From a93e128f26e40505d79735c8afc695c438cec335 Mon Sep 17 00:00:00 2001 From: Leon van Kammen <leonvankammen@gmail.com> Date: Sun, 9 Feb 2025 12:54:37 +0100 Subject: [PATCH] updated aframe to last version to mitigate stencil rendering --- dist/aframe.min.js | 2 +- dist/xrfragment.aframe.all.js | 11 +- dist/xrfragment.aframe.js | 5 + dist/xrfragment.js | 5 + dist/xrfragment.model-viewer.js | 11 +- dist/xrfragment.module.js | 2032 ++++++++++++++++++++++++ dist/xrfragment.plugin.editor.js | 2 +- dist/xrfragment.plugin.frontend.css.js | 2 +- dist/xrfragment.plugin.frontend.js | 2 +- dist/xrfragment.plugin.matrix.js | 2 +- dist/xrfragment.plugin.network.js | 2 +- dist/xrfragment.plugin.p2p.js | 2 +- dist/xrfragment.three.js | 5 + dist/xrfragment.three.module.js | 5 + 14 files changed, 2075 insertions(+), 13 deletions(-) diff --git a/dist/aframe.min.js b/dist/aframe.min.js index 5bde258..430812d 100644 --- a/dist/aframe.min.js +++ b/dist/aframe.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AFRAME=t():e.AFRAME=t()}(self,(()=>(()=>{var e={8167:e=>{var t=Object.prototype.toString;e.exports=function(e){return e.BYTES_PER_ELEMENT&&"[object ArrayBuffer]"===t.call(e.buffer)||Array.isArray(e)}},5734:e=>{e.exports=function(e,t){return"number"==typeof e?e:"number"==typeof t?t:0}},7961:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),n=t[0],i=t[1];return 3*(n+i)/4-i},t.toByteArray=function(e){var t,n,s=a(e),o=s[0],l=s[1],c=new r(function(e,t,n){return 3*(t+n)/4-n}(0,o,l)),h=0,d=l>0?o-4:o;for(n=0;n<d;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],c[h++]=t>>16&255,c[h++]=t>>8&255,c[h++]=255&t;return 2===l&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,c[h++]=255&t),1===l&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,c[h++]=t>>8&255,c[h++]=255&t),c},t.fromByteArray=function(e){for(var t,i=e.length,r=i%3,s=[],o=16383,a=0,c=i-r;a<c;a+=o)s.push(l(e,a,a+o>c?c:a+o));return 1===r?(t=e[i-1],s.push(n[t>>2]+n[t<<4&63]+"==")):2===r&&(t=(e[i-2]<<8)+e[i-1],s.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),s.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)n[o]=s[o],i[s.charCodeAt(o)]=o;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,i){for(var r,s,o=[],a=t;a<i;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(n[(s=r)>>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},911:(e,t,n)=>{var i=n(9922).hp;e.exports=function(e,t){if(i.isBuffer(e)&&i.isBuffer(t)){if("function"==typeof e.equals)return e.equals(t);if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}}},9922:(e,t,n)=>{"use strict";const i=n(7961),r=n(1024),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=l,t.IS=50;const o=2147483647;function a(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return c(e,t,n)}function c(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|f(e,t);let i=a(n);const r=i.write(e,t);return r!==n&&(i=i.slice(0,r)),i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return u(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return p(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return p(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return l.from(i,t,n);const r=function(e){if(l.isBuffer(e)){const t=0|A(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||J(e.length)?a(0):u(e):"Buffer"===e.type&&Array.isArray(e.data)?u(e.data):void 0}(e);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function h(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return h(e),a(e<0?0:0|A(e))}function u(e){const t=e.length<0?0:0|A(e.length),n=a(t);for(let i=0;i<t;i+=1)n[i]=255&e[i];return n}function p(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(i,l.prototype),i}function A(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function f(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;let r=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(e).length;default:if(r)return i?-1:W(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,n);case"utf8":case"utf-8":return M(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return B(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function g(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function v(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=l.from(t,i)),l.isBuffer(t))return 0===t.length?-1:y(e,t,n,i,r);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,i,r){let s,o=1,a=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,n/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(r){let i=-1;for(s=n;s<a;s++)if(c(e,s)===c(t,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===l)return i*o}else-1!==i&&(s-=s-i),i=-1}else for(n+l>a&&(n=a-l),s=n;s>=0;s--){let n=!0;for(let i=0;i<l;i++)if(c(e,s+i)!==c(t,i)){n=!1;break}if(n)return s}return-1}function E(e,t,n,i){n=Number(n)||0;const r=e.length-n;i?(i=Number(i))>r&&(i=r):i=r;const s=t.length;let o;for(i>s/2&&(i=s/2),o=0;o<i;++o){const i=parseInt(t.substr(2*o,2),16);if(J(i))return o;e[n+o]=i}return o}function x(e,t,n,i){return X(W(t,e.length-n),e,n,i)}function b(e,t,n,i){return X(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,i)}function C(e,t,n,i){return X(q(t),e,n,i)}function w(e,t,n,i){return X(function(e,t){let n,i,r;const s=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),i=n>>8,r=n%256,s.push(r),s.push(i);return s}(t,e.length-n),e,n,i)}function _(e,t,n){return 0===t&&n===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,n))}function M(e,t,n){n=Math.min(e.length,n);const i=[];let r=t;for(;r<n;){const t=e[r];let s=null,o=t>239?4:t>223?3:t>191?2:1;if(r+o<=n){let n,i,a,l;switch(o){case 1:t<128&&(s=t);break;case 2:n=e[r+1],128==(192&n)&&(l=(31&t)<<6|63&n,l>127&&(s=l));break;case 3:n=e[r+1],i=e[r+2],128==(192&n)&&128==(192&i)&&(l=(15&t)<<12|(63&n)<<6|63&i,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:n=e[r+1],i=e[r+2],a=e[r+3],128==(192&n)&&128==(192&i)&&128==(192&a)&&(l=(15&t)<<18|(63&n)<<12|(63&i)<<6|63&a,l>65535&&l<1114112&&(s=l))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),r+=o}return function(e){const t=e.length;if(t<=S)return String.fromCharCode.apply(String,e);let n="",i=0;for(;i<t;)n+=String.fromCharCode.apply(String,e.slice(i,i+=S));return n}(i)}l.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,n){return function(e,t,n){return h(e),e<=0?a(e):void 0!==t?"string"==typeof n?a(e).fill(t,n):a(e).fill(t):a(e)}(e,t,n)},l.allocUnsafe=function(e){return d(e)},l.allocUnsafeSlow=function(e){return d(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(Y(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,i=t.length;for(let r=0,s=Math.min(n,i);r<s;++r)if(e[r]!==t[r]){n=e[r],i=t[r];break}return n<i?-1:i<n?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const i=l.allocUnsafe(t);let r=0;for(n=0;n<e.length;++n){let t=e[n];if(Y(t,Uint8Array))r+t.length>i.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(i,r)):Uint8Array.prototype.set.call(i,t,r);else{if(!l.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,r)}r+=t.length}return i},l.byteLength=f,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)g(this,t,t+1);return this},l.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},l.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},l.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?M(this,0,e):m.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){let e="";const n=t.IS;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},s&&(l.prototype[s]=l.prototype.inspect),l.prototype.compare=function(e,t,n,i,r){if(Y(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;let s=(r>>>=0)-(i>>>=0),o=(n>>>=0)-(t>>>=0);const a=Math.min(s,o),c=this.slice(i,r),h=e.slice(t,n);for(let e=0;e<a;++e)if(c[e]!==h[e]){s=c[e],o=h[e];break}return s<o?-1:o<s?1:0},l.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},l.prototype.indexOf=function(e,t,n){return v(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return v(this,e,t,n,!1)},l.prototype.write=function(e,t,n,i){if(void 0===t)i="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)i=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}const r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":case"latin1":case"binary":return b(this,e,t,n);case"base64":return C(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const S=4096;function I(e,t,n){let i="";n=Math.min(e.length,n);for(let r=t;r<n;++r)i+=String.fromCharCode(127&e[r]);return i}function B(e,t,n){let i="";n=Math.min(e.length,n);for(let r=t;r<n;++r)i+=String.fromCharCode(e[r]);return i}function T(e,t,n){const i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);let r="";for(let i=t;i<n;++i)r+=K[e[i]];return r}function R(e,t,n){const i=e.slice(t,n);let r="";for(let e=0;e<i.length-1;e+=2)r+=String.fromCharCode(i[e]+256*i[e+1]);return r}function L(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,n,i,r,s){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<s)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}function P(e,t,n,i,r){z(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function U(e,t,n,i,r){z(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n+7]=s,s>>=8,e[n+6]=s,s>>=8,e[n+5]=s,s>>=8,e[n+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function O(e,t,n,i,r,s){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(e,t,n,i,s){return t=+t,n>>>=0,s||O(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function k(e,t,n,i,s){return t=+t,n>>>=0,s||O(e,0,n,8),r.write(e,t,n,i,52,8),n+8}l.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const i=this.subarray(e,t);return Object.setPrototypeOf(i,l.prototype),i},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let i=this[e],r=1,s=0;for(;++s<t&&(r*=256);)i+=this[e+s]*r;return i},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let i=this[e+--t],r=1;for(;t>0&&(r*=256);)i+=this[e+--t]*r;return i},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=Z((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,r=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(i)+(BigInt(r)<<BigInt(32))})),l.prototype.readBigUInt64BE=Z((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=t*2**24+65536*this[++e]+256*this[++e]+this[++e],r=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(i)<<BigInt(32))+BigInt(r)})),l.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let i=this[e],r=1,s=0;for(;++s<t&&(r*=256);)i+=this[e+s]*r;return r*=128,i>=r&&(i-=Math.pow(2,8*t)),i},l.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let i=t,r=1,s=this[e+--i];for(;i>0&&(r*=256);)s+=this[e+--i]*r;return r*=128,s>=r&&(s-=Math.pow(2,8*t)),s},l.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=Z((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),l.prototype.readBigInt64BE=Z((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),r.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),r.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),r.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),r.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,i){e=+e,t>>>=0,n>>>=0,i||D(this,e,t,n,Math.pow(2,8*n)-1,0);let r=1,s=0;for(this[t]=255&e;++s<n&&(r*=256);)this[t+s]=e/r&255;return t+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,n,i){e=+e,t>>>=0,n>>>=0,i||D(this,e,t,n,Math.pow(2,8*n)-1,0);let r=n-1,s=1;for(this[t+r]=255&e;--r>=0&&(s*=256);)this[t+r]=e/s&255;return t+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=Z((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=Z((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);D(this,e,t,n,i-1,-i)}let r=0,s=1,o=0;for(this[t]=255&e;++r<n&&(s*=256);)e<0&&0===o&&0!==this[t+r-1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+n},l.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);D(this,e,t,n,i-1,-i)}let r=n-1,s=1,o=0;for(this[t+r]=255&e;--r>=0&&(s*=256);)e<0&&0===o&&0!==this[t+r+1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=Z((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=Z((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(e,t,n){return F(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return F(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return k(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return k(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,i){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);const r=i-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),t),r},l.prototype.fill=function(e,t,n,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){const t=e.charCodeAt(0);("utf8"===i&&t<128||"latin1"===i)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let r;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(r=t;r<n;++r)this[r]=e;else{const s=l.isBuffer(e)?e:l.from(e,i),o=s.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(r=0;r<n-t;++r)this[r+t]=s[r%o]}return this};const N={};function Q(e,t,n){N[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function G(e){let t="",n=e.length;const i="-"===e[0]?1:0;for(;n>=i+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function z(e,t,n,i,r,s){if(e>n||e<t){const i="bigint"==typeof t?"n":"";let r;throw r=s>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${t}${i} and <= ${n}${i}`,new N.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,n){H(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||V(t,e.length-(n+1))}(i,r,s)}function H(e,t){if("number"!=typeof e)throw new N.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,n){if(Math.floor(e)!==e)throw H(e,n),new N.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new N.ERR_BUFFER_OUT_OF_BOUNDS;throw new N.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}Q("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),Q("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),Q("ERR_OUT_OF_RANGE",(function(e,t,n){let i=`The value of "${e}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=G(String(n)):"bigint"==typeof n&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=G(r)),r+="n"),i+=` It must be ${t}. Received ${r}`,i}),RangeError);const j=/[^+/0-9A-Za-z-_]/g;function W(e,t){let n;t=t||1/0;const i=e.length;let r=null;const s=[];for(let o=0;o<i;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function q(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(j,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,n,i){let r;for(r=0;r<i&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const K=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const i=16*n;for(let r=0;r<16;++r)t[i+r]=e[n]+e[r]}return t}();function Z(e){return"undefined"==typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},9089:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,i,r,s){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(o[l]=!0)}for(var c=0;c<e.length;c++){var h=[].concat(e[c]);i&&o[h[0]]||(void 0!==s&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=s),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),t.push(h))}},t}},6492:e=>{"use strict";e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},963:e=>{"use strict";e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),s="/*# ".concat(r," */");return[t].concat([s]).join("\n")}return[t].join("\n")}},8878:(e,t,n)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let i=0,r=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(i++,"%c"===e&&(r=i))})),t.splice(r,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(8945)(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},8945:(e,t,n)=>{e.exports=function(e){function t(e){let n,r,s,o=null;function a(...e){if(!a.enabled)return;const i=a,r=Number(new Date),s=r-(n||r);i.diff=s,i.prev=n,i.curr=r,n=r,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,r)=>{if("%%"===n)return"%";o++;const s=t.formatters[r];if("function"==typeof s){const t=e[o];n=s.call(i,t),e.splice(o,1),o--}return n})),t.formatArgs.call(i,e),(i.log||t.log).apply(i,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=i,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(r!==t.namespaces&&(r=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function i(e,n){const i=t(this.namespace+(void 0===n?":":n)+e);return i.log=this.log,i}function r(e,t){let n=0,i=0,r=-1,s=0;for(;n<e.length;)if(i<t.length&&(t[i]===e[n]||"*"===t[i]))"*"===t[i]?(r=i,s=n,i++):(n++,i++);else{if(-1===r)return!1;i=r+1,s++,n=s}for(;i<t.length&&"*"===t[i];)i++;return i===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names,...t.skips.map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").trim().replace(" ",",").split(",").filter(Boolean);for(const e of n)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const n of t.skips)if(r(e,n))return!1;for(const n of t.names)if(r(e,n))return!0;return!1},t.humanize=n(9192),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},1124:(e,t,n)=>{"use strict";var i=n(6240),r=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function o(e,t,n){var s=t[n];if(null!=s){if(r.call(e,n)&&(void 0===e[n]||null===e[n]))throw new TypeError("Cannot convert undefined or null to object ("+n+")");r.call(e,n)&&i(s)?e[n]=a(Object(e[n]),t[n]):e[n]=s}}function a(e,t){if(e===t)return e;for(var n in t=Object(t))r.call(t,n)&&o(e,t,n);if(Object.getOwnPropertySymbols)for(var i=Object.getOwnPropertySymbols(t),a=0;a<i.length;a++)s.call(t,i[a])&&o(e,t,i[a]);return e}e.exports=function(e){e=function(e){if(null==e)throw new TypeError("Sources cannot be null or undefined");return Object(e)}(e);for(var t=1;t<arguments.length;t++)a(e,arguments[t]);return e}},8480:e=>{e.exports=function(e){switch(e){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},919:(e,t,n)=>{var i;i="undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},e.exports=i},1024:(e,t)=>{t.read=function(e,t,n,i,r){var s,o,a=8*r-i-1,l=(1<<a)-1,c=l>>1,h=-7,d=n?r-1:0,u=n?-1:1,p=e[t+d];for(d+=u,s=p&(1<<-h)-1,p>>=-h,h+=a;h>0;s=256*s+e[t+d],d+=u,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=i;h>0;o=256*o+e[t+d],d+=u,h-=8);if(0===s)s=1-c;else{if(s===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),s-=c}return(p?-1:1)*o*Math.pow(2,s-i)},t.write=function(e,t,n,i,r,s){var o,a,l,c=8*s-r-1,h=(1<<c)-1,d=h>>1,u=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,A=i?1:-1,f=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+d>=1?u/l:u*Math.pow(2,1-d))*l>=2&&(o++,l/=2),o+d>=h?(a=0,o=h):o+d>=1?(a=(t*l-1)*Math.pow(2,r),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,r),o=0));r>=8;e[n+p]=255&a,p+=A,a/=256,r-=8);for(o=o<<r|a,c+=r;c>0;e[n+p]=255&o,p+=A,o/=256,c-=8);e[n+p-A]|=128*f}},2225:e=>{function t(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(t(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},8847:e=>{e.exports=function(e){if(!e)return!1;var n=t.call(e);return"[object Function]"===n||"function"==typeof e&&"[object RegExp]"!==n||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var t=Object.prototype.toString},6240:e=>{"use strict";e.exports=function(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}},5651:(e,t,n)=>{var i=n(5406),r=n(4597),s=n(5734),o=["x","e","a","o","n","s","r","c","u","m","v","w","z"],a=["m","w"],l=["H","I","N","E","F","K","L","T","U","V","W","X","Y","Z"],c="\t".charCodeAt(0),h=" ".charCodeAt(0);function d(e){this.glyphs=[],this._measure=this.computeMetrics.bind(this),this.update(e)}function u(e){return new Function(["return function "+e+"() {"," return this._"+e,"}"].join("\n"))()}function p(e,t){if(!e.chars||0===e.chars.length)return null;var n=f(e.chars,t);return n>=0?e.chars[n]:null}function A(e,t,n){if(!e.kernings||0===e.kernings.length)return 0;for(var i=e.kernings,r=0;r<i.length;r++){var s=i[r];if(s.first===t&&s.second===n)return s.amount}return 0}function f(e,t,n){for(var i=n=n||0;i<e.length;i++)if(e[i].id===t)return i;return-1}e.exports=function(e){return new d(e)},d.prototype.update=function(e){if(e=r({measure:this._measure},e),this._opt=e,this._opt.tabSize=s(this._opt.tabSize,4),!e.font)throw new Error("must provide a valid bitmap font");var t=this.glyphs,n=e.text||"",a=e.font;this._setupSpaceGlyphs(a);var c=i.lines(n,e),h=e.width||0;t.length=0;var d=c.reduce((function(e,t){return Math.max(e,t.width,h)}),0),u=0,p=0,m=s(e.lineHeight,a.common.lineHeight),g=a.common.base,v=m-g,y=e.letterSpacing||0,E=m*c.length-v,x=function(e){return"center"===e?1:"right"===e?2:0}(this._opt.align);p-=E,this._width=d,this._height=E,this._descender=m-g,this._baseline=g,this._xHeight=function(e){for(var t=0;t<o.length;t++){var n=o[t].charCodeAt(0),i=f(e.chars,n);if(i>=0)return e.chars[i].height}return 0}(a),this._capHeight=function(e){for(var t=0;t<l.length;t++){var n=l[t].charCodeAt(0),i=f(e.chars,n);if(i>=0)return e.chars[i].height}return 0}(a),this._lineHeight=m,this._ascender=m-v-this._xHeight;var b=this;c.forEach((function(e,i){for(var r,s=e.start,o=e.end,l=e.width,c=s;c<o;c++){var h=n.charCodeAt(c),f=b.getGlyph(a,h);if(f){r&&(u+=A(a,r.id,f.id));var g=u;1===x?g+=(d-l)/2:2===x&&(g+=d-l),t.push({position:[g,p],data:f,index:c,line:i}),u+=f.xadvance+y,r=f}}p+=m,u=0})),this._linesTotal=c.length},d.prototype._setupSpaceGlyphs=function(e){if(this._fallbackSpaceGlyph=null,this._fallbackTabGlyph=null,e.chars&&0!==e.chars.length){var t=p(e,h)||function(e){for(var t=0;t<a.length;t++){var n=a[t].charCodeAt(0),i=f(e.chars,n);if(i>=0)return e.chars[i]}return 0}(e)||e.chars[0],n=this._opt.tabSize*t.xadvance;this._fallbackSpaceGlyph=t,this._fallbackTabGlyph=r(t,{x:0,y:0,xadvance:n,id:c,xoffset:0,yoffset:0,width:0,height:0})}},d.prototype.getGlyph=function(e,t){return p(e,t)||(t===c?this._fallbackTabGlyph:t===h?this._fallbackSpaceGlyph:null)},d.prototype.computeMetrics=function(e,t,n,i){var r,s=this._opt.letterSpacing||0,o=this._opt.font,a=0,l=0,c=0;if(!o.chars||0===o.chars.length)return{start:t,end:t,width:0};n=Math.min(e.length,n);for(var h=t;h<n;h++){var d,u=e.charCodeAt(h);if(d=this.getGlyph(o,u)){d.xoffset;var p=(a+=r?A(o,r.id,d.id):0)+d.xadvance+s,f=a+d.width;if(f>=i||p>=i)break;a=p,l=f,r=d}c++}return r&&(l+=r.xoffset),{start:t,end:t+c,width:l}},["width","height","descender","ascender","xHeight","baseline","capHeight","lineHeight"].forEach((function(e){Object.defineProperty(d.prototype,e,{get:u(e),configurable:!0})}))},5751:(e,t,n)=>{var i=n(9922).hp,r=n(3558),s=function(){},o=n(1476),a=n(7034),l=n(7480),c=n(573),h=n(4597),d=self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;e.exports=function(e,t){t="function"==typeof t?t:s,"string"==typeof e?e={uri:e}:e||(e={}),e.binary&&(e=function(e){if(d)return h(e,{responseType:"arraybuffer"});if(void 0===self.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var t=new self.XMLHttpRequest;return t.overrideMimeType("text/plain; charset=x-user-defined"),h({xhr:t},e)}(e)),r(e,(function(n,r,h){if(n)return t(n);if(!/^2/.test(r.statusCode))return t(new Error("http status code: "+r.statusCode));if(!h)return t(new Error("no body result"));var d,u,p=!1;if(d=h,"[object ArrayBuffer]"===Object.prototype.toString.call(d)){var A=new Uint8Array(h);h=i.from(A,"binary")}c(h)&&(p=!0,"string"==typeof h&&(h=i.from(h,"binary"))),p||(i.isBuffer(h)&&(h=h.toString(e.encoding)),h=h.trim());try{var f=r.headers["content-type"];u=p?l(h):/json/.test(f)||"{"===h.charAt(0)?JSON.parse(h):/xml/.test(f)||"<"===h.charAt(0)?a(h):o(h)}catch(e){t(new Error("error parsing font "+e.message)),t=s}t(null,u)}))}},573:(e,t,n)=>{var i=n(9922).hp,r=n(911),s=i.from([66,77,70,3]);e.exports=function(e){return"string"==typeof e?"BMF"===e.substring(0,3):e.length>4&&r(e.slice(0,4),s)}},9192:e=>{var t=1e3,n=60*t,i=60*n,r=24*i,s=7*r;function o(e,t,n,i){var r=t>=1.5*n;return Math.round(e/n)+" "+i+(r?"s":"")}e.exports=function(e,a){a=a||{};var l,c,h=typeof e;if("string"===h&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(o){var a=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return a*s;case"days":case"day":case"d":return a*r;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(e);if("number"===h&&isFinite(e))return a.long?(l=e,(c=Math.abs(l))>=r?o(l,c,r,"day"):c>=i?o(l,c,i,"hour"):c>=n?o(l,c,n,"minute"):c>=t?o(l,c,t,"second"):l+" ms"):function(e){var s=Math.abs(e);return s>=r?Math.round(e/r)+"d":s>=i?Math.round(e/i)+"h":s>=n?Math.round(e/n)+"m":s>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},1476:e=>{function t(e,t){if(!(e=e.replace(/\t+/g," ").trim()))return null;var i=e.indexOf(" ");if(-1===i)throw new Error("no named row at line "+t);var r=e.substring(0,i);e=(e=(e=(e=e.substring(i+1)).replace(/letter=[\'\"]\S+[\'\"]/gi,"")).split("=")).map((function(e){return e.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)}));for(var s=[],o=0;o<e.length;o++){var a=e[o];0===o?s.push({key:a[0],data:""}):o===e.length-1?s[s.length-1].data=n(a[0]):(s[s.length-1].data=n(a[0]),s.push({key:a[1],data:""}))}var l={key:r,data:{}};return s.forEach((function(e){l.data[e.key]=e.data})),l}function n(e){return e&&0!==e.length?0===e.indexOf('"')||0===e.indexOf("'")?e.substring(1,e.length-1):-1!==e.indexOf(",")?function(e){return e.split(",").map((function(e){return parseInt(e,10)}))}(e):parseInt(e,10):""}e.exports=function(e){if(!e)throw new Error("no data provided");var n={pages:[],chars:[],kernings:[]},i=(e=e.toString().trim()).split(/\r\n?|\n/g);if(0===i.length)throw new Error("no data in BMFont file");for(var r=0;r<i.length;r++){var s=t(i[r],r);if(s)if("page"===s.key){if("number"!=typeof s.data.id)throw new Error("malformed file at line "+r+" -- needs page id=N");if("string"!=typeof s.data.file)throw new Error("malformed file at line "+r+' -- needs page file="path"');n.pages[s.data.id]=s.data.file}else"chars"===s.key||"kernings"===s.key||("char"===s.key?n.chars.push(s.data):"kerning"===s.key?n.kernings.push(s.data):n[s.key]=s.data)}return n}},7480:e=>{var t=[66,77,70];function n(e,t,n){if(n>t.length-1)return 0;var r=t.readUInt8(n++),s=t.readInt32LE(n);switch(n+=4,r){case 1:e.info=function(e,t){var n={};n.size=e.readInt16LE(t);var r=e.readUInt8(t+2);return n.smooth=r>>7&1,n.unicode=r>>6&1,n.italic=r>>5&1,n.bold=r>>4&1,r>>3&1&&(n.fixedHeight=1),n.charset=e.readUInt8(t+3)||"",n.stretchH=e.readUInt16LE(t+4),n.aa=e.readUInt8(t+6),n.padding=[e.readInt8(t+7),e.readInt8(t+8),e.readInt8(t+9),e.readInt8(t+10)],n.spacing=[e.readInt8(t+11),e.readInt8(t+12)],n.outline=e.readUInt8(t+13),n.face=function(e,t){return i(e,t).toString("utf8")}(e,t+14),n}(t,n);break;case 2:e.common=function(e,t){var n={};return n.lineHeight=e.readUInt16LE(t),n.base=e.readUInt16LE(t+2),n.scaleW=e.readUInt16LE(t+4),n.scaleH=e.readUInt16LE(t+6),n.pages=e.readUInt16LE(t+8),e.readUInt8(t+10),n.packed=0,n.alphaChnl=e.readUInt8(t+11),n.redChnl=e.readUInt8(t+12),n.greenChnl=e.readUInt8(t+13),n.blueChnl=e.readUInt8(t+14),n}(t,n);break;case 3:e.pages=function(e,t,n){for(var r=[],s=i(e,t),o=s.length+1,a=n/o,l=0;l<a;l++)r[l]=e.slice(t,t+s.length).toString("utf8"),t+=o;return r}(t,n,s);break;case 4:e.chars=function(e,t,n){for(var i=[],r=n/20,s=0;s<r;s++){var o={},a=20*s;o.id=e.readUInt32LE(t+0+a),o.x=e.readUInt16LE(t+4+a),o.y=e.readUInt16LE(t+6+a),o.width=e.readUInt16LE(t+8+a),o.height=e.readUInt16LE(t+10+a),o.xoffset=e.readInt16LE(t+12+a),o.yoffset=e.readInt16LE(t+14+a),o.xadvance=e.readInt16LE(t+16+a),o.page=e.readUInt8(t+18+a),o.chnl=e.readUInt8(t+19+a),i[s]=o}return i}(t,n,s);break;case 5:e.kernings=function(e,t,n){for(var i=[],r=n/10,s=0;s<r;s++){var o={},a=10*s;o.first=e.readUInt32LE(t+0+a),o.second=e.readUInt32LE(t+4+a),o.amount=e.readInt16LE(t+8+a),i[s]=o}return i}(t,n,s)}return 5+s}function i(e,t){for(var n=t;n<e.length&&0!==e[n];n++);return e.slice(t,n)}e.exports=function(e){if(e.length<6)throw new Error("invalid buffer length for BMFont");var i=t.every((function(t,n){return e.readUInt8(n)===t}));if(!i)throw new Error("BMFont missing BMF byte header");var r=3;if(e.readUInt8(r++)>3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var s={kernings:[],chars:[]},o=0;o<5;o++)r+=n(s,e,r);return s}},7034:(e,t,n)=>{var i=n(7829),r=n(1896),s={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"};function o(e){var t=function(e){for(var t=[],n=0;n<e.attributes.length;n++)t.push(e.attributes[n]);return t}(e);return t.reduce((function(e,t){var n;return e[(n=t.nodeName,s[n.toLowerCase()]||n)]=t.nodeValue,e}),{})}e.exports=function(e){e=e.toString();var t=r(e),n={pages:[],chars:[],kernings:[]};["info","common"].forEach((function(e){var r=t.getElementsByTagName(e)[0];r&&(n[e]=i(o(r)))}));var s=t.getElementsByTagName("pages")[0];if(!s)throw new Error("malformed file -- no <pages> element");for(var a=s.getElementsByTagName("page"),l=0;l<a.length;l++){var c=a[l],h=parseInt(c.getAttribute("id"),10),d=c.getAttribute("file");if(isNaN(h))throw new Error('malformed file -- page "id" attribute is NaN');if(!d)throw new Error('malformed file -- needs page "file" attribute');n.pages[parseInt(h,10)]=d}return["chars","kernings"].forEach((function(e){var r=t.getElementsByTagName(e)[0];if(r)for(var s=e.substring(0,e.length-1),a=r.getElementsByTagName(s),l=0;l<a.length;l++){var c=a[l];n[e].push(i(o(c)))}})),n}},7829:e=>{var t="chasrset";e.exports=function(e){for(var n in e=Object.assign({},e),t in e&&(e.charset=e[t],delete e[t]),e)"face"!==n&&"charset"!==n&&(e[n]="padding"===n||"spacing"===n?e[n].split(",").map((function(e){return parseInt(e,10)})):parseInt(e[n],10));return e}},3216:e=>{var t=function(e){return e.replace(/^\s+|\s+$/g,"")};e.exports=function(e){if(!e)return{};for(var n,i={},r=t(e).split("\n"),s=0;s<r.length;s++){var o=r[s],a=o.indexOf(":"),l=t(o.slice(0,a)).toLowerCase(),c=t(o.slice(a+1));void 0===i[l]?i[l]=c:(n=i[l],"[object Array]"===Object.prototype.toString.call(n)?i[l].push(c):i[l]=[i[l],c])}return i}},9035:(e,t,n)=>{var i=n(8480),r=n(8167),s=n(2225),o=[0,2,3],a=[2,1,3];e.exports=function(e,t){e&&(r(e)||s(e))||(t=e||{},e=null);for(var n="string"==typeof(t="number"==typeof t?{count:t}:t||{}).type?t.type:"uint16",l="number"==typeof t.count?t.count:1,c=t.start||0,h=!1!==t.clockwise?o:a,d=h[0],u=h[1],p=h[2],A=6*l,f=e||new(i(n))(A),m=0,g=0;m<A;m+=6,g+=4){var v=m+c;f[v+0]=g+0,f[v+1]=g+1,f[v+2]=g+2,f[v+3]=g+d,f[v+4]=g+u,f[v+5]=g+p}return f}},4635:(e,t,n)=>{"use strict";n.d(t,{A:()=>ve});var i={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},r={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},s=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective"],o={CSS:{},springs:{}};function a(e,t,n){return Math.min(Math.max(e,t),n)}function l(e,t){return e.indexOf(t)>-1}function c(e,t){return e.apply(null,t)}var h=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,d=/^rgb/,u=/^hsl/,p={arr:function(e){return Array.isArray(e)},obj:function(e){return l(Object.prototype.toString.call(e),"Object")},pth:function(e){return p.obj(e)&&e.hasOwnProperty("totalLength")},svg:function(e){return e instanceof SVGElement},inp:function(e){return e instanceof HTMLInputElement},dom:function(e){return e.nodeType||p.svg(e)},str:function(e){return"string"==typeof e},fnc:function(e){return"function"==typeof e},und:function(e){return void 0===e},hex:function(e){return h.test(e)},rgb:function(e){return d.test(e)},hsl:function(e){return u.test(e)},col:function(e){return p.hex(e)||p.rgb(e)||p.hsl(e)},key:function(e){return!i.hasOwnProperty(e)&&!r.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}},A=/\(([^)]+)\)/;function f(e){var t=A.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function m(e,t){var n=f(e),i=a(p.und(n[0])?1:n[0],.1,100),r=a(p.und(n[1])?100:n[1],.1,100),s=a(p.und(n[2])?10:n[2],.1,100),l=a(p.und(n[3])?0:n[3],.1,100),c=Math.sqrt(r/i),h=s/(2*Math.sqrt(r*i)),d=h<1?c*Math.sqrt(1-h*h):0,u=h<1?(h*c-l)/d:-l+c;function A(e){var n=t?t*e/1e3:e;return n=h<1?Math.exp(-n*h*c)*(1*Math.cos(d*n)+u*Math.sin(d*n)):(1+u*n)*Math.exp(-n*c),0===e||1===e?e:1-n}return t?A:function(){var t=o.springs[e];if(t)return t;for(var n=1/6,i=0,r=0;;)if(1===A(i+=n)){if(++r>=16)break}else r=0;var s=i*n*1e3;return o.springs[e]=s,s}}function g(e,t){void 0===e&&(e=1),void 0===t&&(t=.5);var n=a(e,1,10),i=a(t,.1,2);return function(e){return 0===e||1===e?e:-n*Math.pow(2,10*(e-1))*Math.sin((e-1-i/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/i)}}function v(e){return void 0===e&&(e=10),function(t){return Math.round(t*e)*(1/e)}}var y=function(){var e=.1;function t(e,t){return 1-3*t+3*e}function n(e,t){return 3*t-6*e}function i(e){return 3*e}function r(e,r,s){return((t(r,s)*e+n(r,s))*e+i(r))*e}function s(e,r,s){return 3*t(r,s)*e*e+2*n(r,s)*e+i(r)}return function(t,n,i,o){if(0<=t&&t<=1&&0<=i&&i<=1){var a=new Float32Array(11);if(t!==n||i!==o)for(var l=0;l<11;++l)a[l]=r(l*e,t,i);return function(l){return t===n&&i===o||0===l||1===l?l:r(function(n){for(var o=0,l=1;10!==l&&a[l]<=n;++l)o+=e;--l;var c=o+(n-a[l])/(a[l+1]-a[l])*e,h=s(c,t,i);return h>=.001?function(e,t,n,i){for(var o=0;o<4;++o){var a=s(t,n,i);if(0===a)return t;t-=(r(t,n,i)-e)/a}return t}(n,c,t,i):0===h?c:function(e,t,n,i,s){var o,a,l=0;do{(o=r(a=t+(n-t)/2,i,s)-e)>0?n=a:t=a}while(Math.abs(o)>1e-7&&++l<10);return a}(n,o,o+e,t,i)}(l),n,o)}}}}(),E=function(){var e=["Quad","Cubic","Quart","Quint","Sine","Expo","Circ","Back","Elastic"],t={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],g],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(e,t){return function(n){return 1-g(e,t)(1-n)}}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(e,t){return function(n){return n<.5?g(e,t)(2*n)/2:1-g(e,t)(-2*n+2)/2}}]},n={linear:[.25,.25,.75,.75]};for(var i in t)for(var r=0,s=t[i].length;r<s;r++)n["ease"+i+e[r]]=t[i][r];return n}();function x(e,t){if(p.fnc(e))return e;var n=e.split("(")[0],i=E[n],r=f(e);switch(n){case"spring":return m(e,t);case"cubicBezier":return c(y,r);case"steps":return c(v,r);default:return p.fnc(i)?c(i,r):c(y,i)}}function b(e){try{return document.querySelectorAll(e)}catch(e){return}}var C=[];function w(e,t){for(var n=C,i=e.length,r=arguments.length>=2?arguments[1]:void 0,s=0;s<i;s++)if(s in e){var o=e[s];t.call(r,o,s,e)&&n.push(o)}return(C=e).length=0,n}function _(e,t){t||(t=[]);for(var n=0,i=e.length;n<i;n++){var r=e[n];Array.isArray(r)?_(r,t):t.push(r)}return t}function M(e){return p.arr(e)?e:(p.str(e)&&(e=b(e)||e),e instanceof NodeList||e instanceof HTMLCollection?[].slice.call(e):[e])}function S(e,t){return e.some((function(e){return e===t}))}function I(e){var t={};for(var n in e)t[n]=e[n];return t}function B(e,t){var n=I(e);for(var i in e)n[i]=t.hasOwnProperty(i)?t[i]:e[i];return n}function T(e,t){var n=I(e);for(var i in t)n[i]=p.und(e[i])?t[i]:e[i];return n}var R=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g,L=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,D=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,P=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g,U=/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g;var O=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/;function F(e){var t=O.exec(e);if(t)return t[2]}function k(e,t){return p.fnc(e)?e(t.target,t.id,t.total):e}function N(e,t){return e.getAttribute(t)}function Q(e,t,n){if(S([n,"deg","rad","turn"],F(t)))return t;var i=o.CSS[t+n];if(!p.und(i))return i;var r=document.createElement(e.tagName),s=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;s.appendChild(r),r.style.position="absolute",r.style.width=100+n;var a=100/r.offsetWidth;s.removeChild(r);var l=a*parseFloat(t);return o.CSS[t+n]=l,l}function G(e,t,n){if(t in e.style){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=e.style[t]||getComputedStyle(e).getPropertyValue(i)||"0";return n?Q(e,r,n):r}}function z(e,t){return p.dom(e)&&!p.inp(e)&&(N(e,t)||p.svg(e)&&e[t])?"attribute":p.dom(e)&&S(s,t)?"transform":p.dom(e)&&"transform"!==t&&G(e,t)?"css":null!=e[t]?"object":void 0}var H=/(\w+)\(([^)]*)\)/g;function V(e){if(p.dom(e)){for(var t,n=e.style.transform||"",i=new Map;t=H.exec(n);)i.set(t[1],t[2]);return i}}function j(e,t,n,i){switch(z(e,t)){case"transform":return function(e,t,n,i){var r=l(t,"scale")?1:0+function(e){return l(e,"translate")||"perspective"===e?"px":l(e,"rotate")||l(e,"skew")?"deg":void 0}(t),s=V(e).get(t)||r;return n&&(n.transforms.list.set(t,s),n.transforms.last=t),i?Q(e,s,i):s}(e,t,i,n);case"css":return G(e,t,n);case"attribute":return N(e,t);default:return e[t]||0}}var W=/^(\*=|\+=|-=)/;function q(e,t){var n=W.exec(e);if(!n)return e;var i=F(e)||0,r=parseFloat(t),s=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return r+s+i;case"-":return r-s+i;case"*":return r*s+i}}var X=/\s/g;function Y(e,t){if(p.col(e))return function(e){return p.rgb(e)?(t=e,(n=R.exec(t))?"rgba("+n[1]+",1)":t):p.hex(e)?function(e){var t=e.replace(L,(function(e,t,n,i){return t+t+n+n+i+i})),n=D.exec(t);return"rgba("+parseInt(n[1],16)+","+parseInt(n[2],16)+","+parseInt(n[3],16)+",1)"}(e):p.hsl(e)?function(e){var t,n,i,r=P.exec(e)||U.exec(e),s=parseInt(r[1],10)/360,o=parseInt(r[2],10)/100,a=parseInt(r[3],10)/100,l=r[4]||1;function c(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+(t-e)*(2/3-n)*6:e}if(0==o)t=n=i=a;else{var h=a<.5?a*(1+o):a+o-a*o,d=2*a-h;t=c(d,h,s+1/3),n=c(d,h,s),i=c(d,h,s-1/3)}return"rgba("+255*t+","+255*n+","+255*i+","+l+")"}(e):void 0;var t,n}(e);var n=F(e),i=n?e.substr(0,e.length-n.length):e;return t&&!X.test(e)?i+t:i}function J(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function K(e){for(var t,n=e.points,i=0,r=0;r<n.numberOfItems;r++){var s=n.getItem(r);r>0&&(i+=J(t,s)),t=s}return i}function Z(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*N(e,"r")}(e);case"rect":return function(e){return 2*N(e,"width")+2*N(e,"height")}(e);case"line":return function(e){return J({x:N(e,"x1"),y:N(e,"y1")},{x:N(e,"x2"),y:N(e,"y2")})}(e);case"polyline":return K(e);case"polygon":return function(e){var t=e.points;return K(e)+J(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function $(e,t){var n=t||{},i=n.el||function(e){for(var t=e.parentNode;p.svg(t)&&(t=t.parentNode,p.svg(t.parentNode)););return t}(e),r=i.getBoundingClientRect(),s=N(i,"viewBox"),o=r.width,a=r.height,l=n.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:i,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function ee(e,t){function n(n){void 0===n&&(n=0);var i=t+n>=1?t+n:0;return e.el.getPointAtLength(i)}var i=$(e.el,e.svg),r=n(),s=n(-1),o=n(1);switch(e.property){case"x":return(r.x-i.x)*i.w;case"y":return(r.y-i.y)*i.h;case"angle":return 180*Math.atan2(o.y-s.y,o.x-s.x)/Math.PI}}var te=/-?\d*\.?\d+/g;function ne(e,t){var n=Y(p.pth(e)?e.totalLength:e,t)+"";return{original:n,numbers:n.match(te)?n.match(te).map(Number):[0],strings:p.str(e)||t?n.split(te):[]}}function ie(e){return w(e?_(p.arr(e)?e.map(M):M(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function re(e){var t=ie(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:V(e)}}}))}var se=/^spring/;function oe(e,t){var n=I(t);if(se.test(n.easing)&&(n.duration=m(n.easing)),p.arr(e)){var i=e.length;2!==i||p.obj(e[0])?p.fnc(t.duration)||(n.duration=t.duration/i):e={value:e}}var r=p.arr(e)?e:[e];return r.map((function(e,n){var i=p.obj(e)&&!p.pth(e)?e:{value:e};return p.und(i.delay)&&(i.delay=n?0:t.delay),p.und(i.endDelay)&&(i.endDelay=n===r.length-1?t.endDelay:0),i})).map((function(e){return T(e,n)}))}var ae={css:function(e,t,n){return e.style[t]=n},attribute:function(e,t,n){return e.setAttribute(t,n)},object:function(e,t,n){return e[t]=n},transform:function(e,t,n,i,r){if(i.list.set(t,n),t===i.last||r){var s="";i.list.forEach((function(e,t){s+=t+"("+e+") "})),e.style.transform=s}}};function le(e,t){for(var n=re(e),i=0,r=n.length;i<r;i++){var s=n[i];for(var o in t){var a=k(t[o],s),l=s.target,c=F(a),h=j(l,o,c,s),d=q(Y(a,c||F(h)),h),u=z(l,o);ae[u](l,o,d,s.transforms,!0)}}}function ce(e,t){return w(_(e.map((function(e){return t.map((function(t){return function(e,t){var n=z(e.target,t.name);if(n){var i=function(e,t){var n;return e.tweens.map((function(i){var r=function(e,t){var n={};for(var i in e){var r=k(e[i],t);p.arr(r)&&1===(r=r.map((function(e){return k(e,t)}))).length&&(r=r[0]),n[i]=r}return n.duration=parseFloat(n.duration),n.delay=parseFloat(n.delay),n}(i,t),s=r.value,o=p.arr(s)?s[1]:s,a=F(o),l=j(t.target,e.name,a,t),c=n?n.to.original:l,h=p.arr(s)?s[0]:c,d=F(h)||F(l),u=a||d;return p.und(o)&&(o=c),r.from=ne(h,u),r.to=ne(q(o,h),u),r.start=n?n.end:0,r.end=r.start+r.delay+r.duration+r.endDelay,r.easing=x(r.easing,r.duration),r.isPath=p.pth(s),r.isColor=p.col(r.from.original),r.isColor&&(r.round=1),n=r,r}))}(t,e),r=i[i.length-1];return{type:n,property:t.name,animatable:e,tweens:i,duration:r.end,delay:i[0].delay,endDelay:r.endDelay}}}(e,t)}))}))),(function(e){return!p.und(e)}))}function he(e,t){var n=e.length,i=function(e){return e.timelineOffset?e.timelineOffset:0},r={};return r.duration=n?Math.max.apply(Math,e.map((function(e){return i(e)+e.duration}))):t.duration,r.delay=n?Math.min.apply(Math,e.map((function(e){return i(e)+e.delay}))):t.delay,r.endDelay=n?r.duration-Math.max.apply(Math,e.map((function(e){return i(e)+e.duration-e.endDelay}))):t.endDelay,r}var de,ue=0,pe=[],Ae=[],fe=function(){function e(){de=requestAnimationFrame(t)}function t(t){var n=pe.length;if(n){for(var i=0;i<n;){var r=pe[i];if(r.paused){var s=pe.indexOf(r);s>-1&&(pe.splice(s,1),n=pe.length)}else r.tick(t);i++}e()}else de=cancelAnimationFrame(de)}return e}();function me(e){void 0===e&&(e={});var t,n=0,s=0,o=0,l=0,c=null;function h(){return window.Promise&&new Promise((function(e){return c=e}))}var d=h(),u=function(e){var t=B(i,e),n=B(r,e),s=function(e,t){var n=[],i=t.keyframes;for(var r in i&&(t=T(function(e){for(var t=w(_(e.map((function(e){return Object.keys(e)}))),(function(e){return p.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},i=function(i){var r=t[i];n[r]=e.map((function(e){var t={};for(var n in e)p.key(n)?n==r&&(t.value=e[n]):t[n]=e[n];return t}))},r=0;r<t.length;r++)i(r);return n}(i),t)),t)p.key(r)&&n.push({name:r,tweens:oe(t[r],e)});return n}(n,e),o=re(e.targets),a=ce(o,s),l=he(a,n),c=ue;return ue++,T(t,{id:c,children:[],animatables:o,animations:a,duration:l.duration,delay:l.delay,endDelay:l.endDelay})}(e);function A(){u.reversed=!u.reversed;for(var e=0,n=t.length;e<n;e++)t[e].reversed=u.reversed}function f(e){return u.reversed?u.duration-e:e}function m(){n=0,s=f(u.currentTime)*(1/me.speed)}function g(e,t){t&&t.seek(e-t.timelineOffset)}function v(e){for(var t=0,n=u.animations,i=n.length;t<i;){var r=n[t],s=r.animatable,o=r.tweens,l=o.length-1,c=o[l];l&&(c=w(o,(function(t){return e<t.end}))[0]||c);for(var h=a(e-c.start-c.delay,0,c.duration)/c.duration,d=isNaN(h)?1:c.easing(h),p=c.to.strings,A=c.round,f=[],m=c.to.numbers.length,g=void 0,v=0;v<m;v++){var y=void 0,E=c.to.numbers[v],x=c.from.numbers[v]||0;y=c.isPath?ee(c.value,d*E):x+d*(E-x),A&&(c.isColor&&v>2||(y=Math.round(y*A)/A)),f.push(y)}var b=p.length;if(b){g=p[0];for(var C=0;C<b;C++){p[C];var _=p[C+1],M=f[C];isNaN(M)||(g+=_?M+_:M+" ")}}else g=f[0];ae[r.type](s.target,r.property,g,s.transforms),r.currentValue=g,t++}}function y(e){u[e]&&!u.passThrough&&u[e](u)}function E(e){var i=u.duration,r=u.delay,p=i-u.endDelay,m=f(e);u.progress=a(m/i*100,0,100),u.reversePlayback=m<u.currentTime,t&&function(e){if(u.reversePlayback)for(var n=l;n--;)g(e,t[n]);else for(var i=0;i<l;i++)g(e,t[i])}(m),!u.began&&u.currentTime>0&&(u.began=!0,y("begin"),y("loopBegin")),m<=r&&0!==u.currentTime&&v(0),(m>=p&&u.currentTime!==i||!i)&&v(i),m>r&&m<p?(u.changeBegan||(u.changeBegan=!0,u.changeCompleted=!1,y("changeBegin")),y("change"),v(m)):u.changeBegan&&(u.changeCompleted=!0,u.changeBegan=!1,y("changeComplete")),u.currentTime=a(m,0,i),u.began&&y("update"),e>=i&&(s=0,u.remaining&&!0!==u.remaining&&u.remaining--,u.remaining?(n=o,y("loopComplete"),y("loopBegin"),"alternate"===u.direction&&A()):(u.paused=!0,u.completed||(u.completed=!0,y("loopComplete"),y("complete"),"Promise"in window&&(c(),d=h()))))}return u.reset=function(){var e=u.direction;u.passThrough=!1,u.currentTime=0,u.progress=0,u.paused=!0,u.began=!1,u.changeBegan=!1,u.completed=!1,u.changeCompleted=!1,u.reversePlayback=!1,u.reversed="reverse"===e,u.remaining=u.loop,t=u.children;for(var n=l=t.length;n--;)u.children[n].reset();(u.reversed&&!0!==u.loop||"alternate"===e&&1===u.loop)&&u.remaining++,v(0)},u.set=function(e,t){return le(e,t),u},u.tick=function(e){o=e,n||(n=o),E((o+(s-n))*me.speed)},u.seek=function(e){E(f(e))},u.pause=function(){u.paused=!0,m()},u.play=function(){u.paused&&(u.paused=!1,pe.push(u),m(),de||fe())},u.reverse=function(){A(),m()},u.restart=function(){u.reset(),u.play()},u.finished=d,u.reset(),u.autoplay&&u.play(),u}function ge(e,t){for(var n=t.length;n--;)S(e,t[n].animatable.target)&&t.splice(n,1)}document.addEventListener("visibilitychange",(function(){if(document.hidden){for(var e=0,t=pe.length;e<t;e++)activeInstance[e].pause();Ae=pe.slice(0),pe=[]}else for(var n=0,i=Ae.length;n<i;n++)Ae[n].play()})),me.version="3.0.0",me.speed=1,me.running=pe,me.remove=function(e){for(var t=ie(e),n=pe.length;n--;){var i=pe[n],r=i.animations,s=i.children;ge(t,r);for(var o=s.length;o--;){var a=s[o],l=a.animations;ge(t,l),l.length||a.children.length||s.splice(o,1)}r.length||s.length||i.pause()}},me.get=j,me.set=le,me.convertPx=Q,me.path=function(e,t){var n=p.str(e)?b(e)[0]:e,i=t||100;return function(e){return{property:e,el:n,svg:$(n),totalLength:Z(n)*(i/100)}}},me.setDashoffset=function(e){var t=Z(e);return e.setAttribute("stroke-dasharray",t),t},me.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",i=t.easing?x(t.easing):null,r=t.grid,s=t.axis,o=t.from||0,a="first"===o,l="center"===o,c="last"===o,h=p.arr(e),d=h?parseFloat(e[0]):parseFloat(e),u=h?parseFloat(e[1]):0,A=F(h?e[1]:e)||0,f=t.start||0+(h?d:0),m=[],g=0;return function(e,t,p){if(a&&(o=0),l&&(o=(p-1)/2),c&&(o=p-1),!m.length){for(var v=0;v<p;v++){if(r){var y=l?(r[0]-1)/2:o%r[0],E=l?(r[1]-1)/2:Math.floor(o/r[0]),x=y-v%r[0],b=E-Math.floor(v/r[0]),C=Math.sqrt(x*x+b*b);"x"===s&&(C=-x),"y"===s&&(C=-b),m.push(C)}else m.push(Math.abs(o-v));g=Math.max.apply(Math,m)}i&&(m=m.map((function(e){return i(e/g)*g}))),"reverse"===n&&(m=m.map((function(e){return s?e<0?-1*e:-e:Math.abs(g-e)})))}return f+(h?(u-d)/g:d)*(Math.round(100*m[t])/100)+A}},me.timeline=function(e){void 0===e&&(e={});var t=me(e);return t.duration=0,t.add=function(n,i){var s=pe.indexOf(t),o=t.children;function a(e){e.passThrough=!0}s>-1&&pe.splice(s,1);for(var l=0;l<o.length;l++)a(o[l]);var c=T(n,B(r,e));c.targets=c.targets||e.targets;var h=t.duration;c.autoplay=!1,c.direction=t.direction,c.timelineOffset=p.und(i)?h:q(i,h),a(t),t.seek(c.timelineOffset);var d=me(c);a(d),o.push(d);var u=he(o,e);return t.delay=u.delay,t.endDelay=u.endDelay,t.duration=u.duration,t.seek(0),t.reset(),t.autoplay&&t.play(),t},t},me.easing=x,me.penner=E,me.random=function(e,t){return Math.floor(Math.random()*(t-e+1))+e};const ve=me},4433:(e,t,n)=>{var i=n(5651),r=n(9035),s=n(7106),o=n(1684);e.exports=function(e){return new a(e)};class a extends THREE.BufferGeometry{constructor(e){super(),"string"==typeof e&&(e={text:e}),this._opt=Object.assign({},e),e&&this.update(e)}update(e){if("string"==typeof e&&(e={text:e}),!(e=Object.assign({},this._opt,e)).font)throw new TypeError("must specify a { font } in options");this.layout=i(e);var t=!1!==e.flipY,n=e.font,o=n.common.scaleW,a=n.common.scaleH,l=this.layout.glyphs.filter((function(e){var t=e.data;return t.width*t.height>0}));this.visibleGlyphs=l;var c=s.positions(l),h=s.uvs(l,o,a,t),d=r([],{clockwise:!0,type:"uint16",count:l.length});if(this.setIndex(d),this.setAttribute("position",new THREE.BufferAttribute(c,2)),this.setAttribute("uv",new THREE.BufferAttribute(h,2)),!e.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(e.multipage){var u=s.pages(l);this.setAttribute("page",new THREE.BufferAttribute(u,1))}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var e=this.attributes.position.array,t=this.attributes.position.itemSize;if(!e||!t||e.length<2)return this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0);o.computeSphere(e,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var e=this.boundingBox,t=this.attributes.position.array,n=this.attributes.position.itemSize;!t||!n||t.length<2?e.makeEmpty():o.computeBox(t,e)}}},1684:e=>{var t={min:[0,0],max:[0,0]};function n(e){var n=e.length/2;t.min[0]=e[0],t.min[1]=e[1],t.max[0]=e[0],t.max[1]=e[1];for(var i=0;i<n;i++){var r=e[2*i+0],s=e[2*i+1];t.min[0]=Math.min(r,t.min[0]),t.min[1]=Math.min(s,t.min[1]),t.max[0]=Math.max(r,t.max[0]),t.max[1]=Math.max(s,t.max[1])}}e.exports.computeBox=function(e,i){n(e),i.min.set(t.min[0],t.min[1],0),i.max.set(t.max[0],t.max[1],0)},e.exports.computeSphere=function(e,i){n(e);var r=t.min[0],s=t.min[1],o=t.max[0]-r,a=t.max[1]-s,l=Math.sqrt(o*o+a*a);i.center.set(r+o/2,s+a/2,0),i.radius=l/2}},7106:e=>{e.exports.pages=function(e){var t=new Float32Array(4*e.length*1),n=0;return e.forEach((function(e){var i=e.data.page||0;t[n++]=i,t[n++]=i,t[n++]=i,t[n++]=i})),t},e.exports.uvs=function(e,t,n,i){var r=new Float32Array(4*e.length*2),s=0;return e.forEach((function(e){var o=e.data,a=o.x+o.width,l=o.y+o.height,c=o.x/t,h=o.y/n,d=a/t,u=l/n;i&&(h=(n-o.y)/n,u=(n-l)/n),r[s++]=c,r[s++]=h,r[s++]=c,r[s++]=u,r[s++]=d,r[s++]=u,r[s++]=d,r[s++]=h})),r},e.exports.positions=function(e){var t=new Float32Array(4*e.length*2),n=0;return e.forEach((function(e){var i=e.data,r=e.position[0]+i.xoffset,s=e.position[1]+i.yoffset,o=i.width,a=i.height;t[n++]=r,t[n++]=s,t[n++]=r,t[n++]=s+a,t[n++]=r+o,t[n++]=s+a,t[n++]=r+o,t[n++]=s})),t}},5406:e=>{var t=/\n/,n=/\s/;function i(e,t,n,i){var r=e.indexOf(t,n);return-1===r||r>i?i:r}function r(e){return n.test(e)}function s(e,t,n,i){return{start:t,end:t+Math.min(i,n-t)}}e.exports=function(t,n){return e.exports.lines(t,n).map((function(e){return t.substring(e.start,e.end)})).join("\n")},e.exports.lines=function(e,n){if(0===(n=n||{}).width&&"nowrap"!==n.mode)return[];e=e||"";var o="number"==typeof n.width?n.width:Number.MAX_VALUE,a=Math.max(0,n.start||0),l="number"==typeof n.end?n.end:e.length,c=n.mode,h=n.measure||s;return"pre"===c?function(e,n,i,r,s){for(var o=[],a=i,l=i;l<r&&l<n.length;l++){var c=n.charAt(l),h=t.test(c);if(h||l===r-1){var d=e(n,a,h?l:l+1,s);o.push(d),a=l+1}}return o}(h,e,a,l,o):function(e,t,n,s,o,a){var l=[],c=o;for("nowrap"===a&&(c=Number.MAX_VALUE);n<s&&n<t.length;){for(var h=i(t,"\n",n,s);n<h&&r(t.charAt(n));)n++;var d=e(t,n,h,c),u=n+(d.end-d.start),p=u+1;if(u<h){for(;u>n&&!r(t.charAt(u));)u--;if(u===n)p>n+1&&p--,u=p;else for(p=u;u>n&&r(t.charAt(u-1));)u--}if(u>=n){var A=e(t,n,u,c);l.push(A)}n=p}return l}(h,e,a,l,o,c)}},3558:(e,t,n)=>{"use strict";var i=n(919),r=n(8847),s=n(3216),o=n(4597);function a(e,t,n){var i=e;return r(t)?(n=t,"string"==typeof e&&(i={uri:e})):i=o(t,{uri:e}),i.callback=n,i}function l(e,t,n){return c(t=a(e,t,n))}function c(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,n=function(n,i,r){t||(t=!0,e.callback(n,i,r))};function i(){var e=void 0;if(e=h.response?h.response:h.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(h),g)try{e=JSON.parse(e)}catch(e){}return e}function r(e){return clearTimeout(d),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,n(e,v)}function o(){if(!c){var t;clearTimeout(d),t=e.useXDR&&void 0===h.status?200:1223===h.status?204:h.status;var r=v,o=null;return 0!==t?(r={body:i(),statusCode:t,method:p,headers:{},url:u,rawRequest:h},h.getAllResponseHeaders&&(r.headers=s(h.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var a,c,h=e.xhr||null;h||(h=e.cors||e.useXDR?new l.XDomainRequest:new l.XMLHttpRequest);var d,u=h.url=e.uri||e.url,p=h.method=e.method||"GET",A=e.body||e.data,f=h.headers=e.headers||{},m=!!e.sync,g=!1,v={body:void 0,headers:{},statusCode:0,method:p,url:u,rawRequest:h};if("json"in e&&!1!==e.json&&(g=!0,f.accept||f.Accept||(f.Accept="application/json"),"GET"!==p&&"HEAD"!==p&&(f["content-type"]||f["Content-Type"]||(f["Content-Type"]="application/json"),A=JSON.stringify(!0===e.json?A:e.json))),h.onreadystatechange=function(){4===h.readyState&&setTimeout(o,0)},h.onload=o,h.onerror=r,h.onprogress=function(){},h.onabort=function(){c=!0},h.ontimeout=r,h.open(p,u,!m,e.username,e.password),m||(h.withCredentials=!!e.withCredentials),!m&&e.timeout>0&&(d=setTimeout((function(){if(!c){c=!0,h.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}}),e.timeout)),h.setRequestHeader)for(a in f)f.hasOwnProperty(a)&&h.setRequestHeader(a,f[a]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(h.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(h),h.send(A||null),h}e.exports=l,e.exports.default=l,l.XMLHttpRequest=i.XMLHttpRequest||function(){},l.XDomainRequest="withCredentials"in new l.XMLHttpRequest?l.XMLHttpRequest:i.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],(function(e){l["delete"===e?"del":e]=function(t,n,i){return(n=a(t,n,i)).method=e.toUpperCase(),c(n)}}))},1896:e=>{e.exports=void 0!==self.DOMParser?function(e){return(new self.DOMParser).parseFromString(e,"application/xml")}:void 0!==self.ActiveXObject&&new self.ActiveXObject("Microsoft.XMLDOM")?function(e){var t=new self.ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(e),t}:function(e){var t=document.createElement("div");return t.innerHTML=e,t}},4597:e=>{e.exports=function(){for(var e={},n=0;n<arguments.length;n++){var i=arguments[n];for(var r in i)t.call(i,r)&&(e[r]=i[r])}return e};var t=Object.prototype.hasOwnProperty},2784:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7427).debug("components:anchored:warn");e.exports.Component=i("anchored",{schema:{persistent:{default:!1}},init:function(){var e=this.el.sceneEl.getAttribute("webxr"),t=e.optionalFeatures;-1===t.indexOf("anchors")&&(t.push("anchors"),this.el.sceneEl.setAttribute("webxr",e)),this.auxQuaternion=new THREE.Quaternion,this.onEnterVR=this.onEnterVR.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR)},onEnterVR:function(){this.anchor=void 0,this.requestPersistentAnchorPending=this.data.persistent,this.requestAnchorPending=!this.data.persistent},tick:function(){var e,t,n,i=this.el.sceneEl,r=i.renderer.xr,s=this.el.object3D;(i.is("ar-mode")||i.is("vr-mode"))&&(!this.anchor&&this.requestPersistentAnchorPending&&this.restorePersistentAnchor(),!this.anchor&&this.requestAnchorPending&&this.createAnchor(),this.anchor&&(e=i.frame,t=r.getReferenceSpace(),n=e.getPose(this.anchor.anchorSpace,t),s.matrix.elements=n.transform.matrix,s.matrix.decompose(s.position,s.rotation,s.scale)))},createAnchor:async function(e,t){var n,i,s,o,a=this.el.sceneEl,l=a.renderer.xr,c=this.el.object3D;e=e||c.position,t=t||this.auxQuaternion.setFromEuler(c.rotation),function(e){var t=e.renderer.xr.getSession();return t&&t.restorePersistentAnchor}(a)?(this.anchor&&this.deleteAnchor(),n=a.frame,i=l.getReferenceSpace(),s=new XRRigidTransform({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z,w:t.w}),this.requestAnchorPending=!1,o=await n.createAnchor(s,i),this.data.persistent&&(this.el.id?(this.persistentHandle=await o.requestPersistentHandle(),localStorage.setItem(this.el.id,this.persistentHandle)):r("The anchor won't be persisted because the entity has no assigned id.")),a.object3D.attach(this.el.object3D),this.anchor=o):r("This browser doesn't support the WebXR anchors module")},restorePersistentAnchor:async function(){var e,t=this.el.sceneEl.renderer.xr.getSession(),n=t.persistentAnchors;if(this.requestPersistentAnchorPending=!1,!this.el.id)return r("The entity associated to the persistent anchor cannot be retrieved because it doesn't have an assigned id."),void(this.requestAnchorPending=!0);if(n){e=localStorage.getItem(this.el.id);for(var i=0;i<n.length;++i)if(e===n[i]){this.anchor=await t.restorePersistentAnchor(n[i]),this.anchor&&(this.persistentHandle=n[i]);break}this.anchor||(this.requestAnchorPending=!0)}else this.requestPersistentAnchorPending=!0},deleteAnchor:function(){var e,t=this.anchor;t&&(e=this.el.sceneEl.renderer.xr.getSession(),t.delete(),this.el.sceneEl.object3D.add(this.el.object3D),this.persistentHandle&&e.deletePersistentAnchor(this.persistentHandle),this.anchor=void 0)}})},6896:(e,t,n)=>{var i=n(4635).A,r=n(8190).components,s=n(8190).registerComponent,o=n(9437),a=n(7427),l=new o.Color,c=new o.Color,h=a.entity.getComponentProperty,d=a.entity.setComponentProperty,u={},p="color",A="rotation",f="components";function m(e){e.x=o.MathUtils.degToRad(e.x),e.y=o.MathUtils.degToRad(e.y),e.z=o.MathUtils.degToRad(e.z)}function g(e,t,n){var i;for(i=0;i<t.length;i++)e.addEventListener(t[i],n)}function v(e,t,n){var i;for(i=0;i<t.length;i++)e.removeEventListener(t[i],n)}function y(e,t){var n,i,r;for(i=x(t),r=e,n=0;n<i.length;n++)r=r[i[n]];if(void 0===r)throw console.log(e),new Error("[animation] property ("+t+") could not be found");return r}function E(e,t,n,i){var r,s,a,l;for(t.startsWith("object3D.rotation")&&(n=o.MathUtils.degToRad(n)),s=x(t),l=e,r=0;r<s.length-1;r++)l=l[s[r]];a=s[s.length-1],i!==p?l[a]=n:"r"in l[a]?(l[a].r=n.r,l[a].g=n.g,l[a].b=n.b):(l[a].x=n.r,l[a].y=n.g,l[a].z=n.b)}function x(e){return e in u||(u[e]=e.split(".")),u[e]}function b(e){return e.isRawProperty||e.property.startsWith(f)||e.property.startsWith("object3D")}e.exports.Component=s("animation",{schema:{autoplay:{default:!0},delay:{default:0},dir:{default:""},dur:{default:1e3},easing:{default:"easeInQuad"},elasticity:{default:400},enabled:{default:!0},from:{default:""},loop:{default:0,parse:function(e){return!0===e||"true"===e||!1!==e&&"false"!==e&&parseInt(e,10)}},property:{default:""},startEvents:{type:"array"},pauseEvents:{type:"array"},resumeEvents:{type:"array"},round:{default:!1},to:{default:""},type:{default:""},isRawProperty:{default:!1}},multiple:!0,init:function(){var e=this;this.eventDetail={name:this.attrName},this.time=0,this.animation=null,this.animationIsPlaying=!1,this.onStartEvent=this.onStartEvent.bind(this),this.beginAnimation=this.beginAnimation.bind(this),this.pauseAnimation=this.pauseAnimation.bind(this),this.resumeAnimation=this.resumeAnimation.bind(this),this.fromColor={},this.toColor={},this.targets={},this.targetsArray=[],this.updateConfigForDefault=this.updateConfigForDefault.bind(this),this.updateConfigForRawColor=this.updateConfigForRawColor.bind(this),this.config={complete:function(){e.animationIsPlaying=!1,e.el.emit("animationcomplete",e.eventDetail,!1),e.id&&e.el.emit("animationcomplete__"+e.id,e.eventDetail,!1)}}},update:function(e){var t=this.config,n=this.data;this.animationIsPlaying=!1,this.data.enabled&&n.property&&(t.autoplay=!1,t.direction=n.dir,t.duration=n.dur,t.easing=n.easing,t.elasticity=n.elasticity,t.loop=n.loop,t.round=n.round,this.createAndStartAnimation())},tick:function(e,t){this.animationIsPlaying&&(this.time+=t,this.animation.tick(this.time))},remove:function(){this.pauseAnimation(),this.removeEventListeners()},pause:function(){this.paused=!0,this.pausedWasPlaying=this.animationIsPlaying,this.pauseAnimation(),this.removeEventListeners()},play:function(){this.paused&&(this.paused=!1,this.addEventListeners(),this.pausedWasPlaying&&(this.resumeAnimation(),this.pausedWasPlaying=!1))},createAndStartAnimation:function(){var e=this.data;this.updateConfig(),this.animationIsPlaying=!1,this.animation=i(this.config),this.animation.began=!0,this.removeEventListeners(),this.addEventListeners(),!e.autoplay||e.startEvents&&e.startEvents.length||(e.delay?setTimeout(this.beginAnimation,e.delay):this.beginAnimation())},beginAnimation:function(){this.updateConfig(),this.animation.began=!0,this.time=0,this.animationIsPlaying=!0,this.stopRelatedAnimations(),this.el.emit("animationbegin",this.eventDetail,!1)},pauseAnimation:function(){this.animationIsPlaying=!1},resumeAnimation:function(){this.animationIsPlaying=!0},onStartEvent:function(){this.data.enabled&&(this.updateConfig(),this.animation&&this.animation.pause(),this.animation=i(this.config),this.data.delay?setTimeout(this.beginAnimation,this.data.delay):this.beginAnimation())},updateConfigForRawColor:function(){var e,t,n,i=this.config,r=this.data,s=this.el;if(!this.waitComponentInitRawProperty(this.updateConfigForRawColor)){for(t in e=""===r.from?y(s,r.property):r.from,n=r.to,this.setColorConfig(e,n),e=this.fromColor,n=this.toColor,this.targetsArray.length=0,this.targetsArray.push(e),i.targets=this.targetsArray,n)i[t]=n[t];var o;i.update=(o={},function(e){var t;(t=e.animatables[0].target).r===o.r&&t.g===o.g&&t.b===o.b||E(s,r.property,t,r.type)})}},updateConfigForDefault:function(){var e,t,n,i,r=this.config,s=this.data,o=this.el;this.waitComponentInitRawProperty(this.updateConfigForDefault)||(e=""===s.from?b(s)?y(o,s.property):h(o,s.property):s.from,n=s.to,isNaN(e||n)?(e=e?e.toString():e,n=n?n.toString():n):(e=parseFloat(e),n=parseFloat(n)),(t="true"===s.to||"false"===s.to||!0===s.to||!1===s.to)&&(e="true"===s.from||!0===s.from?1:0,n="true"===s.to||!0===s.to?1:0),this.targets.aframeProperty=e,r.targets=this.targets,r.aframeProperty=n,r.update=function(e){var n;(n=e.animatables[0].target.aframeProperty)!==i&&(i=n,t&&(n=n>=1),b(s)?E(o,s.property,n,s.type):d(o,s.property,n))})},updateConfigForVector:function(){var e,t,n,i,r=this.config,s=this.data,o=this.el,l=x(s.property),c="object3D"===l[0]?l[1]:l[0];for(e in t=""!==s.from?a.coordinates.parse(s.from):h(o,c),n=a.coordinates.parse(s.to),c===A&&(m(t),m(n)),this.targetsArray.length=0,this.targetsArray.push(t),r.targets=this.targetsArray,n)r[e]=n[e];r.update="position"!==c&&c!==A&&"scale"!==c?function(){var e={};return function(t){var n=t.animatables[0].target;n.x===e.x&&n.y===e.y&&n.z===e.z||(e.x=n.x,e.y=n.y,e.z=n.z,d(o,s.property,n))}}():(i={},function(e){var t=e.animatables[0].target;t.x===i.x&&t.y===i.y&&t.z===i.z||(i.x=t.x,i.y=t.y,i.z=t.z,o.object3D[c].set(t.x,t.y,t.z))})},updateConfig:function(){var e,t,n,i,s,o,a;t=this.el,n=this.data.property,e="object3D"!==(o=n.split("."))[0]||o[2]||"position"!==o[1]&&"rotation"!==o[1]&&"scale"!==o[1]?(s=o[0],a=o[1],(i=t.components[s]||r[s])?a&&!i.schema[a]?null:a?i.schema[a].type:i.schema.type:null):"vec3",b(this.data)&&this.data.type===p?this.updateConfigForRawColor():"vec2"===e||"vec3"===e||"vec4"===e?this.updateConfigForVector():this.updateConfigForDefault()},waitComponentInitRawProperty:function(e){var t,n=this.data,r=this.el,s=this;return""===n.from&&!!n.property.startsWith(f)&&(t=x(n.property)[1],!r.components[t]&&(r.addEventListener("componentinitialized",(function n(o){o.detail.name===t&&(e(),s.animation=i(s.config),r.removeEventListener("componentinitialized",n))})),!0))},stopRelatedAnimations:function(){var e,t;for(t in this.el.components)e=this.el.components[t],t!==this.attrName&&"animation"===e.name&&e.animationIsPlaying&&e.data.property===this.data.property&&(e.animationIsPlaying=!1)},addEventListeners:function(){var e=this.data,t=this.el;g(t,e.startEvents,this.onStartEvent),g(t,e.pauseEvents,this.pauseAnimation),g(t,e.resumeEvents,this.resumeAnimation)},removeEventListeners:function(){var e=this.data,t=this.el;v(t,e.startEvents,this.onStartEvent),v(t,e.pauseEvents,this.pauseAnimation),v(t,e.resumeEvents,this.resumeAnimation)},setColorConfig:function(e,t){l.set(e),c.set(t),e=this.fromColor,t=this.toColor,e.r=l.r,e.g=l.g,e.b=l.b,t.r=c.r,t.g=c.g,t.b=c.b}})},4395:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437);e.exports.Component=i("camera",{schema:{active:{default:!0},far:{default:1e4},fov:{default:80,min:0},near:{default:.005,min:0},spectator:{default:!1},zoom:{default:1,min:0}},init:function(){var e,t=this.el;e=this.camera=new r.PerspectiveCamera,t.setObject3D("camera",e)},update:function(e){var t=this.data,n=this.camera;n.aspect=t.aspect||window.innerWidth/window.innerHeight,n.far=t.far,n.fov=t.fov,n.near=t.near,n.zoom=t.zoom,n.updateProjectionMatrix(),this.updateActiveCamera(e),this.updateSpectatorCamera(e)},updateActiveCamera:function(e){var t=this.data,n=this.el,i=this.system;e&&e.active===t.active||t.spectator||(t.active&&i.activeCameraEl!==n?i.setActiveCamera(n):t.active||i.activeCameraEl!==n||i.disableActiveCamera())},updateSpectatorCamera:function(e){var t=this.data,n=this.el,i=this.system;e&&e.spectator===t.spectator||(t.spectator&&i.spectatorCameraEl!==n?i.setSpectatorCamera(n):t.spectator||i.spectatorCameraEl!==n||i.disableSpectatorCamera())},remove:function(){this.el.removeObject3D("camera")}})},3674:(e,t,n)=>{var i,r,s,o,a=n(8190).registerComponent,l=n(7427),c="click",h="mouseup",d="cursor-fusing",u="cursor-hovering",p="cursor-hovered",A={DOWN:["mousedown","touchstart"],UP:["mouseup","touchend"]},f={DOWN:["selectstart"],UP:["selectend"]},m="a-mouse-cursor-hover";e.exports.Component=a("cursor",{dependencies:["raycaster"],schema:{downEvents:{default:[]},fuse:{default:l.device.isMobile()},fuseTimeout:{default:1500,min:0},mouseCursorStylesEnabled:{default:!0},upEvents:{default:[]},rayOrigin:{default:"entity",oneOf:["mouse","entity","xrselect"]}},after:["tracked-controls"],multiple:!0,init:function(){var e=this;this.fuseTimeout=void 0,this.cursorDownEl=null,this.intersectedEl=null,this.canvasBounds=document.body.getBoundingClientRect(),this.isCursorDown=!1,this.activeXRInput=null,this.updateCanvasBounds=l.debounce((function(){e.canvasBounds=e.el.sceneEl.canvas.getBoundingClientRect()}),500),this.eventDetail={},this.intersectedEventDetail={cursorEl:this.el},this.onCursorDown=this.onCursorDown.bind(this),this.onCursorUp=this.onCursorUp.bind(this),this.onIntersection=this.onIntersection.bind(this),this.onIntersectionCleared=this.onIntersectionCleared.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onEnterVR=this.onEnterVR.bind(this)},update:function(e){this.data.rayOrigin!==e.rayOrigin&&("entity"===this.data.rayOrigin&&this.resetRaycaster(),this.updateMouseEventListeners(),"xrselect"===this.data.rayOrigin&&this.addWebXREventListeners(),"xrselect"===e.rayOrigin&&this.removeWebXREventListeners())},tick:function(){var e=this.el.sceneEl.frame,t=this.activeXRInput;"xrselect"===this.data.rayOrigin&&e&&t&&this.onMouseMove({frame:e,inputSource:t,type:"fakeselectevent"})},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){var e=this.el;e.removeState(u),e.removeState(d),clearTimeout(this.fuseTimeout),this.intersectedEl&&this.intersectedEl.removeState(p),this.removeEventListeners()},addEventListeners:function(){var e,t=this.data,n=this.el,i=this;function r(){e=n.sceneEl.canvas,t.downEvents.length||t.upEvents.length||(A.DOWN.forEach((function(t){e.addEventListener(t,i.onCursorDown,{passive:!1})})),A.UP.forEach((function(t){e.addEventListener(t,i.onCursorUp,{passive:!1})})))}(e=n.sceneEl.canvas)?r():n.sceneEl.addEventListener("render-target-loaded",r),t.downEvents.forEach((function(e){n.addEventListener(e,i.onCursorDown)})),t.upEvents.forEach((function(e){n.addEventListener(e,i.onCursorUp)})),n.addEventListener("raycaster-intersection",this.onIntersection),n.addEventListener("raycaster-closest-entity-changed",this.onIntersection),n.addEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),n.sceneEl.addEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.addEventListener("enter-vr",this.onEnterVR),window.addEventListener("resize",this.updateCanvasBounds),window.addEventListener("scroll",this.updateCanvasBounds),this.updateMouseEventListeners()},removeEventListeners:function(){var e,t=this.data,n=this.el,i=this;!(e=n.sceneEl.canvas)||t.downEvents.length||t.upEvents.length||(A.DOWN.forEach((function(t){e.removeEventListener(t,i.onCursorDown)})),A.UP.forEach((function(t){e.removeEventListener(t,i.onCursorUp)}))),t.downEvents.forEach((function(e){n.removeEventListener(e,i.onCursorDown)})),t.upEvents.forEach((function(e){n.removeEventListener(e,i.onCursorUp)})),n.removeEventListener("raycaster-intersection",this.onIntersection),n.removeEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),e.removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchstart",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),n.sceneEl.removeEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.removeEventListener("enter-vr",this.onEnterVR),window.removeEventListener("resize",this.updateCanvasBounds),window.removeEventListener("scroll",this.updateCanvasBounds),this.removeWebXREventListeners()},updateMouseEventListeners:function(){var e,t=this.el;(e=t.sceneEl.canvas).removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),t.setAttribute("raycaster","useWorldCoordinates",!1),"mouse"===this.data.rayOrigin&&(e.addEventListener("mousemove",this.onMouseMove),e.addEventListener("touchmove",this.onMouseMove,{passive:!1}),t.setAttribute("raycaster","useWorldCoordinates",!0),this.updateCanvasBounds())},resetRaycaster:function(){this.el.setAttribute("raycaster",{direction:(new THREE.Vector3).set(0,0,-1),origin:new THREE.Vector3})},addWebXREventListeners:function(){var e=this,t=this.el.sceneEl.xrSession;t&&(f.DOWN.forEach((function(n){t.addEventListener(n,e.onCursorDown)})),f.UP.forEach((function(n){t.addEventListener(n,e.onCursorUp)})))},removeWebXREventListeners:function(){var e=this,t=this.el.sceneEl.xrSession;t&&(f.DOWN.forEach((function(n){t.removeEventListener(n,e.onCursorDown)})),f.UP.forEach((function(n){t.removeEventListener(n,e.onCursorUp)})))},onMouseMove:(i=new THREE.Vector3,r=new THREE.Vector2,s=new THREE.Vector3,o={origin:s,direction:i},function(e){var t,n,a,l,c,h,d,u,p,A=this.canvasBounds,f=this.el.sceneEl.camera;f.parent.updateMatrixWorld(),n=(a="touchmove"===e.type||"touchstart"===e.type?e.touches.item(0):e).clientX-A.left,l=a.clientY-A.top,r.x=n/A.width*2-1,r.y=-l/A.height*2+1,"xrselect"!==this.data.rayOrigin||"selectstart"!==e.type&&"fakeselectevent"!==e.type?"fakeselectout"===e.type?(i.set(0,1,0),s.set(0,9999,0)):f&&f.isPerspectiveCamera?(s.setFromMatrixPosition(f.matrixWorld),i.set(r.x,r.y,.5).unproject(f).sub(s).normalize()):f&&f.isOrthographicCamera?(s.set(r.x,r.y,(f.near+f.far)/(f.near-f.far)).unproject(f),i.set(0,0,-1).transformDirection(f.matrixWorld)):console.error("AFRAME.Raycaster: Unsupported camera type: "+f.type):(c=e.frame,h=e.inputSource,d=this.el.sceneEl.renderer.xr.getReferenceSpace(),(u=c.getPose(h.targetRaySpace,d))&&(p=u.transform,i.set(0,0,-1),i.applyQuaternion(p.orientation),s.copy(p.position),(t=f.el.object3D.parent).localToWorld(s),i.transformDirection(t.matrixWorld))),this.el.setAttribute("raycaster",o),"touchmove"===e.type&&e.preventDefault()}),onCursorDown:function(e){this.isCursorDown=!0,"mouse"===this.data.rayOrigin&&"touchstart"===e.type&&(this.onMouseMove(e),this.el.components.raycaster.checkIntersections(),e.preventDefault()),"xrselect"===this.data.rayOrigin&&"selectstart"===e.type&&(this.activeXRInput=e.inputSource,this.onMouseMove(e),this.el.components.raycaster.checkIntersections(),this.el.components.raycaster.intersectedEls.length&&void 0!==this.el.sceneEl.components["ar-hit-test"]&&this.el.sceneEl.getAttribute("ar-hit-test").enabled&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!1),this.reenableARHitTest=!0)),this.twoWayEmit("mousedown",e),this.cursorDownEl=this.intersectedEl},onCursorUp:function(e){if(this.isCursorDown&&("xrselect"!==this.data.rayOrigin||this.activeXRInput===e.inputSource)){this.isCursorDown=!1;var t=this.data;this.twoWayEmit(h,e),!0===this.reenableARHitTest&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!0),this.reenableARHitTest=void 0),this.cursorDownEl&&this.cursorDownEl!==this.intersectedEl&&(this.intersectedEventDetail.intersection=null,this.cursorDownEl.emit(h,this.intersectedEventDetail)),t.fuse&&"mouse"!==t.rayOrigin&&"xrselect"!==t.rayOrigin||!this.intersectedEl||this.cursorDownEl!==this.intersectedEl||this.twoWayEmit(c,e),"xrselect"===t.rayOrigin&&this.onMouseMove({type:"fakeselectout"}),this.activeXRInput=null,this.cursorDownEl=null,"touchend"===e.type&&e.preventDefault()}},onIntersection:function(e){var t,n,i,r,s=this.el;n=e.detail.els[0]===s?1:0,r=e.detail.intersections[n],(i=e.detail.els[n])&&this.intersectedEl!==i&&(this.intersectedEl&&(t=this.el.components.raycaster.getIntersection(this.intersectedEl))&&t.distance<=r.distance||(this.clearCurrentIntersection(!0),this.setIntersection(i,r)))},onIntersectionCleared:function(e){-1!==e.detail.clearedEls.indexOf(this.intersectedEl)&&this.clearCurrentIntersection()},onEnterVR:function(){this.clearCurrentIntersection(!0),"xrselect"===this.data.rayOrigin&&this.addWebXREventListeners()},setIntersection:function(e,t){var n=this.el,i=this.data,r=this;this.intersectedEl!==e&&(this.intersectedEl=e,n.addState(u),e.addState(p),this.twoWayEmit("mouseenter"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.add(m),0!==i.fuseTimeout&&i.fuse&&"xrselect"!==i.rayOrigin&&"mouse"!==i.rayOrigin&&(n.addState(d),this.twoWayEmit("fusing"),this.fuseTimeout=setTimeout((function(){n.removeState(d),r.twoWayEmit(c)}),i.fuseTimeout)))},clearCurrentIntersection:function(e){var t,n,i=this.el;this.intersectedEl&&(this.intersectedEl.removeState(p),i.removeState(u),i.removeState(d),this.twoWayEmit("mouseleave"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.remove(m),this.intersectedEl=null,clearTimeout(this.fuseTimeout),!0!==e&&0!==(n=this.el.components.raycaster.intersections).length&&(t=n[n[0].object.el===i?1:0])&&this.setIntersection(t.object.el,t))},twoWayEmit:function(e,t){var n,i=this.el,r=this.intersectedEl;function s(e,n){t instanceof MouseEvent?e.mouseEvent=t:"undefined"!=typeof TouchEvent&&t instanceof TouchEvent&&(e.touchEvent=t)}n=this.el.components.raycaster.getIntersection(r),this.eventDetail.intersectedEl=r,this.eventDetail.intersection=n,s(this.eventDetail),i.emit(e,this.eventDetail),r&&(this.intersectedEventDetail.intersection=n,s(this.intersectedEventDetail),r.emit(e,this.intersectedEventDetail))}})},8388:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l="generic";e.exports.Component=i("generic-tracked-controller-controls",{schema:{hand:{default:""},defaultModel:{default:!0},defaultModelColor:{default:"gray"},disabled:{default:!1}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick"]},bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.wasControllerConnected=!1,this.bindMethods(),this.el.addEventListener("controllerconnected",(function(t){t.detail.name!==e.name&&(e.wasControllerConnected=!0,e.removeEventListeners(),e.removeControllersUpdateListener())}))},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data,t=e.hand?e.hand:void 0;s(this,l,{hand:t,iterateControllerProfiles:!0})},play:function(){this.wasControllerConnected||(this.checkIfControllerPresent(),this.addControllersUpdateListener())},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;this.el.components["tracked-controls"]?this.removeEventListeners():(e.setAttribute("tracked-controls",{hand:t.hand,idPrefix:l,iterateControllerProfiles:!0}),this.data.defaultModel&&this.initDefaultModel())},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.wasControllerConnected&&this.checkIfControllerPresent()},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},initDefaultModel:function(){var e=this.modelEl=document.createElement("a-entity");e.setAttribute("geometry",{primitive:"sphere",radius:.03}),e.setAttribute("material",{color:this.data.color}),this.el.appendChild(e),this.el.emit("controllermodelready",{name:"generic-tracked-controller-controls",model:this.modelEl,rayOrigin:{origin:{x:0,y:0,z:-.01},direction:{x:0,y:0,z:-1}}})}})},9840:(e,t,n)=>{var i=n(7045).to,r=n(7045).Ls,s=n(8190).registerComponent,o=n(9437),a=new o.BufferGeometry;e.exports.Component=s("geometry",{schema:{buffer:{default:!0},primitive:{default:"box",oneOf:r,schemaChange:!0},skipCache:{default:!1}},init:function(){this.geometry=null},update:function(e){var t,n=this.data,i=this.el,r=this.system;this.geometry&&(r.unuseGeometry(e),this.geometry=null),this.geometry=r.getOrCreateGeometry(n),(t=i.getObject3D("mesh"))?t.geometry=this.geometry:((t=new o.Mesh).geometry=this.geometry,this.el.getAttribute("material")||(t.material=new o.MeshStandardMaterial({color:16777215*Math.random(),metalness:0,roughness:.5})),i.setObject3D("mesh",t))},remove:function(){this.system.unuseGeometry(this.data),this.el.getObject3D("mesh").geometry=a,this.geometry=null},updateSchema:function(e){var t=this.oldData&&this.oldData.primitive,n=e.primitive,r=i[n]&&i[n].schema;if(!r)throw new Error("Unknown geometry schema `"+n+"`");t&&t===n||this.extendSchema(r)}})},297:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7427).debug("components:gltf-model:warn");e.exports.Component=i("gltf-model",{schema:{type:"model"},init:function(){var e=this,t=this.system.getDRACOLoader(),n=this.system.getMeshoptDecoder(),i=this.system.getKTX2Loader();this.model=null,this.loader=new r.GLTFLoader,t&&this.loader.setDRACOLoader(t),this.ready=n?n.then((function(t){e.loader.setMeshoptDecoder(t)})):Promise.resolve(),i&&this.loader.setKTX2Loader(i)},update:function(){var e=this,t=this.el,n=this.data;n&&(this.remove(),this.ready.then((function(){e.loader.load(n,(function(n){e.model=n.scene||n.scenes[0],e.model.animations=n.animations,t.setObject3D("mesh",e.model),t.emit("model-loaded",{format:"gltf",model:e.model})}),void 0,(function(e){var i=e&&e.message?e.message:"Failed to load glTF model";s(i),t.emit("model-error",{format:"gltf",src:n})}))})))},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},9194:(e,t,n)=>{(0,n(8190).registerComponent)("grabbable",{init:function(){this.el.setAttribute("obb-collider","centerModel: true")}})},332:(e,t,n)=>{var i=n(8190).registerComponent,r=n(1343).AFRAME_CDN_ROOT,s={toonLeft:r+"controllers/hands/leftHand.glb",toonRight:r+"controllers/hands/rightHand.glb",lowPolyLeft:r+"controllers/hands/leftHandLow.glb",lowPolyRight:r+"controllers/hands/rightHandLow.glb",highPolyLeft:r+"controllers/hands/leftHandHigh.glb",highPolyRight:r+"controllers/hands/rightHandHigh.glb"},o="Point",a="Fist",l="Thumb Up",c={};function h(e,t){var n;if(e)return"grip"===(n=c[e])?n+(t?"close":"open"):"point"===n?n+(t?"up":"down"):"pointing"===n||"pistol"===n?n+(t?"start":"end"):void 0}c[a]="grip",c[l]="pistol",c[o]="pointing",e.exports.Component=i("hand-controls",{schema:{color:{default:"white",type:"color"},hand:{default:"left"},handModelStyle:{default:"lowPoly",oneOf:["lowPoly","highPoly","toon"]}},after:["tracked-controls"],init:function(){var e=this,t=this.el;this.pressedButtons={},this.touchedButtons={},this.loader=new THREE.GLTFLoader,this.loader.setCrossOrigin("anonymous"),this.onGripDown=function(){e.handleButton("grip","down")},this.onGripUp=function(){e.handleButton("grip","up")},this.onTrackpadDown=function(){e.handleButton("trackpad","down")},this.onTrackpadUp=function(){e.handleButton("trackpad","up")},this.onTrackpadTouchStart=function(){e.handleButton("trackpad","touchstart")},this.onTrackpadTouchEnd=function(){e.handleButton("trackpad","touchend")},this.onTriggerDown=function(){e.handleButton("trigger","down")},this.onTriggerUp=function(){e.handleButton("trigger","up")},this.onTriggerTouchStart=function(){e.handleButton("trigger","touchstart")},this.onTriggerTouchEnd=function(){e.handleButton("trigger","touchend")},this.onGripTouchStart=function(){e.handleButton("grip","touchstart")},this.onGripTouchEnd=function(){e.handleButton("grip","touchend")},this.onThumbstickDown=function(){e.handleButton("thumbstick","down")},this.onThumbstickUp=function(){e.handleButton("thumbstick","up")},this.onAorXTouchStart=function(){e.handleButton("AorX","touchstart")},this.onAorXTouchEnd=function(){e.handleButton("AorX","touchend")},this.onBorYTouchStart=function(){e.handleButton("BorY","touchstart")},this.onBorYTouchEnd=function(){e.handleButton("BorY","touchend")},this.onSurfaceTouchStart=function(){e.handleButton("surface","touchstart")},this.onSurfaceTouchEnd=function(){e.handleButton("surface","touchend")},this.onControllerConnected=this.onControllerConnected.bind(this),this.onControllerDisconnected=this.onControllerDisconnected.bind(this),t.addEventListener("controllerconnected",this.onControllerConnected),t.addEventListener("controllerdisconnected",this.onControllerDisconnected),t.object3D.visible=!1},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},tick:function(e,t){var n=this.el.getObject3D("mesh");n&&n.mixer&&n.mixer.update(t/1e3)},onControllerConnected:function(e){var t=this.el,n=this.data.hand,i=this.el.getObject3D("mesh");t.object3D.visible=!0;var r="left"===n?Math.PI/2:-Math.PI/2,s=t.sceneEl.hasWebXR?-Math.PI/2:0;"pico-controls"===e.detail.name&&(s+=Math.PI/4),i.position.set(0,0,0),i.rotation.set(s,0,r)},onControllerDisconnected:function(){this.el.object3D.visible=!1},addEventListeners:function(){var e=this.el;e.addEventListener("gripdown",this.onGripDown),e.addEventListener("gripup",this.onGripUp),e.addEventListener("trackpaddown",this.onTrackpadDown),e.addEventListener("trackpadup",this.onTrackpadUp),e.addEventListener("trackpadtouchstart",this.onTrackpadTouchStart),e.addEventListener("trackpadtouchend",this.onTrackpadTouchEnd),e.addEventListener("triggerdown",this.onTriggerDown),e.addEventListener("triggerup",this.onTriggerUp),e.addEventListener("triggertouchstart",this.onTriggerTouchStart),e.addEventListener("triggertouchend",this.onTriggerTouchEnd),e.addEventListener("griptouchstart",this.onGripTouchStart),e.addEventListener("griptouchend",this.onGripTouchEnd),e.addEventListener("thumbstickdown",this.onThumbstickDown),e.addEventListener("thumbstickup",this.onThumbstickUp),e.addEventListener("abuttontouchstart",this.onAorXTouchStart),e.addEventListener("abuttontouchend",this.onAorXTouchEnd),e.addEventListener("bbuttontouchstart",this.onBorYTouchStart),e.addEventListener("bbuttontouchend",this.onBorYTouchEnd),e.addEventListener("xbuttontouchstart",this.onAorXTouchStart),e.addEventListener("xbuttontouchend",this.onAorXTouchEnd),e.addEventListener("ybuttontouchstart",this.onBorYTouchStart),e.addEventListener("ybuttontouchend",this.onBorYTouchEnd),e.addEventListener("surfacetouchstart",this.onSurfaceTouchStart),e.addEventListener("surfacetouchend",this.onSurfaceTouchEnd)},removeEventListeners:function(){var e=this.el;e.removeEventListener("gripdown",this.onGripDown),e.removeEventListener("gripup",this.onGripUp),e.removeEventListener("trackpaddown",this.onTrackpadDown),e.removeEventListener("trackpadup",this.onTrackpadUp),e.removeEventListener("trackpadtouchstart",this.onTrackpadTouchStart),e.removeEventListener("trackpadtouchend",this.onTrackpadTouchEnd),e.removeEventListener("triggerdown",this.onTriggerDown),e.removeEventListener("triggerup",this.onTriggerUp),e.removeEventListener("triggertouchstart",this.onTriggerTouchStart),e.removeEventListener("triggertouchend",this.onTriggerTouchEnd),e.removeEventListener("griptouchstart",this.onGripTouchStart),e.removeEventListener("griptouchend",this.onGripTouchEnd),e.removeEventListener("thumbstickdown",this.onThumbstickDown),e.removeEventListener("thumbstickup",this.onThumbstickUp),e.removeEventListener("abuttontouchstart",this.onAorXTouchStart),e.removeEventListener("abuttontouchend",this.onAorXTouchEnd),e.removeEventListener("bbuttontouchstart",this.onBorYTouchStart),e.removeEventListener("bbuttontouchend",this.onBorYTouchEnd),e.removeEventListener("xbuttontouchstart",this.onAorXTouchStart),e.removeEventListener("xbuttontouchend",this.onAorXTouchEnd),e.removeEventListener("ybuttontouchstart",this.onBorYTouchStart),e.removeEventListener("ybuttontouchend",this.onBorYTouchEnd),e.removeEventListener("surfacetouchstart",this.onSurfaceTouchStart),e.removeEventListener("surfacetouchend",this.onSurfaceTouchEnd)},update:function(e){var t,n=this.el,i=this.data.hand,r=this.data.handModelStyle,o=this.data.color,a=this;if(t={hand:i,model:!1},i!==e){var l=s[r+i.charAt(0).toUpperCase()+i.slice(1)];this.loader.load(l,(function(e){var i=e.scene.children[0];i.mixer=new THREE.AnimationMixer(i),a.clips=e.animations,n.setObject3D("mesh",i),i.traverse((function(e){e.isMesh&&(e.material.color=new THREE.Color(o))})),n.setAttribute("magicleap-controls",t),n.setAttribute("vive-controls",t),n.setAttribute("meta-touch-controls",t),n.setAttribute("pico-controls",t),n.setAttribute("windows-motion-controls",t),n.setAttribute("hp-mixed-reality-controls",t)}))}},remove:function(){this.el.removeObject3D("mesh")},handleButton:function(e,t){var n,i="down"===t,r="touchstart"===t;if(0===t.indexOf("touch")){if(r===this.touchedButtons[e])return;this.touchedButtons[e]=r}else{if(i===this.pressedButtons[e])return;this.pressedButtons[e]=i}n=this.gesture,this.gesture=this.determineGesture(),this.gesture!==n&&(this.animateGesture(this.gesture,n),this.emitGestureEvents(this.gesture,n))},determineGesture:function(){var e,t,n,i=this.pressedButtons.grip,r=this.pressedButtons.surface||this.touchedButtons.surface,s=this.pressedButtons.trackpad||this.touchedButtons.trackpad,c=this.pressedButtons.trigger||this.touchedButtons.trigger,h=this.touchedButtons.AorX||this.touchedButtons.BorY;return t=this.el.components["tracked-controls"],(n=t&&t.controller)&&(n.id&&0===n.id.indexOf("OpenVR ")||n.profiles&&n.profiles[0]&&"htc-vive"===n.profiles[0])?i||c?e=a:s&&(e=o):i?e=r||h||s?c?a:o:c?l:"Point + Thumb":c&&(e="Hold"),e},getClip:function(e){var t,n;for(n=0;n<this.clips.length;n++)if((t=this.clips[n]).name===e)return t},animateGesture:function(e,t){e?this.playAnimation(e||"Open",t,!1):this.playAnimation(t,t,!0)},emitGestureEvents:function(e,t){var n,i=this.el;t!==e&&((n=h(t,!1))&&i.emit(n),(n=h(e,!0))&&i.emit(n))},playAnimation:function(e,t,n){var i,r,s=this.el.getObject3D("mesh");if(s){if(i=this.getClip(e),r=s.mixer.clipAction(i),n)return r.paused=!1,void(r.timeScale=-1);if(r.clampWhenFinished=!0,r.loop=THREE.LoopOnce,r.repetitions=0,r.timeScale=1,r.time=0,r.weight=1,!t)return s.mixer.stopAllAction(),void r.play();i=this.getClip(t),r.reset(),r.play(),s.mixer.clipAction(i).crossFadeTo(r,.15,!0)}}})},9686:(e,t,n)=>{var i,r=n(8190).registerComponent,s=n(4056).P,o=n(7960).checkControllerPresentAndSetup,a=n(1343).AFRAME_CDN_ROOT,l=a+"controllers/oculus-hands/v4/left.glb",c=a+"controllers/oculus-hands/v4/right.glb",h=["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"];e.exports.Component=r("hand-tracking-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},modelStyle:{default:"mesh",oneOf:["dots","mesh"]},modelColor:{default:"white"},modelOpacity:{default:1}},after:["tracked-controls"],bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this)},addEventListeners:function(){this.el.addEventListener("model-loaded",this.onModelLoaded);for(var e=0;e<this.jointEls.length;++e)this.jointEls[e].object3D.visible=!0},removeEventListeners:function(){this.el.removeEventListener("model-loaded",this.onModelLoaded);for(var e=0;e<this.jointEls.length;++e)this.jointEls[e].object3D.visible=!1},init:function(){var e=this.el.sceneEl,t=e.getAttribute("webxr"),n=t.optionalFeatures;-1===n.indexOf("hand-tracking")&&(n.push("hand-tracking"),e.setAttribute("webxr",t)),this.wristObject3D=new THREE.Object3D,this.el.sceneEl.object3D.add(this.wristObject3D),this.onModelLoaded=this.onModelLoaded.bind(this),this.onChildAttached=this.onChildAttached.bind(this),this.jointEls=[],this.controllerPresent=!1,this.isPinched=!1,this.pinchEventDetail={position:new THREE.Vector3,wristRotation:new THREE.Quaternion},this.indexTipPosition=new THREE.Vector3,this.hasPoses=!1,this.jointPoses=new Float32Array(16*h.length),this.jointRadii=new Float32Array(h.length),this.bindMethods(),this.updateReferenceSpace=this.updateReferenceSpace.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.updateReferenceSpace),this.el.sceneEl.addEventListener("exit-vr",this.updateReferenceSpace),this.el.addEventListener("child-attached",this.onChildAttached),this.wristObject3D.visible=!1},onChildAttached:function(e){this.addChildEntity(e.detail.el)},update:function(){this.updateModelMaterial()},updateModelMaterial:function(){var e=this.jointEls,t=this.skinnedMesh,n=!(1===this.data.modelOpacity);t&&(this.skinnedMesh.material.color.set(this.data.modelColor),this.skinnedMesh.material.transparent=n,this.skinnedMesh.material.opacity=this.data.modelOpacity);for(var i=0;i<e.length;i++)e[i].setAttribute("material",{color:this.data.modelColor,transparent:n,opacity:this.data.modelOpacity})},updateReferenceSpace:function(){var e=this,t=this.el.sceneEl.xrSession;if(this.referenceSpace=void 0,t){var n=e.el.sceneEl.systems.webxr.sessionReferenceSpaceType;t.requestReferenceSpace(n).then((function(t){e.referenceSpace=t})).catch((function(t){throw e.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(n,"tracked-controls-webxr uses reference space "+n),t}))}},checkIfControllerPresent:function(){var e=this.data,t=e.hand?e.hand:void 0;o(this,"",{hand:t,iterateControllerProfiles:!0,handTracking:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},tick:function(){var e=this.el.sceneEl,t=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller,n=e.frame,i=this.el.components["tracked-controls"],r=this.referenceSpace;t&&n&&r&&i&&(this.hasPoses=!1,t.hand&&(this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),this.hasPoses=n.fillPoses(t.hand.values(),r,this.jointPoses)&&n.fillJointRadii(t.hand.values(),this.jointRadii),this.updateHandModel(),this.detectGesture(),this.updateWristObject()))},updateWristObject:(i=new THREE.Matrix4,function(){var e=this.wristObject3D;e&&this.hasPoses&&(i.fromArray(this.jointPoses,0),e.position.setFromMatrixPosition(i),e.quaternion.setFromRotationMatrix(i))}),updateHandModel:function(){this.wristObject3D.visible=!0,this.el.object3D.visible=!0,"dots"===this.data.modelStyle&&this.updateHandDotsModel(),"mesh"===this.data.modelStyle&&this.updateHandMeshModel()},getBone:function(e){for(var t=this.bones,n=0;n<t.length;n++)if(t[n].name===e)return t[n];return null},updateHandMeshModel:function(){var e=new THREE.Matrix4;return function(){var t=0,n=this.jointPoses,i=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller;if(i&&this.mesh&&(this.mesh.visible=!1,this.hasPoses))for(var r of i.hand.values()){var s=this.getBone(r.jointName);null!=s&&(this.mesh.visible=!0,e.fromArray(n,16*t),s.position.setFromMatrixPosition(e),s.quaternion.setFromRotationMatrix(e)),t++}}}(),updateHandDotsModel:function(){for(var e,t,n=this.jointPoses,i=this.jointRadii,r=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller,s=0;s<r.hand.size;s++)t=(e=this.jointEls[s]).object3D,e.object3D.visible=this.hasPoses,this.hasPoses&&(t.matrix.fromArray(n,16*s),t.matrix.decompose(t.position,t.rotation,t.scale),e.setAttribute("scale",{x:i[s],y:i[s],z:i[s]}))},detectGesture:function(){this.detectPinch()},detectPinch:function(){var e=new THREE.Vector3,t=new THREE.Matrix4;return function(){var n=this.indexTipPosition,i=this.pinchEventDetail;if(this.hasPoses){e.setFromMatrixPosition(t.fromArray(this.jointPoses,64)),n.setFromMatrixPosition(t.fromArray(this.jointPoses,144)),i.wristRotation.setFromRotationMatrix(t.fromArray(this.jointPoses,0));var r=n.distanceTo(e);r<.015&&!1===this.isPinched&&(this.isPinched=!0,i.position.copy(n).add(e).multiplyScalar(.5),this.el.emit("pinchstarted",i)),r>.02&&!0===this.isPinched&&(this.isPinched=!1,i.position.copy(n).add(e).multiplyScalar(.5),this.el.emit("pinchended",i)),this.isPinched&&(i.position.copy(n).add(e).multiplyScalar(.5),this.el.emit("pinchmoved",i))}}}(),pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{id:"",hand:t.hand,iterateControllerProfiles:!0,handTrackingEnabled:!0}),this.mesh?this.mesh!==e.getObject3D("mesh")&&e.setObject3D("mesh",this.mesh):this.initDefaultModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){var e,t=this.el;this.checkIfControllerPresent(),e=t.components["tracked-controls"]&&t.components["tracked-controls"].controller,this.mesh&&e&&e.hand&&e.hand instanceof XRHand&&t.setObject3D("mesh",this.mesh)},initDefaultModel:function(){var e=this.data;"dots"===e.modelStyle&&this.initDotsModel(),"mesh"===e.modelStyle&&this.initMeshHandModel(),this.el.object3D.visible=!0,this.wristObject3D.visible=!0},initDotsModel:function(){if(0===this.jointEls.length){for(var e=0;e<h.length;++e){var t=this.jointEl=document.createElement("a-entity");t.setAttribute("geometry",{primitive:"sphere",radius:1}),t.object3D.visible=!1,this.el.appendChild(t),this.jointEls.push(t)}this.updateModelMaterial()}},initMeshHandModel:function(){var e="left"===this.data.hand?l:c;this.el.setAttribute("gltf-model",e)},onModelLoaded:function(){var e=this.mesh=this.el.getObject3D("mesh").children[0],t=this.skinnedMesh=e.getObjectByProperty("type","SkinnedMesh");this.skinnedMesh&&(this.bones=t.skeleton.bones,this.el.removeObject3D("mesh"),e.position.set(0,0,0),e.rotation.set(0,0,0),t.frustumCulled=!1,t.material=new THREE.MeshStandardMaterial,this.updateModelMaterial(),this.setupChildrenEntities(),this.el.setObject3D("mesh",e))},setupChildrenEntities:function(){for(var e=this.el.children,t=0;t<e.length;++t)e[t]instanceof s&&this.addChildEntity(e[t])},addChildEntity:function(e){e instanceof s&&this.wristObject3D.add(e.object3D)}})},5593:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437);i("hand-tracking-grab-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},color:{type:"color",default:"white"},hoverColor:{type:"color",default:"#538df1"},hoverEnabled:{default:!1}},init:function(){var e,t=this.el,n=this.data;e="right"===n.hand?"components.hand-tracking-controls.bones.3":"components.hand-tracking-controls.bones.21",t.setAttribute("hand-tracking-controls",{hand:n.hand}),t.setAttribute("obb-collider",{trackedObject3D:e,size:.04}),this.auxMatrix=new r.Matrix4,this.onCollisionStarted=this.onCollisionStarted.bind(this),this.el.addEventListener("obbcollisionstarted",this.onCollisionStarted),this.onCollisionEnded=this.onCollisionEnded.bind(this),this.el.addEventListener("obbcollisionended",this.onCollisionEnded),this.onPinchStarted=this.onPinchStarted.bind(this),this.el.addEventListener("pinchstarted",this.onPinchStarted),this.onPinchEnded=this.onPinchEnded.bind(this),this.el.addEventListener("pinchended",this.onPinchEnded)},transferEntityOwnership:function(){for(var e,t=this.el.sceneEl.querySelectorAll("[hand-tracking-grab-controls]"),n=0;n<t.length;++n)(e=t[n].components["hand-tracking-grab-controls"])!==this&&this.grabbedEl&&this.grabbedEl===e.grabbedEl&&e.releaseGrabbedEntity();return!1},onCollisionStarted:function(e){var t=e.detail.withEl;this.collidedEl||t.getAttribute("grabbable")&&(this.collidedEl=t,this.grabbingObject3D=e.detail.trackedObject3D,this.data.hoverEnabled&&this.el.setAttribute("hand-tracking-controls","modelColor",this.data.hoverColor))},onCollisionEnded:function(){this.collidedEl=void 0,this.grabbedEl||(this.grabbingObject3D=void 0,this.data.hoverEnabled&&this.el.setAttribute("hand-tracking-controls","modelColor",this.data.color))},onPinchStarted:function(e){this.collidedEl&&(this.grabbedEl=this.collidedEl,this.transferEntityOwnership(),this.grab())},onPinchEnded:function(){this.releaseGrabbedEntity()},releaseGrabbedEntity:function(){var e=this.grabbedEl;if(e){var t=e.object3D,n=t.parent,i=this.originalParent;t.applyMatrix4(n.matrixWorld),t.applyMatrix4(this.auxMatrix.copy(i.matrixWorld).invert()),n.remove(t),i.add(t),this.el.emit("grabended",{grabbedEl:e}),this.grabbedEl=void 0,this.originalParent=void 0}},grab:function(){var e=this.grabbedEl,t=e.object3D,n=t.parent;this.originalParent=n;var i=this.el.components["hand-tracking-controls"].wristObject3D;t.applyMatrix4(n.matrixWorld),t.applyMatrix4(this.auxMatrix.copy(i.matrixWorld).invert()),n.remove(t),i.add(t),this.el.emit("grabstarted",{grabbedEl:e})}})},5387:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("hide-on-enter-ar",{init:function(){var e=this;this.el.sceneEl.addEventListener("enter-vr",(function(){e.el.sceneEl.is("ar-mode")&&(e.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){e.el.object3D.visible=!0}))}})},1620:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("hide-on-enter-vr",{init:function(){var e=this;this.el.sceneEl.addEventListener("enter-vr",(function(){e.el.sceneEl.is("vr-mode")&&(e.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){e.el.object3D.visible=!0}))}})},7538:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="hp-mixed-reality",h=n(1343).AFRAME_CDN_ROOT+"controllers/hp/mixed-reality/",d={x:0,y:0,z:.06},u={_x:Math.PI/4,_y:0,_z:0,_order:"XYZ"};e.exports.Component=i("hp-mixed-reality-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{left:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var e=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){l(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e,e.data.hand)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e,e.data.hand)},this.previousButtonValues={},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;o(this,c,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:c,hand:t.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",h+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t=e.detail.model;this.data.model&&(t.position.copy(d),t.rotation.copy(u),this.el.emit("controllermodelready",{name:"hp-mixed-reality-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)}))},onAxisMoved:function(e){a(this,this.mapping.axes,e)}})},8850:(e,t,n)=>{n(6896),n(2784),n(4395),n(3674),n(9840),n(8388),n(297),n(9194),n(9686),n(5593),n(332),n(5387),n(1620),n(7538),n(6219),n(9248),n(8798),n(6298),n(7796),n(7701),n(7850),n(298),n(3069),n(3176),n(8771),n(6077),n(3942),n(2588),n(7519),n(7394),n(2310),n(4760),n(1072),n(477),n(1603),n(6547),n(5300),n(7360),n(1507),n(4592),n(6458),n(221),n(3575),n(4005),n(3494),n(6273),n(3239),n(2288),n(6149),n(2130),n(3791),n(2662),n(952),n(1217),n(8346),n(6469)},9248:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7427);i("laser-controls",{schema:{hand:{default:"right"},model:{default:!0},defaultModelColor:{type:"color",default:"grey"}},init:function(){var e=this.config,t=this.data,n=this.el,i=this,s={hand:t.hand,model:t.model};function o(t){var s=e[t.detail.name];if(s){var o=r.extend({showLine:!0},s.raycaster||{});t.detail.rayOrigin&&(o.origin=t.detail.rayOrigin.origin,o.direction=t.detail.rayOrigin.direction,o.showLine=!0),t.detail.rayOrigin||!i.modelReady?n.setAttribute("raycaster",o):n.setAttribute("raycaster","showLine",!0),n.setAttribute("cursor",r.extend({fuse:!1},s.cursor))}}n.setAttribute("hp-mixed-reality-controls",s),n.setAttribute("magicleap-controls",s),n.setAttribute("oculus-go-controls",s),n.setAttribute("meta-touch-controls",s),n.setAttribute("pico-controls",s),n.setAttribute("valve-index-controls",s),n.setAttribute("vive-controls",s),n.setAttribute("vive-focus-controls",s),n.setAttribute("windows-motion-controls",s),n.setAttribute("generic-tracked-controller-controls",{hand:s.hand}),n.addEventListener("controllerconnected",o),n.addEventListener("controllerdisconnected",(function(t){e[t.detail.name]&&n.setAttribute("raycaster","showLine",!1)})),n.addEventListener("controllermodelready",(function(e){o(e),i.modelReady=!0}))},config:{"generic-tracked-controller-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"hp-mixed-reality-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"magicleap-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"oculus-go-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:5e-4,z:0}}},"meta-touch-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"pico-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"valve-index-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-focus-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"windows-motion-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{showLine:!1}}}})},6219:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7427).debug("components:layer:warn");e.exports.Component=i("layer",{schema:{type:{default:"quad",oneOf:["quad","monocubemap","stereocubemap"]},src:{type:"map"},rotateCubemap:{default:!1},width:{default:0},height:{default:0}},init:function(){var e=this.el.sceneEl.renderer.getContext();this.quaternion=new THREE.Quaternion,this.position=new THREE.Vector3,this.bindMethods(),this.needsRedraw=!1,this.frameBuffer=e.createFramebuffer();var t=this.el.sceneEl.getAttribute("webxr"),n=t.requiredFeatures;-1===n.indexOf("layers")&&(n.push("layers"),this.el.sceneEl.setAttribute("webxr",t)),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR),this.el.sceneEl.addEventListener("exit-vr",this.onExitVR)},bindMethods:function(){this.onRequestedReferenceSpace=this.onRequestedReferenceSpace.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this)},update:function(e){this.data.src!==e.src&&this.updateSrc()},updateSrc:function(){var e=this.data.type;this.texture=void 0,"quad"!==e?"monocubemap"!==e&&"stereocubemap"!==e||this.loadCubeMapImages():this.loadQuadImage()},loadCubeMapImages:function(){var e,t=this.xrGLFactory,n=this.el.sceneEl.frame,i=this.data.src,r=this.data.type;this.visibilityChanged=!1,this.layer&&("monocubemap"!==r&&"stereocubemap"!==r||(i.complete?this.pendingCubeMapUpdate=!1:this.pendingCubeMapUpdate=!0,this.loadingScreen?this.loadingScreen=!1:this.loadingScreen=!0,"monocubemap"===r?(e=t.getSubImage(this.layer,n),this.loadCubeMapImage(e.colorTexture,i,0)):(e=t.getSubImage(this.layer,n,"left"),this.loadCubeMapImage(e.colorTexture,i,0),e=t.getSubImage(this.layer,n,"right"),this.loadCubeMapImage(e.colorTexture,i,6))))},loadQuadImage:function(){var e=this.data.src,t=this;this.el.sceneEl.systems.material.loadTexture(e,{src:e},(function(n){t.el.sceneEl.renderer.initTexture(n),t.texture=n,"VIDEO"===e.tagName&&setTimeout((function(){t.textureIsVideo=!0}),1e3),t.layer&&(t.layer.height=t.data.height/2||t.texture.image.height/1e3,t.layer.width=t.data.width/2||t.texture.image.width/1e3,t.needsRedraw=!0),t.updateQuadPanel()}))},preGenerateCubeMapTextures:function(e,t){"monocubemap"===this.data.type?this.generateCubeMapTextures(e,0,t):(this.generateCubeMapTextures(e,0,t),this.generateCubeMapTextures(e,6,t))},generateCubeMapTextures:function(e,t,n){for(var i,r,s=this.data,o=this.cubeFaceSize,a=Math.min(e.width,e.height),l=[],c=0;c<6;c++){var h=document.createElement("CANVAS");h.width=h.height=o;var d=h.getContext("2d");s.rotateCubemap&&(2!==c&&3!==c||(d.save(),d.translate(o,o),d.rotate(Math.PI))),d.drawImage(e,(c+t)*a,0,a,a,0,0,o,o),d.restore(),n&&n(),l.push(h)}return s.rotateCubemap&&(i=l[0],r=l[1],l[0]=r,l[1]=i,i=l[4],r=l[5],l[4]=r,l[5]=i),n&&n(),l},loadCubeMapImage:function(e,t,n){var i,r=this.el.sceneEl.renderer.getContext();r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.bindTexture(r.TEXTURE_CUBE_MAP,e),i=!t.complete||this.loadingScreen?this.loadingScreenImages:this.generateCubeMapTextures(t,n);var s=0;i.forEach((function(e,t){r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,r.RGBA,r.UNSIGNED_BYTE,e),s=r.getError()})),0!==s&&console.log("renderingError, WebGL Error Code: "+s),r.bindTexture(r.TEXTURE_CUBE_MAP,null)},tick:function(){this.el.sceneEl.xrSession&&(this.layer||!this.el.sceneEl.is("vr-mode")&&!this.el.sceneEl.is("ar-mode")||this.initLayer(),this.updateTransform(),this.data.src.complete&&(this.pendingCubeMapUpdate||this.loadingScreen||this.visibilityChanged)&&this.loadCubeMapImages(),(this.needsRedraw||this.layer.needsRedraw||this.textureIsVideo)&&("quad"===this.data.type&&this.draw(),this.needsRedraw=!1))},initLayer:function(){var e=this,t=this.data.type;this.el.sceneEl.xrSession.onvisibilitychange=function(t){e.visibilityChanged="hidden"!==t.session.visibilityState},"quad"!==t?"monocubemap"!==t&&"stereocubemap"!==t||this.initCubeMapLayer():this.initQuadLayer()},initQuadLayer:function(){var e=this.el.sceneEl,t=e.renderer.getContext(),n=this.xrGLFactory=new XRWebGLBinding(e.xrSession,t);this.texture&&(this.layer=n.createQuadLayer({space:this.referenceSpace,viewPixelHeight:2048,viewPixelWidth:2048,height:this.data.height/2||this.texture.image.height/1e3,width:this.data.width/2||this.texture.image.width/1e3}),this.initLoadingScreenImages(),e.renderer.xr.addLayer(this.layer))},initCubeMapLayer:function(){var e=this.data.src,t=this.el.sceneEl,n=t.renderer.getContext(),i=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),r=this.cubeFaceSize=Math.min(i,Math.min(e.width,e.height)),s=this.xrGLFactory=new XRWebGLBinding(t.xrSession,n);this.layer=s.createCubeLayer({space:this.referenceSpace,viewPixelWidth:r,viewPixelHeight:r,layout:"monocubemap"===this.data.type?"mono":"stereo",isStatic:!1}),this.initLoadingScreenImages(),this.loadCubeMapImages(),t.renderer.xr.addLayer(this.layer)},initLoadingScreenImages:function(){for(var e=this.cubeFaceSize,t=this.loadingScreenImages=[],n=0;n<6;n++){var i=document.createElement("CANVAS");i.width=i.height=e;var r=i.getContext("2d");i.width=i.height=e,r.fillStyle="black",r.fillRect(0,0,e,e),2!==n&&3!==n&&(r.translate(e,0),r.scale(-1,1),r.fillStyle="white",r.font="30px Arial",r.fillText("Loading",e/2,e/2)),t.push(i)}},destroyLayer:function(){this.layer&&(this.el.sceneEl.renderer.xr.removeLayer(this.layer),this.layer.destroy(),this.layer=void 0)},toggleCompositorLayer:function(){this.enableCompositorLayer(!this.layerEnabled)},enableCompositorLayer:function(e){this.layerEnabled=e,this.quadPanelEl.object3D.visible=!this.layerEnabled},updateQuadPanel:function(){var e=this.quadPanelEl;this.quadPanelEl||(e=this.quadPanelEl=document.createElement("a-entity"),this.el.appendChild(e)),e.setAttribute("material",{shader:"flat",src:this.data.src,transparent:!0}),e.setAttribute("geometry",{primitive:"plane",height:this.data.height||this.texture.image.height/1e3,width:this.data.width||this.texture.image.height/1e3})},draw:function(){var e=this.el.sceneEl,t=this.el.sceneEl.renderer.getContext(),n=this.xrGLFactory.getSubImage(this.layer,e.frame),i=e.renderer.properties.get(this.texture).__webglTexture,r=t.getParameter(t.FRAMEBUFFER_BINDING);t.viewport(n.viewport.x,n.viewport.y,n.viewport.width,n.viewport.height),t.bindFramebuffer(t.FRAMEBUFFER,this.frameBuffer),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n.colorTexture,0),function(e,t,n,i){var r=e.createFramebuffer(),s=n.viewport.x,o=n.viewport.y,a=n.viewport.x+n.viewport.width,l=n.viewport.y+n.viewport.height;"VIDEO"===i.tagName&&(e.bindTexture(e.TEXTURE_2D,t),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,e.RGB,e.UNSIGNED_BYTE,i)),e.bindFramebuffer(e.READ_FRAMEBUFFER,r),e.framebufferTexture2D(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),e.readBuffer(e.COLOR_ATTACHMENT0),e.blitFramebuffer(0,0,i.width,i.height,s,o,a,l,e.COLOR_BUFFER_BIT,e.NEAREST),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.deleteFramebuffer(r)}(t,i,n,this.data.src),t.bindFramebuffer(t.FRAMEBUFFER,r)},updateTransform:function(){var e=this.el,t=this.position,n=this.quaternion;e.object3D.updateMatrixWorld(),t.setFromMatrixPosition(e.object3D.matrixWorld),n.setFromRotationMatrix(e.object3D.matrixWorld),this.layerEnabled||t.set(0,0,1e8),this.layer.transform=new XRRigidTransform(t,n)},onEnterVR:function(){var e=this.el.sceneEl,t=e.xrSession;e.hasWebXR&&XRWebGLBinding&&t?(t.requestReferenceSpace("local-floor").then(this.onRequestedReferenceSpace),this.layerEnabled=!0,this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!1),this.data.src.play&&this.data.src.play()):r("The layer component requires WebXR and the layers API enabled")},onExitVR:function(){this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!0),this.destroyLayer()},onRequestedReferenceSpace:function(e){this.referenceSpace=e}})},8798:(e,t,n)=>{var i,r,s,o,a,l,c=n(7427),h=c.diff,d=n(8940),u=n(8190).registerComponent,p=n(9437),A=n(3657),f=p.MathUtils.degToRad,m=d("components:light:warn"),g=new p.CubeTextureLoader,v={};e.exports.Component=u("light",{schema:{angle:{default:60,if:{type:["spot"]}},color:{type:"color",if:{type:["ambient","directional","hemisphere","point","spot"]}},envMap:{default:"",if:{type:["probe"]}},groundColor:{type:"color",if:{type:["hemisphere"]}},decay:{default:1,if:{type:["point","spot"]}},distance:{default:0,min:0,if:{type:["point","spot"]}},intensity:{default:3.14,min:0,if:{type:["ambient","directional","hemisphere","point","spot","probe"]}},penumbra:{default:0,min:0,max:1,if:{type:["spot"]}},type:{default:"directional",oneOf:["ambient","directional","hemisphere","point","spot","probe"],schemaChange:!0},target:{type:"selector",if:{type:["spot","directional"]}},castShadow:{default:!1,if:{type:["point","spot","directional"]}},shadowBias:{default:0,if:{castShadow:!0}},shadowCameraFar:{default:500,if:{castShadow:!0}},shadowCameraFov:{default:90,if:{castShadow:!0}},shadowCameraNear:{default:.5,if:{castShadow:!0}},shadowCameraTop:{default:5,if:{castShadow:!0}},shadowCameraRight:{default:5,if:{castShadow:!0}},shadowCameraBottom:{default:-5,if:{castShadow:!0}},shadowCameraLeft:{default:-5,if:{castShadow:!0}},shadowCameraVisible:{default:!1,if:{castShadow:!0}},shadowCameraAutomatic:{default:"",if:{type:["directional"]}},shadowMapHeight:{default:512,if:{castShadow:!0}},shadowMapWidth:{default:512,if:{castShadow:!0}},shadowRadius:{default:1,if:{castShadow:!0}}},init:function(){var e=this.el;this.light=null,this.defaultTarget=null,this.system.registerLight(e)},update:function(e){var t=this.data,n=h(t,e),i=this.light,r=this;if(!i||"type"in n)this.setLight(this.data),this.updateShadow();else{var s=!1;Object.keys(n).forEach((function(e){var n=t[e];switch(e){case"color":i.color.set(n);break;case"groundColor":i.groundColor.set(n);break;case"angle":i.angle=f(n);break;case"target":null===n?"spot"!==t.type&&"directional"!==t.type||(i.target=r.defaultTarget):n.hasLoaded?r.onSetTarget(n,i):n.addEventListener("loaded",r.onSetTarget.bind(r,n,i));break;case"envMap":r.updateProbeMap(t,i);break;case"castShadow":case"shadowBias":case"shadowCameraFar":case"shadowCameraFov":case"shadowCameraNear":case"shadowCameraTop":case"shadowCameraRight":case"shadowCameraBottom":case"shadowCameraLeft":case"shadowCameraVisible":case"shadowMapHeight":case"shadowMapWidth":case"shadowRadius":s||(r.updateShadow(),s=!0);break;case"shadowCameraAutomatic":t.shadowCameraAutomatic?r.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(t.shadowCameraAutomatic)):r.shadowCameraAutomaticEls=[];break;default:i[e]=n}}))}},tick:(i=new p.Box3,r=new p.Vector3,s=new p.Vector3,o=new p.Matrix4,a=new p.Sphere,l=new p.Vector3,function(){if("directional"===this.data.type&&this.light.shadow&&this.light.shadow.camera instanceof p.OrthographicCamera&&this.shadowCameraAutomaticEls.length){var e=this.light.shadow.camera;e.getWorldDirection(r),e.getWorldPosition(s),o.copy(e.matrixWorld),o.invert(),e.near=1,e.left=1e5,e.right=-1e5,e.top=-1e5,e.bottom=1e5,this.shadowCameraAutomaticEls.forEach((function(t){i.setFromObject(t.object3D),i.getBoundingSphere(a);var n=A.distanceOfPointFromPlane(s,r,a.center),c=A.nearestPointInPlane(s,r,a.center,l).applyMatrix4(o);e.near=Math.min(-n-a.radius-1,e.near),e.left=Math.min(-a.radius+c.x,e.left),e.right=Math.max(a.radius+c.x,e.right),e.top=Math.max(a.radius+c.y,e.top),e.bottom=Math.min(-a.radius+c.y,e.bottom)})),e.updateProjectionMatrix()}}),setLight:function(e){var t=this.el,n=this.getLight(e);n&&(this.light&&t.removeObject3D("light"),this.light=n,this.light.el=t,t.setObject3D("light",this.light),"spot"!==e.type&&"directional"!==e.type&&"hemisphere"!==e.type||t.getObject3D("light").translateY(-1),"spot"===e.type&&(t.setObject3D("light-target",this.defaultTarget),t.getObject3D("light-target").position.set(0,0,-1)),e.shadowCameraAutomatic?this.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(e.shadowCameraAutomatic)):this.shadowCameraAutomaticEls=[])},updateShadow:function(){var e=this.el,t=this.data,n=this.light;n.castShadow=t.castShadow;var i=e.getObject3D("cameraHelper");if(t.shadowCameraVisible&&!i?(i=new p.CameraHelper(n.shadow.camera),e.setObject3D("cameraHelper",i)):!t.shadowCameraVisible&&i&&e.removeObject3D("cameraHelper"),!t.castShadow)return n;n.shadow.bias=t.shadowBias,n.shadow.radius=t.shadowRadius,n.shadow.mapSize.height=t.shadowMapHeight,n.shadow.mapSize.width=t.shadowMapWidth,n.shadow.camera.near=t.shadowCameraNear,n.shadow.camera.far=t.shadowCameraFar,n.shadow.camera instanceof p.OrthographicCamera?(n.shadow.camera.top=t.shadowCameraTop,n.shadow.camera.right=t.shadowCameraRight,n.shadow.camera.bottom=t.shadowCameraBottom,n.shadow.camera.left=t.shadowCameraLeft):n.shadow.camera.fov=t.shadowCameraFov,n.shadow.camera.updateProjectionMatrix(),i&&i.update()},getLight:function(e){var t=e.angle,n=new p.Color(e.color);n=n.getHex();var i=e.decay,r=e.distance,s=new p.Color(e.groundColor);s=s.getHex();var o=e.intensity,a=e.type,l=e.target,c=null;switch(a.toLowerCase()){case"ambient":return new p.AmbientLight(n,o);case"directional":return c=new p.DirectionalLight(n,o),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"hemisphere":return new p.HemisphereLight(n,s,o);case"point":return new p.PointLight(n,o,r,i);case"spot":return c=new p.SpotLight(n,o,r,f(t),e.penumbra,i),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"probe":return c=new p.LightProbe,this.updateProbeMap(e,c),c;default:m("%s is not a valid light type. Choose from ambient, directional, hemisphere, point, spot.",a)}},updateProbeMap:function(e,t){e.envMap?(void 0===v[e.envMap]&&(v[e.envMap]=new window.Promise((function(t){c.srcLoader.validateCubemapSrc(e.envMap,(function(n){g.load(n,(function(n){var i=p.LightProbeGenerator.fromCubeTexture(n);v[e.envMap]=i,t(i)}))}))}))),v[e.envMap]instanceof window.Promise?v[e.envMap].then((function(e){t.copy(e)})):v[e.envMap]instanceof p.LightProbe&&t.copy(v[e.envMap])):t.copy(new p.LightProbe)},onSetTarget:function(e,t){t.target=e.object3D},remove:function(){var e=this.el;e.removeObject3D("light"),e.getObject3D("cameraHelper")&&e.removeObject3D("cameraHelper")}})},6298:(e,t,n)=>{var i=n(8190).registerComponent;function r(e,t){return!(!e||!t)&&e.x===t.x&&e.y===t.y&&e.z===t.z}e.exports.Component=i("line",{schema:{start:{type:"vec3",default:{x:0,y:0,z:0}},end:{type:"vec3",default:{x:0,y:0,z:0}},color:{type:"color",default:"#74BEC1"},opacity:{type:"number",default:1},visible:{default:!0}},multiple:!0,init:function(){var e,t,n=this.data;t=this.material=new THREE.LineBasicMaterial({color:n.color,opacity:n.opacity,transparent:n.opacity<1,visible:n.visible}),(e=this.geometry=new THREE.BufferGeometry).setAttribute("position",new THREE.BufferAttribute(new Float32Array(6),3)),this.line=new THREE.Line(e,t),this.el.setObject3D(this.attrName,this.line)},update:function(e){var t=this.data,n=this.geometry,i=!1,s=this.material,o=n.attributes.position.array;r(t.start,e.start)||(o[0]=t.start.x,o[1]=t.start.y,o[2]=t.start.z,i=!0),r(t.end,e.end)||(o[3]=t.end.x,o[4]=t.end.y,o[5]=t.end.z,i=!0),i&&(n.attributes.position.needsUpdate=!0,n.computeBoundingSphere()),s.color.setStyle(t.color),s.opacity=t.opacity,s.transparent=t.opacity<1,s.visible=t.visible},remove:function(){this.el.removeObject3D(this.attrName,this.line)}})},7796:(e,t,n)=>{var i,r,s,o,a,l,c,h,d=n(8190).registerComponent,u=n(5892).registerShader,p=n(9437);e.exports.Component=d("link",{schema:{backgroundColor:{default:"red",type:"color"},borderColor:{default:"white",type:"color"},highlighted:{default:!1},highlightedColor:{default:"#24CAFF",type:"color"},href:{default:""},image:{type:"asset"},on:{default:"click"},peekMode:{default:!1},title:{default:""},titleColor:{default:"white",type:"color"},visualAspectEnabled:{default:!1}},init:function(){this.navigate=this.navigate.bind(this),this.previousQuaternion=void 0,this.quaternionClone=new p.Quaternion,this.hiddenEls=[]},update:function(e){var t,n,i=this.data,r=this.el;if(i.visualAspectEnabled){var s=this.el.getAttribute("scale");this.previewDistance=15*(s.x+s.y)/2,this.initVisualAspect(),t=i.highlighted?i.highlightedColor:i.backgroundColor,n=i.highlighted?i.highlightedColor:i.borderColor,r.setAttribute("material","backgroundColor",t),r.setAttribute("material","strokeColor",n),i.on!==e.on&&this.updateEventListener(),void 0!==e.peekMode&&i.peekMode!==e.peekMode&&this.updatePeekMode(),i.image&&e.image!==i.image&&r.setAttribute("material","pano","string"==typeof i.image?i.image:i.image.src)}},updatePeekMode:function(){var e=this.el,t=this.sphereEl;this.data.peekMode?(this.hideAll(),e.getObject3D("mesh").visible=!1,t.setAttribute("visible",!0)):(this.showAll(),e.getObject3D("mesh").visible=!0,t.setAttribute("visible",!1))},play:function(){this.updateEventListener()},pause:function(){this.removeEventListener()},updateEventListener:function(){var e=this.el;e.isPlaying&&(this.removeEventListener(),e.addEventListener(this.data.on,this.navigate))},removeEventListener:function(){var e=this.data.on;e&&this.el.removeEventListener(e,this.navigate)},initVisualAspect:function(){var e,t,n,i=this.el;this.data.visualAspectEnabled&&!this.visualAspectInitialized&&(n=this.textEl=this.textEl||document.createElement("a-entity"),t=this.sphereEl=this.sphereEl||document.createElement("a-entity"),e=this.semiSphereEl=this.semiSphereEl||document.createElement("a-entity"),i.setAttribute("geometry",{primitive:"circle",radius:1,segments:64}),i.setAttribute("material",{shader:"portal",pano:this.data.image,side:"double",previewDistance:this.previewDistance}),n.setAttribute("text",{color:this.data.titleColor,align:"center",font:"kelsonsans",value:this.data.title||this.data.href,width:4}),n.setAttribute("position","0 1.5 0"),i.appendChild(n),e.setAttribute("geometry",{primitive:"sphere",radius:1,phiStart:0,segmentsWidth:64,segmentsHeight:64,phiLength:180,thetaStart:0,thetaLength:360}),e.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back",previewDistance:this.previewDistance}),e.setAttribute("rotation","0 180 0"),e.setAttribute("position","0 0 0"),e.setAttribute("visible",!1),i.appendChild(e),t.setAttribute("geometry",{primitive:"sphere",radius:10,segmentsWidth:64,segmentsHeight:64}),t.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back",previewDistance:this.previewDistance}),t.setAttribute("visible",!1),i.appendChild(t),this.visualAspectInitialized=!0)},navigate:function(){window.location=this.data.href},tick:(a=new p.Vector3,l=new p.Vector3,c=new p.Quaternion,h=new p.Vector3,function(){var e,t,n=this.el,i=n.object3D,r=n.sceneEl.camera,s=this.textEl;if(this.data.visualAspectEnabled)if(i.updateMatrixWorld(),r.parent.updateMatrixWorld(),r.updateMatrixWorld(),i.matrix.decompose(l,c,h),l.setFromMatrixPosition(i.matrixWorld),a.setFromMatrixPosition(r.matrixWorld),(t=l.distanceTo(a))>1.33333*this.previewDistance)this.previousQuaternion||(this.quaternionClone.copy(c),this.previousQuaternion=this.quaternionClone),i.lookAt(a);else{if(e=this.calculateCameraPortalOrientation(),t<.5){if(!0===this.semiSphereEl.getAttribute("visible"))return;s.setAttribute("text","width",1.5),e<=0?(s.setAttribute("position","0 0 0.75"),s.setAttribute("rotation","0 180 0"),this.semiSphereEl.setAttribute("rotation","0 0 0")):(s.setAttribute("position","0 0 -0.75"),s.setAttribute("rotation","0 0 0"),this.semiSphereEl.setAttribute("rotation","0 180 0")),n.getObject3D("mesh").visible=!1,this.semiSphereEl.setAttribute("visible",!0),this.peekCameraPortalOrientation=e}else e<=0?s.setAttribute("rotation","0 180 0"):s.setAttribute("rotation","0 0 0"),s.setAttribute("text","width",5),s.setAttribute("position","0 1.5 0"),n.getObject3D("mesh").visible=!0,this.semiSphereEl.setAttribute("visible",!1),this.peekCameraPortalOrientation=void 0;this.previousQuaternion&&(i.quaternion.copy(this.previousQuaternion),this.previousQuaternion=void 0)}}),hideAll:function(){var e=this.el,t=this.hiddenEls,n=this;t.length>0||e.sceneEl.object3D.traverse((function(i){i&&i.el&&i.el.hasAttribute("link-controls")||i.el&&i!==e.sceneEl.object3D&&i.el!==e&&i.el!==n.sphereEl&&i.el!==e.sceneEl.cameraEl&&!1!==i.el.getAttribute("visible")&&i.el!==n.textEl&&i.el!==n.semiSphereEl&&(i.el.setAttribute("visible",!1),t.push(i.el))}))},showAll:function(){this.hiddenEls.forEach((function(e){e.setAttribute("visible",!0)})),this.hiddenEls=[]},calculateCameraPortalOrientation:(i=new p.Matrix4,r=new p.Vector3,s=new p.Vector3(0,0,1),o=new p.Vector3(0,0,0),function(){var e=this.el,t=e.sceneEl.camera;return r.set(0,0,0),s.set(0,0,1),o.set(0,0,0),e.object3D.matrixWorld.extractRotation(i),s.applyMatrix4(i),e.object3D.updateMatrixWorld(),e.object3D.localToWorld(o),t.parent.parent.updateMatrixWorld(),t.parent.updateMatrixWorld(),t.updateMatrixWorld(),t.localToWorld(r),r.sub(o).normalize(),s.normalize(),Math.sign(s.dot(r))}),remove:function(){this.removeEventListener()}}),u("portal",{schema:{borderEnabled:{default:1,type:"int",is:"uniform"},backgroundColor:{default:"red",type:"color",is:"uniform"},pano:{type:"map",is:"uniform"},strokeColor:{default:"white",type:"color",is:"uniform"},previewDistance:{default:15,type:"float",is:"uniform"}},vertexShader:["vec3 portalPosition;","varying vec3 vWorldPosition;","varying float vDistanceToCenter;","varying float vDistance;","void main() {","vDistanceToCenter = clamp(length(position - vec3(0.0, 0.0, 0.0)), 0.0, 1.0);","portalPosition = (modelMatrix * vec4(0.0, 0.0, 0.0, 1.0)).xyz;","vDistance = length(portalPosition - cameraPosition);","vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI2 0.15915494","uniform sampler2D pano;","uniform vec3 strokeColor;","uniform vec3 backgroundColor;","uniform float borderEnabled;","uniform float previewDistance;","varying float vDistanceToCenter;","varying float vDistance;","varying vec3 vWorldPosition;","void main() {","vec3 direction = normalize(vWorldPosition - cameraPosition);","vec2 sampleUV;","float borderThickness = clamp(exp(-vDistance / 50.0), 0.6, 0.95);","sampleUV.y = clamp(direction.y * 0.5 + 0.5, 0.0, 1.0);","sampleUV.x = atan(direction.z, -direction.x) * -RECIPROCAL_PI2 + 0.5;","if (vDistanceToCenter > borderThickness && borderEnabled == 1.0) {","gl_FragColor = vec4(strokeColor, 1.0);","} else {","gl_FragColor = mix(texture2D(pano, sampleUV), vec4(backgroundColor, 1.0), clamp(pow((vDistance / previewDistance), 2.0), 0.0, 1.0));","}","}"].join("\n")})},7701:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="logitech-mx-ink",h=n(1343).AFRAME_CDN_ROOT+"controllers/logitech/";e.exports.Component=i("logitech-mx-ink-controls",{schema:{hand:{default:"left"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{left:{buttons:["front","back","none","none","none","tip"]},right:{buttons:["front","back","none","none","none","tip"]}},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){l(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e,e.data.hand)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e,e.data.hand)},this.bindMethods()},update:function(){this.data},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),e.sceneEl.removeEventListener("enter-vr",this.onEnterVR),e.sceneEl.removeEventListener("exit-vr",this.onExitVR),this.controllerEventsActive=!1},checkIfControllerPresent:function(){this.data;var e=this.controllerObject3D;e&&(e.visible=!1),o(this,c,{hand:this.data.hand,iterateControllerProfiles:!0})},injectTrackedControls:function(){var e=this.el,t=this.data,n=c;e.setAttribute("tracked-controls",{id:n,hand:t.hand,handTrackingEnabled:!1,iterateControllerProfiles:!0,orientationOffset:t.orientationOffset}),this.loadModel()},loadModel:function(){var e=this.controllerObject3D;if(this.data.model)return e?(e.visible=this.el.sceneEl.is("vr-mode"),void this.el.setObject3D("mesh",e)):void this.el.setAttribute("gltf-model",h+"logitech-mx-ink.glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){e.target===this.el&&this.data.model&&(this.el.emit("controllermodelready",{name:"logitech-mx-ink-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)}),this.controllerObject3D=this.el.getObject3D("mesh"),this.controllerObject3D.visible=this.el.sceneEl.is("vr-mode"))},onAxisMoved:function(e){a(this,this.mapping.axes,e)}})},7850:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7427),o=Math.PI/2;e.exports.Component=i("look-controls",{dependencies:["position","rotation"],schema:{enabled:{default:!0},magicWindowTrackingEnabled:{default:!0},pointerLockEnabled:{default:!1},reverseMouseDrag:{default:!1},reverseTouchDrag:{default:!1},touchEnabled:{default:!0},mouseEnabled:{default:!0}},init:function(){this.deltaYaw=0,this.previousHMDPosition=new r.Vector3,this.hmdQuaternion=new r.Quaternion,this.magicWindowAbsoluteEuler=new r.Euler,this.magicWindowDeltaEuler=new r.Euler,this.position=new r.Vector3,this.magicWindowObject=new r.Object3D,this.rotation={},this.deltaRotation={},this.savedPose=null,this.pointerLocked=!1,this.setupMouseControls(),this.bindMethods(),this.previousMouseEvent={},this.setupMagicWindowControls(),this.savedPose={position:new r.Vector3,rotation:new r.Euler},(this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode"))&&this.onEnterVR()},setupMagicWindowControls:function(){var e,t=this.data;(s.device.isMobile()||s.device.isMobileDeviceRequestingDesktopSite())&&(e=this.magicWindowControls=new r.DeviceOrientationControls(this.magicWindowObject),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission&&(e.enabled=!1,this.el.sceneEl.components["device-orientation-permission-ui"].permissionGranted?e.enabled=t.magicWindowTrackingEnabled:this.el.sceneEl.addEventListener("deviceorientationpermissiongranted",(function(){e.enabled=t.magicWindowTrackingEnabled}))))},update:function(e){var t=this.data;t.enabled!==e.enabled&&this.updateGrabCursor(t.enabled),e&&!t.magicWindowTrackingEnabled&&e.magicWindowTrackingEnabled&&(this.magicWindowAbsoluteEuler.set(0,0,0),this.magicWindowDeltaEuler.set(0,0,0)),this.magicWindowControls&&(this.magicWindowControls.enabled=t.magicWindowTrackingEnabled),e&&!t.pointerLockEnabled!==e.pointerLockEnabled&&(this.removeEventListeners(),this.addEventListeners(),this.pointerLocked&&this.exitPointerLock())},tick:function(e){this.data.enabled&&this.updateOrientation()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},remove:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},bindMethods:function(){this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this),this.onPointerLockChange=this.onPointerLockChange.bind(this),this.onPointerLockError=this.onPointerLockError.bind(this)},setupMouseControls:function(){this.mouseDown=!1,this.pitchObject=new r.Object3D,this.yawObject=new r.Object3D,this.yawObject.position.y=10,this.yawObject.add(this.pitchObject)},addEventListeners:function(){var e=this.el.sceneEl,t=e.canvas;t?(t.addEventListener("mousedown",this.onMouseDown,!1),window.addEventListener("mousemove",this.onMouseMove,!1),window.addEventListener("mouseup",this.onMouseUp,!1),t.addEventListener("touchstart",this.onTouchStart,{passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{passive:!0}),e.addEventListener("enter-vr",this.onEnterVR),e.addEventListener("exit-vr",this.onExitVR),this.data.pointerLockEnabled&&(document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.addEventListener("pointerlockerror",this.onPointerLockError,!1))):e.addEventListener("render-target-loaded",this.addEventListeners.bind(this))},removeEventListeners:function(){var e=this.el.sceneEl,t=e&&e.canvas;t&&(t.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),t.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),e.removeEventListener("enter-vr",this.onEnterVR),e.removeEventListener("exit-vr",this.onExitVR),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("pointerlockerror",this.onPointerLockError,!1))},updateOrientation:function(){var e=this.el.object3D,t=this.pitchObject,n=this.yawObject,i=this.el.sceneEl;(i.is("vr-mode")||i.is("ar-mode"))&&i.checkHeadsetConnected()||(this.updateMagicWindowOrientation(),e.rotation.x=this.magicWindowDeltaEuler.x+t.rotation.x,e.rotation.y=this.magicWindowDeltaEuler.y+n.rotation.y,e.rotation.z=this.magicWindowDeltaEuler.z)},updateMagicWindowOrientation:function(){var e=this.magicWindowAbsoluteEuler,t=this.magicWindowDeltaEuler;this.magicWindowControls&&this.magicWindowControls.enabled&&(this.magicWindowControls.update(),e.setFromQuaternion(this.magicWindowObject.quaternion,"YXZ"),this.previousMagicWindowYaw||0===e.y||(this.previousMagicWindowYaw=e.y),this.previousMagicWindowYaw&&(t.x=e.x,t.y+=e.y-this.previousMagicWindowYaw,t.z=e.z,this.previousMagicWindowYaw=e.y))},onMouseMove:function(e){var t,n,i,r=this.pitchObject,s=this.previousMouseEvent,a=this.yawObject;this.data.enabled&&(this.mouseDown||this.pointerLocked)&&(this.pointerLocked?(n=e.movementX||e.mozMovementX||0,i=e.movementY||e.mozMovementY||0):(n=e.screenX-s.screenX,i=e.screenY-s.screenY),this.previousMouseEvent.screenX=e.screenX,this.previousMouseEvent.screenY=e.screenY,t=this.data.reverseMouseDrag?1:-1,a.rotation.y+=.002*n*t,r.rotation.x+=.002*i*t,r.rotation.x=Math.max(-o,Math.min(o,r.rotation.x)))},onMouseDown:function(e){var t=this.el.sceneEl;if(this.data.enabled&&this.data.mouseEnabled&&(!t.is("vr-mode")&&!t.is("ar-mode")||!t.checkHeadsetConnected())&&0===e.button){var n=t&&t.canvas;this.mouseDown=!0,this.previousMouseEvent.screenX=e.screenX,this.previousMouseEvent.screenY=e.screenY,this.showGrabbingCursor(),this.data.pointerLockEnabled&&!this.pointerLocked&&(n.requestPointerLock?n.requestPointerLock():n.mozRequestPointerLock&&n.mozRequestPointerLock())}},showGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor="grabbing"},hideGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor=""},onMouseUp:function(){this.mouseDown=!1,this.hideGrabbingCursor()},onTouchStart:function(e){1!==e.touches.length||!this.data.touchEnabled||this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode")||(this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY},this.touchStarted=!0)},onTouchMove:function(e){var t,n,i=this.el.sceneEl.canvas,r=this.yawObject;this.touchStarted&&this.data.touchEnabled&&(n=2*Math.PI*(e.touches[0].pageX-this.touchStart.x)/i.clientWidth,t=this.data.reverseTouchDrag?1:-1,r.rotation.y-=.5*n*t,this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY})},onTouchEnd:function(){this.touchStarted=!1},onEnterVR:function(){var e=this.el.sceneEl;e.checkHeadsetConnected()&&(this.saveCameraPose(),this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),e.hasWebXR&&(this.el.object3D.matrixAutoUpdate=!1,this.el.object3D.updateMatrix()))},onExitVR:function(){this.el.sceneEl.checkHeadsetConnected()&&(this.restoreCameraPose(),this.previousHMDPosition.set(0,0,0),this.el.object3D.matrixAutoUpdate=!0)},onPointerLockChange:function(){this.pointerLocked=!(!document.pointerLockElement&&!document.mozPointerLockElement)},onPointerLockError:function(){this.pointerLocked=!1},exitPointerLock:function(){document.exitPointerLock(),this.pointerLocked=!1},updateGrabCursor:function(e){var t=this.el.sceneEl;function n(){t.canvas.classList.add("a-grab-cursor")}function i(){t.canvas.classList.remove("a-grab-cursor")}t.canvas?e?n():i():e?t.addEventListener("render-target-loaded",n):t.addEventListener("render-target-loaded",i)},saveCameraPose:function(){var e=this.el;this.savedPose.position.copy(e.object3D.position),this.savedPose.rotation.copy(e.object3D.rotation),this.hasSavedPose=!0},restoreCameraPose:function(){var e=this.el,t=this.savedPose;this.hasSavedPose&&(e.object3D.position.copy(t.position),e.object3D.rotation.copy(t.rotation),this.hasSavedPose=!1)}})},298:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l="magicleap-one",c=n(1343).AFRAME_CDN_ROOT+"controllers/magicleap/magicleap-one-controller.glb";e.exports.Component=i("magicleap-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","menu"]},init:function(){var e=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;s(this,l,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:l,hand:t.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",c)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){e.detail.model.scale.set(.01,.01,.01)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){},setButtonColor:function(e,t){}})},3069:(e,t,n)=>{var i=n(7427),r=n(8190),s=n(9437),o=n(5892),a=i.debug("components:material:error"),l=r.registerComponent,c=o.shaders,h=o.shaderNames;function d(e,t){e.dispose(),t.unregisterMaterial(e),Object.keys(e).filter((function(t){return e[t]&&e[t].isTexture})).forEach((function(t){e[t].dispose()}))}e.exports.Component=l("material",{schema:{alphaTest:{default:0,min:0,max:1},depthTest:{default:!0},depthWrite:{default:!0},flatShading:{default:!1},npot:{default:!1},offset:{type:"vec2",default:{x:0,y:0}},opacity:{default:1,min:0,max:1},repeat:{type:"vec2",default:{x:1,y:1}},shader:{default:"standard",oneOf:h,schemaChange:!0},side:{default:"front",oneOf:["front","back","double"]},transparent:{default:!1},vertexColorsEnabled:{default:!1},visible:{default:!0},blending:{default:"normal",oneOf:["none","normal","additive","subtractive","multiply"]},dithering:{default:!0},anisotropy:{default:0,min:0}},init:function(){this.material=null},update:function(e){var t=this.data;this.shader&&t.shader===e.shader||this.updateShader(t.shader),this.shader.update(this.data),this.updateMaterial(e)},updateSchema:function(e){var t,n,i,r;n=e&&e.shader,t=this.oldData&&this.oldData.shader,(i=c[r=n||t]&&c[r].schema)||a("Unknown shader schema "+r),t&&n===t||(this.extendSchema(i),this.updateBehavior())},updateBehavior:function(){var e,t,n=this.el.sceneEl,i=this.schema,r=this;function s(e,n){var i;for(i in t)t[i]=e;r.shader.update(t)}for(e in this.tick=void 0,t={},i)"time"===i[e].type&&(this.tick=s,t[e]=!0);n&&(this.tick?n.addBehavior(this):n.removeBehavior(this))},updateShader:function(e){var t,n=this.data,i=c[e]&&c[e].Shader;if(!i)throw new Error("Unknown shader "+e);(t=this.shader=new i).el=this.el,t.init(n),this.setMaterial(t.material),this.updateSchema(n)},updateMaterial:function(e){var t,n=this.data,i=this.material;for(t in i.alphaTest=n.alphaTest,i.depthTest=!1!==n.depthTest,i.depthWrite=!1!==n.depthWrite,i.opacity=n.opacity,i.flatShading=n.flatShading,i.side=function(e){switch(e){case"back":return s.BackSide;case"double":return s.DoubleSide;default:return s.FrontSide}}(n.side),i.transparent=!1!==n.transparent||n.opacity<1,i.vertexColors=n.vertexColorsEnabled,i.visible=n.visible,i.blending=function(e){switch(e){case"none":return s.NoBlending;case"additive":return s.AdditiveBlending;case"subtractive":return s.SubtractiveBlending;case"multiply":return s.MultiplyBlending;default:return s.NormalBlending}}(n.blending),i.dithering=n.dithering,e)break;!t||e.alphaTest===n.alphaTest&&e.side===n.side&&e.vertexColorsEnabled===n.vertexColorsEnabled||(i.needsUpdate=!0)},remove:function(){var e=new s.MeshBasicMaterial,t=this.material,n=this.el.getObject3D("mesh");n&&(n.material=e),d(t,this.system)},setMaterial:function(e){var t,n=this.el,i=this.system;this.material&&d(this.material,i),this.material=e,i.registerMaterial(e),(t=n.getObject3D("mesh"))?t.material=e:n.addEventListener("object3dset",(function t(i){"mesh"===i.detail.type&&i.target===n&&(n.getObject3D("mesh").material=e,n.removeEventListener("object3dset",t))}))}})},3942:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="oculus-touch",h=n(1343).AFRAME_CDN_ROOT,d=h+"controllers/oculus/oculus-touch-controller-",u=h+"controllers/meta/",p={left:{modelUrl:d+"left.gltf",rayOrigin:{origin:{x:.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new r.Vector3(-.005,.036,-.037),modelPivotRotation:new r.Euler(Math.PI/4.5,0,0)},right:{modelUrl:d+"right.gltf",rayOrigin:{origin:{x:-.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new r.Vector3(.005,.036,-.037),modelPivotRotation:new r.Euler(Math.PI/4.5,0,0)}},A="oculus-touch",f={"oculus-touch":p,"oculus-touch-v2":{left:{modelUrl:d+"gen2-left.gltf",rayOrigin:{origin:{x:-.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new r.Vector3(0,-.007,-.021),modelPivotRotation:new r.Euler(-Math.PI/4,0,0)},right:{modelUrl:d+"gen2-right.gltf",rayOrigin:{origin:{x:.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new r.Vector3(0,-.007,-.021),modelPivotRotation:new r.Euler(-Math.PI/4,0,0)}},"oculus-touch-v3":{left:{modelUrl:d+"v3-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)},right:{modelUrl:d+"v3-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)}},"meta-quest-touch-pro":{left:{modelUrl:u+"quest-touch-pro-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)},right:{modelUrl:u+"quest-touch-pro-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)}},"meta-quest-touch-plus":{left:{modelUrl:u+"quest-touch-plus-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)},right:{modelUrl:u+"quest-touch-plus-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)}}},m={schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#999"},buttonTouchColor:{type:"color",default:"#8AB"},buttonHighlightColor:{type:"color",default:"#2DF"},model:{default:!0},controllerType:{default:"auto",oneOf:["auto","oculus-touch","oculus-touch-v2","oculus-touch-v3"]}},after:["tracked-controls"],mapping:{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton","surface"]}},bindMethods:function(){this.onButtonChanged=this.onButtonChanged.bind(this),this.onThumbstickMoved=this.onThumbstickMoved.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonDown=function(t){l(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){l(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e,e.data.hand)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e,e.data.hand)},this.controllerPresent=!1,this.previousButtonValues={},this.bindMethods(),this.triggerEuler=new r.Euler},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.controllerObject3D;e&&(e.visible=!1),o(this,c,{hand:this.data.hand,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},loadModel:function(e){var t,n=this.data;if(n.model){if(this.controllerObject3D)return this.controllerObject3D.visible=!0,void this.el.setObject3D("mesh",this.controllerObject3D);if(this.displayModel=f[n.controllerType]||f[A],"auto"===n.controllerType){t=A;for(var i=Object.keys(f),r=0;r<e.profiles.length;r++)if(-1!==i.indexOf(e.profiles[r])){t=e.profiles[r];break}this.displayModel=f[t]}var s=this.displayModel[n.hand].modelUrl;this.isTouchV3orPROorPlus=this.displayModel===f["oculus-touch-v3"]||this.displayModel===f["meta-quest-touch-pro"]||this.displayModel===f["meta-quest-touch-plus"],this.el.setAttribute("gltf-model",s)}},injectTrackedControls:function(e){var t=this.data,n=c;this.el.setAttribute("tracked-controls",{id:n,hand:t.hand,handTrackingEnabled:!1,iterateControllerProfiles:!0}),this.loadModel(e)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t=this.mapping[this.data.hand].buttons[e.detail.id];if(t){if(this.isTouchV3orPROorPlus)this.onButtonChangedV3orPROorPlus(e);else{var n,i=this.buttonMeshes;"trigger"!==t&&"grip"!==t||(n=e.detail.state.value),i&&("trigger"===t&&i.trigger&&(i.trigger.rotation.x=this.originalXRotationTrigger-n*(Math.PI/26)),"grip"===t&&i.grip&&(n*="left"===this.data.hand?-1:1,i.grip.position.x=this.originalXPositionGrip+.004*n))}this.el.emit(t+"changed",e.detail.state)}},onButtonChangedV3orPROorPlus:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id],i=this.buttonObjects;i&&i[n]&&(t=e.detail.state.value,i[n].quaternion.slerpQuaternions(this.buttonRanges[n].min.quaternion,this.buttonRanges[n].max.quaternion,t),i[n].position.lerpVectors(this.buttonRanges[n].min.position,this.buttonRanges[n].max.position,t))},onModelLoaded:function(e){if(e.target===this.el&&this.data.model){if(this.isTouchV3orPROorPlus)this.onTouchV3orPROorPlusModelLoaded(e);else{var t,n=this.controllerObject3D=e.detail.model;(t=this.buttonMeshes={}).grip=n.getObjectByName("buttonHand"),this.originalXPositionGrip=t.grip&&t.grip.position.x,t.trigger=n.getObjectByName("buttonTrigger"),this.originalXRotationTrigger=t.trigger&&t.trigger.rotation.x,t.thumbstick=n.getObjectByName("stick"),t.xbutton=n.getObjectByName("buttonX"),t.abutton=n.getObjectByName("buttonA"),t.ybutton=n.getObjectByName("buttonY"),t.bbutton=n.getObjectByName("buttonB")}for(var i in this.buttonMeshes)this.buttonMeshes[i]&&g(this.buttonMeshes[i]);this.applyOffset(e.detail.model),this.el.emit("controllermodelready",{name:"meta-touch-controls",model:this.data.model,rayOrigin:this.displayModel[this.data.hand].rayOrigin})}},applyOffset:function(e){e.position.copy(this.displayModel[this.data.hand].modelPivotOffset),e.rotation.copy(this.displayModel[this.data.hand].modelPivotRotation)},onTouchV3orPROorPlusModelLoaded:function(e){var t=this.controllerObject3D=e.detail.model,n=this.buttonObjects={},i=this.buttonMeshes={},r=this.buttonRanges={};i.grip=t.getObjectByName("squeeze"),n.grip=t.getObjectByName("xr_standard_squeeze_pressed_value"),r.grip={min:t.getObjectByName("xr_standard_squeeze_pressed_min"),max:t.getObjectByName("xr_standard_squeeze_pressed_max")},n.grip.minX=n.grip.position.x,i.thumbstick=t.getObjectByName("thumbstick"),n.thumbstick=t.getObjectByName("xr_standard_thumbstick_pressed_value"),r.thumbstick={min:t.getObjectByName("xr_standard_thumbstick_pressed_min"),max:t.getObjectByName("xr_standard_thumbstick_pressed_max")},n.thumbstickXAxis=t.getObjectByName("xr_standard_thumbstick_xaxis_pressed_value"),r.thumbstickXAxis={min:t.getObjectByName("xr_standard_thumbstick_xaxis_pressed_min"),max:t.getObjectByName("xr_standard_thumbstick_xaxis_pressed_max")},n.thumbstickYAxis=t.getObjectByName("xr_standard_thumbstick_yaxis_pressed_value"),r.thumbstickYAxis={min:t.getObjectByName("xr_standard_thumbstick_yaxis_pressed_min"),max:t.getObjectByName("xr_standard_thumbstick_yaxis_pressed_max")},i.trigger=t.getObjectByName("trigger"),n.trigger=t.getObjectByName("xr_standard_trigger_pressed_value"),r.trigger={min:t.getObjectByName("xr_standard_trigger_pressed_min"),max:t.getObjectByName("xr_standard_trigger_pressed_max")},r.trigger.diff={x:Math.abs(r.trigger.max.rotation.x)-Math.abs(r.trigger.min.rotation.x),y:Math.abs(r.trigger.max.rotation.y)-Math.abs(r.trigger.min.rotation.y),z:Math.abs(r.trigger.max.rotation.z)-Math.abs(r.trigger.min.rotation.z)};var s="left"===this.data.hand?"x":"a",o="left"===this.data.hand?"y":"b",a=s+"button",l=o+"button";i[a]=t.getObjectByName(s+"_button"),n[a]=t.getObjectByName(s+"_button_pressed_value"),r[a]={min:t.getObjectByName(s+"_button_pressed_min"),max:t.getObjectByName(s+"_button_pressed_max")},i[l]=t.getObjectByName(o+"_button"),n[l]=t.getObjectByName(o+"_button_pressed_value"),r[l]={min:t.getObjectByName(o+"_button_pressed_min"),max:t.getObjectByName(o+"_button_pressed_max")}},onAxisMoved:function(e){a(this,this.mapping[this.data.hand].axes,e)},onThumbstickMoved:function(e){if(this.buttonMeshes&&this.buttonMeshes.thumbstick)if(this.isTouchV3orPROorPlus)this.updateThumbstickTouchV3orPROorPlus(e);else for(var t in e.detail)this.buttonObjects.thumbstick.rotation[this.axisMap[t]]=this.buttonRanges.thumbstick.originalRotation[this.axisMap[t]]-Math.PI/8*e.detail[t]*("y"===t||"right"===this.data.hand?-1:1)},axisMap:{y:"x",x:"z"},updateThumbstickTouchV3orPROorPlus:function(e){var t=(e.detail.x+1)/2;this.buttonObjects.thumbstickXAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickXAxis.min.quaternion,this.buttonRanges.thumbstickXAxis.max.quaternion,t);var n=(e.detail.y+1)/2;this.buttonObjects.thumbstickYAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickYAxis.min.quaternion,this.buttonRanges.thumbstickYAxis.max.quaternion,n)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n,i=this.buttonMeshes;i&&i[e]&&(n="up"===t||"touchend"===t?i[e].originalColor||this.data.buttonColor:"touchstart"===t?this.data.buttonTouchColor:this.data.buttonHighlightColor,i[e].material.color.set(n))}};function g(e){e.traverse((function(t){var n;"Mesh"===t.type&&(n=t.material.clone(),e.originalColor=t.material.color,t.material.dispose(),t.material=n)}))}i("oculus-touch-controls",m),e.exports.Component=i("meta-touch-controls",m)},3176:(e,t,n)=>{var i,r,s,o,a,l=n(8190).registerComponent,c=n(9437);l("obb-collider",{schema:{size:{default:0},trackedObject3D:{default:""},minimumColliderDimension:{default:.02},centerModel:{default:!1}},init:function(){this.previousScale=(new c.Vector3).copy(this.el.object3D.scale),this.auxEuler=new c.Euler,this.boundingBox=new c.Box3,this.boundingBoxSize=new c.Vector3,this.updateCollider=this.updateCollider.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.updateBoundingBox=this.updateBoundingBox.bind(this),this.el.addEventListener("model-loaded",this.onModelLoaded),this.updateCollider(),this.system.addCollider(this.el)},remove:function(){this.system.removeCollider(this.el)},update:function(){this.data.trackedObject3D&&(this.trackedObject3DPath=this.data.trackedObject3D.split("."))},onModelLoaded:function(){this.data.centerModel&&this.centerModel(),this.updateCollider()},centerModel:function(){var e,t=this.el,n=t.components["gltf-model"]&&t.components["gltf-model"].model;n&&(this.el.removeObject3D("mesh"),e=(new c.Box3).setFromObject(n).getCenter(new c.Vector3),n.position.x+=n.position.x-e.x,n.position.y+=n.position.y-e.y,n.position.z+=n.position.z-e.z,this.el.setObject3D("mesh",n))},updateCollider:function(){var e=this.el,t=this.boundingBoxSize,n=this.aabb=this.aabb||new c.OBB;this.obb=this.obb||new c.OBB,e.hasLoaded?(this.updateBoundingBox(),n.halfSize.copy(t).multiplyScalar(.5),this.el.sceneEl.systems["obb-collider"].data.showColliders&&this.showCollider()):e.addEventListener("loaded",this.updateCollider)},showCollider:function(){this.updateColliderMesh(),this.renderColliderMesh.visible=!0},updateColliderMesh:function(){var e=this.renderColliderMesh,t=this.boundingBoxSize;e?(e.geometry.dispose(),e.geometry=new c.BoxGeometry(t.x,t.y,t.z)):this.initColliderMesh()},hideCollider:function(){this.renderColliderMesh&&(this.renderColliderMesh.visible=!1)},initColliderMesh:function(){var e,t,n;e=this.boundingBoxSize,t=this.renderColliderGeometry=new c.BoxGeometry(e.x,e.y,e.z),(n=this.renderColliderMesh=new c.Mesh(t,new c.MeshLambertMaterial({color:65280,side:c.DoubleSide}))).matrixAutoUpdate=!1,n.matrixWorldAutoUpdate=!1,n.updateMatrixWorld=function(){},this.el.sceneEl.object3D.add(n)},updateBoundingBox:(i=new c.Vector3,r=new c.Vector3,s=new c.Quaternion,o=new c.Quaternion,a=new c.Matrix4,function(){var e=this.auxEuler,t=this.boundingBox,n=this.data.size,l=this.trackedObject3D||this.el.object3D,c=this.boundingBoxSize,h=this.data.minimumColliderDimension;if(n)return this.boundingBoxSize.x=n,this.boundingBoxSize.y=n,void(this.boundingBoxSize.z=n);e.copy(l.rotation),l.rotation.set(0,0,0),l.parent.matrixWorld.decompose(i,s,r),a.compose(i,o,r),l.parent.matrixWorld.copy(a),t.setFromObject(l,!0),t.getSize(c),c.x=c.x<h?h:c.x,c.y=c.y<h?h:c.y,c.z=c.z<h?h:c.z,l.parent.matrixWorld.compose(i,s,r),this.el.object3D.rotation.copy(e)}),checkTrackedObject:function(){var e,t=this.trackedObject3DPath;if(t&&t.length&&!this.trackedObject3D){e=this.el;for(var n=0;n<t.length&&(e=e[t[n]]);n++);e&&(this.trackedObject3D=e,this.updateCollider())}return this.trackedObject3D},tick:function(){var e=new c.Vector3,t=new c.Vector3,n=new c.Quaternion,i=new c.Matrix4;return function(){var r=this.obb,s=this.renderColliderMesh,o=this.checkTrackedObject()||this.el.object3D;o&&(o.updateMatrix(),o.updateMatrixWorld(!0),o.matrixWorld.decompose(e,n,t),(Math.abs(t.x-this.previousScale.x)>1e-4||Math.abs(t.y-this.previousScale.y)>1e-4||Math.abs(t.z-this.previousScale.z)>1e-4)&&this.updateCollider(),this.previousScale.copy(t),t.set(1,1,1),i.compose(e,n,t),s&&s.matrixWorld.copy(i),r.copy(this.aabb),r.applyMatrix4(i))}}()})},8771:(e,t,n)=>{var i=n(8940),r=n(8190).registerComponent,s=n(9437),o=i("components:obj-model:warn");e.exports.Component=r("obj-model",{schema:{mtl:{type:"model"},obj:{type:"model"}},init:function(){var e=this;this.model=null,this.objLoader=new s.OBJLoader,this.mtlLoader=new s.MTLLoader(this.objLoader.manager),this.mtlLoader.crossOrigin="",this.el.addEventListener("componentinitialized",(function(t){e.model&&"material"===t.detail.name&&e.applyMaterial()}))},update:function(){var e=this.data;e.obj&&(this.resetMesh(),this.loadObj(e.obj,e.mtl))},remove:function(){this.resetMesh()},resetMesh:function(){this.model&&this.el.removeObject3D("mesh")},loadObj:function(e,t){var n=this,i=this.el,r=this.mtlLoader,s=this.objLoader,a=this.el.sceneEl.systems.renderer,l=t.substr(0,t.lastIndexOf("/")+1);if(t)return i.hasAttribute("material")&&o("Material component properties are ignored when a .MTL is provided"),r.setResourcePath(l),void r.load(t,(function(t){t.preload(),s.setMaterials(t),s.load(e,(function(e){n.model=e,n.model.traverse((function(e){if(e.isMesh){var t=e.material;t.map&&a.applyColorCorrection(t.map),t.emissiveMap&&a.applyColorCorrection(t.emissiveMap)}})),i.setObject3D("mesh",e),i.emit("model-loaded",{format:"obj",model:e})}))}));s.load(e,(function(e){n.model=e,n.applyMaterial(),i.setObject3D("mesh",e),i.emit("model-loaded",{format:"obj",model:e})}))},applyMaterial:function(){var e=this.el.components.material;e&&this.model.traverse((function(t){t instanceof s.Mesh&&(t.material=e.material)}))}})},6077:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l=n(1343).AFRAME_CDN_ROOT+"controllers/oculus/go/oculus-go-controller.gltf",c="oculus-go";e.exports.Component=i("oculus-go-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#FFFFFF"},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad"]},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.bindMethods()},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){s(this,c,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{hand:t.hand,idPrefix:c}),this.data.model&&this.el.setAttribute("gltf-model",l)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(e){var t,n=e.detail.model;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).trigger=n.getObjectByName("oculus_go_button_trigger"),t.trackpad=n.getObjectByName("oculus_go_touchpad"),t.touchpad=n.getObjectByName("oculus_go_touchpad"))},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n=this.buttonMeshes;if(n&&n[e]){var i;switch(t){case"down":i=this.data.buttonHighlightColor;break;case"touchstart":i=this.data.buttonTouchedColor;break;default:i=this.data.buttonColor}n[e].material.color.set(i)}}})},2588:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="pico-4",h=n(1343).AFRAME_CDN_ROOT+"controllers/pico/pico4/";e.exports.Component=i("pico-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){l(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e,e.data.hand)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e,e.data.hand)},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;o(this,c,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:c,hand:t.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",h+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){e.target===this.el&&this.data.model&&this.el.emit("controllermodelready",{name:"pico-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)})},onAxisMoved:function(e){a(this,this.mapping[this.data.hand].axes,e)}})},7519:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("position",{schema:{type:"vec3"},update:function(){var e=this.el.object3D,t=this.data;e.position.set(t.x,t.y,t.z)},remove:function(){this.el.object3D.position.set(0,0,0)}})},7394:(e,t,n)=>{var i,r,s=n(8190).registerComponent,o=n(9437),a=n(7427).debug("components:raycaster:warn"),l=/^[\w\s-.,[\]#]*$/,c={childList:!0,attributes:!0,subtree:!0},h="raycaster-intersected-cleared",d="raycaster-intersection-cleared";function u(e,t){var n;for(e.length=t.length,n=0;n<t.length;n++)e[n]=t[n]}e.exports.Component=s("raycaster",{schema:{autoRefresh:{default:!0},direction:{type:"vec3",default:{x:0,y:0,z:-1}},enabled:{default:!0},far:{default:1e3},interval:{default:0},near:{default:0},objects:{default:""},origin:{type:"vec3"},showLine:{default:!1},lineColor:{default:"white"},lineOpacity:{default:1},useWorldCoordinates:{default:!1}},multiple:!0,init:function(){this.clearedIntersectedEls=[],this.unitLineEndVec3=new o.Vector3,this.intersectedEls=[],this.intersections=[],this.newIntersectedEls=[],this.newIntersections=[],this.objects=[],this.prevCheckTime=void 0,this.prevIntersectedEls=[],this.rawIntersections=[],this.raycaster=new o.Raycaster,this.updateOriginDirection(),this.setDirty=this.setDirty.bind(this),this.updateLine=this.updateLine.bind(this),this.observer=new MutationObserver(this.setDirty),this.dirty=!0,this.lineEndVec3=new o.Vector3,this.otherLineEndVec3=new o.Vector3,this.lineData={end:this.lineEndVec3},this.getIntersection=this.getIntersection.bind(this),this.intersectedDetail={el:this.el,getIntersection:this.getIntersection},this.intersectedClearedDetail={el:this.el},this.intersectionClearedDetail={clearedEls:this.clearedIntersectedEls},this.intersectionDetail={}},update:function(e){var t=this.data,n=this.el,i=this.raycaster;i.far=t.far,i.near=t.near,!t.showLine||t.far===e.far&&t.origin===e.origin&&t.direction===e.direction&&e.showLine||(this.unitLineEndVec3.copy(t.direction).normalize(),this.drawLine()),!t.showLine&&e.showLine&&n.removeAttribute("line"),t.objects===e.objects||l.test(t.objects)||a('[raycaster] Selector "'+t.objects+'" may not update automatically with DOM changes.'),t.objects||a('[raycaster] For performance, please define raycaster.objects when using raycaster or cursor components to whitelist which entities to intersect with. e.g., raycaster="objects: [data-raycastable]".'),t.autoRefresh!==e.autoRefresh&&n.isPlaying&&(t.autoRefresh?this.addEventListeners():this.removeEventListeners()),e.enabled&&!t.enabled&&this.clearAllIntersections(),t.objects!==e.objects&&this.setDirty()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){this.data.showLine&&this.el.removeAttribute("line"),this.clearAllIntersections()},addEventListeners:function(){this.data.autoRefresh&&(this.observer.observe(this.el.sceneEl,c),this.el.sceneEl.addEventListener("object3dset",this.setDirty),this.el.sceneEl.addEventListener("object3dremove",this.setDirty))},removeEventListeners:function(){this.observer.disconnect(),this.el.sceneEl.removeEventListener("object3dset",this.setDirty),this.el.sceneEl.removeEventListener("object3dremove",this.setDirty)},setDirty:function(){this.dirty=!0},refreshObjects:function(){var e,t=this.data;e=t.objects?this.el.sceneEl.querySelectorAll(t.objects):this.el.sceneEl.querySelectorAll("*"),this.objects=this.flattenObject3DMaps(e),this.dirty=!1},tock:function(e){var t=this.data,n=this.prevCheckTime;t.enabled&&(n&&e-n<t.interval||(this.prevCheckTime=e,this.checkIntersections()))},checkIntersections:function(){var e,t,n=this.clearedIntersectedEls,i=this.el,r=this.data,s=this.intersectedEls,o=this.intersections,a=this.newIntersectedEls,l=this.newIntersections,c=this.prevIntersectedEls,p=this.rawIntersections;for(this.dirty&&this.refreshObjects(),u(this.prevIntersectedEls,this.intersectedEls),this.updateOriginDirection(),p.length=0,this.raycaster.intersectObjects(this.objects,!0,p),o.length=0,s.length=0,e=0;e<p.length;e++)t=p[e],r.showLine&&t.object===i.getObject3D("line")||t.object.el&&(o.push(t),s.push(t.object.el));for(l.length=0,a.length=0,e=0;e<o.length;e++)-1===c.indexOf(o[e].object.el)&&(l.push(o[e]),a.push(o[e].object.el));for(n.length=0,e=0;e<c.length;e++)-1===s.indexOf(c[e])&&(c[e].emit(h,this.intersectedClearedDetail),n.push(c[e]));for(n.length&&i.emit(d,this.intersectionClearedDetail),e=0;e<a.length;e++)a[e].emit("raycaster-intersected",this.intersectedDetail);l.length&&(this.intersectionDetail.els=a,this.intersectionDetail.intersections=l,i.emit("raycaster-intersection",this.intersectionDetail)),(0===c.length&&o.length>0||c.length>0&&0===o.length||c.length&&o.length&&c[0]!==o[0].object.el)&&(this.intersectionDetail.els=this.intersectedEls,this.intersectionDetail.intersections=o,i.emit("raycaster-closest-entity-changed",this.intersectionDetail)),r.showLine&&setTimeout(this.updateLine)},updateLine:function(){var e,t=this.el,n=this.intersections;n.length&&(e=n[0].object.el===t&&n[1]?n[1].distance:n[0].distance),this.drawLine(e)},getIntersection:function(e){var t,n;for(t=0;t<this.intersections.length;t++)if((n=this.intersections[t]).object.el===e)return n;return null},updateOriginDirection:(i=new o.Vector3,r=new o.Vector3,function(){var e=this.el,t=this.data;t.useWorldCoordinates?this.raycaster.set(t.origin,t.direction):(e.object3D.updateMatrixWorld(),r.setFromMatrixPosition(e.object3D.matrixWorld),0===t.origin.x&&0===t.origin.y&&0===t.origin.z||(r=e.object3D.localToWorld(r.copy(t.origin))),i.copy(t.direction).transformDirection(e.object3D.matrixWorld).normalize(),this.raycaster.set(r,i))}),drawLine:function(e){var t,n=this.data,i=this.el;t=this.lineData.end===this.lineEndVec3?this.otherLineEndVec3:this.lineEndVec3,void 0===e&&(e=n.far===1/0?1e3:n.far),this.lineData.start=n.origin,this.lineData.end=t.copy(this.unitLineEndVec3).multiplyScalar(e).add(n.origin),this.lineData.color=n.lineColor,this.lineData.opacity=n.lineOpacity,i.setAttribute("line",this.lineData)},flattenObject3DMaps:function(e){var t,n,i=this.objects,r=this.el.sceneEl.object3D;function s(e){return e.parent?s(e.parent):e===r}for(i.length=0,n=0;n<e.length;n++){var o=e[n];if(o.isEntity&&o.object3D&&s(o.object3D))for(t in o.object3DMap)i.push(o.getObject3D(t))}return i},clearAllIntersections:function(){var e;for(e=0;e<this.intersectedEls.length;e++)this.intersectedEls[e].emit(h,this.intersectedClearedDetail);u(this.clearedIntersectedEls,this.intersectedEls),this.intersectedEls.length=0,this.intersections.length=0,this.el.emit(d,this.intersectionClearedDetail)}})},2310:(e,t,n)=>{var i=n(9437).MathUtils.degToRad,r=n(8190).registerComponent;e.exports.Component=r("rotation",{schema:{type:"vec3"},update:function(){var e=this.data;this.el.object3D.rotation.set(i(e.x),i(e.y),i(e.z),"YXZ")},remove:function(){this.el.object3D.rotation.set(0,0,0)}})},4760:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("scale",{schema:{type:"vec3",default:{x:1,y:1,z:1}},update:function(){var e=this.data;this.el.object3D.scale.set(e.x,e.y,e.z)},remove:function(){this.el.object3D.scale.set(1,1,1)}})},3575:(e,t,n)=>{var i,r,s,o=n(8190).registerComponent,a=n(9437),l=(i=new a.Quaternion,r=new a.Vector3,function(e,t,n){t.position.copy(e.transform.position),t.quaternion.copy(e.transform.orientation),r.copy(n),i.copy(e.transform.orientation),r.applyQuaternion(i),t.position.sub(r)});function c(e,t){this.renderer=e,this.xrHitTestSource=null,e.xr.addEventListener("sessionend",function(){this.xrHitTestSource=null}.bind(this)),e.xr.addEventListener("sessionstart",function(){this.sessionStart(t)}.bind(this)),this.renderer.xr.isPresenting&&this.sessionStart(t)}function h(e){console.warn(e.message),console.warn('Cannot requestHitTestSource Are you missing: webxr="optionalFeatures: hit-test;" from <a-scene>?')}l.tempFakePose={transform:{orientation:new a.Quaternion,position:new a.Vector3}},c.prototype.previousFrameAnchors=new Set,c.prototype.anchorToObject3D=new Map,c.prototype.sessionStart=function(e){this.session=this.renderer.xr.getSession(),"requestHitTestSource"in this.session?e.space?this.session.requestHitTestSource(e).then(function(e){this.xrHitTestSource=e}.bind(this)).catch(h):e.profile&&this.session.requestHitTestSourceForTransientInput(e).then(function(e){this.xrHitTestSource=e,this.transient=!0}.bind(this)).catch(h):h({message:"No requestHitTestSource on the session."})},c.prototype.anchorFromLastHitTestResult=function(e,t){var n=this.lastHitTest;if(n){var i={object3D:e,offset:t};Array.from(this.anchorToObject3D.entries()).forEach(function(t){var n=t[1].object3D,i=t[0];n===e&&(this.anchorToObject3D.delete(i),i.delete())}.bind(this)),n.createAnchor&&n.createAnchor().then(function(e){this.anchorToObject3D.set(e,i)}.bind(this)).catch((function(e){console.warn(e.message),console.warn('Cannot create anchor, are you missing: webxr="optionalFeatures: anchors;" from <a-scene>?')}))}},c.prototype.doHit=function(e){if(this.renderer.xr.isPresenting){var t,n,i=this.renderer.xr.getReferenceSpace(),r=e.getViewerPose(i);return this.xrHitTestSource&&r?this.transient?(t=e.getHitTestResultsForTransientInput(this.xrHitTestSource)).length>0&&(n=t[0].results).length>0&&(this.lastHitTest=n[0],n[0].getPose(i)):(t=e.getHitTestResults(this.xrHitTestSource)).length>0&&(this.lastHitTest=t[0],t[0].getPose(i)):void 0}},c.updateAnchorPoses=function(e,t){var n=e.trackedAnchors||c.prototype.previousFrameAnchors;c.prototype.previousFrameAnchors.forEach((function(e){n.has(e)||c.prototype.anchorToObject3D.delete(e)})),n.forEach((function(n){var i,r,s,o;try{if(i=e.getPose(n.anchorSpace,t)){if(!(r=c.prototype.anchorToObject3D.get(n)))return;s=r.offset,o=r.object3D,l(i,o,s)}}catch(e){console.error("while updating anchor poses:",e)}})),c.prototype.previousFrameAnchors=n},e.exports.Component=o("ar-hit-test",{schema:{target:{type:"selector"},enabled:{default:!0},src:{default:"data:image/webp;base64,UklGRkQHAABXRUJQVlA4WAoAAAAQAAAA/wEA/wEAQUxQSL0DAAARDzD/ERGCjrY9sYYFfgo6aa1kJ7K0w9Lo3AadLSVeFxevQwj5kuM8RfR/Atw/C0+ozB/oUBrloFZs6ElSW88j1KA4yExNWQaqRZquIDF0JYmlq0hAuUDTFu66tng3teW7pa3cQf1V1edvur54M/Slm6Wv3Gx9zw0MXlQLntcsBN6wkHjTQuYtC4W3LTw8mGRVG57TbAROtxHfZNhInGkjc5aNwtk2Hg6Mvki14k+NkZzCwQgCxalcAv3kddRTPI1DcUrXId1FLf1uHpzaQz4tquhZVLlKesbVpqKeTj0n0F5PpXDlFN9UqmhalL/ImuZFo6KmToWLoKlddMprqlS8cKovBvHo2kTiFV2LN4msaxKZl3QNiair8xYRdDWivIvXVXmbcMqJ51UebZuFXxZt6xd4laxtciqRtA3Cv0nU1t+kEUFbI8JvCa+tvkm3FDlO/W+OR99+kWEp/YYo+tYfTVnf/K8cE/F///3vv//993eeL+a+uvjawLcX3xjYvJotBFY3kVjTRGFtE+BU2AiMbiQyhpHMWEYeBozAH5qNBYRDB5KBCaTDBKKBAZTDBoKBDjwHAN5ABeCJBsAZcAAC0YHHxAYSMYBiYgGZWEA2MYFCbCCZGAAIANFEB+AnYgMQTDQAYSJ2AN5EBZAm4gDgTDgAeSIu4DGygTIRN1CMLOCZiACykQlg4jsAycgA8AO+BxCNdJyDkcbwRirDGXGnx8w+FDPrkM3MQ9JQZMYhiiwV/RDMtIM3U1/DmXHUo+IR2kSR2ToWkQ1NIn2qf2J8LCqJKiDUiSADHY3whirhdHgZ94HKaR97PhE+twEUJUFoAcgyTct8hfSxSkShASDKdMJ/ritKHwgyQ0sD4D/miCxU5SbhOOUDTnZpccCjYP/i0bZ/8bAgtVGEoGapWIQXyzKVKLwgNJFk2rtMIgoNRJlOZF7SNSSyUEeQmbxBFKEmtYjEe8S8zOZ1AkJVCmS88FJOtF40Ksg4oUaFiygk3C8qlTVNyl8UTevCUdAE2t14PfVqU1FPp57TopKeQZWromddTQp6QOfTOEQt/ZDuipZ11w/wOiqO8dRORcc6BQEkDQMClaHcn5wV9yLbxsNZNgpn2sicYSNxuo34Js1G4FQbnuNsOPa28PCWhcKbFjJvWEi8ZiHwqgXPcxbc5db33Cx95WboSzddX7yp+vyN0+eul7ZyN7Xlu64t3jVt4c5pc4JLV5EYupJE0xUknC4nOjVlmaYpyLit53HCQ0+ScnqceNcS5dzUkd0/CwMAVlA4IGADAAAQXwCdASoAAgACP8ne6Wy/tjCpqJ/IA/A5CWlu4XYBG/Pz8AfwD8APz//f3v8E1fuHZnxKYACtfuHZnxKYACrYTb5mOslhxu843ecbvON3nG7zjd3a0VCn7G1MABVxwH/Xd25gAK1+4dmfEpe2+PHhQaj75++riG6FuYACtfuHZnxKYACRrK3q9xO8Ss3uWKnMhs/rDF1hi6wxdYYusMXWGI5QRcCFDZog5OgqNlse1NDuz/UoFa/cOzPiUwAEsAOK4/nu5eZHK2tlXxJfNYlMABWv3Dsz4bvNJ5YA/LtxJ38SmAArX7h2Z8Sk5vdZUYv7mZPiUwAFa/cOzPh21s5OgZxf1mfEpemRyFr/rM+JS9noA/LtxJ38SmAAlUJIotzAASn6TjdhK+D3Dsz4dyvB7h2Z8O2tnJ0DOL+sz4lL2nKLT4lL/+iSLOocxq639w7M34MNZdm55uJ8v8ra2cpVZnxKTq2F3PN/cNksAfl24k7+JTAASqrD37h2Z7b1W+VtbOUqsz4lJ1bC7nm/uGyWAPy7cSd/EpgAJVVh79w7M9t6rfK2tnKVWZ8Sk6thdzzf3DZLAH5duJO/iUwAEqqw9+4dme29VvlbWzlKrM+JSdWwu55v7hslgD8u3EnfxKYACVVYe/cOzPbeq3ytrZylVme0kYJ8557FLerqFrzIbPrrf3DZLAH5duJO/iUvaVMS9BoaF4p7pSDFTP1XMyfElelrM0DOL+sz4eBJ13nV1OppBGPuKb4YzXQgq9uH19uS/0+JS9t9fr6ZUlQBelDG6GMgq97otb5QMPJwtKyBTbFp8Sl7b6/X0ykkawEOsgdiE6Fi0vb/Eve6xkwsmug0Z4nGNHQO8839bpTsjpz7SWIJxKagvd1QWMa6FYT1KEw3j4XDT6vJ9Xk+nyfT5Pq8n1eEmk5dinMM/9Fcfz4Z3Dsz3KD2dw7LxBRxKrqUUGQPH/7zxr1KIfNpLEJ0MZB2ITM/0Z2EFoh12NlXnEcpYcbvON3nG7zjd5xu84vfcNIAAP7+y8ceyzbVxkakPYY4lcr72fqOnDwipv+yxC71wAADBrjKnAAAAAAAAAAAAAAw7oNGHttqWONcoFN/2WIDc2pa6WVFtFYROlsaMaTXdcOjXHz93+YxAglKa4AAAAA=",type:"map"},type:{default:"footprint",oneOf:["footprint","map"]},footprintDepth:{default:.1},mapSize:{type:"vec2",default:{x:.5,y:.5}}},sceneOnly:!0,init:function(){this.hitTest=null,this.imageDataArray=new Uint8ClampedArray(1048576),this.imageData=new ImageData(this.imageDataArray,512,512),this.textureCache=new Map,this.orthoCam=new a.OrthographicCamera,this.orthoCam.layers.set(21),this.textureTarget=new a.WebGLRenderTarget(512,512,{}),this.basicMaterial=new a.MeshBasicMaterial({color:0,side:a.DoubleSide}),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.context.imageSmoothingEnabled=!1,this.canvas.width=512,this.canvas.height=512,this.canvasTexture=new a.CanvasTexture(this.canvas,{alpha:!0}),this.canvasTexture.flipY=!1;var e=this.el.getAttribute("webxr"),t=e.optionalFeatures;t.includes("hit-test")&&t.includes("anchors")||(t.push("hit-test"),t.push("anchors"),this.el.setAttribute("webxr",e)),this.el.sceneEl.renderer.xr.addEventListener("sessionend",function(){this.hitTest=null}.bind(this)),this.el.sceneEl.renderer.xr.addEventListener("sessionstart",function(){if(this.el.is("ar-mode")){var e=this.el.sceneEl.renderer,t=this.session=e.xr.getSession();this.hasPosedOnce=!1,this.bboxMesh.visible=!1,s||(s=new Map),t.requestReferenceSpace("viewer").then(function(t){this.viewerHitTest=this.hitTest=new c(e,{space:t}),this.el.emit("ar-hit-test-start")}.bind(this));var n=this;this.el.sceneEl.addEventListener("controllersupdated",(function(){var t=this.xrSession&&this.xrSession.inputSources;if(t)for(var i=0;i<t.length;++i)if("tracked-pointer"===t[i].targetRayMode){n.hitTest=new c(e,{space:t[i].targetRaySpace}),s.set(t[i],n.hitTest),n.viewerHitTest&&"function"==typeof n.viewerHitTest.cancel&&(n.viewerHitTest.cancel(),n.viewerHitTest=null);break}}));var i="generic-touchscreen",r=new c(e,{profile:i});t.addEventListener("selectstart",function(t){if(!0===this.data.enabled){var n=t.inputSource;this.bboxMesh.visible=!0,!0===this.hasPosedOnce&&(this.el.emit("ar-hit-test-select-start",{inputSource:n,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),n.profiles[0]===i?this.hitTest=r:(this.hitTest=s.get(n)||new c(e,{space:n.targetRaySpace}),s.set(n,this.hitTest)))}}.bind(this)),t.addEventListener("selectend",function(e){if(this.hitTest&&!0===this.data.enabled){var t,n=e.inputSource;!0===this.hasPosedOnce&&(this.bboxMesh.visible=!1,this.data.target&&(t=this.data.target.object3D)&&(l.tempFakePose.transform.position.copy(this.bboxMesh.position),l.tempFakePose.transform.orientation.copy(this.bboxMesh.quaternion),l(l.tempFakePose,t,this.bboxOffset),t.visible=!0,this.hitTest.anchorFromLastHitTestResult(t,this.bboxOffset)),this.el.emit("ar-hit-test-select",{inputSource:n,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),this.hitTest=null)}else this.hitTest=null}.bind(this))}}.bind(this)),this.bboxOffset=new a.Vector3,this.update=this.update.bind(this),this.makeBBox()},update:function(){!1===this.data.enabled&&(this.hitTest=null,this.bboxMesh.visible=!1),this.data.target&&(this.data.target.object3D?(this.data.target.addEventListener("model-loaded",this.update),this.data.target.object3D.layers.enable(21),this.data.target.object3D.traverse((function(e){e.layers.enable(21)}))):this.data.target.addEventListener("loaded",this.update,{once:!0})),this.bboxNeedsUpdate=!0},makeBBox:function(){var e=new a.PlaneGeometry(1,1),t=new a.MeshBasicMaterial({transparent:!0,color:16777215});e.rotateX(-Math.PI/2),e.rotateY(-Math.PI/2),this.bbox=new a.Box3,this.bboxMesh=new a.Mesh(e,t),this.el.setObject3D("ar-hit-test",this.bboxMesh),this.bboxMesh.visible=!1},updateFootprint:function(){var e,t,n,i=this.el.sceneEl.renderer,r=i.xr.enabled;this.bboxMesh.material.map=this.canvasTexture,this.bboxMesh.material.needsUpdate=!0,this.orthoCam.rotation.set(-Math.PI/2,0,-Math.PI/2),this.orthoCam.position.copy(this.bboxMesh.position),this.orthoCam.position.y-=this.bboxMesh.scale.y/2,this.orthoCam.near=.1,this.orthoCam.far=this.orthoCam.near+this.data.footprintDepth*this.bboxMesh.scale.y,this.orthoCam.position.y+=this.orthoCam.far,this.orthoCam.right=this.bboxMesh.scale.z/2,this.orthoCam.left=-this.bboxMesh.scale.z/2,this.orthoCam.top=this.bboxMesh.scale.x/2,this.orthoCam.bottom=-this.bboxMesh.scale.x/2,this.orthoCam.updateProjectionMatrix(),t=i.getRenderTarget(),i.setRenderTarget(this.textureTarget),i.xr.enabled=!1,n=this.el.object3D.background,this.el.object3D.overrideMaterial=this.basicMaterial,this.el.object3D.background=null,i.render(this.el.object3D,this.orthoCam),this.el.object3D.background=n,this.el.object3D.overrideMaterial=null,i.xr.enabled=r,i.setRenderTarget(t),i.readRenderTargetPixels(this.textureTarget,0,0,512,512,this.imageDataArray),this.context.putImageData(this.imageData,0,0),this.context.shadowColor="white",this.context.shadowBlur=10,this.context.drawImage(this.canvas,0,0),e=this.context.getImageData(0,0,512,512);for(var s=0;s<262144;s++)0!==e.data[4*s+3]&&255!==e.data[4*s+3]&&(e.data[4*s+3]=128);this.context.putImageData(e,0,0),this.canvasTexture.needsUpdate=!0},tick:function(){var e,t,n=this.el.sceneEl.frame,i=this.el.sceneEl.renderer;(n&&c.updateAnchorPoses(n,i.xr.getReferenceSpace()),this.bboxNeedsUpdate)&&(this.bboxNeedsUpdate=!1,this.data.target&&"map"!==this.data.type||(this.textureCache.has(this.data.src)?t=this.textureCache.get(this.data.src):(t=(new a.TextureLoader).load(this.data.src),this.textureCache.set(this.data.src,t)),this.bboxMesh.material.map=t,this.bboxMesh.material.needsUpdate=!0),this.data.target&&this.data.target.object3D?(this.bbox.setFromObject(this.data.target.object3D),this.bbox.getCenter(this.bboxMesh.position),this.bbox.getSize(this.bboxMesh.scale),"footprint"===this.data.type&&(this.bboxMesh.scale.x*=1.04,this.bboxMesh.scale.z*=1.04,this.updateFootprint()),this.bboxMesh.position.y-=this.bboxMesh.scale.y/2,this.bboxOffset.copy(this.bboxMesh.position),this.bboxOffset.sub(this.data.target.object3D.position)):this.bboxMesh.scale.set(this.data.mapSize.x,1,this.data.mapSize.y));this.hitTest&&(e=this.hitTest.doHit(n))&&(!0!==this.hasPosedOnce&&(this.hasPosedOnce=!0,this.el.emit("ar-hit-test-achieved")),this.bboxMesh.visible=!0,this.bboxMesh.position.copy(e.transform.position),this.bboxMesh.quaternion.copy(e.transform.orientation))}})},4005:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("background",{schema:{color:{type:"color",default:"black"},transparent:{default:!1}},sceneOnly:!0,update:function(){var e=this.data,t=this.el.object3D;e.transparent?t.background=null:t.background=new THREE.Color(e.color)},remove:function(){this.el.object3D.background=null}})},3494:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("debug",{schema:{default:!0},sceneOnly:!0})},6273:(e,t,n)=>{var i=n(8190).registerComponent,r=n(1343),s="a-dialog-buttons-container",o="a-dialog-button";function a(e,t){var n,i,s,o;return(n=document.createElement("div")).classList.add("a-modal"),n.setAttribute(r.AFRAME_INJECTED,""),(i=document.createElement("div")).className="a-dialog",i.setAttribute(r.AFRAME_INJECTED,""),n.appendChild(i),(s=document.createElement("div")).classList.add("a-dialog-text-container"),i.appendChild(s),(o=document.createElement("div")).classList.add("a-dialog-text"),o.innerHTML=e,s.appendChild(o),i.appendChild(t),n}e.exports.Component=i("device-orientation-permission-ui",{schema:{enabled:{default:!0},deviceMotionMessage:{default:"This immersive website requires access to your device motion sensors."},httpsMessage:{default:"Access this site over HTTPS to enter VR mode and grant access to the device sensors."},denyButtonText:{default:"Deny"},allowButtonText:{default:"Allow"},cancelButtonText:{default:"Cancel"}},sceneOnly:!0,init:function(){var e=this;this.data.enabled&&(window.isSecureContext||this.showHTTPAlert(),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission?(this.onDeviceMotionDialogAllowClicked=this.onDeviceMotionDialogAllowClicked.bind(this),this.onDeviceMotionDialogDenyClicked=this.onDeviceMotionDialogDenyClicked.bind(this),DeviceOrientationEvent.requestPermission().then((function(){e.el.emit("deviceorientationpermissiongranted"),e.permissionGranted=!0})).catch((function(){var t,n,i,l,c,h,d,u;e.devicePermissionDialogEl=(t=e.data.denyButtonText,n=e.data.allowButtonText,i=e.data.deviceMotionMessage,l=e.onDeviceMotionDialogAllowClicked,c=e.onDeviceMotionDialogDenyClicked,(h=document.createElement("div")).classList.add(s),(d=document.createElement("button")).classList.add(o,"a-dialog-deny-button"),d.setAttribute(r.AFRAME_INJECTED,""),d.innerHTML=t,h.appendChild(d),(u=document.createElement("button")).classList.add(o,"a-dialog-allow-button"),u.setAttribute(r.AFRAME_INJECTED,""),u.innerHTML=n,h.appendChild(u),u.addEventListener("click",(function(e){e.stopPropagation(),l()})),d.addEventListener("click",(function(e){e.stopPropagation(),c()})),a(i,h)),e.el.appendChild(e.devicePermissionDialogEl)}))):this.permissionGranted=!0)},remove:function(){this.devicePermissionDialogEl&&this.el.removeChild(this.devicePermissionDialogEl)},onDeviceMotionDialogDenyClicked:function(){this.remove()},showHTTPAlert:function(){var e,t,n,i,l,c=this,h=(e=c.data.cancelButtonText,t=c.data.httpsMessage,n=function(){c.el.removeChild(h)},(i=document.createElement("div")).classList.add(s),(l=document.createElement("button")).classList.add(o,"a-dialog-ok-button"),l.setAttribute(r.AFRAME_INJECTED,""),l.innerHTML=e,i.appendChild(l),l.addEventListener("click",(function(e){e.stopPropagation(),n()})),a(t,i));this.el.appendChild(h)},onDeviceMotionDialogAllowClicked:function(){var e=this;this.el.emit("deviceorientationpermissionrequested"),DeviceOrientationEvent.requestPermission().then((function(t){"granted"===t?(e.el.emit("deviceorientationpermissiongranted"),e.permissionGranted=!0):e.el.emit("deviceorientationpermissionrejected"),e.remove()})).catch(console.error)}})},3239:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("embedded",{dependencies:["xr-mode-ui"],schema:{default:!0},sceneOnly:!0,update:function(){var e=this.el,t=e.querySelector(".a-enter-vr");!0===this.data?(t&&t.classList.add("embedded"),e.removeFullScreenStyles()):(t&&t.classList.remove("embedded"),e.addFullScreenStyles())}})},6149:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437);n(8940)("components:fog:warn"),e.exports.Component=i("fog",{schema:{color:{type:"color",default:"#000"},density:{default:25e-5},far:{default:1e3,min:0},near:{default:1,min:0},type:{default:"linear",oneOf:["linear","exponential"]}},sceneOnly:!0,update:function(){var e=this.data,t=this.el,n=this.el.object3D.fog;n&&e.type===n.name?Object.keys(this.schema).forEach((function(t){var i=e[t];"color"===t&&(i=new r.Color(i)),n[t]=i})):t.object3D.fog=function(e){var t;return(t="exponential"===e.type?new r.FogExp2(e.color,e.density):new r.Fog(e.color,e.near,e.far)).name=e.type,t}(e)},remove:function(){var e=this.el;this.el.object3D.fog&&(e.object3D.fog=null)}})},2288:(e,t,n)=>{var i,r=n(1343).AFRAME_INJECTED,s=n(8330),o=n(8190).registerComponent,a=n(7427),l="https://unpkg.com/aframe-inspector@"+((i=s.version.split("."))[2]="x",i.join(".")+"/dist/aframe-inspector.min.js");e.exports.Component=o("inspector",{schema:{url:{default:l}},sceneOnly:!0,init:function(){this.firstPlay=!0,this.onKeydown=this.onKeydown.bind(this),this.onMessage=this.onMessage.bind(this),this.initOverlay(),window.addEventListener("keydown",this.onKeydown),window.addEventListener("message",this.onMessage)},play:function(){var e;this.firstPlay&&"false"!==(e=a.getUrlParameter("inspector"))&&e&&(this.openInspector(),this.firstPlay=!1)},initOverlay:function(){this.loadingMessageEl=document.createElement("div"),this.loadingMessageEl.classList.add("a-inspector-loader"),this.loadingMessageEl.innerHTML='Loading Inspector<span class="dots"><span>.</span><span>.</span><span>.</span></span>'},remove:function(){this.removeEventListeners()},onKeydown:function(e){73===e.keyCode&&(e.ctrlKey&&e.altKey||e.getModifierState("AltGraph"))&&this.openInspector()},showLoader:function(){document.body.appendChild(this.loadingMessageEl)},hideLoader:function(){document.body.removeChild(this.loadingMessageEl)},onMessage:function(e){"INJECT_AFRAME_INSPECTOR"===e.data&&this.openInspector()},openInspector:function(e){var t,n=this;AFRAME.INSPECTOR||AFRAME.inspectorInjected?AFRAME.INSPECTOR.open(e):(this.showLoader(),(t=document.createElement("script")).src=this.data.url,t.setAttribute("data-name","aframe-inspector"),t.setAttribute(r,""),t.onload=function(){AFRAME.INSPECTOR.open(e),n.hideLoader(),n.removeEventListeners()},t.onerror=function(){n.loadingMessageEl.innerHTML="Error loading Inspector"},document.head.appendChild(t),AFRAME.inspectorInjected=!0)},removeEventListeners:function(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("message",this.onMessage)}})},2130:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7427).shouldCaptureKeyEvent;e.exports.Component=i("keyboard-shortcuts",{schema:{enterVR:{default:!0},exitVR:{default:!0}},sceneOnly:!0,init:function(){this.onKeyup=this.onKeyup.bind(this)},play:function(){window.addEventListener("keyup",this.onKeyup,!1)},pause:function(){window.removeEventListener("keyup",this.onKeyup)},onKeyup:function(e){var t=this.el;r(e)&&(this.data.enterVR&&70===e.keyCode&&t.enterVR(),this.data.exitVR&&27===e.keyCode&&t.exitVR())}})},3791:(e,t,n)=>{var i=n(8940),r=n(8190).registerComponent,s=i("components:pool:warn");e.exports.Component=r("pool",{schema:{container:{default:""},mixin:{default:""},size:{default:0},dynamic:{default:!1}},sceneOnly:!0,multiple:!0,initPool:function(){var e;for(this.availableEls=[],this.usedEls=[],this.data.mixin||s("No mixin provided for pool component."),this.data.container&&(this.container=document.querySelector(this.data.container),this.container||s("Container "+this.data.container+" not found.")),this.container=this.container||this.el,e=0;e<this.data.size;++e)this.createEntity()},update:function(e){var t=this.data;e.mixin===t.mixin&&e.size===t.size||this.initPool()},createEntity:function(){var e;(e=document.createElement("a-entity")).play=this.wrapPlay(e.play),e.setAttribute("mixin",this.data.mixin),e.object3D.visible=!1,e.pause(),this.container.appendChild(e),this.availableEls.push(e);var t=this.usedEls;e.addEventListener("loaded",(function(){-1===t.indexOf(e)&&(e.object3DParent=e.object3D.parent,e.object3D.parent.remove(e.object3D))}))},wrapPlay:function(e){var t=this.usedEls;return function(){-1!==t.indexOf(this)&&e.call(this)}},requestEntity:function(){var e;if(0===this.availableEls.length){if(!1===this.data.dynamic)return void s("Requested entity from empty pool: "+this.attrName);s("Requested entity from empty pool. This pool is dynamic and will resize automatically. You might want to increase its initial size: "+this.attrName),this.createEntity()}return e=this.availableEls.shift(),this.usedEls.push(e),e.object3DParent&&(e.object3DParent.add(e.object3D),this.updateRaycasters()),e.object3D.visible=!0,e},returnEntity:function(e){var t=this.usedEls.indexOf(e);if(-1!==t)return this.usedEls.splice(t,1),this.availableEls.push(e),e.object3DParent=e.object3D.parent,e.object3D.parent.remove(e.object3D),this.updateRaycasters(),e.object3D.visible=!1,e.pause(),e;s("The returned entity was not previously pooled from "+this.attrName)},updateRaycasters:function(){document.querySelectorAll("[raycaster]").forEach((function(e){e.components.raycaster.setDirty()}))}})},2662:(e,t,n)=>{var i,r=n(8190).registerComponent,s=n(9437);e.exports.Component=r("real-world-meshing",{schema:{filterLabels:{type:"array"},meshesEnabled:{default:!0},meshMixin:{default:!0},planesEnabled:{default:!0},planeMixin:{default:""}},sceneOnly:!0,init:function(){var e=this.el.getAttribute("webxr"),t=e.requiredFeatures;-1===t.indexOf("mesh-detection")&&(t.push("mesh-detection"),this.el.setAttribute("webxr",e)),-1===t.indexOf("plane-detection")&&(t.push("plane-detection"),this.el.setAttribute("webxr",e)),this.meshEntities=[],this.initWorldMeshEntity=this.initWorldMeshEntity.bind(this)},tick:function(){this.el.is("ar-mode")&&(this.detectMeshes(),this.updateMeshes())},detectMeshes:function(){var e,t,n,i=this.data,r=this.el,s=(r.renderer.xr,this.meshEntities),o=!1,a=[],l=this.data.filterLabels;e=(n=r.frame).detectedMeshes,t=n.detectedPlanes;for(var c=0;c<s.length;c++)s[c].present=!1;if(i.meshesEnabled)for(var h of e.values())if(!l.length||-1!==l.indexOf(h.semanticLabel)){for(c=0;c<s.length;c++)if(h===s[c].mesh){o=!0,s[c].present=!0,s[c].lastChangedTime<h.lastChangedTime&&this.updateMeshGeometry(s[c].el,h),s[c].lastChangedTime=h.lastChangedTime;break}o||a.push(h),o=!1}if(i.planesEnabled)for(h of t.values())if(!l.length||-1!==l.indexOf(h.semanticLabel)){for(c=0;c<s.length;c++)if(h===s[c].mesh){o=!0,s[c].present=!0,s[c].lastChangedTime<h.lastChangedTime&&this.updateMeshGeometry(s[c].el,h),s[c].lastChangedTime=h.lastChangedTime;break}o||a.push(h),o=!1}this.deleteMeshes(),this.createNewMeshes(a)},updateMeshes:(i=new s.Matrix4,function(){for(var e,t,n,r=this.el,s=r.frame,o=this.meshEntities,a=r.renderer.xr.getReferenceSpace(),l=0;l<o.length;l++)n=o[l].mesh.meshSpace||o[l].mesh.planeSpace,e=s.getPose(n,a),(t=o[l].el).hasLoaded&&(i.fromArray(e.transform.matrix),i.decompose(t.object3D.position,t.object3D.quaternion,t.object3D.scale))}),deleteMeshes:function(){for(var e=this.meshEntities,t=[],n=0;n<e.length;n++)e[n].present?t.push(e[n]):this.el.removeChild(e[n]);this.meshEntities=t},createNewMeshes:function(e){for(var t,n=0;n<e.length;n++)t=document.createElement("a-entity"),this.meshEntities.push({mesh:e[n],el:t}),t.addEventListener("loaded",this.initWorldMeshEntity),this.el.appendChild(t)},initMeshGeometry:function(e){var t,n,i;if(e instanceof XRPlane){n=new s.Shape,i=e.polygon;for(var r=0;r<i.length;++r)0===r?n.moveTo(i[r].x,i[r].z):n.lineTo(i[r].x,i[r].z);return(t=new s.ShapeGeometry(n)).rotateX(Math.PI/2),t}return(t=new s.BufferGeometry).setAttribute("position",new s.BufferAttribute(e.vertices,3)),t.setIndex(new s.BufferAttribute(e.indices,1)),t},initWorldMeshEntity:function(e){for(var t,n,i,r=e.target,o=this.meshEntities,a=0;a<o.length;a++)if(o[a].el===r){i=o[a];break}t=this.initMeshGeometry(i.mesh),n=new s.Mesh(t,new s.MeshBasicMaterial({color:16777215*Math.random(),side:s.DoubleSide})),r.setObject3D("mesh",n),i.mesh instanceof XRPlane&&this.data.planeMixin?r.setAttribute("mixin",this.data.planeMixin):this.data.meshMixin&&r.setAttribute("mixin",this.data.meshMixin),r.setAttribute("data-world-mesh",i.mesh.semanticLabel)},updateMeshGeometry:function(e,t){var n=e.getObject3D("mesh");n.geometry.dispose(),n.geometry=this.initMeshGeometry(t)}})},952:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("reflection",{schema:{directionalLight:{type:"selector"}},sceneOnly:!0,init:function(){var e=this;this.cubeRenderTarget=new THREE.WebGLCubeRenderTarget(16),this.cubeCamera=new THREE.CubeCamera(.1,1e3,this.cubeRenderTarget),this.lightingEstimationTexture=new THREE.WebGLCubeRenderTarget(16).texture,this.needsVREnvironmentUpdate=!0;var t=this.el.getAttribute("webxr"),n=t.optionalFeatures;n.includes("light-estimation")||(n.push("light-estimation"),this.el.setAttribute("webxr",t)),this.el.addEventListener("enter-vr",(function(){e.el.is("ar-mode")&&e.el.renderer.xr.getSession().requestLightProbe&&e.startLightProbe()})),this.el.addEventListener("exit-vr",(function(){e.xrLightProbe&&e.stopLightProbe()})),this.el.object3D.environment=this.cubeRenderTarget.texture},stopLightProbe:function(){this.xrLightProbe=null,this.probeLight&&(this.probeLight.components.light.light.intensity=0),this.needsVREnvironmentUpdate=!0,this.el.object3D.environment=this.cubeRenderTarget.texture},startLightProbe:function(){this.needsLightProbeUpdate=!0},setupLightProbe:function(){var e=this.el.renderer,t=e.xr.getSession(),n=this,i=e.getContext();if(!this.probeLight){var r=document.createElement("a-light");r.setAttribute("type","probe"),r.setAttribute("intensity",0),this.el.appendChild(r),this.probeLight=r}switch(t.preferredReflectionFormat){case"srgba8":i.getExtension("EXT_sRGB");break;case"rgba16f":i.getExtension("OES_texture_half_float")}this.glBinding=new XRWebGLBinding(t,i),i.getExtension("EXT_sRGB"),i.getExtension("OES_texture_half_float"),t.requestLightProbe().then((function(e){n.xrLightProbe=e,e.addEventListener("reflectionchange",n.updateXRCubeMap.bind(n))})).catch((function(e){console.warn("Lighting estimation not supported: "+e.message),console.warn('Are you missing: webxr="optionalFeatures: light-estimation;" from <a-scene>?')}))},updateXRCubeMap:function(){var e=this.el.renderer,t=this.glBinding.getReflectionCubeMap(this.xrLightProbe);t&&(e.properties.get(this.lightingEstimationTexture).__webglTexture=t,this.lightingEstimationTexture.needsPMREMUpdate=!0,this.el.object3D.environment=this.lightingEstimationTexture)},tick:function(){var e=this.el.object3D,t=this.el.renderer,n=this.el.frame;if(n&&this.xrLightProbe){var i=n.getLightEstimate(this.xrLightProbe);i&&function(e,t,n,i){var r=Math.max(e.primaryLightIntensity.x,Math.max(e.primaryLightIntensity.y,e.primaryLightIntensity.z));t.sh.fromArray(e.sphericalHarmonicsCoefficients),t.intensity=3.14,n&&(n.color.setRGB(e.primaryLightIntensity.x/r,e.primaryLightIntensity.y/r,e.primaryLightIntensity.z/r),n.intensity=r,i.copy(e.primaryLightDirection))}(i,this.probeLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.object3D.position)}this.needsVREnvironmentUpdate&&(e.environment=null,this.needsVREnvironmentUpdate=!1,this.cubeCamera.position.set(0,1.6,0),this.cubeCamera.update(t,e),e.environment=this.cubeRenderTarget.texture),this.needsLightProbeUpdate&&n&&(this.setupLightProbe(),this.needsLightProbeUpdate=!1)},remove:function(){this.el.object3D.environment=null,this.probeLight&&this.el.removeChild(this.probeLight)}})},1217:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=["attribute vec3 position;","attribute vec2 uv;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","varying vec2 vUv;","void main() {"," vUv = vec2( 1.- uv.x, uv.y );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),o=["precision mediump float;","uniform samplerCube map;","varying vec2 vUv;","#define M_PI 3.141592653589793238462643383279","void main() {"," vec2 uv = vUv;"," float longitude = uv.x * 2. * M_PI - M_PI + M_PI / 2.;"," float latitude = uv.y * M_PI;"," vec3 dir = vec3("," - sin( longitude ) * sin( latitude ),"," cos( latitude ),"," - cos( longitude ) * sin( latitude )"," );"," normalize( dir );"," gl_FragColor = vec4( textureCube( map, dir ).rgb, 1.0 );","}"].join("\n");e.exports.Component=i("screenshot",{schema:{width:{default:4096},height:{default:2048},camera:{type:"selector"}},sceneOnly:!0,setup:function(){var e=this.el;if(!this.canvas){var t=e.renderer.getContext();t&&(this.cubeMapSize=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),this.material=new r.RawShaderMaterial({uniforms:{map:{type:"t",value:null}},vertexShader:s,fragmentShader:o,side:r.DoubleSide}),this.quad=new r.Mesh(new r.PlaneGeometry(1,1),this.material),this.quad.visible=!1,this.camera=new r.OrthographicCamera(-.5,.5,.5,-.5,-1e4,1e4),this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),e.object3D.add(this.quad),this.onKeyDown=this.onKeyDown.bind(this))}},getRenderTarget:function(e,t){return new r.WebGLRenderTarget(e,t,{colorSpace:this.el.sceneEl.renderer.outputColorSpace,minFilter:r.LinearFilter,magFilter:r.LinearFilter,wrapS:r.ClampToEdgeWrapping,wrapT:r.ClampToEdgeWrapping,format:r.RGBAFormat,type:r.UnsignedByteType})},resize:function(e,t){this.quad.scale.set(e,t,1),this.camera.left=-1*e/2,this.camera.right=e/2,this.camera.top=t/2,this.camera.bottom=-1*t/2,this.camera.updateProjectionMatrix(),this.canvas.width=e,this.canvas.height=t},play:function(){window.addEventListener("keydown",this.onKeyDown)},onKeyDown:function(e){var t=83===e.keyCode&&e.ctrlKey&&e.altKey;if(this.data&&t){var n=e.shiftKey?"equirectangular":"perspective";this.capture(n)}},setCapture:function(e){var t,n,i,s,o=this.el;return"perspective"===e?(this.quad.visible=!1,n=this.data.camera&&this.data.camera.components.camera.camera||o.camera,t={width:this.data.width,height:this.data.height}):(n=this.camera,s=new r.WebGLCubeRenderTarget(Math.min(this.cubeMapSize,2048),{format:r.RGBFormat,generateMipmaps:!0,minFilter:r.LinearMipmapLinearFilter,colorSpace:r.SRGBColorSpace}),i=new r.CubeCamera(o.camera.near,o.camera.far,s),o.camera.getWorldPosition(i.position),o.camera.getWorldQuaternion(i.quaternion),i.update(o.renderer,o.object3D),this.quad.material.uniforms.map.value=i.renderTarget.texture,t={width:this.data.width,height:this.data.height},this.quad.visible=!0),{camera:n,size:t,projection:e}},capture:function(e){var t,n=this.el.renderer.xr.enabled,i=this.el.renderer;this.setup(),i.xr.enabled=!1,t=this.setCapture(e),this.renderCapture(t.camera,t.size,t.projection),this.saveCapture(),i.xr.enabled=n},getCanvas:function(e){var t=this.el.renderer.xr.enabled,n=this.el.renderer;this.setup();var i=this.setCapture(e);return n.xr.enabled=!1,this.renderCapture(i.camera,i.size,i.projection),n.xr.enabled=t,this.canvas},renderCapture:function(e,t,n){var i,r,s,o=this.el.renderer.autoClear,a=this.el,l=a.renderer;r=this.getRenderTarget(t.width,t.height),s=new Uint8Array(4*t.width*t.height),this.resize(t.width,t.height),l.autoClear=!0,l.clear(),l.setRenderTarget(r),l.render(a.object3D,e),l.autoClear=o,l.readRenderTargetPixels(r,0,0,t.width,t.height,s),l.setRenderTarget(null),"perspective"===n&&(s=this.flipPixelsVertically(s,t.width,t.height)),i=new ImageData(new Uint8ClampedArray(s),t.width,t.height),this.quad.visible=!1,this.ctx.putImageData(i,0,0)},flipPixelsVertically:function(e,t,n){for(var i=e.slice(0),r=0;r<t;++r)for(var s=0;s<n;++s)i[4*r+s*t*4]=e[4*r+(n-s)*t*4],i[4*r+1+s*t*4]=e[4*r+1+(n-s)*t*4],i[4*r+2+s*t*4]=e[4*r+2+(n-s)*t*4],i[4*r+3+s*t*4]=e[4*r+3+(n-s)*t*4];return i},saveCapture:function(){this.canvas.toBlob((function(e){var t="screenshot-"+document.title.toLowerCase()+"-"+Date.now()+".png",n=document.createElement("a"),i=URL.createObjectURL(e);n.href=i,n.setAttribute("download",t),n.innerHTML="downloading...",n.style.display="none",document.body.appendChild(n),setTimeout((function(){n.click(),document.body.removeChild(n)}),1)}),"image/png")}})},8346:(e,t,n)=>{var i=n(8190).registerComponent,r=n(282),s=n(7427);n(3729),n(8132);var o=window.aframeStats,a="a-hidden",l=window.threeStats;e.exports.Component=i("stats",{schema:{default:!0},sceneOnly:!0,init:function(){var e=this.el;"false"!==s.getUrlParameter("stats")&&(this.stats=function(e){var t=new l(e.renderer),n=new o(e),i=e.isMobile?[]:[t,n];return new r({css:[],values:{fps:{caption:"fps",below:30}},groups:[{caption:"Framerate",values:["fps","raf"]}],plugins:i})}(e),this.statsEl=document.querySelector(".rs-base"),this.hideBound=this.hide.bind(this),this.showBound=this.show.bind(this),e.addEventListener("enter-vr",this.hideBound),e.addEventListener("exit-vr",this.showBound))},update:function(){if(this.stats)return this.data?this.show():this.hide()},remove:function(){this.el.removeEventListener("enter-vr",this.hideBound),this.el.removeEventListener("exit-vr",this.showBound),this.statsEl&&this.statsEl.parentNode.removeChild(this.statsEl)},tick:function(){var e=this.stats;e&&(e("rAF").tick(),e("FPS").frame(),e().update())},hide:function(){this.statsEl.classList.add(a)},show:function(){this.statsEl.classList.remove(a)}})},6469:(e,t,n)=>{var i=n(8190).registerComponent,r=n(1343),s=n(7427),o="a-hidden";function a(e){e.addEventListener("touchstart",(function(){e.classList.remove("resethover")}),{passive:!0}),e.addEventListener("touchend",(function(){e.classList.add("resethover")}),{passive:!0})}e.exports.Component=i("xr-mode-ui",{dependencies:["canvas"],schema:{enabled:{default:!0},cardboardModeEnabled:{default:!1},enterVRButton:{default:""},enterVREnabled:{default:!0},enterARButton:{default:""},enterAREnabled:{default:!0},XRMode:{default:"vr",oneOf:["vr","ar","xr"]}},sceneOnly:!0,init:function(){var e=this,t=this.el;"false"!==s.getUrlParameter("ui")&&(this.insideLoader=!1,this.enterVREl=null,this.enterAREl=null,this.orientationModalEl=null,this.bindMethods(),t.addEventListener("enter-vr",this.updateEnterInterfaces),t.addEventListener("exit-vr",this.updateEnterInterfaces),t.addEventListener("update-vr-devices",this.updateEnterInterfaces),window.addEventListener("message",(function(t){"loaderReady"===t.data.type&&(e.insideLoader=!0,e.remove())})),window.addEventListener("orientationchange",this.toggleOrientationModalIfNeeded))},bindMethods:function(){this.onEnterVRButtonClick=this.onEnterVRButtonClick.bind(this),this.onEnterARButtonClick=this.onEnterARButtonClick.bind(this),this.onModalClick=this.onModalClick.bind(this),this.toggleOrientationModalIfNeeded=this.toggleOrientationModalIfNeeded.bind(this),this.updateEnterInterfaces=this.updateEnterInterfaces.bind(this)},onModalClick:function(){this.el.exitVR()},onEnterVRButtonClick:function(){this.el.enterVR()},onEnterARButtonClick:function(){this.el.enterAR()},update:function(){var e,t,n,i=this.data,l=this.el;if(!i.enabled||this.insideLoader||"false"===s.getUrlParameter("ui"))return this.remove();this.enterVREl||this.enterAREl||this.orientationModalEl||(this.enterVREl||!i.enterVREnabled||"xr"!==i.XRMode&&"vr"!==i.XRMode||(i.enterVRButton?(this.enterVREl=document.querySelector(i.enterVRButton),this.enterVREl.addEventListener("click",this.onEnterVRButtonClick)):(this.enterVREl=(e=this.onEnterVRButtonClick,(n=document.createElement("div")).classList.add("a-enter-vr"),n.setAttribute(r.AFRAME_INJECTED,""),(t=document.createElement("button")).className="a-enter-vr-button",t.setAttribute("title","Enter VR mode with a headset or fullscreen without"),t.setAttribute(r.AFRAME_INJECTED,""),s.device.isMobile()&&a(t),n.appendChild(t),t.addEventListener("click",(function(t){e(),t.stopPropagation()})),n),l.appendChild(this.enterVREl))),this.enterAREl||!i.enterAREnabled||"xr"!==i.XRMode&&"ar"!==i.XRMode||(i.enterARButton?(this.enterAREl=document.querySelector(i.enterARButton),this.enterAREl.addEventListener("click",this.onEnterARButtonClick)):(this.enterAREl=function(e,t){var n,i;return(i=document.createElement("div")).classList.add("a-enter-ar"),t&&i.classList.add("xr"),i.setAttribute(r.AFRAME_INJECTED,""),(n=document.createElement("button")).className="a-enter-ar-button",n.setAttribute("title","Enter AR mode with a headset or handheld device."),n.setAttribute(r.AFRAME_INJECTED,""),s.device.isMobile()&&a(n),i.appendChild(n),n.addEventListener("click",(function(t){e(),t.stopPropagation()})),i}(this.onEnterARButtonClick,"xr"===i.XRMode),l.appendChild(this.enterAREl))),this.orientationModalEl=function(e){var t=document.createElement("div");t.className="a-orientation-modal",t.classList.add(o),t.setAttribute(r.AFRAME_INJECTED,"");var n=document.createElement("button");return n.setAttribute(r.AFRAME_INJECTED,""),n.innerHTML="Exit VR",n.addEventListener("click",e),t.appendChild(n),t}(this.onModalClick),l.appendChild(this.orientationModalEl),this.updateEnterInterfaces())},remove:function(){[this.enterVREl,this.enterAREl,this.orientationModalEl].forEach((function(e){e&&e.parentNode&&e.parentNode.removeChild(e)})),this.enterVREl=void 0,this.enterAREl=void 0,this.orientationModalEl=void 0},updateEnterInterfaces:function(){this.toggleEnterVRButtonIfNeeded(),this.toggleEnterARButtonIfNeeded(),this.toggleOrientationModalIfNeeded()},toggleEnterVRButtonIfNeeded:function(){var e=this.el;this.enterVREl&&(e.is("vr-mode")||(e.isMobile||s.device.isMobileDeviceRequestingDesktopSite())&&!this.data.cardboardModeEnabled&&!s.device.checkVRSupport()?this.enterVREl.classList.add(o):(s.device.checkVRSupport()||this.enterVREl.classList.add("fullscreen"),this.enterVREl.classList.remove(o),e.enterVR(!1,!0)))},toggleEnterARButtonIfNeeded:function(){var e=this.el;this.enterAREl&&(e.is("vr-mode")||!s.device.checkARSupport()?this.enterAREl.classList.add(o):(this.enterAREl.classList.remove(o),e.enterVR(!0,!0)))},toggleOrientationModalIfNeeded:function(){var e=this.el,t=this.orientationModalEl;t&&e.isMobile&&(!s.device.isLandscape()&&e.is("vr-mode")?t.classList.remove(o):t.classList.add(o))}})},1072:(e,t,n)=>{var i=n(8190),r=n(9437),s=i.registerComponent;e.exports.Component=s("shadow",{schema:{cast:{default:!0},receive:{default:!0}},init:function(){this.onMeshChanged=this.update.bind(this),this.el.addEventListener("object3dset",this.onMeshChanged),this.system.setShadowMapEnabled(!0)},update:function(){var e=this.data;this.updateDescendants(e.cast,e.receive)},remove:function(){this.el.removeEventListener("object3dset",this.onMeshChanged),this.updateDescendants(!1,!1)},updateDescendants:function(e,t){var n=this.el.sceneEl;this.el.object3D.traverse((function(i){if(i instanceof r.Mesh&&(i.castShadow=e,i.receiveShadow=t,n.hasLoaded&&i.material))for(var s=Array.isArray(i.material)?i.material:[i.material],o=0;o<s.length;o++)s[o].needsUpdate=!0}))}})},477:(e,t,n)=>{var i=n(8190).registerComponent,r=n(8940),s=n(9437),o=r("components:sound:warn");e.exports.Component=i("sound",{schema:{autoplay:{default:!1},distanceModel:{default:"inverse",oneOf:["linear","inverse","exponential"]},loop:{default:!1},loopStart:{default:0},loopEnd:{default:0},maxDistance:{default:1e4},on:{default:""},poolSize:{default:1},positional:{default:!0},refDistance:{default:1},rolloffFactor:{default:1},src:{type:"audio"},volume:{default:1}},multiple:!0,init:function(){var e=this;this.listener=null,this.audioLoader=new s.AudioLoader,this.pool=new s.Group,this.loaded=!1,this.mustPlay=!1,this.playSoundBound=function(){e.playSound()}},update:function(e){var t,n,i=this.data,r=i.src!==e.src;if(r){if(!i.src)return;this.setupSound()}for(t=0;t<this.pool.children.length;t++)n=this.pool.children[t],i.positional&&(n.setDistanceModel(i.distanceModel),n.setMaxDistance(i.maxDistance),n.setRefDistance(i.refDistance),n.setRolloffFactor(i.rolloffFactor)),n.setLoop(i.loop),n.setLoopStart(i.loopStart),0!==i.loopStart&&0===i.loopEnd?n.setLoopEnd(n.buffer.duration):n.setLoopEnd(i.loopEnd),n.setVolume(i.volume),n.isPaused=!1;if(i.on!==e.on&&this.updateEventListener(e.on),r){var o=this;this.loaded=!1,this.audioLoader.load(i.src,(function(e){for(t=0;t<o.pool.children.length;t++)(n=o.pool.children[t]).setBuffer(e);o.loaded=!0,s.Cache.remove(i.src),(o.data.autoplay||o.mustPlay)&&o.playSound(o.processSound),o.el.emit("sound-loaded",o.evtDetail,!1)}))}},pause:function(){this.stopSound(),this.removeEventListener()},play:function(){this.data.autoplay&&this.playSound(),this.updateEventListener()},remove:function(){var e;this.removeEventListener(),this.el.getObject3D(this.attrName)&&this.el.removeObject3D(this.attrName);try{for(e=0;e<this.pool.children.length;e++)this.pool.children[e].disconnect()}catch(e){o("Audio source not properly disconnected")}},updateEventListener:function(e){var t=this.el;e&&t.removeEventListener(e,this.playSoundBound),t.addEventListener(this.data.on,this.playSoundBound)},removeEventListener:function(){this.el.removeEventListener(this.data.on,this.playSoundBound)},setupSound:function(){var e,t,n=this.el,i=n.sceneEl,r=this;this.pool.children.length>0&&(this.stopSound(),n.removeObject3D("sound"));var o=this.listener=i.audioListener||new s.AudioListener;for(i.audioListener=o,i.camera&&i.camera.add(o),i.addEventListener("camera-set-active",(function(e){e.detail.cameraEl.getObject3D("camera").add(o)})),this.pool=new s.Group,e=0;e<this.data.poolSize;e++)t=this.data.positional?new s.PositionalAudio(o):new s.Audio(o),this.pool.add(t);for(n.setObject3D(this.attrName,this.pool),e=0;e<this.pool.children.length;e++)(t=this.pool.children[e]).onEnded=function(){this.isPlaying=!1,r.el.emit("sound-ended",r.evtDetail,!1)}},pauseSound:function(){var e,t;for(this.isPlaying=!1,e=0;e<this.pool.children.length;e++)(t=this.pool.children[e]).source&&t.source.buffer&&t.isPlaying&&!t.isPaused&&(t.isPaused=!0,t.pause())},playSound:function(e){var t,n,i;if(!this.loaded)return o("Sound not loaded yet. It will be played once it finished loading"),this.mustPlay=!0,void(this.processSound=e);for(t=!1,this.isPlaying=!0,n=0;n<this.pool.children.length;n++)(i=this.pool.children[n]).isPlaying||!i.buffer||t||(e&&e(i),i.play(),i.isPaused=!1,t=!0);t?(this.mustPlay=!1,this.processSound=void 0):o("All the sounds are playing. If you need to play more sounds simultaneously consider increasing the size of pool with the `poolSize` attribute.",this.el)},stopSound:function(){var e,t;for(this.isPlaying=!1,e=0;e<this.pool.children.length;e++){if(!(t=this.pool.children[e]).source||!t.source.buffer)return;t.stop()}}})},1603:(e,t,n)=>{var i=n(4433),r=n(5751),s=n(8190).registerComponent,o=n(5892),a=n(9437),l=n(7427),c=l.debug("components:text:error"),h=o.shaders,d=l.debug("components:text:warn"),u=n(1343).AFRAME_CDN_ROOT+"fonts/",p={aileronsemibold:u+"Aileron-Semibold.fnt",dejavu:u+"DejaVu-sdf.fnt",exo2bold:u+"Exo2Bold.fnt",exo2semibold:u+"Exo2SemiBold.fnt",kelsonsans:u+"KelsonSans.fnt",monoid:u+"Monoid.fnt",mozillavr:u+"mozillavr.fnt",roboto:u+"Roboto-msdf.json",sourcecodepro:u+"SourceCodePro.fnt"},A=["roboto"],f="roboto";e.exports.FONTS=p;var m,g,v,y,E=new function(){var e=this.cache={};this.get=function(t,n){return t in e||(e[t]=n()),e[t]}},x={},b={},C=/^\w+:/;function w(e,t,n){return e||(.5+t)*n}e.exports.Component=s("text",{multiple:!0,schema:{align:{type:"string",default:"left",oneOf:["left","right","center"]},alphaTest:{default:.5},anchor:{default:"center",oneOf:["left","right","center","align"]},baseline:{default:"center",oneOf:["top","center","bottom"]},color:{type:"color",default:"#FFF"},font:{type:"string",default:f},fontImage:{type:"string"},height:{type:"number"},letterSpacing:{type:"number",default:0},lineHeight:{type:"number"},negate:{type:"boolean",default:!0},opacity:{type:"number",default:1},shader:{default:"sdf",oneOf:h},side:{default:"front",oneOf:["front","back","double"]},tabSize:{default:4},transparent:{default:!0},value:{type:"string"},whiteSpace:{default:"normal",oneOf:["normal","pre","nowrap"]},width:{type:"number"},wrapCount:{type:"number",default:40},wrapPixels:{type:"number"},xOffset:{type:"number",default:0},yOffset:{type:"number",default:0},zOffset:{type:"number",default:.001}},init:function(){this.shaderData={},this.geometry=i(),this.createOrUpdateMaterial(),this.explicitGeoDimensionsChecked=!1},update:function(e){var t=this.data,n=this.currentFont;b[t.font]?this.texture=b[t.font]:(this.texture=b[t.font]=new a.Texture,this.texture.anisotropy=16),this.createOrUpdateMaterial(),e.font===t.font?n&&(this.updateGeometry(this.geometry,n),this.updateLayout()):this.updateFont()},remove:function(){this.geometry.dispose(),this.geometry=null,this.el.removeObject3D(this.attrName),this.material.dispose(),this.material=null,this.texture.dispose(),this.texture=null,this.shaderObject&&delete this.shaderObject},createOrUpdateMaterial:function(){var e,t,n,i=this.data,r=this.material,s=this.shaderData;if(n=i.shader,-1!==A.indexOf(i.font)||i.font.indexOf("-msdf.")>=0?n="msdf":i.font in p&&-1===A.indexOf(i.font)&&(n="sdf"),e=(this.shaderObject&&this.shaderObject.name)!==n,s.alphaTest=i.alphaTest,s.color=i.color,s.map=this.texture,s.opacity=i.opacity,s.side=function(e){switch(e){case"back":return a.FrontSide;case"double":return a.DoubleSide;default:return a.BackSide}}(i.side),s.transparent=i.transparent,s.negate=i.negate,!e)return this.shaderObject.update(s),r.transparent=s.transparent,void(r.side=s.side);t=function(e,t,n){var i,r;return(r=new h[t].Shader).el=e,r.init(n),r.update(n),(i=r.material).transparent=n.transparent,{material:i,shader:r}}(this.el,n,s),this.material=t.material,this.shaderObject=t.shader,this.material.side=s.side,this.mesh&&(this.mesh.material=this.material)},updateFont:function(){var e,t=this.data,n=this.el,i=this.geometry,s=this;t.font||d("No font specified. Using the default font."),this.mesh&&(this.mesh.visible=!1),e=this.lookupFont(t.font||f)||t.font,E.get(e,(function(){return n=e,i=t.yOffset,new Promise((function(e,t){r(n,(function(r,s){if(r)return c("Error loading font",n),void t(r);n.indexOf("/Roboto-msdf.json")>=0&&(i=30),i&&s.chars.map((function(e){e.yoffset+=i})),e(s)}))}));var n,i})).then((function(r){var o;if(1!==r.pages.length)throw new Error("Currently only single-page bitmap fonts are supported.");x[e]||(r.widthFactor=x[r]=function(e){var t=0,n=0,i=0;return e.chars.map((function(e){t+=e.xadvance,e.id>=48&&e.id<=57&&(i++,n+=e.xadvance)})),i?n/i:t/e.chars.length}(r)),s.currentFont=r,o=s.getFontImageSrc(),E.get(o,(function(){return e=o,new Promise((function(t,n){(new a.ImageLoader).load(e,(function(e){t(e)}),void 0,(function(){c("Error loading font image",e),n(null)}))}));var e})).then((function(e){var o=s.texture;o&&(o.image=e,o.needsUpdate=!0,b[t.font]=o,s.texture=o,s.initMesh(),s.currentFont=r,s.updateGeometry(i,r),s.updateLayout(),s.mesh.visible=!0,n.emit("textfontset",{font:t.font,fontObj:r}))})).catch((function(e){c(e.message),c(e.stack)}))})).catch((function(e){c(e.message),c(e.stack)}))},initMesh:function(){this.mesh||(this.mesh=new a.Mesh(this.geometry,this.material),this.el.setObject3D(this.attrName,this.mesh))},getFontImageSrc:function(){if(this.data.fontImage)return this.data.fontImage;var e=this.lookupFont(this.data.font||f)||this.data.font,t=this.currentFont.pages[0];return t.match(C)&&0!==t.indexOf("http")?e.replace(/(\.fnt)|(\.json)/,".png"):a.LoaderUtils.extractUrlBase(e)+t},updateLayout:function(){var e,t,n,i,r,s,o,a,l,c=this.el,h=this.data,d=this.geometry,u=this.mesh;if(u&&d.layout){if(n=c.getAttribute("geometry"),i=(s=(o=h.width||n&&n.width||1)/w(h.wrapPixels,h.wrapCount,this.currentFont.widthFactor))*((r=d.layout).height+r.descender),n&&"plane"===n.primitive&&(this.explicitGeoDimensionsChecked||(this.explicitGeoDimensionsChecked=!0,this.hasExplicitGeoWidth=!!n.width,this.hasExplicitGeoHeight=!!n.height),this.hasExplicitGeoWidth||c.setAttribute("geometry","width",o),this.hasExplicitGeoHeight||c.setAttribute("geometry","height",i)),"left"===(e="align"===h.anchor?h.align:h.anchor))a=0;else if("right"===e)a=-1*r.width;else{if("center"!==e)throw new TypeError("Invalid text.anchor property value",e);a=-1*r.width/2}if("bottom"===(t=h.baseline))l=0;else if("top"===t)l=-1*r.height+r.ascender;else{if("center"!==t)throw new TypeError("Invalid text.baseline property value",t);l=-1*r.height/2}u.position.x=a*s+h.xOffset,u.position.y=l*s,u.position.z=h.zOffset,u.scale.set(s,-1*s,s)}},lookupFont:function(e){return p[e]},updateGeometry:(m={},g={},v=/\\n/g,y=/\\t/g,function(e,t){var n=this.data;g.font=t,g.lineHeight=n.lineHeight&&isFinite(n.lineHeight)?n.lineHeight:t.common.lineHeight,g.text=n.value.toString().replace(v,"\n").replace(y,"\t"),g.width=w(n.wrapPixels,n.wrapCount,t.widthFactor),e.update(l.extend(m,n,g))})})},6547:(e,t,n)=>{var i=n(7960),r=n(8190).registerComponent;e.exports.Component=r("tracked-controls",{schema:{id:{type:"string",default:""},controller:{default:-1},autoHide:{default:!0},hand:{type:"string",default:""},handTrackingEnabled:{default:!1},iterateControllerProfiles:{default:!1}},init:function(){this.buttonEventDetails={},this.buttonStates=this.el.components["tracked-controls"].buttonStates={},this.axis=this.el.components["tracked-controls"].axis=[0,0,0],this.changedAxes=[],this.axisMoveEventDetail={axis:this.axis,changed:this.changedAxes},this.updateController=this.updateController.bind(this)},update:function(){this.updateController()},play:function(){var e=this.el.sceneEl;this.updateController(),e.addEventListener("controllersupdated",this.updateController)},pause:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.updateController)},isControllerPresent:function(e){return!(!this.controller||this.controller.gamepad||"none"!==e.inputSource.handedness&&e.inputSource.handedness!==this.data.hand)},updateController:function(){this.controller=i.findMatchingControllerWebXR(this.system.controllers,this.data.id,this.data.hand,this.data.controller,this.data.iterateControllerProfiles,this.data.handTrackingEnabled),this.el.components["tracked-controls"].controller=this.controller},tick:function(){var e=this.el.sceneEl,t=this.controller,n=e.frame;this.data.autoHide&&(this.el.object3D.visible=!!t),t&&e.frame&&this.system.referenceSpace&&(t.hand||(this.pose=n.getPose(t.gripSpace,this.system.referenceSpace),this.updatePose(),this.updateButtons()))},updatePose:function(){var e=this.el.object3D,t=this.pose;t&&(e.matrix.elements=t.transform.matrix,e.matrix.decompose(e.position,e.rotation,e.scale))},updateButtons:function(){var e,t,n,i=this.controller;if(i&&i.gamepad){for(n=i.gamepad,t=0;t<n.buttons.length;++t)this.buttonStates[t]||(this.buttonStates[t]={pressed:!1,touched:!1,value:0}),this.buttonEventDetails[t]||(this.buttonEventDetails[t]={id:t,state:this.buttonStates[t]}),e=n.buttons[t],this.handleButton(t,e);this.handleAxes()}},handleButton:function(e,t){return!!(this.handlePress(e,t)|this.handleTouch(e,t)|this.handleValue(e,t))&&(this.el.emit("buttonchanged",this.buttonEventDetails[e],!1),!0)},handleAxes:function(){var e,t=!1,n=this.controller.gamepad.axes,i=this.axis,r=this.changedAxes;for(this.changedAxes.splice(0,this.changedAxes.length),e=0;e<n.length;++e)r.push(i[e]!==n[e]),r[e]&&(t=!0);if(!t)return!1;for(this.axis.splice(0,this.axis.length),e=0;e<n.length;e++)this.axis.push(n[e]);return this.el.emit("axismove",this.axisMoveEventDetail,!1),!0},handlePress:function(e,t){var n,i=this.buttonStates[e];return t.pressed!==i.pressed&&(n=t.pressed?"buttondown":"buttonup",this.el.emit(n,this.buttonEventDetails[e],!1),i.pressed=t.pressed,!0)},handleTouch:function(e,t){var n,i=this.buttonStates[e];return t.touched!==i.touched&&(n=t.touched?"touchstart":"touchend",this.el.emit(n,this.buttonEventDetails[e],!1),i.touched=t.touched,!0)},handleValue:function(e,t){var n=this.buttonStates[e];return t.value!==n.value&&(n.value=t.value,!0)}})},7360:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c=n(1343).AFRAME_CDN_ROOT+"controllers/valve/index/valve-index-",h={left:c+"left.glb",right:c+"right.glb"},d="valve",u={left:{x:0,y:-.05,z:.06},right:{x:0,y:-.05,z:.06}},p={left:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"},right:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"}};e.exports.Component=i("valve-index-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{trackpad:[0,1],thumbstick:[2,3]},buttons:["trigger","grip","trackpad","thumbstick","abutton"]},init:function(){var e=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.bindMethods()},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data,t="right"===e.hand?0:"left"===e.hand?1:2;o(this,d,{index:t,iterateControllerProfiles:!0,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:d,controller:"right"===t.hand?1:"left"===t.hand?0:2,hand:t.hand}),this.loadModel()},loadModel:function(){var e=this.data;e.model&&this.el.setAttribute("gltf-model",""+h[e.hand])},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(t=e.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=this.triggerOriginalRotationX-t*(Math.PI/40))),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t,n=e.detail.model,i=this;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},t.menu=n.getObjectByName("menubutton"),t.system=n.getObjectByName("systembutton"),t.trackpad=n.getObjectByName("touchpad"),t.trigger=n.getObjectByName("trigger"),this.triggerOriginalRotationX=t.trigger.rotation.x,Object.keys(t).forEach((function(e){i.setButtonColor(e,i.data.buttonColor)})),n.position.copy(p[this.data.hand]),n.rotation.copy(u[this.data.hand]),this.el.emit("controllermodelready",{name:"valve-index-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)}))},onAxisMoved:function(e){a(this,this.mapping.axes,e)},updateModel:function(e,t){var n;this.data.model&&(-1!==t.indexOf("touch")||(n="up"===t?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(e,n)))},setButtonColor:function(e,t){}})},5300:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("visible",{schema:{default:!0},update:function(){this.el.object3D.visible=this.data}})},1507:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l=n(1343).AFRAME_CDN_ROOT,c=l+"controllers/vive/vr_controller_vive.obj",h=l+"controllers/vive/vr_controller_vive.mtl",d="htc-vive";e.exports.Component=i("vive-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","none"]},init:function(){var e=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;s(this,d,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:d,hand:t.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("obj-model",{obj:c,mtl:h})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(t=e.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=-t*(Math.PI/12))),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t,n=e.detail.model,i=this;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},t.menu=n.getObjectByName("menubutton"),t.system=n.getObjectByName("systembutton"),t.trackpad=n.getObjectByName("touchpad"),t.touchpad=n.getObjectByName("touchpad"),t.trigger=n.getObjectByName("trigger"),Object.keys(t).forEach((function(e){i.setButtonColor(e,i.data.buttonColor)})),n.position.set(0,-.015,.04))},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){var n;this.data.model&&(-1!==t.indexOf("touch")||(n="up"===t?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(e,n)))},setButtonColor:function(e,t){var n=this.buttonMeshes;if(n)return"grip"===e?(n.grip.left.material.color.set(t),void n.grip.right.material.color.set(t)):void n[e].material.color.set(t)}})},4592:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l=n(1343).AFRAME_CDN_ROOT+"controllers/vive/focus-controller/focus-controller.gltf",c="htc-vive-focus";e.exports.Component=i("vive-focus-controls",{schema:{hand:{default:""},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad","none","menu"]},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.bindMethods()},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0,this.addControllersUpdateListener()},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1,this.removeControllersUpdateListener()},checkIfControllerPresent:function(){s(this,c,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el;this.data,e.setAttribute("tracked-controls",{idPrefix:c}),this.data.model&&this.el.setAttribute("gltf-model",l)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(e){var t,n=e.detail.model;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).trigger=n.getObjectByName("BumperKey"),t.triggerPressed=n.getObjectByName("BumperKey_Press"),t.triggerPressed&&(t.triggerPressed.visible=!1),t.touchpad=n.getObjectByName("TouchPad"),t.touchpadPressed=n.getObjectByName("TouchPad_Press"),t.trackpad=n.getObjectByName("TouchPad"),t.trackpadPressed=n.getObjectByName("TouchPad_Press"),t.trackpadPressed&&(t.trackpadPressed.visible=!1))},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n=this.buttonMeshes,i=e+"Pressed";if(n&&n[e]&&n[i]){var r;switch(t){case"down":r=this.data.buttonHighlightColor;break;case"touchstart":r=this.data.buttonTouchedColor}r&&n[i].material.color.set(r),n[i].visible=!!r,n[e].visible=!r}}})},6458:(e,t,n)=>{var i,r,s=n(1343).keyboardevent.KEYCODE_TO_CODE,o=n(8190).registerComponent,a=n(9437),l=n(7427).shouldCaptureKeyEvent,c=1e-5,h=["KeyW","KeyA","KeyS","KeyD","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"];e.exports.Component=o("wasd-controls",{schema:{acceleration:{default:65},adAxis:{default:"x",oneOf:["x","y","z"]},adEnabled:{default:!0},adInverted:{default:!1},enabled:{default:!0},fly:{default:!1},wsAxis:{default:"z",oneOf:["x","y","z"]},wsEnabled:{default:!0},wsInverted:{default:!1}},after:["look-controls"],init:function(){this.keys={},this.easing=1.1,this.velocity=new a.Vector3,this.onBlur=this.onBlur.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.onFocus=this.onFocus.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.attachVisibilityEventListeners()},tick:function(e,t){var n=this.data,i=this.el,r=this.velocity;(r[n.adAxis]||r[n.wsAxis]||!function(e){var t;for(t in e)return!1;return!0}(this.keys))&&(t/=1e3,this.updateVelocity(t),(r[n.adAxis]||r[n.wsAxis])&&i.object3D.position.add(this.getMovementVector(t)))},update:function(e){e.adAxis!==this.data.adAxis&&(this.velocity[e.adAxis]=0),e.wsAxis!==this.data.wsAxis&&(this.velocity[e.wsAxis]=0)},remove:function(){this.removeKeyEventListeners(),this.removeVisibilityEventListeners()},play:function(){this.attachKeyEventListeners()},pause:function(){this.keys={},this.removeKeyEventListeners()},updateVelocity:function(e){var t,n,i,r,s,o=this.data,a=this.keys,l=this.velocity;if(n=o.adAxis,r=o.wsAxis,e>.2)return l[n]=0,void(l[r]=0);var h=Math.pow(1/this.easing,60*e);0!==l[n]&&(l[n]=l[n]*h),0!==l[r]&&(l[r]=l[r]*h),Math.abs(l[n])<c&&(l[n]=0),Math.abs(l[r])<c&&(l[r]=0),o.enabled&&(t=o.acceleration,o.adEnabled&&(i=o.adInverted?-1:1,(a.KeyA||a.ArrowLeft)&&(l[n]-=i*t*e),(a.KeyD||a.ArrowRight)&&(l[n]+=i*t*e)),o.wsEnabled&&(s=o.wsInverted?-1:1,(a.KeyW||a.ArrowUp)&&(l[r]-=s*t*e),(a.KeyS||a.ArrowDown)&&(l[r]+=s*t*e)))},getMovementVector:(i=new a.Vector3(0,0,0),r=new a.Euler(0,0,0,"YXZ"),function(e){var t,n=this.el.getAttribute("rotation"),s=this.velocity;return i.copy(s),i.multiplyScalar(e),n?(t=this.data.fly?n.x:0,r.set(a.MathUtils.degToRad(t),a.MathUtils.degToRad(n.y),0),i.applyEuler(r),i):i}),attachVisibilityEventListeners:function(){window.oncontextmenu=this.onContextMenu,window.addEventListener("blur",this.onBlur),window.addEventListener("focus",this.onFocus),document.addEventListener("visibilitychange",this.onVisibilityChange)},removeVisibilityEventListeners:function(){window.removeEventListener("blur",this.onBlur),window.removeEventListener("focus",this.onFocus),document.removeEventListener("visibilitychange",this.onVisibilityChange)},attachKeyEventListeners:function(){window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp)},removeKeyEventListeners:function(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp)},onContextMenu:function(){for(var e=Object.keys(this.keys),t=0;t<e.length;t++)delete this.keys[e[t]]},onBlur:function(){this.pause()},onFocus:function(){this.play()},onVisibilityChange:function(){document.hidden?this.onBlur():this.onFocus()},onKeyDown:function(e){var t;l(e)&&(t=e.code||s[e.keyCode],-1!==h.indexOf(t)&&(this.keys[t]=!0))},onKeyUp:function(e){var t;t=e.code||s[e.keyCode],delete this.keys[t]}})},221:(e,t,n)=>{var i,r=n(8190).registerComponent,s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c=n(7427),h=c.debug("components:windows-motion-controls:debug"),d=c.debug("components:windows-motion-controls:warn"),u=n(1343).DEFAULT_HANDEDNESS,p=n(1343).AFRAME_CDN_ROOT+"controllers/microsoft/",A={left:"left.glb",right:"right.glb",default:"universal.glb"},f="windows-mixed-reality";e.exports.Component=r("windows-motion-controls",{schema:{hand:{default:u},pair:{default:0},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick","menu"],axisMeshNames:["TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_X","THUMBSTICK_X","THUMBSTICK_Y"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",squeeze:"GRASP",thumbstick:"THUMBSTICK_PRESS",touchpad:"TOUCHPAD_PRESS"},pointingPoseMeshName:"POINTING_POSE"},bindMethods:function(){this.onModelError=this.onModelError.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this,t=this.el;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.onControllerConnected=function(){e.setModelVisibility(!0)},this.onControllerDisconnected=function(){e.setModelVisibility(!1)},this.controllerPresent=!1,this.previousButtonValues={},this.bindMethods(),this.loadedMeshInfo={buttonMeshes:null,axisMeshes:null},this.rayOrigin={origin:new THREE.Vector3,direction:new THREE.Vector3(0,0,-1),createdFromMesh:!1},t.addEventListener("controllerconnected",this.onControllerConnected),t.addEventListener("controllerdisconnected",this.onControllerDisconnected)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-error",this.onModelError),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-error",this.onModelError),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){o(this,f,{hand:this.data.hand,index:this.data.pair,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},updateControllerModel:function(){if(this.data.model&&!this.rayOrigin.createdFromMesh){var e=this.createControllerModelUrl();this.loadModel(e)}else this.modelReady()},createControllerModelUrl:function(e){var t=this.data.hand;return p+"default/"+(A[t]||A.default)},injectTrackedControls:function(){var e=this.data;this.el.setAttribute("tracked-controls",{idPrefix:f,controller:e.pair,hand:e.hand}),this.updateControllerModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelError:function(e){var t=this.createControllerModelUrl(!0);e.detail.src!==t?(d("Failed to load controller model for device, attempting to load default."),this.loadModel(t)):d("Failed to load default controller model.")},loadModel:function(e){this.el.setAttribute("gltf-model","url("+e+")")},onModelLoaded:function(e){var t,n,i,r,s=this.controllerModel=e.detail.model,o=this.loadedMeshInfo;if(e.target===this.el){if(h("Processing model"),o.buttonMeshes={},o.axisMeshes={},s){for(t=0;t<this.mapping.buttons.length;t++)(n=this.mapping.buttonMeshNames[this.mapping.buttons[t]])?(i=s.getObjectByName(n))?(r={index:t,value:a(i,"VALUE"),pressed:a(i,"PRESSED"),unpressed:a(i,"UNPRESSED")}).value&&r.pressed&&r.unpressed?o.buttonMeshes[this.mapping.buttons[t]]=r:d("Missing button submesh under mesh with name: "+n+"(VALUE: "+!!r.value+", PRESSED: "+!!r.pressed+", UNPRESSED:"+!!r.unpressed+")"):d("Missing button mesh with name: "+n):h("Skipping unknown button at index: "+t+" with mapped name: "+this.mapping.buttons[t]);for(t=0;t<this.mapping.axisMeshNames.length;t++)(n=this.mapping.axisMeshNames[t])?(i=s.getObjectByName(n))?(r={index:t,value:a(i,"VALUE"),min:a(i,"MIN"),max:a(i,"MAX")}).value&&r.min&&r.max?o.axisMeshes[t]=r:d("Missing axis submesh under mesh with name: "+n+"(VALUE: "+!!r.value+", MIN: "+!!r.min+", MAX:"+!!r.max+")"):d("Missing axis mesh with name: "+n):h("Skipping unknown axis at index: "+t);this.calculateRayOriginFromMesh(s),this.setModelVisibility()}h("Model load complete.")}function a(e,t){for(var n=0,i=e.children.length;n<i;n++){var r=e.children[n];if(r&&r.name===t)return r}}},calculateRayOriginFromMesh:(i=new THREE.Quaternion,function(e){var t;if(this.rayOrigin.origin.set(0,0,0),this.rayOrigin.direction.set(0,0,-1),this.rayOrigin.createdFromMesh=!0,t=e.getObjectByName(this.mapping.pointingPoseMeshName)){var n=e.parent;n&&(e.parent=null,e.updateMatrixWorld(!0),e.parent=n),t.getWorldPosition(this.rayOrigin.origin),t.getWorldQuaternion(i),this.rayOrigin.direction.applyQuaternion(i),n&&e.updateMatrixWorld(!0)}else h("Mesh does not contain pointing origin data, defaulting to none.");this.modelReady()}),lerpAxisTransform:function(){var e=new THREE.Quaternion;return function(t,n){var i=this.loadedMeshInfo.axisMeshes[t];if(i){var r=i.min,s=i.max,o=i.value,a=.5*n+.5;o.setRotationFromQuaternion(e.copy(r.quaternion).slerp(s.quaternion,a)),o.position.lerpVectors(r.position,s.position,a)}}}(),lerpButtonTransform:function(){var e=new THREE.Quaternion;return function(t,n){var i=this.loadedMeshInfo.buttonMeshes[t];if(i){var r=i.unpressed,s=i.pressed,o=i.value;o.setRotationFromQuaternion(e.copy(r.quaternion).slerp(s.quaternion,n)),o.position.lerpVectors(r.position,s.position,n)}}}(),modelReady:function(){this.el.emit("controllermodelready",{name:"windows-motion-controls",model:this.data.model,rayOrigin:this.rayOrigin})},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&(this.loadedMeshInfo&&this.loadedMeshInfo.buttonMeshes&&this.lerpButtonTransform(t,e.detail.state.value),this.el.emit(t+"changed",e.detail.state))},onAxisMoved:function(e){var t=this.mapping.axisMeshNames.length;if(this.loadedMeshInfo&&this.loadedMeshInfo.axisMeshes)for(var n=0;n<t;n++)this.lerpAxisTransform(n,e.detail.axis[n]||0);a(this,this.mapping.axes,e)},setModelVisibility:function(e){var t=this.el.getObject3D("mesh");this.controllerPresent&&(e=void 0!==e?e:this.modelVisible,this.modelVisible=e,t&&(t.visible=e))}})},1343:(e,t,n)=>{e.exports={AFRAME_CDN_ROOT:window.AFRAME_CDN_ROOT||"https://cdn.aframe.io/",AFRAME_INJECTED:"aframe-injected",DEFAULT_CAMERA_HEIGHT:1.6,DEFAULT_HANDEDNESS:"right",keyboardevent:n(5440)}},5440:e=>{e.exports={KEYCODE_TO_CODE:{38:"ArrowUp",37:"ArrowLeft",40:"ArrowDown",39:"ArrowRight",87:"KeyW",65:"KeyA",83:"KeyS",68:"KeyD"}}},842:(e,t,n)=>{var i=n(2203).a,r=n(8940),s=n(9437),o=new s.FileLoader,a=r("core:a-assets:warn");function l(e){if(e.hasAttribute("autoplay")||"auto"===e.getAttribute("preload"))return new Promise((function(t,n){if(4===e.readyState)return t();if(e.error)return n();function i(){for(var n=0,i=0;i<e.buffered.length;i++)n+=e.buffered.end(i)-e.buffered.start(i);n>=e.duration&&("VIDEO"===e.tagName&&s.Cache.add(e.getAttribute("src"),e),t())}e.addEventListener("loadeddata",i,!1),e.addEventListener("progress",i,!1),e.addEventListener("error",n,!1)}))}function c(e){var t=function(e){var t,n,i;if(e.hasAttribute("crossorigin"))return e;if(null!==(t=e.getAttribute("src"))){if(-1===t.indexOf("://"))return e;if((i=(n=t).indexOf("://")>-1?n.split("/")[2]:n.split("/")[0]).substring(0,i.indexOf(":"))===window.location.host)return e}return a('Cross-origin element (e.g., <img>) was requested without `crossorigin` set. A-Frame will re-request the asset with `crossorigin` attribute set. Please set `crossorigin` on the element (e.g., <img crossorigin="anonymous">)',t),e.crossOrigin="anonymous",e.cloneNode(!0)}(e);return t.tagName&&"video"===t.tagName.toLowerCase()&&(t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline","")),t!==e&&(e.parentNode.appendChild(t),e.parentNode.removeChild(e)),t}function h(e){var t=d(e),n=t.lastIndexOf(".");return n>=0&&".glb"===t.slice(n,e.search(/\?|#|$/))?"arraybuffer":"text"}function d(e){var t=document.createElement("a");t.href=e;var n=t.search.replace(/^\?/,""),i=e.replace(n,"").replace("?","");return i.substring(i.lastIndexOf("/")+1)}customElements.define("a-assets",class extends i{constructor(){super(),this.isAssets=!0,this.fileLoader=o,this.timeout=null}doConnectedCallback(){var e,t,n,i,r,o,h=this,d=[];if(super.doConnectedCallback(),!this.parentNode.isScene)throw new Error("<a-assets> must be a child of a <a-scene>.");for(r=this.querySelectorAll("img"),e=0;e<r.length;e++)i=c(r[e]),d.push(new Promise((function(t,n){s.Cache.add(r[e].getAttribute("src"),i),i.complete?t():(i.onload=t,i.onerror=n)})));for(n=this.querySelectorAll("audio, video"),e=0;e<n.length;e++)(t=c(n[e])).src||t.srcObject||a("Audio/video asset has neither `src` nor `srcObject` attributes."),d.push(l(t));this.getChildren().forEach((function(e){e.isAssetItem&&e.hasAttribute("src")&&d.push(new Promise((function(t,n){if(e.hasLoaded)return t();e.addEventListener("loaded",t),e.addEventListener("error",n)})))})),Promise.allSettled(d).then((function(){null!==h.timeout&&h.load()})),o=parseInt(this.getAttribute("timeout"),10)||3e3,this.timeout=setTimeout((function(){h.hasLoaded||(a("Asset loading timed out in",o,"ms"),h.timeout=null,h.emit("timeout"),h.load())}),o)}disconnectedCallback(){super.disconnectedCallback(),this.timeout&&clearTimeout(this.timeout)}load(){super.load.call(this,null,(function(){return!1}))}}),customElements.define("a-asset-item",class extends i{constructor(){super(),this.data=null,this.isAssetItem=!0}connectedCallback(){var e=this,t=this.getAttribute("src");o.setResponseType(this.getAttribute("response-type")||h(t)),o.load(t,(function(t){e.data=t,i.prototype.load.call(e)}),(function(t){e.emit("progress",{loadedBytes:t.loaded,totalBytes:t.total,xhr:t})}),(function(t){e.emit("error",{xhr:t},!1)}))}}),e.exports.inferResponseType=h,e.exports.getFileNameFromURL=d},6178:(e,t,n)=>{var i=n(8940)("core:cubemap:warn");class r extends HTMLElement{constructor(e){return super(e)}onReadyStateChange(){"complete"===document.readyState&&this.doConnectedCallback()}connectedCallback(){"complete"===document.readyState?r.prototype.doConnectedCallback.call(this):document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){this.srcs=this.validate()}validate(){var e,t=this.querySelectorAll("[src]"),n=[];if(6===t.length){for(e=0;e<t.length;e++)"IMG"===t[e].tagName?n.push(t[e]):n.push(t[e].getAttribute("src"));return n}i("<a-cubemap> did not contain exactly six elements each with a `src` attribute.")}}customElements.define("a-cubemap",r)},4056:(e,t,n)=>{var i=n(2203).a,r=n(8190).components,s=n(9437),o=n(7427),a=o.debug("core:a-entity:debug"),l=o.debug("core:a-entity:warn"),c="__",h=["position","rotation","scale","visible"],d={once:!0};class u extends i{constructor(){super(),this.components={},this.initializingComponents={},this.componentsToUpdate={},this.isEntity=!0,this.isPlaying=!1,this.object3D=new s.Group,this.object3D.rotation.order="YXZ",this.object3D.el=this,this.object3DMap={},this.parentEl=null,this.rotationObj={},this.states=[]}attributeChangedCallback(e,t,n){var i=this.components[e];super.attributeChangedCallback(),i&&i.justInitialized&&""===n?delete i.justInitialized:(i||null!==n)&&this.setEntityAttribute(e,t,n)}doConnectedCallback(){var e,t,n=this;super.doConnectedCallback(),t=this.sceneEl,this.addToParent(),this.isScene||(t?!(e=t.querySelector("a-assets"))||e.hasLoaded?this.load():e.addEventListener("loaded",(function(){n.load()})):this.load())}disconnectedCallback(){var e;if(this.parentEl){for(e in this.components)this.removeComponent(e,!1);this.isScene||(this.removeFromParent(),super.disconnectedCallback(),this.object3D.el=null)}}getObject3D(e){return this.object3DMap[e]}setObject3D(e,t){var n,i=this;if(!(t instanceof s.Object3D))throw new Error("`Entity.setObject3D` was called with an object that was not an instance of THREE.Object3D.");(n=this.getObject3D(e))&&this.object3D.remove(n),t.el=this,t.children.length&&t.traverse((function(e){e.el=i})),this.object3D.add(t),this.object3DMap[e]=t,this.emit("object3dset",{object:t,type:e})}removeObject3D(e){var t=this.getObject3D(e);t?(this.object3D.remove(t),delete this.object3DMap[e],this.emit("object3dremove",{type:e})):l("Tried to remove `Object3D` of type:",e,"which was not defined.")}getOrCreateObject3D(e,t){var n=this.getObject3D(e);return!n&&t&&(n=new t,this.setObject3D(e,n)),l("`getOrCreateObject3D` has been deprecated. Use `setObject3D()` and `object3dset` event instead."),n}add(e){if(!e.object3D)throw new Error("Trying to add an element that doesn't have an `object3D`");this.object3D.add(e.object3D),this.emit("child-attached",{el:e})}addToParent(){var e=this.parentEl=this.parentNode;e&&e.add&&!this.attachedToParent&&(e.add(this),this.attachedToParent=!0)}removeFromParent(){var e=this.parentEl;this.parentEl.remove(this),this.attachedToParent=!1,this.parentEl=null,e.emit("child-detached",{el:this})}load(){var e=this;!this.hasLoaded&&this.parentEl&&super.load.call(this,(function(){e.parentEl&&(e.updateComponents(),(e.isScene||e.parentEl.isPlaying)&&e.play())}))}remove(e){e?this.object3D.remove(e.object3D):this.parentNode.removeChild(this)}getChildEntities(){for(var e=this.children,t=[],n=0;n<e.length;n++){var i=e[n];i instanceof u&&t.push(i)}return t}initComponent(e,t,n){var i,s,l,h;h=(l=o.split(e,c))[0],s=l.length>2?l.slice(1).join("__"):l[1],r[h]&&(p(this,e)||void 0!==t||n)&&(e in this.components||(this.initComponentDependencies(h),i=new r[h].Component(this,t,s),this.isPlaying&&i.play(),this.hasAttribute(e)||(i.justInitialized=!0,window.HTMLElement.prototype.setAttribute.call(this,e,"")),a("Component initialized: %s",e)))}initComponentDependencies(e){var t,n;if(r[e]&&(t=r[e].dependencies))for(n=0;n<t.length;n++)this.initComponent(t[n],window.HTMLElement.prototype.getAttribute.call(this,t[n])||void 0,!0)}removeComponent(e,t){var n;(n=this.components[e])&&(n.initialized?(n.pause(),n.remove(),t&&(n.destroy(),delete this.components[e],this.hasAttribute(e)&&window.HTMLElement.prototype.removeAttribute.call(this,e)),this.emit("componentremoved",n.evtDetail,!1)):this.addEventListener("componentinitialized",(function n(i){i.detail.name===e&&(this.removeComponent(e,t),this.removeEventListener("componentinitialized",n))})))}updateComponents(){var e,t,n,i,r,s,a=this.componentsToUpdate;if(this.hasLoaded||this.isLoading){for(n=0;n<this.mixinEls.length;n++)for(i in this.mixinEls[n].componentCache)A(i)&&(a[i]=!0);if(this.getExtraComponents)for(i in t=this.getExtraComponents())A(i)&&(a[i]=!0);for(n=0;n<this.attributes.length;++n)i=this.attributes[n].name,-1===h.indexOf(i)&&A(i)&&(a[i]=!0);for(n=0;n<h.length;n++)i=h[n],this.hasAttribute(i)&&this.updateComponent(i,this.getDOMAttribute(i));for(i in a)r=this.getDOMAttribute(i),e=(s=t&&t[i])?s.constructor===Object?o.extend(s,o.styleParser.parse(r||{})):r||s:r,this.updateComponent(i,e),delete a[i]}}updateComponent(e,t,n){var i=this.components[e];if(i)return null!==t||p(this,e)?void i.updateProperties(t,n):void this.removeComponent(e,!0);this.initComponent(e,t,!1)}removeAttribute(e,t){var n=this.components[e];n&&void 0===t&&this.removeComponent(e,!0),n&&void 0!==t?n.resetProperty(t):("mixin"===e&&this.mixinUpdate(""),window.HTMLElement.prototype.removeAttribute.call(this,e))}play(){var e,t,n;if(!this.isPlaying&&(this.hasLoaded||this.isLoading)){for(n in this.isPlaying=!0,this.components)this.components[n].play();for(e=this.getChildEntities(),t=0;t<e.length;t++)e[t].play();this.emit("play")}}pause(){var e,t,n;if(this.isPlaying){for(n in this.isPlaying=!1,this.components)this.components[n].pause();for(e=this.getChildEntities(),t=0;t<e.length;t++)e[t].pause();this.emit("pause")}}setEntityAttribute(e,t,n){if(r[e]||this.components[e])this.updateComponent(e,n);else if("mixin"===e){if(n===this.computedMixinStr)return;this.mixinUpdate(n,t)}}mixinUpdate(e,t,n){var i,r,s,o,a=u.componentsUpdated,l=this;if(n||(t=t||this.getAttribute("mixin")),this.hasLoaded){for(s=this.updateMixins(e,t),a.length=0,o=0;o<this.mixinEls.length;o++)for(i in this.mixinEls[o].componentCache)-1===a.indexOf(i)&&(this.components[i]?this.components[i].handleMixinUpdate():this.initComponent(i,null),a.push(i));for(o=0;o<s.oldMixinIds.length;o++)if(r=document.getElementById(s.oldMixinIds[o]))for(i in r.componentCache)-1===a.indexOf(i)&&this.components[i]&&(this.getDOMAttribute(i)?this.components[i].handleMixinUpdate():this.removeComponent(i,!0))}else this.addEventListener("loaded-private",(function(){l.mixinUpdate(e,t,!0)}),d)}setAttribute(e,t,n){var i,s,a,l,h,d=u.singlePropUpdate;if(a=(l=e.indexOf(c))>0?e.substring(0,l):e,!r[a])return"mixin"===e&&this.mixinUpdate(t),void super.setAttribute.call(this,e,t);if(!this.components[e]&&this.hasAttribute(e)&&this.updateComponent(e,window.HTMLElement.prototype.getAttribute.call(this,e)),void 0!==n&&"string"==typeof t&&t.length>0&&"string"==typeof o.styleParser.parse(t)){for(h in d)delete d[h];(i=d)[t]=n,s=!1}else i=t,s=!0===n;this.updateComponent(e,i,s),this.sceneEl&&this.sceneEl.getAttribute("debug")&&this.components[e].flushToDOM()}flushToDOM(e){var t,n,i,r=this.components,s=this.children;for(i in r)r[i].flushToDOM();if(e)for(n=0;n<s.length;++n)(t=s[n]).flushToDOM&&t.flushToDOM(e)}getAttribute(e){var t,n,i,r;return"position"===e?this.object3D.position:"rotation"===e?(n=s.MathUtils.radToDeg,i=this.object3D.rotation,(r=this.rotationObj).x=n(i.x),r.y=n(i.y),r.z=n(i.z),r):"scale"===e?this.object3D.scale:"visible"===e?this.object3D.visible:(t=this.components[e])?t.data:window.HTMLElement.prototype.getAttribute.call(this,e)}getDOMAttribute(e){var t=this.components[e];return t?t.attrValue:window.HTMLElement.prototype.getAttribute.call(this,e)}addState(e){this.is(e)||(this.states.push(e),this.emit("stateadded",e))}removeState(e){var t=this.states.indexOf(e);-1!==t&&(this.states.splice(t,1),this.emit("stateremoved",e))}is(e){return-1!==this.states.indexOf(e)}inspect(){this.sceneEl.components.inspector.openInspector(this)}destroy(){var e;if(this.parentNode)l("Entity can only be destroyed if detached from scenegraph.");else for(e in this.components)this.components[e].destroy()}}function p(e,t){return!(!e.components[t]||!e.components[t].attrValue)||function(e,t){var n,i=!1;for(n=0;n<t.length&&!(i=t[n].hasAttribute(e));++n);return i}(t,e.mixinEls)}function A(e){return-1!==e.indexOf(c)&&(e=o.split(e,c)[0]),!!r[e]}u.componentsUpdated=[],u.singlePropUpdate={},customElements.define("a-entity",u),e.exports.P=u},5890:(e,t,n)=>{var i=n(2203).a,r=n(8190).components,s=n(7427),o=s.styleParser;customElements.define("a-mixin",class extends i{constructor(){super(),this.componentCache={},this.rawAttributeCache={},this.isMixin=!0}doConnectedCallback(){super.doConnectedCallback(),this.sceneEl=this.closestScene(),this.id=this.getAttribute("id"),this.cacheAttributes(),this.updateEntities(),this.load()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(),this.cacheAttribute(e,n),this.updateEntities()}setAttribute(e,t){window.HTMLElement.prototype.setAttribute.call(this,e,t),this.cacheAttribute(e,t)}cacheAttribute(e,t){var n,i;i=s.split(e,"__")[0],n=r[i],void 0===t&&(t=window.HTMLElement.prototype.getAttribute.call(this,e)),this.rawAttributeCache[e]=t,n&&(this.componentCache[e]=this.parseComponentAttrValue(n,t))}parseComponentAttrValue(e,t){var n;return"string"!=typeof t?t:(e.isSingleProperty?"string"==typeof(n=e.schema.parse(t))&&(n=t):n=o.parse(t),n)}getAttribute(e){return this.componentCache[e]||window.HTMLElement.prototype.getAttribute.call(this,e)}cacheAttributes(){var e,t,n=this.attributes;for(t=0;t<n.length;t++)e=n[t].name,this.cacheAttribute(e)}updateEntities(){var e,t,n;if(this.sceneEl)for(t=this.sceneEl.querySelectorAll("[mixin~="+this.id+"]"),n=0;n<t.length;n++)(e=t[n]).hasLoaded&&!e.isMixin&&e.mixinUpdate(this.id)}})},2203:(e,t,n)=>{var i=n(7427),r=n(2849),s=i.debug("core:a-node:warn"),o={"a-scene":!0,"a-assets":!0,"a-assets-items":!0,"a-cubemap":!0,"a-mixin":!0,"a-node":!0,"a-entity":!0};function a(e){return e.tagName.toLowerCase()in o||e.isNode}class l extends HTMLElement{constructor(){super(),this.computedMixinStr="",this.hasLoaded=!1,this.isNode=!0,this.mixinEls=[]}connectedCallback(){r.canInitializeElements?this.doConnectedCallback():document.addEventListener("aframeready",this.connectedCallback.bind(this))}doConnectedCallback(){var e;this.sceneEl=this.closestScene(),this.sceneEl||s("You are attempting to attach <"+this.tagName+"> outside of an A-Frame scene. Append this element to `<a-scene>` instead."),this.hasLoaded=!1,this.emit("nodeready",void 0,!1),this.isMixin||(e=this.getAttribute("mixin"))&&this.updateMixins(e)}attributeChangedCallback(e,t,n){n!==this.computedMixinStr&&("mixin"!==e||this.isMixin||this.updateMixins(n,t))}closestScene(){for(var e=this;e&&!e.isScene;)e=e.parentElement;return e}closest(e){for(var t=this.matches||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector,n=this;n&&!t.call(n,e);)n=n.parentElement;return n}disconnectedCallback(){this.hasLoaded=!1}load(e,t){var n,i=this;this.hasLoaded||(t=t||a,n=this.getChildren().filter(t).map((function(e){return new Promise((function(t,n){if(e.hasLoaded)return t();e.addEventListener("loaded",t),e.addEventListener("error",n)}))})),Promise.allSettled(n).then((function(t){t.forEach((function(e){"rejected"===e.status&&s("Rendering scene with errors on node: ",e.reason.target)})),i.isLoading=!0,i.setupMutationObserver(),e&&e(),i.isLoading=!1,i.hasLoaded=!0,i.emit("loaded-private",void 0,!1),i.emit("loaded",void 0,!1)})))}setupMutationObserver(){var e=this;new MutationObserver((function(t){var n;for(n=0;n<t.length;n++)if("attributes"===t[n].type){var i=t[n].attributeName,r=window.HTMLElement.prototype.getAttribute.call(e,i),s=t[n].oldValue;e.attributeChangedCallback(i,s,r)}})).observe(this,{attributes:!0,attributeOldValue:!0})}getChildren(){return Array.prototype.slice.call(this.children,0)}updateMixins(e,t){var n,r,s,o=l.newMixinIdArray,a=l.oldMixinIdArray,c=l.mixinIds;for(o.length=0,a.length=0,r=e?i.split(e.trim(),/\s+/):o,s=t?i.split(t.trim(),/\s+/):a,c.newMixinIds=r,c.oldMixinIds=s,n=0;n<s.length;n++)-1===r.indexOf(s[n])&&this.unregisterMixin(s[n]);for(this.computedMixinStr="",this.mixinEls.length=0,n=0;n<r.length;n++)this.registerMixin(r[n]);return this.computedMixinStr&&(this.computedMixinStr=this.computedMixinStr.trim(),window.HTMLElement.prototype.setAttribute.call(this,"mixin",this.computedMixinStr)),0===r.length&&window.HTMLElement.prototype.removeAttribute.call(this,"mixin"),c}registerMixin(e){var t,n,r,o=document.getElementById(e);if(o){if(r=o.getAttribute("mixin"))for(t=i.split(r.trim(),/\s+/),n=0;n<t.length;n++)this.registerMixin(t[n]);this.computedMixinStr=this.computedMixinStr+" "+o.id,this.mixinEls.push(o)}else s("No mixin was found with id `%s`",e)}setAttribute(e,t){"mixin"===e&&this.updateMixins(t),window.HTMLElement.prototype.setAttribute.call(this,e,t)}unregisterMixin(e){var t,n=this.mixinEls;for(t=0;t<n.length;++t)if(e===n[t].id){n.splice(t,1);break}}emit(e,t,n,r){var s=l.evtData;void 0===n&&(n=!0),s.bubbles=!!n,s.detail=t,r&&(s=i.extend({},r,s)),this.dispatchEvent(new CustomEvent(e,s))}}l.evtData={},l.newMixinIdArray=[],l.oldMixinIdArray=[],l.mixinIds={},customElements.define("a-node",l),e.exports.a=l,e.exports.$=o},8190:(e,t,n)=>{var i=n(7282),r=n(8313),s=n(1876),o=n(7427),a=e.exports.components={},l=i.parseProperty,c=i.process,h=i.isSingleProperty,d=i.stringifyProperties,u=i.stringifyProperty,p=o.styleParser,A=o.debug("core:component:warn"),f=document.currentScript,m=new RegExp("[A-Z]+"),g={},v=Object.freeze({}),y=[],E={get:function(e,t){return e.getComputedPropertyValue(t)},set:function(e,t,n){return t in e.schema?e.recomputeProperty(t,n):void 0!==n&&e.handleUnknownProperty(t,n),!0}},x=e.exports.Component=function(e,t,n){var i=this;if(this.sceneOnly&&!e.isScene)throw new Error("Component `"+this.name+"` can only be applied to <a-scene>");if(n&&!this.multiple)throw new Error("Trying to initialize multiple components of type `"+this.name+"`. There can only be one component of this type per entity.");this.el=e,this.id=n,this.attrName=this.name+(n?"__"+n:""),this.evtDetail={id:this.id,name:this.name},this.initialized=!1,this.el.components[this.attrName]=this,this.objectPool=g[this.name];var r=this.events;this.events={},function(e,t){var n;for(n in t)e.events[n]=t[n].bind(e)}(this,r),this.attrValue=void 0,this.isObjectBased?(this.data=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.data,this.schema),this.oldData=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.oldData,this.schema),this.attrValueProxy=new Proxy(this,E)):(this.data=void 0,this.oldData=void 0,this.attrValueProxy=void 0),this.deferUnknownPropertyWarnings=!!this.updateSchema,this.throttledEmitComponentChanged=o.throttleLeadingAndTrailing((function(){e.emit("componentchanged",i.evtDetail,!1)}),200),this.updateProperties(t,!0)};if(x.prototype={schema:{},init:function(){},events:{},update:function(e){},updateSchema:void 0,tick:void 0,tock:void 0,play:function(){},pause:function(){},remove:function(){},stringify:function(e){var t=this.schema;return"string"==typeof e?e:this.isSingleProperty?u(e,t):(e=d(e,t),p.stringify(e))},flushToDOM:function(e){var t=e?this.data:this.attrValue;null!=t&&window.HTMLElement.prototype.setAttribute.call(this.el,this.attrName,this.stringify(t))},updateProperties:function(e,t){var n=this.el;this.updateData(e,t),(n.hasLoaded||n.isLoading)&&(this.initialized?this.callUpdateHandler():this.initComponent())},initComponent:function(){var e,t=this.el;t.initializingComponents[this.name]||(t.initializingComponents[this.name]=!0,this.init(),this.initialized=!0,delete t.initializingComponents[this.name],e=this.isObjectBased?v:void 0,this.dataChanged=!1,this.storeOldData(),this.update(e),t.isPlaying&&this.play(),t.emit("componentinitialized",this.evtDetail,!1))},updateData:function(e,t){this.isSingleProperty?this.recomputeProperty(void 0,e):(t?(o.objectPool.clearObject(this.attrValue),this.recomputeData(e),this.schemaChangeRequired=!!this.updateSchema):"string"==typeof e?p.parse(e,this.attrValueProxy):o.extend(this.attrValueProxy,e),this.updateSchemaIfNeeded(e))},updateSchemaIfNeeded:function(e){if(this.schemaChangeRequired&&this.updateSchema)for(var t in y.length=0,this.updateSchema(this.data),o.objectPool.removeUnusedKeys(this.data,this.schema),this.recomputeData(e),this.schemaChangeRequired=!1,this.attrValue)void 0!==this.attrValue[t]&&-1===y.indexOf(t)&&(t in this.schema||A("Unknown property `"+t+"` for component `"+this.name+"`."));for(var n=0;n<y.length;n++)A("Unknown property `"+y[n]+"` for component `"+this.name+"`.");y.length=0},callUpdateHandler:function(){if(this.isPositionRotationScale||this.dataChanged){this.dataChanged=!1;var e=this.oldData;this.oldDataInUse=!0,this.update(e),e!==this.oldData&&this.objectPool.recycle(e),this.oldDataInUse=!1,this.storeOldData(),this.throttledEmitComponentChanged()}},handleMixinUpdate:function(){this.recomputeData(),this.updateSchemaIfNeeded(),this.callUpdateHandler()},resetProperty:function(e){(this.isSingleProperty||e in this.schema)&&(e?this.attrValue[e]=void 0:(this.isObjectBased&&this.objectPool.recycle(this.attrValue),this.attrValue=void 0),this.recomputeProperty(e,void 0),this.updateSchemaIfNeeded(),this.callUpdateHandler())},extendSchema:function(e){var t;t=o.extend({},a[this.name].schema),o.extend(t,e),this.schema=c(t),this.el.emit("schemachanged",this.evtDetail)},getComputedPropertyValue:function(e){var t=this.el.mixinEls,n=this.attrValue&&e?this.attrValue[e]:this.attrValue;if(void 0!==n)return n;for(var i=t.length-1;i>=0;i--){var r=t[i].getAttribute(this.attrName);if(null!==r&&(!e||e in r))return e?r[e]:r}return e?this.schema[e].default:this.schema.default},recomputeProperty:function(e,t){var n=e?this.schema[e]:this.schema;if(null!=t){void 0===this.attrValue&&this.isObjectBased&&(this.attrValue=this.objectPool.use());var i=e?this.attrValue[e]:this.attrValue;"string"==typeof(i=n.isCacheable?l(t,n,i):t)&&(i=""===t?void 0:t),e?this.attrValue[e]=i:this.attrValue=i}this.oldDataInUse&&(this.oldData=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.oldData,this.schema),this.storeOldData(),this.oldDataInUse=!1);var r=e?this.oldData[e]:this.oldData,s=e?this.data[e]:this.data,a=l(this.getComputedPropertyValue(e),n,s);return"array"!==n.type||e||(a=o.clone(a)),n.equals(a,r)||(this.dataChanged=!0,n.schemaChange&&(this.schemaChangeRequired=!0)),e?this.data[e]=a:this.data=a,a},handleUnknownProperty:function(e,t){void 0===this.attrValue&&(this.attrValue=this.objectPool.use()),this.attrValue[e]=t,this.deferUnknownPropertyWarnings?y.push(e):this.silenceUnknownPropertyWarnings||A("Unknown property `"+e+"` for component `"+this.name+"`.")},storeOldData:function(){var e;if(this.isObjectBased)if(this.isSingleProperty)this.oldData=l(this.data,this.schema,this.oldData);else for(e in this.schema)void 0!==this.data[e]&&(this.data[e]&&"object"==typeof this.data[e]?this.oldData[e]=l(this.data[e],this.schema[e],this.oldData[e]):this.oldData[e]=this.data[e]);else this.oldData=this.data},recomputeData:function(e){var t;if(this.isSingleProperty)this.recomputeProperty(void 0,e);else{for(t in this.schema)this.attrValueProxy[t]=void 0;e&&"object"==typeof e?o.extend(this.attrValueProxy,e):"string"==typeof e&&p.parse(e,this.attrValueProxy)}},eventsAttach:function(){var e;for(e in this.eventsDetach(),this.events)this.el.addEventListener(e,this.events[e])},eventsDetach:function(){var e;for(e in this.events)this.el.removeEventListener(e,this.events[e])},destroy:function(){this.objectPool.recycle(this.attrValue),this.objectPool.recycle(this.data),this.objectPool.recycle(this.oldData),this.attrValue=this.data=this.oldData=this.attrValueProxy=void 0}},window.debug)var b=e.exports.registrationOrderWarnings={};function C(e){return e.tick||e.tock}function w(e){return e&&e.constructor===Object&&!(e instanceof window.HTMLElement)}e.exports.registerComponent=function(e,t){var n,i,d,u,p,v={};if(document.currentScript&&document.currentScript!==f&&r.forEach((function(t){t.hasLoaded||document.currentScript.compareDocumentPosition(t)!==Node.DOCUMENT_POSITION_FOLLOWING&&(A("The component `"+e+"` was registered in a <script> tag after the scene. Component <script> tags in an HTML file should be declared *before* the scene such that the component is available to entities during scene initialization."),window.debug&&(b[e]=!0))})),!0===m.test(e)&&A("The component name `"+e+"` contains uppercase characters, but HTML will ignore the capitalization of attribute names. Change the name to be lowercase: `"+e.toLowerCase()+"`"),-1!==e.indexOf("__"))throw new Error("The component name `"+e+"` is not allowed. The sequence __ (double underscore) is reserved to specify an id for multiple components of the same type");if(Object.keys(t).forEach((function(e){v[e]={value:t[e],writable:!0}})),a[e])throw new Error("The component `"+e+"` has been already registered. Check that you are not loading two versions of the same component or two different components of the same name.");((n=function(e,t,n){x.call(this,e,t,n)}).prototype=Object.create(x.prototype,v)).name=e,n.prototype.isPositionRotationScale="position"===e||"rotation"===e||"scale"===e,n.prototype.constructor=n,n.prototype.system=s&&s.systems[e],n.prototype.play=(u=n.prototype.play,function(){var e=this.el.sceneEl,t=this.el.isPlaying&&!this.isPlaying;this.initialized&&t&&(u.call(this),this.isPlaying=!0,this.eventsAttach(),C(this)&&e.addBehavior(this))}),n.prototype.pause=(p=n.prototype.pause,function(){var e=this.el.sceneEl;this.isPlaying&&(p.call(this),this.isPlaying=!1,this.eventsDetach(),C(this)&&e.removeBehavior(this))}),i=o.extend(c(n.prototype.schema,n.prototype.name)),n.prototype.isSingleProperty=d=h(n.prototype.schema),n.prototype.isObjectBased=!d||d&&(w(i.default)||w(l(void 0,i))),g[e]=o.objectPool.createPool(),a[e]={Component:n,dependencies:n.prototype.dependencies,before:n.prototype.before,after:n.prototype.after,isSingleProperty:n.prototype.isSingleProperty,isObjectBased:n.prototype.isObjectBased,multiple:n.prototype.multiple,sceneOnly:n.prototype.sceneOnly,name:e,schema:i,stringify:n.prototype.stringify};for(var y=0;y<r.length;y++)r[y].emit("componentregistered",{name:e},!1);return n}},7045:(e,t,n)=>{var i=n(7282).process,r=e.exports.to={},s=e.exports.Ls=[],o=n(9437),a=function(){};a.prototype={schema:{},init:function(e){return this.geometry=new o.BufferGeometry,this.geometry},update:function(e){}},e.exports.Az=function(e,t){var n,o={};if(Object.keys(t).forEach((function(e){o[e]={value:t[e],writable:!0}})),r[e])throw new Error("The geometry `"+e+"` has been already registered");return((n=function(){a.call(this)}).prototype=Object.create(a.prototype,o)).name=e,n.prototype.constructor=n,r[e]={Geometry:n,schema:i(n.prototype.schema)},s.push(e),n}},1551:(e,t,n)=>{var i=n(676),r=n(8878)("core:propertyTypes:warn"),s=e.exports.propertyTypes={},o=/[,> .[\]:]/,a=/url\((.+)\)/;function l(e,t,n,i,r,o){if(e in s)throw new Error("Property type "+e+" is already registered.");s[e]={default:t,parse:n||u,stringify:i||p,equals:r||A,isCacheable:!1!==o}}function c(e,t){if(!Array.isArray(e)||!Array.isArray(t))return e===t;if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function h(e){var t,n;return"string"!=typeof e?e:(n=e.match(a))?n[1]:"#"===e.charAt(0)?(t=document.getElementById(e.substring(1)))?"CANVAS"===t.tagName||"VIDEO"===t.tagName||"IMG"===t.tagName?t:t.getAttribute("src"):void r('"'+e+'" asset not found.'):e}function d(e){return e.getAttribute?e.getAttribute("id")?"#"+e.getAttribute("id"):e.getAttribute("src"):p(e)}function u(e){return e}function p(e){return null===e?"null":e.toString()}function A(e,t){return e===t}function f(e){return parseInt(e,10)}function m(e,t,n){return i.parse(e,t,n)}function g(e,t){if(null===e)return!0;if("object"!=typeof e)return!1;if(Object.keys(e).length!==t)return!1;var n=e.x,i=e.y,r=e.z,s=e.w;return!("number"!=typeof n||"number"!=typeof i||t>2&&"number"!=typeof r||t>3&&"number"!=typeof s)}l("audio","",h,d),l("array",[],(function(e){return Array.isArray(e)?e:e&&"string"==typeof e?e.split(",").map((function(e){return e.trim()})):[]}),(function(e){return e.join(", ")}),c),l("asset","",h,d),l("boolean",!1,(function(e){return"false"!==e&&!1!==e})),l("color","#FFF"),l("int",0,f),l("number",0,(function(e){return parseFloat(e,10)})),l("map","",h,d),l("model","",h,d),l("selector",null,(function(e){return e?"string"!=typeof e?e:"#"!==e[0]||o.test(e)?document.querySelector(e):document.getElementById(e.substring(1)):null}),(function(e){return e.getAttribute?"#"+e.getAttribute("id"):p(e)}),A,!1),l("selectorAll",null,(function(e){return e?"string"!=typeof e?e:Array.prototype.slice.call(document.querySelectorAll(e),0):null}),(function(e){return e instanceof Array?e.map((function(e){return"#"+e.getAttribute("id")})).join(", "):p(e)}),c,!1),l("src","",(function(e){return r("`src` property type is deprecated. Use `asset` instead."),h(e)}),d),l("string",""),l("time",0,f),l("vec2",{x:0,y:0},m,i.stringify,i.equals),l("vec3",{x:0,y:0,z:0},m,i.stringify,i.equals),l("vec4",{x:0,y:0,z:0,w:1},m,i.stringify,i.equals),e.exports.registerPropertyType=l,e.exports.isValidDefaultValue=function(e,t){return("audio"!==e||"string"==typeof t)&&!("array"===e&&!Array.isArray(t))&&("asset"!==e||"string"==typeof t)&&("boolean"!==e||"boolean"==typeof t)&&("color"!==e||"string"==typeof t)&&("int"!==e||"number"==typeof t)&&("number"!==e||"number"==typeof t)&&("map"!==e||"string"==typeof t)&&("model"!==e||"string"==typeof t)&&("selector"!==e||"string"==typeof t||null===t)&&("selectorAll"!==e||"string"==typeof t||null===t)&&("src"!==e||"string"==typeof t)&&("string"!==e||"string"==typeof t)&&("time"!==e||"number"==typeof t)&&("vec2"===e?g(t,2):"vec3"===e?g(t,3):"vec4"!==e||g(t,4))},e.exports.isValidDefaultCoordinate=g},2849:e=>{function t(){e.exports.canInitializeElements||(e.exports.canInitializeElements=!0,setTimeout((function(){document.dispatchEvent(new CustomEvent("aframeready"))})))}e.exports.canInitializeElements=!1,e.exports.waitForDocumentReadyState=function(){"complete"!==document.readyState?document.addEventListener("readystatechange",(function e(){"complete"===document.readyState&&(document.removeEventListener("readystatechange",e),t())})):t()},e.exports.emitReady=t},5076:(e,t,n)=>{var i=n(8316).W,r=n(6147),s=n(9762),o=n(8313),a=n(1876).systems,l=n(8190).components,c=n(9437),h=n(7427),d=h.debug("core:a-scene:warn"),u=n(4056).P,p=n(2203).a,A=n(8371),f=h.device.isIOS(),m=h.device.isMobile(),g=h.device.isWebXRAvailable;f&&n(1957);class v extends u{constructor(){var e;super(),(e=this).clock=new c.Clock,e.isIOS=f,e.isMobile=m,e.hasWebXR=g,e.isAR=!1,e.isScene=!0,e.object3D=new c.Scene,e.object3D.onAfterRender=function(t,n,i){e.isPlaying&&e.tock(e.time,e.delta,i)},e.resize=e.resize.bind(e),e.render=e.render.bind(e),e.systems={},e.systemNames=[],e.time=e.delta=0,e.usedOfferSession=!1,e.componentOrder=[],e.behaviors={},e.hasLoaded=!1,e.isPlaying=!1,e.originalHTML=e.innerHTML}addFullScreenStyles(){document.documentElement.classList.add("a-fullscreen")}removeFullScreenStyles(){document.documentElement.classList.remove("a-fullscreen")}doConnectedCallback(){var e=this,t=this.hasAttribute("embedded");this.setAttribute("inspector",""),this.setAttribute("keyboard-shortcuts",""),this.setAttribute("screenshot",""),this.setAttribute("xr-mode-ui",""),this.setAttribute("device-orientation-permission-ui",""),super.doConnectedCallback(),function(e){var t;function n(){document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||e.exitVR(),document.activeElement.blur(),document.body.focus()}(t=document.createElement("canvas")).classList.add("a-canvas"),t.dataset.aframeCanvas=!0,e.appendChild(t),document.addEventListener("fullscreenchange",n),document.addEventListener("mozfullscreenchange",n),document.addEventListener("webkitfullscreenchange",n),document.addEventListener("MSFullscreenChange",n),t.addEventListener("touchmove",(function(e){e.preventDefault()}),{passive:!1}),e.canvas=t,e.emit("render-target-loaded",{target:t}),setTimeout(e.resize.bind(e),0)}(this),this.setupRenderer(),s.setup(this,x),this.resize(),t||this.addFullScreenStyles(),A(this),i(this),r(this),this.enterVRBound=function(){e.enterVR()},this.exitVRBound=function(){e.exitVR()},window.addEventListener("sessionend",this.resize),this.addEventListener("cameraready",(function(){e.attachedCallbackPostCamera()})),this.initSystems(),this.componentOrder=y(l,this.componentOrder),this.addEventListener("componentregistered",(function(){e.componentOrder=y(l,e.componentOrder)})),this.hasWebXR&&navigator.xr&&navigator.xr.addEventListener&&navigator.xr.addEventListener("sessiongranted",(function(){e.enterVR()}))}attachedCallbackPostCamera(){var e=this;window.addEventListener("load",void 0),window.addEventListener("resize",(function(){e.isIOS?setTimeout(e.resize,100):e.resize()})),this.play(),o.push(this)}initSystems(){var e;for(e in this.initSystem("camera"),a)"camera"!==e&&this.initSystem(e)}initSystem(e){this.systems[e]||(this.systems[e]=new a[e](this),this.systemNames.push(e))}disconnectedCallback(){var e=o.indexOf(this);super.disconnectedCallback(),o.splice(e,1),window.removeEventListener("sessionend",this.resize),this.removeFullScreenStyles(),this.renderer.dispose()}addBehavior(e){var t,n,i=this.behaviors[e.name];for(n in i||(i=this.behaviors[e.name]={tick:{inUse:!1,array:[],markedForRemoval:[]},tock:{inUse:!1,array:[],markedForRemoval:[]}}),i)if(e[n]){if((t=i[n]).inUse){var r=t.markedForRemoval.indexOf(e);-1!==r&&t.markedForRemoval.splice(r,1)}-1===t.array.indexOf(e)&&t.array.push(e)}}getPointerLockElement(){return document.pointerLockElement}checkHeadsetConnected(){return h.device.checkHeadsetConnected()}enterAR(){var e;if(!this.hasWebXR)throw e="Failed to enter AR mode, WebXR not supported.",new Error(e);if(!h.device.checkARSupport())throw e="Failed to enter AR, WebXR immersive-ar mode not supported in your browser or device.",new Error(e);return this.enterVR(!0)}enterVR(e,t){var n,i=this,r=i.renderer.xr;if(t&&(!navigator.xr||!navigator.xr.offerSession))return Promise.resolve("OfferSession is not supported.");if(i.usedOfferSession&&t)return Promise.resolve("OfferSession was already called.");if(this.is("vr-mode"))return Promise.resolve("Already in VR.");if(this.checkHeadsetConnected()||this.isMobile){var s=i.getAttribute("renderer");if(r.enabled=!0,this.hasWebXR){this.xrSession&&this.xrSession.removeEventListener("end",this.exitVRBound);var o=this.sceneEl.systems.webxr.sessionReferenceSpaceType;r.setReferenceSpaceType(o);var a=e?"immersive-ar":"immersive-vr";return n=this.sceneEl.systems.webxr.sessionConfiguration,new Promise((function(e,o){var c=t?navigator.xr.offerSession.bind(navigator.xr):navigator.xr.requestSession.bind(navigator.xr);i.usedOfferSession|=t,c(a,n).then((function(o){t&&(i.usedOfferSession=!1),r.layersEnabled=-1!==n.requiredFeatures.indexOf("layers"),r.setSession(o).then((function(){r.setFoveation(s.foveationLevel),i.xrSession=o,i.systems.renderer.setWebXRFrameRate(o),o.addEventListener("end",i.exitVRBound),l(e)}))}),(function(e){o(new Error("Failed to enter "+("immersive-ar"===a?"AR":"VR")+" mode (`requestSession`)",{cause:e}))}))}))}throw new Error("Failed to enter "+(e?"AR":"VR")+" no WebXR")}return l(),Promise.resolve();function l(t){var n;e?i.addState("ar-mode"):i.addState("vr-mode"),i.emit("enter-vr",{target:i}),!i.hasWebXR&&i.isMobile&&screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape"),i.addFullScreenStyles(),i.isMobile||i.checkHeadsetConnected()||((n=i.canvas).requestFullscreen||n.webkitRequestFullscreen||n.mozRequestFullScreen||n.msRequestFullscreen).apply(n,[{navigationUI:"hide"}]),i.resize(),t&&t()}}exitVR(){var e=this,t=this.renderer.xr;if(!this.is("vr-mode")&&!this.is("ar-mode"))return Promise.resolve("Not in immersive mode.");if(this.checkHeadsetConnected()||this.isMobile){if(t.enabled=!1,!this.hasWebXR)throw Error("Failed to exit VR - no WebXR");this.xrSession.removeEventListener("end",this.exitVRBound),this.xrSession.end().then((function(){}),(function(){})),this.xrSession=void 0}else(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen());return e.removeState("vr-mode"),e.removeState("ar-mode"),e.isMobile&&screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),e.hasAttribute("embedded")&&e.removeFullScreenStyles(),e.resize(),e.isIOS&&h.forceCanvasResizeSafariMobile(e.canvas),e.renderer.setPixelRatio(window.devicePixelRatio),e.emit("exit-vr",{target:e}),Promise.resolve()}getAttribute(e){var t=this.systems[e];return t?t.data:u.prototype.getAttribute.call(this,e)}getDOMAttribute(e){var t=this.systems[e];return t?t.data:u.prototype.getDOMAttribute.call(this,e)}setAttribute(e,t,n){if(a[e]){p.prototype.setAttribute.call(this,e,t);var i=this.systems[e];i&&i.updateProperties(t)}else u.prototype.setAttribute.call(this,e,t,n)}removeBehavior(e){var t,n,i,r=this.behaviors[e.name];for(n in r)e[n]&&-1!==(i=(t=r[n]).array.indexOf(e))&&(t.inUse?-1===t.markedForRemoval.indexOf(e)&&t.markedForRemoval.push(e):(t.array[i]=t.array[t.array.length-1],t.array.pop()))}resize(){var e,t,n=this.camera,i=this.canvas,r=this.renderer.xr.isPresenting;e=this.renderer.xr.enabled&&r,!n||!i||this.is("vr-mode")&&(this.isMobile||e)||(t=x(i,this.getAttribute("embedded")&&!this.is("vr-mode"),this.maxCanvasSize,this.is("vr-mode")),n.aspect=t.width/t.height,n.updateProjectionMatrix(),this.renderer.setSize(t.width,t.height,!1),this.emit("rendererresize",null,!1))}setupRenderer(){var e,t,n,i,r=this;i={alpha:!0,antialias:!m,canvas:this.canvas,logarithmicDepthBuffer:!1,powerPreference:"high-performance"},this.maxCanvasSize={height:-1,width:-1},this.hasAttribute("renderer")&&(n=this.getAttribute("renderer"),(t=h.styleParser.parse(n)).precision&&(i.precision=t.precision+"p"),t.antialias&&"auto"!==t.antialias&&(i.antialias="true"===t.antialias),t.logarithmicDepthBuffer&&"auto"!==t.logarithmicDepthBuffer&&(i.logarithmicDepthBuffer="true"===t.logarithmicDepthBuffer),t.alpha&&(i.alpha="true"===t.alpha),t.stencil&&(i.stencil="true"===t.stencil),t.multiviewStereo&&(i.multiviewStereo="true"===t.multiviewStereo),this.maxCanvasSize={width:t.maxCanvasWidth?parseInt(t.maxCanvasWidth):this.maxCanvasSize.width,height:t.maxCanvasHeight?parseInt(t.maxCanvasHeight):this.maxCanvasSize.height}),(e=this.renderer=new c.WebGLRenderer(i)).setPixelRatio(window.devicePixelRatio),this.camera&&e.xr.setPoseTarget(this.camera.el.object3D),this.addEventListener("camera-set-active",(function(){e.xr.setPoseTarget(r.camera.el.object3D)}))}play(){var e=this,t=this;this.renderStarted?u.prototype.play.call(this):(this.addEventListener("loaded",(function(){var e=this.renderer;u.prototype.play.call(this),t.renderStarted||(t.resize(),t.renderer&&(window.performance&&window.performance.mark("render-started"),s.remove(),e.setAnimationLoop(this.render),t.renderStarted=!0,t.emit("renderstart")))})),setTimeout((function(){u.prototype.load.call(e)})))}updateComponent(e){e in a||u.prototype.updateComponent.apply(this,arguments)}tick(e,t){var n,i=this.systems;for(this.callComponentBehaviors("tick",e,t),n=0;n<this.systemNames.length;n++)i[this.systemNames[n]].tick&&i[this.systemNames[n]].tick(e,t)}tock(e,t,n){var i,r=this.systems;for(this.callComponentBehaviors("tock",e,t),i=0;i<this.systemNames.length;i++)r[this.systemNames[i]].tock&&r[this.systemNames[i]].tock(e,t,n)}render(e,t){var n=this.renderer;this.frame=t,this.delta=1e3*this.clock.getDelta(),this.time=1e3*this.clock.elapsedTime,this.isPlaying&&this.tick(this.time,this.delta);var i=null;this.is("ar-mode")&&(i=this.object3D.background,this.object3D.background=null),n.render(this.object3D,this.camera),i&&(this.object3D.background=i)}callComponentBehaviors(e,t,n){for(var i,r=0;r<this.componentOrder.length;r++){var s=this.behaviors[this.componentOrder[r]];if(s){var o=s[e];for(o.inUse=!0,i=0;i<o.array.length;i++)o.array[i].isPlaying&&o.array[i][e](t,n);for(o.inUse=!1,i=0;i<o.markedForRemoval.length;i++)this.removeBehavior(o.markedForRemoval[i]);o.markedForRemoval.length=0}}}}function y(e,t){var n,i,r={},s=t||[];for(i in s.length=0,e){var o=e[i];if(void 0!==o){var a=o.before?o.before.slice(0):[],l=o.after?o.after.slice(0):[];r[i]={before:a,after:l,visited:!1,done:!1}}}for(i in r)for(n=0;n<r[i].before.length;n++){var c=r[i].before[n];c in r?r[c].after.push(i):d("Invalid ordering constraint, no component named `"+c+"` referenced by `"+i+"`")}function h(e){if(e in r&&!r[e].done)if(r[e].visited)d("Cycle detected, ignoring one or more before/after constraints. The resulting order might be incorrect");else{r[e].visited=!0;for(var t=0;t<r[e].after.length;t++){var n=r[e].after[t];n in r||d("Invalid before/after constraint, no component named `"+n+"` referenced in `"+e+"`"),h(n)}r[e].done=!0,s.push(e)}}for(i in r)r[i].done||h(i);return s}function E(e,t){var n,i=window.devicePixelRatio;return!t||-1===t.width&&-1===t.height||e.width*i<t.width&&e.height*i<t.height||(n=e.width/e.height,e.width*i>t.width&&-1!==t.width&&(e.width=Math.round(t.width/i),e.height=Math.round(t.width/n/i)),e.height*i>t.height&&-1!==t.height&&(e.height=Math.round(t.height/i),e.width=Math.round(t.height*n/i))),e}function x(e,t,n,i){return e.parentElement?t?E({height:e.parentElement.offsetHeight,width:e.parentElement.offsetWidth},n):function(e,t){var n;return n={height:document.body.offsetHeight,width:document.body.offsetWidth},t?n:E(n,e)}(n,i):{height:0,width:0}}customElements.define("a-scene",v),e.exports.aQ=v},9762:(e,t,n)=>{var i,r,s,o=n(1343).AFRAME_INJECTED,a=n(7427).styleParser,l="loading-screen";function c(e){var t=i.hasAttribute("embedded"),n=s(i.canvas,t,i.maxCanvasSize,i.is("vr-mode"));e.aspect=n.width/n.height,e.updateProjectionMatrix(),i.renderer.setSize(n.width,n.height,!1)}e.exports.setup=function(e,t){s=t;var n,h,d,u,p,A,f,m,g,v,y=(i=e).hasAttribute(l)?a.parse(i.getAttribute(l)):void 0,E=y&&y.dotsColor||"white",x=y&&y.backgroundColor||"#24CAFF";(void 0===y||"true"===y.enabled||void 0===y.enabled)&&(n=new THREE.Scene,h=new THREE.SphereGeometry(.2,36,18,0,2*Math.PI,0,Math.PI),d=new THREE.MeshBasicMaterial({color:E}),u=new THREE.Mesh(h,d),p=u.clone(),A=u.clone(),f=new THREE.PerspectiveCamera(80,window.innerWidth/window.innerHeight,5e-4,1e4),m=new THREE.Clock,g=0,v=function(){i.renderer.render(n,f),g=m.getElapsedTime()%4,u.visible=g>=1,p.visible=g>=2,A.visible=g>=3},n.background=new THREE.Color(x),n.add(f),u.position.set(-1,0,-15),p.position.set(0,0,-15),A.position.set(1,0,-15),f.add(u),f.add(p),f.add(A),(r=document.createElement("div")).className="a-loader-title",r.innerHTML=document.title,r.style.display="none",r.setAttribute(o,""),i.appendChild(r),setTimeout((function(){i.hasLoaded||(c(f),r.style.display="block",window.addEventListener("resize",(function(){c(f)})),i.renderer.setAnimationLoop(v))}),200))},e.exports.remove=function(){window.removeEventListener("resize",c),r&&(r.style.display="none")}},8316:(e,t,n)=>{var i,r=n(1343),s=n(7427).extend,o=[l({name:"viewport",content:"width=device-width,initial-scale=1,maximum-scale=1,shrink-to-fit=no,user-scalable=no,minimal-ui,viewport-fit=cover"}),l({name:"mobile-web-app-capable",content:"yes"}),l({name:"theme-color",content:"black"})],a=[l({name:"apple-mobile-web-app-capable",content:"yes"}),l({name:"apple-mobile-web-app-status-bar-style",content:"black"}),(i={rel:"apple-touch-icon",href:"https://aframe.io/images/aframe-logo-152.png"},{tagName:"link",attributes:i,exists:function(){return document.querySelector('link[rel="'+i.rel+'"]')}})];function l(e){return{tagName:"meta",attributes:e,exists:function(){return document.querySelector('meta[name="'+e.name+'"]')}}}e.exports.W=function(e){var t,n=document.head,i=n.querySelector("script"),l=[];return o.forEach(c),e.isIOS&&a.forEach(c),l;function c(e){e&&!e.exists()&&(t=function(e){if(e&&e.tagName){var t=document.createElement(e.tagName);return t.setAttribute(r.AFRAME_INJECTED,""),s(t,e.attributes)}}(e),t&&(i?i.parentNode.insertBefore(t,i):n.appendChild(t),l.push(t)))}}},8371:(e,t,n)=>{var i=n(7427).isIframed;function r(e){if(e.data&&"vr"===e.data.type)switch(e.data.data){case"enter":this.enterVR();break;case"exit":this.exitVR()}}e.exports=function(e){i()&&window.addEventListener("message",r.bind(e))}},8313:e=>{e.exports=[]},6147:(e,t,n)=>{var i=n(5928);e.exports=function(e){if(e.isMobile){var t=e.wakelock=new i;e.addEventListener("enter-vr",(function(){t.request()})),e.addEventListener("exit-vr",(function(){t.release()}))}}},7282:(e,t,n)=>{var i,r=n(7427),s=n(1551),o=r.debug,a=s.isValidDefaultValue,l=s.propertyTypes,c=o("core:schema:warn");function h(e){return"type"in e?"string"==typeof e.type:"default"in e}function d(e,t){var n,i,r=e.default,s=e.type;return e.type?"bool"===e.type?s="boolean":"float"===e.type&&(s="number"):s=void 0===r||"boolean"!=typeof r&&"number"!=typeof r?Array.isArray(r)?"array":"string":typeof r,(i=l[s])||c("Unknown property type for component `"+t+"`: "+s),n=!!e.parse,e.parse=e.parse||i.parse,e.stringify=e.stringify||i.stringify,e.equals=e.equals||i.equals,e.isCacheable=!0===e.isCacheable||i.isCacheable,e.type=s,"default"in e?n||a(s,r)||c("Default value `"+r+"` does not match type `"+s+"` in component `"+t+"`"):e.default=i.default,e}function u(e,t,n){return null!=e&&""!==e||(e=t.default,Array.isArray(e)&&(e=e.slice())),t.parse(e,t.default,n)}function p(e,t){return"object"!=typeof e?e:t&&null!==e?t.stringify(e):JSON.stringify(e)}e.exports.isSingleProperty=h,e.exports.process=function(e,t){var n;if(h(e))return d(e,t);for(n in e)e[n]=d(e[n],t);return e},e.exports.processPropertyDefinition=d,e.exports.parseProperties=(i=[],function(e,t,n,r,s){var o,a,l,h;for(a in i.length=0,n?e:t)n&&void 0===e[a]||i.push(a);if(null===e||"object"!=typeof e)return e;for(a in e)void 0===e[a]||t[a]||s||c("Unknown property `"+a+"` for component/system `"+r+"`.");for(o=0;o<i.length;o++){if(l=t[a=i[o]],h=e[a],!t[a])return;e[a]=u(h,l)}return e}),e.exports.parseProperty=u,e.exports.stringifyProperties=function(e,t){var n,i,r,s,o={};for(n in e)i=t[n],"object"==typeof(s=r=e[n])&&(s=p(r,i),i||c("Unknown component property: "+n)),void 0!==s&&(o[n]=s);return o},e.exports.stringifyProperty=p},5892:(e,t,n)=>{var i=n(7282).process,r=e.exports.shaders={},s=e.exports.shaderNames=[],o=n(9437),a=n(7427),l={array:"v3",color:"v3",int:"i",number:"f",map:"t",time:"f",vec2:"v2",vec3:"v3",vec4:"v4"},c=e.exports.Shader=function(){};c.prototype={schema:{},vertexShader:"void main() {gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);}",fragmentShader:"void main() {gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);}",init:function(e){return this.uniforms=this.initUniforms(),this.material=new(this.raw?o.RawShaderMaterial:o.ShaderMaterial)({uniforms:this.uniforms,glslVersion:this.raw||this.glsl3?o.GLSL3:null,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader}),this.material},initUniforms:function(){var e,t,n=this.schema,i={};for(e in n)"uniform"===n[e].is&&(t=l[n[e].type],i[e]={type:t,value:void 0});return i},update:function(e){var t,n,i=this.schema,r=this.uniforms;for(t in e)if(i[t]&&"uniform"===i[t].is)if("map"!==i[t].type)r[t].value=this.parseValue(i[t].type,e[t]),r[t].needsUpdate=!0;else{if(!r[t]||r[t].value===e[t])continue;n="_texture_"+t,this.setMapOnTextureLoad(r,t,n),a.material.updateMapMaterialFromData(n,t,this,e)}},parseValue:function(e,t){var n;switch(e){case"vec2":return new o.Vector2(t.x,t.y);case"vec3":return new o.Vector3(t.x,t.y,t.z);case"vec4":return new o.Vector4(t.x,t.y,t.z,t.w);case"color":return n=new o.Color(t),new o.Vector3(n.r,n.g,n.b);default:return t}},setMapOnTextureLoad:function(e,t,n){var i=this;this.el.addEventListener("materialtextureloaded",(function(){e[t].value=i.material[n],e[t].needsUpdate=!0}))}},e.exports.registerShader=function(e,t){var n,o={};if(Object.keys(t).forEach((function(e){o[e]={value:t[e],writable:!0}})),r[e])throw new Error("The shader "+e+" has already been registered");return((n=function(){c.call(this)}).prototype=Object.create(c.prototype,o)).name=e,n.prototype.constructor=n,r[e]={Shader:n,schema:i(n.prototype.schema)},s.push(e),n}},1876:(e,t,n)=>{var i=n(8190),r=n(7282),s=n(7427),o=n(2849),a=r.parseProperties,l=r.parseProperty,c=r.process,h=r.isSingleProperty,d=s.styleParser,u=e.exports.systems={},p=e.exports.System=function(e){var t=i&&i.components[this.name];this.el=e,this.sceneEl=e,t&&(t.Component.prototype.system=this),this.buildData(),this.init(),this.update({})};p.prototype={schema:{},init:function(){},update:function(e){},updateProperties:function(e){var t=this.data;Object.keys(r).length&&(this.buildData(e),this.update(t))},buildData:function(e){var t=this.schema;Object.keys(t).length&&(e=e||window.HTMLElement.prototype.getAttribute.call(this.sceneEl,this.name),h(t)?this.data=l(e,t):this.data=a(d.parse(e)||{},t,!1,this.name))},tick:void 0,tock:void 0,play:function(){},pause:function(){}},e.exports.registerSystem=function(e,t){var n,i,r={},a=s.findAllScenes(document);if(Object.keys(t).forEach((function(e){r[e]={value:t[e],writable:!0}})),u[e])throw new Error("The system `"+e+"` has been already registered. Check that you are not loading two versions of the same system or two different systems of the same name.");if(((i=function(e){p.call(this,e)}).prototype=Object.create(p.prototype,r)).name=e,i.prototype.constructor=i,i.prototype.schema=s.extend(c(i.prototype.schema)),u[e]=i,o.canInitializeElements)for(n=0;n<a.length;n++)a[n].initSystem(e)}},258:(e,t,n)=>{n(4530)},4530:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=new r.Vector3,o=new r.Vector3;i("pivot",{dependencies:["position"],schema:{type:"vec3"},init:function(){var e=this.data,t=this.el,n=t.object3D.parent,i=t.object3D,a=new r.Group;s.copy(i.position),o.copy(i.rotation),n.remove(i),a.add(i),n.add(a),t.object3D=a,i.position.set(-1*e.x,-1*e.y,-1*e.z),a.position.set(e.x+s.x,e.y+s.y,e.z+s.z),a.rotation.copy(i.rotation),i.rotation.set(0,0,0)}})},1028:(e,t,n)=>{var i=n(8190).components,r=n(5892).shaders,s=n(7427),o={};function a(e){var t=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();"fog"===e&&(t="material-fog"),"visible"===e&&(t="material-visible"),o[t]="material."+e}Object.keys(i.material.schema).forEach(a),Object.keys(r.standard.schema).forEach(a),e.exports=function(){return{defaultComponents:{material:{}},mappings:s.extend({},o)}}},196:(e,t,n)=>{n(5702),n(9099),n(1907),n(3200),n(3120),n(9357),n(7161),n(9172),n(9012),n(4814),n(542),n(2414),n(1199),n(6672)},5920:(e,t,n)=>{var i=n(2203).$,r=n(4056).P,s=n(8190).components,o=n(7427),a=o.debug,l=o.entity.setComponentProperty,c=a("extras:primitives:debug"),h=a("extras:primitives:warn"),d=a("extras:primitives:error"),u=e.exports.primitives={};function p(e,t,n){var i=o.entity.getComponentPropertyPath(e);i.constructor===Array?(n[i[0]]=n[i[0]]||{},n[i[0]][i[1]]=t.trim()):n[i]=t.trim()}e.exports.registerPrimitive=function(e,t){if(e=e.toLowerCase(),!i[e]){i[e]=!0,c("Registering <%s>",e),t.defaultAttributes&&h("The 'defaultAttributes' object is deprecated. Use 'defaultComponents' instead.");var n=t.mappings||{},a=class extends r{constructor(){super(),this.defaultComponentsFromPrimitive=t.defaultComponents||t.defaultAttributes||{},this.deprecated=t.deprecated||null,this.deprecatedMappings=t.deprecatedMappings||{},this.mappings=n,t.deprecated&&console.warn(t.deprecated),this.resolveMappingCollisions()}resolveMappingCollisions(){var e=this.mappings,t=this;Object.keys(e).forEach((function(n){var i;n!==n.toLowerCase()&&h("Mapping keys should be specified in lower case. The mapping key "+n+" may not be recognized"),s[n]&&(i=e[n].replace(".","-"),e[i]=e[n],delete e[n],console.warn("The primitive "+t.tagName.toLowerCase()+" has a mapping collision. The attribute "+n+" has the same name as a registered component and has been renamed to "+i))}))}getExtraComponents(){var e,t,n,i,r,s=this;for(t=o.clone(this.defaultComponentsFromPrimitive),(r=this.getAttribute("mixin"))&&(r=o.split(r.trim(),/\s+/)).forEach((function(e){var n,r,h=document.getElementById(e);if(h){var d=h.rawAttributeCache,u=h.componentCache;for(var A in d){if(i=s.mappings[A])return void p(i,d[A],t);A in u&&(t[A]=(n=t[A],r=u[A],a(n)?l(r):a(r)?l(n):c(n)&&c(r)?o.extendDeep(n,r):l(r)))}}})),n=0;n<this.attributes.length;n++)e=this.attributes[n],(i=this.mappings[e.name])&&p(i,e.value,t);return t;function a(e){return void 0===e}function l(e){return c(e)?o.extendDeep({},e):e}function c(e){return null!==e&&e.constructor===Object}}attributeChangedCallback(e,t,n){var i=this.mappings[e];e in this.deprecatedMappings&&console.warn(this.deprecatedMappings[e]),e&&i?l(this,i,n):super.attributeChangedCallback(e,t,n)}};return customElements.define(e,a),a.mappings=n,u[e]=a,a}d("Trying to register primitive "+e+" that has been already previously registered")},e.exports.definePrimitive=function(t,n,i){i=i||{},Object.keys(n).map((function(e){!function(e,t){var n=s[e].schema;Object.keys(n).map((function(n){var i=n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();void 0!==t[i]&&(i=e+"-"+n),t[i]=e+"."+n}))}(e,i)})),e.exports.registerPrimitive(t,o.extendDeep({},null,{defaultComponents:n,mappings:i}))}},5702:(e,t,n)=>{(0,n(5920).registerPrimitive)("a-camera",{defaultComponents:{camera:{},"look-controls":{},"wasd-controls":{},position:{x:0,y:1.6,z:0}},mappings:{active:"camera.active",far:"camera.far",fov:"camera.fov","look-controls-enabled":"look-controls.enabled",near:"camera.near","pointer-lock-enabled":"look-controls.pointerLockEnabled","wasd-controls-enabled":"wasd-controls.enabled","reverse-mouse-drag":"look-controls.reverseMouseDrag",zoom:"camera.zoom"}})},9099:(e,t,n)=>{var i=n(1028);(0,n(5920).registerPrimitive)("a-cursor",n(7427).extendDeep({},i(),{defaultComponents:{cursor:{},geometry:{primitive:"ring",radiusOuter:.016,radiusInner:.01,segmentsTheta:32},material:{color:"#000",shader:"flat",opacity:.8},position:{x:0,y:0,z:-1}},mappings:{far:"raycaster.far",fuse:"cursor.fuse","fuse-timeout":"cursor.fuseTimeout",interval:"raycaster.interval",objects:"raycaster.objects"}}))},1907:(e,t,n)=>{var i=n(1028);(0,n(5920).registerPrimitive)("a-curvedimage",n(7427).extendDeep({},i(),{defaultComponents:{geometry:{height:1,primitive:"cylinder",radius:2,segmentsRadial:48,thetaLength:270,openEnded:!0,thetaStart:0},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0,repeat:"-1 1"}},mappings:{height:"geometry.height","open-ended":"geometry.openEnded",radius:"geometry.radius",segments:"geometry.segmentsRadial",start:"geometry.thetaStart","theta-length":"geometry.thetaLength","theta-start":"geometry.thetaStart",width:"geometry.thetaLength"}}))},3200:(e,t,n)=>{(0,n(5920).registerPrimitive)("a-gltf-model",{mappings:{src:"gltf-model"}})},3120:(e,t,n)=>{var i=n(1028);(0,n(5920).registerPrimitive)("a-image",n(7427).extendDeep({},i(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}}))},9357:(e,t,n)=>{(0,n(5920).registerPrimitive)("a-light",{defaultComponents:{light:{}},mappings:{angle:"light.angle",color:"light.color","ground-color":"light.groundColor",decay:"light.decay",distance:"light.distance",intensity:"light.intensity",penumbra:"light.penumbra",type:"light.type",target:"light.target",envmap:"light.envMap","shadow-camera-automatic":"light.shadowCameraAutomatic"}})},7161:(e,t,n)=>{(0,n(5920).registerPrimitive)("a-link",{defaultComponents:{link:{visualAspectEnabled:!0}},mappings:{href:"link.href",image:"link.image",title:"link.title"}})},9172:(e,t,n)=>{var i=n(1028)();(0,n(5920).registerPrimitive)("a-obj-model",n(7427).extendDeep({},i,{defaultComponents:{"obj-model":{}},mappings:{src:"obj-model.obj",mtl:"obj-model.mtl"}}))},9012:(e,t,n)=>{var i=n(1028),r=n(5920).registerPrimitive,s=n(7427),o=n(6672);r("a-sky",s.extendDeep({},i(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",side:"back",shader:"flat",npot:!0},scale:"-1 1 1"},mappings:s.extendDeep({},o["a-sphere"].mappings)}))},4814:(e,t,n)=>{(0,n(5920).registerPrimitive)("a-sound",{defaultComponents:{sound:{}},mappings:{src:"sound.src",on:"sound.on",autoplay:"sound.autoplay",loop:"sound.loop",volume:"sound.volume"}})},542:(e,t,n)=>{(0,n(5920).definePrimitive)("a-text",{text:{anchor:"align",width:5}})},2414:(e,t,n)=>{var i=n(1028);(0,n(5920).registerPrimitive)("a-video",n(7427).extendDeep({},i(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}}))},1199:(e,t,n)=>{var i=n(1028);(0,n(5920).registerPrimitive)("a-videosphere",n(7427).extendDeep({},i(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",shader:"flat",side:"back",npot:!0},scale:"-1 1 1"},mappings:{radius:"geometry.radius","segments-height":"geometry.segmentsHeight","segments-width":"geometry.segmentsWidth"}}))},6672:(e,t,n)=>{var i=n(1028),r=n(7045).to,s=n(7045).Ls,o=n(5920).registerPrimitive,a=n(7427),l=e.exports={};function c(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}s.forEach((function(e){var t=r[e],n=c(e),s={};Object.keys(t.schema).forEach((function(e){s[c(e)]="geometry."+e}));var h="a-"+n,d=o(h,a.extendDeep({},i(),{defaultComponents:{geometry:{primitive:e}},mappings:s}));l[h]=d}))},5459:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("box",{schema:{depth:{default:1,min:0},height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"},segmentsDepth:{default:1,min:1,max:20,type:"int"}},init:function(e){this.geometry=new r.BoxGeometry(e.width,e.height,e.depth,e.segmentsWidth,e.segmentsHeight,e.segmentsDepth)}})},2328:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("circle",{schema:{radius:{default:1,min:0},segments:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new r.CircleGeometry(e.radius,e.segments,s(e.thetaStart),s(e.thetaLength))}})},4907:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("cone",{schema:{height:{default:1,min:0},openEnded:{default:!1},radiusBottom:{default:1,min:0},radiusTop:{default:.01,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new r.CylinderGeometry(e.radiusTop,e.radiusBottom,e.height,e.segmentsRadial,e.segmentsHeight,e.openEnded,s(e.thetaStart),s(e.thetaLength))}})},6362:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("cylinder",{schema:{height:{default:1,min:0},openEnded:{default:!1},radius:{default:1,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new r.CylinderGeometry(e.radius,e.radius,e.height,e.segmentsRadial,e.segmentsHeight,e.openEnded,s(e.thetaStart),s(e.thetaLength))}})},3934:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("dodecahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new r.DodecahedronGeometry(e.radius,e.detail)}})},4763:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("icosahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new r.IcosahedronGeometry(e.radius,e.detail)}})},6394:(e,t,n)=>{n(5459),n(2328),n(4907),n(6362),n(3934),n(4763),n(7049),n(6184),n(4110),n(7313),n(1394),n(6103),n(5553),n(7020)},7049:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("octahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new r.OctahedronGeometry(e.radius,e.detail)}})},6184:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("plane",{schema:{height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"}},init:function(e){this.geometry=new r.PlaneGeometry(e.width,e.height,e.segmentsWidth,e.segmentsHeight)}})},4110:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("ring",{schema:{radiusInner:{default:.8,min:0},radiusOuter:{default:1.2,min:0},segmentsPhi:{default:10,min:1,type:"int"},segmentsTheta:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new r.RingGeometry(e.radiusInner,e.radiusOuter,e.segmentsTheta,e.segmentsPhi,s(e.thetaStart),s(e.thetaLength))}})},7313:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("sphere",{schema:{radius:{default:1,min:0},phiLength:{default:360},phiStart:{default:0,min:0},thetaLength:{default:180,min:0},thetaStart:{default:0},segmentsHeight:{default:18,min:2,type:"int"},segmentsWidth:{default:36,min:3,type:"int"}},init:function(e){this.geometry=new r.SphereGeometry(e.radius,e.segmentsWidth,e.segmentsHeight,s(e.phiStart),s(e.phiLength),s(e.thetaStart),s(e.thetaLength))}})},1394:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("tetrahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new r.TetrahedronGeometry(e.radius,e.detail)}})},6103:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("torus",{schema:{arc:{default:360},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:36,min:2,type:"int"},segmentsTubular:{default:32,min:3,type:"int"}},init:function(e){this.geometry=new r.TorusGeometry(e.radius,2*e.radiusTubular,e.segmentsRadial,e.segmentsTubular,s(e.arc))}})},5553:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("torusKnot",{schema:{p:{default:2,min:1},q:{default:3,min:1},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:8,min:3,type:"int"},segmentsTubular:{default:100,min:3,type:"int"}},init:function(e){this.geometry=new r.TorusKnotGeometry(e.radius,2*e.radiusTubular,e.segmentsTubular,e.segmentsRadial,e.p,e.q)}})},7020:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=new r.Quaternion,o=new r.Vector3(0,0,1),a=new r.Vector2,l=new r.Vector2,c=new r.Vector2;i("triangle",{schema:{vertexA:{type:"vec3",default:{x:0,y:.5,z:0}},vertexB:{type:"vec3",default:{x:-.5,y:-.5,z:0}},vertexC:{type:"vec3",default:{x:.5,y:-.5,z:0}}},init:function(e){var t,n,i,h,d,u,p,A,f;(i=new r.Triangle).a.set(e.vertexA.x,e.vertexA.y,e.vertexA.z),i.b.set(e.vertexB.x,e.vertexB.y,e.vertexB.z),i.c.set(e.vertexC.x,e.vertexC.y,e.vertexC.z),n=i.getNormal(new r.Vector3),s.setFromUnitVectors(n,o),h=i.a.clone().applyQuaternion(s),d=i.b.clone().applyQuaternion(s),u=i.c.clone().applyQuaternion(s),a.set(Math.min(h.x,d.x,u.x),Math.min(h.y,d.y,u.y)),l.set(Math.max(h.x,d.x,u.x),Math.max(h.y,d.y,u.y)),c.set(0,0).subVectors(l,a),h=(new r.Vector2).subVectors(h,a).divide(c),d=(new r.Vector2).subVectors(d,a).divide(c),u=(new r.Vector2).subVectors(u,a).divide(c),t=this.geometry=new r.BufferGeometry,p=[i.a.x,i.a.y,i.a.z,i.b.x,i.b.y,i.b.z,i.c.x,i.c.y,i.c.z],A=[n.x,n.y,n.z,n.x,n.y,n.z,n.x,n.y,n.z],f=[h.x,h.y,d.x,d.y,u.x,u.y],t.setAttribute("position",new r.Float32BufferAttribute(p,3)),t.setAttribute("normal",new r.Float32BufferAttribute(A,3)),t.setAttribute("uv",new r.Float32BufferAttribute(f,2))}})},4497:(e,t,n)=>{var i=n(7427),r=i.debug,s=r("A-Frame:error"),o=r("A-Frame:warn");window.document.currentScript&&window.document.currentScript.parentNode!==window.document.head&&!window.debug&&o("Put the A-Frame <script> tag in the <head> of the HTML *before* the scene to ensure everything for A-Frame is properly registered before they are used from HTML."),window.cordova||"file:"!==window.location.protocol||s("This HTML file is currently being served via the file:// protocol. Assets, textures, and models WILL NOT WORK due to cross-origin policy! Please use a local or hosted server: https://aframe.io/docs/1.4.0/introduction/installation.html#use-a-local-server."),i.device.isBrowserEnvironment&&(n(7180),n(9379));var a=n(5076).aQ,l=n(8190).components,c=n(8190).registerComponent,h=n(7045).Az,d=n(5920).registerPrimitive,u=n(5892).registerShader,p=n(1876).registerSystem,A=n(5892).shaders,f=n(1876).systems,m=window.THREE=n(9437),g=n(2849),v=n(8330);n(8850),n(6394),n(344),n(3072);var y=n(2203).a,E=n(4056).P;n(842),n(6178),n(5890),n(258),n(196),console.log("A-Frame Version: 1.6.0 (Date 2024-12-09, Commit #24c2bad)"),console.log("THREE Version (https://github.com/supermedium/three.js):",m.REVISION),window.AFRAME_ASYNC||g.waitForDocumentReadyState(),e.exports=window.AFRAME={AComponent:n(8190).Component,AEntity:E,ANode:y,ANIME:n(4635).A,AScene:a,components:l,coreComponents:Object.keys(l),geometries:n(7045).to,registerComponent:c,registerGeometry:h,registerPrimitive:d,registerShader:u,registerSystem:p,primitives:{getMeshMixin:n(1028),primitives:n(5920).primitives},scenes:n(8313),schema:n(7282),shaders:A,systems:f,emitReady:g.emitReady,THREE:m,utils:i,version:v.version}},8132:e=>{window.aframeStats=function(e){var t=null,n=e;return{update:function(){var e;t("te").set((e=n.querySelectorAll("*"),Array.prototype.slice.call(e).filter((function(e){return e.isEntity})),e.length)),window.performance.getEntriesByName&&t("lt").set(window.performance.getEntriesByName("render-started")[0].startTime.toFixed(0))},start:function(){},end:function(){},attach:function(e){t=e},values:{te:{caption:"Entities"},lt:{caption:"Load Time"}},groups:[{caption:"A-Frame",values:["te","lt"]}],fractions:[]}},e.exports={aframeStats:window.aframeStats}},9437:(e,t,n)=>{var i=n(7496).A;n.g.THREE=i,n(7469),i.Cache&&(i.Cache.enabled=!0),e.exports=i},2621:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437),s=n(7427);function o(e,t){return t.color.set(e.color),t.fog=e.fog,t.wireframe=e.wireframe,t.toneMapped=e.toneMapped,t.wireframeLinewidth=e.wireframeLinewidth,t}e.exports.Shader=i("flat",{schema:{color:{type:"color"},fog:{default:!0},height:{default:256},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},src:{type:"map"},width:{default:512},wireframe:{default:!1},wireframeLinewidth:{default:2},toneMapped:{default:!0}},init:function(e){this.materialData={color:new r.Color},o(e,this.materialData),this.material=new r.MeshBasicMaterial(this.materialData)},update:function(e){this.updateMaterial(e),s.material.updateMap(this,e)},updateMaterial:function(e){var t;for(t in o(e,this.materialData),this.materialData)this.material[t]=this.materialData[t]}})},344:(e,t,n)=>{n(2621),n(9583),n(8318),n(6419),n(1152),n(7002)},1152:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437),s=["#include <common>","#include <fog_pars_vertex>","#include <logdepthbuf_pars_vertex>","out vec2 vUV;","void main(void) {"," vUV = uv;"," #include <begin_vertex>"," #include <project_vertex>"," #include <logdepthbuf_vertex>"," #include <fog_vertex>","}"].join("\n"),o=["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","uniform bool negate;","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","float median(float r, float g, float b) {"," return max(min(r, g), min(max(r, g), b));","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec3 sampleColor = texture(map, vUV).rgb;"," if (negate) { sampleColor = 1.0 - sampleColor; }"," float sigDist = median(sampleColor.r, sampleColor.g, sampleColor.b) - 0.5;"," float alpha = clamp(sigDist / fwidth(sigDist) + 0.5, 0.0, 1.0);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(vUV) + dFdy(vUV));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," // Do modified alpha test."," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * (sigDist + 0.5);"," }"," // Do modified alpha test."," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," gl_FragColor = vec4(color.xyz, alpha * opacity);"," #include <logdepthbuf_fragment>"," #include <tonemapping_fragment>"," #include <colorspace_fragment>"," #include <fog_fragment>","}"].join("\n");e.exports.Shader=i("msdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},negate:{type:"boolean",is:"uniform",default:!0},opacity:{type:"number",is:"uniform",default:1}},vertexShader:s,fragmentShader:o,init:function(){return this.uniforms=r.UniformsUtils.merge([r.UniformsLib.fog,this.initUniforms()]),this.material=new r.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,fog:!0}),this.material}})},8318:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437),s=n(7427);function o(e,t){switch(t.color.set(e.color),t.specular.set(e.specular),t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity,t.fog=e.fog,t.transparent=e.transparent,t.wireframe=e.wireframe,t.wireframeLinewidth=e.wireframeLinewidth,t.shininess=e.shininess,t.flatShading=e.flatShading,t.wireframe=e.wireframe,t.wireframeLinewidth=e.wireframeLinewidth,t.reflectivity=e.reflectivity,t.refractionRatio=e.refractionRatio,e.combine){case"mix":t.combine=r.MixOperation;break;case"multiply":t.combine=r.MultiplyOperation;break;case"add":t.combine=r.AddOperation}return e.normalMap&&(t.normalScale=e.normalScale),e.ambientOcclusionMap&&(t.aoMapIntensity=e.ambientOcclusionMapIntensity),e.bumpMap&&(t.bumpScale=e.bumpMapScale),e.displacementMap&&(t.displacementScale=e.displacementScale,t.displacementBias=e.displacementBias),t}e.exports.Shader=i("phong",{schema:{color:{type:"color"},emissive:{type:"color",default:"black"},emissiveIntensity:{default:1},specular:{type:"color",default:"#111111"},transparent:{default:!1},fog:{default:!0},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},src:{type:"map"},envMap:{default:""},sphericalEnvMap:{type:"map"},shininess:{default:30},flatShading:{default:!1},wireframe:{default:!1},wireframeLinewidth:{default:2},combine:{oneOF:["multiply","mix","add"],default:"mix"},reflectivity:{default:.9},refractionRatio:{default:.98},refract:{default:!1},normalMap:{type:"map"},normalScale:{type:"vec2",default:{x:1,y:1}},normalTextureOffset:{type:"vec2"},normalTextureRepeat:{type:"vec2",default:{x:1,y:1}},ambientOcclusionMap:{type:"map"},ambientOcclusionMapIntensity:{default:1},displacementMap:{type:"map"},displacementScale:{default:1},displacementBias:{default:.5},displacementTextureOffset:{type:"vec2"},displacementTextureRepeat:{type:"vec2",default:{x:1,y:1}},bumpMap:{type:"map"},bumpMapScale:{default:1},bumpTextureOffset:{type:"vec2"},bumpTextureRepeat:{type:"vec2",default:{x:1,y:1}}},init:function(e){this.materialData={color:new r.Color,specular:new r.Color,emissive:new r.Color},o(e,this.materialData),this.material=new r.MeshPhongMaterial(this.materialData);var t=this.el.sceneEl;Object.defineProperty(this.material,"envMap",{get:function(){return this._envMap||t.object3D.environment},set:function(e){this._envMap=e}})},update:function(e){this.updateMaterial(e),s.material.updateMap(this,e),s.material.updateDistortionMap("normal",this,e),s.material.updateDistortionMap("displacement",this,e),s.material.updateDistortionMap("ambientOcclusion",this,e),s.material.updateDistortionMap("bump",this,e),s.material.updateEnvMap(this,e)},updateMaterial:function(e){var t;for(t in o(e,this.materialData),this.materialData)this.material[t]=this.materialData[t]}})},6419:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437),s=["#include <common>","#include <fog_pars_vertex>","#include <logdepthbuf_pars_vertex>","out vec2 vUV;","void main(void) {"," vUV = uv;"," #include <begin_vertex>"," #include <project_vertex>"," #include <logdepthbuf_vertex>"," #include <fog_vertex>","}"].join("\n"),o=["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","float contour(float width, float value) {"," return smoothstep(0.5 - value, 0.5 + value, width);","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec2 uv = vUV;"," vec4 texColor = texture(map, uv);"," float dist = texColor.a;"," float width = fwidth(dist);"," float alpha = contour(dist, width);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(uv) + dFdy(uv));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * dist;"," }"," if (isBigEnough <= BIG_ENOUGH) {"," vec4 box = vec4 (uv - duv, uv + duv);"," alpha = (alpha + 0.5 * ("," contour(texture(map, box.xy).a, width)"," + contour(texture(map, box.zw).a, width)"," + contour(texture(map, box.xw).a, width)"," + contour(texture(map, box.zy).a, width)"," )) / 3.0;"," }"," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," gl_FragColor = vec4(color, opacity * alpha);"," #include <logdepthbuf_fragment>"," #include <tonemapping_fragment>"," #include <colorspace_fragment>"," #include <fog_fragment>","}"].join("\n");e.exports.Shader=i("sdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},opacity:{type:"number",is:"uniform",default:1}},vertexShader:s,fragmentShader:o,init:function(){return this.uniforms=r.UniformsUtils.merge([r.UniformsLib.fog,this.initUniforms()]),this.material=new r.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,fog:!0}),this.material}})},7002:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437);e.exports.Shader=i("shadow",{schema:{opacity:{default:.5},transparent:{default:!0},alphaToCoverage:{default:!0}},init:function(e){this.material=new r.ShadowMaterial},update:function(e){this.material.opacity=e.opacity,this.material.alphaToCoverage=e.alphaToCoverage,this.material.transparent=e.transparent}})},9583:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437),s=n(7427);function o(e,t){return t.color.set(e.color),t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity,t.fog=e.fog,t.metalness=e.metalness,t.roughness=e.roughness,t.wireframe=e.wireframe,t.wireframeLinewidth=e.wireframeLinewidth,e.normalMap&&(t.normalScale=e.normalScale),e.ambientOcclusionMap&&(t.aoMapIntensity=e.ambientOcclusionMapIntensity),e.displacementMap&&(t.displacementScale=e.displacementScale,t.displacementBias=e.displacementBias),t}e.exports.Shader=i("standard",{schema:{ambientOcclusionMap:{type:"map"},ambientOcclusionMapIntensity:{default:1},ambientOcclusionTextureOffset:{type:"vec2"},ambientOcclusionTextureRepeat:{type:"vec2",default:{x:1,y:1}},color:{type:"color"},displacementMap:{type:"map"},displacementScale:{default:1},displacementBias:{default:.5},displacementTextureOffset:{type:"vec2"},displacementTextureRepeat:{type:"vec2",default:{x:1,y:1}},emissive:{type:"color",default:"#000"},emissiveIntensity:{default:1},envMap:{default:""},fog:{default:!0},height:{default:256},metalness:{default:0,min:0,max:1},metalnessMap:{type:"map"},metalnessTextureOffset:{type:"vec2"},metalnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},normalMap:{type:"map"},normalScale:{type:"vec2",default:{x:1,y:1}},normalTextureOffset:{type:"vec2"},normalTextureRepeat:{type:"vec2",default:{x:1,y:1}},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},roughness:{default:.5,min:0,max:1},roughnessMap:{type:"map"},roughnessTextureOffset:{type:"vec2"},roughnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},sphericalEnvMap:{type:"map"},src:{type:"map"},width:{default:512},wireframe:{default:!1},wireframeLinewidth:{default:2}},init:function(e){this.materialData={color:new r.Color,emissive:new r.Color},o(e,this.materialData),this.material=new r.MeshStandardMaterial(this.materialData)},update:function(e){this.updateMaterial(e),s.material.updateMap(this,e),s.material.updateDistortionMap("normal",this,e),s.material.updateDistortionMap("displacement",this,e),s.material.updateDistortionMap("ambientOcclusion",this,e),s.material.updateDistortionMap("metalness",this,e),s.material.updateDistortionMap("roughness",this,e),s.material.updateEnvMap(this,e)},updateMaterial:function(e){var t,n=this.material;for(t in o(e,this.materialData),this.materialData)n[t]=this.materialData[t]}})},409:(e,t,n)=>{var i=n(1343),r=n(1876).registerSystem,s="data-aframe-default-camera";e.exports.System=r("camera",{init:function(){this.activeCameraEl=null,this.render=this.render.bind(this),this.unwrapRender=this.unwrapRender.bind(this),this.wrapRender=this.wrapRender.bind(this),this.initialCameraFound=!1,this.numUserCameras=0,this.numUserCamerasChecked=0,this.setupInitialCamera()},setupInitialCamera:function(){var e,t,n=this.sceneEl,i=this;if(!n.camera||n.camera.el.getAttribute("camera").spectator)if((e=n.querySelectorAll("a-camera, :not(a-mixin)[camera]")).length)for(this.numUserCameras=e.length,t=0;t<e.length;t++)e[t].addEventListener("object3dset",(function(e){"camera"===e.detail.type&&i.checkUserCamera(this)})),e[t].isNode?e[t].load():e[t].addEventListener("nodeready",(function(){this.load()}));else this.createDefaultCamera();else n.emit("cameraready",{cameraEl:n.camera.el})},checkUserCamera:function(e){var t,n=this.el.sceneEl;this.numUserCamerasChecked++,this.initialCameraFound||((t=e.getAttribute("camera")).active&&!t.spectator?(this.initialCameraFound=!0,n.camera=e.getObject3D("camera"),n.emit("cameraready",{cameraEl:e})):this.numUserCamerasChecked===this.numUserCameras&&this.createDefaultCamera())},createDefaultCamera:function(){var e,t=this.sceneEl;(e=document.createElement("a-entity")).setAttribute("camera",{active:!0}),e.setAttribute("position",{x:0,y:i.DEFAULT_CAMERA_HEIGHT,z:0}),e.setAttribute("wasd-controls",""),e.setAttribute("look-controls",""),e.setAttribute(i.AFRAME_INJECTED,""),e.addEventListener("object3dset",(function(n){"camera"===n.detail.type&&(t.camera=n.detail.object,t.emit("cameraready",{cameraEl:e}))})),t.appendChild(e)},disableActiveCamera:function(){var e;(e=this.sceneEl.querySelectorAll(":not(a-mixin)[camera]"))[e.length-1].setAttribute("camera","active",!0)},setActiveCamera:function(e){var t,n,i,r,o=this.activeCameraEl,a=this.sceneEl;if((r=e.getObject3D("camera"))&&e!==this.activeCameraEl){var l=a.querySelector("["+s+"]");for(e!==(l&&l.querySelector(":not(a-mixin)[camera]"))&&function(e){var t;e.camera&&(t=e.querySelector("["+s+"]"))&&e.removeChild(t)}(a),this.activeCameraEl=e,this.activeCameraEl.play(),a.camera=r,o&&o.setAttribute("camera","active",!1),n=a.querySelectorAll(":not(a-mixin)[camera]"),i=0;i<n.length;i++)(t=n[i]).isEntity&&e!==t&&(t.setAttribute("camera","active",!1),t.pause());a.emit("camera-set-active",{cameraEl:e})}},setSpectatorCamera:function(e){var t,n=this.spectatorCameraEl,i=this.sceneEl;e.getObject3D("camera")&&e!==this.spectatorCameraEl&&(n&&n.setAttribute("camera","spectator",!1),t=this.spectatorCameraEl=e,i.addEventListener("enter-vr",this.wrapRender),i.addEventListener("exit-vr",this.unwrapRender),t.setAttribute("camera","active",!1),t.play(),i.emit("camera-set-spectator",{cameraEl:e}))},disableSpectatorCamera:function(){this.spectatorCameraEl=void 0},wrapRender:function(){this.spectatorCameraEl&&!this.originalRender&&(this.originalRender=this.sceneEl.renderer.render,this.sceneEl.renderer.render=this.render)},unwrapRender:function(){this.originalRender&&(this.sceneEl.renderer.render=this.originalRender,this.originalRender=void 0)},render:function(e,t){var n,i,r=this.sceneEl;n=r.renderer.xr.enabled,this.originalRender.call(r.renderer,e,t),this.spectatorCameraEl&&!r.isMobile&&n&&(i=this.spectatorCameraEl.components.camera.camera,r.renderer.xr.enabled=!1,this.originalRender.call(r.renderer,e,i),r.renderer.xr.enabled=n)}})},810:(e,t,n)=>{var i=n(7045).to,r=n(1876).registerSystem;function s(e){var t=e.primitive,n=i[t]&&i[t].Geometry,r=new n;if(!n)throw new Error("Unknown geometry `"+t+"`");return r.init(e),r.geometry}e.exports.System=r("geometry",{init:function(){this.cache={},this.cacheCount={}},clearCache:function(){this.cache={},this.cacheCount={}},getOrCreateGeometry:function(e){var t,n,i=this.cache;return e.skipCache?s(e):(t=i[n=this.hash(e)],function(e,t){e[t]=void 0===e[t]?1:e[t]+1}(this.cacheCount,n),t||(t=s(e),i[n]=t,t))},unuseGeometry:function(e){var t,n=this.cache,i=this.cacheCount;e.skipCache||n[t=this.hash(e)]&&(function(e,t){e[t]--}(i,t),i[t]>0||(n[t].dispose(),delete n[t],delete i[t]))},hash:function(e){return JSON.stringify(e)}})},4211:(e,t,n)=>{var i=n(1876).registerSystem,r=n(9437);e.exports.System=i("gltf-model",{schema:{dracoDecoderPath:{default:"https://www.gstatic.com/draco/versioned/decoders/1.5.7/"},basisTranscoderPath:{default:""},meshoptDecoderPath:{default:""}},init:function(){this.update()},update:function(){var e,t=this.data.dracoDecoderPath,n=this.data.basisTranscoderPath,i=this.data.meshoptDecoderPath;!this.dracoLoader&&t&&(this.dracoLoader=new r.DRACOLoader,this.dracoLoader.setDecoderPath(t)),!this.ktx2Loader&&n&&(this.ktx2Loader=new r.KTX2Loader,this.ktx2Loader.setTranscoderPath(n).detectSupport(this.el.renderer)),!this.meshoptDecoder&&i&&(this.meshoptDecoder=(e=i,new Promise((function(t,n){var i=document.createElement("script");document.body.appendChild(i),i.onload=t,i.onerror=n,i.async=!0,i.src=e}))).then((function(){return window.MeshoptDecoder.ready})).then((function(){return window.MeshoptDecoder})))},getDRACOLoader:function(){return this.dracoLoader},getKTX2Loader:function(){return this.ktx2Loader},getMeshoptDecoder:function(){return this.meshoptDecoder}})},3072:(e,t,n)=>{n(409),n(810),n(4211),n(6540),n(1855),n(2382),n(6769),n(5426),n(2941),n(6696)},6540:(e,t,n)=>{var i=n(1876).registerSystem,r=n(1343),s="data-aframe-default-light";e.exports.System=i("light",{schema:{defaultLightsEnabled:{default:!0}},init:function(){this.defaultLights=!1,this.userDefinedLights=!1,this.sceneEl.addEventListener("loaded",this.setupDefaultLights.bind(this))},registerLight:function(e){e.hasAttribute(s)||(this.removeDefaultLights(),this.userDefinedLights=!0)},removeDefaultLights:function(){var e,t=this.sceneEl;if(this.defaultLights){e=document.querySelectorAll("["+s+"]");for(var n=0;n<e.length;n++)t.removeChild(e[n]);this.defaultLights=!1}},setupDefaultLights:function(){var e,t,n=this.sceneEl;this.userDefinedLights||this.defaultLights||!this.data.defaultLightsEnabled||((e=document.createElement("a-entity")).setAttribute("light",{color:"#BBB",type:"ambient"}),e.setAttribute(s,""),e.setAttribute(r.AFRAME_INJECTED,""),n.appendChild(e),(t=document.createElement("a-entity")).setAttribute("light",{color:"#FFF",intensity:1.884,castShadow:!0}),t.setAttribute("position",{x:-.5,y:1,z:1}),t.setAttribute(s,""),t.setAttribute(r.AFRAME_INJECTED,""),n.appendChild(t),this.defaultLights=!0)}})},1855:(e,t,n)=>{var i=n(1876).registerSystem,r=n(9437),s=n(7427),o=n(8066).setTextureProperties,a=n(8066).createCompatibleTexture,l=s.debug,c=l("components:texture:error"),h=l("components:texture:warn"),d=new r.ImageLoader;e.exports.System=i("material",{init:function(){this.materials={},this.sourceCache={}},clearTextureSourceCache:function(){this.sourceCache={}},loadTexture:function(e,t,n){this.loadTextureSource(e,(function(e){var i=a(e);o(i,t),n(i)}))},loadTextureSource:function(e,t){var n=this,i=this.sourceCache,o=this.hash(e);function a(e){i[o]=Promise.resolve(e),i[o].then(t)}i[o]?i[o].then(t):"CANVAS"!==e.tagName?a(new Promise((function(t,i){s.srcLoader.validateSrc(e,(function(e){n.loadImage(e,t)}),(function(e){n.loadVideo(e,t)}))}))):a(new r.Source(e))},loadCubeMapTexture:function(e,t){var n=this,i=0,s=new r.CubeTexture;function o(r){n.loadTextureSource(e[r],(function(e){s.images[r]=e.data,6==++i&&(s.needsUpdate=!0,t(s))}))}if(s.colorSpace=r.SRGBColorSpace,6===e.length)for(var a=0;a<e.length;a++)o(a);else h("Cube map texture requires exactly 6 sources, got only %s sources",e.length)},loadImage:function(e,t){t("string"==typeof e?function(e){return new Promise((function(t,n){d.load(e,(function(e){t(new r.Source(e))}),(function(){}),(function(e){c("`$s` could not be fetched (Error code: %s; Response: %s)",e.status,e.statusText)}))}))}(e):new r.Source(e))},loadVideo:function(e,t){var n;"string"!=typeof e&&function(e){e.autoplay=e.hasAttribute("autoplay")&&"false"!==e.getAttribute("autoplay"),e.controls=e.hasAttribute("controls")&&"false"!==e.getAttribute("controls"),"false"===e.getAttribute("loop")&&e.removeAttribute("loop"),"false"===e.getAttribute("preload")&&(e.preload="none"),e.crossOrigin=e.crossOrigin||"anonymous",e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline","")}(n=e),n=n||function(e){var t=document.createElement("video");return t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline",""),t.autoplay=!0,t.loop=!0,t.crossOrigin="anonymous",t.addEventListener("error",(function(){h("`%s` is not a valid video",e)}),!0),t.src=e,t}(e),t(new r.Source(n))},hash:function(e){return e.tagName&&(e.id||e.src)||e},registerMaterial:function(e){this.materials[e.uuid]=e},unregisterMaterial:function(e){delete this.materials[e.uuid]}})},2382:(e,t,n)=>{(0,n(1876).registerSystem)("obb-collider",{schema:{showColliders:{default:!1}},init:function(){this.collisions=[],this.colliderEls=[]},addCollider:function(e){this.colliderEls.push(e),this.data.showColliders?e.components["obb-collider"].showCollider():e.components["obb-collider"].hideCollider(),this.tick=this.detectCollisions},removeCollider:function(e){var t=this.colliderEls,n=t.indexOf(e);e.components["obb-collider"].hideCollider(),n>-1&&t.splice(n,1),0===t.length&&(this.tick=void 0)},registerCollision:function(e,t){var n=this.collisions,i=!1,r=e.obb,s=t.obb,o=e.renderColliderMesh,a=t.renderColliderMesh;o&&o.material.color.set(16711680),a&&a.material.color.set(16711680);for(var l=0;l<n.length;l++)if(n[l].componentA.obb===r&&n[l].componentB.obb===s||n[l].componentA.obb===s&&n[l].componentB.obb===r){i=!0,n[l].detected=!0;break}i||(n.push({componentA:e,componentB:t,detected:!0}),e.el.emit("obbcollisionstarted",{trackedObject3D:e.trackedObject3D,withEl:t.el}),t.el.emit("obbcollisionstarted",{trackedObject3D:t.trackedObject3D,withEl:e.el}))},resetCollisions:function(){for(var e=this.collisions,t=0;t<e.length;t++)e[t].detected=!1},clearCollisions:function(){for(var e,t,n,i,r=this.collisions,s=[],o=0;o<r.length;o++)r[o].detected?s.push(r[o]):(e=r[o].componentA,t=r[o].componentB,n=e.renderColliderMesh,i=t.renderColliderMesh,n&&n.material.color.set(65280),e.el.emit("obbcollisionended",{trackedObject3D:this.trackedObject3D,withEl:t.el}),i&&i.material.color.set(65280),t.el.emit("obbcollisionended",{trackedObject3D:this.trackedObject3D,withEl:e.el}));this.collisions=s},detectCollisions:function(){var e,t,n,i,r=this.colliderEls;if(!(r.length<2)){this.resetCollisions();for(var s=0;s<r.length;s++)if(n=r[s].components["obb-collider"],0!==(e=r[s].components["obb-collider"].obb).halfSize.x&&0!==e.halfSize.y&&0!==e.halfSize.z)for(var o=s+1;o<r.length;o++)0!==(t=(i=r[o].components["obb-collider"]).obb).halfSize.x&&0!==t.halfSize.y&&0!==t.halfSize.z&&e.intersectsOBB(t)&&this.registerCollision(n,i);this.clearCollisions()}}})},6769:(e,t,n)=>{var i=n(1876).registerSystem,r=n(7427),s=n(9437),o=(0,r.debug)("components:renderer:warn");function a(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z-t.z}function l(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder-t.renderOrder}function c(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:t.z-e.z}e.exports.System=i("renderer",{schema:{antialias:{default:"auto",oneOf:["true","false","auto"]},highRefreshRate:{default:r.device.isOculusBrowser()},logarithmicDepthBuffer:{default:"auto",oneOf:["true","false","auto"]},maxCanvasWidth:{default:-1},maxCanvasHeight:{default:-1},multiviewStereo:{default:!1},exposure:{default:1,if:{toneMapping:["ACESFilmic","linear","reinhard","cineon","AgX","neutral"]}},toneMapping:{default:"no",oneOf:["no","ACESFilmic","linear","reinhard","cineon","AgX","neutral"]},precision:{default:"high",oneOf:["high","medium","low"]},anisotropy:{default:1},sortTransparentObjects:{default:!1},colorManagement:{default:!0},alpha:{default:!0},stencil:{default:!1},foveationLevel:{default:1}},init:function(){var e=this.data,t=this.el,n=this.data.toneMapping.charAt(0).toUpperCase()+this.data.toneMapping.slice(1),i=t.renderer;i.toneMapping=s[n+"ToneMapping"],s.Texture.DEFAULT_ANISOTROPY=e.anisotropy,s.ColorManagement.enabled=e.colorManagement,i.outputColorSpace=e.colorManagement?s.SRGBColorSpace:s.LinearSRGBColorSpace,t.hasAttribute("antialias")&&o('Component `antialias` is deprecated. Use `renderer="antialias: true"` instead.'),t.hasAttribute("logarithmicDepthBuffer")&&o('Component `logarithmicDepthBuffer` is deprecated. Use `renderer="logarithmicDepthBuffer: true"` instead.'),i.sortObjects=!0,i.setOpaqueSort(a)},update:function(){var e=this.data,t=this.el.renderer,n=this.data.toneMapping.charAt(0).toUpperCase()+this.data.toneMapping.slice(1);t.toneMapping=s[n+"ToneMapping"],t.toneMappingExposure=e.exposure,t.xr.setFoveation(e.foveationLevel),e.sortObjects&&o('`sortObjects` property is deprecated. Use `renderer="sortTransparentObjects: true"` instead.'),e.sortTransparentObjects?t.setTransparentSort(c):t.setTransparentSort(l)},applyColorCorrection:function(e){this.data.colorManagement&&e&&e.isTexture&&e.colorSpace!==s.SRGBColorSpace&&(e.colorSpace=s.SRGBColorSpace,e.needsUpdate=!0)},setWebXRFrameRate:function(e){var t,n=this.data,i=e.supportedFrameRates;i&&e.updateTargetFrameRate&&(t=i.includes(90)?n.highRefreshRate?90:72:n.highRefreshRate?72:60,e.updateTargetFrameRate(t).catch((function(e){console.warn("failed to set target frame rate of "+t+". Error info: "+e)})))}}),e.exports.sortFrontToBack=a,e.exports.sortRenderOrderOnly=l,e.exports.sortBackToFront=c},5426:(e,t,n)=>{var i=n(1876).registerSystem,r=n(9437),s={basic:r.BasicShadowMap,pcf:r.PCFShadowMap,pcfsoft:r.PCFSoftShadowMap};e.exports.System=i("shadow",{schema:{enabled:{default:!0},autoUpdate:{default:!0},type:{default:"pcf",oneOf:["basic","pcf","pcfsoft"]}},init:function(){var e=this.sceneEl,t=this.data;this.shadowMapEnabled=!1,e.renderer.shadowMap.type=s[t.type],e.renderer.shadowMap.autoUpdate=t.autoUpdate},update:function(e){e.enabled!==this.data.enabled&&this.setShadowMapEnabled(this.shadowMapEnabled)},setShadowMapEnabled:function(e){var t=this.sceneEl,n=this.sceneEl.renderer;this.shadowMapEnabled=e;var i=this.data.enabled&&this.shadowMapEnabled;n&&i!==n.shadowMap.enabled&&(n.shadowMap.enabled=i,function(e){e.hasLoaded&&e.object3D.traverse((function(e){if(e.material)for(var t=Array.isArray(e.material)?e.material:[e.material],n=0;n<t.length;n++)t[n].needsUpdate=!0}))}(t))}})},2941:(e,t,n)=>{var i=n(1876).registerSystem;n(7427),e.exports.System=i("tracked-controls",{init:function(){this.controllers=[],this.onInputSourcesChange=this.onInputSourcesChange.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.el.addEventListener("enter-vr",this.onEnterVR),this.onExitVR=this.onExitVR.bind(this),this.el.addEventListener("exit-vr",this.onExitVR)},onEnterVR:function(){this.el.xrSession.addEventListener("inputsourceschange",this.onInputSourcesChange)},onExitVR:function(){this.referenceSpace=void 0,this.controllers=[],this.el.emit("controllersupdated",void 0,!1)},onInputSourcesChange:function(){var e=this,t=this.el.xrSession,n=this.el.sceneEl.systems.webxr.sessionReferenceSpaceType;t.requestReferenceSpace(n).then((function(t){e.referenceSpace=t})).catch((function(t){throw e.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(n,'tracked-controls uses reference space "'+n+'".'),t})),this.controllers=t.inputSources,this.el.emit("controllersupdated",void 0,!1)}})},6696:(e,t,n)=>{var i=n(1876).registerSystem,r=n(7427).debug("systems:webxr:warn");e.exports.System=i("webxr",{schema:{referenceSpaceType:{type:"string",default:"local-floor"},requiredFeatures:{type:"array",default:["local-floor"]},optionalFeatures:{type:"array",default:["bounded-floor"]},overlayElement:{type:"selector"}},update:function(){var e=this.data;this.sessionConfiguration={requiredFeatures:e.requiredFeatures,optionalFeatures:e.optionalFeatures},this.sessionReferenceSpaceType=e.referenceSpaceType,e.overlayElement&&(e.overlayElement.classList.remove("a-dom-overlay"),e.optionalFeatures.includes("dom-overlay")||(e.optionalFeatures.push("dom-overlay"),this.el.setAttribute("webxr",e)),this.warnIfFeatureNotRequested("dom-overlay"),this.sessionConfiguration.domOverlay={root:e.overlayElement},e.overlayElement.classList.add("a-dom-overlay"))},wasFeatureRequested:function(e){return"viewer"===e||"local"===e||!(!this.sessionConfiguration.requiredFeatures.includes(e)&&!this.sessionConfiguration.optionalFeatures.includes(e))},warnIfFeatureNotRequested:function(e,t){this.wasFeatureRequested(e)||r((t?t+" ":"")+'Please add the feature "'+e+"\" to a-scene's webxr system options in requiredFeatures/optionalFeatures.")}})},676:(e,t,n)=>{var i=n(8940)("utils:coordinates:warn"),r=["x","y","z","w"],s=/^\s*((-?\d*\.{0,1}\d+(e-?\d+)?)\s+){2,3}(-?\d*\.{0,1}\d+(e-?\d+)?)\s*$/;e.exports.regex=s;var o=/\s+/g;function a(e){return s.test(e)}function l(e){return null!=e&&e.constructor===String?parseFloat(e,10):e}e.exports.parse=function(e,t,n){var i,s,a,c,h,d,u,p,A=n&&"object"==typeof n?n:{};if(e&&e instanceof Object)return h=void 0===e.x?t&&t.x:e.x,d=void 0===e.y?t&&t.y:e.y,u=void 0===e.z?t&&t.z:e.z,p=void 0===e.w?t&&t.w:e.w,null!=h&&(A.x=l(h)),null!=d&&(A.y=l(d)),null!=u&&(A.z=l(u)),null!=p&&(A.w=l(p)),A;if(null==e)return"object"==typeof t?Object.assign(A,t):t;for(i=e.trim().split(o),c=0;c<r.length;c++)if(a=r[c],i[c])A[a]=parseFloat(i[c],10);else{if(void 0===(s=t&&t[a]))continue;A[a]=l(s)}return A},e.exports.stringify=function(e){var t;return"object"!=typeof e?e:(t=e.x+" "+e.y,null!=e.z&&(t+=" "+e.z),null!=e.w&&(t+=" "+e.w),t)},e.exports.equals=function(e,t){return"object"!=typeof e||"object"!=typeof t?e===t:e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},e.exports.isCoordinates=a,e.exports.isCoordinate=function(e){return i("`AFRAME.utils.isCoordinate` has been renamed to `AFRAME.utils.isCoordinates`"),a(e)},e.exports.toVector3=function(e){return new THREE.Vector3(e.x,e.y,e.z)}},8940:(e,t,n)=>{var i=n(8878),r=n(9485).isBrowserEnvironment,s={colors:{debug:"gray",error:"red",info:"gray",warn:"orange"}};i.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" "),this.useColors){var t;this.color=(t=function(e){var t=e.split(":");return t[t.length-1]}(this.namespace),s.colors&&s.colors[t]||null);var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,r=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(r=i))})),e.splice(r,0,n)}};var o=function(){try{return window.localStorage}catch(e){}}();o&&(parseInt(o.logs,10)||"true"===o.logs)?i.enable("*"):i.enable("*:error,*:info,*:warn"),r&&(window.logs=i),e.exports=i},9485:(e,t,n)=>{var i=n(8878)("device:error"),r=!1,s=!1,o=e.exports.isWebXRAvailable=void 0!==navigator.xr;if(o){var a=function(){var e=document.querySelector("a-scene");e?e.hasLoaded?e.components["xr-mode-ui"].updateEnterInterfaces():e.addEventListener("loaded",a):window.addEventListener("DOMContentLoaded",a)},l=function(e){i("WebXR session support error: "+e.message)};navigator.xr.isSessionSupported?(navigator.xr.isSessionSupported("immersive-vr").then((function(e){r=e,a()})).catch(l),navigator.xr.isSessionSupported("immersive-ar").then((function(e){s=e,a()})).catch((function(){}))):navigator.xr.supportsSession?(navigator.xr.supportsSession("immersive-vr").then((function(){r=!0,a()})).catch(l),navigator.xr.supportsSession("immersive-ar").then((function(){s=!0,a()})).catch((function(){}))):i("WebXR has neither isSessionSupported or supportsSession?!")}e.exports.checkHeadsetConnected=function(){return r||s},e.exports.checkARSupport=function(){return s},e.exports.checkVRSupport=function(){return r};var c,h,d=(h=!1,c=window.navigator.userAgent||window.navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(c)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(c.substr(0,4)))&&(h=!0),(f()||u()||y())&&(h=!0),v()&&(h=!1),function(){return h});function u(e){var t=e||window.navigator.userAgent;return/Nexus (7|9)|xoom|sch-i800|playbook|tablet|kindle/i.test(t)||p()}function p(e,t,n){var i=e||window.navigator.userAgent,r=t||window.navigator.platform,s=n||window.navigator.maxTouchPoints||0;return("iPad"===r||"MacIntel"===r)&&s>0&&/Macintosh|Intel|iPad|ipad/i.test(i)&&!window.MSStream}function A(){var e=navigator.userAgent.includes("Macintosh"),t=5===navigator.maxTouchPoints;return e&&t&&o}function f(){return/iPad|iPhone|iPod/.test(window.navigator.platform)}function m(){return/(OculusBrowser)/i.test(window.navigator.userAgent)}function g(){return/(Mobile VR)/i.test(window.navigator.userAgent)}function v(){return m()||g()||A()}function y(){return/R7 Build/.test(window.navigator.userAgent)}e.exports.isMobile=d,e.exports.isTablet=u,e.exports.isIpad=p,e.exports.isAppleVisionPro=A,e.exports.isIOS=f,e.exports.isMobileDeviceRequestingDesktopSite=function(){return!d()&&!v()&&void 0!==window.orientation},e.exports.isOculusBrowser=m,e.exports.isFirefoxReality=g,e.exports.isMobileVR=v,e.exports.isR7=y,e.exports.isLandscape=function(){var e=window.orientation;return y()&&(e+=90),90===e||-90===e},e.exports.isBrowserEnvironment="undefined"==typeof process||!0===process.browser,e.exports.isNodeEnvironment=!e.exports.isBrowserEnvironment},7264:(e,t,n)=>{var i=n(8183).split;function r(e,t){var n=i(e,t=t||".");return 1===n.length?n[0]:n}e.exports.getComponentPropertyPath=r,e.exports.getComponentProperty=function(e,t,n){var i;return n=n||".",-1!==t.indexOf(n)?(i=r(t,n)).constructor===String?e.getAttribute(i):e.getAttribute(i[0])[i[1]]:e.getAttribute(t)},e.exports.setComponentProperty=function(e,t,n,i){var s;i=i||".",-1===t.indexOf(i)?e.setAttribute(t,n):(s=r(t,i)).constructor===String?e.setAttribute(s,n):e.setAttribute(s[0],s[1],n)}},9202:e=>{e.exports=function(e){var t=e.style.width,n=e.style.height;e.style.width=parseInt(t,10)+1+"px",e.style.height=parseInt(n,10)+1+"px",setTimeout((function(){e.style.width=t,e.style.height=n}),200)}},7427:(e,t,n)=>{var i=n(8940),r=n(1124),s=n(9485),o=n(1451),a=i("utils:warn");e.exports.bind=function(e){return e.bind.apply(e,Array.prototype.slice.call(arguments,1))},e.exports.coordinates=n(676),e.exports.debug=i,e.exports.device=s,e.exports.entity=n(7264),e.exports.forceCanvasResizeSafariMobile=n(9202),e.exports.material=n(8066),e.exports.objectPool=o,e.exports.split=n(8183).split,e.exports.styleParser=n(3845),e.exports.trackedControls=n(7960),e.exports.checkHeadsetConnected=function(){return a("`utils.checkHeadsetConnected` has moved to `utils.device.checkHeadsetConnected`"),s.checkHeadsetConnected(arguments)},e.exports.isGearVR=e.exports.device.isGearVR=function(){a("`utils.isGearVR` has been deprecated, use `utils.device.isMobileVR`")},e.exports.isIOS=function(){return a("`utils.isIOS` has moved to `utils.device.isIOS`"),s.isIOS(arguments)},e.exports.isOculusGo=e.exports.device.isOculusGo=function(){a("`utils.isOculusGo` has been deprecated, use `utils.device.isMobileVR`")},e.exports.isMobile=function(){return a("`utils.isMobile has moved to `utils.device.isMobile`"),s.isMobile(arguments)},e.exports.throttle=function(e,t,n){var i;return n&&(e=e.bind(n)),function(){var n=Date.now();(void 0===i||(void 0===i?t:n-i)>=t)&&(i=n,e.apply(null,arguments))}},e.exports.throttleLeadingAndTrailing=function(e,t,n){var i,r,s;n&&(e=e.bind(n));var o=function(){i=Date.now(),e.apply(this,s),r=void 0};return function(){var n=Date.now(),a=void 0===i?t:n-i;a>=t?(clearTimeout(r),r=void 0,i=n,e.apply(null,arguments)):(r=r||setTimeout(o,t-a),s=arguments)}},e.exports.throttleTick=function(e,t,n){var i;return n&&(e=e.bind(n)),function(n,r){var s=void 0===i?r:n-i;(void 0===i||s>=t)&&(i=n,e(n,s))}},e.exports.debounce=function(e,t,n){var i;return function(){var r=this,s=arguments,o=n&&!i;clearTimeout(i),i=setTimeout((function(){i=null,n||e.apply(r,s)}),t),o&&e.apply(r,s)}},e.exports.extend=Object.assign,e.exports.extendDeep=r,e.exports.clone=function(e){return JSON.parse(JSON.stringify(e))};var l,c,h=(l=o.createPool((function(){return[]})),function(e,t){var n,i,r,s,o,a;if(void 0===e||void 0===t||null===e||null===t||!(e&&t&&e.constructor===Object&&t.constructor===Object||e.constructor===Array&&t.constructor===Array))return e===t;for(n in i=l.use(),r=l.use(),i.length=0,r.length=0,e)i.push(n);for(n in t)r.push(n);if(i.length!==r.length)return l.recycle(i),l.recycle(r),!1;for(s=0;s<i.length;++s)if(o=e[i[s]],a=t[i[s]],"object"==typeof o||"object"==typeof a||Array.isArray(o)&&Array.isArray(a)){if(o===a)continue;if(!h(o,a))return l.recycle(i),l.recycle(r),!1}else if(o!==a)return l.recycle(i),l.recycle(r),!1;return l.recycle(i),l.recycle(r),!0});e.exports.deepEqual=h,e.exports.diff=(c=[],function(e,t,n){var i,r,s,o,a,l,d;for(a in o=n||{},c.length=0,e)c.push(a);if(!t)return o;for(s in t)-1===c.indexOf(s)&&c.push(s);for(l=0;l<c.length;l++)i=e[a=c[l]],r=t[a],((d=i&&r&&i.constructor===Object&&r.constructor===Object)&&!h(i,r)||!d&&i!==r)&&(o[a]=r);return o}),e.exports.shouldCaptureKeyEvent=function(e){return!e.metaKey&&document.activeElement===document.body},e.exports.splitString=function(e,t){void 0===t&&(t=" ");var n=new RegExp(t,"g");return(e=(e||"").replace(n,t)).split(t)},e.exports.getElData=function(e,t){t=t||{};var n={};return Object.keys(t).forEach((function(t){e.hasAttribute(t)&&(n[t]=e.getAttribute(t))})),n},e.exports.getUrlParameter=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},e.exports.isIframed=function(){return window.top!==window.self},e.exports.findAllScenes=function(e){for(var t=[],n=e.getElementsByTagName("*"),i=0,r=n.length;i<r;i++)n[i].isScene&&t.push(n[i]);return t},e.exports.srcLoader=n(1857)},1957:()=>{window.addEventListener("orientationchange",(function(){document.documentElement.style.height="initial",setTimeout((function(){document.documentElement.style.height="100%",setTimeout((function(){window.scrollTo(0,1)}),500)}),500)}))},8066:(e,t,n)=>{var i=n(9437),r=n(1857),s=n(8940)("utils:material:warn"),o=new Set(["emissiveMap","envMap","map","specularMap"]);function a(e,t){var n=t.offset||{x:0,y:0},r=t.repeat||{x:1,y:1},s=t.npot||!1,o=t.anisotropy||i.Texture.DEFAULT_ANISOTROPY,a=e.wrapS,l=e.wrapT,c=e.magFilter,h=e.minFilter;s&&(a=i.ClampToEdgeWrapping,l=i.ClampToEdgeWrapping,c=i.LinearFilter,h=i.LinearFilter),1===r.x&&1===r.y||(a=i.RepeatWrapping,l=i.RepeatWrapping),e.offset.set(n.x,n.y),e.repeat.set(r.x,r.y),e.wrapS===a&&e.wrapT===l&&e.magFilter===c&&e.minFilter===h&&e.anisotropy===o||(e.wrapS=a,e.wrapT=l,e.magFilter=c,e.minFilter=h,e.anisotropy=o,e.needsUpdate=!0)}e.exports.setTextureProperties=a,e.exports.updateMapMaterialFromData=function(e,t,n,r){var s=n.el,l=n.material,u=s.sceneEl.systems.renderer,p=r[t];if(n.materialSrcs||(n.materialSrcs={}),!p)return delete n.materialSrcs[e],void A(null);function A(t){l[e]!==t&&(l[e]&&l[e].dispose(),l[e]=t,l.needsUpdate=!0,c(s,t))}p===n.materialSrcs[e]&&l[e]?a(l[e],r):(n.materialSrcs[e]=p,p instanceof i.Texture?A(p):s.sceneEl.systems.material.loadTextureSource(p,(function(t){if(n.materialSrcs[e]===p){var i=l[e];!i||null!==t&&h(i,t)||(i=null),!i&&t&&(i=d(t)),i&&(i.source!==t&&(i.source=t,i.needsUpdate=!0),o.has(e)&&u.applyColorCorrection(i),a(i,r)),A(i)}})))},e.exports.updateMap=function(t,n){return e.exports.updateMapMaterialFromData("map","src",t,n)},e.exports.updateDistortionMap=function(t,n,i){var r=t;"ambientOcclusion"===t&&(r="ao");var s={};return s.src=i[t+"Map"],s.offset=i[t+"TextureOffset"],s.repeat=i[t+"TextureRepeat"],s.wrap=i[t+"TextureWrap"],e.exports.updateMapMaterialFromData(r+"Map","src",n,s)};var l={};function c(e,t){function n(){e.emit("materialvideoloadeddata",{src:t.image,texture:t})}function i(){e.emit("materialvideoended",{src:t.image,texture:t})}t&&(e.emit("materialtextureloaded",{src:t.image,texture:t}),t.image&&"VIDEO"===t.image.tagName&&(t.image.addEventListener("loadeddata",n),t.image.addEventListener("ended",i),t.addEventListener("dispose",(function(){t.image.removeEventListener("loadeddata",n),t.image.removeEventListener("ended",i)}))))}function h(e,t){return e.source===t&&(t.data instanceof HTMLCanvasElement?e.isCanvasTexture:t.data instanceof HTMLVideoElement?e.isVideoTexture:e.isTexture&&!e.isCanvasTexture&&!e.isVideoTexture)}function d(e){var t;return(t=e.data instanceof HTMLCanvasElement?new i.CanvasTexture:e.data instanceof HTMLVideoElement?new i.VideoTexture(e.data):new i.Texture).source=e,t.needsUpdate=!0,t}e.exports.updateEnvMap=function(e,t){var n=e.material,o=e.el,a="envMap",h=t.envMap,d=t.sphericalEnvMap,u=t.refract;if(d&&(h=d,s("`sphericalEnvMap` property is deprecated, using spherical map as equirectangular map instead. Use `envMap` property with a CubeMap or Equirectangular image instead.")),e.materialSrcs||(e.materialSrcs={}),!h)return delete e.materialSrcs[a],n.envMap=null,void(n.needsUpdate=!0);function p(t){e.materialSrcs[a]===h&&(n.envMap=t,n.needsUpdate=!0,c(o,t))}e.materialSrcs[a]=h,l[h]?l[h].then(p):l[h]=new Promise((function(e){r.validateEnvMapSrc(h,(function(t){o.sceneEl.systems.material.loadCubeMapTexture(t,(function(t){t.mapping=u?i.CubeRefractionMapping:i.CubeReflectionMapping,p(t),e(t)}))}),(function(t){o.sceneEl.systems.material.loadTexture(t,{src:t},(function(t){t.mapping=u?i.EquirectangularRefractionMapping:i.EquirectangularReflectionMapping,p(t),e(t)}))}))}))},e.exports.handleTextureEvents=c,e.exports.isCompatibleTexture=h,e.exports.createCompatibleTexture=d},3657:e=>{function t(e,t,n){return(t.dot(e)-t.dot(n))/t.length()}e.exports.distanceOfPointFromPlane=t,e.exports.nearestPointInPlane=function(e,n,i,r){var s=t(e,n,i);return r.copy(n),r.multiplyScalar(s),r.add(i),r}},1451:e=>{var t=Object.freeze(Object.create(null));function n(){return{}}function i(e){var t;if(e&&e.constructor===Object)for(t in e)e[t]=void 0}e.exports.createPool=function(e){var r=[],s=null;function o(t){var n,i;if((t=void 0===t?r.length:t)>0&&null==s&&(s=0),t>0)for(n=r.length,r.length+=Number(t),i=n;i<r.length;i++)r[i]=e();return r.length}return e=e||n,{grow:o,pool:r,recycle:function(e){e instanceof Object&&(null!==s&&-1!==s?r[--s]=e:r[r.length]=e)},size:function(){return r.length},use:function(){var e;return null!==s&&s!==r.length||o(r.length||5),e=r[s],r[s++]=t,i(e),e}}},e.exports.clearObject=i,e.exports.removeUnusedKeys=function(e,t){var n;if(e&&e.constructor===Object)for(n in e)n in t||delete e[n]}},8183:e=>{var t;e.exports.split=(t={},function(e,n){return n in t||(t[n]={}),e in t[n]||(t[n][e]=e.split(n)),t[n][e]})},1857:(e,t,n)=>{var i=n(8940)("utils:src-loader:warn");function r(e,t,n){!function(e,t){var n;e.tagName?t("IMG"===e.tagName):((n=new XMLHttpRequest).open("HEAD",e),n.addEventListener("load",(function(i){var r;n.status>=200&&n.status<300?null==(r=n.getResponseHeader("Content-Type"))?a(e,t):r.startsWith("image")?t(!0):t(!1):a(e,t),n.abort()})),n.send())}(e,(function(i){i?t(e):n(e)}))}function s(e,t,n){var s,a,l,c="",h=[];if("string"==typeof e){for(a=0;a<5;a++)c+="(url\\((?:[^\\)]+)\\),\\s*)";function d(e){h.push(e),6===h.length&&t(h)}if(c+="(url\\((?:[^\\)]+)\\)\\s*)",l=e.match(new RegExp(c))){for(a=1;a<7;a++)r(o(l[a]),d);return}if(!e.startsWith("#"))return void r(o(e)||e,n)}if(s=e.tagName?e:function(e){try{var t=document.querySelector(e);return t||i('No element was found matching the selector: "%s"',e),t}catch(t){return void i('"%s" is not a valid selector',e)}}(e))return"A-CUBEMAP"===s.tagName&&s.srcs?t(s.srcs):"IMG"===s.tagName?n(s):void i('Selector "%s" does not point to <a-cubemap> or <img>',e)}function o(e){var t=e.match(/url\((.+)\)/);if(t)return t[1]}function a(e,t){var n=new Image;n.addEventListener("load",(function(){t(!0)})),n.addEventListener("error",(function(){t(!1)})),n.src=e}e.exports={parseUrl:o,validateSrc:r,validateCubemapSrc:function(e,t){return s(e,t,(function(){i("Expected cubemap but got image")}))},validateEnvMapSrc:s}},3845:e=>{var t=/-([a-z])/g;function n(e){return e.replace(t,o)}e.exports.parse=function(e,t){var i;return"string"!=typeof e?e:(i=function(e,t){var i,r,o,a,l,c;for(t=t||{},i=s(e),r=0;r<i.length;r++)(o=i[r])&&(a=o.indexOf(":"),l=o.substr(0,a).trim(),c=o.substr(a+1).trim(),t[n(l)]=c);return t}(e,t),i[""]?e:i)},e.exports.stringify=function(e){return"string"==typeof e?e:function(e){var t,n=0,i=0,r="";for(t in e)n++;for(t in e)r+=t+": "+e[t],i<n-1&&(r+="; "),i++;return r}(e)},e.exports.toCamelCase=n;var i,r,s=(i=[],r=/url\([^)]+$/,function(e){var t,n="",s=0;for(i.length=0;s<e.length;)-1===(t=e.indexOf(";",s))&&(t=e.length),n+=e.substring(s,t),r.test(n)?(n+=";",s=t+1):(i.push(n.trim()),n="",s=t+1);return i});function o(e){return e[1].toUpperCase()}},7960:e=>{var t=["x","y","z","w"];function n(e,t,n){var r,s=e.el.sceneEl,o=s&&s.systems["tracked-controls"];return!!o&&!(!(r=o.controllers)||!r.length)&&i(r,t,n.hand,n.index,n.iterateControllerProfiles,n.handTracking)}function i(e,t,n,i,r,s){var o,a,l,c,h=!1;for(o=0;o<e.length;o++){if(c=(l=e[o]).profiles,s)h=l.hand;else if(r)for(a=0;a<c.length&&!(h=c[a].startsWith(t));a++);else h=c.length>0&&c[0].startsWith(t);if(h)if("right"===l.handedness||"left"===l.handedness){if(l.handedness===n)return e[o]}else if(o===i)return e[o]}}e.exports.checkControllerPresentAndSetup=function(e,t,i){var r,s,o=e.el;if((s=!!(r=n(e,t,i)))===e.controllerPresent)return s;e.controllerPresent=s,s?(e.addEventListeners(),e.injectTrackedControls(r),o.emit("controllerconnected",{name:e.name,component:e})):(e.removeEventListeners(),o.emit("controllerdisconnected",{name:e.name,component:e}))},e.exports.isControllerPresentWebXR=n,e.exports.findMatchingControllerWebXR=i,e.exports.emitIfAxesChanged=function(e,n,i){var r,s,o,a,l;for(s in n){for(r=n[s],o=!1,l=0;l<r.length;l++)i.detail.changed[r[l]]&&(o=!0);if(o){for(a={},l=0;l<r.length;l++)a[t[l]]=i.detail.axis[r[l]];e.el.emit(s+"moved",a)}}},e.exports.onButtonEvent=function(e,t,n,i){var r=(i?n.mapping[i]:n.mapping).buttons[e];n.el.emit(r+t),n.updateModel&&n.updateModel(r,t)}},7469:()=>{THREE.DeviceOrientationControls=function(e){var t=this;this.object=e,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0,this.alphaOffset=0;var n,i,r,s,o=function(e){t.deviceOrientation=e},a=function(){t.screenOrientation=window.orientation||0},l=(n=new THREE.Vector3(0,0,1),i=new THREE.Euler,r=new THREE.Quaternion,s=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),function(e,t,o,a,l){i.set(o,t,-a,"YXZ"),e.setFromEuler(i),e.multiply(s),e.multiply(r.setFromAxisAngle(n,-l))});this.connect=function(){a(),window.addEventListener("orientationchange",a,!1),window.addEventListener("deviceorientation",o,!1),t.enabled=!0},this.disconnect=function(){window.removeEventListener("orientationchange",a,!1),window.removeEventListener("deviceorientation",o,!1),t.enabled=!1},this.update=function(){if(!1!==t.enabled){var e=t.deviceOrientation;if(e){var n=e.alpha?THREE.MathUtils.degToRad(e.alpha)+t.alphaOffset:0,i=e.beta?THREE.MathUtils.degToRad(e.beta):0,r=e.gamma?THREE.MathUtils.degToRad(e.gamma):0,s=t.screenOrientation?THREE.MathUtils.degToRad(t.screenOrientation):0;l(t.object.quaternion,n,i,r,s)}}},this.dispose=function(){t.disconnect()},this.connect()}},3729:e=>{window.glStats=function(){var e=null,t=0,n=0,i=0,r=0,s=0,o=0,a=0;function l(e,t){return function(){t.apply(this,arguments),e.apply(this,arguments)}}return WebGLRenderingContext.prototype.drawArrays=l(WebGLRenderingContext.prototype.drawArrays,(function(){t++,arguments[0]==this.POINTS?o+=arguments[2]:s+=arguments[2]})),WebGLRenderingContext.prototype.drawElements=l(WebGLRenderingContext.prototype.drawElements,(function(){n++,r+=arguments[1]/3,s+=arguments[1]})),WebGLRenderingContext.prototype.useProgram=l(WebGLRenderingContext.prototype.useProgram,(function(){i++})),WebGLRenderingContext.prototype.bindTexture=l(WebGLRenderingContext.prototype.bindTexture,(function(){a++})),{update:function(){e("allcalls").set(t+n),e("drawElements").set(n),e("drawArrays").set(t),e("bindTexture").set(a),e("useProgram").set(i),e("glfaces").set(r),e("glvertices").set(s),e("glpoints").set(o)},start:function(){t=0,n=0,i=0,r=0,s=0,o=0,a=0},end:function(){},attach:function(t){e=t},values:{allcalls:{over:3e3,caption:"Calls (hook)"},drawelements:{caption:"drawElements (hook)"},drawarrays:{caption:"drawArrays (hook)"}},groups:[{caption:"WebGL",values:["allcalls","drawelements","drawarrays","useprogram","bindtexture","glfaces","glvertices","glpoints"]}],fractions:[{base:"allcalls",steps:["drawelements","drawarrays"]}]}},window.threeStats=function(e){var t=null;return{update:function(){t("renderer.info.memory.geometries").set(e.info.memory.geometries),t("renderer.info.programs").set(e.info.programs.length),t("renderer.info.memory.textures").set(e.info.memory.textures),t("renderer.info.render.calls").set(e.info.render.calls),t("renderer.info.render.triangles").set(e.info.render.triangles),t("renderer.info.render.points").set(e.info.render.points)},start:function(){},end:function(){},attach:function(e){t=e},values:{"renderer.info.memory.geometries":{caption:"Geometries"},"renderer.info.memory.textures":{caption:"Textures"},"renderer.info.programs":{caption:"Programs"},"renderer.info.render.calls":{caption:"Calls"},"renderer.info.render.triangles":{caption:"Triangles",over:1e3},"renderer.info.render.points":{caption:"Points"}},groups:[{caption:"Three.js - Memory",values:["renderer.info.memory.geometries","renderer.info.programs","renderer.info.memory.textures"]},{caption:"Three.js - Render",values:["renderer.info.render.calls","renderer.info.render.triangles","renderer.info.render.points"]}],fractions:[]}},window.BrowserStats=function(){var e=null,t=0,n=0;window.performance&&!performance.memory&&(performance.memory={usedJSHeapSize:0,totalJSHeapSize:0}),0===performance.memory.totalJSHeapSize&&console.warn("totalJSHeapSize === 0... performance.memory is only available in Chrome .");var i=Math.log(1024);function r(e){var t=Math.floor(Math.log(e)/i);return Math.round(100*e/Math.pow(1024,t))/100}return{update:function(){t=r(performance.memory.usedJSHeapSize),n=r(performance.memory.totalJSHeapSize),e("memory").set(t),e("total").set(n)},start:function(){t=0},end:function(){},attach:function(t){e=t},values:{memory:{caption:"Used Memory",average:!0,avgMs:1e3,over:22},total:{caption:"Total Memory"}},groups:[{caption:"Browser",values:["memory","total"]}],fractions:[{base:"total",steps:["memory"]}]}},e.exports={glStats:window.glStats,threeStats:window.threeStats,BrowserStats:window.BrowserStats}},282:e=>{"use strict";!function(){"performance"in window==0&&(window.performance={});var e=window.performance;if("now"in e==0){var t=Date.now();e.timing&&e.timing.navigationStart&&(t=e.timing.navigationStart),e.now=function(){return Date.now()-t}}e.mark||(e.mark=function(){}),e.measure||(e.measure=function(){})}(),window.rStats=function(e){function t(e,t){for(var n=Object.keys(e),i=0,r=n.length;i<r;i++)t(n[i])}var n=e||{},i=n.colours||["#850700","#c74900","#fcb300","#284280","#4c7c0c"],r=(n.CSSPath?n.CSSPath:"")+"rStats.css";(n.css||["https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300",r]).forEach((function(e){var t,n;t=e,(n=document.createElement("link")).href=t,n.rel="stylesheet",n.type="text/css",document.getElementsByTagName("head")[0].appendChild(n)})),n.values||(n.values={});var s,o,a=10,l={};function c(e,t,n){var i=n||{},r=document.createElement("canvas"),s=r.getContext("2d"),o=0,l=0,c=i.color?i.color:"#666666",h=document.createElement("canvas"),d=h.getContext("2d");h.width=1,h.height=20,d.fillStyle="#444444",d.fillRect(0,0,1,20),d.fillStyle=c,d.fillRect(0,a,1,a),d.fillStyle="#ffffff",d.globalAlpha=.5,d.fillRect(0,a,1,1),d.globalAlpha=1;var u=document.createElement("canvas"),p=u.getContext("2d");return u.width=1,u.height=20,p.fillStyle="#444444",p.fillRect(0,0,1,20),p.fillStyle="#b70000",p.fillRect(0,a,1,a),p.globalAlpha=.5,p.fillStyle="#ffffff",p.fillRect(0,a,1,1),p.globalAlpha=1,r.width=200,r.height=a,r.style.width=r.width+"px",r.style.height=r.height+"px",r.className="rs-canvas",e.appendChild(r),s.fillStyle="#444444",s.fillRect(0,0,r.width,r.height),{draw:function(e,t){(l+=.1*(e-l))>(o*=.99)&&(o=l),s.drawImage(r,1,0,r.width-1,r.height,0,0,r.width-1,r.height),t?s.drawImage(u,r.width-1,r.height-l*r.height/o-a):s.drawImage(h,r.width-1,r.height-l*r.height/o-a)}}}function h(e,n){var r=document.createElement("canvas"),s=r.getContext("2d");return r.width=200,r.height=a*n,r.style.width=r.width+"px",r.style.height=r.height+"px",r.className="rs-canvas",e.appendChild(r),s.fillStyle="#444444",s.fillRect(0,0,r.width,r.height),{draw:function(e){s.drawImage(r,1,0,r.width-1,r.height,0,0,r.width-1,r.height);var n=0;t(e,(function(t){var o=e[t]*r.height;s.fillStyle=i[t],s.fillRect(r.width-1,n,1,o),n+=o}))}}}function d(e,t){var i,r=e,s=0,a=0,l=0,h=0,d=performance.now(),u=0,p=document.createElement("div"),A=document.createElement("span"),f=document.createElement("div"),m=document.createTextNode(""),g=n?n.values[r.toLowerCase()]:null,v=new c(p,r,g),y=!1;function E(e){if(g&&g.average){h+=e,u++;var t=performance.now();t-d>=(g.avgMs||1e3)&&(l=h/u,h=0,d=t,u=0)}}function x(){i=performance.now(),n.userTimingAPI&&performance.mark(r+"-start"),y=!0}function b(){s=performance.now()-i,n.userTimingAPI&&(performance.mark(r+"-end"),y&&performance.measure(r,r+"-start",r+"-end")),E(s)}return A.className="rs-counter-id",A.textContent=g&&g.caption?g.caption:r,f.className="rs-counter-value",f.appendChild(m),p.appendChild(A),p.appendChild(f),t?t.div.appendChild(p):o.appendChild(p),i=performance.now(),{set:function(e){E(s=e)},start:x,tick:function(){b(),x()},end:b,frame:function(){var e=performance.now(),t=e-i;a++,t>1e3&&(s=g&&!1===g.interpolate?a:1e3*a/t,a=0,i=e,E(s))},value:function(){return s},draw:function(){var e=g&&g.average?l:s;m.nodeValue=Math.round(100*e)/100;var t=g&&(g.below&&s<g.below||g.over&&s>g.over);v.draw(s,t),p.className=t?"rs-counter-base alarm":"rs-counter-base"}}}function u(e){var i=e.toLowerCase();if(void 0===i&&(i="default"),l[i])return l[i];var r=null;n&&n.groups&&t(n.groups,(function(e){var t=n.groups[parseInt(e,10)];r||-1===t.values.indexOf(i.toLowerCase())||(r=t)}));var s=new d(i,r);return l[i]=s,s}function p(){t(n.plugins,(function(e){n.plugins[e].update()})),t(l,(function(e){l[e].draw()})),n&&n.fractions&&t(n.fractions,(function(e){var i=n.fractions[parseInt(e,10)],r=[],s=l[i.base.toLowerCase()];s&&(s=s.value(),t(n.fractions[e].steps,(function(t){var i=n.fractions[e].steps[parseInt(t,10)].toLowerCase(),o=l[i];o&&r.push(o.value()/s)}))),i.graph.draw(r)}))}return function(){if(n.plugins){n.values||(n.values={}),n.groups||(n.groups=[]),n.fractions||(n.fractions=[]);for(var e=0;e<n.plugins.length;e++)n.plugins[e].attach(u),t(n.plugins[e].values,(function(t){n.values[t]=n.plugins[e].values[t]})),n.groups=n.groups.concat(n.plugins[e].groups),n.fractions=n.fractions.concat(n.plugins[e].fractions)}else n.plugins={};(s=document.createElement("div")).className="rs-base",(o=document.createElement("div")).className="rs-container",o.style.height="auto",s.appendChild(o),document.body.appendChild(s),n&&(n.groups&&t(n.groups,(function(e){var t=n.groups[parseInt(e,10)],i=document.createElement("div");i.className="rs-group",t.div=i;var r=document.createElement("h1");r.textContent=t.caption,r.addEventListener("click",function(e){this.classList.toggle("hidden"),e.preventDefault()}.bind(i)),o.appendChild(r),o.appendChild(i)})),n.fractions&&t(n.fractions,(function(e){var r=n.fractions[parseInt(e,10)],s=document.createElement("div");s.className="rs-fraction";var l=document.createElement("div");l.className="rs-legend";var c=0;t(n.fractions[e].steps,(function(t){var r=document.createElement("p");r.textContent=n.fractions[e].steps[t],r.style.color=i[c],l.appendChild(r),c++})),s.appendChild(l),s.style.height=c*a+"px",r.div=s;var d=new h(s,c);r.graph=d,o.appendChild(s)})))}(),function(e){return e?u(e):{element:s,update:p}}},e.exports=window.rStats},2535:e=>{var t={base64:function(e,t){return"data:"+e+";base64,"+t},isMobile:function(){var e,t=!1;return e=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0),t},isIOS:function(){return/(iPad|iPhone|iPod)/g.test(navigator.userAgent)},isIFrame:function(){try{return window.self!==window.top}catch(e){return!0}},appendQueryParameter:function(e,t,n){var i=e.indexOf("?")<0?"?":"&";return e+(i+t+"=")+n},getQueryParameter:function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},isLandscapeMode:function(){return 90==window.orientation||-90==window.orientation}};e.exports=t},5928:(e,t,n)=>{var i,r=n(2535);e.exports=(i=navigator.userAgent||navigator.vendor||window.opera).match(/iPhone/i)||i.match(/iPod/i)?function(){var e=null;this.request=function(){e||(e=setInterval((function(){window.location.href="/",setTimeout(window.stop,0)}),15e3))},this.release=function(){e&&(clearInterval(e),e=null)}}:function(){var e=document.createElement("video");e.addEventListener("ended",(function(){e.play()})),this.request=function(){e.paused&&(e.src=r.base64("video/webm","GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4ECQoWBAhhTgGcBAAAAAAAH4xFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsggfG7AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU2LjQwLjEwMVdBjUxhdmY1Ni40MC4xMDFzpJAGSJTMbsLpDt/ySkipgX1fRImIQO1MAAAAAAAWVK5rAQAAAAAAADuuAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDmDgQEj44OEO5rKAOABAAAAAAAABrCBsLqBkB9DtnUBAAAAAAAAo+eBAKOmgQAAgKJJg0IAAV4BHsAHBIODCoAACmH2MAAAZxgz4dPSTFi5JACjloED6ACmAECSnABMQAADYAAAWi0quoCjloEH0ACmAECSnABNwAADYAAAWi0quoCjloELuACmAECSnABNgAADYAAAWi0quoCjloEPoACmAECSnABNYAADYAAAWi0quoCjloETiACmAECSnABNIAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTnghdwo5aBAAAApgBAkpwATOAAA2AAAFotKrqAo5aBA+gApgBAkpwATMAAA2AAAFotKrqAo5aBB9AApgBAkpwATIAAA2AAAFotKrqAo5aBC7gApgBAkpwATEAAA2AAAFotKrqAo5aBD6AApgDAkpwAQ2AAA2AAAFotKrqAo5aBE4gApgBAkpwATCAAA2AAAFotKrqAH0O2dQEAAAAAAACU54Iu4KOWgQAAAKYAQJKcAEvAAANgAABaLSq6gKOWgQPoAKYAQJKcAEtgAANgAABaLSq6gKOWgQfQAKYAQJKcAEsAAANgAABaLSq6gKOWgQu4AKYAQJKcAEqAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEogAANgAABaLSq6gKOWgROIAKYAQJKcAEnAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCRlCjloEAAACmAECSnABJgAADYAAAWi0quoCjloED6ACmAECSnABJIAADYAAAWi0quoCjloEH0ACmAMCSnABDYAADYAAAWi0quoCjloELuACmAECSnABI4AADYAAAWi0quoCjloEPoACmAECSnABIoAADYAAAWi0quoCjloETiACmAECSnABIYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngl3Ao5aBAAAApgBAkpwASCAAA2AAAFotKrqAo5aBA+gApgBAkpwASAAAA2AAAFotKrqAo5aBB9AApgBAkpwAR8AAA2AAAFotKrqAo5aBC7gApgBAkpwAR4AAA2AAAFotKrqAo5aBD6AApgBAkpwAR2AAA2AAAFotKrqAo5aBE4gApgBAkpwARyAAA2AAAFotKrqAH0O2dQEAAAAAAACU54J1MKOWgQAAAKYAwJKcAENgAANgAABaLSq6gKOWgQPoAKYAQJKcAEbgAANgAABaLSq6gKOWgQfQAKYAQJKcAEagAANgAABaLSq6gKOWgQu4AKYAQJKcAEaAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEZAAANgAABaLSq6gKOWgROIAKYAQJKcAEYAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCjKCjloEAAACmAECSnABF4AADYAAAWi0quoCjloED6ACmAECSnABFwAADYAAAWi0quoCjloEH0ACmAECSnABFoAADYAAAWi0quoCjloELuACmAECSnABFgAADYAAAWi0quoCjloEPoACmAMCSnABDYAADYAAAWi0quoCjloETiACmAECSnABFYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngqQQo5aBAAAApgBAkpwARUAAA2AAAFotKrqAo5aBA+gApgBAkpwARSAAA2AAAFotKrqAo5aBB9AApgBAkpwARQAAA2AAAFotKrqAo5aBC7gApgBAkpwARQAAA2AAAFotKrqAo5aBD6AApgBAkpwAROAAA2AAAFotKrqAo5aBE4gApgBAkpwARMAAA2AAAFotKrqAH0O2dQEAAAAAAACU54K7gKOWgQAAAKYAQJKcAESgAANgAABaLSq6gKOWgQPoAKYAQJKcAESAAANgAABaLSq6gKOWgQfQAKYAwJKcAENgAANgAABaLSq6gKOWgQu4AKYAQJKcAERgAANgAABaLSq6gKOWgQ+gAKYAQJKcAERAAANgAABaLSq6gKOWgROIAKYAQJKcAEQgAANgAABaLSq6gB9DtnUBAAAAAAAAlOeC0vCjloEAAACmAECSnABEIAADYAAAWi0quoCjloED6ACmAECSnABEAAADYAAAWi0quoCjloEH0ACmAECSnABD4AADYAAAWi0quoCjloELuACmAECSnABDwAADYAAAWi0quoCjloEPoACmAECSnABDoAADYAAAWi0quoCjloETiACmAECSnABDgAADYAAAWi0quoAcU7trAQAAAAAAABG7j7OBALeK94EB8YIBd/CBAw=="),e.play())},this.release=function(){e.pause(),e.src=""}}},8217:(e,t,n)=>{"use strict";n.d(t,{A:()=>E});var i=n(963),r=n.n(i),s=n(9089),o=n.n(s),a=n(6492),l=n.n(a),c=new URL(n(9169),n.b),h=new URL(n(6085),n.b),d=new URL(n(3931),n.b),u=new URL(n(7889),n.b),p=new URL(n(6517),n.b),A=o()(r()),f=l()(c),m=l()(h),g=l()(d),v=l()(u),y=l()(p);A.push([e.id,`/* .a-fullscreen means not embedded. */\nhtml.a-fullscreen {\n bottom: 0;\n left: 0;\n position: fixed;\n right: 0;\n top: 0;\n}\n\nhtml.a-fullscreen body {\n height: 100%;\n margin: 0;\n overflow: hidden;\n padding: 0;\n width: 100%;\n}\n\n/* Class is removed when doing <a-scene embedded>. */\nhtml.a-fullscreen .a-canvas {\n width: 100% !important;\n height: 100% !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n position: fixed !important;\n}\n\nhtml:not(.a-fullscreen) .a-enter-vr,\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 5px;\n bottom: 5px;\n}\n\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 60px;\n}\n\n/* In chrome mobile the user agent stylesheet set it to white */\n:-webkit-full-screen {\n background-color: transparent;\n}\n\n.a-hidden {\n display: none !important;\n}\n\n.a-canvas {\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.a-canvas.a-grab-cursor:hover {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\ncanvas.a-canvas.a-mouse-cursor-hover:hover {\n cursor: pointer;\n}\n\n.a-inspector-loader {\n background-color: #ed3160;\n position: fixed;\n left: 3px;\n top: 3px;\n padding: 6px 10px;\n color: #fff;\n text-decoration: none;\n font-size: 12px;\n font-family: Roboto,sans-serif;\n text-align: center;\n z-index: 99999;\n width: 204px;\n}\n\n/* Inspector loader animation */\n@keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n@-webkit-keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@-webkit-keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@-webkit-keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n\n.a-inspector-loader .dots span {\n animation: dots-1 2s infinite steps(1);\n -webkit-animation: dots-1 2s infinite steps(1);\n}\n\n.a-inspector-loader .dots span:first-child + span {\n animation-name: dots-2;\n -webkit-animation-name: dots-2;\n}\n\n.a-inspector-loader .dots span:first-child + span + span {\n animation-name: dots-3;\n -webkit-animation-name: dots-3;\n}\n\na-scene {\n display: block;\n position: relative;\n height: 100%;\n width: 100%;\n}\n\na-assets,\na-scene video,\na-scene img,\na-scene audio {\n display: none;\n}\n\n.a-enter-vr-modal,\n.a-orientation-modal {\n font-family: Consolas, Andale Mono, Courier New, monospace;\n}\n\n.a-enter-vr-modal a {\n border-bottom: 1px solid #fff;\n padding: 2px 0;\n text-decoration: none;\n transition: .1s color ease-in;\n}\n\n.a-enter-vr-modal a:hover {\n background-color: #fff;\n color: #111;\n padding: 2px 4px;\n position: relative;\n left: -4px;\n}\n\n.a-enter-vr,\n.a-enter-ar {\n font-family: sans-serif, monospace;\n font-size: 13px;\n width: 100%;\n font-weight: 200;\n line-height: 16px;\n position: absolute;\n right: 20px;\n bottom: 20px;\n}\n\n.a-enter-ar.xr {\n right: 90px;\n}\n\n.a-enter-vr-button,\n.a-enter-vr-modal,\n.a-enter-vr-modal a {\n color: #fff;\n user-select: none;\n outline: none;\n}\n\n.a-enter-vr-button {\n background: rgba(0, 0, 0, 0.35) url(${f}) 50% 50% no-repeat;\n}\n\n.a-enter-ar-button {\n background: rgba(0, 0, 0, 0.20) url(${m}) 50% 50% no-repeat;\n}\n\n.a-enter-vr.fullscreen .a-enter-vr-button {\n background-image: url(${g});\n}\n\n.a-enter-vr-button,\n.a-enter-ar-button {\n background-size: 90% 90%;\n border: 0;\n bottom: 0;\n cursor: pointer;\n min-width: 58px;\n min-height: 34px;\n /* 1.74418604651 */\n /*\n In order to keep the aspect ratio when resizing\n padding-top percentages are relative to the containing block's width.\n http://stackoverflow.com/questions/12121090/responsively-change-div-size-keeping-aspect-ratio\n */\n padding-right: 0;\n padding-top: 0;\n position: absolute;\n right: 0;\n transition: background-color .05s ease;\n -webkit-transition: background-color .05s ease;\n z-index: 9999;\n border-radius: 8px;\n touch-action: manipulation; /* Prevent iOS double tap zoom on the button */\n}\n\n.a-enter-ar-button {\n background-size: 100% 90%;\n border-radius: 7px;\n}\n\n.a-enter-ar-button:active,\n.a-enter-ar-button:hover,\n.a-enter-vr-button:active,\n.a-enter-vr-button:hover {\n background-color: #ef2d5e;\n}\n\n.a-enter-vr-button.resethover {\n background-color: rgba(0, 0, 0, 0.35);\n}\n\n.a-enter-vr-modal {\n background-color: #666;\n border-radius: 0;\n display: none;\n min-height: 32px;\n margin-right: 70px;\n padding: 9px;\n width: 280px;\n right: 2%;\n position: absolute;\n}\n\n.a-enter-vr-modal:after {\n border-bottom: 10px solid transparent;\n border-left: 10px solid #666;\n border-top: 10px solid transparent;\n display: inline-block;\n content: '';\n position: absolute;\n right: -5px;\n top: 5px;\n width: 0;\n height: 0;\n}\n\n.a-enter-vr-modal p,\n.a-enter-vr-modal a {\n display: inline;\n}\n\n.a-enter-vr-modal p {\n margin: 0;\n}\n\n.a-enter-vr-modal p:after {\n content: ' ';\n}\n\n.a-orientation-modal {\n background: rgba(244, 244, 244, 1) url(${v}) center no-repeat;\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-orientation-modal:after {\n color: #666;\n content: "Insert phone into Cardboard holder.";\n display: block;\n position: absolute;\n text-align: center;\n top: 70%;\n transform: translateY(-70%);\n width: 100%;\n}\n\n.a-orientation-modal button {\n background: url(${y}) no-repeat;\n border: none;\n height: 50px;\n text-indent: -9999px;\n width: 50px;\n}\n\n.a-loader-title {\n background-color: rgba(0, 0, 0, 0.6);\n font-family: sans-serif, monospace;\n text-align: center;\n font-size: 20px;\n height: 50px;\n font-weight: 300;\n line-height: 50px;\n position: absolute;\n right: 0px;\n left: 0px;\n top: 0px;\n color: white;\n}\n\n.a-modal {\n position: absolute;\n background: rgba(0, 0, 0, 0.60);\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-dialog {\n position: relative;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n z-index: 199995;\n width: 300px;\n height: 200px;\n background-size: contain;\n background-color: white;\n font-family: sans-serif, monospace;\n font-size: 20px;\n border-radius: 3px;\n padding: 6px;\n}\n\n.a-dialog-text-container {\n width: 100%;\n height: 70%;\n align-self: flex-start;\n display: flex;\n justify-content: center;\n align-content: center;\n flex-direction: column;\n}\n\n.a-dialog-text {\n display: inline-block;\n font-weight: normal;\n font-size: 14pt;\n margin: 8px;\n}\n\n.a-dialog-buttons-container {\n display: inline-flex;\n align-self: flex-end;\n width: 100%;\n height: 30%;\n}\n\n.a-dialog-button {\n cursor: pointer;\n align-self: center;\n opacity: 0.9;\n height: 80%;\n width: 50%;\n font-size: 12pt;\n margin: 4px;\n border-radius: 2px;\n text-align:center;\n border: none;\n display: inline-block;\n -webkit-transition: all 0.25s ease-in-out;\n transition: all 0.25s ease-in-out;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.20);\n user-select: none;\n}\n\n.a-dialog-permission-button:hover {\n box-shadow: 0 7px 14px rgba(0,0,0,0.20), 0 2px 2px rgba(0,0,0,0.20);\n}\n\n.a-dialog-allow-button {\n background-color: #00ceff;\n}\n\n.a-dialog-deny-button {\n background-color: #ff005b;\n}\n\n.a-dialog-ok-button {\n background-color: #00ceff;\n width: 100%;\n}\n\n.a-dom-overlay:not(.a-no-style) {\n overflow: hidden;\n position: absolute;\n pointer-events: none;\n box-sizing: border-box;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n padding: 1em;\n}\n\n.a-dom-overlay:not(.a-no-style)>* {\n pointer-events: auto;\n}\n`,"",{version:3,sources:["webpack://./src/style/aframe.css"],names:[],mappings:"AAAA,sCAAsC;AACtC;EACE,SAAS;EACT,OAAO;EACP,eAAe;EACf,QAAQ;EACR,MAAM;AACR;;AAEA;EACE,YAAY;EACZ,SAAS;EACT,gBAAgB;EAChB,UAAU;EACV,WAAW;AACb;;AAEA,oDAAoD;AACpD;EACE,sBAAsB;EACtB,uBAAuB;EACvB,iBAAiB;EACjB,kBAAkB;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,0BAA0B;AAC5B;;AAEA;;EAEE,UAAU;EACV,WAAW;AACb;;AAEA;EACE,WAAW;AACb;;AAEA,gEAAgE;AAChE;EACE,6BAA6B;AAC/B;;AAEA;EACE,wBAAwB;AAC1B;;AAEA;EACE,YAAY;EACZ,OAAO;EACP,kBAAkB;EAClB,MAAM;EACN,WAAW;AACb;;AAEA;EACE,YAAY;EACZ,iBAAiB;EACjB,oBAAoB;AACtB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,yBAAyB;EACzB,eAAe;EACf,SAAS;EACT,QAAQ;EACR,iBAAiB;EACjB,WAAW;EACX,qBAAqB;EACrB,eAAe;EACf,8BAA8B;EAC9B,kBAAkB;EAClB,cAAc;EACd,YAAY;AACd;;AAEA,+BAA+B;AAC/B,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AACrE,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AACrE,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;;AAErE;EACE,sCAAsC;EACtC,8CAA8C;AAChD;;AAEA;EACE,sBAAsB;EACtB,8BAA8B;AAChC;;AAEA;EACE,sBAAsB;EACtB,8BAA8B;AAChC;;AAEA;EACE,cAAc;EACd,kBAAkB;EAClB,YAAY;EACZ,WAAW;AACb;;AAEA;;;;EAIE,aAAa;AACf;;AAEA;;EAEE,0DAA0D;AAC5D;;AAEA;EACE,6BAA6B;EAC7B,cAAc;EACd,qBAAqB;EACrB,6BAA6B;AAC/B;;AAEA;EACE,sBAAsB;EACtB,WAAW;EACX,gBAAgB;EAChB,kBAAkB;EAClB,UAAU;AACZ;;AAEA;;EAEE,kCAAkC;EAClC,eAAe;EACf,WAAW;EACX,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EAClB,WAAW;EACX,YAAY;AACd;;AAEA;EACE,WAAW;AACb;;AAEA;;;EAGE,WAAW;EACX,iBAAiB;EACjB,aAAa;AACf;;AAEA;EACE,yFAA4qB;AAC9qB;;AAEA;EACE,yFAAkzB;AACpzB;;AAEA;EACE,yDAA2qK;AAC7qK;;AAEA;;EAEE,wBAAwB;EACxB,SAAS;EACT,SAAS;EACT,eAAe;EACf,eAAe;EACf,gBAAgB;EAChB,kBAAkB;EAClB;;;;GAIC;EACD,gBAAgB;EAChB,cAAc;EACd,kBAAkB;EAClB,QAAQ;EACR,sCAAsC;EACtC,8CAA8C;EAC9C,aAAa;EACb,kBAAkB;EAClB,0BAA0B,EAAE,8CAA8C;AAC5E;;AAEA;EACE,yBAAyB;EACzB,kBAAkB;AACpB;;AAEA;;;;EAIE,yBAAyB;AAC3B;;AAEA;EACE,qCAAqC;AACvC;;AAEA;EACE,sBAAsB;EACtB,gBAAgB;EAChB,aAAa;EACb,gBAAgB;EAChB,kBAAkB;EAClB,YAAY;EACZ,YAAY;EACZ,SAAS;EACT,kBAAkB;AACpB;;AAEA;EACE,qCAAqC;EACrC,4BAA4B;EAC5B,kCAAkC;EAClC,qBAAqB;EACrB,WAAW;EACX,kBAAkB;EAClB,WAAW;EACX,QAAQ;EACR,QAAQ;EACR,SAAS;AACX;;AAEA;;EAEE,eAAe;AACjB;;AAEA;EACE,SAAS;AACX;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,2FAAivF;EACjvF,wBAAwB;EACxB,SAAS;EACT,eAAe;EACf,gBAAgB;EAChB,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,eAAe;EACf,MAAM;EACN,gBAAgB;AAClB;;AAEA;EACE,WAAW;EACX,8CAA8C;EAC9C,cAAc;EACd,kBAAkB;EAClB,kBAAkB;EAClB,QAAQ;EACR,2BAA2B;EAC3B,WAAW;AACb;;AAEA;EACE,6DAA25B;EAC35B,YAAY;EACZ,YAAY;EACZ,oBAAoB;EACpB,WAAW;AACb;;AAEA;EACE,oCAAoC;EACpC,kCAAkC;EAClC,kBAAkB;EAClB,eAAe;EACf,YAAY;EACZ,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EAClB,UAAU;EACV,SAAS;EACT,QAAQ;EACR,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,+BAA+B;EAC/B,wBAAwB;EACxB,SAAS;EACT,eAAe;EACf,gBAAgB;EAChB,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,eAAe;EACf,MAAM;EACN,gBAAgB;AAClB;;AAEA;EACE,kBAAkB;EAClB,SAAS;EACT,QAAQ;EACR,gCAAgC;EAChC,eAAe;EACf,YAAY;EACZ,aAAa;EACb,wBAAwB;EACxB,uBAAuB;EACvB,kCAAkC;EAClC,eAAe;EACf,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,WAAW;EACX,WAAW;EACX,sBAAsB;EACtB,aAAa;EACb,uBAAuB;EACvB,qBAAqB;EACrB,sBAAsB;AACxB;;AAEA;EACE,qBAAqB;EACrB,mBAAmB;EACnB,eAAe;EACf,WAAW;AACb;;AAEA;EACE,oBAAoB;EACpB,oBAAoB;EACpB,WAAW;EACX,WAAW;AACb;;AAEA;EACE,eAAe;EACf,kBAAkB;EAClB,YAAY;EACZ,WAAW;EACX,UAAU;EACV,eAAe;EACf,WAAW;EACX,kBAAkB;EAClB,iBAAiB;EACjB,YAAY;EACZ,qBAAqB;EACrB,yCAAyC;EACzC,iCAAiC;EACjC,wEAAwE;EACxE,iBAAiB;AACnB;;AAEA;EACE,mEAAmE;AACrE;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,yBAAyB;EACzB,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,oBAAoB;EACpB,sBAAsB;EACtB,SAAS;EACT,OAAO;EACP,QAAQ;EACR,MAAM;EACN,YAAY;AACd;;AAEA;EACE,oBAAoB;AACtB",sourcesContent:["/* .a-fullscreen means not embedded. */\nhtml.a-fullscreen {\n bottom: 0;\n left: 0;\n position: fixed;\n right: 0;\n top: 0;\n}\n\nhtml.a-fullscreen body {\n height: 100%;\n margin: 0;\n overflow: hidden;\n padding: 0;\n width: 100%;\n}\n\n/* Class is removed when doing <a-scene embedded>. */\nhtml.a-fullscreen .a-canvas {\n width: 100% !important;\n height: 100% !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n position: fixed !important;\n}\n\nhtml:not(.a-fullscreen) .a-enter-vr,\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 5px;\n bottom: 5px;\n}\n\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 60px;\n}\n\n/* In chrome mobile the user agent stylesheet set it to white */\n:-webkit-full-screen {\n background-color: transparent;\n}\n\n.a-hidden {\n display: none !important;\n}\n\n.a-canvas {\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.a-canvas.a-grab-cursor:hover {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\ncanvas.a-canvas.a-mouse-cursor-hover:hover {\n cursor: pointer;\n}\n\n.a-inspector-loader {\n background-color: #ed3160;\n position: fixed;\n left: 3px;\n top: 3px;\n padding: 6px 10px;\n color: #fff;\n text-decoration: none;\n font-size: 12px;\n font-family: Roboto,sans-serif;\n text-align: center;\n z-index: 99999;\n width: 204px;\n}\n\n/* Inspector loader animation */\n@keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n@-webkit-keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@-webkit-keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@-webkit-keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n\n.a-inspector-loader .dots span {\n animation: dots-1 2s infinite steps(1);\n -webkit-animation: dots-1 2s infinite steps(1);\n}\n\n.a-inspector-loader .dots span:first-child + span {\n animation-name: dots-2;\n -webkit-animation-name: dots-2;\n}\n\n.a-inspector-loader .dots span:first-child + span + span {\n animation-name: dots-3;\n -webkit-animation-name: dots-3;\n}\n\na-scene {\n display: block;\n position: relative;\n height: 100%;\n width: 100%;\n}\n\na-assets,\na-scene video,\na-scene img,\na-scene audio {\n display: none;\n}\n\n.a-enter-vr-modal,\n.a-orientation-modal {\n font-family: Consolas, Andale Mono, Courier New, monospace;\n}\n\n.a-enter-vr-modal a {\n border-bottom: 1px solid #fff;\n padding: 2px 0;\n text-decoration: none;\n transition: .1s color ease-in;\n}\n\n.a-enter-vr-modal a:hover {\n background-color: #fff;\n color: #111;\n padding: 2px 4px;\n position: relative;\n left: -4px;\n}\n\n.a-enter-vr,\n.a-enter-ar {\n font-family: sans-serif, monospace;\n font-size: 13px;\n width: 100%;\n font-weight: 200;\n line-height: 16px;\n position: absolute;\n right: 20px;\n bottom: 20px;\n}\n\n.a-enter-ar.xr {\n right: 90px;\n}\n\n.a-enter-vr-button,\n.a-enter-vr-modal,\n.a-enter-vr-modal a {\n color: #fff;\n user-select: none;\n outline: none;\n}\n\n.a-enter-vr-button {\n background: rgba(0, 0, 0, 0.35) url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-vrmode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M68.81,21.56H64.23v8.27h4.58a4.13,4.13,0,0,0,3.1-1.09,4.2,4.2,0,0,0,1-3,4.24,4.24,0,0,0-1-3A4.05,4.05,0,0,0,68.81,21.56Z' fill='%23fff'/%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0ZM41.9,46H34L24,16h8l6,21.84,6-21.84H52Zm39.29,0H73.44L68.15,35.39H64.23V46H57V16H68.81q5.32,0,8.34,2.37a8,8,0,0,1,3,6.69,9.68,9.68,0,0,1-1.27,5.18,8.9,8.9,0,0,1-4,3.34l6.26,12.11Z' fill='%23fff'/%3E%3C/svg%3E\") 50% 50% no-repeat;\n}\n\n.a-enter-ar-button {\n background: rgba(0, 0, 0, 0.20) url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0Zm8,50a8,8,0,0,1-8,8H12a8,8,0,0,1-8-8V12a8,8,0,0,1,8-8H96a8,8,0,0,1,8,8Z' fill='%23fff'/%3E%3Cpath d='M43.35,39.82H32.51L30.45,46H23.88L35,16h5.73L52,46H45.43Zm-9.17-5h7.5L37.91,23.58Z' fill='%23fff'/%3E%3Cpath d='M68.11,35H63.18V46H57V16H68.15q5.31,0,8.2,2.37a8.18,8.18,0,0,1,2.88,6.7,9.22,9.22,0,0,1-1.33,5.12,9.09,9.09,0,0,1-4,3.26l6.49,12.26V46H73.73Zm-4.93-5h5a5.09,5.09,0,0,0,3.6-1.18,4.21,4.21,0,0,0,1.28-3.27,4.56,4.56,0,0,0-1.2-3.34A5,5,0,0,0,68.15,21h-5Z' fill='%23fff'/%3E%3C/svg%3E\") 50% 50% no-repeat;\n}\n\n.a-enter-vr.fullscreen .a-enter-vr-button {\n background-image: url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8' standalone='no'%3F%3E%3Csvg width='108' height='62' viewBox='0 0 108 62' version='1.1' id='svg320' sodipodi:docname='fullscreen-aframe.svg' xml:space='preserve' inkscape:version='1.2.1 (9c6d41e 2022-07-14)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3E%3Cdefs id='defs324' /%3E%3Csodipodi:namedview id='namedview322' pagecolor='%23ffffff' bordercolor='%23000000' borderopacity='0.25' inkscape:showpageshadow='2' inkscape:pageopacity='0.0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23d1d1d1' showgrid='false' inkscape:zoom='3.8064516' inkscape:cx='91.423729' inkscape:cy='-1.4449153' inkscape:window-width='1440' inkscape:window-height='847' inkscape:window-x='32' inkscape:window-y='25' inkscape:window-maximized='0' inkscape:current-layer='svg320' /%3E%3Ctitle id='title312'%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M96 0H12A12 12 0 0 0 0 12V50A12 12 0 0 0 12 62H96a12 12 0 0 0 12-12V12A12 12 0 0 0 96 0Zm8 50a8 8 0 0 1-8 8H12a8 8 0 0 1-8-8V12a8 8 0 0 1 8-8H96a8 8 0 0 1 8 8Z' fill='%23fff' id='path314' style='fill:%23ffffff' /%3E%3Cg id='g356' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g358' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g360' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g362' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g364' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g366' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g368' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g370' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g372' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g374' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g376' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g378' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g380' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g382' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g384' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cmetadata id='metadata561'%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=''%3E%3Cdc:title%3Eaframe-armode-noborder-reduced-tracking%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cpath d='m 98.168511 40.083649 c 0 -1.303681 -0.998788 -2.358041 -2.239389 -2.358041 -1.230088 0.0031 -2.240892 1.05436 -2.240892 2.358041 v 4.881296 l -9.041661 -9.041662 c -0.874129 -0.875631 -2.288954 -0.875631 -3.16308 0 -0.874129 0.874126 -0.874129 2.293459 0 3.167585 l 8.995101 8.992101 h -4.858767 c -1.323206 0.0031 -2.389583 1.004796 -2.389583 2.239386 0 1.237598 1.066377 2.237888 2.389583 2.237888 h 10.154599 c 1.323206 0 2.388082 -0.998789 2.392587 -2.237888 -0.0044 -0.03305 -0.009 -0.05858 -0.0134 -0.09161 0.0046 -0.04207 0.0134 -0.08712 0.0134 -0.13066 V 40.085172 h -1.52e-4' id='path596' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 23.091002 35.921781 -9.026643 9.041662 v -4.881296 c 0 -1.303681 -1.009302 -2.355037 -2.242393 -2.358041 -1.237598 0 -2.237888 1.05436 -2.237888 2.358041 l -0.0031 10.016421 c 0 0.04356 0.01211 0.08862 0.0015 0.130659 -0.0031 0.03153 -0.009 0.05709 -0.01211 0.09161 0.0031 1.239099 1.069379 2.237888 2.391085 2.237888 h 10.156101 c 1.320202 0 2.388079 -1.000291 2.388079 -2.237888 0 -1.234591 -1.067877 -2.236383 -2.388079 -2.239387 h -4.858767 l 8.995101 -8.9921 c 0.871126 -0.874127 0.871126 -2.293459 0 -3.167586 -0.875628 -0.877132 -2.291957 -0.877132 -3.169087 -1.52e-4' id='path598' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 84.649572 25.978033 9.041662 -9.041664 v 4.881298 c 0 1.299176 1.010806 2.350532 2.240891 2.355037 1.240601 0 2.23939 -1.055861 2.23939 -2.355037 V 11.798242 c 0 -0.04356 -0.009 -0.08862 -0.0134 -0.127671 0.0044 -0.03153 0.009 -0.06157 0.0134 -0.09313 -0.0044 -1.240598 -1.069379 -2.2393873 -2.391085 -2.2393873 h -10.1546 c -1.323205 0 -2.38958 0.9987893 -2.38958 2.2393873 0 1.233091 1.066375 2.237887 2.38958 2.240891 h 4.858768 l -8.995102 8.9921 c -0.874129 0.872625 -0.874129 2.288954 0 3.161578 0.874127 0.880137 2.288951 0.880137 3.16308 1.5e-4' id='path600' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 17.264988 13.822853 h 4.857265 c 1.320202 -0.0031 2.388079 -1.0078 2.388079 -2.240889 0 -1.240601 -1.067877 -2.2393893 -2.388079 -2.2393893 H 11.967654 c -1.321707 0 -2.388082 0.9987883 -2.391085 2.2393893 0.0031 0.03153 0.009 0.06157 0.01211 0.09313 -0.0031 0.03905 -0.0015 0.08262 -0.0015 0.127671 l 0.0031 10.020926 c 0 1.299176 1.00029 2.355038 2.237887 2.355038 1.233092 -0.0044 2.242393 -1.055862 2.242393 -2.355038 v -4.881295 l 9.026644 9.041661 c 0.877132 0.878635 2.293459 0.878635 3.169087 0 0.871125 -0.872624 0.871125 -2.288953 0 -3.161577 l -8.995282 -8.993616' id='path602' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3C/svg%3E\");\n}\n\n.a-enter-vr-button,\n.a-enter-ar-button {\n background-size: 90% 90%;\n border: 0;\n bottom: 0;\n cursor: pointer;\n min-width: 58px;\n min-height: 34px;\n /* 1.74418604651 */\n /*\n In order to keep the aspect ratio when resizing\n padding-top percentages are relative to the containing block's width.\n http://stackoverflow.com/questions/12121090/responsively-change-div-size-keeping-aspect-ratio\n */\n padding-right: 0;\n padding-top: 0;\n position: absolute;\n right: 0;\n transition: background-color .05s ease;\n -webkit-transition: background-color .05s ease;\n z-index: 9999;\n border-radius: 8px;\n touch-action: manipulation; /* Prevent iOS double tap zoom on the button */\n}\n\n.a-enter-ar-button {\n background-size: 100% 90%;\n border-radius: 7px;\n}\n\n.a-enter-ar-button:active,\n.a-enter-ar-button:hover,\n.a-enter-vr-button:active,\n.a-enter-vr-button:hover {\n background-color: #ef2d5e;\n}\n\n.a-enter-vr-button.resethover {\n background-color: rgba(0, 0, 0, 0.35);\n}\n\n.a-enter-vr-modal {\n background-color: #666;\n border-radius: 0;\n display: none;\n min-height: 32px;\n margin-right: 70px;\n padding: 9px;\n width: 280px;\n right: 2%;\n position: absolute;\n}\n\n.a-enter-vr-modal:after {\n border-bottom: 10px solid transparent;\n border-left: 10px solid #666;\n border-top: 10px solid transparent;\n display: inline-block;\n content: '';\n position: absolute;\n right: -5px;\n top: 5px;\n width: 0;\n height: 0;\n}\n\n.a-enter-vr-modal p,\n.a-enter-vr-modal a {\n display: inline;\n}\n\n.a-enter-vr-modal p {\n margin: 0;\n}\n\n.a-enter-vr-modal p:after {\n content: ' ';\n}\n\n.a-orientation-modal {\n background: rgba(244, 244, 244, 1) url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E) center no-repeat;\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-orientation-modal:after {\n color: #666;\n content: \"Insert phone into Cardboard holder.\";\n display: block;\n position: absolute;\n text-align: center;\n top: 70%;\n transform: translateY(-70%);\n width: 100%;\n}\n\n.a-orientation-modal button {\n background: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E) no-repeat;\n border: none;\n height: 50px;\n text-indent: -9999px;\n width: 50px;\n}\n\n.a-loader-title {\n background-color: rgba(0, 0, 0, 0.6);\n font-family: sans-serif, monospace;\n text-align: center;\n font-size: 20px;\n height: 50px;\n font-weight: 300;\n line-height: 50px;\n position: absolute;\n right: 0px;\n left: 0px;\n top: 0px;\n color: white;\n}\n\n.a-modal {\n position: absolute;\n background: rgba(0, 0, 0, 0.60);\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-dialog {\n position: relative;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n z-index: 199995;\n width: 300px;\n height: 200px;\n background-size: contain;\n background-color: white;\n font-family: sans-serif, monospace;\n font-size: 20px;\n border-radius: 3px;\n padding: 6px;\n}\n\n.a-dialog-text-container {\n width: 100%;\n height: 70%;\n align-self: flex-start;\n display: flex;\n justify-content: center;\n align-content: center;\n flex-direction: column;\n}\n\n.a-dialog-text {\n display: inline-block;\n font-weight: normal;\n font-size: 14pt;\n margin: 8px;\n}\n\n.a-dialog-buttons-container {\n display: inline-flex;\n align-self: flex-end;\n width: 100%;\n height: 30%;\n}\n\n.a-dialog-button {\n cursor: pointer;\n align-self: center;\n opacity: 0.9;\n height: 80%;\n width: 50%;\n font-size: 12pt;\n margin: 4px;\n border-radius: 2px;\n text-align:center;\n border: none;\n display: inline-block;\n -webkit-transition: all 0.25s ease-in-out;\n transition: all 0.25s ease-in-out;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.20);\n user-select: none;\n}\n\n.a-dialog-permission-button:hover {\n box-shadow: 0 7px 14px rgba(0,0,0,0.20), 0 2px 2px rgba(0,0,0,0.20);\n}\n\n.a-dialog-allow-button {\n background-color: #00ceff;\n}\n\n.a-dialog-deny-button {\n background-color: #ff005b;\n}\n\n.a-dialog-ok-button {\n background-color: #00ceff;\n width: 100%;\n}\n\n.a-dom-overlay:not(.a-no-style) {\n overflow: hidden;\n position: absolute;\n pointer-events: none;\n box-sizing: border-box;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n padding: 1em;\n}\n\n.a-dom-overlay:not(.a-no-style)>* {\n pointer-events: auto;\n}\n"],sourceRoot:""}]);const E=A},2470:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(963),r=n.n(i),s=n(9089),o=n.n(s)()(r());o.push([e.id,".rs-base {\n background-color: #333;\n color: #fafafa;\n border-radius: 0;\n font: 10px monospace;\n left: 5px;\n line-height: 1em;\n opacity: 0.85;\n overflow: hidden;\n padding: 10px;\n position: fixed;\n top: 5px;\n width: 300px;\n z-index: 10000;\n}\n\n.rs-base div.hidden {\n display: none;\n}\n\n.rs-base h1 {\n color: #fff;\n cursor: pointer;\n font-size: 1.4em;\n font-weight: 300;\n margin: 0 0 5px;\n padding: 0;\n}\n\n.rs-group {\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n -webkit-flex-direction: column-reverse;\n flex-direction: column-reverse;\n margin-bottom: 5px;\n}\n\n.rs-group:last-child {\n margin-bottom: 0;\n}\n\n.rs-counter-base {\n align-items: center;\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n height: 10px;\n -webkit-justify-content: space-between;\n justify-content: space-between;\n margin: 2px 0;\n}\n\n.rs-counter-base.alarm {\n color: #b70000;\n text-shadow: 0 0 0 #b70000,\n 0 0 1px #fff,\n 0 0 1px #fff,\n 0 0 2px #fff,\n 0 0 2px #fff,\n 0 0 3px #fff,\n 0 0 3px #fff,\n 0 0 4px #fff,\n 0 0 4px #fff;\n}\n\n.rs-counter-id {\n font-weight: 300;\n -webkit-box-ordinal-group: 0;\n -webkit-order: 0;\n order: 0;\n width: 54px;\n}\n\n.rs-counter-value {\n font-weight: 300;\n -webkit-box-ordinal-group: 1;\n -webkit-order: 1;\n order: 1;\n text-align: right;\n width: 35px;\n}\n\n.rs-canvas {\n -webkit-box-ordinal-group: 2;\n -webkit-order: 2;\n order: 2;\n}\n\n@media (min-width: 480px) {\n .rs-base {\n left: 20px;\n top: 20px;\n }\n}\n","",{version:3,sources:["webpack://./src/style/rStats.css"],names:[],mappings:"AAAA;EACE,sBAAsB;EACtB,cAAc;EACd,gBAAgB;EAChB,oBAAoB;EACpB,SAAS;EACT,gBAAgB;EAChB,aAAa;EACb,gBAAgB;EAChB,aAAa;EACb,eAAe;EACf,QAAQ;EACR,YAAY;EACZ,cAAc;AAChB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,WAAW;EACX,eAAe;EACf,gBAAgB;EAChB,gBAAgB;EAChB,eAAe;EACf,UAAU;AACZ;;AAEA;EACE,oBAAoB;EACpB,qBAAqB;EACrB,aAAa;EACb,sCAAsC;EACtC,8BAA8B;EAC9B,kBAAkB;AACpB;;AAEA;EACE,gBAAgB;AAClB;;AAEA;EACE,mBAAmB;EACnB,oBAAoB;EACpB,qBAAqB;EACrB,aAAa;EACb,YAAY;EACZ,sCAAsC;EACtC,8BAA8B;EAC9B,aAAa;AACf;;AAEA;EACE,cAAc;EACd;;;;;;;;2BAQyB;AAC3B;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;EACR,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;EACR,iBAAiB;EACjB,WAAW;AACb;;AAEA;EACE,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;AACV;;AAEA;EACE;IACE,UAAU;IACV,SAAS;EACX;AACF",sourcesContent:[".rs-base {\n background-color: #333;\n color: #fafafa;\n border-radius: 0;\n font: 10px monospace;\n left: 5px;\n line-height: 1em;\n opacity: 0.85;\n overflow: hidden;\n padding: 10px;\n position: fixed;\n top: 5px;\n width: 300px;\n z-index: 10000;\n}\n\n.rs-base div.hidden {\n display: none;\n}\n\n.rs-base h1 {\n color: #fff;\n cursor: pointer;\n font-size: 1.4em;\n font-weight: 300;\n margin: 0 0 5px;\n padding: 0;\n}\n\n.rs-group {\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n -webkit-flex-direction: column-reverse;\n flex-direction: column-reverse;\n margin-bottom: 5px;\n}\n\n.rs-group:last-child {\n margin-bottom: 0;\n}\n\n.rs-counter-base {\n align-items: center;\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n height: 10px;\n -webkit-justify-content: space-between;\n justify-content: space-between;\n margin: 2px 0;\n}\n\n.rs-counter-base.alarm {\n color: #b70000;\n text-shadow: 0 0 0 #b70000,\n 0 0 1px #fff,\n 0 0 1px #fff,\n 0 0 2px #fff,\n 0 0 2px #fff,\n 0 0 3px #fff,\n 0 0 3px #fff,\n 0 0 4px #fff,\n 0 0 4px #fff;\n}\n\n.rs-counter-id {\n font-weight: 300;\n -webkit-box-ordinal-group: 0;\n -webkit-order: 0;\n order: 0;\n width: 54px;\n}\n\n.rs-counter-value {\n font-weight: 300;\n -webkit-box-ordinal-group: 1;\n -webkit-order: 1;\n order: 1;\n text-align: right;\n width: 35px;\n}\n\n.rs-canvas {\n -webkit-box-ordinal-group: 2;\n -webkit-order: 2;\n order: 2;\n}\n\n@media (min-width: 480px) {\n .rs-base {\n left: 20px;\n top: 20px;\n }\n}\n"],sourceRoot:""}]);const a=o},7180:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>g});var i=n(5072),r=n.n(i),s=n(7825),o=n.n(s),a=n(7659),l=n.n(a),c=n(5056),h=n.n(c),d=n(540),u=n.n(d),p=n(1113),A=n.n(p),f=n(8217),m={};m.styleTagTransform=A(),m.setAttributes=h(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=u(),r()(f.A,m);const g=f.A&&f.A.locals?f.A.locals:void 0},9379:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>g});var i=n(5072),r=n.n(i),s=n(7825),o=n.n(s),a=n(7659),l=n.n(a),c=n(5056),h=n.n(c),d=n(540),u=n.n(d),p=n(1113),A=n.n(p),f=n(2470),m={};m.styleTagTransform=A(),m.setAttributes=h(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=u(),r()(f.A,m);const g=f.A&&f.A.locals?f.A.locals:void 0},5072:e=>{"use strict";var t=[];function n(e){for(var n=-1,i=0;i<t.length;i++)if(t[i].identifier===e){n=i;break}return n}function i(e,i){for(var s={},o=[],a=0;a<e.length;a++){var l=e[a],c=i.base?l[0]+i.base:l[0],h=s[c]||0,d="".concat(c," ").concat(h);s[c]=h+1;var u=n(d),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==u)t[u].references++,t[u].updater(p);else{var A=r(p,i);i.byIndex=a,t.splice(a,0,{identifier:d,updater:A,references:1})}o.push(d)}return o}function r(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var s=i(e=e||[],r=r||{});return function(e){e=e||[];for(var o=0;o<s.length;o++){var a=n(s[o]);t[a].references--}for(var l=i(e,r),c=0;c<s.length;c++){var h=n(s[c]);0===t[h].references&&(t[h].updater(),t.splice(h,1))}s=l}}},7659:e=>{"use strict";var t={};e.exports=function(e,n){var i=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},5056:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},7825:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(i,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},1113:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},3931:e=>{"use strict";e.exports="data:image/svg+xml,%3C%3Fxml version=%271.0%27 encoding=%27UTF-8%27 standalone=%27no%27%3F%3E%3Csvg width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27 version=%271.1%27 id=%27svg320%27 sodipodi:docname=%27fullscreen-aframe.svg%27 xml:space=%27preserve%27 inkscape:version=%271.2.1 %289c6d41e 2022-07-14%29%27 xmlns:inkscape=%27http://www.inkscape.org/namespaces/inkscape%27 xmlns:sodipodi=%27http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd%27 xmlns=%27http://www.w3.org/2000/svg%27 xmlns:svg=%27http://www.w3.org/2000/svg%27 xmlns:rdf=%27http://www.w3.org/1999/02/22-rdf-syntax-ns%23%27 xmlns:cc=%27http://creativecommons.org/ns%23%27 xmlns:dc=%27http://purl.org/dc/elements/1.1/%27%3E%3Cdefs id=%27defs324%27 /%3E%3Csodipodi:namedview id=%27namedview322%27 pagecolor=%27%23ffffff%27 bordercolor=%27%23000000%27 borderopacity=%270.25%27 inkscape:showpageshadow=%272%27 inkscape:pageopacity=%270.0%27 inkscape:pagecheckerboard=%270%27 inkscape:deskcolor=%27%23d1d1d1%27 showgrid=%27false%27 inkscape:zoom=%273.8064516%27 inkscape:cx=%2791.423729%27 inkscape:cy=%27-1.4449153%27 inkscape:window-width=%271440%27 inkscape:window-height=%27847%27 inkscape:window-x=%2732%27 inkscape:window-y=%2725%27 inkscape:window-maximized=%270%27 inkscape:current-layer=%27svg320%27 /%3E%3Ctitle id=%27title312%27%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M96 0H12A12 12 0 0 0 0 12V50A12 12 0 0 0 12 62H96a12 12 0 0 0 12-12V12A12 12 0 0 0 96 0Zm8 50a8 8 0 0 1-8 8H12a8 8 0 0 1-8-8V12a8 8 0 0 1 8-8H96a8 8 0 0 1 8 8Z%27 fill=%27%23fff%27 id=%27path314%27 style=%27fill:%23ffffff%27 /%3E%3Cg id=%27g356%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g358%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g360%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g362%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g364%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g366%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g368%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g370%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g372%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g374%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g376%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g378%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g380%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g382%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g384%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cmetadata id=%27metadata561%27%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=%27%27%3E%3Cdc:title%3Eaframe-armode-noborder-reduced-tracking%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cpath d=%27m 98.168511 40.083649 c 0 -1.303681 -0.998788 -2.358041 -2.239389 -2.358041 -1.230088 0.0031 -2.240892 1.05436 -2.240892 2.358041 v 4.881296 l -9.041661 -9.041662 c -0.874129 -0.875631 -2.288954 -0.875631 -3.16308 0 -0.874129 0.874126 -0.874129 2.293459 0 3.167585 l 8.995101 8.992101 h -4.858767 c -1.323206 0.0031 -2.389583 1.004796 -2.389583 2.239386 0 1.237598 1.066377 2.237888 2.389583 2.237888 h 10.154599 c 1.323206 0 2.388082 -0.998789 2.392587 -2.237888 -0.0044 -0.03305 -0.009 -0.05858 -0.0134 -0.09161 0.0046 -0.04207 0.0134 -0.08712 0.0134 -0.13066 V 40.085172 h -1.52e-4%27 id=%27path596%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 23.091002 35.921781 -9.026643 9.041662 v -4.881296 c 0 -1.303681 -1.009302 -2.355037 -2.242393 -2.358041 -1.237598 0 -2.237888 1.05436 -2.237888 2.358041 l -0.0031 10.016421 c 0 0.04356 0.01211 0.08862 0.0015 0.130659 -0.0031 0.03153 -0.009 0.05709 -0.01211 0.09161 0.0031 1.239099 1.069379 2.237888 2.391085 2.237888 h 10.156101 c 1.320202 0 2.388079 -1.000291 2.388079 -2.237888 0 -1.234591 -1.067877 -2.236383 -2.388079 -2.239387 h -4.858767 l 8.995101 -8.9921 c 0.871126 -0.874127 0.871126 -2.293459 0 -3.167586 -0.875628 -0.877132 -2.291957 -0.877132 -3.169087 -1.52e-4%27 id=%27path598%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 84.649572 25.978033 9.041662 -9.041664 v 4.881298 c 0 1.299176 1.010806 2.350532 2.240891 2.355037 1.240601 0 2.23939 -1.055861 2.23939 -2.355037 V 11.798242 c 0 -0.04356 -0.009 -0.08862 -0.0134 -0.127671 0.0044 -0.03153 0.009 -0.06157 0.0134 -0.09313 -0.0044 -1.240598 -1.069379 -2.2393873 -2.391085 -2.2393873 h -10.1546 c -1.323205 0 -2.38958 0.9987893 -2.38958 2.2393873 0 1.233091 1.066375 2.237887 2.38958 2.240891 h 4.858768 l -8.995102 8.9921 c -0.874129 0.872625 -0.874129 2.288954 0 3.161578 0.874127 0.880137 2.288951 0.880137 3.16308 1.5e-4%27 id=%27path600%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 17.264988 13.822853 h 4.857265 c 1.320202 -0.0031 2.388079 -1.0078 2.388079 -2.240889 0 -1.240601 -1.067877 -2.2393893 -2.388079 -2.2393893 H 11.967654 c -1.321707 0 -2.388082 0.9987883 -2.391085 2.2393893 0.0031 0.03153 0.009 0.06157 0.01211 0.09313 -0.0031 0.03905 -0.0015 0.08262 -0.0015 0.127671 l 0.0031 10.020926 c 0 1.299176 1.00029 2.355038 2.237887 2.355038 1.233092 -0.0044 2.242393 -1.055862 2.242393 -2.355038 v -4.881295 l 9.026644 9.041661 c 0.877132 0.878635 2.293459 0.878635 3.169087 0 0.871125 -0.872624 0.871125 -2.288953 0 -3.161577 l -8.995282 -8.993616%27 id=%27path602%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3C/svg%3E"},6085:e=>{"use strict";e.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27%3E%3Ctitle%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0Zm8,50a8,8,0,0,1-8,8H12a8,8,0,0,1-8-8V12a8,8,0,0,1,8-8H96a8,8,0,0,1,8,8Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M43.35,39.82H32.51L30.45,46H23.88L35,16h5.73L52,46H45.43Zm-9.17-5h7.5L37.91,23.58Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M68.11,35H63.18V46H57V16H68.15q5.31,0,8.2,2.37a8.18,8.18,0,0,1,2.88,6.7,9.22,9.22,0,0,1-1.33,5.12,9.09,9.09,0,0,1-4,3.26l6.49,12.26V46H73.73Zm-4.93-5h5a5.09,5.09,0,0,0,3.6-1.18,4.21,4.21,0,0,0,1.28-3.27,4.56,4.56,0,0,0-1.2-3.34A5,5,0,0,0,68.15,21h-5Z%27 fill=%27%23fff%27/%3E%3C/svg%3E"},9169:e=>{"use strict";e.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27%3E%3Ctitle%3Eaframe-vrmode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M68.81,21.56H64.23v8.27h4.58a4.13,4.13,0,0,0,3.1-1.09,4.2,4.2,0,0,0,1-3,4.24,4.24,0,0,0-1-3A4.05,4.05,0,0,0,68.81,21.56Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0ZM41.9,46H34L24,16h8l6,21.84,6-21.84H52Zm39.29,0H73.44L68.15,35.39H64.23V46H57V16H68.81q5.32,0,8.34,2.37a8,8,0,0,1,3,6.69,9.68,9.68,0,0,1-1.27,5.18,8.9,8.9,0,0,1-4,3.34l6.26,12.11Z%27 fill=%27%23fff%27/%3E%3C/svg%3E"},6517:e=>{"use strict";e.exports="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E"},7889:e=>{"use strict";e.exports="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E"},7496:(e,t,n)=>{"use strict";n.d(t,{A:()=>qg});var i={};n.r(i),n.d(i,{ACESFilmicToneMapping:()=>oe,AddEquation:()=>_,AddOperation:()=>te,AdditiveAnimationBlendMode:()=>Vt,AdditiveBlending:()=>x,AgXToneMapping:()=>le,AlphaFormat:()=>He,AlwaysCompare:()=>Bn,AlwaysDepth:()=>W,AlwaysStencilFunc:()=>xn,AmbientLight:()=>Th,AnimationAction:()=>Ed,AnimationClip:()=>$c,AnimationLoader:()=>lh,AnimationMixer:()=>bd,AnimationObjectGroup:()=>yd,AnimationUtils:()=>Qc,ArcCurve:()=>nl,ArrayCamera:()=>Jh,ArrowHelper:()=>fu,AttachedBindMode:()=>he,Audio:()=>rd,AudioAnalyser:()=>hd,AudioContext:()=>Vh,AudioListener:()=>id,AudioLoader:()=>jh,AxesHelper:()=>mu,BackSide:()=>g,BasicDepthPacking:()=>Xt,BasicShadowMap:()=>u,BatchedMesh:()=>wa,Bone:()=>Qo,BooleanKeyframeTrack:()=>Wc,Box2:()=>Od,Box3:()=>Ui,Box3Helper:()=>hu,BoxGeometry:()=>Hs,BoxHelper:()=>cu,BufferAttribute:()=>us,BufferGeometry:()=>Bs,BufferGeometryLoader:()=>Fh,ByteType:()=>Le,Cache:()=>th,Camera:()=>Ys,CameraHelper:()=>ou,CanvasTexture:()=>Za,CapsuleGeometry:()=>Cl,CatmullRomCurve3:()=>ll,CineonToneMapping:()=>se,CircleGeometry:()=>wl,ClampToEdgeWrapping:()=>ye,Clock:()=>Kh,Color:()=>es,ColorKeyframeTrack:()=>qc,ColorManagement:()=>Ai,CompressedArrayTexture:()=>Ja,CompressedCubeTexture:()=>Ka,CompressedTexture:()=>Ya,CompressedTextureLoader:()=>ch,ConeGeometry:()=>Ml,ConstantAlphaFactor:()=>H,ConstantColorFactor:()=>G,Controls:()=>vu,CubeCamera:()=>to,CubeReflectionMapping:()=>pe,CubeRefractionMapping:()=>Ae,CubeTexture:()=>no,CubeTextureLoader:()=>dh,CubeUVReflectionMapping:()=>ge,CubicBezierCurve:()=>ul,CubicBezierCurve3:()=>pl,CubicInterpolant:()=>zc,CullFaceBack:()=>c,CullFaceFront:()=>h,CullFaceFrontBack:()=>d,CullFaceNone:()=>l,Curve:()=>el,CurvePath:()=>El,CustomBlending:()=>w,CustomToneMapping:()=>ae,CylinderGeometry:()=>_l,Cylindrical:()=>Dd,Data3DTexture:()=>Bi,DataArrayTexture:()=>Si,DataTexture:()=>Go,DataTextureLoader:()=>uh,DataUtils:()=>cs,DecrementStencilOp:()=>hn,DecrementWrapStencilOp:()=>un,DefaultLoadingManager:()=>ih,DepthFormat:()=>Xe,DepthStencilFormat:()=>Ye,DepthTexture:()=>$a,DetachedBindMode:()=>de,DirectionalLight:()=>Bh,DirectionalLightHelper:()=>iu,DiscreteInterpolant:()=>Vc,DodecahedronGeometry:()=>Il,DoubleSide:()=>v,DstAlphaFactor:()=>O,DstColorFactor:()=>k,DynamicCopyUsage:()=>Fn,DynamicDrawUsage:()=>Rn,DynamicReadUsage:()=>Pn,EdgesGeometry:()=>Dl,EllipseCurve:()=>tl,EqualCompare:()=>wn,EqualDepth:()=>Y,EqualStencilFunc:()=>mn,EquirectangularReflectionMapping:()=>fe,EquirectangularRefractionMapping:()=>me,Euler:()=>vr,EventDispatcher:()=>Hn,ExtrudeGeometry:()=>lc,FileLoader:()=>ah,Float16BufferAttribute:()=>Es,Float32BufferAttribute:()=>xs,FloatType:()=>Fe,Fog:()=>so,FogExp2:()=>ro,FramebufferTexture:()=>Xa,FrontSide:()=>m,Frustum:()=>oa,GLBufferAttribute:()=>Sd,GLSL1:()=>Nn,GLSL3:()=>Qn,GreaterCompare:()=>Mn,GreaterDepth:()=>K,GreaterEqualCompare:()=>In,GreaterEqualDepth:()=>J,GreaterEqualStencilFunc:()=>En,GreaterStencilFunc:()=>vn,GridHelper:()=>Zd,Group:()=>Wa,HalfFloatType:()=>ke,HemisphereLight:()=>fh,HemisphereLightHelper:()=>Kd,IcosahedronGeometry:()=>hc,ImageBitmapLoader:()=>zh,ImageLoader:()=>hh,ImageUtils:()=>vi,IncrementStencilOp:()=>cn,IncrementWrapStencilOp:()=>dn,InstancedBufferAttribute:()=>jo,InstancedBufferGeometry:()=>Oh,InstancedInterleavedBuffer:()=>Md,InstancedMesh:()=>$o,Int16BufferAttribute:()=>ms,Int32BufferAttribute:()=>vs,Int8BufferAttribute:()=>ps,IntType:()=>Ue,InterleavedBuffer:()=>ao,InterleavedBufferAttribute:()=>co,Interpolant:()=>Gc,InterpolateDiscrete:()=>Ft,InterpolateLinear:()=>kt,InterpolateSmooth:()=>Nt,InvertStencilOp:()=>pn,KeepStencilOp:()=>an,KeyframeTrack:()=>jc,LOD:()=>Bo,LatheGeometry:()=>bl,Layers:()=>yr,LessCompare:()=>Cn,LessDepth:()=>q,LessEqualCompare:()=>_n,LessEqualDepth:()=>X,LessEqualStencilFunc:()=>gn,LessStencilFunc:()=>fn,Light:()=>Ah,LightProbe:()=>Dh,Line:()=>Da,Line3:()=>Nd,LineBasicMaterial:()=>_a,LineCurve:()=>Al,LineCurve3:()=>fl,LineDashedMaterial:()=>Pc,LineLoop:()=>ka,LineSegments:()=>Fa,LinearFilter:()=>Me,LinearInterpolant:()=>Hc,LinearMipMapLinearFilter:()=>Te,LinearMipMapNearestFilter:()=>Ie,LinearMipmapLinearFilter:()=>Be,LinearMipmapNearestFilter:()=>Se,LinearSRGBColorSpace:()=>nn,LinearToneMapping:()=>ie,LinearTransfer:()=>rn,Loader:()=>rh,LoaderUtils:()=>Uh,LoadingManager:()=>nh,LoopOnce:()=>Pt,LoopPingPong:()=>Ot,LoopRepeat:()=>Ut,LuminanceAlphaFormat:()=>qe,LuminanceFormat:()=>We,MOUSE:()=>o,Material:()=>is,MaterialLoader:()=>Ph,MathUtils:()=>ei,Matrix2:()=>Pd,Matrix3:()=>ni,Matrix4:()=>lr,MaxEquation:()=>B,Mesh:()=>Gs,MeshBasicMaterial:()=>rs,MeshDepthMaterial:()=>Rc,MeshDistanceMaterial:()=>Lc,MeshLambertMaterial:()=>Tc,MeshMatcapMaterial:()=>Dc,MeshNormalMaterial:()=>Bc,MeshPhongMaterial:()=>Sc,MeshPhysicalMaterial:()=>Mc,MeshStandardMaterial:()=>_c,MeshToonMaterial:()=>Ic,MinEquation:()=>I,MirroredRepeatWrapping:()=>Ee,MixOperation:()=>ee,MultiplyBlending:()=>C,MultiplyOperation:()=>$,NearestFilter:()=>xe,NearestMipMapLinearFilter:()=>_e,NearestMipMapNearestFilter:()=>Ce,NearestMipmapLinearFilter:()=>we,NearestMipmapNearestFilter:()=>be,NeutralToneMapping:()=>ce,NeverCompare:()=>bn,NeverDepth:()=>j,NeverStencilFunc:()=>An,NoBlending:()=>y,NoColorSpace:()=>en,NoToneMapping:()=>ne,NormalAnimationBlendMode:()=>Ht,NormalBlending:()=>E,NotEqualCompare:()=>Sn,NotEqualDepth:()=>Z,NotEqualStencilFunc:()=>yn,NumberKeyframeTrack:()=>Xc,Object3D:()=>Ur,ObjectLoader:()=>kh,ObjectSpaceNormalMap:()=>$t,OctahedronGeometry:()=>dc,OneFactor:()=>R,OneMinusConstantAlphaFactor:()=>V,OneMinusConstantColorFactor:()=>z,OneMinusDstAlphaFactor:()=>F,OneMinusDstColorFactor:()=>N,OneMinusSrcAlphaFactor:()=>U,OneMinusSrcColorFactor:()=>D,OrthographicCamera:()=>Sh,PCFShadowMap:()=>p,PCFSoftShadowMap:()=>A,PMREMGenerator:()=>Wu,Path:()=>xl,PerspectiveCamera:()=>$s,Plane:()=>ia,PlaneGeometry:()=>uc,PlaneHelper:()=>du,PointLight:()=>Mh,PointLightHelper:()=>qd,Points:()=>Va,PointsMaterial:()=>Na,PolarGridHelper:()=>$d,PolyhedronGeometry:()=>Sl,PositionalAudio:()=>cd,PropertyBinding:()=>vd,PropertyMixer:()=>dd,QuadraticBezierCurve:()=>ml,QuadraticBezierCurve3:()=>gl,Quaternion:()=>Ri,QuaternionKeyframeTrack:()=>Jc,QuaternionLinearInterpolant:()=>Yc,RED_GREEN_RGTC2_Format:()=>Lt,RED_RGTC1_Format:()=>Tt,REVISION:()=>s,RGBADepthPacking:()=>Yt,RGBAFormat:()=>je,RGBAIntegerFormat:()=>tt,RGBA_ASTC_10x10_Format:()=>wt,RGBA_ASTC_10x5_Format:()=>xt,RGBA_ASTC_10x6_Format:()=>bt,RGBA_ASTC_10x8_Format:()=>Ct,RGBA_ASTC_12x10_Format:()=>_t,RGBA_ASTC_12x12_Format:()=>Mt,RGBA_ASTC_4x4_Format:()=>pt,RGBA_ASTC_5x4_Format:()=>At,RGBA_ASTC_5x5_Format:()=>ft,RGBA_ASTC_6x5_Format:()=>mt,RGBA_ASTC_6x6_Format:()=>gt,RGBA_ASTC_8x5_Format:()=>vt,RGBA_ASTC_8x6_Format:()=>yt,RGBA_ASTC_8x8_Format:()=>Et,RGBA_BPTC_Format:()=>St,RGBA_ETC2_EAC_Format:()=>ut,RGBA_PVRTC_2BPPV1_Format:()=>ct,RGBA_PVRTC_4BPPV1_Format:()=>lt,RGBA_S3TC_DXT1_Format:()=>it,RGBA_S3TC_DXT3_Format:()=>rt,RGBA_S3TC_DXT5_Format:()=>st,RGBDepthPacking:()=>Jt,RGBFormat:()=>Ve,RGBIntegerFormat:()=>et,RGB_BPTC_SIGNED_Format:()=>It,RGB_BPTC_UNSIGNED_Format:()=>Bt,RGB_ETC1_Format:()=>ht,RGB_ETC2_Format:()=>dt,RGB_PVRTC_2BPPV1_Format:()=>at,RGB_PVRTC_4BPPV1_Format:()=>ot,RGB_S3TC_DXT1_Format:()=>nt,RGDepthPacking:()=>Kt,RGFormat:()=>Ze,RGIntegerFormat:()=>$e,RawShaderMaterial:()=>wc,Ray:()=>ar,Raycaster:()=>Bd,RectAreaLight:()=>Rh,RedFormat:()=>Je,RedIntegerFormat:()=>Ke,ReinhardToneMapping:()=>re,RenderTarget:()=>_i,RepeatWrapping:()=>ve,ReplaceStencilOp:()=>ln,ReverseSubtractEquation:()=>S,RingGeometry:()=>pc,SIGNED_RED_GREEN_RGTC2_Format:()=>Dt,SIGNED_RED_RGTC1_Format:()=>Rt,SRGBColorSpace:()=>tn,SRGBTransfer:()=>sn,Scene:()=>oo,ShaderChunk:()=>wu,ShaderLib:()=>Mu,ShaderMaterial:()=>Xs,ShadowMaterial:()=>Cc,Shape:()=>Pl,ShapeGeometry:()=>Ac,ShapePath:()=>gu,ShapeUtils:()=>sc,ShortType:()=>De,Skeleton:()=>Vo,SkeletonHelper:()=>jd,SkinnedMesh:()=>No,Source:()=>Ei,Sphere:()=>$i,SphereGeometry:()=>fc,Spherical:()=>Ld,SphericalHarmonics3:()=>Lh,SplineCurve:()=>vl,SpotLight:()=>xh,SpotLightHelper:()=>Gd,Sprite:()=>_o,SpriteMaterial:()=>ho,SrcAlphaFactor:()=>P,SrcAlphaSaturateFactor:()=>Q,SrcColorFactor:()=>L,StaticCopyUsage:()=>On,StaticDrawUsage:()=>Tn,StaticReadUsage:()=>Dn,StereoCamera:()=>Yh,StreamCopyUsage:()=>kn,StreamDrawUsage:()=>Ln,StreamReadUsage:()=>Un,StringKeyframeTrack:()=>Kc,SubtractEquation:()=>M,SubtractiveBlending:()=>b,TOUCH:()=>a,TangentSpaceNormalMap:()=>Zt,TetrahedronGeometry:()=>mc,Texture:()=>Ci,TextureLoader:()=>ph,TextureUtils:()=>Eu,TorusGeometry:()=>gc,TorusKnotGeometry:()=>vc,Triangle:()=>Yr,TriangleFanDrawMode:()=>qt,TriangleStripDrawMode:()=>Wt,TrianglesDrawMode:()=>jt,TubeGeometry:()=>yc,UVMapping:()=>ue,Uint16BufferAttribute:()=>gs,Uint32BufferAttribute:()=>ys,Uint8BufferAttribute:()=>As,Uint8ClampedBufferAttribute:()=>fs,Uniform:()=>Cd,UniformsGroup:()=>_d,UniformsLib:()=>_u,UniformsUtils:()=>qs,UnsignedByteType:()=>Re,UnsignedInt248Type:()=>Ge,UnsignedInt5999Type:()=>ze,UnsignedIntType:()=>Oe,UnsignedShort4444Type:()=>Ne,UnsignedShort5551Type:()=>Qe,UnsignedShortType:()=>Pe,VSMShadowMap:()=>f,Vector2:()=>ti,Vector3:()=>Li,Vector4:()=>wi,VectorKeyframeTrack:()=>Zc,VideoTexture:()=>qa,WebGL3DRenderTarget:()=>Ti,WebGLArrayRenderTarget:()=>Ii,WebGLCoordinateSystem:()=>Gn,WebGLCubeRenderTarget:()=>io,WebGLMultipleRenderTargets:()=>xu,WebGLRenderTarget:()=>Mi,WebGLRenderer:()=>sf,WebGLUtils:()=>XA,WebGPUCoordinateSystem:()=>zn,WireframeGeometry:()=>Ec,WrapAroundEnding:()=>zt,ZeroCurvatureEnding:()=>Qt,ZeroFactor:()=>T,ZeroSlopeEnding:()=>Gt,ZeroStencilOp:()=>on,createCanvasElement:()=>li});var r={};n.r(r),n.d(r,{computeMikkTSpaceTangents:()=>lf,computeMorphedAttributes:()=>vf,deepCloneAttribute:()=>df,deinterleaveAttribute:()=>pf,deinterleaveGeometry:()=>Af,estimateBytesUsed:()=>ff,interleaveAttributes:()=>uf,mergeAttributes:()=>hf,mergeGeometries:()=>cf,mergeGroups:()=>yf,mergeVertices:()=>mf,toCreasedNormals:()=>Ef,toTrianglesDrawMode:()=>gf});const s="171",o={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},a={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},l=0,c=1,h=2,d=3,u=0,p=1,A=2,f=3,m=0,g=1,v=2,y=0,E=1,x=2,b=3,C=4,w=5,_=100,M=101,S=102,I=103,B=104,T=200,R=201,L=202,D=203,P=204,U=205,O=206,F=207,k=208,N=209,Q=210,G=211,z=212,H=213,V=214,j=0,W=1,q=2,X=3,Y=4,J=5,K=6,Z=7,$=0,ee=1,te=2,ne=0,ie=1,re=2,se=3,oe=4,ae=5,le=6,ce=7,he="attached",de="detached",ue=300,pe=301,Ae=302,fe=303,me=304,ge=306,ve=1e3,ye=1001,Ee=1002,xe=1003,be=1004,Ce=1004,we=1005,_e=1005,Me=1006,Se=1007,Ie=1007,Be=1008,Te=1008,Re=1009,Le=1010,De=1011,Pe=1012,Ue=1013,Oe=1014,Fe=1015,ke=1016,Ne=1017,Qe=1018,Ge=1020,ze=35902,He=1021,Ve=1022,je=1023,We=1024,qe=1025,Xe=1026,Ye=1027,Je=1028,Ke=1029,Ze=1030,$e=1031,et=1032,tt=1033,nt=33776,it=33777,rt=33778,st=33779,ot=35840,at=35841,lt=35842,ct=35843,ht=36196,dt=37492,ut=37496,pt=37808,At=37809,ft=37810,mt=37811,gt=37812,vt=37813,yt=37814,Et=37815,xt=37816,bt=37817,Ct=37818,wt=37819,_t=37820,Mt=37821,St=36492,It=36494,Bt=36495,Tt=36283,Rt=36284,Lt=36285,Dt=36286,Pt=2200,Ut=2201,Ot=2202,Ft=2300,kt=2301,Nt=2302,Qt=2400,Gt=2401,zt=2402,Ht=2500,Vt=2501,jt=0,Wt=1,qt=2,Xt=3200,Yt=3201,Jt=3202,Kt=3203,Zt=0,$t=1,en="",tn="srgb",nn="srgb-linear",rn="linear",sn="srgb",on=0,an=7680,ln=7681,cn=7682,hn=7683,dn=34055,un=34056,pn=5386,An=512,fn=513,mn=514,gn=515,vn=516,yn=517,En=518,xn=519,bn=512,Cn=513,wn=514,_n=515,Mn=516,Sn=517,In=518,Bn=519,Tn=35044,Rn=35048,Ln=35040,Dn=35045,Pn=35049,Un=35041,On=35046,Fn=35050,kn=35042,Nn="100",Qn="300 es",Gn=2e3,zn=2001;class Hn{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<i;t++)n[t].call(this,e);e.target=null}}}const Vn=["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 jn=1234567;const Wn=Math.PI/180,qn=180/Math.PI;function Xn(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(Vn[255&e]+Vn[e>>8&255]+Vn[e>>16&255]+Vn[e>>24&255]+"-"+Vn[255&t]+Vn[t>>8&255]+"-"+Vn[t>>16&15|64]+Vn[t>>24&255]+"-"+Vn[63&n|128]+Vn[n>>8&255]+"-"+Vn[n>>16&255]+Vn[n>>24&255]+Vn[255&i]+Vn[i>>8&255]+Vn[i>>16&255]+Vn[i>>24&255]).toLowerCase()}function Yn(e,t,n){return Math.max(t,Math.min(n,e))}function Jn(e,t){return(e%t+t)%t}function Kn(e,t,n){return(1-n)*e+n*t}function Zn(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function $n(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const ei={DEG2RAD:Wn,RAD2DEG:qn,generateUUID:Xn,clamp:Yn,euclideanModulo:Jn,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:Kn,damp:function(e,t,n,i){return Kn(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(Jn(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(jn=e);let t=jn+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*Wn},radToDeg:function(e){return e*qn},isPowerOfTwo:function(e){return!(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((t+i)/2),h=o((t+i)/2),d=s((t-i)/2),u=o((t-i)/2),p=s((i-t)/2),A=o((i-t)/2);switch(r){case"XYX":e.set(a*h,l*d,l*u,a*c);break;case"YZY":e.set(l*u,a*h,l*d,a*c);break;case"ZXZ":e.set(l*d,l*u,a*h,a*c);break;case"XZX":e.set(a*h,l*A,l*p,a*c);break;case"YXY":e.set(l*p,a*h,l*A,a*c);break;case"ZYZ":e.set(l*A,l*p,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:$n,denormalize:Zn};class ti{constructor(e=0,t=0){ti.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,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=Yn(this.x,e.x,t.x),this.y=Yn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Yn(this.x,e,t),this.y=Yn(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Yn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Yn(n,-1,1))}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){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ni{constructor(e,t,n,i,r,s,o,a,l){ni.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,s,o,a,l)}set(e,t,n,i,r,s,o,a,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],d=n[2],u=n[5],p=n[8],A=i[0],f=i[3],m=i[6],g=i[1],v=i[4],y=i[7],E=i[2],x=i[5],b=i[8];return r[0]=s*A+o*g+a*E,r[3]=s*f+o*v+a*x,r[6]=s*m+o*y+a*b,r[1]=l*A+c*g+h*E,r[4]=l*f+c*v+h*x,r[7]=l*m+c*y+h*b,r[2]=d*A+u*g+p*E,r[5]=d*f+u*v+p*x,r[8]=d*m+u*y+p*b,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8];return t*s*c-t*o*l-n*r*c+n*o*a+i*r*l-i*s*a}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=c*s-o*l,d=o*a-c*r,u=l*r-s*a,p=t*h+n*d+i*u;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const A=1/p;return e[0]=h*A,e[1]=(i*l-c*n)*A,e[2]=(o*n-i*s)*A,e[3]=d*A,e[4]=(c*t-i*a)*A,e[5]=(i*r-o*t)*A,e[6]=u*A,e[7]=(n*a-l*t)*A,e[8]=(s*t-n*r)*A,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,s,o){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*s+l*o)+s+e,-i*l,i*a,-i*(-l*s+a*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(ii.makeScale(e,t)),this}rotate(e){return this.premultiply(ii.makeRotation(-e)),this}translate(e,t){return this.premultiply(ii.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,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)}}const ii=new ni;function ri(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}const si={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function oi(e,t){return new si[e](t)}function ai(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function li(){const e=ai("canvas");return e.style.display="block",e}const ci={};function hi(e){e in ci||(ci[e]=!0,console.warn(e))}const di=(new ni).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ui=(new ni).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function pi(){const e={enabled:!0,workingColorSpace:nn,spaces:{},convert:function(e,t,n){return!1!==this.enabled&&t!==n&&t&&n?(this.spaces[t].transfer===sn&&(e.r=fi(e.r),e.g=fi(e.g),e.b=fi(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===sn&&(e.r=mi(e.r),e.g=mi(e.g),e.b=mi(e.b)),e):e},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===en?rn:this.spaces[e].transfer},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return e.define({[nn]:{primaries:t,whitePoint:i,transfer:rn,toXYZ:di,fromXYZ:ui,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:tn},outputColorSpaceConfig:{drawingBufferColorSpace:tn}},[tn]:{primaries:t,whitePoint:i,transfer:sn,toXYZ:di,fromXYZ:ui,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:tn}}}),e}const Ai=pi();function fi(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function mi(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let gi;class vi{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===gi&&(gi=ai("canvas")),gi.width=e.width,gi.height=e.height;const n=gi.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=gi}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")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=ai("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e<r.length;e++)r[e]=255*fi(r[e]/255);return n.putImageData(i,0,0),t}if(e.data){const t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*fi(t[e]/255)):t[e]=fi(t[e]);return{data:t,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let yi=0;class Ei{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:yi++}),this.uuid=Xn(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(xi(i[t].image)):e.push(xi(i[t]))}else e=xi(i);n.url=e}return t||(e.images[this.uuid]=n),n}}function xi(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?vi.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let bi=0;class Ci extends Hn{constructor(e=Ci.DEFAULT_IMAGE,t=Ci.DEFAULT_MAPPING,n=ye,i=ye,r=Me,s=Be,o=je,a=Re,l=Ci.DEFAULT_ANISOTROPY,c=en){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:bi++}),this.uuid=Xn(),this.name="",this.source=new Ei(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new ti(0,0),this.repeat=new ti(1,1),this.center=new ti(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ni,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ue)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ve:e.x=e.x-Math.floor(e.x);break;case ye:e.x=e.x<0?0:1;break;case Ee: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 ve:e.y=e.y-Math.floor(e.y);break;case ye:e.y=e.y<0?0:1;break;case Ee:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}Ci.DEFAULT_IMAGE=null,Ci.DEFAULT_MAPPING=ue,Ci.DEFAULT_ANISOTROPY=1;class wi{constructor(e=0,t=0,n=0,i=1){wi.prototype.isVector4=!0,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){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,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}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const s=.01,o=.1,a=e.elements,l=a[0],c=a[4],h=a[8],d=a[1],u=a[5],p=a[9],A=a[2],f=a[6],m=a[10];if(Math.abs(c-d)<s&&Math.abs(h-A)<s&&Math.abs(p-f)<s){if(Math.abs(c+d)<o&&Math.abs(h+A)<o&&Math.abs(p+f)<o&&Math.abs(l+u+m-3)<o)return this.set(1,0,0,0),this;t=Math.PI;const e=(l+1)/2,a=(u+1)/2,g=(m+1)/2,v=(c+d)/4,y=(h+A)/4,E=(p+f)/4;return e>a&&e>g?e<s?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(e),i=v/n,r=y/n):a>g?a<s?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(a),n=v/i,r=E/i):g<s?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(g),n=y/r,i=E/r),this.set(n,i,r,t),this}let g=Math.sqrt((f-p)*(f-p)+(h-A)*(h-A)+(d-c)*(d-c));return Math.abs(g)<.001&&(g=1),this.x=(f-p)/g,this.y=(h-A)/g,this.z=(d-c)/g,this.w=Math.acos((l+u+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Yn(this.x,e.x,t.x),this.y=Yn(this.y,e.y,t.y),this.z=Yn(this.z,e.z,t.z),this.w=Yn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Yn(this.x,e,t),this.y=Yn(this.y,e,t),this.z=Yn(this.z,e,t),this.w=Yn(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Yn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,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.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class _i extends Hn{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new wi(0,0,e,t),this.scissorTest=!1,this.viewport=new wi(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Me,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new Ci(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const s=n.count;for(let e=0;e<s;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++)this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Ei(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Mi extends _i{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Si extends Ci{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xe,this.minFilter=xe,this.wrapR=ye,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ii extends Mi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Si(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Bi extends Ci{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xe,this.minFilter=xe,this.wrapR=ye,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ti extends Mi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Bi(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Ri{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,s,o){let a=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const d=r[s+0],u=r[s+1],p=r[s+2],A=r[s+3];if(0===o)return e[t+0]=a,e[t+1]=l,e[t+2]=c,void(e[t+3]=h);if(1===o)return e[t+0]=d,e[t+1]=u,e[t+2]=p,void(e[t+3]=A);if(h!==A||a!==d||l!==u||c!==p){let e=1-o;const t=a*d+l*u+c*p+h*A,n=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,t*n);e=Math.sin(e*s)/r,o=Math.sin(o*s)/r}const r=o*n;if(a=a*e+d*r,l=l*e+u*r,c=c*e+p*r,h=h*e+A*r,e===1-o){const e=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=e,l*=e,c*=e,h*=e}}e[t]=a,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,s){const o=n[i],a=n[i+1],l=n[i+2],c=n[i+3],h=r[s],d=r[s+1],u=r[s+2],p=r[s+3];return e[t]=o*p+c*h+a*u-l*d,e[t+1]=a*p+c*d+l*h-o*u,e[t+2]=l*p+c*u+o*d-a*h,e[t+3]=c*p-o*h-a*d-l*u,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=!0){const n=e._x,i=e._y,r=e._z,s=e._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),d=a(n/2),u=a(i/2),p=a(r/2);switch(s){case"XYZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"YXZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"ZXY":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"ZYX":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"YZX":this._x=d*c*h+l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h-d*u*p;break;case"XZY":this._x=d*c*h-l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h+d*u*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],o=t[5],a=t[9],l=t[2],c=t[6],h=t[10],d=n+o+h;if(d>0){const e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(c-a)*e,this._y=(r-l)*e,this._z=(s-i)*e}else if(n>o&&n>h){const e=2*Math.sqrt(1+n-o-h);this._w=(c-a)/e,this._x=.25*e,this._y=(i+s)/e,this._z=(r+l)/e}else if(o>h){const e=2*Math.sqrt(1+o-n-h);this._w=(r-l)/e,this._x=(i+s)/e,this._y=.25*e,this._z=(a+c)/e}else{const e=2*Math.sqrt(1+h-n-o);this._w=(s-i)/e,this._x=(r+l)/e,this._y=(a+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.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(Yn(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){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,s=e._w,o=t._x,a=t._y,l=t._z,c=t._w;return this._x=n*c+s*o+i*l-r*a,this._y=i*c+s*a+r*o-n*l,this._z=r*c+s*l+n*a-i*o,this._w=s*c-n*o-i*a-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,s=this._w;let o=s*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const e=1-t;return this._w=e*s+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,d=Math.sin(t*c)/l;return this._w=s*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Li{constructor(e=0,t=0,n=0){Li.prototype.isVector3=!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){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Pi.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Pi.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,s=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,s=e.y,o=e.z,a=e.w,l=2*(s*i-o*n),c=2*(o*t-r*i),h=2*(r*n-s*t);return this.x=t+a*l+s*h-o*c,this.y=n+a*c+o*l-r*h,this.z=i+a*h+r*c-s*l,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=Yn(this.x,e.x,t.x),this.y=Yn(this.y,e.y,t.y),this.z=Yn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Yn(this.x,e,t),this.y=Yn(this.y,e,t),this.z=Yn(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Yn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,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){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,s=t.x,o=t.y,a=t.z;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-i*s,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Di.copy(this).projectOnVector(e),this.sub(Di)}reflect(e){return this.sub(Di.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(Yn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Di=new Li,Pi=new Ri;class Ui{constructor(e=new Li(1/0,1/0,1/0),t=new Li(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Fi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Fi.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Fi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===t&&void 0!==i&&!0!==e.isInstancedMesh)for(let t=0,n=i.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,Fi):Fi.fromBufferAttribute(i,t),Fi.applyMatrix4(e.matrixWorld),this.expandByPoint(Fi);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),ki.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),ki.copy(n.boundingBox)),ki.applyMatrix4(e.matrixWorld),this.union(ki)}const i=e.children;for(let e=0,n=i.length;e<n;e++)this.expandByObject(i[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Fi),Fi.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(ji),Wi.subVectors(this.max,ji),Ni.subVectors(e.a,ji),Qi.subVectors(e.b,ji),Gi.subVectors(e.c,ji),zi.subVectors(Qi,Ni),Hi.subVectors(Gi,Qi),Vi.subVectors(Ni,Gi);let t=[0,-zi.z,zi.y,0,-Hi.z,Hi.y,0,-Vi.z,Vi.y,zi.z,0,-zi.x,Hi.z,0,-Hi.x,Vi.z,0,-Vi.x,-zi.y,zi.x,0,-Hi.y,Hi.x,0,-Vi.y,Vi.x,0];return!!Yi(t,Ni,Qi,Gi,Wi)&&(t=[1,0,0,0,1,0,0,0,1],!!Yi(t,Ni,Qi,Gi,Wi)&&(qi.crossVectors(zi,Hi),t=[qi.x,qi.y,qi.z],Yi(t,Ni,Qi,Gi,Wi)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Fi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(Fi).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()||(Oi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Oi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Oi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Oi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Oi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Oi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Oi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Oi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Oi)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Oi=[new Li,new Li,new Li,new Li,new Li,new Li,new Li,new Li],Fi=new Li,ki=new Ui,Ni=new Li,Qi=new Li,Gi=new Li,zi=new Li,Hi=new Li,Vi=new Li,ji=new Li,Wi=new Li,qi=new Li,Xi=new Li;function Yi(e,t,n,i,r){for(let s=0,o=e.length-3;s<=o;s+=3){Xi.fromArray(e,s);const o=r.x*Math.abs(Xi.x)+r.y*Math.abs(Xi.y)+r.z*Math.abs(Xi.z),a=t.dot(Xi),l=n.dot(Xi),c=i.dot(Xi);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const Ji=new Ui,Ki=new Li,Zi=new Li;class $i{constructor(e=new Li,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):Ji.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;t<r;t++)i=Math.max(i,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ki.subVectors(e,this.center);const t=Ki.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(Ki,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(Zi.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ki.copy(e.center).add(Zi)),this.expandByPoint(Ki.copy(e.center).sub(Zi))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const er=new Li,tr=new Li,nr=new Li,ir=new Li,rr=new Li,sr=new Li,or=new Li;class ar{constructor(e=new Li,t=new Li(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,er)),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.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=er.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(er.copy(this.origin).addScaledVector(this.direction,t),er.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){tr.copy(e).add(t).multiplyScalar(.5),nr.copy(t).sub(e).normalize(),ir.copy(this.origin).sub(tr);const r=.5*e.distanceTo(t),s=-this.direction.dot(nr),o=ir.dot(this.direction),a=-ir.dot(nr),l=ir.lengthSq(),c=Math.abs(1-s*s);let h,d,u,p;if(c>0)if(h=s*a-o,d=s*o-a,p=r*c,h>=0)if(d>=-p)if(d<=p){const e=1/c;h*=e,d*=e,u=h*(h+s*d+2*o)+d*(s*h+d+2*a)+l}else d=r,h=Math.max(0,-(s*d+o)),u=-h*h+d*(d+2*a)+l;else d=-r,h=Math.max(0,-(s*d+o)),u=-h*h+d*(d+2*a)+l;else d<=-p?(h=Math.max(0,-(-s*r+o)),d=h>0?-r:Math.min(Math.max(-r,-a),r),u=-h*h+d*(d+2*a)+l):d<=p?(h=0,d=Math.min(Math.max(-r,-a),r),u=d*(d+2*a)+l):(h=Math.max(0,-(s*r+o)),d=h>0?r:Math.min(Math.max(-r,-a),r),u=-h*h+d*(d+2*a)+l);else d=s>0?-r:r,h=Math.max(0,-(s*d+o)),u=-h*h+d*(d+2*a)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(tr).addScaledVector(nr,d),u}intersectSphere(e,t){er.subVectors(e.center,this.origin);const n=er.dot(this.direction),i=er.dot(er)-n*n,r=e.radius*e.radius;if(i>r)return null;const s=Math.sqrt(r-i),o=n-s,a=n+s;return a<0?null:o<0?this.at(a,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),c>=0?(r=(e.min.y-d.y)*c,s=(e.max.y-d.y)*c):(r=(e.max.y-d.y)*c,s=(e.min.y-d.y)*c),n>s||r>i?null:((r>n||isNaN(n))&&(n=r),(s<i||isNaN(i))&&(i=s),h>=0?(o=(e.min.z-d.z)*h,a=(e.max.z-d.z)*h):(o=(e.max.z-d.z)*h,a=(e.min.z-d.z)*h),n>a||o>i?null:((o>n||n!=n)&&(n=o),(a<i||i!=i)&&(i=a),i<0?null:this.at(n>=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,er)}intersectTriangle(e,t,n,i,r){rr.subVectors(t,e),sr.subVectors(n,e),or.crossVectors(rr,sr);let s,o=this.direction.dot(or);if(o>0){if(i)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}ir.subVectors(this.origin,e);const a=s*this.direction.dot(sr.crossVectors(ir,sr));if(a<0)return null;const l=s*this.direction.dot(rr.cross(ir));if(l<0)return null;if(a+l>o)return null;const c=-s*ir.dot(or);return c<0?null:this.at(c/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class lr{constructor(e,t,n,i,r,s,o,a,l,c,h,d,u,p,A,f){lr.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,s,o,a,l,c,h,d,u,p,A,f)}set(e,t,n,i,r,s,o,a,l,c,h,d,u,p,A,f){const m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=i,m[1]=r,m[5]=s,m[9]=o,m[13]=a,m[2]=l,m[6]=c,m[10]=h,m[14]=d,m[3]=u,m[7]=p,m[11]=A,m[15]=f,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 lr).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/cr.setFromMatrixColumn(e,0).length(),r=1/cr.setFromMatrixColumn(e,1).length(),s=1/cr.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){const t=this.elements,n=e.x,i=e.y,r=e.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){const e=s*c,n=s*h,i=o*c,r=o*h;t[0]=a*c,t[4]=-a*h,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-o*a,t[2]=r-e*l,t[6]=i+n*l,t[10]=s*a}else if("YXZ"===e.order){const e=a*c,n=a*h,i=l*c,r=l*h;t[0]=e+r*o,t[4]=i*o-n,t[8]=s*l,t[1]=s*h,t[5]=s*c,t[9]=-o,t[2]=n*o-i,t[6]=r+e*o,t[10]=s*a}else if("ZXY"===e.order){const e=a*c,n=a*h,i=l*c,r=l*h;t[0]=e-r*o,t[4]=-s*h,t[8]=i+n*o,t[1]=n+i*o,t[5]=s*c,t[9]=r-e*o,t[2]=-s*l,t[6]=o,t[10]=s*a}else if("ZYX"===e.order){const e=s*c,n=s*h,i=o*c,r=o*h;t[0]=a*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=a*h,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=o*a,t[10]=s*a}else if("YZX"===e.order){const e=s*a,n=s*l,i=o*a,r=o*l;t[0]=a*c,t[4]=r-e*h,t[8]=i*h+n,t[1]=h,t[5]=s*c,t[9]=-o*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-r*h}else if("XZY"===e.order){const e=s*a,n=s*l,i=o*a,r=o*l;t[0]=a*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=s*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=o*c,t[10]=r*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(dr,e,ur)}lookAt(e,t,n){const i=this.elements;return fr.subVectors(e,t),0===fr.lengthSq()&&(fr.z=1),fr.normalize(),pr.crossVectors(n,fr),0===pr.lengthSq()&&(1===Math.abs(n.z)?fr.x+=1e-4:fr.z+=1e-4,fr.normalize(),pr.crossVectors(n,fr)),pr.normalize(),Ar.crossVectors(fr,pr),i[0]=pr.x,i[4]=Ar.x,i[8]=fr.x,i[1]=pr.y,i[5]=Ar.y,i[9]=fr.y,i[2]=pr.z,i[6]=Ar.z,i[10]=fr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],d=n[9],u=n[13],p=n[2],A=n[6],f=n[10],m=n[14],g=n[3],v=n[7],y=n[11],E=n[15],x=i[0],b=i[4],C=i[8],w=i[12],_=i[1],M=i[5],S=i[9],I=i[13],B=i[2],T=i[6],R=i[10],L=i[14],D=i[3],P=i[7],U=i[11],O=i[15];return r[0]=s*x+o*_+a*B+l*D,r[4]=s*b+o*M+a*T+l*P,r[8]=s*C+o*S+a*R+l*U,r[12]=s*w+o*I+a*L+l*O,r[1]=c*x+h*_+d*B+u*D,r[5]=c*b+h*M+d*T+u*P,r[9]=c*C+h*S+d*R+u*U,r[13]=c*w+h*I+d*L+u*O,r[2]=p*x+A*_+f*B+m*D,r[6]=p*b+A*M+f*T+m*P,r[10]=p*C+A*S+f*R+m*U,r[14]=p*w+A*I+f*L+m*O,r[3]=g*x+v*_+y*B+E*D,r[7]=g*b+v*M+y*T+E*P,r[11]=g*C+v*S+y*R+E*U,r[15]=g*w+v*I+y*L+E*O,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],s=e[1],o=e[5],a=e[9],l=e[13],c=e[2],h=e[6],d=e[10],u=e[14];return e[3]*(+r*a*h-i*l*h-r*o*d+n*l*d+i*o*u-n*a*u)+e[7]*(+t*a*u-t*l*d+r*s*d-i*s*u+i*l*c-r*a*c)+e[11]*(+t*l*h-t*o*u-r*s*h+n*s*u+r*o*c-n*l*c)+e[15]*(-i*o*c-t*a*h+t*o*d+i*s*h-n*s*d+n*a*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=e[9],d=e[10],u=e[11],p=e[12],A=e[13],f=e[14],m=e[15],g=h*f*l-A*d*l+A*a*u-o*f*u-h*a*m+o*d*m,v=p*d*l-c*f*l-p*a*u+s*f*u+c*a*m-s*d*m,y=c*A*l-p*h*l+p*o*u-s*A*u-c*o*m+s*h*m,E=p*h*a-c*A*a-p*o*d+s*A*d+c*o*f-s*h*f,x=t*g+n*v+i*y+r*E;if(0===x)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/x;return e[0]=g*b,e[1]=(A*d*r-h*f*r-A*i*u+n*f*u+h*i*m-n*d*m)*b,e[2]=(o*f*r-A*a*r+A*i*l-n*f*l-o*i*m+n*a*m)*b,e[3]=(h*a*r-o*d*r-h*i*l+n*d*l+o*i*u-n*a*u)*b,e[4]=v*b,e[5]=(c*f*r-p*d*r+p*i*u-t*f*u-c*i*m+t*d*m)*b,e[6]=(p*a*r-s*f*r-p*i*l+t*f*l+s*i*m-t*a*m)*b,e[7]=(s*d*r-c*a*r+c*i*l-t*d*l-s*i*u+t*a*u)*b,e[8]=y*b,e[9]=(p*h*r-c*A*r-p*n*u+t*A*u+c*n*m-t*h*m)*b,e[10]=(s*A*r-p*o*r+p*n*l-t*A*l-s*n*m+t*o*m)*b,e[11]=(c*o*r-s*h*r-c*n*l+t*h*l+s*n*u-t*o*u)*b,e[12]=E*b,e[13]=(c*A*i-p*h*i+p*n*d-t*A*d-c*n*f+t*h*f)*b,e[14]=(p*o*i-s*A*i-p*n*a+t*A*a+s*n*f-t*o*f)*b,e[15]=(s*h*i-c*o*i+c*n*a-t*h*a-s*n*d+t*o*d)*b,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 e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,s=e.x,o=e.y,a=e.z,l=r*s,c=r*o;return this.set(l*s+n,l*o-i*a,l*a+i*o,0,l*o+i*a,c*o+n,c*a-i*s,0,l*a-i*o,c*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,s){return this.set(1,n,r,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,s=t._y,o=t._z,a=t._w,l=r+r,c=s+s,h=o+o,d=r*l,u=r*c,p=r*h,A=s*c,f=s*h,m=o*h,g=a*l,v=a*c,y=a*h,E=n.x,x=n.y,b=n.z;return i[0]=(1-(A+m))*E,i[1]=(u+y)*E,i[2]=(p-v)*E,i[3]=0,i[4]=(u-y)*x,i[5]=(1-(d+m))*x,i[6]=(f+g)*x,i[7]=0,i[8]=(p+v)*b,i[9]=(f-g)*b,i[10]=(1-(d+A))*b,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=cr.set(i[0],i[1],i[2]).length();const s=cr.set(i[4],i[5],i[6]).length(),o=cr.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],hr.copy(this);const a=1/r,l=1/s,c=1/o;return hr.elements[0]*=a,hr.elements[1]*=a,hr.elements[2]*=a,hr.elements[4]*=l,hr.elements[5]*=l,hr.elements[6]*=l,hr.elements[8]*=c,hr.elements[9]*=c,hr.elements[10]*=c,t.setFromRotationMatrix(hr),n.x=r,n.y=s,n.z=o,this}makePerspective(e,t,n,i,r,s,o=Gn){const a=this.elements,l=2*r/(t-e),c=2*r/(n-i),h=(t+e)/(t-e),d=(n+i)/(n-i);let u,p;if(o===Gn)u=-(s+r)/(s-r),p=-2*s*r/(s-r);else{if(o!==zn)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);u=-s/(s-r),p=-s*r/(s-r)}return a[0]=l,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=c,a[9]=d,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,r,s,o=Gn){const a=this.elements,l=1/(t-e),c=1/(n-i),h=1/(s-r),d=(t+e)*l,u=(n+i)*c;let p,A;if(o===Gn)p=(s+r)*h,A=-2*h;else{if(o!==zn)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);p=r*h,A=-1*h}return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-d,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=A,a[14]=-p,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}}const cr=new Li,hr=new lr,dr=new Li(0,0,0),ur=new Li(1,1,1),pr=new Li,Ar=new Li,fr=new Li,mr=new lr,gr=new Ri;class vr{constructor(e=0,t=0,n=0,i=vr.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],s=i[4],o=i[8],a=i[1],l=i[5],c=i[9],h=i[2],d=i[6],u=i[10];switch(t){case"XYZ":this._y=Math.asin(Yn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Yn(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,u),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Yn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,u),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-Yn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Yn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,u));break;case"XZY":this._z=Math.asin(-Yn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,u),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 mr.makeRotationFromQuaternion(e),this.setFromRotationMatrix(mr,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return gr.setFromEuler(this),this.setFromQuaternion(gr,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}vr.DEFAULT_ORDER="XYZ";class yr{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return!!(this.mask&e.mask)}isEnabled(e){return!!(this.mask&1<<e)}}let Er=0;const xr=new Li,br=new Ri,Cr=new lr,wr=new Li,_r=new Li,Mr=new Li,Sr=new Ri,Ir=new Li(1,0,0),Br=new Li(0,1,0),Tr=new Li(0,0,1),Rr={type:"added"},Lr={type:"removed"},Dr={type:"childadded",child:null},Pr={type:"childremoved",child:null};class Ur extends Hn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Er++}),this.uuid=Xn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ur.DEFAULT_UP.clone();const e=new Li,t=new vr,n=new Ri,i=new Li(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new lr},normalMatrix:{value:new ni}}),this.matrix=new lr,this.matrixWorld=new lr,this.matrixAutoUpdate=Ur.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ur.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new yr,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return br.setFromAxisAngle(e,t),this.quaternion.multiply(br),this}rotateOnWorldAxis(e,t){return br.setFromAxisAngle(e,t),this.quaternion.premultiply(br),this}rotateX(e){return this.rotateOnAxis(Ir,e)}rotateY(e){return this.rotateOnAxis(Br,e)}rotateZ(e){return this.rotateOnAxis(Tr,e)}translateOnAxis(e,t){return xr.copy(e).applyQuaternion(this.quaternion),this.position.add(xr.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ir,e)}translateY(e){return this.translateOnAxis(Br,e)}translateZ(e){return this.translateOnAxis(Tr,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Cr.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?wr.copy(e):wr.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),_r.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Cr.lookAt(_r,wr,this.up):Cr.lookAt(wr,_r,this.up),this.quaternion.setFromRotationMatrix(Cr),i&&(Cr.extractRotation(i.matrixWorld),br.setFromRotationMatrix(Cr),this.quaternion.premultiply(br.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Rr),Dr.child=e,this.dispatchEvent(Dr),Dr.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Lr),Pr.child=e,this.dispatchEvent(Pr),Pr.child=null),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Cr.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Cr.multiply(e.parent.matrixWorld)),e.applyMatrix4(Cr),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Rr),Dr.child=e,this.dispatchEvent(Dr),Dr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,s=i.length;r<s;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_r,e,Mr),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_r,Sr,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){const t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map((e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()}))),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const i=n[t];r(e.shapes,i)}else r(e.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let n=0,i=this.material.length;n<i;n++)t.push(r(e.materials,this.material[n]));i.material=t}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){const n=this.animations[t];i.animations.push(r(e.animations,n))}}if(t){const t=s(e.geometries),i=s(e.materials),r=s(e.textures),o=s(e.images),a=s(e.shapes),l=s(e.skeletons),c=s(e.animations),h=s(e.nodes);t.length>0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];this.add(n.clone())}return this}}Ur.DEFAULT_UP=new Li(0,1,0),Ur.DEFAULT_MATRIX_AUTO_UPDATE=!0,Ur.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Or=new Li,Fr=new Li,kr=new Li,Nr=new Li,Qr=new Li,Gr=new Li,zr=new Li,Hr=new Li,Vr=new Li,jr=new Li,Wr=new wi,qr=new wi,Xr=new wi;class Yr{constructor(e=new Li,t=new Li,n=new Li){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Or.subVectors(e,t),i.cross(Or);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Or.subVectors(i,t),Fr.subVectors(n,t),kr.subVectors(e,t);const s=Or.dot(Or),o=Or.dot(Fr),a=Or.dot(kr),l=Fr.dot(Fr),c=Fr.dot(kr),h=s*l-o*o;if(0===h)return r.set(0,0,0),null;const d=1/h,u=(l*a-o*c)*d,p=(s*c-o*a)*d;return r.set(1-u-p,p,u)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,Nr)&&Nr.x>=0&&Nr.y>=0&&Nr.x+Nr.y<=1}static getInterpolation(e,t,n,i,r,s,o,a){return null===this.getBarycoord(e,t,n,i,Nr)?(a.x=0,a.y=0,"z"in a&&(a.z=0),"w"in a&&(a.w=0),null):(a.setScalar(0),a.addScaledVector(r,Nr.x),a.addScaledVector(s,Nr.y),a.addScaledVector(o,Nr.z),a)}static getInterpolatedAttribute(e,t,n,i,r,s){return Wr.setScalar(0),qr.setScalar(0),Xr.setScalar(0),Wr.fromBufferAttribute(e,t),qr.fromBufferAttribute(e,n),Xr.fromBufferAttribute(e,i),s.setScalar(0),s.addScaledVector(Wr,r.x),s.addScaledVector(qr,r.y),s.addScaledVector(Xr,r.z),s}static isFrontFacing(e,t,n,i){return Or.subVectors(n,t),Fr.subVectors(e,t),Or.cross(Fr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Or.subVectors(this.c,this.b),Fr.subVectors(this.a,this.b),.5*Or.cross(Fr).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Yr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Yr.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Yr.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Yr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Yr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let s,o;Qr.subVectors(i,n),Gr.subVectors(r,n),Hr.subVectors(e,n);const a=Qr.dot(Hr),l=Gr.dot(Hr);if(a<=0&&l<=0)return t.copy(n);Vr.subVectors(e,i);const c=Qr.dot(Vr),h=Gr.dot(Vr);if(c>=0&&h<=c)return t.copy(i);const d=a*h-c*l;if(d<=0&&a>=0&&c<=0)return s=a/(a-c),t.copy(n).addScaledVector(Qr,s);jr.subVectors(e,r);const u=Qr.dot(jr),p=Gr.dot(jr);if(p>=0&&u<=p)return t.copy(r);const A=u*l-a*p;if(A<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(n).addScaledVector(Gr,o);const f=c*p-u*h;if(f<=0&&h-c>=0&&u-p>=0)return zr.subVectors(r,i),o=(h-c)/(h-c+(u-p)),t.copy(i).addScaledVector(zr,o);const m=1/(f+A+d);return s=A*m,o=d*m,t.copy(n).addScaledVector(Qr,s).addScaledVector(Gr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Jr={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},Kr={h:0,s:0,l:0},Zr={h:0,s:0,l:0};function $r(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}class es{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=tn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Ai.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Ai.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ai.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Ai.workingColorSpace){if(e=Jn(e,1),t=Yn(t,0,1),n=Yn(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=$r(r,i,e+1/3),this.g=$r(r,i,e),this.b=$r(r,i,e-1/3)}return Ai.toWorkingColorSpace(this,i),this}setStyle(e,t=tn){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const s=i[1],o=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=tn){const n=Jr[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=fi(e.r),this.g=fi(e.g),this.b=fi(e.b),this}copyLinearToSRGB(e){return this.r=mi(e.r),this.g=mi(e.g),this.b=mi(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=tn){return Ai.fromWorkingColorSpace(ts.copy(this),e),65536*Math.round(Yn(255*ts.r,0,255))+256*Math.round(Yn(255*ts.g,0,255))+Math.round(Yn(255*ts.b,0,255))}getHexString(e=tn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ai.workingColorSpace){Ai.fromWorkingColorSpace(ts.copy(this),t);const n=ts.r,i=ts.g,r=ts.b,s=Math.max(n,i,r),o=Math.min(n,i,r);let a,l;const c=(o+s)/2;if(o===s)a=0,l=0;else{const e=s-o;switch(l=c<=.5?e/(s+o):e/(2-s-o),s){case n:a=(i-r)/e+(i<r?6:0);break;case i:a=(r-n)/e+2;break;case r:a=(n-i)/e+4}a/=6}return e.h=a,e.s=l,e.l=c,e}getRGB(e,t=Ai.workingColorSpace){return Ai.fromWorkingColorSpace(ts.copy(this),t),e.r=ts.r,e.g=ts.g,e.b=ts.b,e}getStyle(e=tn){Ai.fromWorkingColorSpace(ts.copy(this),e);const t=ts.r,n=ts.g,i=ts.b;return e!==tn?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(e,t,n){return this.getHSL(Kr),this.setHSL(Kr.h+e,Kr.s+t,Kr.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Kr),e.getHSL(Zr);const n=Kn(Kr.h,Zr.h,t),i=Kn(Kr.s,Zr.s,t),r=Kn(Kr.l,Zr.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const ts=new es;es.NAMES=Jr;let ns=0;class is extends Hn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ns++}),this.uuid=Xn(),this.name="",this.type="Material",this.blending=E,this.side=m,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=P,this.blendDst=U,this.blendEquation=_,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new es(0,0,0),this.blendAlpha=0,this.depthFunc=X,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=xn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=an,this.stencilZFail=an,this.stencilZPass=an,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);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.Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),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&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==E&&(n.blending=this.blending),this.side!==m&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==P&&(n.blendSrc=this.blendSrc),this.blendDst!==U&&(n.blendDst=this.blendDst),this.blendEquation!==_&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==X&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==xn&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==an&&(n.stencilFail=this.stencilFail),this.stencilZFail!==an&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==an&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),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=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let 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.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class rs extends is{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new es(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vr,this.combine=$,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const ss=os();function os(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(i[e]=0,i[256|e]=32768,r[e]=24,r[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,r[e]=-t-1,r[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,r[e]=13,r[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,r[e]=24,r[256|e]=24):(i[e]=31744,i[256|e]=64512,r[e]=13,r[256|e]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,s[e]=t|n}for(let e=1024;e<2048;++e)s[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)o[e]=e<<23;o[31]=1199570944,o[32]=2147483648;for(let e=33;e<63;++e)o[e]=2147483648+(e-32<<23);o[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(a[e]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function as(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Yn(e,-65504,65504),ss.floatView[0]=e;const t=ss.uint32View[0],n=t>>23&511;return ss.baseTable[n]+((8388607&t)>>ss.shiftTable[n])}function ls(e){const t=e>>10;return ss.uint32View[0]=ss.mantissaTable[ss.offsetTable[t]+(1023&e)]+ss.exponentTable[t],ss.floatView[0]}const cs={toHalfFloat:as,fromHalfFloat:ls},hs=new Li,ds=new ti;class us{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=Tn,this.updateRanges=[],this.gpuType=Fe,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)ds.fromBufferAttribute(this,t),ds.applyMatrix3(e),this.setXY(t,ds.x,ds.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)hs.fromBufferAttribute(this,t),hs.applyMatrix3(e),this.setXYZ(t,hs.x,hs.y,hs.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)hs.fromBufferAttribute(this,t),hs.applyMatrix4(e),this.setXYZ(t,hs.x,hs.y,hs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)hs.fromBufferAttribute(this,t),hs.applyNormalMatrix(e),this.setXYZ(t,hs.x,hs.y,hs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)hs.fromBufferAttribute(this,t),hs.transformDirection(e),this.setXYZ(t,hs.x,hs.y,hs.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Zn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=$n(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Zn(t,this.array)),t}setX(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Zn(t,this.array)),t}setY(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Zn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Zn(t,this.array)),t}setW(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array),r=$n(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Tn&&(e.usage=this.usage),e}}class ps extends us{constructor(e,t,n){super(new Int8Array(e),t,n)}}class As extends us{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class fs extends us{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class ms extends us{constructor(e,t,n){super(new Int16Array(e),t,n)}}class gs extends us{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class vs extends us{constructor(e,t,n){super(new Int32Array(e),t,n)}}class ys extends us{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Es extends us{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=ls(this.array[e*this.itemSize]);return this.normalized&&(t=Zn(t,this.array)),t}setX(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize]=as(t),this}getY(e){let t=ls(this.array[e*this.itemSize+1]);return this.normalized&&(t=Zn(t,this.array)),t}setY(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+1]=as(t),this}getZ(e){let t=ls(this.array[e*this.itemSize+2]);return this.normalized&&(t=Zn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+2]=as(t),this}getW(e){let t=ls(this.array[e*this.itemSize+3]);return this.normalized&&(t=Zn(t,this.array)),t}setW(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+3]=as(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array)),this.array[e+0]=as(t),this.array[e+1]=as(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array)),this.array[e+0]=as(t),this.array[e+1]=as(n),this.array[e+2]=as(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array),r=$n(r,this.array)),this.array[e+0]=as(t),this.array[e+1]=as(n),this.array[e+2]=as(i),this.array[e+3]=as(r),this}}class xs extends us{constructor(e,t,n){super(new Float32Array(e),t,n)}}let bs=0;const Cs=new lr,ws=new Ur,_s=new Li,Ms=new Ui,Ss=new Ui,Is=new Li;class Bs extends Hn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:bs++}),this.uuid=Xn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=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(ri(e)?ys:gs)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}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 ni).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 Cs.makeRotationFromQuaternion(e),this.applyMatrix4(Cs),this}rotateX(e){return Cs.makeRotationX(e),this.applyMatrix4(Cs),this}rotateY(e){return Cs.makeRotationY(e),this.applyMatrix4(Cs),this}rotateZ(e){return Cs.makeRotationZ(e),this.applyMatrix4(Cs),this}translate(e,t,n){return Cs.makeTranslation(e,t,n),this.applyMatrix4(Cs),this}scale(e,t,n){return Cs.makeScale(e,t,n),this.applyMatrix4(Cs),this}lookAt(e){return ws.lookAt(e),ws.updateMatrix(),this.applyMatrix4(ws.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(_s).negate(),this.translate(_s.x,_s.y,_s.z),this}setFromPoints(e){const t=this.getAttribute("position");if(void 0===t){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n];t.push(i.x,i.y,i.z||0)}this.setAttribute("position",new xs(t,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const n=e[i];t.setXYZ(i,n.x,n.y,n.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Ui);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Li(-1/0,-1/0,-1/0),new Li(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];Ms.setFromBufferAttribute(n),this.morphTargetsRelative?(Is.addVectors(this.boundingBox.min,Ms.min),this.boundingBox.expandByPoint(Is),Is.addVectors(this.boundingBox.max,Ms.max),this.boundingBox.expandByPoint(Is)):(this.boundingBox.expandByPoint(Ms.min),this.boundingBox.expandByPoint(Ms.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new $i);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new Li,1/0);if(e){const n=this.boundingSphere.center;if(Ms.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];Ss.setFromBufferAttribute(n),this.morphTargetsRelative?(Is.addVectors(Ms.min,Ss.min),Ms.expandByPoint(Is),Is.addVectors(Ms.max,Ss.max),Ms.expandByPoint(Is)):(Ms.expandByPoint(Ss.min),Ms.expandByPoint(Ss.max))}Ms.getCenter(n);let i=0;for(let t=0,r=e.count;t<r;t++)Is.fromBufferAttribute(e,t),i=Math.max(i,n.distanceToSquared(Is));if(t)for(let r=0,s=t.length;r<s;r++){const s=t[r],o=this.morphTargetsRelative;for(let t=0,r=s.count;t<r;t++)Is.fromBufferAttribute(s,t),o&&(_s.fromBufferAttribute(e,t),Is.add(_s)),i=Math.max(i,n.distanceToSquared(Is))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.position,i=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new us(new Float32Array(4*n.count),4));const s=this.getAttribute("tangent"),o=[],a=[];for(let e=0;e<n.count;e++)o[e]=new Li,a[e]=new Li;const l=new Li,c=new Li,h=new Li,d=new ti,u=new ti,p=new ti,A=new Li,f=new Li;function m(e,t,i){l.fromBufferAttribute(n,e),c.fromBufferAttribute(n,t),h.fromBufferAttribute(n,i),d.fromBufferAttribute(r,e),u.fromBufferAttribute(r,t),p.fromBufferAttribute(r,i),c.sub(l),h.sub(l),u.sub(d),p.sub(d);const s=1/(u.x*p.y-p.x*u.y);isFinite(s)&&(A.copy(c).multiplyScalar(p.y).addScaledVector(h,-u.y).multiplyScalar(s),f.copy(h).multiplyScalar(u.x).addScaledVector(c,-p.x).multiplyScalar(s),o[e].add(A),o[t].add(A),o[i].add(A),a[e].add(f),a[t].add(f),a[i].add(f))}let g=this.groups;0===g.length&&(g=[{start:0,count:e.count}]);for(let t=0,n=g.length;t<n;++t){const n=g[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)m(e.getX(t+0),e.getX(t+1),e.getX(t+2))}const v=new Li,y=new Li,E=new Li,x=new Li;function b(e){E.fromBufferAttribute(i,e),x.copy(E);const t=o[e];v.copy(t),v.sub(E.multiplyScalar(E.dot(t))).normalize(),y.crossVectors(x,t);const n=y.dot(a[e])<0?-1:1;s.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=g.length;t<n;++t){const n=g[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)b(e.getX(t+0)),b(e.getX(t+1)),b(e.getX(t+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new us(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);const i=new Li,r=new Li,s=new Li,o=new Li,a=new Li,l=new Li,c=new Li,h=new Li;if(e)for(let d=0,u=e.count;d<u;d+=3){const u=e.getX(d+0),p=e.getX(d+1),A=e.getX(d+2);i.fromBufferAttribute(t,u),r.fromBufferAttribute(t,p),s.fromBufferAttribute(t,A),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),o.fromBufferAttribute(n,u),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,A),o.add(c),a.add(c),l.add(c),n.setXYZ(u,o.x,o.y,o.z),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(A,l.x,l.y,l.z)}else for(let e=0,o=t.count;e<o;e+=3)i.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),s.fromBufferAttribute(t,e+2),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),n.setXYZ(e+0,c.x,c.y,c.z),n.setXYZ(e+1,c.x,c.y,c.z),n.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Is.fromBufferAttribute(e,t),Is.normalize(),e.setXYZ(t,Is.x,Is.y,Is.z)}toNonIndexed(){function e(e,t){const n=e.array,i=e.itemSize,r=e.normalized,s=new n.constructor(t.length*i);let o=0,a=0;for(let r=0,l=t.length;r<l;r++){o=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*i;for(let e=0;e<i;e++)s[a++]=n[o++]}return new us(s,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Bs,n=this.index.array,i=this.attributes;for(const r in i){const s=e(i[r],n);t.setAttribute(r,s)}const r=this.morphAttributes;for(const i in r){const s=[],o=r[i];for(let t=0,i=o.length;t<i;t++){const i=e(o[t],n);s.push(i)}t.morphAttributes[i]=s}t.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let e=0,n=s.length;e<n;e++){const n=s[e];t.addGroup(n.start,n.count,n.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const 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;t<i;t++){const i=n[t];s.push(i.toJSON(e.data))}s.length>0&&(i[t]=s,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e<r;e++)n.push(i[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;const s=e.groups;for(let e=0,t=s.length;e<t;e++){const t=s[e];this.addGroup(t.start,t.count,t.materialIndex)}const o=e.boundingBox;null!==o&&(this.boundingBox=o.clone());const a=e.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Ts=new lr,Rs=new ar,Ls=new $i,Ds=new Li,Ps=new Li,Us=new Li,Os=new Li,Fs=new Li,ks=new Li,Ns=new Li,Qs=new Li;class Gs extends Ur{constructor(e=new Bs,t=new rs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(r&&o){ks.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=o[n],a=r[n];0!==i&&(Fs.fromBufferAttribute(a,e),s?ks.addScaledVector(Fs,i):ks.addScaledVector(Fs.sub(t),i))}t.add(ks)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),Ls.copy(n.boundingSphere),Ls.applyMatrix4(r),Rs.copy(e.ray).recast(e.near),!1===Ls.containsPoint(Rs.origin)){if(null===Rs.intersectSphere(Ls,Ds))return;if(Rs.origin.distanceToSquared(Ds)>(e.far-e.near)**2)return}Ts.copy(r).invert(),Rs.copy(e.ray).applyMatrix4(Ts),null!==n.boundingBox&&!1===Rs.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,Rs)}}_computeIntersections(e,t,n){let i;const r=this.geometry,s=this.material,o=r.index,a=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,d=r.groups,u=r.drawRange;if(null!==o)if(Array.isArray(s))for(let r=0,a=d.length;r<a;r++){const a=d[r],p=s[a.materialIndex];for(let r=Math.max(a.start,u.start),s=Math.min(o.count,Math.min(a.start+a.count,u.start+u.count));r<s;r+=3)i=zs(this,p,e,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=a.materialIndex,t.push(i))}else for(let r=Math.max(0,u.start),a=Math.min(o.count,u.start+u.count);r<a;r+=3)i=zs(this,s,e,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),t.push(i));else if(void 0!==a)if(Array.isArray(s))for(let r=0,o=d.length;r<o;r++){const o=d[r],p=s[o.materialIndex];for(let r=Math.max(o.start,u.start),s=Math.min(a.count,Math.min(o.start+o.count,u.start+u.count));r<s;r+=3)i=zs(this,p,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,t.push(i))}else for(let r=Math.max(0,u.start),o=Math.min(a.count,u.start+u.count);r<o;r+=3)i=zs(this,s,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),t.push(i))}}function zs(e,t,n,i,r,s,o,a,l,c){e.getVertexPosition(a,Ps),e.getVertexPosition(l,Us),e.getVertexPosition(c,Os);const h=function(e,t,n,i,r,s,o,a){let l;if(l=t.side===g?i.intersectTriangle(o,s,r,!0,a):i.intersectTriangle(r,s,o,t.side===m,a),null===l)return null;Qs.copy(a),Qs.applyMatrix4(e.matrixWorld);const c=n.ray.origin.distanceTo(Qs);return c<n.near||c>n.far?null:{distance:c,point:Qs.clone(),object:e}}(e,t,n,i,Ps,Us,Os,Ns);if(h){const e=new Li;Yr.getBarycoord(Ns,Ps,Us,Os,e),r&&(h.uv=Yr.getInterpolatedAttribute(r,a,l,c,e,new ti)),s&&(h.uv1=Yr.getInterpolatedAttribute(s,a,l,c,e,new ti)),o&&(h.normal=Yr.getInterpolatedAttribute(o,a,l,c,e,new Li),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const t={a,b:l,c,normal:new Li,materialIndex:0};Yr.getNormal(Ps,Us,Os,t.normal),h.face=t,h.barycoord=e}return h}class Hs extends Bs{constructor(e=1,t=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const a=[],l=[],c=[],h=[];let d=0,u=0;function p(e,t,n,i,r,s,p,A,f,m,g){const v=s/f,y=p/m,E=s/2,x=p/2,b=A/2,C=f+1,w=m+1;let _=0,M=0;const S=new Li;for(let s=0;s<w;s++){const o=s*y-x;for(let a=0;a<C;a++){const d=a*v-E;S[e]=d*i,S[t]=o*r,S[n]=b,l.push(S.x,S.y,S.z),S[e]=0,S[t]=0,S[n]=A>0?1:-1,c.push(S.x,S.y,S.z),h.push(a/f),h.push(1-s/m),_+=1}}for(let e=0;e<m;e++)for(let t=0;t<f;t++){const n=d+t+C*e,i=d+t+C*(e+1),r=d+(t+1)+C*(e+1),s=d+(t+1)+C*e;a.push(n,i,s),a.push(i,r,s),M+=6}o.addGroup(u,M,g),u+=M,d+=_}p("z","y","x",-1,-1,n,t,e,s,r,0),p("z","y","x",1,-1,n,t,-e,s,r,1),p("x","z","y",1,1,e,n,t,i,s,2),p("x","z","y",1,-1,e,n,-t,i,s,3),p("x","y","z",1,-1,e,t,n,i,r,4),p("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(a),this.setAttribute("position",new xs(l,3)),this.setAttribute("normal",new xs(c,3)),this.setAttribute("uv",new xs(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Hs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Vs(e){const t={};for(const n in e){t[n]={};for(const i in e[n]){const r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}}return t}function js(e){const t={};for(let n=0;n<e.length;n++){const i=Vs(e[n]);for(const e in i)t[e]=i[e]}return t}function Ws(e){const t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:Ai.workingColorSpace}const qs={clone:Vs,merge:js};class Xs extends is{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Vs(e.uniforms),this.uniformsGroups=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Ys extends Ur{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new lr,this.projectionMatrix=new lr,this.projectionMatrixInverse=new lr,this.coordinateSystem=Gn}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const Js=new Li,Ks=new ti,Zs=new ti;class $s extends Ys{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,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*qn*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Wn*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*qn*Math.atan(Math.tan(.5*Wn*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Js.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Js.x,Js.y).multiplyScalar(-e/Js.z),Js.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Js.x,Js.y).multiplyScalar(-e/Js.z)}getViewSize(e,t){return this.getViewBounds(e,Ks,Zs),t.subVectors(Zs,Ks)}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*Wn*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const e=s.fullWidth,o=s.fullHeight;r+=s.offsetX*i/e,t-=s.offsetY*n/o,i*=s.width/e,n*=s.height/o}const o=this.filmOffset;0!==o&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const eo=-90;class to extends Ur{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new $s(eo,1,e,t);i.layers=this.layers,this.add(i);const r=new $s(eo,1,e,t);r.layers=this.layers,this.add(r);const s=new $s(eo,1,e,t);s.layers=this.layers,this.add(s);const o=new $s(eo,1,e,t);o.layers=this.layers,this.add(o);const a=new $s(eo,1,e,t);a.layers=this.layers,this.add(a);const l=new $s(eo,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,s,o,a]=t;for(const e of t)this.remove(e);if(e===Gn)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),a.up.set(0,1,0),a.lookAt(0,0,-1);else{if(e!==zn)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),a.up.set(0,-1,0),a.lookAt(0,0,-1)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,s,o,a,l,c]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const A=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,s),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,a),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=A,e.setRenderTarget(n,5,i),e.render(t,c),e.setRenderTarget(h,d,u),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class no extends Ci{constructor(e,t,n,i,r,s,o,a,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:pe,n,i,r,s,o,a,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class io extends Mi{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new no(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:Me}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const 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 <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\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 <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",s=new Hs(5,5,5),o=new Xs({name:"CubemapFromEquirect",uniforms:Vs(n),vertexShader:i,fragmentShader:r,side:g,blending:y});o.uniforms.tEquirect.value=t;const a=new Gs(s,o),l=t.minFilter;return t.minFilter===Be&&(t.minFilter=Me),new to(1,10,this).update(e,a),t.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}class ro{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new es(e),this.density=t}clone(){return new ro(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class so{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new es(e),this.near=t,this.far=n}clone(){return new so(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class oo extends Ur{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new vr,this.environmentIntensity=1,this.environmentRotation=new vr,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class ao{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Tn,this.updateRanges=[],this.version=0,this.uuid=Xn()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Xn()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Xn()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const lo=new Li;class co{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)lo.fromBufferAttribute(this,t),lo.applyMatrix4(e),this.setXYZ(t,lo.x,lo.y,lo.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)lo.fromBufferAttribute(this,t),lo.applyNormalMatrix(e),this.setXYZ(t,lo.x,lo.y,lo.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)lo.fromBufferAttribute(this,t),lo.transformDirection(e),this.setXYZ(t,lo.x,lo.y,lo.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Zn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=$n(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=$n(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=$n(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=$n(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=$n(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Zn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Zn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Zn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Zn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array),r=$n(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new us(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new co(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class ho extends is{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new es(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let uo;const po=new Li,Ao=new Li,fo=new Li,mo=new ti,go=new ti,vo=new lr,yo=new Li,Eo=new Li,xo=new Li,bo=new ti,Co=new ti,wo=new ti;class _o extends Ur{constructor(e=new ho){if(super(),this.isSprite=!0,this.type="Sprite",void 0===uo){uo=new Bs;const e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),t=new ao(e,5);uo.setIndex([0,1,2,0,2,3]),uo.setAttribute("position",new co(t,3,0,!1)),uo.setAttribute("uv",new co(t,2,3,!1))}this.geometry=uo,this.material=e,this.center=new ti(.5,.5)}raycast(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ao.setFromMatrixScale(this.matrixWorld),vo.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),fo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Ao.multiplyScalar(-fo.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const s=this.center;Mo(yo.set(-.5,-.5,0),fo,s,Ao,i,r),Mo(Eo.set(.5,-.5,0),fo,s,Ao,i,r),Mo(xo.set(.5,.5,0),fo,s,Ao,i,r),bo.set(0,0),Co.set(1,0),wo.set(1,1);let o=e.ray.intersectTriangle(yo,Eo,xo,!1,po);if(null===o&&(Mo(Eo.set(-.5,.5,0),fo,s,Ao,i,r),Co.set(0,1),o=e.ray.intersectTriangle(yo,xo,Eo,!1,po),null===o))return;const a=e.ray.origin.distanceTo(po);a<e.near||a>e.far||t.push({distance:a,point:po.clone(),uv:Yr.getInterpolation(po,yo,Eo,xo,bo,Co,wo,new ti),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function Mo(e,t,n,i,r,s){mo.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(go.x=s*mo.x-r*mo.y,go.y=r*mo.x+s*mo.y):go.copy(mo),e.copy(t),e.x+=go.x,e.y+=go.y,e.applyMatrix4(vo)}const So=new Li,Io=new Li;class Bo extends Ur{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;e<n;e++){const n=t[e];this.addLevel(n.object.clone(),n.distance,n.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let r;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const e=t.splice(n,1);return this.remove(e[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let i=t[n].distance;if(t[n].object.visible&&(i-=i*t[n].hysteresis),e<i)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){So.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(So);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){So.setFromMatrixPosition(e.matrixWorld),Io.setFromMatrixPosition(this.matrixWorld);const n=So.distanceTo(Io)/e.zoom;let i,r;for(t[0].object.visible=!0,i=1,r=t.length;i<r;i++){let e=t[i].distance;if(t[i].object.visible&&(e-=e*t[i].hysteresis),!(n>=e))break;t[i-1].object.visible=!1,t[i].object.visible=!0}for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let e=0,i=n.length;e<i;e++){const i=n[e];t.object.levels.push({object:i.object.uuid,distance:i.distance,hysteresis:i.hysteresis})}return t}}const To=new Li,Ro=new wi,Lo=new wi,Do=new Li,Po=new lr,Uo=new Li,Oo=new $i,Fo=new lr,ko=new ar;class No extends Gs{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=he,this.bindMatrix=new lr,this.bindMatrixInverse=new lr,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;null===this.boundingBox&&(this.boundingBox=new Ui),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,Uo),this.boundingBox.expandByPoint(Uo)}computeBoundingSphere(){const e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new $i),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,Uo),this.boundingSphere.expandByPoint(Uo)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),Oo.copy(this.boundingSphere),Oo.applyMatrix4(i),!1!==e.ray.intersectsSphere(Oo)&&(Fo.copy(i).invert(),ko.copy(e.ray).applyMatrix4(Fo),null!==this.boundingBox&&!1===ko.intersectsBox(this.boundingBox)||this._computeIntersections(e,t,ko)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new wi,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===he?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===de?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Ro.fromBufferAttribute(i.attributes.skinIndex,e),Lo.fromBufferAttribute(i.attributes.skinWeight,e),To.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){const i=Lo.getComponent(e);if(0!==i){const r=Ro.getComponent(e);Po.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),t.addScaledVector(Do.copy(To).applyMatrix4(Po),i)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Qo extends Ur{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Go extends Ci{constructor(e=null,t=1,n=1,i,r,s,o,a,l=xe,c=xe,h,d){super(null,s,o,a,l,c,i,r,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const zo=new lr,Ho=new lr;class Vo{constructor(e=[],t=[]){this.uuid=Xn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new lr)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new lr;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=e.length;i<r;i++){const r=e[i]?e[i].matrixWorld:Ho;zo.multiplyMatrices(r,t[i]),zo.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new Vo(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Go(t,e,e,je,Fe);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const i=e.bones[n];let r=t[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new Qo),this.bones.push(r),this.boneInverses.push((new lr).fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const r=t[i];e.bones.push(r.uuid);const s=n[i];e.boneInverses.push(s.toArray())}return e}}class jo extends us{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Wo=new lr,qo=new lr,Xo=[],Yo=new Ui,Jo=new lr,Ko=new Gs,Zo=new $i;class $o extends Gs{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new jo(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,Jo)}computeBoundingBox(){const e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new Ui),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Wo),Yo.copy(e.boundingBox).applyMatrix4(Wo),this.boundingBox.union(Yo)}computeBoundingSphere(){const e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new $i),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Wo),Zo.copy(e.boundingSphere).applyMatrix4(Wo),this.boundingSphere.union(Zo)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=i[r+e]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Ko.geometry=this.geometry,Ko.material=this.material,void 0!==Ko.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Zo.copy(this.boundingSphere),Zo.applyMatrix4(n),!1!==e.ray.intersectsSphere(Zo)))for(let r=0;r<i;r++){this.getMatrixAt(r,Wo),qo.multiplyMatrices(n,Wo),Ko.matrixWorld=qo,Ko.raycast(e,Xo);for(let e=0,n=Xo.length;e<n;e++){const n=Xo[e];n.instanceId=r,n.object=this,t.push(n)}Xo.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new jo(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new Go(new Float32Array(i*this.count),i,this.count,Je,Fe));const r=this.morphTexture.source.data.data;let s=0;for(let e=0;e<n.length;e++)s+=n[e];const o=this.geometry.morphTargetsRelative?1:1-s,a=i*e;r[a]=o,r.set(n,a+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}}const ea=new Li,ta=new Li,na=new ni;class ia{constructor(e=new Li(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,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=ea.subVectors(n,t).cross(ta.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(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(ea),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(e.start).addScaledVector(n,r)}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||na.getNormalMatrix(e),i=this.coplanarPoint(ea).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)}}const ra=new $i,sa=new Li;class oa{constructor(e=new ia,t=new ia,n=new ia,i=new ia,r=new ia,s=new ia){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Gn){const n=this.planes,i=e.elements,r=i[0],s=i[1],o=i[2],a=i[3],l=i[4],c=i[5],h=i[6],d=i[7],u=i[8],p=i[9],A=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];if(n[0].setComponents(a-r,d-l,f-u,y-m).normalize(),n[1].setComponents(a+r,d+l,f+u,y+m).normalize(),n[2].setComponents(a+s,d+c,f+p,y+g).normalize(),n[3].setComponents(a-s,d-c,f-p,y-g).normalize(),n[4].setComponents(a-o,d-h,f-A,y-v).normalize(),t===Gn)n[5].setComponents(a+o,d+h,f+A,y+v).normalize();else{if(t!==zn)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(o,h,A,v).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),ra.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),ra.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ra)}intersectsSprite(e){return ra.center.set(0,0,0),ra.radius=.7071067811865476,ra.applyMatrix4(e.matrixWorld),this.intersectsSphere(ra)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(sa.x=i.normal.x>0?e.max.x:e.min.x,sa.y=i.normal.y>0?e.max.y:e.min.y,sa.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(sa)<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 aa(e,t){return e-t}function la(e,t){return e.z-t.z}function ca(e,t){return t.z-e.z}class ha{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const r=this.pool,s=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const o=r[this.index];s.push(o),this.index++,o.start=e,o.count=t,o.z=n,o.index=i}reset(){this.list.length=0,this.index=0}}const da=new lr,ua=new es(1,1,1),pa=new oa,Aa=new Ui,fa=new $i,ma=new Li,ga=new Li,va=new Li,ya=new ha,Ea=new Gs,xa=[];function ba(e,t,n=0){const i=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){const r=e.count;for(let s=0;s<r;s++)for(let r=0;r<i;r++)t.setComponent(s+n,r,e.getComponent(s,r))}else t.array.set(e.array,n*i);t.needsUpdate=!0}function Ca(e,t){if(e.constructor!==t.constructor){const n=Math.min(e.length,t.length);for(let i=0;i<n;i++)t[i]=e[i]}else{const n=Math.min(e.length,t.length);t.set(new e.constructor(e.buffer,0,n))}}class wa extends Gs{get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}constructor(e,t,n=2*t,i){super(new Bs,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let e=Math.sqrt(4*this._maxInstanceCount);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Go(t,e,e,je,Fe);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Go(t,e,e,Ke,Oe);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new Go(t,e,e,je,Fe);n.colorSpace=Ai.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(!1===this._geometryInitialized){for(const i in e.attributes){const r=e.getAttribute(i),{array:s,itemSize:o,normalized:a}=r,l=new s.constructor(n*o),c=new us(l,o,a);t.setAttribute(i,c)}if(null!==e.getIndex()){const e=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new us(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(Boolean(e.getIndex())!==Boolean(t.getIndex()))throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||!1===t[e].active)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||!1===t[e].active)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Ui);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(!1===t[n].active)continue;const i=t[n].geometryIndex;this.getMatrixAt(n,da),this.getBoundingBoxAt(i,Aa).applyMatrix4(da),e.union(Aa)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new $i);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(!1===t[n].active)continue;const i=t[n].geometryIndex;this.getMatrixAt(n,da),this.getBoundingSphereAt(i,fa).applyMatrix4(da),e.union(fa)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const t={visible:!0,active:!0,geometryIndex:e};let n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(aa),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));const i=this._matricesTexture;da.identity().toArray(i.image.data,16*n),i.needsUpdate=!0;const r=this._colorsTexture;return r&&(ua.toArray(r.image.data,4*n),r.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=-1===t?e.getAttribute("position").count:t;const s=e.getIndex();if(null!==s&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=-1===n?s.count:n),-1!==i.indexStart&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let o;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(aa),o=this._availableGeometryIds.shift(),r[o]=i):(o=this._geometryCount,this._geometryCount++,r.push(i)),this.setGeometryAt(o,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,o}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=null!==n.getIndex(),r=n.getIndex(),s=t.getIndex(),o=this._geometryInfo[e];if(i&&s.count>o.reservedIndexCount||t.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const a=o.vertexStart,l=o.reservedVertexCount;o.vertexCount=t.getAttribute("position").count;for(const e in n.attributes){const i=t.getAttribute(e),r=n.getAttribute(e);ba(i,r,a);const s=i.itemSize;for(let e=i.count,t=l;e<t;e++){const t=a+e;for(let e=0;e<s;e++)r.setComponent(t,e,0)}r.needsUpdate=!0,r.addUpdateRange(a*s,l*s)}if(i){const e=o.indexStart,n=o.reservedIndexCount;o.indexCount=t.getIndex().count;for(let t=0;t<s.count;t++)r.setX(e+t,a+s.getX(t));for(let t=s.count,i=n;t<i;t++)r.setX(e+t,a);r.needsUpdate=!0,r.addUpdateRange(e,o.reservedIndexCount)}return o.start=i?o.indexStart:o.vertexStart,o.count=i?o.indexCount:o.vertexCount,o.boundingBox=null,null!==t.boundingBox&&(o.boundingBox=t.boundingBox.clone()),o.boundingSphere=null,null!==t.boundingSphere&&(o.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||!1===t[e].active)return this;const n=this._instanceInfo;for(let t=0,i=n.length;t<i;t++)n[t].geometryIndex===e&&this.deleteInstance(t);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,i=n.map(((e,t)=>t)).sort(((e,t)=>n[e].vertexStart-n[t].vertexStart)),r=this.geometry;for(let s=0,o=n.length;s<o;s++){const o=i[s],a=n[o];if(!1!==a.active){if(null!==r.index){if(a.indexStart!==t){const{indexStart:n,vertexStart:i,reservedIndexCount:s}=a,o=r.index,l=o.array,c=e-i;for(let e=n;e<n+s;e++)l[e]=l[e]+c;o.array.copyWithin(t,n,n+s),o.addUpdateRange(t,s),a.indexStart=t}t+=a.reservedIndexCount}if(a.vertexStart!==e){const{vertexStart:t,reservedVertexCount:n}=a,i=r.attributes;for(const r in i){const s=i[r],{array:o,itemSize:a}=s;o.copyWithin(e*a,t*a,(t+n)*a),s.addUpdateRange(e*a,n*a)}a.vertexStart=e}e+=a.reservedVertexCount,a.start=r.index?a.indexStart:a.vertexStart,this._nextIndexStart=r.index?a.indexStart+a.reservedIndexCount:0,this._nextVertexStart=a.vertexStart+a.reservedVertexCount}}return this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(null===i.boundingBox){const e=new Ui,t=n.index,r=n.attributes.position;for(let n=i.start,s=i.start+i.count;n<s;n++){let i=n;t&&(i=t.getX(i)),e.expandByPoint(ma.fromBufferAttribute(r,i))}i.boundingBox=e}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(null===i.boundingSphere){const t=new $i;this.getBoundingBoxAt(e,Aa),Aa.getCenter(t.center);const r=n.index,s=n.attributes.position;let o=0;for(let e=i.start,n=i.start+i.count;e<n;e++){let n=e;r&&(n=r.getX(n)),ma.fromBufferAttribute(s,n),o=Math.max(o,t.center.distanceToSquared(ma))}t.radius=Math.sqrt(o),i.boundingSphere=t}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,16*e),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,16*e)}setColorAt(e,t){return this.validateInstanceId(e),null===this._colorsTexture&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,4*e),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,4*e)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t||(this._instanceInfo[e].visible=t,this._visibilityChanged=!0),this}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(aa);t[t.length-1]===n.length;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),r=new Int32Array(e);Ca(this._multiDrawCounts,i),Ca(this._multiDrawStarts,r),this._multiDrawCounts=i,this._multiDrawStarts=r,this._maxInstanceCount=e;const s=this._indirectTexture,o=this._matricesTexture,a=this._colorsTexture;s.dispose(),this._initIndirectTexture(),Ca(s.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),Ca(o.image.data,this._matricesTexture.image.data),a&&(a.dispose(),this._initColorsTexture(),Ca(a.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter((e=>e.active));if(Math.max(...n.map((e=>e.vertexStart+e.reservedVertexCount)))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map((e=>e.indexStart+e.reservedIndexCount)))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const i=this.geometry;i.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Bs,this._initializeGeometry(i));const r=this.geometry;i.index&&Ca(i.index.array,r.index.array);for(const e in i.attributes)Ca(i.attributes[e].array,r.attributes[e].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,s=this.geometry;Ea.material=this.material,Ea.geometry.index=s.index,Ea.geometry.attributes=s.attributes,null===Ea.geometry.boundingBox&&(Ea.geometry.boundingBox=new Ui),null===Ea.geometry.boundingSphere&&(Ea.geometry.boundingSphere=new $i);for(let s=0,o=n.length;s<o;s++){if(!n[s].visible||!n[s].active)continue;const o=n[s].geometryIndex,a=i[o];Ea.geometry.setDrawRange(a.start,a.count),this.getMatrixAt(s,Ea.matrixWorld).premultiply(r),this.getBoundingBoxAt(o,Ea.geometry.boundingBox),this.getBoundingSphereAt(o,Ea.geometry.boundingSphere),Ea.raycast(e,xa);for(let e=0,n=xa.length;e<n;e++){const n=xa[e];n.object=this,n.batchId=s,t.push(n)}xa.length=0}Ea.material=null,Ea.geometry.index=null,Ea.geometry.attributes={},Ea.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=null!==e.boundingBox?e.boundingBox.clone():null,this.boundingSphere=null!==e.boundingSphere?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map((e=>({...e,boundingBox:null!==e.boundingBox?e.boundingBox.clone():null,boundingSphere:null!==e.boundingSphere?e.boundingSphere.clone():null}))),this._instanceInfo=e._instanceInfo.map((e=>({...e}))),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const s=i.getIndex(),o=null===s?1:s.array.BYTES_PER_ELEMENT,a=this._instanceInfo,l=this._multiDrawStarts,c=this._multiDrawCounts,h=this._geometryInfo,d=this.perObjectFrustumCulled,u=this._indirectTexture,p=u.image.data;d&&(da.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),pa.setFromProjectionMatrix(da,e.coordinateSystem));let A=0;if(this.sortObjects){da.copy(this.matrixWorld).invert(),ma.setFromMatrixPosition(n.matrixWorld).applyMatrix4(da),ga.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(da);for(let e=0,t=a.length;e<t;e++)if(a[e].visible&&a[e].active){const t=a[e].geometryIndex;this.getMatrixAt(e,da),this.getBoundingSphereAt(t,fa).applyMatrix4(da);let n=!1;if(d&&(n=!pa.intersectsSphere(fa)),!n){const n=h[t],i=va.subVectors(fa.center,ma).dot(ga);ya.push(n.start,n.count,i,e)}}const e=ya.list,t=this.customSort;null===t?e.sort(r.transparent?ca:la):t.call(this,e,n);for(let t=0,n=e.length;t<n;t++){const n=e[t];l[A]=n.start*o,c[A]=n.count,p[A]=n.index,A++}ya.reset()}else for(let e=0,t=a.length;e<t;e++)if(a[e].visible&&a[e].active){const t=a[e].geometryIndex;let n=!1;if(d&&(this.getMatrixAt(e,da),this.getBoundingSphereAt(t,fa).applyMatrix4(da),n=!pa.intersectsSphere(fa)),!n){const n=h[t];l[A]=n.start*o,c[A]=n.count,p[A]=e,A++}}u.needsUpdate=!0,this._multiDrawCount=A,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,r,s){this.onBeforeRender(e,null,i,r,s)}}class _a extends is{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new es(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Ma=new Li,Sa=new Li,Ia=new lr,Ba=new ar,Ta=new $i,Ra=new Li,La=new Li;class Da extends Ur{constructor(e=new Bs,t=new _a){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,i=t.count;e<i;e++)Ma.fromBufferAttribute(t,e-1),Sa.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=Ma.distanceTo(Sa);e.setAttribute("lineDistance",new xs(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ta.copy(n.boundingSphere),Ta.applyMatrix4(i),Ta.radius+=r,!1===e.ray.intersectsSphere(Ta))return;Ia.copy(i).invert(),Ba.copy(e.ray).applyMatrix4(Ia);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,l=this.isLineSegments?2:1,c=n.index,h=n.attributes.position;if(null!==c){const n=Math.max(0,s.start),i=Math.min(c.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=c.getX(r),i=c.getX(r+1),s=Pa(this,e,Ba,a,n,i);s&&t.push(s)}if(this.isLineLoop){const r=c.getX(i-1),s=c.getX(n),o=Pa(this,e,Ba,a,r,s);o&&t.push(o)}}else{const n=Math.max(0,s.start),i=Math.min(h.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=Pa(this,e,Ba,a,r,r+1);n&&t.push(n)}if(this.isLineLoop){const r=Pa(this,e,Ba,a,i-1,n);r&&t.push(r)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function Pa(e,t,n,i,r,s){const o=e.geometry.attributes.position;if(Ma.fromBufferAttribute(o,r),Sa.fromBufferAttribute(o,s),n.distanceSqToSegment(Ma,Sa,Ra,La)>i)return;Ra.applyMatrix4(e.matrixWorld);const a=t.ray.origin.distanceTo(Ra);return a<t.near||a>t.far?void 0:{distance:a,point:La.clone().applyMatrix4(e.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:e}}const Ua=new Li,Oa=new Li;class Fa extends Da{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e<i;e+=2)Ua.fromBufferAttribute(t,e),Oa.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+Ua.distanceTo(Oa);e.setAttribute("lineDistance",new xs(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ka extends Da{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Na extends is{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new es(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Qa=new lr,Ga=new ar,za=new $i,Ha=new Li;class Va extends Ur{constructor(e=new Bs,t=new Na){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),za.copy(n.boundingSphere),za.applyMatrix4(i),za.radius+=r,!1===e.ray.intersectsSphere(za))return;Qa.copy(i).invert(),Ga.copy(e.ray).applyMatrix4(Qa);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,l=n.index,c=n.attributes.position;if(null!==l)for(let n=Math.max(0,s.start),r=Math.min(l.count,s.start+s.count);n<r;n++){const r=l.getX(n);Ha.fromBufferAttribute(c,r),ja(Ha,r,a,i,e,t,this)}else for(let n=Math.max(0,s.start),r=Math.min(c.count,s.start+s.count);n<r;n++)Ha.fromBufferAttribute(c,n),ja(Ha,n,a,i,e,t,this)}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function ja(e,t,n,i,r,s,o){const a=Ga.distanceSqToPoint(e);if(a<n){const n=new Li;Ga.closestPointToPoint(e,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}class Wa extends Ur{constructor(){super(),this.isGroup=!0,this.type="Group"}}class qa extends Ci{constructor(e,t,n,i,r,s,o,a,l){super(e,t,n,i,r,s,o,a,l),this.isVideoTexture=!0,this.minFilter=void 0!==s?s:Me,this.magFilter=void 0!==r?r:Me,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)}}class Xa extends Ci{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=xe,this.minFilter=xe,this.generateMipmaps=!1,this.needsUpdate=!0}}class Ya extends Ci{constructor(e,t,n,i,r,s,o,a,l,c,h,d){super(null,s,o,a,l,c,i,r,h,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Ja extends Ya{constructor(e,t,n,i,r,s){super(e,t,n,r,s),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=ye,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ka extends Ya{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,pe),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Za extends Ci{constructor(e,t,n,i,r,s,o,a,l){super(e,t,n,i,r,s,o,a,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class $a extends Ci{constructor(e,t,n,i,r,s,o,a,l,c=Xe){if(c!==Xe&&c!==Ye)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Xe&&(n=Oe),void 0===n&&c===Ye&&(n=Ge),super(null,i,r,s,o,a,c,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==o?o:xe,this.minFilter=void 0!==a?a:xe,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class el{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let s=1;s<=e;s++)n=this.getPoint(s/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let s;s=t||e*n[r-1];let o,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),o=n[i]-s,o<0)a=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(e,t){const n=1e-4;let i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),o=this.getPoint(r),a=t||(s.isVector2?new ti:new Li);return a.copy(o).sub(s).normalize(),a}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new Li,i=[],r=[],s=[],o=new Li,a=new lr;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new Li)}r[0]=new Li,s[0]=new Li;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),d<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),s[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),s[t]=s[t-1].clone(),o.crossVectors(i[t-1],i[t]),o.length()>Number.EPSILON){o.normalize();const e=Math.acos(Yn(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(a.makeRotationAxis(o,e))}s[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(Yn(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],t*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class tl extends el{constructor(e=0,t=0,n=1,i=1,r=0,s=2*Math.PI,o=!1,a=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(e,t=new ti){const n=t,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=s?0:i),!0!==this.aClockwise||s||(r===i?r=-i:r-=i);const o=this.aStartAngle+e*r;let a=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=a-this.aX,i=l-this.aY;a=n*e-i*t+this.aX,l=n*t+i*e+this.aY}return n.set(a,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class nl extends tl{constructor(e,t,n,i,r,s){super(e,t,n,n,i,r,s),this.isArcCurve=!0,this.type="ArcCurve"}}function il(){let e=0,t=0,n=0,i=0;function r(r,s,o,a){e=r,t=o,n=-3*r+3*s-2*o-a,i=2*r-2*s+o+a}return{initCatmullRom:function(e,t,n,i,s){r(t,n,s*(n-e),s*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,s,o,a){let l=(t-e)/s-(n-e)/(s+o)+(n-t)/o,c=(n-t)/o-(i-t)/(o+a)+(i-n)/a;l*=o,c*=o,r(t,n,l,c)},calc:function(r){const s=r*r;return e+t*r+n*s+i*(s*r)}}}const rl=new Li,sl=new il,ol=new il,al=new il;class ll extends el{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new Li){const n=t,i=this.points,r=i.length,s=(r-(this.closed?0:1))*e;let o,a,l=Math.floor(s),c=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?o=i[(l-1)%r]:(rl.subVectors(i[0],i[1]).add(i[0]),o=rl);const h=i[l%r],d=i[(l+1)%r];if(this.closed||l+2<r?a=i[(l+2)%r]:(rl.subVectors(i[r-1],i[r-2]).add(i[r-1]),a=rl),"centripetal"===this.curveType||"chordal"===this.curveType){const e="chordal"===this.curveType?.5:.25;let t=Math.pow(o.distanceToSquared(h),e),n=Math.pow(h.distanceToSquared(d),e),i=Math.pow(d.distanceToSquared(a),e);n<1e-4&&(n=1),t<1e-4&&(t=n),i<1e-4&&(i=n),sl.initNonuniformCatmullRom(o.x,h.x,d.x,a.x,t,n,i),ol.initNonuniformCatmullRom(o.y,h.y,d.y,a.y,t,n,i),al.initNonuniformCatmullRom(o.z,h.z,d.z,a.z,t,n,i)}else"catmullrom"===this.curveType&&(sl.initCatmullRom(o.x,h.x,d.x,a.x,this.tension),ol.initCatmullRom(o.y,h.y,d.y,a.y,this.tension),al.initCatmullRom(o.z,h.z,d.z,a.z,this.tension));return n.set(sl.calc(c),ol.calc(c),al.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new Li).fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function cl(e,t,n,i,r){const s=.5*(i-t),o=.5*(r-n),a=e*e;return(2*n-2*i+s+o)*(e*a)+(-3*n+3*i-2*s-o)*a+s*e+n}function hl(e,t,n,i){return function(e,t){const n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function dl(e,t,n,i,r){return function(e,t){const n=1-e;return n*n*n*t}(e,t)+function(e,t){const n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}class ul extends el{constructor(e=new ti,t=new ti,n=new ti,i=new ti){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new ti){const n=t,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(dl(e,i.x,r.x,s.x,o.x),dl(e,i.y,r.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class pl extends el{constructor(e=new Li,t=new Li,n=new Li,i=new Li){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new Li){const n=t,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(dl(e,i.x,r.x,s.x,o.x),dl(e,i.y,r.y,s.y,o.y),dl(e,i.z,r.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Al extends el{constructor(e=new ti,t=new ti){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ti){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ti){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class fl extends el{constructor(e=new Li,t=new Li){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new Li){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Li){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class ml extends el{constructor(e=new ti,t=new ti,n=new ti){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ti){const n=t,i=this.v0,r=this.v1,s=this.v2;return n.set(hl(e,i.x,r.x,s.x),hl(e,i.y,r.y,s.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class gl extends el{constructor(e=new Li,t=new Li,n=new Li){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Li){const n=t,i=this.v0,r=this.v1,s=this.v2;return n.set(hl(e,i.x,r.x,s.x),hl(e,i.y,r.y,s.y),hl(e,i.z,r.z,s.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class vl extends el{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ti){const n=t,i=this.points,r=(i.length-1)*e,s=Math.floor(r),o=r-s,a=i[0===s?s:s-1],l=i[s],c=i[s>i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(cl(o,a.x,l.x,c.x,h.x),cl(o,a.y,l.y,c.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new ti).fromArray(n))}return this}}var yl=Object.freeze({__proto__:null,ArcCurve:nl,CatmullRomCurve3:ll,CubicBezierCurve:ul,CubicBezierCurve3:pl,EllipseCurve:tl,LineCurve:Al,LineCurve3:fl,QuadraticBezierCurve:ml,QuadraticBezierCurve3:gl,SplineCurve:vl});class El extends el{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);if(!e.equals(t)){const n=!0===e.isVector2?"LineCurve":"LineCurve3";this.curves.push(new yl[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const e=i[r]-n,s=this.curves[r],o=s.getLength(),a=0===o?0:1-e/o;return s.getPointAt(a,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const s=r[i],o=s.isEllipseCurve?2*e:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?e*s.points.length:e,a=s.getPoints(o);for(let e=0;e<a.length;e++){const i=a[e];n&&n.equals(i)||(t.push(i),n=i)}}return this.autoClose&&t.length>1&&!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;t<n;t++){const n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const n=e.curves[t];this.curves.push((new yl[n.type]).fromJSON(n))}return this}}class xl extends El{constructor(e){super(),this.type="Path",this.currentPoint=new ti,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Al(this.currentPoint.clone(),new ti(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new ml(this.currentPoint.clone(),new ti(e,t),new ti(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,s){const o=new ul(this.currentPoint.clone(),new ti(e,t),new ti(n,i),new ti(r,s));return this.curves.push(o),this.currentPoint.set(r,s),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new vl(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,s){const o=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(e+o,t+a,n,i,r,s),this}absarc(e,t,n,i,r,s){return this.absellipse(e,t,n,n,i,r,s),this}ellipse(e,t,n,i,r,s,o,a){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,n,i,r,s,o,a),this}absellipse(e,t,n,i,r,s,o,a){const l=new tl(e,t,n,i,r,s,o,a);if(this.curves.length>0){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 bl extends Bs{constructor(e=[new ti(0,-.5),new ti(.5,0),new ti(0,.5)],t=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Yn(i,0,2*Math.PI);const r=[],s=[],o=[],a=[],l=[],c=1/t,h=new Li,d=new ti,u=new Li,p=new Li,A=new Li;let f=0,m=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:f=e[t+1].x-e[t].x,m=e[t+1].y-e[t].y,u.x=1*m,u.y=-f,u.z=0*m,A.copy(u),u.normalize(),a.push(u.x,u.y,u.z);break;case e.length-1:a.push(A.x,A.y,A.z);break;default:f=e[t+1].x-e[t].x,m=e[t+1].y-e[t].y,u.x=1*m,u.y=-f,u.z=0*m,p.copy(u),u.x+=A.x,u.y+=A.y,u.z+=A.z,u.normalize(),a.push(u.x,u.y,u.z),A.copy(p)}for(let r=0;r<=t;r++){const u=n+r*c*i,p=Math.sin(u),A=Math.cos(u);for(let n=0;n<=e.length-1;n++){h.x=e[n].x*p,h.y=e[n].y,h.z=e[n].x*A,s.push(h.x,h.y,h.z),d.x=r/t,d.y=n/(e.length-1),o.push(d.x,d.y);const i=a[3*n+0]*p,c=a[3*n+1],u=a[3*n+0]*A;l.push(i,c,u)}}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){const i=t+n*e.length,s=i,o=i+e.length,a=i+e.length+1,l=i+1;r.push(s,o,l),r.push(a,l,o)}this.setIndex(r),this.setAttribute("position",new xs(s,3)),this.setAttribute("uv",new xs(o,2)),this.setAttribute("normal",new xs(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bl(e.points,e.segments,e.phiStart,e.phiLength)}}class Cl extends bl{constructor(e=1,t=1,n=4,i=8){const r=new xl;r.absarc(0,-t/2,e,1.5*Math.PI,0),r.absarc(0,t/2,e,0,.5*Math.PI),super(r.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new Cl(e.radius,e.length,e.capSegments,e.radialSegments)}}class wl extends Bs{constructor(e=1,t=32,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=[],o=[],a=[],l=new Li,c=new ti;s.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let r=0,h=3;r<=t;r++,h+=3){const d=n+r/t*i;l.x=e*Math.cos(d),l.y=e*Math.sin(d),s.push(l.x,l.y,l.z),o.push(0,0,1),c.x=(s[h]/e+1)/2,c.y=(s[h+1]/e+1)/2,a.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 xs(s,3)),this.setAttribute("normal",new xs(o,3)),this.setAttribute("uv",new xs(a,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new wl(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class _l extends Bs{constructor(e=1,t=1,n=1,i=32,r=1,s=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a};const l=this;i=Math.floor(i),r=Math.floor(r);const c=[],h=[],d=[],u=[];let p=0;const A=[],f=n/2;let m=0;function g(n){const r=p,s=new ti,A=new Li;let g=0;const v=!0===n?e:t,y=!0===n?1:-1;for(let e=1;e<=i;e++)h.push(0,f*y,0),d.push(0,y,0),u.push(.5,.5),p++;const E=p;for(let e=0;e<=i;e++){const t=e/i*a+o,n=Math.cos(t),r=Math.sin(t);A.x=v*r,A.y=f*y,A.z=v*n,h.push(A.x,A.y,A.z),d.push(0,y,0),s.x=.5*n+.5,s.y=.5*r*y+.5,u.push(s.x,s.y),p++}for(let e=0;e<i;e++){const t=r+e,i=E+e;!0===n?c.push(i,i+1,t):c.push(i+1,i,t),g+=3}l.addGroup(m,g,!0===n?1:2),m+=g}!function(){const s=new Li,g=new Li;let v=0;const y=(t-e)/n;for(let l=0;l<=r;l++){const c=[],m=l/r,v=m*(t-e)+e;for(let e=0;e<=i;e++){const t=e/i,r=t*a+o,l=Math.sin(r),A=Math.cos(r);g.x=v*l,g.y=-m*n+f,g.z=v*A,h.push(g.x,g.y,g.z),s.set(l,y,A).normalize(),d.push(s.x,s.y,s.z),u.push(t,1-m),c.push(p++)}A.push(c)}for(let n=0;n<i;n++)for(let i=0;i<r;i++){const s=A[i][n],o=A[i+1][n],a=A[i+1][n+1],l=A[i][n+1];(e>0||0!==i)&&(c.push(s,o,l),v+=3),(t>0||i!==r-1)&&(c.push(o,a,l),v+=3)}l.addGroup(m,v,0),m+=v}(),!1===s&&(e>0&&g(!0),t>0&&g(!1)),this.setIndex(c),this.setAttribute("position",new xs(h,3)),this.setAttribute("normal",new xs(d,3)),this.setAttribute("uv",new xs(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _l(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ml extends _l{constructor(e=1,t=1,n=32,i=1,r=!1,s=0,o=2*Math.PI){super(0,e,t,n,i,r,s,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:o}}static fromJSON(e){return new Ml(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Sl extends Bs{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],s=[];function o(e,t,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const o=e.clone().lerp(n,i/r),a=t.clone().lerp(n,i/r),l=r-i;for(let e=0;e<=l;e++)s[i][e]=0===e&&i===r?o:o.clone().lerp(a,e/l)}for(let e=0;e<r;e++)for(let t=0;t<2*(r-e)-1;t++){const n=Math.floor(t/2);t%2==0?(a(s[e][n+1]),a(s[e+1][n]),a(s[e][n])):(a(s[e][n+1]),a(s[e+1][n+1]),a(s[e+1][n]))}}function a(e){r.push(e.x,e.y,e.z)}function l(t,n){const i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function c(e,t,n,i){i<0&&1===e.x&&(s[t]=e.x-1),0===n.x&&0===n.z&&(s[t]=i/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}!function(e){const n=new Li,i=new Li,r=new Li;for(let s=0;s<t.length;s+=3)l(t[s+0],n),l(t[s+1],i),l(t[s+2],r),o(n,i,r,e)}(i),function(e){const t=new Li;for(let n=0;n<r.length;n+=3)t.x=r[n+0],t.y=r[n+1],t.z=r[n+2],t.normalize().multiplyScalar(e),r[n+0]=t.x,r[n+1]=t.y,r[n+2]=t.z}(n),function(){const e=new Li;for(let n=0;n<r.length;n+=3){e.x=r[n+0],e.y=r[n+1],e.z=r[n+2];const i=h(e)/2/Math.PI+.5,o=(t=e,Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5);s.push(i,1-o)}var t;(function(){const e=new Li,t=new Li,n=new Li,i=new Li,o=new ti,a=new ti,l=new ti;for(let d=0,u=0;d<r.length;d+=9,u+=6){e.set(r[d+0],r[d+1],r[d+2]),t.set(r[d+3],r[d+4],r[d+5]),n.set(r[d+6],r[d+7],r[d+8]),o.set(s[u+0],s[u+1]),a.set(s[u+2],s[u+3]),l.set(s[u+4],s[u+5]),i.copy(e).add(t).add(n).divideScalar(3);const p=h(i);c(o,u+0,e,p),c(a,u+2,t,p),c(l,u+4,n,p)}})(),function(){for(let e=0;e<s.length;e+=6){const t=s[e+0],n=s[e+2],i=s[e+4],r=Math.max(t,n,i),o=Math.min(t,n,i);r>.9&&o<.1&&(t<.2&&(s[e+0]+=1),n<.2&&(s[e+2]+=1),i<.2&&(s[e+4]+=1))}}()}(),this.setAttribute("position",new xs(r,3)),this.setAttribute("normal",new xs(r.slice(),3)),this.setAttribute("uv",new xs(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sl(e.vertices,e.indices,e.radius,e.details)}}class Il extends Sl{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 Il(e.radius,e.detail)}}const Bl=new Li,Tl=new Li,Rl=new Li,Ll=new Yr;class Dl extends Bs{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const n=4,i=Math.pow(10,n),r=Math.cos(Wn*t),s=e.getIndex(),o=e.getAttribute("position"),a=s?s.count:o.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),d={},u=[];for(let e=0;e<a;e+=3){s?(l[0]=s.getX(e),l[1]=s.getX(e+1),l[2]=s.getX(e+2)):(l[0]=e,l[1]=e+1,l[2]=e+2);const{a:t,b:n,c:a}=Ll;if(t.fromBufferAttribute(o,l[0]),n.fromBufferAttribute(o,l[1]),a.fromBufferAttribute(o,l[2]),Ll.getNormal(Rl),h[0]=`${Math.round(t.x*i)},${Math.round(t.y*i)},${Math.round(t.z*i)}`,h[1]=`${Math.round(n.x*i)},${Math.round(n.y*i)},${Math.round(n.z*i)}`,h[2]=`${Math.round(a.x*i)},${Math.round(a.y*i)},${Math.round(a.z*i)}`,h[0]!==h[1]&&h[1]!==h[2]&&h[2]!==h[0])for(let e=0;e<3;e++){const t=(e+1)%3,n=h[e],i=h[t],s=Ll[c[e]],o=Ll[c[t]],a=`${n}_${i}`,p=`${i}_${n}`;p in d&&d[p]?(Rl.dot(d[p].normal)<=r&&(u.push(s.x,s.y,s.z),u.push(o.x,o.y,o.z)),d[p]=null):a in d||(d[a]={index0:l[e],index1:l[t],normal:Rl.clone()})}}for(const e in d)if(d[e]){const{index0:t,index1:n}=d[e];Bl.fromBufferAttribute(o,t),Tl.fromBufferAttribute(o,n),u.push(Bl.x,Bl.y,Bl.z),u.push(Tl.x,Tl.y,Tl.z)}this.setAttribute("position",new xs(u,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Pl extends xl{constructor(e){super(e),this.uuid=Xn(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push((new xl).fromJSON(n))}return this}}function Ul(e,t,n,i,r){let s,o;if(r===function(e,t,n,i){let r=0;for(let s=t,o=n-i;s<n;s+=i)r+=(e[o]-e[s])*(e[s+1]+e[o+1]),o=s;return r}(e,t,n,i)>0)for(s=t;s<n;s+=i)o=nc(s,e[s],e[s+1],o);else for(s=n-i;s>=t;s-=i)o=nc(s,e[s],e[s+1],o);return o&&Jl(o,o.next)&&(ic(o),o=o.next),o}function Ol(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!Jl(i,i.next)&&0!==Yl(i.prev,i,i.next))i=i.next;else{if(ic(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function Fl(e,t,n,i,r,s,o){if(!e)return;!o&&s&&function(e,t,n,i){let r=e;do{0===r.z&&(r.z=jl(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n,i,r,s,o,a,l,c=1;do{for(n=e,e=null,s=null,o=0;n;){for(o++,i=n,a=0,t=0;t<c&&(a++,i=i.nextZ,i);t++);for(l=c;a>0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(o>1)}(r)}(e,i,r,s);let a,l,c=e;for(;e.prev!==e.next;)if(a=e.prev,l=e.next,s?Nl(e,i,r,s):kl(e))t.push(a.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),ic(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?Fl(e=Ql(Ol(e),t,n),t,n,i,r,s,2):2===o&&Gl(e,t,n,i,r,s):Fl(Ol(e),t,n,i,r,s,1);break}}function kl(e){const t=e.prev,n=e,i=e.next;if(Yl(t,n,i)>=0)return!1;const r=t.x,s=n.x,o=i.x,a=t.y,l=n.y,c=i.y,h=r<s?r<o?r:o:s<o?s:o,d=a<l?a<c?a:c:l<c?l:c,u=r>s?r>o?r:o:s>o?s:o,p=a>l?a>c?a:c:l>c?l:c;let A=i.next;for(;A!==t;){if(A.x>=h&&A.x<=u&&A.y>=d&&A.y<=p&&ql(r,a,s,l,o,c,A.x,A.y)&&Yl(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function Nl(e,t,n,i){const r=e.prev,s=e,o=e.next;if(Yl(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,h=r.y,d=s.y,u=o.y,p=a<l?a<c?a:c:l<c?l:c,A=h<d?h<u?h:u:d<u?d:u,f=a>l?a>c?a:c:l>c?l:c,m=h>d?h>u?h:u:d>u?d:u,g=jl(p,A,t,n,i),v=jl(f,m,t,n,i);let y=e.prevZ,E=e.nextZ;for(;y&&y.z>=g&&E&&E.z<=v;){if(y.x>=p&&y.x<=f&&y.y>=A&&y.y<=m&&y!==r&&y!==o&&ql(a,h,l,d,c,u,y.x,y.y)&&Yl(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,E.x>=p&&E.x<=f&&E.y>=A&&E.y<=m&&E!==r&&E!==o&&ql(a,h,l,d,c,u,E.x,E.y)&&Yl(E.prev,E,E.next)>=0)return!1;E=E.nextZ}for(;y&&y.z>=g;){if(y.x>=p&&y.x<=f&&y.y>=A&&y.y<=m&&y!==r&&y!==o&&ql(a,h,l,d,c,u,y.x,y.y)&&Yl(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;E&&E.z<=v;){if(E.x>=p&&E.x<=f&&E.y>=A&&E.y<=m&&E!==r&&E!==o&&ql(a,h,l,d,c,u,E.x,E.y)&&Yl(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function Ql(e,t,n){let i=e;do{const r=i.prev,s=i.next.next;!Jl(r,s)&&Kl(r,i,i.next,s)&&ec(r,s)&&ec(s,r)&&(t.push(r.i/n|0),t.push(i.i/n|0),t.push(s.i/n|0),ic(i),ic(i.next),i=e=s),i=i.next}while(i!==e);return Ol(i)}function Gl(e,t,n,i,r,s){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&Xl(o,e)){let a=tc(o,e);return o=Ol(o,o.next),a=Ol(a,a.next),Fl(o,t,n,i,r,s,0),void Fl(a,t,n,i,r,s,0)}e=e.next}o=o.next}while(o!==e)}function zl(e,t){return e.x-t.x}function Hl(e,t){const n=function(e,t){let n,i=t,r=-1/0;const s=e.x,o=e.y;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){const e=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=s&&e>r&&(r=e,n=i.x<i.next.x?i:i.next,e===s))return n}i=i.next}while(i!==t);if(!n)return null;const a=n,l=n.x,c=n.y;let h,d=1/0;i=n;do{s>=i.x&&i.x>=l&&s!==i.x&&ql(o<c?s:r,o,l,c,o<c?r:s,o,i.x,i.y)&&(h=Math.abs(o-i.y)/(s-i.x),ec(i,e)&&(h<d||h===d&&(i.x>n.x||i.x===n.x&&Vl(n,i)))&&(n=i,d=h)),i=i.next}while(i!==a);return n}(e,t);if(!n)return t;const i=tc(n,e);return Ol(i,i.next),Ol(n,n.next)}function Vl(e,t){return Yl(e.prev,e,t.prev)<0&&Yl(t.next,e,e.next)<0}function jl(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Wl(e){let t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function ql(e,t,n,i,r,s,o,a){return(r-o)*(t-a)>=(e-o)*(s-a)&&(e-o)*(i-a)>=(n-o)*(t-a)&&(n-o)*(s-a)>=(r-o)*(i-a)}function Xl(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&&Kl(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(ec(e,t)&&ec(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)&&(Yl(e.prev,e,t.prev)||Yl(e,t.prev,t))||Jl(e,t)&&Yl(e.prev,e,e.next)>0&&Yl(t.prev,t,t.next)>0)}function Yl(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Jl(e,t){return e.x===t.x&&e.y===t.y}function Kl(e,t,n,i){const r=$l(Yl(e,t,n)),s=$l(Yl(e,t,i)),o=$l(Yl(n,i,e)),a=$l(Yl(n,i,t));return r!==s&&o!==a||!(0!==r||!Zl(e,n,t))||!(0!==s||!Zl(e,i,t))||!(0!==o||!Zl(n,e,i))||!(0!==a||!Zl(n,t,i))}function Zl(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 $l(e){return e>0?1:e<0?-1:0}function ec(e,t){return Yl(e.prev,e,e.next)<0?Yl(e,t,e.next)>=0&&Yl(e,e.prev,t)>=0:Yl(e,t,e.prev)<0||Yl(e,e.next,t)<0}function tc(e,t){const n=new rc(e.i,e.x,e.y),i=new rc(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 nc(e,t,n,i){const r=new rc(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 ic(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 rc(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class sc{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n}static isClockWise(e){return sc.area(e)<0}static triangulateShape(e,t){const n=[],i=[],r=[];oc(e),ac(n,e);let s=e.length;t.forEach(oc);for(let e=0;e<t.length;e++)i.push(s),s+=t[e].length,ac(n,t[e]);const o=function(e,t,n=2){const i=t&&t.length,r=i?t[0]*n:e.length;let s=Ul(e,0,r,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,h,d,u,p;if(i&&(s=function(e,t,n,i){const r=[];let s,o,a,l,c;for(s=0,o=t.length;s<o;s++)a=t[s]*i,l=s<o-1?t[s+1]*i:e.length,c=Ul(e,a,l,i,!1),c===c.next&&(c.steiner=!0),r.push(Wl(c));for(r.sort(zl),s=0;s<r.length;s++)n=Hl(r[s],n);return n}(e,t,s,n)),e.length>80*n){a=c=e[0],l=h=e[1];for(let t=n;t<r;t+=n)d=e[t],u=e[t+1],d<a&&(a=d),u<l&&(l=u),d>c&&(c=d),u>h&&(h=u);p=Math.max(c-a,h-l),p=0!==p?32767/p:0}return Fl(s,o,n,a,l,p,0),o}(n,i);for(let e=0;e<o.length;e+=3)r.push(o.slice(e,e+3));return r}}function oc(e){const t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function ac(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}class lc extends Bs{constructor(e=new Pl([new ti(.5,.5),new ti(-.5,.5),new ti(-.5,-.5),new ti(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let t=0,n=e.length;t<n;t++)s(e[t]);function s(e){const s=[],o=void 0!==t.curveSegments?t.curveSegments:12,a=void 0!==t.steps?t.steps:1,l=void 0!==t.depth?t.depth:1;let c=void 0===t.bevelEnabled||t.bevelEnabled,h=void 0!==t.bevelThickness?t.bevelThickness:.2,d=void 0!==t.bevelSize?t.bevelSize:h-.1,u=void 0!==t.bevelOffset?t.bevelOffset:0,p=void 0!==t.bevelSegments?t.bevelSegments:3;const A=t.extrudePath,f=void 0!==t.UVGenerator?t.UVGenerator:cc;let m,g,v,y,E,x=!1;A&&(m=A.getSpacedPoints(a),x=!0,c=!1,g=A.computeFrenetFrames(a,!1),v=new Li,y=new Li,E=new Li),c||(p=0,h=0,d=0,u=0);const b=e.extractPoints(o);let C=b.shape;const w=b.holes;if(!sc.isClockWise(C)){C=C.reverse();for(let e=0,t=w.length;e<t;e++){const t=w[e];sc.isClockWise(t)&&(w[e]=t.reverse())}}const _=sc.triangulateShape(C,w),M=C;for(let e=0,t=w.length;e<t;e++){const t=w[e];C=C.concat(t)}function S(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().addScaledVector(t,n)}const I=C.length,B=_.length;function T(e,t,n){let i,r,s;const o=e.x-t.x,a=e.y-t.y,l=n.x-e.x,c=n.y-e.y,h=o*o+a*a,d=o*c-a*l;if(Math.abs(d)>Number.EPSILON){const d=Math.sqrt(h),u=Math.sqrt(l*l+c*c),p=t.x-a/d,A=t.y+o/d,f=((n.x-c/u-p)*c-(n.y+l/u-A)*l)/(o*c-a*l);i=p+o*f-e.x,r=A+a*f-e.y;const m=i*i+r*r;if(m<=2)return new ti(i,r);s=Math.sqrt(m/2)}else{let e=!1;o>Number.EPSILON?l>Number.EPSILON&&(e=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(a)===Math.sign(c)&&(e=!0),e?(i=-a,r=o,s=Math.sqrt(h)):(i=o,r=a,s=Math.sqrt(h/2))}return new ti(i/s,r/s)}const R=[];for(let e=0,t=M.length,n=t-1,i=e+1;e<t;e++,n++,i++)n===t&&(n=0),i===t&&(i=0),R[e]=T(M[e],M[n],M[i]);const L=[];let D,P=R.concat();for(let e=0,t=w.length;e<t;e++){const t=w[e];D=[];for(let e=0,n=t.length,i=n-1,r=e+1;e<n;e++,i++,r++)i===n&&(i=0),r===n&&(r=0),D[e]=T(t[e],t[i],t[r]);L.push(D),P=P.concat(D)}for(let e=0;e<p;e++){const t=e/p,n=h*Math.cos(t*Math.PI/2),i=d*Math.sin(t*Math.PI/2)+u;for(let e=0,t=M.length;e<t;e++){const t=S(M[e],R[e],i);F(t.x,t.y,-n)}for(let e=0,t=w.length;e<t;e++){const t=w[e];D=L[e];for(let e=0,r=t.length;e<r;e++){const r=S(t[e],D[e],i);F(r.x,r.y,-n)}}}const U=d+u;for(let e=0;e<I;e++){const t=c?S(C[e],P[e],U):C[e];x?(y.copy(g.normals[0]).multiplyScalar(t.x),v.copy(g.binormals[0]).multiplyScalar(t.y),E.copy(m[0]).add(y).add(v),F(E.x,E.y,E.z)):F(t.x,t.y,0)}for(let e=1;e<=a;e++)for(let t=0;t<I;t++){const n=c?S(C[t],P[t],U):C[t];x?(y.copy(g.normals[e]).multiplyScalar(n.x),v.copy(g.binormals[e]).multiplyScalar(n.y),E.copy(m[e]).add(y).add(v),F(E.x,E.y,E.z)):F(n.x,n.y,l/a*e)}for(let e=p-1;e>=0;e--){const t=e/p,n=h*Math.cos(t*Math.PI/2),i=d*Math.sin(t*Math.PI/2)+u;for(let e=0,t=M.length;e<t;e++){const t=S(M[e],R[e],i);F(t.x,t.y,l+n)}for(let e=0,t=w.length;e<t;e++){const t=w[e];D=L[e];for(let e=0,r=t.length;e<r;e++){const r=S(t[e],D[e],i);x?F(r.x,r.y+m[a-1].y,m[a-1].x+n):F(r.x,r.y,l+n)}}}function O(e,t){let n=e.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=e.length-1);for(let e=0,n=a+2*p;e<n;e++){const n=I*e,s=I*(e+1);N(t+i+n,t+r+n,t+r+s,t+i+s)}}}function F(e,t,n){s.push(e),s.push(t),s.push(n)}function k(e,t,r){Q(e),Q(t),Q(r);const s=i.length/3,o=f.generateTopUV(n,i,s-3,s-2,s-1);G(o[0]),G(o[1]),G(o[2])}function N(e,t,r,s){Q(e),Q(t),Q(s),Q(t),Q(r),Q(s);const o=i.length/3,a=f.generateSideWallUV(n,i,o-6,o-3,o-2,o-1);G(a[0]),G(a[1]),G(a[3]),G(a[1]),G(a[2]),G(a[3])}function Q(e){i.push(s[3*e+0]),i.push(s[3*e+1]),i.push(s[3*e+2])}function G(e){r.push(e.x),r.push(e.y)}!function(){const e=i.length/3;if(c){let e=0,t=I*e;for(let e=0;e<B;e++){const n=_[e];k(n[2]+t,n[1]+t,n[0]+t)}e=a+2*p,t=I*e;for(let e=0;e<B;e++){const n=_[e];k(n[0]+t,n[1]+t,n[2]+t)}}else{for(let e=0;e<B;e++){const t=_[e];k(t[2],t[1],t[0])}for(let e=0;e<B;e++){const t=_[e];k(t[0]+I*a,t[1]+I*a,t[2]+I*a)}}n.addGroup(e,i.length/3-e,0)}(),function(){const e=i.length/3;let t=0;O(M,t),t+=M.length;for(let e=0,n=w.length;e<n;e++){const n=w[e];O(n,t),t+=n.length}n.addGroup(e,i.length/3-e,1)}()}this.setAttribute("position",new xs(i,3)),this.setAttribute("uv",new xs(r,2)),this.computeVertexNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,i=e.length;t<i;t++){const i=e[t];n.shapes.push(i.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const r=t[e.shapes[i]];n.push(r)}const i=e.options.extrudePath;return void 0!==i&&(e.options.extrudePath=(new yl[i.type]).fromJSON(i)),new lc(n,e.options)}}const cc={generateTopUV:function(e,t,n,i,r){const s=t[3*n],o=t[3*n+1],a=t[3*i],l=t[3*i+1],c=t[3*r],h=t[3*r+1];return[new ti(s,o),new ti(a,l),new ti(c,h)]},generateSideWallUV:function(e,t,n,i,r,s){const o=t[3*n],a=t[3*n+1],l=t[3*n+2],c=t[3*i],h=t[3*i+1],d=t[3*i+2],u=t[3*r],p=t[3*r+1],A=t[3*r+2],f=t[3*s],m=t[3*s+1],g=t[3*s+2];return Math.abs(a-h)<Math.abs(o-c)?[new ti(o,1-l),new ti(c,1-d),new ti(u,1-A),new ti(f,1-g)]:[new ti(a,1-l),new ti(h,1-d),new ti(p,1-A),new ti(m,1-g)]}};class hc extends Sl{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new hc(e.radius,e.detail)}}class dc extends Sl{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new dc(e.radius,e.detail)}}class uc extends Bs{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,s=t/2,o=Math.floor(n),a=Math.floor(i),l=o+1,c=a+1,h=e/o,d=t/a,u=[],p=[],A=[],f=[];for(let e=0;e<c;e++){const t=e*d-s;for(let n=0;n<l;n++){const i=n*h-r;p.push(i,-t,0),A.push(0,0,1),f.push(n/o),f.push(1-e/a)}}for(let e=0;e<a;e++)for(let t=0;t<o;t++){const n=t+l*e,i=t+l*(e+1),r=t+1+l*(e+1),s=t+1+l*e;u.push(n,i,s),u.push(i,r,s)}this.setIndex(u),this.setAttribute("position",new xs(p,3)),this.setAttribute("normal",new xs(A,3)),this.setAttribute("uv",new xs(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new uc(e.width,e.height,e.widthSegments,e.heightSegments)}}class pc extends Bs{constructor(e=.5,t=1,n=32,i=1,r=0,s=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:s},n=Math.max(3,n);const o=[],a=[],l=[],c=[];let h=e;const d=(t-e)/(i=Math.max(1,i)),u=new Li,p=new ti;for(let e=0;e<=i;e++){for(let e=0;e<=n;e++){const i=r+e/n*s;u.x=h*Math.cos(i),u.y=h*Math.sin(i),a.push(u.x,u.y,u.z),l.push(0,0,1),p.x=(u.x/t+1)/2,p.y=(u.y/t+1)/2,c.push(p.x,p.y)}h+=d}for(let e=0;e<i;e++){const t=e*(n+1);for(let e=0;e<n;e++){const i=e+t,r=i,s=i+n+1,a=i+n+2,l=i+1;o.push(r,s,l),o.push(s,a,l)}}this.setIndex(o),this.setAttribute("position",new xs(a,3)),this.setAttribute("normal",new xs(l,3)),this.setAttribute("uv",new xs(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new pc(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Ac extends Bs{constructor(e=new Pl([new ti(0,.5),new ti(-.5,-.5),new ti(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],s=[];let o=0,a=0;if(!1===Array.isArray(e))l(e);else for(let t=0;t<e.length;t++)l(e[t]),this.addGroup(o,a,t),o+=a,a=0;function l(e){const o=i.length/3,l=e.extractPoints(t);let c=l.shape;const h=l.holes;!1===sc.isClockWise(c)&&(c=c.reverse());for(let e=0,t=h.length;e<t;e++){const t=h[e];!0===sc.isClockWise(t)&&(h[e]=t.reverse())}const d=sc.triangulateShape(c,h);for(let e=0,t=h.length;e<t;e++){const t=h[e];c=c.concat(t)}for(let e=0,t=c.length;e<t;e++){const t=c[e];i.push(t.x,t.y,0),r.push(0,0,1),s.push(t.x,t.y)}for(let e=0,t=d.length;e<t;e++){const t=d[e],i=t[0]+o,r=t[1]+o,s=t[2]+o;n.push(i,r,s),a+=3}}this.setIndex(n),this.setAttribute("position",new xs(i,3)),this.setAttribute("normal",new xs(r,3)),this.setAttribute("uv",new xs(s,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return function(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,i=e.length;n<i;n++){const i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const r=t[e.shapes[i]];n.push(r)}return new Ac(n,e.curveSegments)}}class fc extends Bs{constructor(e=1,t=32,n=16,i=0,r=2*Math.PI,s=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:s,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const a=Math.min(s+o,Math.PI);let l=0;const c=[],h=new Li,d=new Li,u=[],p=[],A=[],f=[];for(let u=0;u<=n;u++){const m=[],g=u/n;let v=0;0===u&&0===s?v=.5/t:u===n&&a===Math.PI&&(v=-.5/t);for(let n=0;n<=t;n++){const a=n/t;h.x=-e*Math.cos(i+a*r)*Math.sin(s+g*o),h.y=e*Math.cos(s+g*o),h.z=e*Math.sin(i+a*r)*Math.sin(s+g*o),p.push(h.x,h.y,h.z),d.copy(h).normalize(),A.push(d.x,d.y,d.z),f.push(a+v,1-g),m.push(l++)}c.push(m)}for(let e=0;e<n;e++)for(let i=0;i<t;i++){const t=c[e][i+1],r=c[e][i],o=c[e+1][i],l=c[e+1][i+1];(0!==e||s>0)&&u.push(t,r,l),(e!==n-1||a<Math.PI)&&u.push(r,o,l)}this.setIndex(u),this.setAttribute("position",new xs(p,3)),this.setAttribute("normal",new xs(A,3)),this.setAttribute("uv",new xs(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fc(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class mc extends Sl{constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new mc(e.radius,e.detail)}}class gc extends Bs{constructor(e=1,t=.4,n=12,i=48,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const s=[],o=[],a=[],l=[],c=new Li,h=new Li,d=new Li;for(let s=0;s<=n;s++)for(let u=0;u<=i;u++){const p=u/i*r,A=s/n*Math.PI*2;h.x=(e+t*Math.cos(A))*Math.cos(p),h.y=(e+t*Math.cos(A))*Math.sin(p),h.z=t*Math.sin(A),o.push(h.x,h.y,h.z),c.x=e*Math.cos(p),c.y=e*Math.sin(p),d.subVectors(h,c).normalize(),a.push(d.x,d.y,d.z),l.push(u/i),l.push(s/n)}for(let e=1;e<=n;e++)for(let t=1;t<=i;t++){const n=(i+1)*e+t-1,r=(i+1)*(e-1)+t-1,o=(i+1)*(e-1)+t,a=(i+1)*e+t;s.push(n,r,a),s.push(r,o,a)}this.setIndex(s),this.setAttribute("position",new xs(o,3)),this.setAttribute("normal",new xs(a,3)),this.setAttribute("uv",new xs(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gc(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class vc extends Bs{constructor(e=1,t=.4,n=64,i=8,r=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:s},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],l=[],c=[],h=new Li,d=new Li,u=new Li,p=new Li,A=new Li,f=new Li,m=new Li;for(let o=0;o<=n;++o){const v=o/n*r*Math.PI*2;g(v,r,s,e,u),g(v+.01,r,s,e,p),f.subVectors(p,u),m.addVectors(p,u),A.crossVectors(f,m),m.crossVectors(A,f),A.normalize(),m.normalize();for(let e=0;e<=i;++e){const r=e/i*Math.PI*2,s=-t*Math.cos(r),p=t*Math.sin(r);h.x=u.x+(s*m.x+p*A.x),h.y=u.y+(s*m.y+p*A.y),h.z=u.z+(s*m.z+p*A.z),a.push(h.x,h.y,h.z),d.subVectors(h,u).normalize(),l.push(d.x,d.y,d.z),c.push(o/n),c.push(e/i)}}for(let e=1;e<=n;e++)for(let t=1;t<=i;t++){const n=(i+1)*(e-1)+(t-1),r=(i+1)*e+(t-1),s=(i+1)*e+t,a=(i+1)*(e-1)+t;o.push(n,r,a),o.push(r,s,a)}function g(e,t,n,i,r){const s=Math.cos(e),o=Math.sin(e),a=n/t*e,l=Math.cos(a);r.x=i*(2+l)*.5*s,r.y=i*(2+l)*o*.5,r.z=i*Math.sin(a)*.5}this.setIndex(o),this.setAttribute("position",new xs(a,3)),this.setAttribute("normal",new xs(l,3)),this.setAttribute("uv",new xs(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vc(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class yc extends Bs{constructor(e=new gl(new Li(-1,-1,0),new Li(-1,1,0),new Li(1,1,0)),t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const s=e.computeFrenetFrames(t,r);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;const o=new Li,a=new Li,l=new ti;let c=new Li;const h=[],d=[],u=[],p=[];function A(r){c=e.getPointAt(r/t,c);const l=s.normals[r],u=s.binormals[r];for(let e=0;e<=i;e++){const t=e/i*Math.PI*2,r=Math.sin(t),s=-Math.cos(t);a.x=s*l.x+r*u.x,a.y=s*l.y+r*u.y,a.z=s*l.z+r*u.z,a.normalize(),d.push(a.x,a.y,a.z),o.x=c.x+n*a.x,o.y=c.y+n*a.y,o.z=c.z+n*a.z,h.push(o.x,o.y,o.z)}}!function(){for(let e=0;e<t;e++)A(e);A(!1===r?t:0),function(){for(let e=0;e<=t;e++)for(let n=0;n<=i;n++)l.x=e/t,l.y=n/i,u.push(l.x,l.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=i;t++){const n=(i+1)*(e-1)+(t-1),r=(i+1)*e+(t-1),s=(i+1)*e+t,o=(i+1)*(e-1)+t;p.push(n,r,o),p.push(r,s,o)}}()}(),this.setIndex(p),this.setAttribute("position",new xs(h,3)),this.setAttribute("normal",new xs(d,3)),this.setAttribute("uv",new xs(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new yc((new yl[e.path.type]).fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Ec extends Bs{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},null!==e){const t=[],n=new Set,i=new Li,r=new Li;if(null!==e.index){const s=e.attributes.position,o=e.index;let a=e.groups;0===a.length&&(a=[{start:0,count:o.count,materialIndex:0}]);for(let e=0,l=a.length;e<l;++e){const l=a[e],c=l.start;for(let e=c,a=c+l.count;e<a;e+=3)for(let a=0;a<3;a++){const l=o.getX(e+a),c=o.getX(e+(a+1)%3);i.fromBufferAttribute(s,l),r.fromBufferAttribute(s,c),!0===xc(i,r,n)&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}}else{const s=e.attributes.position;for(let e=0,o=s.count/3;e<o;e++)for(let o=0;o<3;o++){const a=3*e+o,l=3*e+(o+1)%3;i.fromBufferAttribute(s,a),r.fromBufferAttribute(s,l),!0===xc(i,r,n)&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new xs(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function xc(e,t,n){const i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return!0!==n.has(i)&&!0!==n.has(r)&&(n.add(i),n.add(r),!0)}var bc=Object.freeze({__proto__:null,BoxGeometry:Hs,CapsuleGeometry:Cl,CircleGeometry:wl,ConeGeometry:Ml,CylinderGeometry:_l,DodecahedronGeometry:Il,EdgesGeometry:Dl,ExtrudeGeometry:lc,IcosahedronGeometry:hc,LatheGeometry:bl,OctahedronGeometry:dc,PlaneGeometry:uc,PolyhedronGeometry:Sl,RingGeometry:pc,ShapeGeometry:Ac,SphereGeometry:fc,TetrahedronGeometry:mc,TorusGeometry:gc,TorusKnotGeometry:vc,TubeGeometry:yc,WireframeGeometry:Ec});class Cc extends is{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new es(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class wc extends Xs{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class _c extends is{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new es(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new es(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vr,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Mc extends _c{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ti(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Yn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new es(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new es(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new es(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Sc extends is{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new es(16777215),this.specular=new es(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new es(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vr,this.combine=$,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Ic extends is{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new es(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new es(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class Bc extends is{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Tc extends is{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new es(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new es(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vr,this.combine=$,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Rc extends is{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Xt,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Lc extends is{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class Dc extends is{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new es(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Pc extends _a{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Uc(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function Oc(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Fc(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n}function kc(e,t,n){const i=e.length,r=new e.constructor(i);for(let s=0,o=0;o!==i;++s){const i=n[s]*t;for(let n=0;n!==t;++n)r[o++]=e[i+n]}return r}function Nc(e,t,n,i){let r=1,s=e[0];for(;void 0!==s&&void 0===s[i];)s=e[r++];if(void 0===s)return;let o=s[i];if(void 0!==o)if(Array.isArray(o))do{o=s[i],void 0!==o&&(t.push(s.time),n.push.apply(n,o)),s=e[r++]}while(void 0!==s);else if(void 0!==o.toArray)do{o=s[i],void 0!==o&&(t.push(s.time),o.toArray(n,n.length)),s=e[r++]}while(void 0!==s);else do{o=s[i],void 0!==o&&(t.push(s.time),n.push(o)),s=e[r++]}while(void 0!==s)}const Qc={convertArray:Uc,isTypedArray:Oc,getKeyframeOrder:Fc,sortedArray:kc,flattenJSON:Nc,subclip:function(e,t,n,i,r=30){const s=e.clone();s.name=t;const o=[];for(let e=0;e<s.tracks.length;++e){const t=s.tracks[e],a=t.getValueSize(),l=[],c=[];for(let e=0;e<t.times.length;++e){const s=t.times[e]*r;if(!(s<n||s>=i)){l.push(t.times[e]);for(let n=0;n<a;++n)c.push(t.values[e*a+n])}}0!==l.length&&(t.times=Uc(l,t.times.constructor),t.values=Uc(c,t.values.constructor),o.push(t))}s.tracks=o;let a=1/0;for(let e=0;e<s.tracks.length;++e)a>s.tracks[e].times[0]&&(a=s.tracks[e].times[0]);for(let e=0;e<s.tracks.length;++e)s.tracks[e].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(e,t=0,n=e,i=30){i<=0&&(i=30);const r=n.tracks.length,s=t/i;for(let t=0;t<r;++t){const i=n.tracks[t],r=i.ValueTypeName;if("bool"===r||"string"===r)continue;const o=e.tracks.find((function(e){return e.name===i.name&&e.ValueTypeName===r}));if(void 0===o)continue;let a=0;const l=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let c=0;const h=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=h/3);const d=i.times.length-1;let u;if(s<=i.times[0]){const e=a,t=l-a;u=i.values.slice(e,t)}else if(s>=i.times[d]){const e=d*l+a,t=e+l-a;u=i.values.slice(e,t)}else{const e=i.createInterpolant(),t=a,n=l-a;e.evaluate(s),u=e.resultBuffer.slice(t,n)}"quaternion"===r&&(new Ri).fromArray(u).normalize().conjugate().toArray(u);const p=o.times.length;for(let e=0;e<p;++e){const t=e*h+c;if("quaternion"===r)Ri.multiplyQuaternionsFlat(o.values,t,u,0,o.values,t);else{const e=h-2*c;for(let n=0;n<e;++n)o.values[t+n]-=u[n]}}}return e.blendMode=Vt,e}};class Gc{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let s;n:{i:if(!(e<i)){for(let s=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===s)break;if(r=i,i=t[++n],e<i)break t}s=t.length;break n}if(e>=r)break e;{const o=t[1];e<o&&(n=2,r=o);for(let s=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===s)break;if(i=r,r=t[--n-1],e>=r)break t}s=n,n=0}}for(;n<s;){const i=n+s>>>1;e<t[i]?s=i:n=i+1}if(i=t[n],r=t[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let e=0;e!==i;++e)t[e]=n[r+e];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class zc extends Gc{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Qt,endingEnd:Qt}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,s=e+1,o=i[r],a=i[s];if(void 0===o)switch(this.getSettings_().endingStart){case Gt:r=e,o=2*t-n;break;case zt:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(void 0===a)switch(this.getSettings_().endingEnd){case Gt:s=e,a=2*n-t;break;case zt:s=1,a=n+i[1]-i[0];break;default:s=e-1,a=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(a-n),this._offsetPrev=r*c,this._offsetNext=s*c}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,l=a-o,c=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,u=this._weightNext,p=(n-t)/(i-t),A=p*p,f=A*p,m=-d*f+2*d*A-d*p,g=(1+d)*f+(-1.5-2*d)*A+(-.5+d)*p+1,v=(-1-u)*f+(1.5+u)*A+.5*p,y=u*f-u*A;for(let e=0;e!==o;++e)r[e]=m*s[c+e]+g*s[l+e]+v*s[a+e]+y*s[h+e];return r}}class Hc extends Gc{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,l=a-o,c=(n-t)/(i-t),h=1-c;for(let e=0;e!==o;++e)r[e]=s[l+e]*h+s[a+e]*c;return r}}class Vc extends Gc{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class jc{constructor(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Uc(t,this.TimeBufferType),this.values=Uc(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Uc(e.times,Array),values:Uc(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Vc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Hc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new zc(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Ft:t=this.InterpolantFactoryMethodDiscrete;break;case kt:t=this.InterpolantFactoryMethodLinear;break;case Nt:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){const t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(t);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ft;case this.InterpolantFactoryMethodLinear:return kt;case this.InterpolantFactoryMethodSmooth:return Nt}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(1!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,s=i-1;for(;r!==i&&n[r]<e;)++r;for(;-1!==s&&n[s]>t;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const e=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(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&&Oc(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=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Nt,r=e.length-1;let s=1;for(let o=1;o<r;++o){let r=!1;const a=e[o];if(a!==e[o+1]&&(1!==o||a!==e[0]))if(i)r=!0;else{const e=o*n,i=e-n,s=e+n;for(let o=0;o!==n;++o){const n=t[e+o];if(n!==t[i+o]||n!==t[s+o]){r=!0;break}}}if(r){if(o!==s){e[s]=e[o];const i=o*n,r=s*n;for(let e=0;e!==n;++e)t[r+e]=t[i+e]}++s}}if(r>0){e[s]=e[r];for(let e=r*n,i=s*n,o=0;o!==n;++o)t[i+o]=t[e+o];++s}return s!==e.length?(this.times=e.slice(0,s),this.values=t.slice(0,s*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}jc.prototype.TimeBufferType=Float32Array,jc.prototype.ValueBufferType=Float32Array,jc.prototype.DefaultInterpolation=kt;class Wc extends jc{constructor(e,t,n){super(e,t,n)}}Wc.prototype.ValueTypeName="bool",Wc.prototype.ValueBufferType=Array,Wc.prototype.DefaultInterpolation=Ft,Wc.prototype.InterpolantFactoryMethodLinear=void 0,Wc.prototype.InterpolantFactoryMethodSmooth=void 0;class qc extends jc{}qc.prototype.ValueTypeName="color";class Xc extends jc{}Xc.prototype.ValueTypeName="number";class Yc extends Gc{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-t)/(i-t);let l=e*o;for(let e=l+o;l!==e;l+=4)Ri.slerpFlat(r,0,s,l-o,s,l,a);return r}}class Jc extends jc{InterpolantFactoryMethodLinear(e){return new Yc(this.times,this.values,this.getValueSize(),e)}}Jc.prototype.ValueTypeName="quaternion",Jc.prototype.InterpolantFactoryMethodSmooth=void 0;class Kc extends jc{constructor(e,t,n){super(e,t,n)}}Kc.prototype.ValueTypeName="string",Kc.prototype.ValueBufferType=Array,Kc.prototype.DefaultInterpolation=Ft,Kc.prototype.InterpolantFactoryMethodLinear=void 0,Kc.prototype.InterpolantFactoryMethodSmooth=void 0;class Zc extends jc{}Zc.prototype.ValueTypeName="vector";class $c{constructor(e="",t=-1,n=[],i=Ht){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Xn(),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(eh(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(jc.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,s=[];for(let e=0;e<r;e++){let o=[],a=[];o.push((e+r-1)%r,e,(e+1)%r),a.push(0,1,0);const l=Fc(o);o=kc(o,1,l),a=kc(a,1,l),i||0!==o[0]||(o.push(r),a.push(a[0])),s.push(new Xc(".morphTargetInfluences["+t[e].name+"]",o,a).scale(1/n))}return new this(e,-1,s)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){const n=e[t],s=n.name.match(r);if(s&&s.length>1){const e=s[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const s=[];for(const e in i)s.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const s=[],o=[];Nc(n,s,o,i),0!==s.length&&r.push(new e(t,s,o))}},i=[],r=e.name||"default",s=e.fps||30,o=e.blendMode;let a=e.length||-1;const l=e.hierarchy||[];for(let e=0;e<l.length;e++){const r=l[e].keys;if(r&&0!==r.length)if(r[0].morphTargets){const e={};let t;for(t=0;t<r.length;t++)if(r[t].morphTargets)for(let n=0;n<r[t].morphTargets.length;n++)e[r[t].morphTargets[n]]=-1;for(const n in e){const e=[],s=[];for(let i=0;i!==r[t].morphTargets.length;++i){const i=r[t];e.push(i.time),s.push(i.morphTarget===n?1:0)}i.push(new Xc(".morphTargetInfluence["+n+"]",e,s))}a=e.length*s}else{const s=".bones["+t[e].name+"]";n(Zc,s+".position",r,"pos",i),n(Jc,s+".quaternion",r,"rot",i),n(Zc,s+".scale",r,"scl",i)}}return 0===i.length?null:new this(r,a,i,o)}resetDuration(){let e=0;for(let t=0,n=this.tracks.length;t!==n;++t){const n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function eh(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Xc;case"vector":case"vector2":case"vector3":case"vector4":return Zc;case"color":return qc;case"quaternion":return Jc;case"bool":case"boolean":return Wc;case"string":return Kc}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],n=[];Nc(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}const th={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class nh{constructor(e,t,n){const i=this;let r,s=!1,o=0,a=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){a++,!1===s&&void 0!==i.onStart&&i.onStart(e,o,a),s=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,a),o===a&&(s=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return r?r(e):e},this.setURLModifier=function(e){return r=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){const n=l[t],i=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}}}const ih=new nh;class rh{constructor(e){this.manager=void 0!==e?e:ih,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise((function(i,r){n.load(e,i,t,r)}))}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}rh.DEFAULT_MATERIAL_NAME="__DEFAULT";const sh={};class oh extends Error{constructor(e,t){super(e),this.response=t}}class ah extends rh{constructor(e){super(e)}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=th.get(e);if(void 0!==r)return this.manager.itemStart(e),setTimeout((()=>{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==sh[e])return void sh[e].push({onLoad:t,onProgress:n,onError:i});sh[e]=[],sh[e].push({onLoad:t,onProgress:n,onError:i});const s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(s).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=sh[e],i=t.body.getReader(),r=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),s=r?parseInt(r):0,o=0!==s;let a=0;const l=new ReadableStream({start(e){!function t(){i.read().then((({done:i,value:r})=>{if(i)e.close();else{a+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:s});for(let e=0,t=n.length;e<t;e++){const t=n[e];t.onProgress&&t.onProgress(i)}e.enqueue(r),t()}}),(t=>{e.error(t)}))}()}});return new Response(l)}throw new oh(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)})).then((e=>{switch(a){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,o)));case"json":return e.json();default:if(void 0===o)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((e=>i.decode(e)))}}})).then((t=>{th.add(e,t);const n=sh[e];delete sh[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onLoad&&i.onLoad(t)}})).catch((t=>{const n=sh[e];if(void 0===n)throw this.manager.itemError(e),t;delete sh[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onError&&i.onError(t)}this.manager.itemError(e)})).finally((()=>{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class lh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new ah(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=$c.parse(e[n]);t.push(i)}return t}}class ch extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=[],o=new Ya,a=new ah(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(r.withCredentials);let l=0;function c(c){a.load(e[c],(function(e){const n=r.parse(e,!0);s[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(o.minFilter=Me),o.image=s,o.format=n.format,o.needsUpdate=!0,t&&t(o))}),n,i)}if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)c(t);else a.load(e,(function(e){const n=r.parse(e,!0);if(n.isCubemap){const e=n.mipmaps.length/n.mipmapCount;for(let t=0;t<e;t++){s[t]={mipmaps:[]};for(let e=0;e<n.mipmapCount;e++)s[t].mipmaps.push(n.mipmaps[t*n.mipmapCount+e]),s[t].format=n.format,s[t].width=n.width,s[t].height=n.height}o.image=s}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=Me),o.format=n.format,o.needsUpdate=!0,t&&t(o)}),n,i);return o}}class hh extends rh{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=th.get(e);if(void 0!==s)return r.manager.itemStart(e),setTimeout((function(){t&&t(s),r.manager.itemEnd(e)}),0),s;const o=ai("img");function a(){c(),th.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){c(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function c(){o.removeEventListener("load",a,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",a,!1),o.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}}class dh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=new no;r.colorSpace=tn;const s=new hh(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let o=0;function a(n){s.load(e[n],(function(e){r.images[n]=e,o++,6===o&&(r.needsUpdate=!0,t&&t(r))}),void 0,i)}for(let t=0;t<e.length;++t)a(t);return r}}class uh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new Go,o=new ah(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(e,(function(e){let n;try{n=r.parse(e)}catch(e){if(void 0===i)return void console.error(e);i(e)}void 0!==n.image?s.image=n.image:void 0!==n.data&&(s.image.width=n.width,s.image.height=n.height,s.image.data=n.data),s.wrapS=void 0!==n.wrapS?n.wrapS:ye,s.wrapT=void 0!==n.wrapT?n.wrapT:ye,s.magFilter=void 0!==n.magFilter?n.magFilter:Me,s.minFilter=void 0!==n.minFilter?n.minFilter:Me,s.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(s.colorSpace=n.colorSpace),void 0!==n.flipY&&(s.flipY=n.flipY),void 0!==n.format&&(s.format=n.format),void 0!==n.type&&(s.type=n.type),void 0!==n.mipmaps&&(s.mipmaps=n.mipmaps,s.minFilter=Be),1===n.mipmapCount&&(s.minFilter=Me),void 0!==n.generateMipmaps&&(s.generateMipmaps=n.generateMipmaps),s.needsUpdate=!0,t&&t(s,n)}),n,i),s}}class ph extends rh{constructor(e){super(e)}load(e,t,n,i){const r=new Ci,s=new hh(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,(function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r}}class Ah extends Ur{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new es(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(t.object.target=this.target.uuid),t}}class fh extends Ah{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Ur.DEFAULT_UP),this.updateMatrix(),this.groundColor=new es(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const mh=new lr,gh=new Li,vh=new Li;class yh{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ti(512,512),this.map=null,this.mapPass=null,this.matrix=new lr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new oa,this._frameExtents=new ti(1,1),this._viewportCount=1,this._viewports=[new wi(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;gh.setFromMatrixPosition(e.matrixWorld),t.position.copy(gh),vh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(vh),t.updateMatrixWorld(),mh.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(mh),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(mh)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Eh extends yh{constructor(){super(new $s(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=2*qn*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class xh extends Ah{constructor(e,t,n=0,i=Math.PI/3,r=0,s=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ur.DEFAULT_UP),this.updateMatrix(),this.target=new Ur,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new Eh}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const bh=new lr,Ch=new Li,wh=new Li;class _h extends yh{constructor(){super(new $s(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new ti(4,2),this._viewportCount=6,this._viewports=[new wi(2,1,1,1),new wi(0,1,1,1),new wi(3,1,1,1),new wi(1,1,1,1),new wi(3,0,1,1),new wi(1,0,1,1)],this._cubeDirections=[new Li(1,0,0),new Li(-1,0,0),new Li(0,0,1),new Li(0,0,-1),new Li(0,1,0),new Li(0,-1,0)],this._cubeUps=[new Li(0,1,0),new Li(0,1,0),new Li(0,1,0),new Li(0,1,0),new Li(0,0,1),new Li(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Ch.setFromMatrixPosition(e.matrixWorld),n.position.copy(Ch),wh.copy(n.position),wh.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(wh),n.updateMatrixWorld(),i.makeTranslation(-Ch.x,-Ch.y,-Ch.z),bh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(bh)}}class Mh extends Ah{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new _h}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Sh extends Ys{constructor(e=-1,t=1,n=1,i=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,s=n+e,o=i+t,a=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,s=r+e*this.view.width,o-=t*this.view.offsetY,a=o-t*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}class Ih extends yh{constructor(){super(new Sh(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Bh extends Ah{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ur.DEFAULT_UP),this.updateMatrix(),this.target=new Ur,this.shadow=new Ih}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Th extends Ah{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Rh extends Ah{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Lh{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new Li)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,r=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.282095),t.addScaledVector(s[1],.488603*i),t.addScaledVector(s[2],.488603*r),t.addScaledVector(s[3],.488603*n),t.addScaledVector(s[4],n*i*1.092548),t.addScaledVector(s[5],i*r*1.092548),t.addScaledVector(s[6],.315392*(3*r*r-1)),t.addScaledVector(s[7],n*r*1.092548),t.addScaledVector(s[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.886227),t.addScaledVector(s[1],1.023328*i),t.addScaledVector(s[2],1.023328*r),t.addScaledVector(s[3],1.023328*n),t.addScaledVector(s[4],.858086*n*i),t.addScaledVector(s[5],.858086*i*r),t.addScaledVector(s[6],.743125*r*r-.247708),t.addScaledVector(s[7],.858086*n*r),t.addScaledVector(s[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+3*i);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+3*i);return e}static getBasisAt(e,t){const n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}class Dh extends Ah{constructor(e=new Lh,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Ph extends rh{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,s=new ah(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}const i=this.createMaterialFromType(e.type);if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=e.sheen),void 0!==e.sheenColor&&(i.sheenColor=(new es).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(i.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.specular&&i.specular.setHex(e.specular),void 0!==e.specularIntensity&&(i.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(i.dispersion=e.dispersion),void 0!==e.iridescence&&(i.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(i.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(i.transmission=e.transmission),void 0!==e.thickness&&(i.thickness=e.thickness),void 0!==e.attenuationDistance&&(i.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(i.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(i.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.shadowSide&&(i.shadowSide=e.shadowSide),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(i.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(i.depthFunc=e.depthFunc),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(i.blendSrc=e.blendSrc),void 0!==e.blendDst&&(i.blendDst=e.blendDst),void 0!==e.blendEquation&&(i.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(i.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&(i.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(i.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==i.blendColor&&i.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(i.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),void 0!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(i.forceSinglePass=e.forceSinglePass),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=e.vertexColors>0: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 es).setHex(r.value);break;case"v2":i.uniforms[t].value=(new ti).fromArray(r.value);break;case"v3":i.uniforms[t].value=(new Li).fromArray(r.value);break;case"v4":i.uniforms[t].value=(new wi).fromArray(r.value);break;case"m3":i.uniforms[t].value=(new ni).fromArray(r.value);break;case"m4":i.uniforms[t].value=(new lr).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.glslVersion&&(i.glslVersion=e.glslVersion),void 0!==e.extensions)for(const t in e.extensions)i.extensions[t]=e.extensions[t];if(void 0!==e.lights&&(i.lights=e.lights),void 0!==e.clipping&&(i.clipping=e.clipping),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 ti).fromArray(t)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapRotation&&i.envMapRotation.fromArray(e.envMapRotation),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 ti).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(i.iridescenceMap=n(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=n(e.thicknessMap)),void 0!==e.anisotropyMap&&(i.anisotropyMap=n(e.anisotropyMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Ph.createMaterialFromType(e)}static createMaterialFromType(e){return new{ShadowMaterial:Cc,SpriteMaterial:ho,RawShaderMaterial:wc,ShaderMaterial:Xs,PointsMaterial:Na,MeshPhysicalMaterial:Mc,MeshStandardMaterial:_c,MeshPhongMaterial:Sc,MeshToonMaterial:Ic,MeshNormalMaterial:Bc,MeshLambertMaterial:Tc,MeshDepthMaterial:Rc,MeshDistanceMaterial:Lc,MeshBasicMaterial:rs,MeshMatcapMaterial:Dc,LineDashedMaterial:Pc,LineBasicMaterial:_a,Material:is}[e]}}class Uh{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Oh extends Bs{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Fh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new ah(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t={},n={};function i(e,i){if(void 0!==t[i])return t[i];const r=e.interleavedBuffers[i],s=function(e,t){if(void 0!==n[t])return n[t];const i=e.arrayBuffers[t],r=new Uint32Array(i).buffer;return n[t]=r,r}(e,r.buffer),o=oi(r.type,s),a=new ao(o,r.stride);return a.uuid=r.uuid,t[i]=a,a}const r=e.isInstancedBufferGeometry?new Oh:new Bs,s=e.data.index;if(void 0!==s){const e=oi(s.type,s.array);r.setIndex(new us(e,1))}const o=e.data.attributes;for(const t in o){const n=o[t];let s;if(n.isInterleavedBufferAttribute){const t=i(e.data,n.data);s=new co(t,n.itemSize,n.offset,n.normalized)}else{const e=oi(n.type,n.array);s=new(n.isInstancedBufferAttribute?jo:us)(e,n.itemSize,n.normalized)}void 0!==n.name&&(s.name=n.name),void 0!==n.usage&&s.setUsage(n.usage),r.setAttribute(t,s)}const a=e.data.morphAttributes;if(a)for(const t in a){const n=a[t],s=[];for(let t=0,r=n.length;t<r;t++){const r=n[t];let o;if(r.isInterleavedBufferAttribute){const t=i(e.data,r.data);o=new co(t,r.itemSize,r.offset,r.normalized)}else{const e=oi(r.type,r.array);o=new us(e,r.itemSize,r.normalized)}void 0!==r.name&&(o.name=r.name),s.push(o)}r.morphAttributes[t]=s}e.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);const l=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==l)for(let e=0,t=l.length;e!==t;++e){const t=l[e];r.addGroup(t.start,t.count,t.materialIndex)}const c=e.data.boundingSphere;if(void 0!==c){const e=new Li;void 0!==c.center&&e.fromArray(c.center),r.boundingSphere=new $i(e,c.radius)}return e.name&&(r.name=e.name),e.userData&&(r.userData=e.userData),r}}class kh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=""===this.path?Uh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||s;const o=new ah(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){let s=null;try{s=JSON.parse(n)}catch(t){return void 0!==i&&i(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}const o=s.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())return void 0!==i&&i(new Error("THREE.ObjectLoader: Can't load "+e)),void console.error("THREE.ObjectLoader: Can't load "+e);r.parse(s,t)}),n,i)}async loadAsync(e,t){const n=""===this.path?Uh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||n;const i=new ah(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);const r=await i.loadAsync(e,t),s=JSON.parse(r),o=s.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+e);return await this.parseAsync(s)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=this.parseImages(e.images,(function(){void 0!==t&&t(l)})),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,r,a,o,n),c=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,c),this.bindLightTargets(l),void 0!==t){let e=!1;for(const t in s)if(s[t].data instanceof HTMLImageElement){e=!0;break}!1===e&&t(l)}return l}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),r=await this.parseImagesAsync(e.images),s=this.parseTextures(e.textures,r),o=this.parseMaterials(e.materials,s),a=this.parseObject(e.object,i,o,s,t),l=this.parseSkeletons(e.skeletons,a);return this.bindSkeletons(a,l),this.bindLightTargets(a),a}parseShapes(e){const t={};if(void 0!==e)for(let n=0,i=e.length;n<i;n++){const i=(new Pl).fromJSON(e[n]);t[i.uuid]=i}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse((function(e){e.isBone&&(i[e.uuid]=e)})),void 0!==e)for(let t=0,r=e.length;t<r;t++){const r=(new Vo).fromJSON(e[t],i);n[r.uuid]=r}return n}parseGeometries(e,t){const n={};if(void 0!==e){const i=new Fh;for(let r=0,s=e.length;r<s;r++){let s;const o=e[r];switch(o.type){case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(o);break;case"Geometry":"THREE"in window&&"LegacyJSONLoader"in THREE?s=(new THREE.LegacyJSONLoader).parse(o,this.resourcePath).geometry:console.error('THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".');break;default:o.type in bc?s=bc[o.type].fromJSON(o,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${o.type}"`)}s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.userData&&(s.userData=o.userData),n[o.uuid]=s}}return n}parseMaterials(e,t){const n={},i={};if(void 0!==e){const r=new Ph;r.setTextures(t);for(let t=0,s=e.length;t<s;t++){const s=e[t];void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i}parseAnimations(e){const t={};if(void 0!==e)for(let n=0;n<e.length;n++){const i=e[n],r=$c.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function s(e){if("string"==typeof e){const t=e;return function(e){return n.manager.itemStart(e),r.load(e,(function(){n.manager.itemEnd(e)}),void 0,(function(){n.manager.itemError(e),n.manager.itemEnd(e)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:n.resourcePath+t)}return e.data?{data:oi(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){const n=new nh(t);r=new hh(n),r.setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t<n;t++){const n=e[t],r=n.url;if(Array.isArray(r)){const e=[];for(let t=0,n=r.length;t<n;t++){const n=s(r[t]);null!==n&&(n instanceof HTMLImageElement?e.push(n):e.push(new Go(n.data,n.width,n.height)))}i[n.uuid]=new Ei(e)}else{const e=s(n.url);i[n.uuid]=new Ei(e)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function r(e){if("string"==typeof e){const n=e,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:t.resourcePath+n;return await i.loadAsync(r)}return e.data?{data:oi(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){i=new hh(this.manager),i.setCrossOrigin(this.crossOrigin);for(let t=0,i=e.length;t<i;t++){const i=e[t],s=i.url;if(Array.isArray(s)){const e=[];for(let t=0,n=s.length;t<n;t++){const n=s[t],i=await r(n);null!==i&&(i instanceof HTMLImageElement?e.push(i):e.push(new Go(i.data,i.width,i.height)))}n[i.uuid]=new Ei(e)}else{const e=await r(i.url);n[i.uuid]=new Ei(e)}}}return n}parseTextures(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}const i={};if(void 0!==e)for(let r=0,s=e.length;r<s;r++){const s=e[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);const o=t[s.image],a=o.data;let l;Array.isArray(a)?(l=new no,6===a.length&&(l.needsUpdate=!0)):(l=a&&a.data?new Go:new Ci,a&&(l.needsUpdate=!0)),l.source=o,l.uuid=s.uuid,void 0!==s.name&&(l.name=s.name),void 0!==s.mapping&&(l.mapping=n(s.mapping,Nh)),void 0!==s.channel&&(l.channel=s.channel),void 0!==s.offset&&l.offset.fromArray(s.offset),void 0!==s.repeat&&l.repeat.fromArray(s.repeat),void 0!==s.center&&l.center.fromArray(s.center),void 0!==s.rotation&&(l.rotation=s.rotation),void 0!==s.wrap&&(l.wrapS=n(s.wrap[0],Qh),l.wrapT=n(s.wrap[1],Qh)),void 0!==s.format&&(l.format=s.format),void 0!==s.internalFormat&&(l.internalFormat=s.internalFormat),void 0!==s.type&&(l.type=s.type),void 0!==s.colorSpace&&(l.colorSpace=s.colorSpace),void 0!==s.minFilter&&(l.minFilter=n(s.minFilter,Gh)),void 0!==s.magFilter&&(l.magFilter=n(s.magFilter,Gh)),void 0!==s.anisotropy&&(l.anisotropy=s.anisotropy),void 0!==s.flipY&&(l.flipY=s.flipY),void 0!==s.generateMipmaps&&(l.generateMipmaps=s.generateMipmaps),void 0!==s.premultiplyAlpha&&(l.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(l.unpackAlignment=s.unpackAlignment),void 0!==s.compareFunction&&(l.compareFunction=s.compareFunction),void 0!==s.userData&&(l.userData=s.userData),i[s.uuid]=l}return i}parseObject(e,t,n,i,r){let s,o,a;function l(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function c(e){if(void 0!==e){if(Array.isArray(e)){const t=[];for(let i=0,r=e.length;i<r;i++){const r=e[i];void 0===n[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),t.push(n[r])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}function h(e){return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined texture",e),i[e]}switch(e.type){case"Scene":s=new oo,void 0!==e.background&&(Number.isInteger(e.background)?s.background=new es(e.background):s.background=h(e.background)),void 0!==e.environment&&(s.environment=h(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?s.fog=new so(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(s.fog=new ro(e.fog.color,e.fog.density)),""!==e.fog.name&&(s.fog.name=e.fog.name)),void 0!==e.backgroundBlurriness&&(s.backgroundBlurriness=e.backgroundBlurriness),void 0!==e.backgroundIntensity&&(s.backgroundIntensity=e.backgroundIntensity),void 0!==e.backgroundRotation&&s.backgroundRotation.fromArray(e.backgroundRotation),void 0!==e.environmentIntensity&&(s.environmentIntensity=e.environmentIntensity),void 0!==e.environmentRotation&&s.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":s=new $s(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(s.focus=e.focus),void 0!==e.zoom&&(s.zoom=e.zoom),void 0!==e.filmGauge&&(s.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(s.filmOffset=e.filmOffset),void 0!==e.view&&(s.view=Object.assign({},e.view));break;case"OrthographicCamera":s=new Sh(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(s.zoom=e.zoom),void 0!==e.view&&(s.view=Object.assign({},e.view));break;case"AmbientLight":s=new Th(e.color,e.intensity);break;case"DirectionalLight":s=new Bh(e.color,e.intensity),s.target=e.target||"";break;case"PointLight":s=new Mh(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":s=new Rh(e.color,e.intensity,e.width,e.height);break;case"SpotLight":s=new xh(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),s.target=e.target||"";break;case"HemisphereLight":s=new fh(e.color,e.groundColor,e.intensity);break;case"LightProbe":s=(new Dh).fromJSON(e);break;case"SkinnedMesh":o=l(e.geometry),a=c(e.material),s=new No(o,a),void 0!==e.bindMode&&(s.bindMode=e.bindMode),void 0!==e.bindMatrix&&s.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(s.skeleton=e.skeleton);break;case"Mesh":o=l(e.geometry),a=c(e.material),s=new Gs(o,a);break;case"InstancedMesh":o=l(e.geometry),a=c(e.material);const t=e.count,n=e.instanceMatrix,i=e.instanceColor;s=new $o(o,a,t),s.instanceMatrix=new jo(new Float32Array(n.array),16),void 0!==i&&(s.instanceColor=new jo(new Float32Array(i.array),i.itemSize));break;case"BatchedMesh":o=l(e.geometry),a=c(e.material),s=new wa(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,a),s.geometry=o,s.perObjectFrustumCulled=e.perObjectFrustumCulled,s.sortObjects=e.sortObjects,s._drawRanges=e.drawRanges,s._reservedRanges=e.reservedRanges,s._visibility=e.visibility,s._active=e.active,s._bounds=e.bounds.map((e=>{const t=new Ui;t.min.fromArray(e.boxMin),t.max.fromArray(e.boxMax);const n=new $i;return n.radius=e.sphereRadius,n.center.fromArray(e.sphereCenter),{boxInitialized:e.boxInitialized,box:t,sphereInitialized:e.sphereInitialized,sphere:n}})),s._maxInstanceCount=e.maxInstanceCount,s._maxVertexCount=e.maxVertexCount,s._maxIndexCount=e.maxIndexCount,s._geometryInitialized=e.geometryInitialized,s._geometryCount=e.geometryCount,s._matricesTexture=h(e.matricesTexture.uuid),void 0!==e.colorsTexture&&(s._colorsTexture=h(e.colorsTexture.uuid));break;case"LOD":s=new Bo;break;case"Line":s=new Da(l(e.geometry),c(e.material));break;case"LineLoop":s=new ka(l(e.geometry),c(e.material));break;case"LineSegments":s=new Fa(l(e.geometry),c(e.material));break;case"PointCloud":case"Points":s=new Va(l(e.geometry),c(e.material));break;case"Sprite":s=new _o(c(e.material));break;case"Group":s=new Wa;break;case"Bone":s=new Qo;break;default:s=new Ur}if(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.up&&s.up.fromArray(e.up),void 0!==e.castShadow&&(s.castShadow=e.castShadow),void 0!==e.receiveShadow&&(s.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.intensity&&(s.shadow.intensity=e.shadow.intensity),void 0!==e.shadow.bias&&(s.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(s.shadow.normalBias=e.shadow.normalBias),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.userData&&(s.userData=e.userData),void 0!==e.layers&&(s.layers.mask=e.layers),void 0!==e.children){const o=e.children;for(let e=0;e<o.length;e++)s.add(this.parseObject(o[e],t,n,i,r))}if(void 0!==e.animations){const t=e.animations;for(let e=0;e<t.length;e++){const n=t[e];s.animations.push(r[n])}}if("LOD"===e.type){void 0!==e.autoUpdate&&(s.autoUpdate=e.autoUpdate);const t=e.levels;for(let e=0;e<t.length;e++){const n=t[e],i=s.getObjectByProperty("uuid",n.object);void 0!==i&&s.addLevel(i,n.distance,n.hysteresis)}}return s}bindSkeletons(e,t){0!==Object.keys(t).length&&e.traverse((function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){const n=t[e.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(n,e.bindMatrix)}}))}bindLightTargets(e){e.traverse((function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);t.target=void 0!==i?i:new Ur}}))}}const Nh={UVMapping:ue,CubeReflectionMapping:pe,CubeRefractionMapping:Ae,EquirectangularReflectionMapping:fe,EquirectangularRefractionMapping:me,CubeUVReflectionMapping:ge},Qh={RepeatWrapping:ve,ClampToEdgeWrapping:ye,MirroredRepeatWrapping:Ee},Gh={NearestFilter:xe,NearestMipmapNearestFilter:be,NearestMipmapLinearFilter:we,LinearFilter:Me,LinearMipmapNearestFilter:Se,LinearMipmapLinearFilter:Be};class zh extends rh{constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=th.get(e);if(void 0!==s)return r.manager.itemStart(e),s.then?void s.then((n=>{t&&t(n),r.manager.itemEnd(e)})).catch((e=>{i&&i(e)})):(setTimeout((function(){t&&t(s),r.manager.itemEnd(e)}),0),s);const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader;const a=fetch(e,o).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){return th.add(e,n),t&&t(n),r.manager.itemEnd(e),n})).catch((function(t){i&&i(t),th.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)}));th.add(e,a),r.manager.itemStart(e)}}let Hh;class Vh{static getContext(){return void 0===Hh&&(Hh=new(window.AudioContext||window.webkitAudioContext)),Hh}static setContext(e){Hh=e}}class jh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new ah(this.manager);function o(t){i?i(t):console.error(t),r.manager.itemError(e)}s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(e){try{const n=e.slice(0);Vh.getContext().decodeAudioData(n,(function(e){t(e)})).catch(o)}catch(e){o(e)}}),n,i)}}const Wh=new lr,qh=new lr,Xh=new lr;class Yh{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new $s,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new $s,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Xh.copy(e.projectionMatrix);const n=t.eyeSep/2,i=n*t.near/t.focus,r=t.near*Math.tan(Wn*t.fov*.5)/t.zoom;let s,o;qh.elements[12]=-n,Wh.elements[12]=n,s=-r*t.aspect+i,o=r*t.aspect+i,Xh.elements[0]=2*t.near/(o-s),Xh.elements[8]=(o+s)/(o-s),this.cameraL.projectionMatrix.copy(Xh),s=-r*t.aspect-i,o=r*t.aspect-i,Xh.elements[0]=2*t.near/(o-s),Xh.elements[8]=(o+s)/(o-s),this.cameraR.projectionMatrix.copy(Xh)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(qh),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Wh)}}class Jh extends $s{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Kh{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Zh(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Zh();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Zh(){return performance.now()}const $h=new Li,ed=new Ri,td=new Li,nd=new Li;class id extends Ur{constructor(){super(),this.type="AudioListener",this.context=Vh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Kh}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose($h,ed,td),nd.set(0,0,-1).applyQuaternion(ed),t.positionX){const e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime($h.x,e),t.positionY.linearRampToValueAtTime($h.y,e),t.positionZ.linearRampToValueAtTime($h.z,e),t.forwardX.linearRampToValueAtTime(nd.x,e),t.forwardY.linearRampToValueAtTime(nd.y,e),t.forwardZ.linearRampToValueAtTime(nd.z,e),t.upX.linearRampToValueAtTime(n.x,e),t.upY.linearRampToValueAtTime(n.y,e),t.upZ.linearRampToValueAtTime(n.z,e)}else t.setPosition($h.x,$h.y,$h.z),t.setOrientation(nd.x,nd.y,nd.z,n.x,n.y,n.z)}}class rd extends Ur{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(e=0){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),"buffer"!==e.sourceType?(console.warn("THREE.Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const sd=new Li,od=new Ri,ad=new Li,ld=new Li;class cd extends rd{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(sd,od,ad),ld.set(0,0,1).applyQuaternion(od);const t=this.panner;if(t.positionX){const e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(sd.x,e),t.positionY.linearRampToValueAtTime(sd.y,e),t.positionZ.linearRampToValueAtTime(sd.z,e),t.orientationX.linearRampToValueAtTime(ld.x,e),t.orientationY.linearRampToValueAtTime(ld.y,e),t.orientationZ.linearRampToValueAtTime(ld.z,e)}else t.setPosition(sd.x,sd.y,sd.z),t.setOrientation(ld.x,ld.y,ld.z)}}class hd{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class dd{constructor(e,t,n){let i,r,s;switch(this.binding=e,this.valueSize=n,t){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,r=e*i+i;let s=this.cumulativeWeight;if(0===s){for(let e=0;e!==i;++e)n[r+e]=n[e];s=t}else{s+=t;const e=t/s;this._mixBufferRegion(n,r,0,e,i)}this.cumulativeWeight=s}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const e=t*this._origIndex;this._mixBufferRegion(n,i,e,1-r,t)}s>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let e=t,r=t+t;e!==r;++e)if(n[e]!==n[e+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let e=n,r=i;e!==r;++e)t[e]=t[i+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)e[t+i]=e[n+i]}_slerp(e,t,n,i){Ri.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const s=this._workIndex*r;Ri.multiplyQuaternionsFlat(e,s,e,t,e,n),Ri.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){const s=1-i;for(let o=0;o!==r;++o){const r=t+o;e[r]=e[r]*s+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){const r=t+s;e[r]=e[r]+e[n+s]*i}}}const ud="\\[\\]\\.:\\/",pd=new RegExp("["+ud+"]","g"),Ad="[^"+ud+"]",fd="[^"+ud.replace("\\.","")+"]",md=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Ad)+/(WCOD+)?/.source.replace("WCOD",fd)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ad)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ad)+"$"),gd=["material","materials","bones","map"];class vd{constructor(e,t,n){this.path=t,this.parsedPath=n||vd.parseTrackName(t),this.node=vd.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new vd.Composite(e,t,n):new vd(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(pd,"")}static parseTrackName(e){const t=md.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==gd.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i<e.length;i++){const r=e[i];if(r.name===t||r.uuid===t)return r;const s=n(r.children);if(s)return s}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=vd.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(n){let i=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===i){i=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==i){if(void 0===e[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[i]}}const s=e[i];if(void 0===s){const n=t.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",e)}let o=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(a=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}vd.Composite=class{constructor(e,t,n){const i=n||vd.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},vd.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},vd.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},vd.prototype.GetterByBindingType=[vd.prototype._getValue_direct,vd.prototype._getValue_array,vd.prototype._getValue_arrayElement,vd.prototype._getValue_toArray],vd.prototype.SetterByBindingTypeAndVersioning=[[vd.prototype._setValue_direct,vd.prototype._setValue_direct_setNeedsUpdate,vd.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[vd.prototype._setValue_array,vd.prototype._setValue_array_setNeedsUpdate,vd.prototype._setValue_array_setMatrixWorldNeedsUpdate],[vd.prototype._setValue_arrayElement,vd.prototype._setValue_arrayElement_setNeedsUpdate,vd.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[vd.prototype._setValue_fromArray,vd.prototype._setValue_fromArray_setNeedsUpdate,vd.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class yd{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Xn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,s=r.length;let o,a=e.length,l=this.nCachedObjects_;for(let c=0,h=arguments.length;c!==h;++c){const h=arguments[c],d=h.uuid;let u=t[d];if(void 0===u){u=a++,t[d]=u,e.push(h);for(let e=0,t=s;e!==t;++e)r[e].push(new vd(h,n[e],i[e]))}else if(u<l){o=e[u];const a=--l,c=e[a];t[c.uuid]=u,e[u]=c,t[d]=a,e[a]=h;for(let e=0,t=s;e!==t;++e){const t=r[e],s=t[a];let o=t[u];t[u]=s,void 0===o&&(o=new vd(h,n[e],i[e])),t[a]=o}}else e[u]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let s=0,o=arguments.length;s!==o;++s){const o=arguments[s],a=o.uuid,l=t[a];if(void 0!==l&&l>=r){const s=r++,c=e[s];t[c.uuid]=l,e[l]=c,t[a]=s,e[s]=o;for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[s],r=t[l];t[l]=i,t[s]=r}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=e.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=t[a];if(void 0!==l)if(delete t[a],l<r){const o=--r,a=e[o],c=--s,h=e[c];t[a.uuid]=l,e[l]=a,t[h.uuid]=o,e[o]=h,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[o],r=t[c];t[l]=i,t[o]=r,t.pop()}}else{const r=--s,o=e[r];r>0&&(t[o.uuid]=l),e[l]=o,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e];t[l]=t[r],t.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[e]=i,s.push(e),o.push(t),r.push(h);for(let n=c,i=a.length;n!==i;++n){const i=a[n];h[n]=new vd(i,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];t[e[o]]=n,s[n]=a,s.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}class Ed{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,s=r.length,o=new Array(s),a={endingStart:Qt,endingEnd:Qt};for(let e=0;e!==s;++e){const t=r[e].createInterpolant(null);o[e]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ut,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const n=this._clip.duration,i=e._clip.duration,r=i/n,s=n/i;e.warp(1,r,t),this.warp(s,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,a[1]=r+n,l[0]=e/s,l[1]=t/s,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled)return void this._updateWeight(e);const r=this._startTime;if(null!==r){const i=(e-r)*n;i<0||0===n?t=0:(this._startTime=null,t=n*i)}t*=this._updateTimeScale(e);const s=this._updateTime(t),o=this._updateWeight(e);if(o>0){const e=this._interpolants,t=this._propertyBindings;if(this.blendMode===Vt)for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(s),t[n].accumulateAdditive(o);else for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(s),t[n].accumulate(i,o)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const s=n===Ot;if(0===e)return-1===r||!s||1&~r?i:t-i;if(n===Pt){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=t||i<0){const n=Math.floor(i/t);i-=t*n,r+=Math.abs(n);const o=this.repetitions-r;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===o){const t=e<0;this._setEndings(t,!t,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&!(1&~r))return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Gt,i.endingEnd=Gt):(i.endingStart=e?this.zeroSlopeAtStart?Gt:Qt:zt,i.endingEnd=t?this.zeroSlopeAtEnd?Gt:Qt:zt)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=t,o[1]=r+e,a[1]=n,this}}const xd=new Float32Array(1);class bd extends Hn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,s=e._propertyBindings,o=e._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let e=0;e!==r;++e){const r=i[e],l=r.name;let h=c[l];if(void 0!==h)++h.referenceCount,s[e]=h;else{if(h=s[e],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,a,l));continue}const i=t&&t._propertyBindings[e].binding.parsedPath;h=new dd(vd.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),s[e]=h}o[e].resultBuffer=h.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,r=this._actionsByClip;let s=r[t];if(void 0===s)s={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=s;else{const t=s.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=i.length,i.push(e),s.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,s=this._actionsByClip,o=s[r],a=o.knownActions,l=a[a.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,a[c]=l,a.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===a.length&&delete s[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let s=i[t];void 0===s&&(s={},i[t]=s),s[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,o=s[i],a=t[t.length-1],l=e._cacheIndex;a._cacheIndex=l,t[l]=a,t.pop(),delete o[r],0===Object.keys(o).length&&delete s[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return void 0===n&&(n=new Hc(new Float32Array(2),new Float32Array(2),1,xd),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let s="string"==typeof e?$c.findByName(i,e):e;const o=null!==s?s.uuid:e,a=this._actionsByClip[o];let l=null;if(void 0===n&&(n=null!==s?s.blendMode:Ht),void 0!==a){const e=a.actionByRoot[r];if(void 0!==e&&e.blendMode===n)return e;l=a.knownActions[0],null===s&&(s=l._clip)}if(null===s)return null;const c=new Ed(this,s,t,n);return this._bindAction(c,l),this._addInactiveAction(c,o,r),c}existingAction(e,t){const n=t||this._root,i=n.uuid,r="string"==typeof e?$c.findByName(n,e):e,s=r?r.uuid:e,o=this._actionsByClip[s];return void 0!==o&&o.actionByRoot[i]||null}stopAllAction(){const e=this._actions;for(let t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let o=0;o!==n;++o)t[o]._update(i,e,r,s);const o=this._bindings,a=this._nActiveBindings;for(let e=0;e!==a;++e)o[e].apply(s);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const e=r.knownActions;for(let n=0,i=e.length;n!==i;++n){const i=e[n];this._deactivateAction(i);const r=i._cacheIndex,s=t[t.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,s._cacheIndex=r,t[r]=s,t.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const e in n){const i=n[e].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}const i=this._bindingsByRootAndName[t];if(void 0!==i)for(const e in i){const t=i[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){const n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class Cd{constructor(e){this.value=e}clone(){return new Cd(void 0===this.value.clone?this.value:this.value.clone())}}let wd=0;class _d extends Hn{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:wd++}),this.name="",this.usage=Tn,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let e=0,n=t.length;e<n;e++){const n=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0;e<n.length;e++)this.uniforms.push(n[e].clone())}return this}clone(){return(new this.constructor).copy(this)}}class Md extends ao{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class Sd{constructor(e,t,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(e){!0===e&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Id=new lr;class Bd{constructor(e,t,n=0,i=1/0){this.ray=new ar(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new yr,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Id.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Id),this}intersectObject(e,t=!0,n=[]){return Rd(e,this,n,t),n.sort(Td),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)Rd(e[i],this,n,t);return n.sort(Td),n}}function Td(e,t){return e.distance-t.distance}function Rd(e,t,n,i){let r=!0;if(e.layers.test(t.layers)&&!1===e.raycast(t,n)&&(r=!1),!0===r&&!0===i){const i=e.children;for(let e=0,r=i.length;e<r;e++)Rd(i[e],t,n,!0)}}class Ld{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){const e=1e-6;return this.phi=Yn(this.phi,e,Math.PI-e),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Yn(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class Dd{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return(new this.constructor).copy(this)}}class Pd{constructor(e,t,n,i){Pd.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==e&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}const Ud=new ti;class Od{constructor(e=new ti(1/0,1/0),t=new ti(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Ud.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.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.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ud).distanceTo(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}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Fd=new Li,kd=new Li;class Nd{constructor(e=new Li,t=new Li){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){Fd.subVectors(e,this.start),kd.subVectors(this.end,this.start);const n=kd.dot(kd);let i=kd.dot(Fd)/n;return t&&(i=Yn(i,0,1)),i}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const Qd=new Li;class Gd extends Ur{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new Bs,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<n;e++,t++){const r=e/n*Math.PI*2,s=t/n*Math.PI*2;i.push(Math.cos(r),Math.sin(r),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new xs(i,3));const r=new _a({fog:!1,toneMapped:!1});this.cone=new Fa(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Qd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Qd),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const zd=new Li,Hd=new lr,Vd=new lr;class jd extends Fa{constructor(e){const t=Wd(e),n=new Bs,i=[],r=[],s=new es(0,0,1),o=new es(0,1,0);for(let e=0;e<t.length;e++){const n=t[e];n.parent&&n.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(s.r,s.g,s.b),r.push(o.r,o.g,o.b))}n.setAttribute("position",new xs(i,3)),n.setAttribute("color",new xs(r,3)),super(n,new _a({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Vd.copy(this.root.matrixWorld).invert();for(let e=0,n=0;e<t.length;e++){const r=t[e];r.parent&&r.parent.isBone&&(Hd.multiplyMatrices(Vd,r.matrixWorld),zd.setFromMatrixPosition(Hd),i.setXYZ(n,zd.x,zd.y,zd.z),Hd.multiplyMatrices(Vd,r.parent.matrixWorld),zd.setFromMatrixPosition(Hd),i.setXYZ(n+1,zd.x,zd.y,zd.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Wd(e){const t=[];!0===e.isBone&&t.push(e);for(let n=0;n<e.children.length;n++)t.push.apply(t,Wd(e.children[n]));return t}class qd extends Gs{constructor(e,t,n){super(new fc(t,4,2),new rs({wireframe:!0,fog:!1,toneMapped:!1})),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Xd=new Li,Yd=new es,Jd=new es;class Kd extends Ur{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new dc(t);i.rotateY(.5*Math.PI),this.material=new rs({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),s=new Float32Array(3*r.count);i.setAttribute("color",new us(s,3)),this.add(new Gs(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Yd.copy(this.light.color),Jd.copy(this.light.groundColor);for(let e=0,n=t.count;e<n;e++){const i=e<n/2?Yd:Jd;t.setXYZ(e,i.r,i.g,i.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Xd.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Zd extends Fa{constructor(e=10,t=10,n=4473924,i=8947848){n=new es(n),i=new es(i);const r=t/2,s=e/t,o=e/2,a=[],l=[];for(let e=0,c=0,h=-o;e<=t;e++,h+=s){a.push(-o,0,h,o,0,h),a.push(h,0,-o,h,0,o);const t=e===r?n:i;t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3}const c=new Bs;c.setAttribute("position",new xs(a,3)),c.setAttribute("color",new xs(l,3)),super(c,new _a({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class $d extends Fa{constructor(e=10,t=16,n=8,i=64,r=4473924,s=8947848){r=new es(r),s=new es(s);const o=[],a=[];if(t>1)for(let n=0;n<t;n++){const i=n/t*(2*Math.PI),l=Math.sin(i)*e,c=Math.cos(i)*e;o.push(0,0,0),o.push(l,0,c);const h=1&n?r:s;a.push(h.r,h.g,h.b),a.push(h.r,h.g,h.b)}for(let t=0;t<n;t++){const l=1&t?r:s,c=e-e/n*t;for(let e=0;e<i;e++){let t=e/i*(2*Math.PI),n=Math.sin(t)*c,r=Math.cos(t)*c;o.push(n,0,r),a.push(l.r,l.g,l.b),t=(e+1)/i*(2*Math.PI),n=Math.sin(t)*c,r=Math.cos(t)*c,o.push(n,0,r),a.push(l.r,l.g,l.b)}}const l=new Bs;l.setAttribute("position",new xs(o,3)),l.setAttribute("color",new xs(a,3)),super(l,new _a({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const eu=new Li,tu=new Li,nu=new Li;class iu extends Ur{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",void 0===t&&(t=1);let i=new Bs;i.setAttribute("position",new xs([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new _a({fog:!1,toneMapped:!1});this.lightPlane=new Da(i,r),this.add(this.lightPlane),i=new Bs,i.setAttribute("position",new xs([0,0,0,0,0,1],3)),this.targetLine=new Da(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),eu.setFromMatrixPosition(this.light.matrixWorld),tu.setFromMatrixPosition(this.light.target.matrixWorld),nu.subVectors(tu,eu),this.lightPlane.lookAt(tu),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(tu),this.targetLine.scale.z=nu.length()}}const ru=new Li,su=new Ys;class ou extends Fa{constructor(e){const t=new Bs,n=new _a({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={};function o(e,t){a(e),a(t)}function a(e){i.push(0,0,0),r.push(0,0,0),void 0===s[e]&&(s[e]=[]),s[e].push(i.length/3-1)}o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4"),t.setAttribute("position",new xs(i,3)),t.setAttribute("color",new xs(r,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update();const l=new es(16755200),c=new es(16711680),h=new es(43775),d=new es(16777215),u=new es(3355443);this.setColors(l,c,h,d,u)}setColors(e,t,n,i,r){const s=this.geometry.getAttribute("color");s.setXYZ(0,e.r,e.g,e.b),s.setXYZ(1,e.r,e.g,e.b),s.setXYZ(2,e.r,e.g,e.b),s.setXYZ(3,e.r,e.g,e.b),s.setXYZ(4,e.r,e.g,e.b),s.setXYZ(5,e.r,e.g,e.b),s.setXYZ(6,e.r,e.g,e.b),s.setXYZ(7,e.r,e.g,e.b),s.setXYZ(8,e.r,e.g,e.b),s.setXYZ(9,e.r,e.g,e.b),s.setXYZ(10,e.r,e.g,e.b),s.setXYZ(11,e.r,e.g,e.b),s.setXYZ(12,e.r,e.g,e.b),s.setXYZ(13,e.r,e.g,e.b),s.setXYZ(14,e.r,e.g,e.b),s.setXYZ(15,e.r,e.g,e.b),s.setXYZ(16,e.r,e.g,e.b),s.setXYZ(17,e.r,e.g,e.b),s.setXYZ(18,e.r,e.g,e.b),s.setXYZ(19,e.r,e.g,e.b),s.setXYZ(20,e.r,e.g,e.b),s.setXYZ(21,e.r,e.g,e.b),s.setXYZ(22,e.r,e.g,e.b),s.setXYZ(23,e.r,e.g,e.b),s.setXYZ(24,t.r,t.g,t.b),s.setXYZ(25,t.r,t.g,t.b),s.setXYZ(26,t.r,t.g,t.b),s.setXYZ(27,t.r,t.g,t.b),s.setXYZ(28,t.r,t.g,t.b),s.setXYZ(29,t.r,t.g,t.b),s.setXYZ(30,t.r,t.g,t.b),s.setXYZ(31,t.r,t.g,t.b),s.setXYZ(32,n.r,n.g,n.b),s.setXYZ(33,n.r,n.g,n.b),s.setXYZ(34,n.r,n.g,n.b),s.setXYZ(35,n.r,n.g,n.b),s.setXYZ(36,n.r,n.g,n.b),s.setXYZ(37,n.r,n.g,n.b),s.setXYZ(38,i.r,i.g,i.b),s.setXYZ(39,i.r,i.g,i.b),s.setXYZ(40,r.r,r.g,r.b),s.setXYZ(41,r.r,r.g,r.b),s.setXYZ(42,r.r,r.g,r.b),s.setXYZ(43,r.r,r.g,r.b),s.setXYZ(44,r.r,r.g,r.b),s.setXYZ(45,r.r,r.g,r.b),s.setXYZ(46,r.r,r.g,r.b),s.setXYZ(47,r.r,r.g,r.b),s.setXYZ(48,r.r,r.g,r.b),s.setXYZ(49,r.r,r.g,r.b),s.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap;su.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),au("c",t,e,su,0,0,-1),au("t",t,e,su,0,0,1),au("n1",t,e,su,-1,-1,-1),au("n2",t,e,su,1,-1,-1),au("n3",t,e,su,-1,1,-1),au("n4",t,e,su,1,1,-1),au("f1",t,e,su,-1,-1,1),au("f2",t,e,su,1,-1,1),au("f3",t,e,su,-1,1,1),au("f4",t,e,su,1,1,1),au("u1",t,e,su,.7,1.1,-1),au("u2",t,e,su,-.7,1.1,-1),au("u3",t,e,su,0,2,-1),au("cf1",t,e,su,-1,0,1),au("cf2",t,e,su,1,0,1),au("cf3",t,e,su,0,-1,1),au("cf4",t,e,su,0,1,1),au("cn1",t,e,su,-1,0,-1),au("cn2",t,e,su,1,0,-1),au("cn3",t,e,su,0,-1,-1),au("cn4",t,e,su,0,1,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function au(e,t,n,i,r,s,o){ru.set(r,s,o).unproject(i);const a=t[e];if(void 0!==a){const e=n.getAttribute("position");for(let t=0,n=a.length;t<n;t++)e.setXYZ(a[t],ru.x,ru.y,ru.z)}}const lu=new Ui;class cu extends Fa{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new Bs;r.setIndex(new us(n,1)),r.setAttribute("position",new us(i,3)),super(r,new _a({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&lu.setFromObject(this.object),lu.isEmpty())return;const t=lu.min,n=lu.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class hu extends Fa{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Bs;i.setIndex(new us(n,1)),i.setAttribute("position",new xs([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new _a({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class du extends Da{constructor(e,t=1,n=16776960){const i=n,r=new Bs;r.setAttribute("position",new xs([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),r.computeBoundingSphere(),super(r,new _a({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const s=new Bs;s.setAttribute("position",new xs([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),this.add(new Gs(s,new rs({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const uu=new Li;let pu,Au;class fu extends Ur{constructor(e=new Li(0,0,1),t=new Li(0,0,0),n=1,i=16776960,r=.2*n,s=.2*r){super(),this.type="ArrowHelper",void 0===pu&&(pu=new Bs,pu.setAttribute("position",new xs([0,0,0,0,1,0],3)),Au=new _l(0,.5,1,5,1),Au.translate(0,-.5,0)),this.position.copy(t),this.line=new Da(pu,new _a({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Gs(Au,new rs({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,s)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{uu.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(uu,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}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class mu extends Fa{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 Bs;n.setAttribute("position",new xs(t,3)),n.setAttribute("color",new xs([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new _a({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,n){const i=new es,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class gu{constructor(){this.type="ShapePath",this.color=new es,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new xl,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,s){return this.currentPath.bezierCurveTo(e,t,n,i,r,s),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(e,t){const n=t.length;let i=!1;for(let r=n-1,s=0;s<n;r=s++){let n=t[r],o=t[s],a=o.x-n.x,l=o.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=t[s],a=-a,o=t[r],l=-l),e.y<n.y||e.y>o.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-a*(e.y-n.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==n.y)continue;if(o.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=o.x)return!0}}return i}const n=sc.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,s,o;const a=[];if(1===i.length)return s=i[0],o=new Pl,o.curves=s.curves,a.push(o),a;let l=!n(i[0].getPoints());l=e?!l:l;const c=[],h=[];let d,u,p=[],A=0;h[A]=void 0,p[A]=[];for(let t=0,o=i.length;t<o;t++)s=i[t],d=s.getPoints(),r=n(d),r=e?!r:r,r?(!l&&h[A]&&A++,h[A]={s:new Pl,p:d},h[A].s.curves=s.curves,l&&A++,p[A]=[]):p[A].push({h:s,p:d[0]});if(!h[0])return function(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n],r=new Pl;r.curves=i.curves,t.push(r)}return t}(i);if(h.length>1){let e=!1,n=0;for(let e=0,t=h.length;e<t;e++)c[e]=[];for(let i=0,r=h.length;i<r;i++){const r=p[i];for(let s=0;s<r.length;s++){const o=r[s];let a=!0;for(let r=0;r<h.length;r++)t(o.p,h[r].p)&&(i!==r&&n++,a?(a=!1,c[r].push(o)):e=!0);a&&c[i].push(o)}}n>0&&!1===e&&(p=c)}for(let e=0,t=h.length;e<t;e++){o=h[e].s,a.push(o),u=p[e];for(let e=0,t=u.length;e<t;e++)o.holes.push(u[e].h)}return a}}class vu extends Hn{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}function yu(e,t,n,i){const r=function(e){switch(e){case Re:case Le:return{byteLength:1,components:1};case Pe:case De:case ke:return{byteLength:2,components:1};case Ne:case Qe:return{byteLength:2,components:4};case Oe:case Ue:case Fe:return{byteLength:4,components:1};case ze:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${e}.`)}(i);switch(n){case He:case We:return e*t;case qe:return e*t*2;case Je:case Ke:return e*t/r.components*r.byteLength;case Ze:case $e:return e*t*2/r.components*r.byteLength;case Ve:return e*t*3/r.components*r.byteLength;case je:case tt:return e*t*4/r.components*r.byteLength;case nt:case it:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case rt:case st:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case at:case ct:return Math.max(e,16)*Math.max(t,8)/4;case ot:case lt:return Math.max(e,8)*Math.max(t,8)/2;case ht:case dt:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case ut:case pt:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case At:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case ft:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case mt:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case gt:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case vt:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case yt:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case Et:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case xt:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case bt:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case Ct:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case wt:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case _t:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case Mt:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case St:case It:case Bt:return Math.ceil(e/4)*Math.ceil(t/4)*16;case Tt:case Rt:return Math.ceil(e/4)*Math.ceil(t/4)*8;case Lt:case Dt:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}const Eu={contain:function(e,t){const n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e},cover:function(e,t){const n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e},fill:function(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e},getByteLength:yu};class xu extends Mi{constructor(e=1,t=1,n=1,i={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,t,{...i,count:n}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}function bu(){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 Cu(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.version<n.version)&&t.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}const r=t.get(n);if(void 0===r)t.set(n,function(t,n){const i=t.array,r=t.usage,s=i.byteLength,o=e.createBuffer();let a;if(e.bindBuffer(n,o),e.bufferData(n,i,r),t.onUploadCallback(),i instanceof Float32Array)a=e.FLOAT;else if(i instanceof Uint16Array)a=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(i instanceof Int16Array)a=e.SHORT;else if(i instanceof Uint32Array)a=e.UNSIGNED_INT;else if(i instanceof Int32Array)a=e.INT;else if(i instanceof Int8Array)a=e.BYTE;else if(i instanceof Uint8Array)a=e.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);a=e.UNSIGNED_BYTE}return{buffer:o,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version,size:s}}(n,i));else if(r.version<n.version){if(r.size!==n.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,n,i){const r=n.array,s=n.updateRanges;if(e.bindBuffer(i,t),0===s.length)e.bufferSubData(i,0,r);else{s.sort(((e,t)=>e.start-t.start));let t=0;for(let e=1;e<s.length;e++){const n=s[t],i=s[e];i.start<=n.start+n.count+1?n.count=Math.max(n.count,i.start+i.count-n.start):(++t,s[t]=i)}s.length=t+1;for(let t=0,n=s.length;t<n;t++){const n=s[t];e.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:s}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=s);const wu={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_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 ) || defined( USE_BATCHING_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\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( 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 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in 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( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\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 shadowIntensity;\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\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 shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, 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.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},_u={common:{diffuse:{value:new es(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ni},alphaMap:{value:null},alphaMapTransform:{value:new ni},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ni}},envmap:{envMap:{value:null},envMapRotation:{value:new ni},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ni}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ni}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ni},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ni},normalScale:{value:new ti(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ni},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ni}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ni}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ni}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new es(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 es(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ni},alphaTest:{value:0},uvTransform:{value:new ni}},sprite:{diffuse:{value:new es(16777215)},opacity:{value:1},center:{value:new ti(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ni},alphaMap:{value:null},alphaMapTransform:{value:new ni},alphaTest:{value:0}}},Mu={basic:{uniforms:js([_u.common,_u.specularmap,_u.envmap,_u.aomap,_u.lightmap,_u.fog]),vertexShader:wu.meshbasic_vert,fragmentShader:wu.meshbasic_frag},lambert:{uniforms:js([_u.common,_u.specularmap,_u.envmap,_u.aomap,_u.lightmap,_u.emissivemap,_u.bumpmap,_u.normalmap,_u.displacementmap,_u.fog,_u.lights,{emissive:{value:new es(0)}}]),vertexShader:wu.meshlambert_vert,fragmentShader:wu.meshlambert_frag},phong:{uniforms:js([_u.common,_u.specularmap,_u.envmap,_u.aomap,_u.lightmap,_u.emissivemap,_u.bumpmap,_u.normalmap,_u.displacementmap,_u.fog,_u.lights,{emissive:{value:new es(0)},specular:{value:new es(1118481)},shininess:{value:30}}]),vertexShader:wu.meshphong_vert,fragmentShader:wu.meshphong_frag},standard:{uniforms:js([_u.common,_u.envmap,_u.aomap,_u.lightmap,_u.emissivemap,_u.bumpmap,_u.normalmap,_u.displacementmap,_u.roughnessmap,_u.metalnessmap,_u.fog,_u.lights,{emissive:{value:new es(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:wu.meshphysical_vert,fragmentShader:wu.meshphysical_frag},toon:{uniforms:js([_u.common,_u.aomap,_u.lightmap,_u.emissivemap,_u.bumpmap,_u.normalmap,_u.displacementmap,_u.gradientmap,_u.fog,_u.lights,{emissive:{value:new es(0)}}]),vertexShader:wu.meshtoon_vert,fragmentShader:wu.meshtoon_frag},matcap:{uniforms:js([_u.common,_u.bumpmap,_u.normalmap,_u.displacementmap,_u.fog,{matcap:{value:null}}]),vertexShader:wu.meshmatcap_vert,fragmentShader:wu.meshmatcap_frag},points:{uniforms:js([_u.points,_u.fog]),vertexShader:wu.points_vert,fragmentShader:wu.points_frag},dashed:{uniforms:js([_u.common,_u.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:wu.linedashed_vert,fragmentShader:wu.linedashed_frag},depth:{uniforms:js([_u.common,_u.displacementmap]),vertexShader:wu.depth_vert,fragmentShader:wu.depth_frag},normal:{uniforms:js([_u.common,_u.bumpmap,_u.normalmap,_u.displacementmap,{opacity:{value:1}}]),vertexShader:wu.meshnormal_vert,fragmentShader:wu.meshnormal_frag},sprite:{uniforms:js([_u.sprite,_u.fog]),vertexShader:wu.sprite_vert,fragmentShader:wu.sprite_frag},background:{uniforms:{uvTransform:{value:new ni},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:wu.background_vert,fragmentShader:wu.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ni}},vertexShader:wu.backgroundCube_vert,fragmentShader:wu.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:wu.cube_vert,fragmentShader:wu.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:wu.equirect_vert,fragmentShader:wu.equirect_frag},distanceRGBA:{uniforms:js([_u.common,_u.displacementmap,{referencePosition:{value:new Li},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:wu.distanceRGBA_vert,fragmentShader:wu.distanceRGBA_frag},shadow:{uniforms:js([_u.lights,_u.fog,{color:{value:new es(0)},opacity:{value:1}}]),vertexShader:wu.shadow_vert,fragmentShader:wu.shadow_frag}};Mu.physical={uniforms:js([Mu.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ni},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ni},clearcoatNormalScale:{value:new ti(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ni},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ni},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ni},sheen:{value:0},sheenColor:{value:new es(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ni},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ni},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ni},transmissionSamplerSize:{value:new ti},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ni},attenuationDistance:{value:0},attenuationColor:{value:new es(0)},specularColor:{value:new es(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ni},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ni},anisotropyVector:{value:new ti},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ni}}]),vertexShader:wu.meshphysical_vert,fragmentShader:wu.meshphysical_frag};const Su={r:0,b:0,g:0},Iu=new vr,Bu=new lr;function Tu(e,t,n,i,r,s,o){const a=new es(0);let l,c,h=!0===s?0:1,d=null,u=0,p=null;function A(e){let i=!0===e.isScene?e.background:null;return i&&i.isTexture&&(i=(e.backgroundBlurriness>0?n:t).get(i)),i}function f(t,n){t.getRGB(Su,Ws(e)),i.buffers.color.setClear(Su.r,Su.g,Su.b,n,o)}return{getClearColor:function(){return a},setClearColor:function(e,t=1){a.set(e),h=t,f(a,h)},getClearAlpha:function(){return h},setClearAlpha:function(e){h=e,f(a,h)},render:function(t){let n=!1;const r=A(t);null===r?f(a,h):r&&r.isColor&&(f(r,1),n=!0);const s=e.xr.getEnvironmentBlendMode();"additive"===s?i.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===s&&i.buffers.color.setClear(0,0,0,0,o),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const i=A(n);i&&(i.isCubeTexture||i.mapping===ge)?(void 0===c&&(c=new Gs(new Hs(1e4,1e4,1e4),new Xs({name:"BackgroundCubeMaterial",uniforms:Vs(Mu.backgroundCube.uniforms),vertexShader:Mu.backgroundCube.vertexShader,fragmentShader:Mu.backgroundCube.fragmentShader,side:g,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),Iu.copy(n.backgroundRotation),Iu.x*=-1,Iu.y*=-1,Iu.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(Iu.y*=-1,Iu.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Bu.makeRotationFromEuler(Iu)),c.material.toneMapped=Ai.getTransfer(i.colorSpace)!==sn,d===i&&u===i.version&&p===e.toneMapping||(c.material.needsUpdate=!0,d=i,u=i.version,p=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new Gs(new uc(2,2),new Xs({name:"BackgroundMaterial",uniforms:Vs(Mu.background.uniforms),vertexShader:Mu.background.vertexShader,fragmentShader:Mu.background.fragmentShader,side:m,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=Ai.getTransfer(i.colorSpace)!==sn,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),d===i&&u===i.version&&p===e.toneMapping||(l.material.needsUpdate=!0,d=i,u=i.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==c&&(c.geometry.dispose(),c.material.dispose()),void 0!==l&&(l.geometry.dispose(),l.material.dispose())}}}function Ru(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=c(null);let s=r,o=!1;function a(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){const t=[],i=[],r=[];for(let e=0;e<n;e++)t[e]=0,i[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:i,attributeDivisors:r,object:e,attributes:{},index:null}}function h(){const e=s.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function d(e){u(e,0)}function u(t,n){const i=s.newAttributes,r=s.enabledAttributes,o=s.attributeDivisors;i[t]=1,0===r[t]&&(e.enableVertexAttribArray(t),r[t]=1),o[t]!==n&&(e.vertexAttribDivisor(t,n),o[t]=n)}function p(){const t=s.newAttributes,n=s.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==t[i]&&(e.disableVertexAttribArray(i),n[i]=0)}function A(t,n,i,r,s,o,a){!0===a?e.vertexAttribIPointer(t,n,i,s,o):e.vertexAttribPointer(t,n,i,r,s,o)}function f(){m(),o=!0,s!==r&&(s=r,a(s.object))}function m(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,f,m){let g=!1;const v=function(t,n,r){const s=!0===r.wireframe;let o=i[t.id];void 0===o&&(o={},i[t.id]=o);let a=o[n.id];void 0===a&&(a={},o[n.id]=a);let l=a[s];return void 0===l&&(l=c(e.createVertexArray()),a[s]=l),l}(f,l,r);s!==v&&(s=v,a(s.object)),g=function(e,t,n,i){const r=s.attributes,o=t.attributes;let a=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){const n=r[t];let i=o[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;a++}return s.attributesNum!==a||s.index!==i}(n,f,l,m),g&&function(e,t,n,i){const r={},o=t.attributes;let a=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){let n=o[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,a++}s.attributes=r,s.attributesNum=a,s.index=i}(n,f,l,m),null!==m&&t.update(m,e.ELEMENT_ARRAY_BUFFER),(g||o)&&(o=!1,function(n,i,r,s){h();const o=s.attributes,a=r.getAttributes(),l=i.defaultAttributeValues;for(const i in a){const r=a[i];if(r.location>=0){let a=o[i];if(void 0===a&&("instanceMatrix"===i&&n.instanceMatrix&&(a=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(a=n.instanceColor)),void 0!==a){const i=a.normalized,o=a.itemSize,l=t.get(a);if(void 0===l)continue;const c=l.buffer,h=l.type,p=l.bytesPerElement,f=h===e.INT||h===e.UNSIGNED_INT||a.gpuType===Ue;if(a.isInterleavedBufferAttribute){const t=a.data,l=t.stride,m=a.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)u(r.location+e,t.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<r.locationSize;e++)d(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)A(r.location+e,o/r.locationSize,h,i,l*p,(m+o/r.locationSize*e)*p,f)}else{if(a.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)u(r.location+e,a.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let e=0;e<r.locationSize;e++)d(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)A(r.location+e,o/r.locationSize,h,i,o*p,o/r.locationSize*e*p,f)}}else if(void 0!==l){const t=l[i];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(r.location,t);break;case 3:e.vertexAttrib3fv(r.location,t);break;case 4:e.vertexAttrib4fv(r.location,t);break;default:e.vertexAttrib1fv(r.location,t)}}}}p()}(n,r,l,f),null!==m&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(m).buffer))},reset:f,resetDefaultState:m,dispose:function(){f();for(const e in i){const t=i[e];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e]}},releaseStatesOfGeometry:function(e){if(void 0===i[e.id])return;const t=i[e.id];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e.id]},releaseStatesOfProgram:function(e){for(const t in i){const n=i[t];if(void 0===n[e.id])continue;const r=n[e.id];for(const e in r)l(r[e].object),delete r[e];delete n[e.id]}},initAttributes:h,enableAttribute:d,disableUnusedAttributes:p}}function Lu(e,t,n){let i;function r(t,r,s){0!==s&&(e.drawArraysInstanced(i,t,r,s),n.update(r,i,s))}this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(e,r,s){if(0===s)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,e,0,r,0,s);let o=0;for(let e=0;e<s;e++)o+=r[e];n.update(o,i,1)},this.renderMultiDrawInstances=function(e,s,o,a){if(0===o)return;const l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)r(e[t],s[t],a[t]);else{l.multiDrawArraysInstancedWEBGL(i,e,0,s,0,a,0,o);let t=0;for(let e=0;e<o;e++)t+=s[e]*a[e];n.update(t,i,1)}}}function Du(e,t,n,i){let r;function s(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==n.precision?n.precision:"highp";const a=s(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=!0===n.logarithmicDepthBuffer,c=!0===n.reverseDepthBuffer&&t.has("EXT_clip_control"),h=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:s,textureFormatReadable:function(t){return t===je||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===ke&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==Re&&i.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==Fe&&!r)},precision:o,logarithmicDepthBuffer:l,reverseDepthBuffer:c,maxTextures:h,maxVertexTextures:d,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:d>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function Pu(e){const t=this;let n=null,i=0,r=!1,s=!1;const o=new ia,a=new ni,l={value:null,needsUpdate:!1};function c(e,n,i,r){const s=null!==e?e.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const t=i+4*s,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===c||c.length<t)&&(c=new Float32Array(t));for(let t=0,n=i;t!==s;++t,n+=4)o.copy(e[t]).applyMatrix4(r,a),o.normal.toArray(c,n),c[n+3]=o.constant}l.value=c,l.needsUpdate=!0}return t.numPlanes=s,t.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){const n=0!==e.length||t||0!==i||r;return r=t,i=e.length,n},this.beginShadows=function(){s=!0,c(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(e,t){n=c(e,t,0)},this.setState=function(o,a,h){const d=o.clippingPlanes,u=o.clipIntersection,p=o.clipShadows,A=e.get(o);if(!r||null===d||0===d.length||s&&!p)s?c(null):(l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0);else{const e=s?0:i,t=4*e;let r=A.clippingState||null;l.value=r,r=c(d,a,t,h);for(let e=0;e!==t;++e)r[e]=n[e];A.clippingState=r,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=e}}}function Uu(e){let t=new WeakMap;function n(e,t){return t===fe?e.mapping=pe:t===me&&(e.mapping=Ae),e}function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping;if(s===fe||s===me){if(t.has(r))return n(t.get(r).texture,r.mapping);{const s=r.image;if(s&&s.height>0){const o=new io(s.height);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}const Ou=[.125,.215,.35,.446,.526,.582],Fu=new Sh,ku=new es;let Nu=null,Qu=0,Gu=0,zu=!1;const Hu=(1+Math.sqrt(5))/2,Vu=1/Hu,ju=[new Li(-Hu,Vu,0),new Li(Hu,Vu,0),new Li(-Vu,0,Hu),new Li(Vu,0,Hu),new Li(0,Hu,-Vu),new Li(0,Hu,Vu),new Li(-1,1,-1),new Li(1,1,-1),new Li(-1,1,1),new Li(1,1,1)];class Wu{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Nu=this._renderer.getRenderTarget(),Qu=this._renderer.getActiveCubeFace(),Gu=this._renderer.getActiveMipmapLevel(),zu=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Ju(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Yu(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Nu,Qu,Gu),this._renderer.xr.enabled=zu,e.scissorTest=!1,Xu(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===pe||e.mapping===Ae?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Nu=this._renderer.getRenderTarget(),Qu=this._renderer.getActiveCubeFace(),Gu=this._renderer.getActiveMipmapLevel(),zu=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Me,minFilter:Me,generateMipmaps:!1,type:ke,format:je,colorSpace:nn,depthBuffer:!1},i=qu(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=qu(e,t,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){const t=[],n=[],i=[];let r=e;const s=e-4+1+Ou.length;for(let o=0;o<s;o++){const s=Math.pow(2,r);n.push(s);let a=1/s;o>e-4?a=Ou[o-e+4-1]:0===o&&(a=0),i.push(a);const l=1/(s-2),c=-l,h=1+l,d=[c,c,h,c,h,h,c,c,h,h,c,h],u=6,p=6,A=3,f=2,m=1,g=new Float32Array(A*p*u),v=new Float32Array(f*p*u),y=new Float32Array(m*p*u);for(let e=0;e<u;e++){const t=e%3*2/3-1,n=e>2?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,A*p*e),v.set(d,f*p*e);const r=[e,e,e,e,e,e];y.set(r,m*p*e)}const E=new Bs;E.setAttribute("position",new us(g,A)),E.setAttribute("uv",new us(v,f)),E.setAttribute("faceIndex",new us(y,m)),t.push(E),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(20),r=new Li(0,1,0);return new Xs({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:y,depthTest:!1,depthWrite:!1})}(i,e,t)}return i}_compileMaterial(e){const t=new Gs(this._lodPlanes[0],e);this._renderer.compile(t,Fu)}_sceneToCubeUV(e,t,n,i){const r=new $s(90,1,t,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,c=a.toneMapping;a.getClearColor(ku),a.toneMapping=ne,a.autoClear=!1;const h=new rs({name:"PMREM.Background",side:g,depthWrite:!1,depthTest:!1}),d=new Gs(new Hs,h);let u=!1;const p=e.background;p?p.isColor&&(h.color.copy(p),e.background=null,u=!0):(h.color.copy(ku),u=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,s[t],0),r.lookAt(o[t],0,0)):1===n?(r.up.set(0,0,s[t]),r.lookAt(0,o[t],0)):(r.up.set(0,s[t],0),r.lookAt(0,0,o[t]));const l=this._cubeSize;Xu(i,n*l,t>2?l:0,l,l),a.setRenderTarget(i),u&&a.render(d,r),a.render(e,r)}d.geometry.dispose(),d.material.dispose(),a.toneMapping=c,a.autoClear=l,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===pe||e.mapping===Ae;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Ju()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Yu());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new Gs(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const o=this._cubeSize;Xu(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(s,Fu)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let t=1;t<i;t++){const n=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),r=ju[(i-t-1)%ju.length];this._blur(e,t-1,t,n,r)}t.autoClear=n}_blur(e,t,n,i,r){const s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,i,"latitudinal",r),this._halfBlur(s,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,s,o){const a=this._renderer,l=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Gs(this._lodPlanes[i],l),h=l.uniforms,d=this._sizeLods[n]-1,u=isFinite(r)?Math.PI/(2*d):2*Math.PI/39,p=r/u,A=isFinite(r)?1+Math.floor(3*p):20;A>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${A} samples when the maximum is set to 20`);const f=[];let m=0;for(let e=0;e<20;++e){const t=e/p,n=Math.exp(-t*t/2);f.push(n),0===e?m+=n:e<A&&(m+=2*n)}for(let e=0;e<f.length;e++)f[e]=f[e]/m;h.envMap.value=e.texture,h.samples.value=A,h.weights.value=f,h.latitudinal.value="latitudinal"===s,o&&(h.poleAxis.value=o);const{_lodMax:g}=this;h.dTheta.value=u,h.mipInt.value=g-n;const v=this._sizeLods[i];Xu(t,3*v*(i>g-4?i-g+4:0),4*(this._cubeSize-v),3*v,2*v),a.setRenderTarget(t),a.render(c,Fu)}}function qu(e,t,n){const i=new Mi(e,t,n);return i.texture.mapping=ge,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Xu(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Yu(){return new Xs({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:y,depthTest:!1,depthWrite:!1})}function Ju(){return new Xs({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:y,depthTest:!1,depthWrite:!1})}function Ku(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,o=s===fe||s===me,a=s===pe||s===Ae;if(o||a){let s=t.get(r);const l=void 0!==s?s.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new Wu(e)),s=o?n.fromEquirectangular(r,s):n.fromCubemap(r,s),s.texture.pmremVersion=r.pmremVersion,t.set(r,s),s.texture;if(void 0!==s)return s.texture;{const l=r.image;return o&&l&&l.height>0||a&&l&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)?(null===n&&(n=new Wu(e)),s=o?n.fromEquirectangular(r):n.fromCubemap(r),s.texture.pmremVersion=r.pmremVersion,t.set(r,s),r.addEventListener("dispose",i),s.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Zu(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(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){const t=n(e);return null===t&&hi("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function $u(e,t,n,i){const r={},s=new WeakMap;function o(e){const a=e.target;null!==a.index&&t.remove(a.index);for(const e in a.attributes)t.remove(a.attributes[e]);a.removeEventListener("dispose",o),delete r[a.id];const l=s.get(a);l&&(t.remove(l),s.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(e){const n=[],i=e.index,r=e.attributes.position;let o=0;if(null!==i){const e=i.array;o=i.version;for(let t=0,i=e.length;t<i;t+=3){const i=e[t+0],r=e[t+1],s=e[t+2];n.push(i,r,r,s,s,i)}}else{if(void 0===r)return;{const e=r.array;o=r.version;for(let t=0,i=e.length/3-1;t<i;t+=3){const e=t+0,i=t+1,r=t+2;n.push(e,i,i,r,r,e)}}}const a=new(ri(n)?ys:gs)(n,1);a.version=o;const l=s.get(e);l&&t.remove(l),s.set(e,a)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",o),r[t.id]=!0,n.memory.geometries++),t},update:function(n){const i=n.attributes;for(const n in i)t.update(i[n],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){const t=s.get(e);if(t){const n=e.index;null!==n&&t.version<n.version&&a(e)}else a(e);return s.get(e)}}}function ep(e,t,n){let i,r,s;function o(t,o,a){0!==a&&(e.drawElementsInstanced(i,o,r,t*s,a),n.update(o,i,a))}this.setMode=function(e){i=e},this.setIndex=function(e){r=e.type,s=e.bytesPerElement},this.render=function(t,o){e.drawElements(i,o,r,t*s),n.update(o,i,1)},this.renderInstances=o,this.renderMultiDraw=function(e,s,o){if(0===o)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,s,0,r,e,0,o);let a=0;for(let e=0;e<o;e++)a+=s[e];n.update(a,i,1)},this.renderMultiDrawInstances=function(e,a,l,c){if(0===l)return;const h=t.get("WEBGL_multi_draw");if(null===h)for(let t=0;t<e.length;t++)o(e[t]/s,a[t],c[t]);else{h.multiDrawElementsInstancedWEBGL(i,a,0,r,e,0,c,0,l);let t=0;for(let e=0;e<l;e++)t+=a[e]*c[e];n.update(t,i,1)}}}function tp(e){const t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,i,r){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=r*(n/3);break;case e.LINES:t.lines+=r*(n/2);break;case e.LINE_STRIP:t.lines+=r*(n-1);break;case e.LINE_LOOP:t.lines+=r*n;break;case e.POINTS:t.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function np(e,t,n){const i=new WeakMap,r=new wi;return{update:function(s,o,a){const l=s.morphTargetInfluences,c=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=void 0!==c?c.length:0;let d=i.get(o);if(void 0===d||d.count!==h){void 0!==d&&d.texture.dispose();const u=void 0!==o.morphAttributes.position,p=void 0!==o.morphAttributes.normal,A=void 0!==o.morphAttributes.color,f=o.morphAttributes.position||[],m=o.morphAttributes.normal||[],g=o.morphAttributes.color||[];let v=0;!0===u&&(v=1),!0===p&&(v=2),!0===A&&(v=3);let y=o.attributes.position.count*v,E=1;y>t.maxTextureSize&&(E=Math.ceil(y/t.maxTextureSize),y=t.maxTextureSize);const x=new Float32Array(y*E*4*h),b=new Si(x,y,E,h);b.type=Fe,b.needsUpdate=!0;const C=4*v;for(let _=0;_<h;_++){const M=f[_],S=m[_],I=g[_],B=y*E*4*_;for(let T=0;T<M.count;T++){const R=T*C;!0===u&&(r.fromBufferAttribute(M,T),x[B+R+0]=r.x,x[B+R+1]=r.y,x[B+R+2]=r.z,x[B+R+3]=0),!0===p&&(r.fromBufferAttribute(S,T),x[B+R+4]=r.x,x[B+R+5]=r.y,x[B+R+6]=r.z,x[B+R+7]=0),!0===A&&(r.fromBufferAttribute(I,T),x[B+R+8]=r.x,x[B+R+9]=r.y,x[B+R+10]=r.z,x[B+R+11]=4===I.itemSize?r.w:1)}}function w(){b.dispose(),i.delete(o),o.removeEventListener("dispose",w)}d={count:h,texture:b,size:new ti(y,E)},i.set(o,d),o.addEventListener("dispose",w)}if(!0===s.isInstancedMesh&&null!==s.morphTexture)a.getUniforms().setValue(e,"morphTexture",s.morphTexture,n);else{let L=0;for(let P=0;P<l.length;P++)L+=l[P];const D=o.morphTargetsRelative?1:1-L;a.getUniforms().setValue(e,"morphTargetBaseInfluence",D),a.getUniforms().setValue(e,"morphTargetInfluences",l)}a.getUniforms().setValue(e,"morphTargetsTexture",d.texture,n),a.getUniforms().setValue(e,"morphTargetsTextureSize",d.size)}}}class ip{constructor(e,t,n){if(this.renderer=e,this.DEFAULT_NUMVIEWS=2,this.maxNumViews=0,this.gl=n,this.extensions=t,this.available=this.extensions.has("OCULUS_multiview"),this.available){const e=this.extensions.get("OCULUS_multiview");this.maxNumViews=this.gl.getParameter(e.MAX_VIEWS_OVR),this.mat4=[],this.mat3=[],this.cameraArray=[];for(var i=0;i<this.maxNumViews;i++)this.mat4[i]=new lr,this.mat3[i]=new ni}}getCameraArray(e){return e.isArrayCamera?e.cameras:(this.cameraArray[0]=e,this.cameraArray)}updateCameraProjectionMatricesUniform(e,t){for(var n=this.getCameraArray(e),i=0;i<n.length;i++)this.mat4[i].copy(n[i].projectionMatrix);t.setValue(this.gl,"projectionMatrices",this.mat4)}updateCameraViewMatricesUniform(e,t){for(var n=this.getCameraArray(e),i=0;i<n.length;i++)this.mat4[i].copy(n[i].matrixWorldInverse);t.setValue(this.gl,"viewMatrices",this.mat4)}updateObjectMatricesUniforms(e,t,n){for(var i=this.getCameraArray(t),r=0;r<i.length;r++)this.mat4[r].multiplyMatrices(i[r].matrixWorldInverse,e.matrixWorld),this.mat3[r].getNormalMatrix(this.mat4[r]);n.setValue(this.gl,"modelViewMatrices",this.mat4),n.setValue(this.gl,"normalMatrices",this.mat3)}}function rp(e,t,n,i){let r=new WeakMap;function s(e){const t=e.target;t.removeEventListener("dispose",s),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(o){const a=i.render.frame,l=o.geometry,c=t.get(o,l);if(r.get(c)!==a&&(t.update(c),r.set(c,a)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",s)&&o.addEventListener("dispose",s),r.get(o)!==a&&(n.update(o.instanceMatrix,e.ARRAY_BUFFER),null!==o.instanceColor&&n.update(o.instanceColor,e.ARRAY_BUFFER),r.set(o,a))),o.isSkinnedMesh){const e=o.skeleton;r.get(e)!==a&&(e.update(),r.set(e,a))}return c},dispose:function(){r=new WeakMap}}}const sp=new Ci,op=new $a(1,1),ap=new Si,lp=new Bi,cp=new no,hp=[],dp=[],up=new Float32Array(16),pp=new Float32Array(9),Ap=new Float32Array(4);function fp(e,t,n){const i=e[0];if(i<=0||i>0)return e;const r=t*n;let s=hp[r];if(void 0===s&&(s=new Float32Array(r),hp[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 mp(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function gp(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function vp(e,t){let n=dp[t];void 0===n&&(n=new Int32Array(t),dp[t]=n);for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function yp(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Ep(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(mp(n,t))return;e.uniform2fv(this.addr,t),gp(n,t)}}function xp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(mp(n,t))return;e.uniform3fv(this.addr,t),gp(n,t)}}function bp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(mp(n,t))return;e.uniform4fv(this.addr,t),gp(n,t)}}function Cp(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(mp(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),gp(n,t)}else{if(mp(n,i))return;Ap.set(i),e.uniformMatrix2fv(this.addr,!1,Ap),gp(n,i)}}function wp(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(mp(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),gp(n,t)}else{if(mp(n,i))return;pp.set(i),e.uniformMatrix3fv(this.addr,!1,pp),gp(n,i)}}function _p(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(mp(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),gp(n,t)}else{if(mp(n,i))return;up.set(i),e.uniformMatrix4fv(this.addr,!1,up),gp(n,i)}}function Mp(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Sp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(mp(n,t))return;e.uniform2iv(this.addr,t),gp(n,t)}}function Ip(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(mp(n,t))return;e.uniform3iv(this.addr,t),gp(n,t)}}function Bp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(mp(n,t))return;e.uniform4iv(this.addr,t),gp(n,t)}}function Tp(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Rp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(mp(n,t))return;e.uniform2uiv(this.addr,t),gp(n,t)}}function Lp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(mp(n,t))return;e.uniform3uiv(this.addr,t),gp(n,t)}}function Dp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(mp(n,t))return;e.uniform4uiv(this.addr,t),gp(n,t)}}function Pp(e,t,n){const i=this.cache,r=n.allocateTextureUnit();let s;i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),this.type===e.SAMPLER_2D_SHADOW?(op.compareFunction=_n,s=op):s=sp,n.setTexture2D(t||s,r)}function Up(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||lp,r)}function Op(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(t||cp,r)}function Fp(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||ap,r)}function kp(e,t){e.uniform1fv(this.addr,t)}function Np(e,t){const n=fp(t,this.size,2);e.uniform2fv(this.addr,n)}function Qp(e,t){const n=fp(t,this.size,3);e.uniform3fv(this.addr,n)}function Gp(e,t){const n=fp(t,this.size,4);e.uniform4fv(this.addr,n)}function zp(e,t){const n=fp(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Hp(e,t){const n=fp(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Vp(e,t){const n=fp(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function jp(e,t){e.uniform1iv(this.addr,t)}function Wp(e,t){e.uniform2iv(this.addr,t)}function qp(e,t){e.uniform3iv(this.addr,t)}function Xp(e,t){e.uniform4iv(this.addr,t)}function Yp(e,t){e.uniform1uiv(this.addr,t)}function Jp(e,t){e.uniform2uiv(this.addr,t)}function Kp(e,t){e.uniform3uiv(this.addr,t)}function Zp(e,t){e.uniform4uiv(this.addr,t)}function $p(e,t,n){const i=this.cache,r=t.length,s=vp(n,r);mp(i,s)||(e.uniform1iv(this.addr,s),gp(i,s));for(let e=0;e!==r;++e)n.setTexture2D(t[e]||sp,s[e])}function eA(e,t,n){const i=this.cache,r=t.length,s=vp(n,r);mp(i,s)||(e.uniform1iv(this.addr,s),gp(i,s));for(let e=0;e!==r;++e)n.setTexture3D(t[e]||lp,s[e])}function tA(e,t,n){const i=this.cache,r=t.length,s=vp(n,r);mp(i,s)||(e.uniform1iv(this.addr,s),gp(i,s));for(let e=0;e!==r;++e)n.setTextureCube(t[e]||cp,s[e])}function nA(e,t,n){const i=this.cache,r=t.length,s=vp(n,r);mp(i,s)||(e.uniform1iv(this.addr,s),gp(i,s));for(let e=0;e!==r;++e)n.setTexture2DArray(t[e]||ap,s[e])}class iA{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return yp;case 35664:return Ep;case 35665:return xp;case 35666:return bp;case 35674:return Cp;case 35675:return wp;case 35676:return _p;case 5124:case 35670:return Mp;case 35667:case 35671:return Sp;case 35668:case 35672:return Ip;case 35669:case 35673:return Bp;case 5125:return Tp;case 36294:return Rp;case 36295:return Lp;case 36296:return Dp;case 35678:case 36198:case 36298:case 36306:case 35682:return Pp;case 35679:case 36299:case 36307:return Up;case 35680:case 36300:case 36308:case 36293:return Op;case 36289:case 36303:case 36311:case 36292:return Fp}}(t.type)}}class rA{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return kp;case 35664:return Np;case 35665:return Qp;case 35666:return Gp;case 35674:return zp;case 35675:return Hp;case 35676:return Vp;case 5124:case 35670:return jp;case 35667:case 35671:return Wp;case 35668:case 35672:return qp;case 35669:case 35673:return Xp;case 5125:return Yp;case 36294:return Jp;case 36295:return Kp;case 36296:return Zp;case 35678:case 36198:case 36298:case 36306:case 35682:return $p;case 35679:case 36299:case 36307:return eA;case 35680:case 36300:case 36308:case 36293:return tA;case 36289:case 36303:case 36311:case 36292:return nA}}(t.type)}}class sA{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,s=i.length;r!==s;++r){const s=i[r];s.setValue(e,t[s.id],n)}}}const oA=/(\w+)(\])?(\[|\.)?/g;function aA(e,t){e.seq.push(t),e.map[t.id]=t}function lA(e,t,n){const i=e.name,r=i.length;for(oA.lastIndex=0;;){const s=oA.exec(i),o=oA.lastIndex;let a=s[1];const l="]"===s[2],c=s[3];if(l&&(a|=0),void 0===c||"["===c&&o+2===r){aA(n,void 0===c?new iA(a,e,t):new rA(a,e,t));break}{let e=n.map[a];void 0===e&&(e=new sA(a),aA(n,e)),n=e}}}class cA{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=e.getActiveUniform(t,i);lA(n,e.getUniformLocation(t,n.name),this)}}setValue(e,t,n,i){const r=this.map[t];void 0!==r&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];void 0!==i&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,s=t.length;r!==s;++r){const s=t[r],o=n[s.id];!1!==o.needsUpdate&&s.setValue(e,o.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const r=e[i];r.id in t&&n.push(r)}return n}}function hA(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}let dA=0;const uA=new ni;function pA(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(i&&""===r)return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const i=parseInt(s[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){const n=e.split("\n"),i=[],r=Math.max(t-6,0),s=Math.min(t+6,n.length);for(let e=r;e<s;e++){const r=e+1;i.push(`${r===t?">":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}return r}function AA(e,t){const n=function(e){Ai._getMatrix(uA,Ai.workingColorSpace,e);const t=`mat3( ${uA.elements.map((e=>e.toFixed(4)))} )`;switch(Ai.getTransfer(e)){case rn:return[t,"LinearTransferOETF"];case sn:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(t);return[`vec4 ${e}( vec4 value ) {`,`\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join("\n")}function fA(e,t){let n;switch(t){case ie:n="Linear";break;case re:n="Reinhard";break;case se:n="Cineon";break;case oe:n="ACESFilmic";break;case le:n="AgX";break;case ce:n="Neutral";break;case ae:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const mA=new Li;function gA(e){return""!==e}function vA(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function yA(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const EA=/^[ \t]*#include +<([\w\d./]+)>/gm;function xA(e){return e.replace(EA,CA)}const bA=new Map;function CA(e,t){let n=wu[t];if(void 0===n){const e=bA.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=wu[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return xA(n)}const wA=/#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 _A(e){return e.replace(wA,MA)}function MA(e,t,n,i){let r="";for(let e=parseInt(t);e<parseInt(n);e++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return r}function SA(e){let t=`precision ${e.precision} float;\n\tprecision ${e.precision} int;\n\tprecision ${e.precision} sampler2D;\n\tprecision ${e.precision} samplerCube;\n\tprecision ${e.precision} sampler3D;\n\tprecision ${e.precision} sampler2DArray;\n\tprecision ${e.precision} sampler2DShadow;\n\tprecision ${e.precision} samplerCubeShadow;\n\tprecision ${e.precision} sampler2DArrayShadow;\n\tprecision ${e.precision} isampler2D;\n\tprecision ${e.precision} isampler3D;\n\tprecision ${e.precision} isamplerCube;\n\tprecision ${e.precision} isampler2DArray;\n\tprecision ${e.precision} usampler2D;\n\tprecision ${e.precision} usampler3D;\n\tprecision ${e.precision} usamplerCube;\n\tprecision ${e.precision} usampler2DArray;\n\t`;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function IA(e,t,n,i){const r=e.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=function(e){let t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===p?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===A?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===f&&(t="SHADOWMAP_TYPE_VSM"),t}(n),c=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case pe:case Ae:t="ENVMAP_TYPE_CUBE";break;case ge:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),h=function(e){let t="ENVMAP_MODE_REFLECTION";return e.envMap&&e.envMapMode===Ae&&(t="ENVMAP_MODE_REFRACTION"),t}(n),d=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case $:t="ENVMAP_BLENDING_MULTIPLY";break;case ee:t="ENVMAP_BLENDING_MIX";break;case te:t="ENVMAP_BLENDING_ADD"}return t}(n),u=function(e){const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),m=function(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(gA).join("\n")}(n),g=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),v=r.createProgram();let y,E,x=n.glslVersion?"#version "+n.glslVersion+"\n":"";const b=n.numMultiviewViews;n.isRawShaderMaterial?(y=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g].filter(gA).join("\n"),y.length>0&&(y+="\n"),E=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g].filter(gA).join("\n"),E.length>0&&(E+="\n")):(y=[SA(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",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.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(gA).join("\n"),E=[SA(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",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 "+d:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",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.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==ne?"#define TONE_MAPPING":"",n.toneMapping!==ne?wu.tonemapping_pars_fragment:"",n.toneMapping!==ne?fA("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",wu.colorspace_pars_fragment,AA("linearToOutputTexel",n.outputColorSpace),(Ai.getLuminanceCoefficients(mA),["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${mA.x.toFixed(4)}, ${mA.y.toFixed(4)}, ${mA.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(gA).join("\n")),o=xA(o),o=vA(o,n),o=yA(o,n),a=xA(a),a=vA(a,n),a=yA(a,n),o=_A(o),a=_A(a),!0!==n.isRawShaderMaterial&&(x="#version 300 es\n",y=[m,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+y,E=["#define varying in",n.glslVersion===Qn?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Qn?"":"#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"+E,b>0&&(y=["#extension GL_OVR_multiview : require","layout(num_views = "+b+") in;","#define VIEW_ID gl_ViewID_OVR"].join("\n")+"\n"+y,y=y.replace(["uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;"].join("\n"),["uniform mat4 modelViewMatrices["+b+"];","uniform mat4 projectionMatrices["+b+"];","uniform mat4 viewMatrices["+b+"];","uniform mat3 normalMatrices["+b+"];","#define modelViewMatrix modelViewMatrices[VIEW_ID]","#define projectionMatrix projectionMatrices[VIEW_ID]","#define viewMatrix viewMatrices[VIEW_ID]","#define normalMatrix normalMatrices[VIEW_ID]"].join("\n")),E=["#extension GL_OVR_multiview : require","#define VIEW_ID gl_ViewID_OVR"].join("\n")+"\n"+E,E=E.replace("uniform mat4 viewMatrix;",["uniform mat4 viewMatrices["+b+"];","#define viewMatrix viewMatrices[VIEW_ID]"].join("\n"))));const C=x+y+o,w=x+E+a,_=hA(r,r.VERTEX_SHADER,C),M=hA(r,r.FRAGMENT_SHADER,w);function S(t){if(e.debug.checkShaderErrors){const n=r.getProgramInfoLog(v).trim(),i=r.getShaderInfoLog(_).trim(),s=r.getShaderInfoLog(M).trim();let o=!0,a=!0;if(!1===r.getProgramParameter(v,r.LINK_STATUS))if(o=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(r,v,_,M);else{const e=pA(r,_,"vertex"),i=pA(r,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(v,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+n+"\n"+e+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==s||(a=!1);a&&(t.diagnostics={runnable:o,programLog:n,vertexShader:{log:i,prefix:y},fragmentShader:{log:s,prefix:E}})}r.deleteShader(_),r.deleteShader(M),I=new cA(r,v),B=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=e.getActiveAttrib(t,r),s=i.name;let o=1;i.type===e.FLOAT_MAT2&&(o=2),i.type===e.FLOAT_MAT3&&(o=3),i.type===e.FLOAT_MAT4&&(o=4),n[s]={type:i.type,location:e.getAttribLocation(t,s),locationSize:o}}return n}(r,v)}let I,B;r.attachShader(v,_),r.attachShader(v,M),void 0!==n.index0AttributeName?r.bindAttribLocation(v,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(v,0,"position"),r.linkProgram(v),this.getUniforms=function(){return void 0===I&&S(this),I},this.getAttributes=function(){return void 0===B&&S(this),B};let T=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===T&&(T=r.getProgramParameter(v,37297)),T},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(v),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=dA++,this.cacheKey=t,this.usedTimes=1,this.program=v,this.vertexShader=_,this.fragmentShader=M,this.numMultiviewViews=b,this}let BA=0;class TA{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),s=this._getShaderCacheForMaterial(e);return!1===s.has(i)&&(s.add(i),i.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return void 0===n&&(n=new RA(e),t.set(e,n)),n}}class RA{constructor(e){this.id=BA++,this.code=e,this.usedTimes=0}}function LA(e,t,n,i,r,s,o){const a=new yr,l=new TA,c=new Set,h=[],d=r.logarithmicDepthBuffer,u=r.vertexTextures;let p=r.precision;const A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function f(e){return c.add(e),0===e?"uv":`uv${e}`}return{getParameters:function(s,a,h,m,y){const x=m.fog,b=y.geometry,C=s.isMeshStandardMaterial?m.environment:null,w=(s.isMeshStandardMaterial?n:t).get(s.envMap||C),_=w&&w.mapping===ge?w.image.height:null,M=A[s.type];null!==s.precision&&(p=r.getMaxPrecision(s.precision),p!==s.precision&&console.warn("THREE.WebGLProgram.getParameters:",s.precision,"not supported, using",p,"instead."));const S=b.morphAttributes.position||b.morphAttributes.normal||b.morphAttributes.color,I=void 0!==S?S.length:0;let B,T,R,L,D=0;if(void 0!==b.morphAttributes.position&&(D=1),void 0!==b.morphAttributes.normal&&(D=2),void 0!==b.morphAttributes.color&&(D=3),M){const e=Mu[M];B=e.vertexShader,T=e.fragmentShader}else B=s.vertexShader,T=s.fragmentShader,l.update(s),R=l.getVertexShaderID(s),L=l.getFragmentShaderID(s);const P=e.getRenderTarget(),U=e.state.buffers.depth.getReversed(),O=P&&P.isWebGLMultiviewRenderTarget?P.numViews:0,F=!0===y.isInstancedMesh,k=!0===y.isBatchedMesh,N=!!s.map,Q=!!s.matcap,G=!!w,z=!!s.aoMap,H=!!s.lightMap,V=!!s.bumpMap,j=!!s.normalMap,W=!!s.displacementMap,q=!!s.emissiveMap,X=!!s.metalnessMap,Y=!!s.roughnessMap,J=s.anisotropy>0,K=s.clearcoat>0,Z=s.dispersion>0,$=s.iridescence>0,ee=s.sheen>0,te=s.transmission>0,ie=J&&!!s.anisotropyMap,re=K&&!!s.clearcoatMap,se=K&&!!s.clearcoatNormalMap,oe=K&&!!s.clearcoatRoughnessMap,ae=$&&!!s.iridescenceMap,le=$&&!!s.iridescenceThicknessMap,ce=ee&&!!s.sheenColorMap,he=ee&&!!s.sheenRoughnessMap,de=!!s.specularMap,ue=!!s.specularColorMap,pe=!!s.specularIntensityMap,Ae=te&&!!s.transmissionMap,fe=te&&!!s.thicknessMap,me=!!s.gradientMap,ve=!!s.alphaMap,ye=s.alphaTest>0,Ee=!!s.alphaHash,xe=!!s.extensions;let be=ne;s.toneMapped&&(null!==P&&!0!==P.isXRRenderTarget||(be=e.toneMapping));const Ce={shaderID:M,shaderType:s.type,shaderName:s.name,vertexShader:B,fragmentShader:T,defines:s.defines,customVertexShaderID:R,customFragmentShaderID:L,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,batching:k,batchingColor:k&&null!==y._colorsTexture,instancing:F,instancingColor:F&&null!==y.instanceColor,instancingMorph:F&&null!==y.morphTexture,supportsVertexTextures:u,numMultiviewViews:O,outputColorSpace:null===P?e.outputColorSpace:!0===P.isXRRenderTarget?P.texture.colorSpace:nn,alphaToCoverage:!!s.alphaToCoverage,map:N,matcap:Q,envMap:G,envMapMode:G&&w.mapping,envMapCubeUVHeight:_,aoMap:z,lightMap:H,bumpMap:V,normalMap:j,displacementMap:u&&W,emissiveMap:q,normalMapObjectSpace:j&&s.normalMapType===$t,normalMapTangentSpace:j&&s.normalMapType===Zt,metalnessMap:X,roughnessMap:Y,anisotropy:J,anisotropyMap:ie,clearcoat:K,clearcoatMap:re,clearcoatNormalMap:se,clearcoatRoughnessMap:oe,dispersion:Z,iridescence:$,iridescenceMap:ae,iridescenceThicknessMap:le,sheen:ee,sheenColorMap:ce,sheenRoughnessMap:he,specularMap:de,specularColorMap:ue,specularIntensityMap:pe,transmission:te,transmissionMap:Ae,thicknessMap:fe,gradientMap:me,opaque:!1===s.transparent&&s.blending===E&&!1===s.alphaToCoverage,alphaMap:ve,alphaTest:ye,alphaHash:Ee,combine:s.combine,mapUv:N&&f(s.map.channel),aoMapUv:z&&f(s.aoMap.channel),lightMapUv:H&&f(s.lightMap.channel),bumpMapUv:V&&f(s.bumpMap.channel),normalMapUv:j&&f(s.normalMap.channel),displacementMapUv:W&&f(s.displacementMap.channel),emissiveMapUv:q&&f(s.emissiveMap.channel),metalnessMapUv:X&&f(s.metalnessMap.channel),roughnessMapUv:Y&&f(s.roughnessMap.channel),anisotropyMapUv:ie&&f(s.anisotropyMap.channel),clearcoatMapUv:re&&f(s.clearcoatMap.channel),clearcoatNormalMapUv:se&&f(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:oe&&f(s.clearcoatRoughnessMap.channel),iridescenceMapUv:ae&&f(s.iridescenceMap.channel),iridescenceThicknessMapUv:le&&f(s.iridescenceThicknessMap.channel),sheenColorMapUv:ce&&f(s.sheenColorMap.channel),sheenRoughnessMapUv:he&&f(s.sheenRoughnessMap.channel),specularMapUv:de&&f(s.specularMap.channel),specularColorMapUv:ue&&f(s.specularColorMap.channel),specularIntensityMapUv:pe&&f(s.specularIntensityMap.channel),transmissionMapUv:Ae&&f(s.transmissionMap.channel),thicknessMapUv:fe&&f(s.thicknessMap.channel),alphaMapUv:ve&&f(s.alphaMap.channel),vertexTangents:!!b.attributes.tangent&&(j||J),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,pointsUvs:!0===y.isPoints&&!!b.attributes.uv&&(N||ve),fog:!!x,useFog:!0===s.fog,fogExp2:!!x&&x.isFogExp2,flatShading:!0===s.flatShading,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:d,reverseDepthBuffer:U,skinning:!0===y.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:I,morphTextureStride:D,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numSpotLightMaps:a.spotLightMap.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numSpotLightShadowsWithMaps:a.numSpotLightShadowsWithMaps,numLightProbes:a.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:be,decodeVideoTexture:N&&!0===s.map.isVideoTexture&&Ai.getTransfer(s.map.colorSpace)===sn,decodeVideoTextureEmissive:q&&!0===s.emissiveMap.isVideoTexture&&Ai.getTransfer(s.emissiveMap.colorSpace)===sn,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===v,flipSided:s.side===g,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionClipCullDistance:xe&&!0===s.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(xe&&!0===s.extensions.multiDraw||k)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:s.customProgramCacheKey()};return Ce.vertexUv1s=c.has(1),Ce.vertexUv2s=c.has(2),Ce.vertexUv3s=c.has(3),c.clear(),Ce},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){a.disableAll(),t.supportsVertexTextures&&a.enable(0),t.instancing&&a.enable(1),t.instancingColor&&a.enable(2),t.instancingMorph&&a.enable(3),t.matcap&&a.enable(4),t.envMap&&a.enable(5),t.normalMapObjectSpace&&a.enable(6),t.normalMapTangentSpace&&a.enable(7),t.clearcoat&&a.enable(8),t.iridescence&&a.enable(9),t.alphaTest&&a.enable(10),t.vertexColors&&a.enable(11),t.vertexAlphas&&a.enable(12),t.vertexUv1s&&a.enable(13),t.vertexUv2s&&a.enable(14),t.vertexUv3s&&a.enable(15),t.vertexTangents&&a.enable(16),t.anisotropy&&a.enable(17),t.alphaHash&&a.enable(18),t.batching&&a.enable(19),t.dispersion&&a.enable(20),t.batchingColor&&a.enable(21),e.push(a.mask),a.disableAll(),t.fog&&a.enable(0),t.useFog&&a.enable(1),t.flatShading&&a.enable(2),t.logarithmicDepthBuffer&&a.enable(3),t.reverseDepthBuffer&&a.enable(4),t.skinning&&a.enable(5),t.morphTargets&&a.enable(6),t.morphNormals&&a.enable(7),t.morphColors&&a.enable(8),t.premultipliedAlpha&&a.enable(9),t.shadowMapEnabled&&a.enable(10),t.doubleSided&&a.enable(11),t.flipSided&&a.enable(12),t.useDepthPacking&&a.enable(13),t.dithering&&a.enable(14),t.transmission&&a.enable(15),t.sheen&&a.enable(16),t.opaque&&a.enable(17),t.pointsUvs&&a.enable(18),t.decodeVideoTexture&&a.enable(19),t.decodeVideoTextureEmissive&&a.enable(20),t.alphaToCoverage&&a.enable(21),t.numMultiviewViews&&a.enable(21),e.push(a.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=A[e.type];let n;if(t){const e=Mu[t];n=qs.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=h.length;e<t;e++){const t=h[e];if(t.cacheKey===n){i=t,++i.usedTimes;break}}return void 0===i&&(i=new IA(e,n,t,s),h.push(i)),i},releaseProgram:function(e){if(0==--e.usedTimes){const t=h.indexOf(e);h[t]=h[h.length-1],h.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:h,dispose:function(){l.dispose()}}}function DA(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function PA(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function UA(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function OA(){const e=[];let t=0;const n=[],i=[],r=[];function s(n,i,r,s,o,a){let l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:s,renderOrder:n.renderOrder,z:o,group:a},e[t]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=s,l.renderOrder=n.renderOrder,l.z=o,l.group=a),t++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,o,a,l,c){const h=s(e,t,o,a,l,c);o.transmission>0?i.push(h):!0===o.transparent?r.push(h):n.push(h)},unshift:function(e,t,o,a,l,c){const h=s(e,t,o,a,l,c);o.transmission>0?i.unshift(h):!0===o.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n<i;n++){const t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){n.length>1&&n.sort(e||PA),i.length>1&&i.sort(t||UA),r.length>1&&r.sort(t||UA)}}}function FA(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let r;return void 0===i?(r=new OA,e.set(t,[r])):n>=i.length?(r=new OA,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function kA(){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 Li,color:new es};break;case"SpotLight":n={position:new Li,direction:new Li,color:new es,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Li,color:new es,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Li,skyColor:new es,groundColor:new es};break;case"RectAreaLight":n={color:new es,position:new Li,halfWidth:new Li,halfHeight:new Li}}return e[t.id]=n,n}}}let NA=0;function QA(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function GA(e){const t=new kA,n=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={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ti};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ti,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)i.probe.push(new Li);const r=new Li,s=new lr,o=new lr;return{setup:function(r){let s=0,o=0,a=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let l=0,c=0,h=0,d=0,u=0,p=0,A=0,f=0,m=0,g=0,v=0;r.sort(QA);for(let e=0,y=r.length;e<y;e++){const y=r[e],E=y.color,x=y.intensity,b=y.distance,C=y.shadow&&y.shadow.map?y.shadow.map.texture:null;if(y.isAmbientLight)s+=E.r*x,o+=E.g*x,a+=E.b*x;else if(y.isLightProbe){for(let e=0;e<9;e++)i.probe[e].addScaledVector(y.sh.coefficients[e],x);v++}else if(y.isDirectionalLight){const e=t.get(y);if(e.color.copy(y.color).multiplyScalar(y.intensity),y.castShadow){const e=y.shadow,t=n.get(y);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,i.directionalShadow[l]=t,i.directionalShadowMap[l]=C,i.directionalShadowMatrix[l]=y.shadow.matrix,p++}i.directional[l]=e,l++}else if(y.isSpotLight){const e=t.get(y);e.position.setFromMatrixPosition(y.matrixWorld),e.color.copy(E).multiplyScalar(x),e.distance=b,e.coneCos=Math.cos(y.angle),e.penumbraCos=Math.cos(y.angle*(1-y.penumbra)),e.decay=y.decay,i.spot[h]=e;const r=y.shadow;if(y.map&&(i.spotLightMap[m]=y.map,m++,r.updateMatrices(y),y.castShadow&&g++),i.spotLightMatrix[h]=r.matrix,y.castShadow){const e=n.get(y);e.shadowIntensity=r.intensity,e.shadowBias=r.bias,e.shadowNormalBias=r.normalBias,e.shadowRadius=r.radius,e.shadowMapSize=r.mapSize,i.spotShadow[h]=e,i.spotShadowMap[h]=C,f++}h++}else if(y.isRectAreaLight){const e=t.get(y);e.color.copy(E).multiplyScalar(x),e.halfWidth.set(.5*y.width,0,0),e.halfHeight.set(0,.5*y.height,0),i.rectArea[d]=e,d++}else if(y.isPointLight){const e=t.get(y);if(e.color.copy(y.color).multiplyScalar(y.intensity),e.distance=y.distance,e.decay=y.decay,y.castShadow){const e=y.shadow,t=n.get(y);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,i.pointShadow[c]=t,i.pointShadowMap[c]=C,i.pointShadowMatrix[c]=y.shadow.matrix,A++}i.point[c]=e,c++}else if(y.isHemisphereLight){const e=t.get(y);e.skyColor.copy(y.color).multiplyScalar(x),e.groundColor.copy(y.groundColor).multiplyScalar(x),i.hemi[u]=e,u++}}d>0&&(!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=_u.LTC_FLOAT_1,i.rectAreaLTC2=_u.LTC_FLOAT_2):(i.rectAreaLTC1=_u.LTC_HALF_1,i.rectAreaLTC2=_u.LTC_HALF_2)),i.ambient[0]=s,i.ambient[1]=o,i.ambient[2]=a;const y=i.hash;y.directionalLength===l&&y.pointLength===c&&y.spotLength===h&&y.rectAreaLength===d&&y.hemiLength===u&&y.numDirectionalShadows===p&&y.numPointShadows===A&&y.numSpotShadows===f&&y.numSpotMaps===m&&y.numLightProbes===v||(i.directional.length=l,i.spot.length=h,i.rectArea.length=d,i.point.length=c,i.hemi.length=u,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=A,i.pointShadowMap.length=A,i.spotShadow.length=f,i.spotShadowMap.length=f,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=A,i.spotLightMatrix.length=f+m-g,i.spotLightMap.length=m,i.numSpotLightShadowsWithMaps=g,i.numLightProbes=v,y.directionalLength=l,y.pointLength=c,y.spotLength=h,y.rectAreaLength=d,y.hemiLength=u,y.numDirectionalShadows=p,y.numPointShadows=A,y.numSpotShadows=f,y.numSpotMaps=m,y.numLightProbes=v,i.version=NA++)},setupView:function(e,t){let n=0,a=0,l=0,c=0,h=0;const d=t.matrixWorldInverse;for(let t=0,u=e.length;t<u;t++){const u=e[t];if(u.isDirectionalLight){const e=i.directional[n];e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(d),n++}else if(u.isSpotLight){const e=i.spot[l];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(d),e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(d),l++}else if(u.isRectAreaLight){const e=i.rectArea[c];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(d),o.identity(),s.copy(u.matrixWorld),s.premultiply(d),o.extractRotation(s),e.halfWidth.set(.5*u.width,0,0),e.halfHeight.set(0,.5*u.height,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),c++}else if(u.isPointLight){const e=i.point[a];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(d),a++}else if(u.isHemisphereLight){const e=i.hemi[h];e.direction.setFromMatrixPosition(u.matrixWorld),e.direction.transformDirection(d),h++}}},state:i}}function zA(e){const t=new GA(e),n=[],i=[],r={lightsArray:n,shadowsArray:i,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){r.camera=e,n.length=0,i.length=0},state:r,setupLights:function(){t.setup(n)},setupLightsView:function(e){t.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){i.push(e)}}}function HA(e){let t=new WeakMap;return{get:function(n,i=0){const r=t.get(n);let s;return void 0===r?(s=new zA(e),t.set(n,[s])):i>=r.length?(s=new zA(e),r.push(s)):s=r[i],s},dispose:function(){t=new WeakMap}}}function VA(e,t,n){let i=new oa;const r=new ti,s=new ti,o=new wi,a=new Rc({depthPacking:Yt}),l=new Lc,c={},h=n.maxTextureSize,d={[m]:g,[g]:m,[v]:v},u=new Xs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ti},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),A=u.clone();A.defines.HORIZONTAL_PASS=1;const E=new Bs;E.setAttribute("position",new us(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Gs(E,u),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=p;let C=this.type;function w(n,i){const s=t.update(x);u.defines.VSM_SAMPLES!==n.blurSamples&&(u.defines.VSM_SAMPLES=n.blurSamples,A.defines.VSM_SAMPLES=n.blurSamples,u.needsUpdate=!0,A.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Mi(r.x,r.y)),u.uniforms.shadow_pass.value=n.map.texture,u.uniforms.resolution.value=n.mapSize,u.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,s,u,x,null),A.uniforms.shadow_pass.value=n.mapPass.texture,A.uniforms.resolution.value=n.mapSize,A.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,s,A,x,null)}function _(t,n,i,r){let s=null;const o=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)s=o;else if(s=!0===i.isPointLight?l:a,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const e=s.uuid,t=n.uuid;let i=c[e];void 0===i&&(i={},c[e]=i);let r=i[t];void 0===r&&(r=s.clone(),i[t]=r,n.addEventListener("dispose",S)),s=r}return s.visible=n.visible,s.wireframe=n.wireframe,s.side=r===f?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:d[n.side],s.alphaMap=n.alphaMap,s.alphaTest=n.alphaTest,s.map=n.map,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.displacementMap=n.displacementMap,s.displacementScale=n.displacementScale,s.displacementBias=n.displacementBias,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===i.isPointLight&&!0===s.isMeshDistanceMaterial&&(e.properties.get(s).light=i),s}function M(n,r,s,o,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===f)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=t.update(n),l=n.material;if(Array.isArray(l)){const t=i.groups;for(let c=0,h=t.length;c<h;c++){const h=t[c],d=l[h.materialIndex];if(d&&d.visible){const t=_(n,d,o,a);n.onBeforeShadow(e,n,r,s,i,t,h),e.renderBufferDirect(s,null,i,t,n,h),n.onAfterShadow(e,n,r,s,i,t,h)}}}else if(l.visible){const t=_(n,l,o,a);n.onBeforeShadow(e,n,r,s,i,t,null),e.renderBufferDirect(s,null,i,t,n,null),n.onAfterShadow(e,n,r,s,i,t,null)}}const l=n.children;for(let e=0,t=l.length;e<t;e++)M(l[e],r,s,o,a)}function S(e){e.target.removeEventListener("dispose",S);for(const t in c){const n=c[t],i=e.target.uuid;i in n&&(n[i].dispose(),delete n[i])}}this.render=function(t,n,a){if(!1===b.enabled)return;if(!1===b.autoUpdate&&!1===b.needsUpdate)return;if(0===t.length)return;const l=e.getRenderTarget(),c=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),u=e.state;u.setBlending(y),u.buffers.color.setClear(1,1,1,1),u.buffers.depth.setTest(!0),u.setScissorTest(!1);const p=C!==f&&this.type===f,A=C===f&&this.type!==f;for(let l=0,c=t.length;l<c;l++){const c=t[l],d=c.shadow;if(void 0===d){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===d.autoUpdate&&!1===d.needsUpdate)continue;r.copy(d.mapSize);const m=d.getFrameExtents();if(r.multiply(m),s.copy(d.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/m.x),r.x=s.x*m.x,d.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/m.y),r.y=s.y*m.y,d.mapSize.y=s.y)),null===d.map||!0===p||!0===A){const e=this.type!==f?{minFilter:xe,magFilter:xe}:{};null!==d.map&&d.map.dispose(),d.map=new Mi(r.x,r.y,e),d.map.texture.name=c.name+".shadowMap",d.camera.updateProjectionMatrix()}e.setRenderTarget(d.map),e.clear();const g=d.getViewportCount();for(let e=0;e<g;e++){const t=d.getViewport(e);o.set(s.x*t.x,s.y*t.y,s.x*t.z,s.y*t.w),u.viewport(o),d.updateMatrices(c,e),i=d.getFrustum(),M(n,a,d.camera,c,this.type)}!0!==d.isPointLightShadow&&this.type===f&&w(d,a),d.needsUpdate=!1}C=this.type,b.needsUpdate=!1,e.setRenderTarget(l,c,d)}}const jA={[j]:W,[q]:K,[Y]:Z,[X]:J,[W]:j,[K]:q,[Z]:Y,[J]:X};function WA(e,t){const n=new function(){let t=!1;const n=new wi;let i=null;const r=new wi(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,s,o,a){!0===a&&(t*=o,i*=o,s*=o),n.set(t,i,s,o),!1===r.equals(n)&&(e.clearColor(t,i,s,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},i=new function(){let n=!1,i=!1,r=null,s=null,o=null;return{setReversed:function(e){if(i!==e){const e=t.get("EXT_clip_control");i?e.clipControlEXT(e.LOWER_LEFT_EXT,e.ZERO_TO_ONE_EXT):e.clipControlEXT(e.LOWER_LEFT_EXT,e.NEGATIVE_ONE_TO_ONE_EXT);const n=o;o=null,this.setClear(n)}i=e},getReversed:function(){return i},setTest:function(t){t?_e(e.DEPTH_TEST):Me(e.DEPTH_TEST)},setMask:function(t){r===t||n||(e.depthMask(t),r=t)},setFunc:function(t){if(i&&(t=jA[t]),s!==t){switch(t){case j:e.depthFunc(e.NEVER);break;case W:e.depthFunc(e.ALWAYS);break;case q:e.depthFunc(e.LESS);break;case X:e.depthFunc(e.LEQUAL);break;case Y:e.depthFunc(e.EQUAL);break;case J:e.depthFunc(e.GEQUAL);break;case K:e.depthFunc(e.GREATER);break;case Z:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}s=t}},setLocked:function(e){n=e},setClear:function(t){o!==t&&(i&&(t=1-t),e.clearDepth(t),o=t)},reset:function(){n=!1,r=null,s=null,o=null,i=!1}}},r=new function(){let t=!1,n=null,i=null,r=null,s=null,o=null,a=null,l=null,c=null;return{setTest:function(n){t||(n?_e(e.STENCIL_TEST):Me(e.STENCIL_TEST))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&s===o||(e.stencilFunc(t,n,o),i=t,r=n,s=o)},setOp:function(t,n,i){o===t&&a===n&&l===i||(e.stencilOp(t,n,i),o=t,a=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,s=null,o=null,a=null,l=null,c=null}}},s=new WeakMap,o=new WeakMap;let a={},d={},u=new WeakMap,p=[],A=null,f=!1,m=null,$=null,ee=null,te=null,ne=null,ie=null,re=null,se=new es(0,0,0),oe=0,ae=!1,le=null,ce=null,he=null,de=null,ue=null;const pe=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Ae=!1,fe=0;const me=e.getParameter(e.VERSION);-1!==me.indexOf("WebGL")?(fe=parseFloat(/^WebGL (\d)/.exec(me)[1]),Ae=fe>=1):-1!==me.indexOf("OpenGL ES")&&(fe=parseFloat(/^OpenGL ES (\d)/.exec(me)[1]),Ae=fe>=2);let ge=null,ve={};const ye=e.getParameter(e.SCISSOR_BOX),Ee=e.getParameter(e.VIEWPORT),xe=(new wi).fromArray(ye),be=(new wi).fromArray(Ee);function Ce(t,n,i,r){const s=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o<i;o++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,s):e.texImage2D(n+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,s);return o}const we={};function _e(t){!0!==a[t]&&(e.enable(t),a[t]=!0)}function Me(t){!1!==a[t]&&(e.disable(t),a[t]=!1)}we[e.TEXTURE_2D]=Ce(e.TEXTURE_2D,e.TEXTURE_2D,1),we[e.TEXTURE_CUBE_MAP]=Ce(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),we[e.TEXTURE_2D_ARRAY]=Ce(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),we[e.TEXTURE_3D]=Ce(e.TEXTURE_3D,e.TEXTURE_3D,1,1),n.setClear(0,0,0,1),i.setClear(1),r.setClear(0),_e(e.DEPTH_TEST),i.setFunc(X),Te(!1),Re(c),_e(e.CULL_FACE),Be(y);const Se={[_]:e.FUNC_ADD,[M]:e.FUNC_SUBTRACT,[S]:e.FUNC_REVERSE_SUBTRACT};Se[I]=e.MIN,Se[B]=e.MAX;const Ie={[T]:e.ZERO,[R]:e.ONE,[L]:e.SRC_COLOR,[P]:e.SRC_ALPHA,[Q]:e.SRC_ALPHA_SATURATE,[k]:e.DST_COLOR,[O]:e.DST_ALPHA,[D]:e.ONE_MINUS_SRC_COLOR,[U]:e.ONE_MINUS_SRC_ALPHA,[N]:e.ONE_MINUS_DST_COLOR,[F]:e.ONE_MINUS_DST_ALPHA,[G]:e.CONSTANT_COLOR,[z]:e.ONE_MINUS_CONSTANT_COLOR,[H]:e.CONSTANT_ALPHA,[V]:e.ONE_MINUS_CONSTANT_ALPHA};function Be(t,n,i,r,s,o,a,l,c,h){if(t!==y){if(!1===f&&(_e(e.BLEND),f=!0),t===w)s=s||n,o=o||i,a=a||r,n===$&&s===ne||(e.blendEquationSeparate(Se[n],Se[s]),$=n,ne=s),i===ee&&r===te&&o===ie&&a===re||(e.blendFuncSeparate(Ie[i],Ie[r],Ie[o],Ie[a]),ee=i,te=r,ie=o,re=a),!1!==l.equals(se)&&c===oe||(e.blendColor(l.r,l.g,l.b,c),se.copy(l),oe=c),m=t,ae=!1;else if(t!==m||h!==ae){if($===_&&ne===_||(e.blendEquation(e.FUNC_ADD),$=_,ne=_),h)switch(t){case E:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case x:e.blendFunc(e.ONE,e.ONE);break;case b:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case C:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case E:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case x:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case b:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case C:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}ee=null,te=null,ie=null,re=null,se.set(0,0,0),oe=0,m=t,ae=h}}else!0===f&&(Me(e.BLEND),f=!1)}function Te(t){le!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),le=t)}function Re(t){t!==l?(_e(e.CULL_FACE),t!==ce&&(t===c?e.cullFace(e.BACK):t===h?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):Me(e.CULL_FACE),ce=t}function Le(t,n,i){t?(_e(e.POLYGON_OFFSET_FILL),de===n&&ue===i||(e.polygonOffset(n,i),de=n,ue=i)):Me(e.POLYGON_OFFSET_FILL)}return{buffers:{color:n,depth:i,stencil:r},enable:_e,disable:Me,bindFramebuffer:function(t,n){return d[t]!==n&&(e.bindFramebuffer(t,n),d[t]=n,t===e.DRAW_FRAMEBUFFER&&(d[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(d[e.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(t,n){let i=p,r=!1;if(t){i=u.get(n),void 0===i&&(i=[],u.set(n,i));const s=t.textures;if(i.length!==s.length||i[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=s.length;t<n;t++)i[t]=e.COLOR_ATTACHMENT0+t;i.length=s.length,r=!0}}else i[0]!==e.BACK&&(i[0]=e.BACK,r=!0);r&&e.drawBuffers(i)},useProgram:function(t){return A!==t&&(e.useProgram(t),A=t,!0)},setBlending:Be,setMaterial:function(t,s){t.side===v?Me(e.CULL_FACE):_e(e.CULL_FACE);let o=t.side===g;s&&(o=!o),Te(o),t.blending===E&&!1===t.transparent?Be(y):Be(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),i.setFunc(t.depthFunc),i.setTest(t.depthTest),i.setMask(t.depthWrite),n.setMask(t.colorWrite);const a=t.stencilWrite;r.setTest(a),a&&(r.setMask(t.stencilWriteMask),r.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),r.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),Le(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?_e(e.SAMPLE_ALPHA_TO_COVERAGE):Me(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:Te,setCullFace:Re,setLineWidth:function(t){t!==he&&(Ae&&e.lineWidth(t),he=t)},setPolygonOffset:Le,setScissorTest:function(t){t?_e(e.SCISSOR_TEST):Me(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+pe-1),ge!==t&&(e.activeTexture(t),ge=t)},bindTexture:function(t,n,i){void 0===i&&(i=null===ge?e.TEXTURE0+pe-1:ge);let r=ve[i];void 0===r&&(r={type:void 0,texture:void 0},ve[i]=r),r.type===t&&r.texture===n||(ge!==i&&(e.activeTexture(i),ge=i),e.bindTexture(t,n||we[t]),r.type=t,r.texture=n)},unbindTexture:function(){const t=ve[ge];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){let i=o.get(n);void 0===i&&(i=new WeakMap,o.set(n,i));let r=i.get(t);void 0===r&&(r=e.getUniformBlockIndex(n,t.name),i.set(t,r))},uniformBlockBinding:function(t,n){const i=o.get(n).get(t);s.get(n)!==i&&(e.uniformBlockBinding(n,i,t.__bindingPointIndex),s.set(n,i))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===xe.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),xe.copy(t))},viewport:function(t){!1===be.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),be.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),i.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),a={},ge=null,ve={},d={},u=new WeakMap,p=[],A=null,f=!1,m=null,$=null,ee=null,te=null,ne=null,ie=null,re=null,se=new es(0,0,0),oe=0,ae=!1,le=null,ce=null,he=null,de=null,ue=null,xe.set(0,0,e.canvas.width,e.canvas.height),be.set(0,0,e.canvas.width,e.canvas.height),n.reset(),i.reset(),r.reset()}}}function qA(e,t,n,i,r,s,o){const a=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=t.has("OCULUS_multiview")?t.get("OCULUS_multiview"):null,h=new ti,d=new WeakMap;let u;const p=new WeakMap;let A=[],f=!1,m=!1;try{m="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function g(e,t){return m?new OffscreenCanvas(e,t):ai("canvas")}function v(e,t,n){let i=1;const r=W(e);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(i*r.width),s=Math.floor(i*r.height);void 0===u&&(u=g(n,s));const o=t?g(n,s):u;return o.width=n,o.height=s,o.getContext("2d").drawImage(e,0,0,n,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+s+")."),o}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),e}return e}function y(e){return e.generateMipmaps}function E(t){e.generateMipmap(t)}function x(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function b(n,i,r,s,o=!1){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 a=i;if(i===e.RED&&(r===e.FLOAT&&(a=e.R32F),r===e.HALF_FLOAT&&(a=e.R16F),r===e.UNSIGNED_BYTE&&(a=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(a=e.R8UI),r===e.UNSIGNED_SHORT&&(a=e.R16UI),r===e.UNSIGNED_INT&&(a=e.R32UI),r===e.BYTE&&(a=e.R8I),r===e.SHORT&&(a=e.R16I),r===e.INT&&(a=e.R32I)),i===e.RG&&(r===e.FLOAT&&(a=e.RG32F),r===e.HALF_FLOAT&&(a=e.RG16F),r===e.UNSIGNED_BYTE&&(a=e.RG8)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(a=e.RG8UI),r===e.UNSIGNED_SHORT&&(a=e.RG16UI),r===e.UNSIGNED_INT&&(a=e.RG32UI),r===e.BYTE&&(a=e.RG8I),r===e.SHORT&&(a=e.RG16I),r===e.INT&&(a=e.RG32I)),i===e.RGB_INTEGER&&(r===e.UNSIGNED_BYTE&&(a=e.RGB8UI),r===e.UNSIGNED_SHORT&&(a=e.RGB16UI),r===e.UNSIGNED_INT&&(a=e.RGB32UI),r===e.BYTE&&(a=e.RGB8I),r===e.SHORT&&(a=e.RGB16I),r===e.INT&&(a=e.RGB32I)),i===e.RGBA_INTEGER&&(r===e.UNSIGNED_BYTE&&(a=e.RGBA8UI),r===e.UNSIGNED_SHORT&&(a=e.RGBA16UI),r===e.UNSIGNED_INT&&(a=e.RGBA32UI),r===e.BYTE&&(a=e.RGBA8I),r===e.SHORT&&(a=e.RGBA16I),r===e.INT&&(a=e.RGBA32I)),i===e.RGB&&r===e.UNSIGNED_INT_5_9_9_9_REV&&(a=e.RGB9_E5),i===e.RGBA){const t=o?rn:Ai.getTransfer(s);r===e.FLOAT&&(a=e.RGBA32F),r===e.HALF_FLOAT&&(a=e.RGBA16F),r===e.UNSIGNED_BYTE&&(a=t===sn?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(a=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(a=e.RGB5_A1)}return a!==e.R16F&&a!==e.R32F&&a!==e.RG16F&&a!==e.RG32F&&a!==e.RGBA16F&&a!==e.RGBA32F||t.get("EXT_color_buffer_float"),a}function C(t,n){let i;return t?null===n||n===Oe||n===Ge?i=e.DEPTH24_STENCIL8:n===Fe?i=e.DEPTH32F_STENCIL8:n===Pe&&(i=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===Oe||n===Ge?i=e.DEPTH_COMPONENT24:n===Fe?i=e.DEPTH_COMPONENT32F:n===Pe&&(i=e.DEPTH_COMPONENT16),i}function w(e,t){return!0===y(e)||e.isFramebufferTexture&&e.minFilter!==xe&&e.minFilter!==Me?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function _(e){const t=e.target;t.removeEventListener("dispose",_),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=p.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&S(e),0===Object.keys(r).length&&p.delete(n)}i.remove(e)}(t),t.isVideoTexture&&d.delete(t)}function M(t){const n=t.target;n.removeEventListener("dispose",M),function(t){const n=i.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),i.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let i=0;i<n.__webglFramebuffer[t].length;i++)e.deleteFramebuffer(n.__webglFramebuffer[t][i]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=t.textures;for(let t=0,n=r.length;t<n;t++){const n=i.get(r[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),o.memory.textures--),i.remove(r[t])}i.remove(t)}(n)}function S(t){const n=i.get(t);e.deleteTexture(n.__webglTexture);const r=t.source;delete p.get(r)[n.__cacheKey],o.memory.textures--}let I=0;function B(t,r){const s=i.get(t);if(t.isVideoTexture&&function(e){const t=o.render.frame;d.get(e)!==t&&(d.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&s.__version!==t.version){const e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===e.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else if(O(s,t,r))return}n.bindTexture(e.TEXTURE_2D,s.__webglTexture,e.TEXTURE0+r)}function T(t,r){const s=i.get(t);t.version>0&&s.__version!==t.version?O(s,t,r):n.bindTexture(e.TEXTURE_2D_ARRAY,s.__webglTexture,e.TEXTURE0+r)}const R={[ve]:e.REPEAT,[ye]:e.CLAMP_TO_EDGE,[Ee]:e.MIRRORED_REPEAT},L={[xe]:e.NEAREST,[be]:e.NEAREST_MIPMAP_NEAREST,[we]:e.NEAREST_MIPMAP_LINEAR,[Me]:e.LINEAR,[Se]:e.LINEAR_MIPMAP_NEAREST,[Be]:e.LINEAR_MIPMAP_LINEAR},D={[bn]:e.NEVER,[Bn]:e.ALWAYS,[Cn]:e.LESS,[_n]:e.LEQUAL,[wn]:e.EQUAL,[In]:e.GEQUAL,[Mn]:e.GREATER,[Sn]:e.NOTEQUAL};function P(n,s){if(s.type!==Fe||!1!==t.has("OES_texture_float_linear")||s.magFilter!==Me&&s.magFilter!==Se&&s.magFilter!==we&&s.magFilter!==Be&&s.minFilter!==Me&&s.minFilter!==Se&&s.minFilter!==we&&s.minFilter!==Be||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,R[s.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,R[s.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,R[s.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,L[s.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,L[s.minFilter]),s.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,D[s.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(s.magFilter===xe)return;if(s.minFilter!==we&&s.minFilter!==Be)return;if(s.type===Fe&&!1===t.has("OES_texture_float_linear"))return;if(s.anisotropy>1||i.get(s).__currentAnisotropy){const o=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy}}}function U(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",_));const r=n.source;let s=p.get(r);void 0===s&&(s={},p.set(r,s));const a=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(a!==t.__cacheKey){void 0===s[a]&&(s[a]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,i=!0),s[a].usedTimes++;const r=s[t.__cacheKey];void 0!==r&&(s[t.__cacheKey].usedTimes--,0===r.usedTimes&&S(n)),t.__cacheKey=a,t.__webglTexture=s[a].texture}return i}function O(t,o,a){if(f)return o.isPendingDeferredUpload||(o.isPendingDeferredUpload=!0,A.push({textureProperties:t,texture:o,slot:a})),!1;let l=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(l=e.TEXTURE_3D);const c=U(t,o),h=o.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+a);const d=i.get(h);if(h.version!==d.__version||!0===c){n.activeTexture(e.TEXTURE0+a);const t=Ai.getPrimaries(Ai.workingColorSpace),i=o.colorSpace===en?null:Ai.getPrimaries(o.colorSpace),u=o.colorSpace===en||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);let p=v(o.image,!1,r.maxTextureSize);p=j(o,p);const A=s.convert(o.format,o.colorSpace),f=s.convert(o.type);let m,g=b(o.internalFormat,A,f,o.colorSpace,o.isVideoTexture);P(l,o);const x=o.mipmaps,_=!0!==o.isVideoTexture,M=void 0===d.__version||!0===c,S=h.dataReady,I=w(o,p);if(o.isDepthTexture)g=C(o.format===Ye,o.type),M&&(_?n.texStorage2D(e.TEXTURE_2D,1,g,p.width,p.height):n.texImage2D(e.TEXTURE_2D,0,g,p.width,p.height,0,A,f,null));else if(o.isDataTexture)if(x.length>0){_&&M&&n.texStorage2D(e.TEXTURE_2D,I,g,x[0].width,x[0].height);for(let t=0,i=x.length;t<i;t++)m=x[t],_?S&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,m.width,m.height,A,f,m.data):n.texImage2D(e.TEXTURE_2D,t,g,m.width,m.height,0,A,f,m.data);o.generateMipmaps=!1}else _?(M&&n.texStorage2D(e.TEXTURE_2D,I,g,p.width,p.height),S&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,p.width,p.height,A,f,p.data)):n.texImage2D(e.TEXTURE_2D,0,g,p.width,p.height,0,A,f,p.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){_&&M&&n.texStorage3D(e.TEXTURE_2D_ARRAY,I,g,x[0].width,x[0].height,p.depth);for(let t=0,i=x.length;t<i;t++)if(m=x[t],o.format!==je)if(null!==A)if(_){if(S)if(o.layerUpdates.size>0){const i=yu(m.width,m.height,o.format,o.type);for(const r of o.layerUpdates){const s=m.data.subarray(r*i/m.data.BYTES_PER_ELEMENT,(r+1)*i/m.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,r,m.width,m.height,1,A,s)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,m.width,m.height,p.depth,A,m.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,g,m.width,m.height,p.depth,0,m.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else _?S&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,m.width,m.height,p.depth,A,f,m.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,g,m.width,m.height,p.depth,0,A,f,m.data)}else{_&&M&&n.texStorage2D(e.TEXTURE_2D,I,g,x[0].width,x[0].height);for(let t=0,i=x.length;t<i;t++)m=x[t],o.format!==je?null!==A?_?S&&n.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,m.width,m.height,A,m.data):n.compressedTexImage2D(e.TEXTURE_2D,t,g,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_?S&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,m.width,m.height,A,f,m.data):n.texImage2D(e.TEXTURE_2D,t,g,m.width,m.height,0,A,f,m.data)}else if(o.isDataArrayTexture)if(_){if(M&&n.texStorage3D(e.TEXTURE_2D_ARRAY,I,g,p.width,p.height,p.depth),S)if(o.layerUpdates.size>0){const t=yu(p.width,p.height,o.format,o.type);for(const i of o.layerUpdates){const r=p.data.subarray(i*t/p.data.BYTES_PER_ELEMENT,(i+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,i,p.width,p.height,1,A,f,r)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,A,f,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,g,p.width,p.height,p.depth,0,A,f,p.data);else if(o.isData3DTexture)_?(M&&n.texStorage3D(e.TEXTURE_3D,I,g,p.width,p.height,p.depth),S&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,A,f,p.data)):n.texImage3D(e.TEXTURE_3D,0,g,p.width,p.height,p.depth,0,A,f,p.data);else if(o.isFramebufferTexture){if(M)if(_)n.texStorage2D(e.TEXTURE_2D,I,g,p.width,p.height);else{let t=p.width,i=p.height;for(let r=0;r<I;r++)n.texImage2D(e.TEXTURE_2D,r,g,t,i,0,A,f,null),t>>=1,i>>=1}}else if(x.length>0){if(_&&M){const t=W(x[0]);n.texStorage2D(e.TEXTURE_2D,I,g,t.width,t.height)}for(let t=0,i=x.length;t<i;t++)m=x[t],_?S&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,A,f,m):n.texImage2D(e.TEXTURE_2D,t,g,A,f,m);o.generateMipmaps=!1}else if(_){if(M){const t=W(p);n.texStorage2D(e.TEXTURE_2D,I,g,t.width,t.height)}S&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,A,f,p)}else n.texImage2D(e.TEXTURE_2D,0,g,A,f,p);y(o)&&E(l),d.__version=h.version,o.onUpdate&&o.onUpdate(o)}return t.__version=o.version,!0}function F(t,r,o,l,h,d){const u=s.convert(o.format,o.colorSpace),p=s.convert(o.type),A=b(o.internalFormat,u,p,o.colorSpace),f=i.get(r),m=i.get(o);if(m.__renderTarget=r,!f.__hasExternalTextures){const t=Math.max(1,r.width>>d),i=Math.max(1,r.height>>d);!0===r.isWebGLMultiviewRenderTarget?n.texStorage3D(e.TEXTURE_2D_ARRAY,0,A,r.width,r.height,r.numViews):h===e.TEXTURE_3D||h===e.TEXTURE_2D_ARRAY?n.texImage3D(h,d,A,t,i,r.depth,0,u,p,null):n.texImage2D(h,d,A,t,i,0,u,p,null)}n.bindFramebuffer(e.FRAMEBUFFER,t);const g=V(r);!0===r.isWebGLMultiviewRenderTarget?g?c.framebufferTextureMultisampleMultiviewOVR(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,m.__webglTexture,0,H(r),0,r.numViews):c.framebufferTextureMultiviewOVR(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,m.__webglTexture,0,0,r.numViews):(h===e.TEXTURE_2D||h>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&h<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&(g?a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,h,m.__webglTexture,0,H(r)):e.framebufferTexture2D(e.FRAMEBUFFER,l,h,m.__webglTexture,d)),n.bindFramebuffer(e.FRAMEBUFFER,null)}function k(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),!0===n.isWebGLMultiviewRenderTarget){const t=V(n),r=n.numViews,s=n.depthTexture;let o=e.DEPTH_COMPONENT24,a=e.DEPTH_ATTACHMENT;s&&s.isDepthTexture&&(s.type===Fe?o=e.DEPTH_COMPONENT32F:s.type===Ge&&(o=e.DEPTH24_STENCIL8,a=e.DEPTH_STENCIL_ATTACHMENT));let l=i.get(n.depthTexture).__webglTexture;void 0===l&&(l=e.createTexture(),e.bindTexture(e.TEXTURE_2D_ARRAY,l),e.texStorage3D(e.TEXTURE_2D_ARRAY,1,o,n.width,n.height,r)),t?c.framebufferTextureMultisampleMultiviewOVR(e.FRAMEBUFFER,a,l,0,H(n),0,r):c.framebufferTextureMultiviewOVR(e.FRAMEBUFFER,a,l,0,0,r)}else if(n.depthBuffer&&!n.stencilBuffer){const i=n.depthTexture,s=i&&i.isDepthTexture?i.type:null,o=C(n.stencilBuffer,s),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=H(n);V(n)?a.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{const t=n.textures;for(let i=0;i<t.length;i++){const o=t[i],l=s.convert(o.format,o.colorSpace),c=s.convert(o.type),h=b(o.internalFormat,l,c,o.colorSpace),d=H(n);r&&!1===V(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,d,h,n.width,n.height):V(n)?a.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,d,h,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,h,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function N(t,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,t),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const s=i.get(r.depthTexture);s.__renderTarget=r,s.__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),B(r.depthTexture,0),1!=r.depthTexture.image.depth?T(r.depthTexture,0):B(r.depthTexture,0);const o=s.__webglTexture,l=H(r);if(!0===r.isWebGLMultiviewRenderTarget){const t=V(r),n=r.numViews;if(r.depthTexture.format===Xe)t?c.framebufferTextureMultisampleMultiviewOVR(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,o,0,l,0,n):c.framebufferTextureMultiviewOVR(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,o,0,0,n);else{if(r.depthTexture.format!==Ye)throw new Error("Unknown depthTexture format");t?c.framebufferTextureMultisampleMultiviewOVR(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,o,0,l,0,n):c.framebufferTextureMultiviewOVR(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,o,0,0,n)}}else if(r.depthTexture.format===Xe)V(r)?a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,o,0,l):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,o,0);else{if(r.depthTexture.format!==Ye)throw new Error("Unknown depthTexture format");V(r)?a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,o,0,l):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,o,0)}}function Q(t){const r=i.get(t),s=!0===t.isWebGLCubeRenderTarget;if(r.__boundDepthTexture!==t.depthTexture){const e=t.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),e){const t=()=>{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),r.__depthDisposeCallback=t}r.__boundDepthTexture=e}if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(s)throw new Error("target.depthTexture not supported in Cube render targets");N(r.__webglFramebuffer,t)}else if(s){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[i]),void 0===r.__webglDepthbuffer[i])r.__webglDepthbuffer[i]=e.createRenderbuffer(),k(r.__webglDepthbuffer[i],t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,s=r.__webglDepthbuffer[i];e.bindRenderbuffer(e.RENDERBUFFER,s),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,s)}}else if(n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=e.createRenderbuffer(),k(r.__webglDepthbuffer,t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,i=r.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,i)}n.bindFramebuffer(e.FRAMEBUFFER,null)}const G=[],z=[];function H(e){return Math.min(r.maxSamples,e.samples)}function V(e){const n=i.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function j(e,t){const n=e.colorSpace,i=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==nn&&n!==en&&(Ai.getTransfer(n)===sn?i===je&&r===Re||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function W(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(h.width=e.naturalWidth||e.width,h.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(h.width=e.displayWidth,h.height=e.displayHeight):(h.width=e.width,h.height=e.height),h}this.allocateTextureUnit=function(){const e=I;return e>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),I+=1,e},this.resetTextureUnits=function(){I=0},this.setTexture2D=B,this.setTexture2DArray=T,this.setTexture3D=function(t,r){const s=i.get(t);t.version>0&&s.__version!==t.version?O(s,t,r):n.bindTexture(e.TEXTURE_3D,s.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,o){const a=i.get(t);t.version>0&&a.__version!==t.version?function(t,o,a){if(6!==o.image.length)return;const l=U(t,o),c=o.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+a);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(e.TEXTURE0+a);const t=Ai.getPrimaries(Ai.workingColorSpace),i=o.colorSpace===en?null:Ai.getPrimaries(o.colorSpace),d=o.colorSpace===en||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);const u=o.isCompressedTexture||o.image[0].isCompressedTexture,p=o.image[0]&&o.image[0].isDataTexture,A=[];for(let e=0;e<6;e++)A[e]=u||p?p?o.image[e].image:o.image[e]:v(o.image[e],!0,r.maxCubemapSize),A[e]=j(o,A[e]);const f=A[0],m=s.convert(o.format,o.colorSpace),g=s.convert(o.type),x=b(o.internalFormat,m,g,o.colorSpace),C=!0!==o.isVideoTexture,_=void 0===h.__version||!0===l,M=c.dataReady;let S,I=w(o,f);if(P(e.TEXTURE_CUBE_MAP,o),u){C&&_&&n.texStorage2D(e.TEXTURE_CUBE_MAP,I,x,f.width,f.height);for(let t=0;t<6;t++){S=A[t].mipmaps;for(let i=0;i<S.length;i++){const r=S[i];o.format!==je?null!==m?C?M&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,m,r.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,x,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):C?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,m,g,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,x,r.width,r.height,0,m,g,r.data)}}}else{if(S=o.mipmaps,C&&_){S.length>0&&I++;const t=W(A[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,I,x,t.width,t.height)}for(let t=0;t<6;t++)if(p){C?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,A[t].width,A[t].height,m,g,A[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,x,A[t].width,A[t].height,0,m,g,A[t].data);for(let i=0;i<S.length;i++){const r=S[i].image[t].image;C?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,r.width,r.height,m,g,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,x,r.width,r.height,0,m,g,r.data)}}else{C?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m,g,A[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,x,m,g,A[t]);for(let i=0;i<S.length;i++){const r=S[i];C?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,m,g,r.image[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,x,m,g,r.image[t])}}}y(o)&&E(e.TEXTURE_CUBE_MAP),h.__version=c.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}(a,t,o):n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+o)},this.rebindTextures=function(t,n,r){const s=i.get(t);void 0!==n&&F(s.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&Q(t)},this.uploadTexture=O,this.setupRenderTarget=function(t){const r=t.texture,a=i.get(t),l=i.get(r);t.addEventListener("dispose",M);const c=t.textures,h=!0===t.isWebGLCubeRenderTarget,d=c.length>1;if(d||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,o.memory.textures++),h){a.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){a.__webglFramebuffer[t]=[];for(let n=0;n<r.mipmaps.length;n++)a.__webglFramebuffer[t][n]=e.createFramebuffer()}else a.__webglFramebuffer[t]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){a.__webglFramebuffer=[];for(let t=0;t<r.mipmaps.length;t++)a.__webglFramebuffer[t]=e.createFramebuffer()}else a.__webglFramebuffer=e.createFramebuffer();if(d)for(let t=0,n=c.length;t<n;t++){const n=i.get(c[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),o.memory.textures++)}if(t.samples>0&&!1===V(t)){a.__webglMultisampledFramebuffer=e.createFramebuffer(),a.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,a.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const i=c[n];a.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,a.__webglColorRenderbuffer[n]);const r=s.convert(i.format,i.colorSpace),o=s.convert(i.type),l=b(i.internalFormat,r,o,i.colorSpace,!0===t.isXRRenderTarget),h=H(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,h,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,a.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(a.__webglDepthRenderbuffer=e.createRenderbuffer(),k(a.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(h){n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),P(e.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)F(a.__webglFramebuffer[n][i],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else F(a.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);y(r)&&E(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(d){for(let r=0,s=c.length;r<s;r++){const s=c[r],o=i.get(s);n.bindTexture(e.TEXTURE_2D,o.__webglTexture),P(e.TEXTURE_2D,s),F(a.__webglFramebuffer,t,s,e.COLOR_ATTACHMENT0+r,e.TEXTURE_2D,0),y(s)&&E(e.TEXTURE_2D)}n.unbindTexture()}else{let i=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(i=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),!0===t.isWebGLMultiviewRenderTarget&&(i=e.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),P(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)F(a.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,i,n);else F(a.__webglFramebuffer,t,r,e.COLOR_ATTACHMENT0,i,0);y(r)&&E(i),n.unbindTexture()}(t.depthBuffer||!0===t.isWebGLMultiviewRenderTarget)&&this.setupDepthRenderbuffer(t)},this.updateRenderTargetMipmap=function(e){const t=e.textures;for(let r=0,s=t.length;r<s;r++){const s=t[r];if(y(s)){const t=x(e),r=i.get(s).__webglTexture;n.bindTexture(t,r),E(t),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0)if(!1===V(t)){const r=t.textures,s=t.width,o=t.height;let a=e.COLOR_BUFFER_BIT;const c=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=i.get(t),d=r.length>1;if(d)for(let t=0;t<r.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let n=0;n<r.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(a|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(a|=e.STENCIL_BUFFER_BIT)),d){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,h.__webglColorRenderbuffer[n]);const t=i.get(r[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,s,o,0,0,s,o,a,e.NEAREST),!0===l&&(G.length=0,z.length=0,G.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&!1===t.resolveDepthBuffer&&(G.push(c),z.push(c),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,z)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,G))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),d)for(let t=0;t<r.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,h.__webglColorRenderbuffer[t]);const s=i.get(r[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,s,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&l){const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}},this.setupDepthTexture=N,this.setupDepthRenderbuffer=Q,this.setupFrameBufferTexture=F,this.useMultisampledRTT=V,this.runDeferredUploads=function(){const e=f;f=!1;for(const e of A)O(e.textureProperties,e.texture,e.slot),e.texture.isPendingDeferredUpload=!1;A=[],f=e},this.setDeferTextureUploads=function(e){f=e}}function XA(e,t){return{convert:function(n,i=en){let r;const s=Ai.getTransfer(i);if(n===Re)return e.UNSIGNED_BYTE;if(n===Ne)return e.UNSIGNED_SHORT_4_4_4_4;if(n===Qe)return e.UNSIGNED_SHORT_5_5_5_1;if(n===ze)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===Le)return e.BYTE;if(n===De)return e.SHORT;if(n===Pe)return e.UNSIGNED_SHORT;if(n===Ue)return e.INT;if(n===Oe)return e.UNSIGNED_INT;if(n===Fe)return e.FLOAT;if(n===ke)return e.HALF_FLOAT;if(n===He)return e.ALPHA;if(n===Ve)return e.RGB;if(n===je)return e.RGBA;if(n===We)return e.LUMINANCE;if(n===qe)return e.LUMINANCE_ALPHA;if(n===Xe)return e.DEPTH_COMPONENT;if(n===Ye)return e.DEPTH_STENCIL;if(n===Je)return e.RED;if(n===Ke)return e.RED_INTEGER;if(n===Ze)return e.RG;if(n===$e)return e.RG_INTEGER;if(n===tt)return e.RGBA_INTEGER;if(n===nt||n===it||n===rt||n===st)if(s===sn){if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===nt)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===it)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===rt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===st)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=t.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===nt)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===it)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===rt)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===st)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===ot||n===at||n===lt||n===ct){if(r=t.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===ot)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===at)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===lt)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ct)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===ht||n===dt||n===ut){if(r=t.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===ht||n===dt)return s===sn?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===ut)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===pt||n===At||n===ft||n===mt||n===gt||n===vt||n===yt||n===Et||n===xt||n===bt||n===Ct||n===wt||n===_t||n===Mt){if(r=t.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===pt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===At)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ft)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===mt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===gt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===vt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===yt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Et)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===xt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===bt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ct)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===wt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===_t)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Mt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===St||n===It||n===Bt){if(r=t.get("EXT_texture_compression_bptc"),null===r)return null;if(n===St)return s===sn?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===It)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Bt)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===Tt||n===Rt||n===Lt||n===Dt){if(r=t.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===St)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Rt)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Lt)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Dt)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===Ge?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}class YA extends Mi{constructor(e,t,n,i={}){super(e,t,i),this.depthBuffer=!1,this.stencilBuffer=!1,this.numViews=n}copy(e){return super.copy(e),this.numViews=e.numViews,this}}YA.prototype.isWebGLMultiviewRenderTarget=!0;const JA={type:"move"};class KA{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Wa,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Wa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Li,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Li),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Wa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Li,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Li),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){s=!0;for(const i of e.hand.values()){const e=t.getJointPose(i,n),r=this._getHandJoint(l,i);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=i.position.distanceTo(r.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==a&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));null!==o&&(i=t.getPose(e.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(JA)))}return null!==o&&(o.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new Wa;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class ZA{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(null===this.texture){const i=new Ci;e.properties.get(i).__webglTexture=t.texture,t.depthNear==n.depthNear&&t.depthFar==n.depthFar||(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(null!==this.texture&&null===this.mesh){const t=e.cameras[0].viewport,n=new Xs({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Gs(new uc(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class $A extends Hn{constructor(e,t,n,i){super();const r=this;let s=null,o=1;var a=null;let l=null,c="local-floor",h=1,d=null,u=null;var p=[];let A=null,f=null,m=null,g=null;const v=new ZA,y=t.getContextAttributes();let E=null,x=null;const b=[],C=[],w=new ti;let _=null;const M=new $s;M.viewport=new wi;const S=new $s;S.viewport=new wi;const I=[M,S],B=new Jh;let T=null,R=null;function L(e){const t=C.indexOf(e.inputSource);if(-1===t)return;const n=b[t];void 0!==n&&(n.update(e.inputSource,e.frame,d||l),n.dispatchEvent({type:e.type,data:e.inputSource}))}function D(){s.removeEventListener("select",L),s.removeEventListener("selectstart",L),s.removeEventListener("selectend",L),s.removeEventListener("squeeze",L),s.removeEventListener("squeezestart",L),s.removeEventListener("squeezeend",L),s.removeEventListener("end",D),s.removeEventListener("inputsourceschange",P);for(let e=0;e<b.length;e++){const t=C[e];null!==t&&(C[e]=null,b[e].disconnect(t))}T=null,R=null,v.reset(),e.setRenderTarget(E),m=null,f=null,A=null,s=null,x=null,N.stop(),r.isPresenting=!1,e.setPixelRatio(_),e.setSize(w.width,w.height,!1),r.dispatchEvent({type:"sessionend"})}function P(e){for(let t=0;t<e.removed.length;t++){const n=e.removed[t],i=C.indexOf(n);i>=0&&(C[i]=null,b[i].disconnect(n))}for(let t=0;t<e.added.length;t++){const n=e.added[t];let i=C.indexOf(n);if(-1===i){for(let e=0;e<b.length;e++){if(e>=C.length){C.push(n),i=e;break}if(null===C[e]){C[e]=n,i=e;break}}if(-1===i)break}const r=b[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.layersEnabled=!1,this.enabled=!1,this.isPresenting=!1,this.isMultiview=!1,this.getCameraPose=function(){return u},this.getController=function(e){let t=b[e];return void 0===t&&(t=new KA,b[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=b[e];return void 0===t&&(t=new KA,b[e]=t),t.getGripSpace()},this.getHand=function(e){let t=b[e];return void 0===t&&(t=new KA,b[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){o=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){c=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||l},this.setReferenceSpace=function(e){d=e},this.getBaseLayer=function(){return null!==f?f:m},this.getBinding=function(){return A},this.getFrame=function(){return g},this.getSession=function(){return s},this.setSession=async function(a){if(s=a,null!==s){if(E=e.getRenderTarget(),s.addEventListener("select",L),s.addEventListener("selectstart",L),s.addEventListener("selectend",L),s.addEventListener("squeeze",L),s.addEventListener("squeezestart",L),s.addEventListener("squeezeend",L),s.addEventListener("end",D),s.addEventListener("inputsourceschange",P),!0!==y.xrCompatible&&await t.makeXRCompatible(),_=e.getPixelRatio(),e.getSize(w),void 0===s.renderState.layers){const n={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:o};m=new XRWebGLLayer(s,t,n),s.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),x=new Mi(m.framebufferWidth,m.framebufferHeight,{format:je,type:Re,colorSpace:e.outputColorSpace,stencilBuffer:y.stencil})}else{let a=null,l=null,c=null;y.depth&&(c=y.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,a=y.stencil?Ye:Xe,l=y.stencil?Ge:Oe),r.isMultiview=i&&n.has("OCULUS_multiview");const h={colorFormat:t.RGBA8,depthFormat:c,scaleFactor:o};r.isMultiview&&(h.textureType="texture-array"),A=new XRWebGLBinding(s,t),f=A.createProjectionLayer(h),s.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1);const d={format:je,type:Re,depthTexture:new $a(f.textureWidth,f.textureHeight,l,void 0,void 0,void 0,void 0,void 0,void 0,a),stencilBuffer:y.stencil,colorSpace:e.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:!1===f.ignoreDepthValues};if(r.isMultiview){const e=n.get("OCULUS_multiview");this.maxNumViews=t.getParameter(e.MAX_VIEWS_OVR),x=new YA(f.textureWidth,f.textureHeight,2,d)}else x=new Mi(f.textureWidth,f.textureHeight,d)}x.isXRRenderTarget=!0,this.setFoveation(h),d=null,l=await s.requestReferenceSpace(c),N.setContext(s),N.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==s)return s.environmentBlendMode},this.addLayer=function(e){window.XRWebGLBinding&&this.layersEnabled&&s&&(p.push(e),this.updateLayers())},this.removeLayer=function(e){p.splice(p.indexOf(e),1),window.XRWebGLBinding&&this.layersEnabled&&s&&this.updateLayers()},this.updateLayers=function(){var e=p.map((function(e){return e}));e.unshift(s.renderState.layers[0]),s.updateRenderState({layers:e})},this.getDepthTexture=function(){return v.getDepthTexture()};const U=new Li,O=new Li;function F(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.setPoseTarget=function(e){void 0!==e&&(a=e)},this.updateCamera=function(e){if(null===s)return;let t=e.near,n=e.far;null!==v.texture&&(v.depthNear>0&&(t=v.depthNear),v.depthFar>0&&(n=v.depthFar)),B.near=S.near=M.near=t,B.far=S.far=M.far=n,T===B.near&&R===B.far||(s.updateRenderState({depthNear:B.near,depthFar:B.far}),T=B.near,R=B.far),M.layers.mask=2|e.layers.mask,S.layers.mask=4|e.layers.mask,B.layers.mask=M.layers.mask|S.layers.mask;const i=B.cameras;var r=a||e;const o=r.parent;F(B,o);for(let e=0;e<i.length;e++)F(i[e],o);2===i.length?function(e,t,n){U.setFromMatrixPosition(t.matrixWorld),O.setFromMatrixPosition(n.matrixWorld);const i=U.distanceTo(O),r=t.projectionMatrix.elements,s=n.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],d=(s[8]+1)/s[0],u=o*h,p=o*d,A=i/(-h+d),f=A*-h;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(f),e.translateZ(A),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===r[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{const t=o+A,n=a+A,r=u-f,s=p+(i-f),h=l*a/n*t,d=c*a/n*t;e.projectionMatrix.makePerspective(r,s,h,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(B,M,S):B.projectionMatrix.copy(M.projectionMatrix),function(e,t,n){t.matrixWorld.decompose(t.position,t.quaternion,t.scale),null===n.parent?n.matrix.copy(t.matrixWorld):(n.matrix.copy(n.parent.matrixWorld),n.matrix.invert(),n.matrix.multiply(t.matrixWorld)),n.matrix.decompose(n.position,n.quaternion,n.scale),n.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*qn*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,B,r)},this.getCamera=function(){return B},this.getFoveation=function(){if(null!==f||null!==m)return h},this.setFoveation=function(e){h=e,null!==f&&(f.fixedFoveation=e),null!==m&&void 0!==m.fixedFoveation&&(m.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==v.texture},this.getDepthSensingMesh=function(){return v.getMesh(B)};let k=null;const N=new bu;N.setAnimationLoop((function(t,n){if(u=n.getViewerPose(d||l),g=n,null!==u){const t=u.views;null!==m&&(e.setRenderTargetFramebuffer(x,m.framebuffer),e.setRenderTarget(x));let n=!1;t.length!==B.cameras.length&&(B.cameras.length=0,n=!0);for(let i=0;i<t.length;i++){const r=t[i];let s=null;if(null!==m)s=m.getViewport(r);else{const t=A.getViewSubImage(f,r);s=t.viewport,0===i&&(e.setRenderTargetTextures(x,t.colorTexture,f.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(x))}let o=I[i];void 0===o&&(o=new $s,o.layers.enable(i),o.viewport=new wi,I[i]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(s.x,s.y,s.width,s.height),0===i&&(B.matrix.copy(o.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),!0===n&&B.cameras.push(o)}const i=s.enabledFeatures;if(i&&i.includes("depth-sensing")){const n=A.getDepthInformation(t[0]);n&&n.isValid&&n.texture&&v.init(e,n,s.renderState)}}for(let e=0;e<b.length;e++){const t=C[e],i=b[e];null!==t&&void 0!==i&&i.update(t,n,d||l)}k&&k(t,n),n.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:n}),g=null})),this.setAnimationLoop=function(e){k=e},this.dispose=function(){}}}const ef=new vr,tf=new lr;function nf(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map,n(i.map,e.mapTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,n(i.alphaMap,e.alphaMapTransform)),i.bumpMap&&(e.bumpMap.value=i.bumpMap,n(i.bumpMap,e.bumpMapTransform),e.bumpScale.value=i.bumpScale,i.side===g&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,n(i.normalMap,e.normalMapTransform),e.normalScale.value.copy(i.normalScale),i.side===g&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,n(i.displacementMap,e.displacementMapTransform),e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,e.emissiveMapTransform)),i.specularMap&&(e.specularMap.value=i.specularMap,n(i.specularMap,e.specularMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);const r=t.get(i),s=r.envMap,o=r.envMapRotation;s&&(e.envMap.value=s,ef.copy(o),ef.x*=-1,ef.y*=-1,ef.z*=-1,s.isCubeTexture&&!1===s.isRenderTargetTexture&&(ef.y*=-1,ef.z*=-1),e.envMapRotation.value.setFromMatrix4(tf.makeRotationFromEuler(ef)),e.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,Ws(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,s,o,a){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===g&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,a)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,s,o):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function rf(e,t,n,i){let r={},s={},o=[];const a=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,i){const r=e.value,s=t+"_"+n;if(void 0===i[s])return i[s]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const e=i[s];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return i[s]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}function c(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function h(t){const n=t.target;n.removeEventListener("dispose",h);const i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete s[n.id]}return{bind:function(e,t){const n=t.program;i.uniformBlockBinding(e,n)},update:function(n,d){let u=r[n.id];void 0===u&&(function(e){const t=e.uniforms;let n=0;for(let e=0,i=t.length;e<i;e++){const i=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=i.length;e<t;e++){const t=i[e],r=Array.isArray(t.value)?t.value:[t.value];for(let e=0,i=r.length;e<i;e++){const i=c(r[e]),s=n%16,o=s%i.boundary,a=s+o;n+=o,0!==a&&16-a<i.storage&&(n+=16-a),t.__data=new Float32Array(i.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=i.storage}}}const i=n%16;i>0&&(n+=16-i),e.__size=n,e.__cache={}}(n),u=function(t){const n=function(){for(let e=0;e<a;e++)if(-1===o.indexOf(e))return o.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;const i=e.createBuffer(),r=t.__size,s=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,i),e.bufferData(e.UNIFORM_BUFFER,r,s),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=u,n.addEventListener("dispose",h));const p=d.program;i.updateUBOMapping(n,p);const A=t.render.frame;s[n.id]!==A&&(function(t){const n=r[t.id],i=t.uniforms,s=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let t=0,n=i.length;t<n;t++){const n=Array.isArray(i[t])?i[t]:[i[t]];for(let i=0,r=n.length;i<r;i++){const r=n[i];if(!0===l(r,t,i,s)){const t=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let s=0;s<n.length;s++){const o=n[s],a=c(o);"number"==typeof o||"boolean"==typeof o?(r.__data[0]=o,e.bufferSubData(e.UNIFORM_BUFFER,t+i,r.__data)):o.isMatrix3?(r.__data[0]=o.elements[0],r.__data[1]=o.elements[1],r.__data[2]=o.elements[2],r.__data[3]=0,r.__data[4]=o.elements[3],r.__data[5]=o.elements[4],r.__data[6]=o.elements[5],r.__data[7]=0,r.__data[8]=o.elements[6],r.__data[9]=o.elements[7],r.__data[10]=o.elements[8],r.__data[11]=0):(o.toArray(r.__data,i),i+=a.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,r.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),s[n.id]=A)},dispose:function(){for(const t in r)e.deleteBuffer(r[t]);o=[],r={},s={}}}}class sf{constructor(e={}){const{canvas:t=li(),context:n=null,depth:i=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reverseDepthBuffer:u=!1,multiviewStereo:p=!1}=e;let A;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");A=n.getContextAttributes().alpha}else A=o;const f=new Uint32Array(4),y=new Int32Array(4);let E=null,x=null;const b=[],C=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=tn,this.toneMapping=ne,this.toneMappingExposure=1;const w=this;let _=!1,M=0,S=0,I=null,B=-1,T=null;const R=new wi,L=new wi;let D=null;const P=new es(0);let U=0,O=t.width,F=t.height,k=1,N=null,Q=null;const G=new wi(0,0,O,F),z=new wi(0,0,O,F);let H=!1;const V=new oa;let j=!1,W=!1;const q=new lr,X=new lr,Y=new Li,J=new wi,K={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Z=!1;function $(){return null===I?k:1}let ee,te,ie,re,se,oe,ae,le,ce,he,de,ue,pe,Ae,fe,me,ge,ve,ye,Ee,xe,be,Ce,we,_e,Me=n;function Se(e,n){return t.getContext(e,n)}try{const e={alpha:!0,depth:i,stencil:r,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${s}`),t.addEventListener("webglcontextlost",Le,!1),t.addEventListener("webglcontextrestored",De,!1),t.addEventListener("webglcontextcreationerror",Ue,!1),null===Me){const t="webgl2";if(Me=Se(t,e),null===Me)throw Se(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function Ie(){ee=new Zu(Me),ee.init(),Ce=new XA(Me,ee),te=new Du(Me,ee,e,Ce),ie=new WA(Me,ee),te.reverseDepthBuffer&&u&&ie.buffers.depth.setReversed(!0),re=new tp(Me),se=new DA,oe=new qA(Me,ee,ie,se,te,Ce,re),ae=new Uu(w),le=new Ku(w),ce=new Cu(Me),we=new Ru(Me,ce),he=new $u(Me,ce,re,we),de=new rp(Me,he,ce,re),Ee=new np(Me,te,oe),me=new Pu(se),ue=new LA(w,ae,le,ee,te,we,me),pe=new nf(w,se),Ae=new FA,fe=new HA(ee),ye=new Tu(w,ae,le,ie,de,A,l),ve=new ip(w,ee,Me),ge=new VA(w,de,te),_e=new rf(Me,re,te,ie),xe=new Lu(Me,ee,re),be=new ep(Me,ee,re),re.programs=ue.programs,w.capabilities=te,w.extensions=ee,w.properties=se,w.renderLists=Ae,w.shadowMap=ge,w.state=ie,w.info=re}Ie();const Te=new $A(w,Me);function Le(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),_=!0}function De(){console.log("THREE.WebGLRenderer: Context Restored."),_=!1;const e=re.autoReset,t=ge.enabled,n=ge.autoUpdate,i=ge.needsUpdate,r=ge.type;Ie(),re.autoReset=e,ge.enabled=t,ge.autoUpdate=n,ge.needsUpdate=i,ge.type=r}function Ue(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function Fe(e){const t=e.target;t.removeEventListener("dispose",Fe),function(e){(function(e){const t=se.get(e).programs;void 0!==t&&(t.forEach((function(e){ue.releaseProgram(e)})),e.isShaderMaterial&&ue.releaseShaderCache(e))})(e),se.remove(e)}(t)}function ze(e,t,n){!0===e.transparent&&e.side===v&&!1===e.forceSinglePass?(e.side=g,e.needsUpdate=!0,et(e,t,n),e.side=m,e.needsUpdate=!0,et(e,t,n),e.side=v):et(e,t,n)}this.xr=Te,this.getContext=function(){return Me},this.getContextAttributes=function(){return Me.getContextAttributes()},this.forceContextLoss=function(){const e=ee.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=ee.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return k},this.setPixelRatio=function(e){void 0!==e&&(k=e,this.setSize(O,F,!1))},this.getSize=function(e){return e.set(O,F)},this.setSize=function(e,n,i=!0){Te.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(O=e,F=n,t.width=Math.floor(e*k),t.height=Math.floor(n*k),!0===i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(O*k,F*k).floor()},this.setDrawingBufferSize=function(e,n,i){O=e,F=n,k=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(R)},this.getViewport=function(e){return e.copy(G)},this.setViewport=function(e,t,n,i){e.isVector4?G.set(e.x,e.y,e.z,e.w):G.set(e,t,n,i),ie.viewport(R.copy(G).multiplyScalar(k).round())},this.getScissor=function(e){return e.copy(z)},this.setScissor=function(e,t,n,i){e.isVector4?z.set(e.x,e.y,e.z,e.w):z.set(e,t,n,i),ie.scissor(L.copy(z).multiplyScalar(k).round())},this.getScissorTest=function(){return H},this.setScissorTest=function(e){ie.setScissorTest(H=e)},this.setOpaqueSort=function(e){N=e},this.setTransparentSort=function(e){Q=e},this.getClearColor=function(e){return e.copy(ye.getClearColor())},this.setClearColor=function(){ye.setClearColor.apply(ye,arguments)},this.getClearAlpha=function(){return ye.getClearAlpha()},this.setClearAlpha=function(){ye.setClearAlpha.apply(ye,arguments)},this.clear=function(e=!0,t=!0,n=!0){let i=0;if(e){let e=!1;if(null!==I){const t=I.texture.format;e=t===tt||t===$e||t===Ke}if(e){const e=I.texture.type,t=e===Re||e===Oe||e===Pe||e===Ge||e===Ne||e===Qe,n=ye.getClearColor(),i=ye.getClearAlpha(),r=n.r,s=n.g,o=n.b;t?(f[0]=r,f[1]=s,f[2]=o,f[3]=i,Me.clearBufferuiv(Me.COLOR,0,f)):(y[0]=r,y[1]=s,y[2]=o,y[3]=i,Me.clearBufferiv(Me.COLOR,0,y))}else i|=Me.COLOR_BUFFER_BIT}t&&(i|=Me.DEPTH_BUFFER_BIT),n&&(i|=Me.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Me.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Le,!1),t.removeEventListener("webglcontextrestored",De,!1),t.removeEventListener("webglcontextcreationerror",Ue,!1),ye.dispose(),Ae.dispose(),fe.dispose(),se.dispose(),ae.dispose(),le.dispose(),de.dispose(),we.dispose(),_e.dispose(),ue.dispose(),Te.dispose(),Te.removeEventListener("sessionstart",Ve),Te.removeEventListener("sessionend",je),We.stop()},this.renderBufferDirect=function(e,t,n,i,r,s){null===t&&(t=K);const o=r.isMesh&&r.matrixWorld.determinant()<0,a=function(e,t,n,i,r){!0!==t.isScene&&(t=K),oe.resetTextureUnits();const s=t.fog,o=i.isMeshStandardMaterial?t.environment:null,a=null===I?w.outputColorSpace:!0===I.isXRRenderTarget?I.texture.colorSpace:nn,l=(i.isMeshStandardMaterial?le:ae).get(i.envMap||o),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),d=!!n.morphAttributes.position,u=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let A=ne;i.toneMapped&&(null!==I&&!0!==I.isXRRenderTarget||(A=w.toneMapping));const f=I&&I.isWebGLMultiviewRenderTarget?I.numViews:0,m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,g=void 0!==m?m.length:0,v=se.get(i),y=x.state.lights;if(!0===j&&(!0===W||e!==T)){const t=e===T&&i.id===B;me.setState(i,e,t)}let E=!1;i.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version||v.outputColorSpace!==a||r.isBatchedMesh&&!1===v.batching?E=!0:r.isBatchedMesh||!0!==v.batching?r.isBatchedMesh&&!0===v.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===v.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===v.instancing?E=!0:r.isInstancedMesh||!0!==v.instancing?r.isSkinnedMesh&&!1===v.skinning?E=!0:r.isSkinnedMesh||!0!==v.skinning?r.isInstancedMesh&&!0===v.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===v.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===v.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===v.instancingMorph&&null!==r.morphTexture||v.envMap!==l||!0===i.fog&&v.fog!==s?E=!0:void 0===v.numClippingPlanes||v.numClippingPlanes===me.numPlanes&&v.numIntersection===me.numIntersection?(v.vertexAlphas!==c||v.vertexTangents!==h||v.morphTargets!==d||v.morphNormals!==u||v.morphColors!==p||v.toneMapping!==A||v.morphTargetsCount!==g||v.numMultiviewViews!==f)&&(E=!0):E=!0:E=!0:E=!0:E=!0:(E=!0,v.__version=i.version);let b=v.currentProgram;!0===E&&(b=et(i,t,r));let C=!1,_=!1,M=!1;const S=b.getUniforms(),R=v.uniforms;if(ie.useProgram(b.program)&&(C=!0,_=!0,M=!0),i.id!==B&&(B=i.id,_=!0),C||T!==e){b.numMultiviewViews>0?(ve.updateCameraProjectionMatricesUniform(e,S),ve.updateCameraViewMatricesUniform(e,S)):(ie.buffers.depth.getReversed()?(q.copy(e.projectionMatrix),function(e){const t=e.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}(q),function(e){const t=e.elements;-1===t[11]?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=1-t[14])}(q),S.setValue(Me,"projectionMatrix",q)):S.setValue(Me,"projectionMatrix",e.projectionMatrix),S.setValue(Me,"viewMatrix",e.matrixWorldInverse));const t=S.map.cameraPosition;void 0!==t&&t.setValue(Me,Y.setFromMatrixPosition(e.matrixWorld)),te.logarithmicDepthBuffer&&S.setValue(Me,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&S.setValue(Me,"isOrthographic",!0===e.isOrthographicCamera),T!==e&&(T=e,_=!0,M=!0)}if(r.isSkinnedMesh){S.setOptional(Me,r,"bindMatrix"),S.setOptional(Me,r,"bindMatrixInverse");const e=r.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),S.setValue(Me,"boneTexture",e.boneTexture,oe))}r.isBatchedMesh&&(S.setOptional(Me,r,"batchingTexture"),S.setValue(Me,"batchingTexture",r._matricesTexture,oe),S.setOptional(Me,r,"batchingIdTexture"),S.setValue(Me,"batchingIdTexture",r._indirectTexture,oe),S.setOptional(Me,r,"batchingColorTexture"),null!==r._colorsTexture&&S.setValue(Me,"batchingColorTexture",r._colorsTexture,oe));const L=n.morphAttributes;var D,P;if(void 0===L.position&&void 0===L.normal&&void 0===L.color||Ee.update(r,n,b),(_||v.receiveShadow!==r.receiveShadow)&&(v.receiveShadow=r.receiveShadow,S.setValue(Me,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(R.envMap.value=l,R.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==t.environment&&(R.envMapIntensity.value=t.environmentIntensity),_&&(S.setValue(Me,"toneMappingExposure",w.toneMappingExposure),v.needsLights&&(P=M,(D=R).ambientLightColor.needsUpdate=P,D.lightProbe.needsUpdate=P,D.directionalLights.needsUpdate=P,D.directionalLightShadows.needsUpdate=P,D.pointLights.needsUpdate=P,D.pointLightShadows.needsUpdate=P,D.spotLights.needsUpdate=P,D.spotLightShadows.needsUpdate=P,D.rectAreaLights.needsUpdate=P,D.hemisphereLights.needsUpdate=P),s&&!0===i.fog&&pe.refreshFogUniforms(R,s),pe.refreshMaterialUniforms(R,i,k,F,x.state.transmissionRenderTarget[e.id]),cA.upload(Me,nt(v),R,oe)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(cA.upload(Me,nt(v),R,oe),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&S.setValue(Me,"center",r.center),b.numMultiviewViews>0?ve.updateObjectMatricesUniforms(r,e,S):(S.setValue(Me,"modelViewMatrix",r.modelViewMatrix),S.setValue(Me,"normalMatrix",r.normalMatrix)),S.setValue(Me,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const e=i.uniformsGroups;for(let t=0,n=e.length;t<n;t++){const n=e[t];_e.update(n,b),_e.bind(n,b)}}return b}(e,t,n,i,r);ie.setMaterial(i,o);let l=n.index,c=1;if(!0===i.wireframe){if(l=he.getWireframeAttribute(n),void 0===l)return;c=2}const h=n.drawRange,d=n.attributes.position;let u=h.start*c,p=(h.start+h.count)*c;null!==s&&(u=Math.max(u,s.start*c),p=Math.min(p,(s.start+s.count)*c)),null!==l?(u=Math.max(u,0),p=Math.min(p,l.count)):null!=d&&(u=Math.max(u,0),p=Math.min(p,d.count));const A=p-u;if(A<0||A===1/0)return;let f;we.setup(r,i,a,n,l);let m=xe;if(null!==l&&(f=ce.get(l),m=be,m.setIndex(f)),r.isMesh)!0===i.wireframe?(ie.setLineWidth(i.wireframeLinewidth*$()),m.setMode(Me.LINES)):m.setMode(Me.TRIANGLES);else if(r.isLine){let e=i.linewidth;void 0===e&&(e=1),ie.setLineWidth(e*$()),r.isLineSegments?m.setMode(Me.LINES):r.isLineLoop?m.setMode(Me.LINE_LOOP):m.setMode(Me.LINE_STRIP)}else r.isPoints?m.setMode(Me.POINTS):r.isSprite&&m.setMode(Me.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)m.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(ee.get("WEBGL_multi_draw"))m.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const e=r._multiDrawStarts,t=r._multiDrawCounts,n=r._multiDrawCount,s=l?ce.get(l).bytesPerElement:1,o=se.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)o.setValue(Me,"_gl_DrawID",i),m.render(e[i]/s,t[i])}else if(r.isInstancedMesh)m.renderInstances(u,A,r.count);else if(n.isInstancedBufferGeometry){const e=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,t=Math.min(n.instanceCount,e);m.renderInstances(u,A,t)}else m.render(u,A)},this.compile=function(e,t,n=null){null===n&&(n=e),x=fe.get(n),x.init(t),C.push(x),n.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(x.pushLight(e),e.castShadow&&x.pushShadow(e))})),e!==n&&e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(x.pushLight(e),e.castShadow&&x.pushShadow(e))})),x.setupLights();const i=new Set;return e.traverse((function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;const t=e.material;if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++){const s=t[r];ze(s,n,e),i.add(s)}else ze(t,n,e),i.add(t)})),C.pop(),x=null,i},this.compileAsync=function(e,t,n=null){const i=this.compile(e,t,n);return new Promise((t=>{function n(){i.forEach((function(e){se.get(e).currentProgram.isReady()&&i.delete(e)})),0!==i.size?setTimeout(n,10):t(e)}null!==ee.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};let He=null;function Ve(){We.stop()}function je(){We.start()}const We=new bu;function qe(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)x.pushLight(e),e.castShadow&&x.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||V.intersectsSprite(e)){i&&J.setFromMatrixPosition(e.matrixWorld).applyMatrix4(X);const t=de.update(e),r=e.material;r.visible&&E.push(e,t,r,n,J.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||V.intersectsObject(e))){const t=de.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),J.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),J.copy(t.boundingSphere.center)),J.applyMatrix4(e.matrixWorld).applyMatrix4(X)),Array.isArray(r)){const i=t.groups;for(let s=0,o=i.length;s<o;s++){const o=i[s],a=r[o.materialIndex];a&&a.visible&&E.push(e,t,a,n,J.z,o)}}else r.visible&&E.push(e,t,r,n,J.z,null)}const r=e.children;for(let e=0,s=r.length;e<s;e++)qe(r[e],t,n,i)}function Xe(e,t,n,i){const r=e.opaque,s=e.transmissive,o=e.transparent;x.setupLightsView(n),!0===j&&me.setGlobalState(w.clippingPlanes,n),i&&ie.viewport(R.copy(i)),r.length>0&&Je(r,t,n),s.length>0&&Je(s,t,n),o.length>0&&Je(o,t,n),ie.buffers.depth.setTest(!0),ie.buffers.depth.setMask(!0),ie.buffers.color.setMask(!0),ie.setPolygonOffset(!1)}function Ye(e,t,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===x.state.transmissionRenderTarget[i.id]&&(x.state.transmissionRenderTarget[i.id]=new Mi(1,1,{generateMipmaps:!0,type:ee.has("EXT_color_buffer_half_float")||ee.has("EXT_color_buffer_float")?ke:Re,minFilter:Be,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ai.workingColorSpace}));const s=x.state.transmissionRenderTarget[i.id],o=i.viewport||R;s.setSize(o.z,o.w);const a=w.getRenderTarget();w.setRenderTarget(s),w.getClearColor(P),U=w.getClearAlpha(),U<1&&w.setClearColor(16777215,.5),w.clear(),Z&&ye.render(n);const l=w.toneMapping;w.toneMapping=ne;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),x.setupLightsView(i),!0===j&&me.setGlobalState(w.clippingPlanes,i),Je(e,n,i),oe.updateMultisampleRenderTarget(s),oe.updateRenderTargetMipmap(s),!1===ee.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,s=t.length;r<s;r++){const s=t[r],o=s.object,a=s.geometry,l=s.material,c=s.group;if(l.side===v&&o.layers.test(i.layers)){const t=l.side;l.side=g,l.needsUpdate=!0,Ze(o,n,i,a,l,c),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(oe.updateMultisampleRenderTarget(s),oe.updateRenderTargetMipmap(s))}w.setRenderTarget(a),w.setClearColor(P,U),void 0!==c&&(i.viewport=c),w.toneMapping=l}function Je(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,s=e.length;r<s;r++){const s=e[r],o=s.object,a=s.geometry,l=null===i?s.material:i,c=s.group;o.layers.test(n.layers)&&Ze(o,t,n,a,l,c)}}function Ze(e,t,n,i,r,s){e.onBeforeRender(w,t,n,i,r,s),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(w,t,n,i,e,s),!0===r.transparent&&r.side===v&&!1===r.forceSinglePass?(r.side=g,r.needsUpdate=!0,w.renderBufferDirect(n,t,i,r,e,s),r.side=m,r.needsUpdate=!0,w.renderBufferDirect(n,t,i,r,e,s),r.side=v):w.renderBufferDirect(n,t,i,r,e,s),e.onAfterRender(w,t,n,i,r,s)}function et(e,t,n){!0!==t.isScene&&(t=K);const i=se.get(e),r=x.state.lights,s=x.state.shadowsArray,o=r.state.version,a=ue.getParameters(e,r.state,s,t,n),l=ue.getProgramCacheKey(a);let c=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=(e.isMeshStandardMaterial?le:ae).get(e.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===c&&(e.addEventListener("dispose",Fe),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===o)return it(e,a),h}else a.uniforms=ue.getUniforms(e),e.onBeforeCompile(a,w),h=ue.acquireProgram(a,l),c.set(l,h),i.uniforms=a.uniforms;const d=i.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(d.clippingPlanes=me.uniform),it(e,a),i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=o,i.needsLights&&(d.ambientLightColor.value=r.state.ambient,d.lightProbe.value=r.state.probe,d.directionalLights.value=r.state.directional,d.directionalLightShadows.value=r.state.directionalShadow,d.spotLights.value=r.state.spot,d.spotLightShadows.value=r.state.spotShadow,d.rectAreaLights.value=r.state.rectArea,d.ltc_1.value=r.state.rectAreaLTC1,d.ltc_2.value=r.state.rectAreaLTC2,d.pointLights.value=r.state.point,d.pointLightShadows.value=r.state.pointShadow,d.hemisphereLights.value=r.state.hemi,d.directionalShadowMap.value=r.state.directionalShadowMap,d.directionalShadowMatrix.value=r.state.directionalShadowMatrix,d.spotShadowMap.value=r.state.spotShadowMap,d.spotLightMatrix.value=r.state.spotLightMatrix,d.spotLightMap.value=r.state.spotLightMap,d.pointShadowMap.value=r.state.pointShadowMap,d.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=h,i.uniformsList=null,h}function nt(e){if(null===e.uniformsList){const t=e.currentProgram.getUniforms();e.uniformsList=cA.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function it(e,t){const n=se.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping,n.numMultiviewViews=t.numMultiviewViews}var rt;We.setAnimationLoop((function(e){He&&He(e)})),"undefined"!=typeof self&&We.setContext(self),this.setAnimationLoop=function(e){He=e,Te.setAnimationLoop(e),null===e?We.stop():We.start()},Te.addEventListener("sessionstart",Ve),Te.addEventListener("sessionend",je),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===_)return;if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===Te.enabled&&!0===Te.isPresenting&&(!0===Te.cameraAutoUpdate&&Te.updateCamera(t),t=Te.getCamera()),!0===e.isScene&&e.onBeforeRender(w,e,t,I),x=fe.get(e,C.length),x.init(t),C.push(x),X.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),V.setFromProjectionMatrix(X),W=this.localClippingEnabled,j=me.init(this.clippingPlanes,W),E=Ae.get(e,b.length),E.init(),b.push(E),!0===Te.enabled&&!0===Te.isPresenting){const e=w.xr.getDepthSensingMesh();null!==e&&qe(e,t,-1/0,w.sortObjects)}qe(e,t,0,w.sortObjects),E.finish(),!0===w.sortObjects&&E.sort(N,Q),Z=!1===Te.enabled||!1===Te.isPresenting||!1===Te.hasDepthSensing(),Z&&ye.addToRenderList(E,e),this.info.render.frame++,!0===j&&me.beginShadows();const n=x.state.shadowsArray;ge.render(n,e,t),!0===j&&me.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=E.opaque,r=E.transmissive;if(x.setupLights(),t.isArrayCamera){const n=t.cameras;if(r.length>0)for(let t=0,s=n.length;t<s;t++)Ye(i,r,e,n[t]);if(Z&&ye.render(e),Te.enabled&&Te.isMultiview)oe.setDeferTextureUploads(!0),Xe(E,e,t,t.cameras[0].viewport);else for(let t=0,i=n.length;t<i;t++){const i=n[t];Xe(E,e,i,i.viewport)}}else r.length>0&&Ye(i,r,e,t),Z&&ye.render(e),Xe(E,e,t);null!==I&&(oe.updateMultisampleRenderTarget(I),oe.updateRenderTargetMipmap(I)),!0===e.isScene&&e.onAfterRender(w,e,t),we.resetDefaultState(),B=-1,T=null,C.pop(),C.length>0?(x=C[C.length-1],!0===j&&me.setGlobalState(w.clippingPlanes,x.state.camera)):x=null,b.pop(),E=b.length>0?b[b.length-1]:null},this.setTexture2D=(rt=!1,function(e,t){e&&e.isWebGLRenderTarget&&(rt||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),rt=!0),e=e.texture),oe.setTexture2D(e,t)}),this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return I},this.setRenderTargetTextures=function(e,t,n){se.get(e.texture).__webglTexture=t,se.get(e.depthTexture).__webglTexture=n;const i=se.get(e);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||I&&I.isWebGLMultiviewRenderTarget||!0===ee.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(e,t){const n=se.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){I=e,M=t,S=n;let i=!0,r=null,s=!1,o=!1;if(e){const a=se.get(e);if(void 0!==a.__useDefaultFramebuffer)ie.bindFramebuffer(Me.FRAMEBUFFER,null),i=!1;else if(void 0===a.__webglFramebuffer)oe.setupRenderTarget(e);else if(a.__hasExternalTextures)oe.rebindTextures(e,se.get(e.texture).__webglTexture,se.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){const t=e.depthTexture;if(a.__boundDepthTexture!==t){if(null!==t&&se.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");oe.setupDepthRenderbuffer(e)}}const l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);const c=se.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],s=!0):r=e.samples>0&&!1===oe.useMultisampledRTT(e)?se.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,R.copy(e.viewport),L.copy(e.scissor),D=e.scissorTest}else R.copy(G).multiplyScalar(k).floor(),L.copy(z).multiplyScalar(k).floor(),D=H;if(ie.bindFramebuffer(Me.FRAMEBUFFER,r)&&i&&ie.drawBuffers(e,r),ie.viewport(R),ie.scissor(L),ie.setScissorTest(D),s){const i=se.get(e.texture);Me.framebufferTexture2D(Me.FRAMEBUFFER,Me.COLOR_ATTACHMENT0,Me.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(o){const i=se.get(e.texture),r=t||0;Me.framebufferTextureLayer(Me.FRAMEBUFFER,Me.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}B=-1},this.readRenderTargetPixels=function(e,t,n,i,r,s,o){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=se.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){ie.bindFramebuffer(Me.FRAMEBUFFER,a);try{const o=e.texture,a=o.format,l=o.type;if(!te.textureFormatReadable(a))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!te.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&Me.readPixels(t,n,i,r,Ce.convert(a),Ce.convert(l),s)}finally{const e=null!==I?se.get(I).__webglFramebuffer:null;ie.bindFramebuffer(Me.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,r,s,o){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=se.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){const o=e.texture,l=o.format,c=o.type;if(!te.textureFormatReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!te.textureTypeReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r){ie.bindFramebuffer(Me.FRAMEBUFFER,a);const e=Me.createBuffer();Me.bindBuffer(Me.PIXEL_PACK_BUFFER,e),Me.bufferData(Me.PIXEL_PACK_BUFFER,s.byteLength,Me.STREAM_READ),Me.readPixels(t,n,i,r,Ce.convert(l),Ce.convert(c),0);const o=null!==I?se.get(I).__webglFramebuffer:null;ie.bindFramebuffer(Me.FRAMEBUFFER,o);const h=Me.fenceSync(Me.SYNC_GPU_COMMANDS_COMPLETE,0);return Me.flush(),await function(e,t){return new Promise((function(n,i){setTimeout((function r(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(r,4);break;default:n()}}),4)}))}(Me,h),Me.bindBuffer(Me.PIXEL_PACK_BUFFER,e),Me.getBufferSubData(Me.PIXEL_PACK_BUFFER,0,s),Me.deleteBuffer(e),Me.deleteSync(h),s}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(e,t=null,n=0){!0!==e.isTexture&&(hi("WebGLRenderer: copyFramebufferToTexture function signature has changed."),t=arguments[0]||null,e=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),s=Math.floor(e.image.height*i),o=null!==t?t.x:0,a=null!==t?t.y:0;oe.setTexture2D(e,0),Me.copyTexSubImage2D(Me.TEXTURE_2D,n,0,0,o,a,r,s),ie.unbindTexture()};const st=Me.createFramebuffer(),ot=Me.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,i=null,r=0,s=null){let o,a,l,c,h,d,u,p,A;!0!==e.isTexture&&(hi("WebGLRenderer: copyTextureToTexture function signature has changed."),i=arguments[0]||null,e=arguments[1],t=arguments[2],s=arguments[3]||0,n=null),null===s&&(0!==r?(hi("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),s=r,r=0):s=0);const f=e.isCompressedTexture?e.mipmaps[s]:e.image;if(null!==n)o=n.max.x-n.min.x,a=n.max.y-n.min.y,l=n.isBox3?n.max.z-n.min.z:1,c=n.min.x,h=n.min.y,d=n.isBox3?n.min.z:0;else{const t=Math.pow(2,-r);o=Math.floor(f.width*t),a=Math.floor(f.height*t),l=e.isDataArrayTexture?f.depth:e.isData3DTexture?Math.floor(f.depth*t):1,c=0,h=0,d=0}null!==i?(u=i.x,p=i.y,A=i.z):(u=0,p=0,A=0);const m=Ce.convert(t.format),g=Ce.convert(t.type);let v;t.isData3DTexture?(oe.setTexture3D(t,0),v=Me.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(oe.setTexture2DArray(t,0),v=Me.TEXTURE_2D_ARRAY):(oe.setTexture2D(t,0),v=Me.TEXTURE_2D),Me.pixelStorei(Me.UNPACK_FLIP_Y_WEBGL,t.flipY),Me.pixelStorei(Me.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Me.pixelStorei(Me.UNPACK_ALIGNMENT,t.unpackAlignment);const y=Me.getParameter(Me.UNPACK_ROW_LENGTH),E=Me.getParameter(Me.UNPACK_IMAGE_HEIGHT),x=Me.getParameter(Me.UNPACK_SKIP_PIXELS),b=Me.getParameter(Me.UNPACK_SKIP_ROWS),C=Me.getParameter(Me.UNPACK_SKIP_IMAGES);Me.pixelStorei(Me.UNPACK_ROW_LENGTH,f.width),Me.pixelStorei(Me.UNPACK_IMAGE_HEIGHT,f.height),Me.pixelStorei(Me.UNPACK_SKIP_PIXELS,c),Me.pixelStorei(Me.UNPACK_SKIP_ROWS,h),Me.pixelStorei(Me.UNPACK_SKIP_IMAGES,d);const w=e.isDataArrayTexture||e.isData3DTexture,_=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){const n=se.get(e),i=se.get(t),f=se.get(n.__renderTarget),m=se.get(i.__renderTarget);ie.bindFramebuffer(Me.READ_FRAMEBUFFER,f.__webglFramebuffer),ie.bindFramebuffer(Me.DRAW_FRAMEBUFFER,m.__webglFramebuffer);for(let n=0;n<l;n++)w&&(Me.framebufferTextureLayer(Me.READ_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,se.get(e).__webglTexture,r,d+n),Me.framebufferTextureLayer(Me.DRAW_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,se.get(t).__webglTexture,s,A+n)),Me.blitFramebuffer(c,h,o,a,u,p,o,a,Me.DEPTH_BUFFER_BIT,Me.NEAREST);ie.bindFramebuffer(Me.READ_FRAMEBUFFER,null),ie.bindFramebuffer(Me.DRAW_FRAMEBUFFER,null)}else if(0!==r||e.isRenderTargetTexture||se.has(e)){const n=se.get(e),i=se.get(t);ie.bindFramebuffer(Me.READ_FRAMEBUFFER,st),ie.bindFramebuffer(Me.DRAW_FRAMEBUFFER,ot);for(let e=0;e<l;e++)w?Me.framebufferTextureLayer(Me.READ_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,n.__webglTexture,r,d+e):Me.framebufferTexture2D(Me.READ_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,Me.TEXTURE_2D,n.__webglTexture,r),_?Me.framebufferTextureLayer(Me.DRAW_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,i.__webglTexture,s,A+e):Me.framebufferTexture2D(Me.DRAW_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,Me.TEXTURE_2D,i.__webglTexture,s),0!==r?Me.blitFramebuffer(c,h,o,a,u,p,o,a,Me.COLOR_BUFFER_BIT,Me.NEAREST):_?Me.copyTexSubImage3D(v,s,u,p,A+e,c,h,o,a):Me.copyTexSubImage2D(v,s,u,p,c,h,o,a);ie.bindFramebuffer(Me.READ_FRAMEBUFFER,null),ie.bindFramebuffer(Me.DRAW_FRAMEBUFFER,null)}else _?e.isDataTexture||e.isData3DTexture?Me.texSubImage3D(v,s,u,p,A,o,a,l,m,g,f.data):t.isCompressedArrayTexture?Me.compressedTexSubImage3D(v,s,u,p,A,o,a,l,m,f.data):Me.texSubImage3D(v,s,u,p,A,o,a,l,m,g,f):e.isDataTexture?Me.texSubImage2D(Me.TEXTURE_2D,s,u,p,o,a,m,g,f.data):e.isCompressedTexture?Me.compressedTexSubImage2D(Me.TEXTURE_2D,s,u,p,f.width,f.height,m,f.data):Me.texSubImage2D(Me.TEXTURE_2D,s,u,p,o,a,m,g,f);Me.pixelStorei(Me.UNPACK_ROW_LENGTH,y),Me.pixelStorei(Me.UNPACK_IMAGE_HEIGHT,E),Me.pixelStorei(Me.UNPACK_SKIP_PIXELS,x),Me.pixelStorei(Me.UNPACK_SKIP_ROWS,b),Me.pixelStorei(Me.UNPACK_SKIP_IMAGES,C),0===s&&t.generateMipmaps&&Me.generateMipmap(v),ie.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n=null,i=null,r=0){return!0!==e.isTexture&&(hi("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,i=arguments[1]||null,e=arguments[2],t=arguments[3],r=arguments[4]||0),hi('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(e,t,n,i,r)},this.initRenderTarget=function(e){void 0===se.get(e).__webglFramebuffer&&oe.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?oe.setTextureCube(e,0):e.isData3DTexture?oe.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?oe.setTexture2DArray(e,0):oe.setTexture2D(e,0),ie.unbindTexture()},this.resetState=function(){M=0,S=0,I=null,ie.reset(),we.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Gn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorspace=Ai._getDrawingBufferColorSpace(e),t.unpackColorSpace=Ai._getUnpackColorSpace()}}const of=new WeakMap;function af(){let e,t;function n(e,t,n,i,r,s){const o=s.num_components(),a=n.num_points()*o,l=a*r.BYTES_PER_ELEMENT,c=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,r),h=e._malloc(l);t.GetAttributeDataArrayForAllPoints(n,s,c,l,h);const d=new r(e.HEAPF32.buffer,h,a).slice();return e._free(h),{name:i,array:d,itemSize:o}}onmessage=function(i){const r=i.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":const i=r.buffer,s=r.taskConfig;t.then((e=>{const t=e.draco,o=new t.Decoder;try{const e=function(e,t,i,r){const s=r.attributeIDs,o=r.attributeTypes;let a,l;const c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)a=new e.Mesh,l=t.DecodeArrayToMesh(i,i.byteLength,a);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,l=t.DecodeArrayToPointCloud(i,i.byteLength,a)}if(!l.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in s){const l=self[o[i]];let c,d;if(r.useUniqueIDs)d=s[i],c=t.GetAttributeByUniqueId(a,d);else{if(d=t.GetAttributeId(a,e[s[i]]),-1===d)continue;c=t.GetAttribute(a,d)}const u=n(e,t,a,i,l,c);"color"===i&&(u.vertexColorSpace=r.vertexColorSpace),h.attributes.push(u)}return c===e.TRIANGULAR_MESH&&(h.index=function(e,t,n){const i=3*n.num_faces(),r=4*i,s=e._malloc(r);t.GetTrianglesUInt32Array(n,r,s);const o=new Uint32Array(e.HEAPF32.buffer,s,i).slice();return e._free(s),{array:o,itemSize:1}}(e,t,a)),e.destroy(a),h}(t,o,new Int8Array(i),s),a=e.attributes.map((e=>e.array.buffer));e.index&&a.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},a)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(o)}}))}}}function lf(e,t,n=!0){if(!t||!t.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!e.hasAttribute("position")||!e.hasAttribute("normal")||!e.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function i(e){if(e.normalized||e.isInterleavedBufferAttribute){const t=new Float32Array(e.count*e.itemSize);for(let n=0,i=0;n<e.count;n++)t[i++]=e.getX(n),t[i++]=e.getY(n),e.itemSize>2&&(t[i++]=e.getZ(n));return t}return e.array instanceof Float32Array?e.array:new Float32Array(e.array)}const r=e.index?e.toNonIndexed():e,s=t.generateTangents(i(r.attributes.position),i(r.attributes.normal),i(r.attributes.uv));if(n)for(let e=3;e<s.length;e+=4)s[e]*=-1;return r.setAttribute("tangent",new us(s,4)),e!==r&&e.copy(r),e}function cf(e,t=!1){const n=null!==e[0].index,i=new Set(Object.keys(e[0].attributes)),r=new Set(Object.keys(e[0].morphAttributes)),s={},o={},a=e[0].morphTargetsRelative,l=new Bs;let c=0;for(let h=0;h<e.length;++h){const d=e[h];let u=0;if(n!==(null!==d.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const e in d.attributes){if(!i.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+e+'" attribute exists among all geometries, or in none of them.'),null;void 0===s[e]&&(s[e]=[]),s[e].push(d.attributes[e]),u++}if(u!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const e in d.morphAttributes){if(!r.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;void 0===o[e]&&(o[e]=[]),o[e].push(d.morphAttributes[e])}if(t){let e;if(n)e=d.index.count;else{if(void 0===d.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;e=d.attributes.position.count}l.addGroup(c,e,h),c+=e}}if(n){let t=0;const n=[];for(let i=0;i<e.length;++i){const r=e[i].index;for(let e=0;e<r.count;++e)n.push(r.getX(e)+t);t+=e[i].attributes.position.count}l.setIndex(n)}for(const e in s){const t=hf(s[e]);if(!t)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" attribute."),null;l.setAttribute(e,t)}for(const e in o){const t=o[e][0].length;if(0===t)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[e]=[];for(let n=0;n<t;++n){const t=[];for(let i=0;i<o[e].length;++i)t.push(o[e][i][n]);const i=hf(t);if(!i)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" morphAttribute."),null;l.morphAttributes[e].push(i)}}return l}function hf(e){let t,n,i,r=-1,s=0;for(let o=0;o<e.length;++o){const a=e[o];if(void 0===t&&(t=a.array.constructor),t!==a.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===n&&(n=a.itemSize),n!==a.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===i&&(i=a.normalized),i!==a.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===r&&(r=a.gpuType),r!==a.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=a.count*n}const o=new t(s),a=new us(o,n,i);let l=0;for(let t=0;t<e.length;++t){const i=e[t];if(i.isInterleavedBufferAttribute){const e=l/n;for(let t=0,r=i.count;t<r;t++)for(let r=0;r<n;r++){const n=i.getComponent(t,r);a.setComponent(t+e,r,n)}}else o.set(i.array,l);l+=i.count*n}return void 0!==r&&(a.gpuType=r),a}function df(e){return e.isInstancedInterleavedBufferAttribute||e.isInterleavedBufferAttribute?pf(e):e.isInstancedBufferAttribute?(new jo).copy(e):(new us).copy(e)}function uf(e){let t,n=0,i=0;for(let r=0,s=e.length;r<s;++r){const s=e[r];if(void 0===t&&(t=s.array.constructor),t!==s.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;n+=s.array.length,i+=s.itemSize}const r=new ao(new t(n),i);let s=0;const o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let t=0,n=e.length;t<n;t++){const n=e[t],i=n.itemSize,c=n.count,h=new co(r,i,s,n.normalized);o.push(h),s+=i;for(let e=0;e<c;e++)for(let t=0;t<i;t++)h[l[t]](e,n[a[t]](e))}return o}function pf(e){const t=e.data.array.constructor,n=e.count,i=e.itemSize,r=e.normalized,s=new t(n*i);let o;o=e.isInstancedInterleavedBufferAttribute?new jo(s,i,r,e.meshPerAttribute):new us(s,i,r);for(let t=0;t<n;t++)o.setX(t,e.getX(t)),i>=2&&o.setY(t,e.getY(t)),i>=3&&o.setZ(t,e.getZ(t)),i>=4&&o.setW(t,e.getW(t));return o}function Af(e){const t=e.attributes,n=e.morphTargets,i=new Map;for(const e in t){const n=t[e];n.isInterleavedBufferAttribute&&(i.has(n)||i.set(n,pf(n)),t[e]=i.get(n))}for(const e in n){const t=n[e];t.isInterleavedBufferAttribute&&(i.has(t)||i.set(t,pf(t)),n[e]=i.get(t))}}function ff(e){let t=0;for(const n in e.attributes){const i=e.getAttribute(n);t+=i.count*i.itemSize*i.array.BYTES_PER_ELEMENT}const n=e.getIndex();return t+=n?n.count*n.itemSize*n.array.BYTES_PER_ELEMENT:0,t}function mf(e,t=1e-4){t=Math.max(t,Number.EPSILON);const n={},i=e.getIndex(),r=e.getAttribute("position"),s=i?i.count:r.count;let o=0;const a=Object.keys(e.attributes),l={},c={},h=[],d=["getX","getY","getZ","getW"],u=["setX","setY","setZ","setW"];for(let t=0,n=a.length;t<n;t++){const n=a[t],i=e.attributes[n];l[n]=new i.constructor(new i.array.constructor(i.count*i.itemSize),i.itemSize,i.normalized);const r=e.morphAttributes[n];r&&(c[n]||(c[n]=[]),r.forEach(((e,t)=>{const i=new e.array.constructor(e.count*e.itemSize);c[n][t]=new e.constructor(i,e.itemSize,e.normalized)})))}const p=.5*t,A=Math.log10(1/t),f=Math.pow(10,A),m=p*f;for(let t=0;t<s;t++){const r=i?i.getX(t):t;let s="";for(let t=0,n=a.length;t<n;t++){const n=a[t],i=e.getAttribute(n),o=i.itemSize;for(let e=0;e<o;e++)s+=~~(i[d[e]](r)*f+m)+","}if(s in n)h.push(n[s]);else{for(let t=0,n=a.length;t<n;t++){const n=a[t],i=e.getAttribute(n),s=e.morphAttributes[n],h=i.itemSize,p=l[n],A=c[n];for(let e=0;e<h;e++){const t=d[e],n=u[e];if(p[n](o,i[t](r)),s)for(let e=0,i=s.length;e<i;e++)A[e][n](o,s[e][t](r))}}n[s]=o,h.push(o),o++}}const g=e.clone();for(const t in e.attributes){const e=l[t];if(g.setAttribute(t,new e.constructor(e.array.slice(0,o*e.itemSize),e.itemSize,e.normalized)),t in c)for(let e=0;e<c[t].length;e++){const n=c[t][e];g.morphAttributes[t][e]=new n.constructor(n.array.slice(0,o*n.itemSize),n.itemSize,n.normalized)}}return g.setIndex(h),g}function gf(e,t){if(t===jt)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===qt||t===Wt){let n=e.getIndex();if(null===n){const t=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<i.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}const i=n.count-2,r=[];if(t===qt)for(let e=1;e<=i;e++)r.push(n.getX(0)),r.push(n.getX(e)),r.push(n.getX(e+1));else for(let e=0;e<i;e++)e%2==0?(r.push(n.getX(e)),r.push(n.getX(e+1)),r.push(n.getX(e+2))):(r.push(n.getX(e+2)),r.push(n.getX(e+1)),r.push(n.getX(e)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=e.clone();return s.setIndex(r),s.clearGroups(),s}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}function vf(e){const t=new Li,n=new Li,i=new Li,r=new Li,s=new Li,o=new Li,a=new Li,l=new Li,c=new Li;function h(e,h,d,u,p,A,f,m){t.fromBufferAttribute(h,p),n.fromBufferAttribute(h,A),i.fromBufferAttribute(h,f);const g=e.morphTargetInfluences;if(d&&g){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let e=0,h=d.length;e<h;e++){const h=g[e],m=d[e];0!==h&&(r.fromBufferAttribute(m,p),s.fromBufferAttribute(m,A),o.fromBufferAttribute(m,f),u?(a.addScaledVector(r,h),l.addScaledVector(s,h),c.addScaledVector(o,h)):(a.addScaledVector(r.sub(t),h),l.addScaledVector(s.sub(n),h),c.addScaledVector(o.sub(i),h)))}t.add(a),n.add(l),i.add(c)}e.isSkinnedMesh&&(e.applyBoneTransform(p,t),e.applyBoneTransform(A,n),e.applyBoneTransform(f,i)),m[3*p+0]=t.x,m[3*p+1]=t.y,m[3*p+2]=t.z,m[3*A+0]=n.x,m[3*A+1]=n.y,m[3*A+2]=n.z,m[3*f+0]=i.x,m[3*f+1]=i.y,m[3*f+2]=i.z}const d=e.geometry,u=e.material;let p,A,f;const m=d.index,g=d.attributes.position,v=d.morphAttributes.position,y=d.morphTargetsRelative,E=d.attributes.normal,x=d.morphAttributes.position,b=d.groups,C=d.drawRange;let w,_,M,S,I,B,T;const R=new Float32Array(g.count*g.itemSize),L=new Float32Array(E.count*E.itemSize);if(null!==m)if(Array.isArray(u))for(w=0,M=b.length;w<M;w++)for(I=b[w],B=Math.max(I.start,C.start),T=Math.min(I.start+I.count,C.start+C.count),_=B,S=T;_<S;_+=3)p=m.getX(_),A=m.getX(_+1),f=m.getX(_+2),h(e,g,v,y,p,A,f,R),h(e,E,x,y,p,A,f,L);else for(B=Math.max(0,C.start),T=Math.min(m.count,C.start+C.count),w=B,M=T;w<M;w+=3)p=m.getX(w),A=m.getX(w+1),f=m.getX(w+2),h(e,g,v,y,p,A,f,R),h(e,E,x,y,p,A,f,L);else if(Array.isArray(u))for(w=0,M=b.length;w<M;w++)for(I=b[w],B=Math.max(I.start,C.start),T=Math.min(I.start+I.count,C.start+C.count),_=B,S=T;_<S;_+=3)p=_,A=_+1,f=_+2,h(e,g,v,y,p,A,f,R),h(e,E,x,y,p,A,f,L);else for(B=Math.max(0,C.start),T=Math.min(g.count,C.start+C.count),w=B,M=T;w<M;w+=3)p=w,A=w+1,f=w+2,h(e,g,v,y,p,A,f,R),h(e,E,x,y,p,A,f,L);return{positionAttribute:g,normalAttribute:E,morphedPositionAttribute:new xs(R,3),morphedNormalAttribute:new xs(L,3)}}function yf(e){if(0===e.groups.length)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),e;let t=e.groups;if(t=t.sort(((e,t)=>e.materialIndex!==t.materialIndex?e.materialIndex-t.materialIndex:e.start-t.start)),null===e.getIndex()){const t=e.getAttribute("position"),n=[];for(let e=0;e<t.count;e+=3)n.push(e,e+1,e+2);e.setIndex(n)}const n=e.getIndex(),i=[];for(let e=0;e<t.length;e++){const r=t[e],s=r.start,o=s+r.count;for(let e=s;e<o;e++)i.push(n.getX(e))}e.dispose(),e.setIndex(i);let r=0;for(let e=0;e<t.length;e++){const n=t[e];n.start=r,r+=n.count}let s=t[0];e.groups=[s];for(let n=1;n<t.length;n++){const i=t[n];s.materialIndex===i.materialIndex?s.count+=i.count:(s=i,e.groups.push(s))}return e}function Ef(e,t=Math.PI/3){const n=Math.cos(t),i=100*(1+1e-10),r=[new Li,new Li,new Li],s=new Li,o=new Li,a=new Li,l=new Li;function c(e){return`${~~(e.x*i)},${~~(e.y*i)},${~~(e.z*i)}`}const h=e.index?e.toNonIndexed():e,d=h.attributes.position,u={};for(let e=0,t=d.count/3;e<t;e++){const t=3*e,n=r[0].fromBufferAttribute(d,t+0),i=r[1].fromBufferAttribute(d,t+1),a=r[2].fromBufferAttribute(d,t+2);s.subVectors(a,i),o.subVectors(n,i);const l=(new Li).crossVectors(s,o).normalize();for(let e=0;e<3;e++){const t=c(r[e]);t in u||(u[t]=[]),u[t].push(l)}}const p=new Float32Array(3*d.count),A=new us(p,3,!1);for(let e=0,t=d.count/3;e<t;e++){const t=3*e,i=r[0].fromBufferAttribute(d,t+0),h=r[1].fromBufferAttribute(d,t+1),p=r[2].fromBufferAttribute(d,t+2);s.subVectors(p,h),o.subVectors(i,h),a.crossVectors(s,o).normalize();for(let e=0;e<3;e++){const i=u[c(r[e])];l.set(0,0,0);for(let e=0,t=i.length;e<t;e++){const t=i[e];a.dot(t)>n&&l.add(t)}l.normalize(),A.setXYZ(t+e,l.x,l.y,l.z)}}return h.setAttribute("normal",A),h}function xf(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const bf="KHR_binary_glTF",Cf="KHR_draco_mesh_compression",wf="KHR_lights_punctual",_f="KHR_materials_clearcoat",Mf="KHR_materials_dispersion",Sf="KHR_materials_ior",If="KHR_materials_sheen",Bf="KHR_materials_specular",Tf="KHR_materials_transmission",Rf="KHR_materials_iridescence",Lf="KHR_materials_anisotropy",Df="KHR_materials_unlit",Pf="KHR_materials_volume",Uf="KHR_texture_basisu",Of="KHR_texture_transform",Ff="KHR_mesh_quantization",kf="KHR_materials_emissive_strength",Nf="EXT_materials_bump",Qf="EXT_texture_webp",Gf="EXT_texture_avif",zf="EXT_meshopt_compression",Hf="EXT_mesh_gpu_instancing";class Vf{constructor(e){this.parser=e,this.name=wf,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const r=t.json,s=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let o;const a=new es(16777215);void 0!==s.color&&a.setRGB(s.color[0],s.color[1],s.color[2],nn);const l=void 0!==s.range?s.range:0;switch(s.type){case"directional":o=new Bh(a),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new Mh(a),o.distance=l;break;case"spot":o=new xh(a),o.distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,o.angle=s.spot.outerConeAngle,o.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return o.position.set(0,0,0),o.decay=2,_m(o,s),void 0!==s.intensity&&(o.intensity=s.intensity),o.name=t.createUniqueName(s.name||"light_"+e),i=Promise.resolve(o),t.cache.add(n,i),i}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,i=n.json.nodes[e],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(e){return n._getNodeRef(t.cache,r,e)}))}}class jf{constructor(){this.name=Df}getMaterialType(){return rs}extendParams(e,t,n){const i=[];e.color=new es(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const t=r.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],nn),e.opacity=t[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture,tn))}return Promise.all(i)}}class Wf{constructor(e){this.parser=e,this.name=kf}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return void 0!==i&&(t.emissiveIntensity=i),Promise.resolve()}}class qf{constructor(e){this.parser=e,this.name=_f}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];if(void 0!==s.clearcoatFactor&&(t.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&r.push(n.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(r.push(n.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){const e=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new ti(e,e)}return Promise.all(r)}}class Xf{constructor(e){this.parser=e,this.name=Mf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class Yf{constructor(e){this.parser=e,this.name=Rf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.iridescenceFactor&&(t.iridescence=s.iridescenceFactor),void 0!==s.iridescenceTexture&&r.push(n.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),void 0!==s.iridescenceIor&&(t.iridescenceIOR=s.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==s.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),void 0!==s.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),void 0!==s.iridescenceThicknessTexture&&r.push(n.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class Jf{constructor(e){this.parser=e,this.name=If}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new es(0,0,0),t.sheenRoughness=0,t.sheen=1;const s=i.extensions[this.name];if(void 0!==s.sheenColorFactor){const e=s.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],nn)}return void 0!==s.sheenRoughnessFactor&&(t.sheenRoughness=s.sheenRoughnessFactor),void 0!==s.sheenColorTexture&&r.push(n.assignTexture(t,"sheenColorMap",s.sheenColorTexture,tn)),void 0!==s.sheenRoughnessTexture&&r.push(n.assignTexture(t,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(r)}}class Kf{constructor(e){this.parser=e,this.name=Tf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.transmissionFactor&&(t.transmission=s.transmissionFactor),void 0!==s.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class Zf{constructor(e){this.parser=e,this.name=Pf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];t.thickness=void 0!==s.thicknessFactor?s.thicknessFactor:0,void 0!==s.thicknessTexture&&r.push(n.assignTexture(t,"thicknessMap",s.thicknessTexture)),t.attenuationDistance=s.attenuationDistance||1/0;const o=s.attenuationColor||[1,1,1];return t.attenuationColor=(new es).setRGB(o[0],o[1],o[2],nn),Promise.all(r)}}class $f{constructor(e){this.parser=e,this.name=Sf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class em{constructor(e){this.parser=e,this.name=Bf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];t.specularIntensity=void 0!==s.specularFactor?s.specularFactor:1,void 0!==s.specularTexture&&r.push(n.assignTexture(t,"specularIntensityMap",s.specularTexture));const o=s.specularColorFactor||[1,1,1];return t.specularColor=(new es).setRGB(o[0],o[1],o[2],nn),void 0!==s.specularColorTexture&&r.push(n.assignTexture(t,"specularColorMap",s.specularColorTexture,tn)),Promise.all(r)}}class tm{constructor(e){this.parser=e,this.name=Nf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return t.bumpScale=void 0!==s.bumpFactor?s.bumpFactor:1,void 0!==s.bumpTexture&&r.push(n.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(r)}}class nm{constructor(e){this.parser=e,this.name=Lf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.anisotropyStrength&&(t.anisotropy=s.anisotropyStrength),void 0!==s.anisotropyRotation&&(t.anisotropyRotation=s.anisotropyRotation),void 0!==s.anisotropyTexture&&r.push(n.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class im{constructor(e){this.parser=e,this.name=Uf}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],s=t.options.ktx2Loader;if(!s){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,s)}}class rm{constructor(e){this.parser=e,this.name=Qf,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const s=r.extensions[t],o=i.images[s.source];let a=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(a=e)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(e,s.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class sm{constructor(e){this.parser=e,this.name=Gf,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const s=r.extensions[t],o=i.images[s.source];let a=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(a=e)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(e,s.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class om{constructor(e){this.name=zf,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(t){const n=e.byteOffset||0,i=e.byteLength||0,s=e.count,o=e.byteStride,a=new Uint8Array(t,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(s,o,a,e.mode,e.filter).then((function(e){return e.buffer})):r.ready.then((function(){const t=new ArrayBuffer(s*o);return r.decodeGltfBuffer(new Uint8Array(t),s,o,a,e.mode,e.filter),t}))}))}return null}}class am{constructor(e){this.name=Hf,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=t.meshes[n.mesh];for(const e of i.primitives)if(e.mode!==mm.TRIANGLES&&e.mode!==mm.TRIANGLE_STRIP&&e.mode!==mm.TRIANGLE_FAN&&void 0!==e.mode)return null;const r=n.extensions[this.name].attributes,s=[],o={};for(const e in r)s.push(this.parser.getDependency("accessor",r[e]).then((t=>(o[e]=t,o[e]))));return s.length<1?null:(s.push(this.parser.createNodeMesh(e)),Promise.all(s).then((e=>{const t=e.pop(),n=t.isGroup?t.children:[t],i=e[0].count,r=[];for(const e of n){const t=new lr,n=new Li,s=new Ri,a=new Li(1,1,1),l=new $o(e.geometry,e.material,i);for(let e=0;e<i;e++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&s.fromBufferAttribute(o.ROTATION,e),o.SCALE&&a.fromBufferAttribute(o.SCALE,e),l.setMatrixAt(e,t.compose(n,s,a));for(const t in o)if("_COLOR_0"===t){const e=o[t];l.instanceColor=new jo(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,o[t]);Ur.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),r.push(l)}return t.isGroup?(t.clear(),t.add(...r),t):r[0]})))}}const lm="glTF";class cm{constructor(e){this.name=bf,this.content=null,this.body=null;const t=new DataView(e,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==lm)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,r=new DataView(e,12);let s=0;for(;s<i;){const t=r.getUint32(s,!0);s+=4;const i=r.getUint32(s,!0);if(s+=4,1313821514===i){const i=new Uint8Array(e,12+s,t);this.content=n.decode(i)}else if(5130562===i){const n=12+s;this.body=e.slice(n,n+t)}s+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class hm{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Cf,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,o={},a={},l={};for(const e in s){const t=xm[e]||e.toLowerCase();o[t]=s[e]}for(const t in e.attributes){const i=xm[t]||t.toLowerCase();if(void 0!==s[t]){const r=n.accessors[e.attributes[t]],s=gm[r.componentType];l[i]=s.name,a[i]=!0===r.normalized}}return t.getDependency("bufferView",r).then((function(e){return new Promise((function(t,n){i.decodeDracoFile(e,(function(e){for(const t in e.attributes){const n=e.attributes[t],i=a[t];void 0!==i&&(n.normalized=i)}t(e)}),o,l,nn,n)}))}))}}class dm{constructor(){this.name=Of}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class um{constructor(){this.name=Ff}}class pm extends Gc{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let e=0;e!==i;e++)t[e]=n[r+e];return t}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=2*o,l=3*o,c=i-t,h=(n-t)/c,d=h*h,u=d*h,p=e*l,A=p-l,f=-2*u+3*d,m=u-d,g=1-f,v=m-d+h;for(let e=0;e!==o;e++){const t=s[A+e+o],n=s[A+e+a]*c,i=s[p+e+o],l=s[p+e]*c;r[e]=g*t+v*n+f*i+m*l}return r}}const Am=new Ri;class fm extends pm{interpolate_(e,t,n,i){const r=super.interpolate_(e,t,n,i);return Am.fromArray(r).normalize().toArray(r),r}}const mm={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},gm={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},vm={9728:xe,9729:Me,9984:be,9985:Se,9986:we,9987:Be},ym={33071:ye,33648:Ee,10497:ve},Em={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},xm={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},bm={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Cm={CUBICSPLINE:void 0,LINEAR:kt,STEP:Ft};function wm(e,t,n){for(const i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function _m(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Mm(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){const n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,i=n.length;t<i;t++)e.morphTargetDictionary[n[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Sm(e){let t;const n=e.extensions&&e.extensions[Cf];if(t=n?"draco:"+n.bufferView+":"+n.indices+":"+Im(n.attributes):e.indices+":"+Im(e.attributes)+":"+e.mode,void 0!==e.targets)for(let n=0,i=e.targets.length;n<i;n++)t+=":"+Im(e.targets[n]);return t}function Im(e){let t="";const n=Object.keys(e).sort();for(let i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function Bm(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const Tm=new lr;class Rm{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new xf,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,s=-1;if("undefined"!=typeof navigator){const e=navigator.userAgent;n=!0===/^((?!chrome|android).)*safari/i.test(e);const t=e.match(/Version\/(\d+)/);i=n&&t?parseInt(t[1],10):-1,r=e.indexOf("Firefox")>-1,s=r?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||n&&i<17||r&&s<98?this.textureLoader=new ph(this.options.manager):this.textureLoader=new zh(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ah(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){const s={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};return wm(r,s,i),_m(s,i),Promise.all(n._invokeAll((function(e){return e.afterRoot&&e.afterRoot(s)}))).then((function(){for(const e of s.scenes)e.updateMatrixWorld();e(s)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n].joints;for(let t=0,n=i.length;t<n;t++)e[i[t]].isBone=!0}for(let t=0,i=e.length;t<i;t++){const i=e[t];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(n[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),r=(e,t)=>{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[n,i]of e.children.entries())r(i,t.children[n])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":i=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":i=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne((function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)})),!i)throw new Error("Unknown type: "+e)}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map((function(t,i){return n.getDependency(e,i)}))),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[bf].body);const i=this.options;return new Promise((function(e,r){n.load(Uh.resolveURL(t.uri,i.path),e,void 0,(function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){const n=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+n)}))}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse){const e=Em[i.type],t=gm[i.componentType],n=!0===i.normalized,r=new t(i.count*e);return Promise.resolve(new us(r,e,n))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then((function(e){const r=e[0],s=Em[i.type],o=gm[i.componentType],a=o.BYTES_PER_ELEMENT,l=a*s,c=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized;let u,p;if(h&&h!==l){const e=Math.floor(c/h),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+e+":"+i.count;let l=t.cache.get(n);l||(u=new o(r,e*h,i.count*h/a),l=new ao(u,h/a),t.cache.add(n,l)),p=new co(l,s,c%h/a,d)}else u=null===r?new o(i.count*s):new o(r,c,i.count*s),p=new us(u,s,d);if(void 0!==i.sparse){const t=Em.SCALAR,n=gm[i.sparse.indices.componentType],a=i.sparse.indices.byteOffset||0,l=i.sparse.values.byteOffset||0,c=new n(e[1],a,i.sparse.count*t),h=new o(e[2],l,i.sparse.count*s);null!==r&&(p=new us(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let e=0,t=c.length;e<t;e++){const t=c[e];if(p.setX(t,h[e*s]),s>=2&&p.setY(t,h[e*s+1]),s>=3&&p.setZ(t,h[e*s+2]),s>=4&&p.setW(t,h[e*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}p.normalized=d}return p}))}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,r=t.images[i];let s=this.textureLoader;if(r.uri){const e=n.manager.getHandler(r.uri);null!==e&&(s=e)}return this.loadTextureImage(e,i,s)}loadTextureImage(e,t,n){const i=this,r=this.json,s=r.textures[e],o=r.images[t],a=(o.uri||o.bufferView)+":"+s.sampler;if(this.textureCache[a])return this.textureCache[a];const l=this.loadImageSource(t,n).then((function(t){t.flipY=!1,t.name=s.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);const n=(r.samplers||{})[s.sampler]||{};return t.magFilter=vm[n.magFilter]||Me,t.minFilter=vm[n.minFilter]||Be,t.wrapS=ym[n.wrapS]||ve,t.wrapT=ym[n.wrapT]||ve,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==xe&&t.minFilter!==Me,i.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[a]=l,l}loadImageSource(e,t){const n=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const r=n.images[e],s=self.URL||self.webkitURL;let o=r.uri||"",a=!1;if(void 0!==r.bufferView)o=this.getDependency("bufferView",r.bufferView).then((function(e){a=!0;const t=new Blob([e],{type:r.mimeType});return o=s.createObjectURL(t),o}));else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const l=Promise.resolve(o).then((function(e){return new Promise((function(n,r){let s=n;!0===t.isImageBitmapLoader&&(s=function(e){const t=new Ci(e);t.needsUpdate=!0,n(t)}),t.load(Uh.resolveURL(e,i.path),s,void 0,r)}))})).then((function(e){var t;return!0===a&&s.revokeObjectURL(o),_m(e,r),e.userData.mimeType=r.mimeType||((t=r.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":t.search(/\.ktx2($|\?)/i)>0||0===t.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e}));return this.sourceCache[e]=l,l}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then((function(s){if(!s)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((s=s.clone()).channel=n.texCoord),r.extensions[Of]){const e=void 0!==n.extensions?n.extensions[Of]:void 0;if(e){const t=r.associations.get(s);s=r.extensions[Of].extendTexture(s,e),r.associations.set(s,t)}}return void 0!==i&&(s.colorSpace=i),e[t]=s,s}))}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=void 0===t.attributes.tangent,r=void 0!==t.attributes.color,s=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new Na,is.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new _a,is.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(i||r||s){let e="ClonedMaterial:"+n.uuid+":";i&&(e+="derivative-tangents:"),r&&(e+="vertex-colors:"),s&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),r&&(t.vertexColors=!0),s&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return _c}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let s;const o={},a=[];if((r.extensions||{})[Df]){const e=i[Df];s=e.getMaterialType(),a.push(e.extendParams(o,r,t))}else{const n=r.pbrMetallicRoughness||{};if(o.color=new es(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],nn),o.opacity=e[3]}void 0!==n.baseColorTexture&&a.push(t.assignTexture(o,"map",n.baseColorTexture,tn)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(a.push(t.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),a.push(t.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),s=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),a.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)}))))}!0===r.doubleSided&&(o.side=v);const l=r.alphaMode||"OPAQUE";if("BLEND"===l?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,"MASK"===l&&(o.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&s!==rs&&(a.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new ti(1,1),void 0!==r.normalTexture.scale)){const e=r.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==r.occlusionTexture&&s!==rs&&(a.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(o.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&s!==rs){const e=r.emissiveFactor;o.emissive=(new es).setRGB(e[0],e[1],e[2],nn)}return void 0!==r.emissiveTexture&&s!==rs&&a.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,tn)),Promise.all(a).then((function(){const n=new s(o);return r.name&&(n.name=r.name),_m(n,r),t.associations.set(n,{materials:e}),r.extensions&&wm(i,n,r),n}))}createUniqueName(e){const t=vd.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(e){return n[Cf].decodePrimitive(e,t).then((function(n){return Lm(n,e,t)}))}const s=[];for(let n=0,o=e.length;n<o;n++){const o=e[n],a=Sm(o),l=i[a];if(l)s.push(l.promise);else{let e;e=o.extensions&&o.extensions[Cf]?r(o):Lm(new Bs,o,t),i[a]={primitive:o,promise:e},s.push(e)}}return Promise.all(s)}loadMesh(e){const t=this,n=this.json,i=this.extensions,r=n.meshes[e],s=r.primitives,o=[];for(let e=0,t=s.length;e<t;e++){const t=void 0===s[e].material?(void 0===(a=this.cache).DefaultMaterial&&(a.DefaultMaterial=new _c({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:m})),a.DefaultMaterial):this.getDependency("material",s[e].material);o.push(t)}var a;return o.push(t.loadGeometries(s)),Promise.all(o).then((function(n){const o=n.slice(0,n.length-1),a=n[n.length-1],l=[];for(let n=0,c=a.length;n<c;n++){const c=a[n],h=s[n];let d;const u=o[n];if(h.mode===mm.TRIANGLES||h.mode===mm.TRIANGLE_STRIP||h.mode===mm.TRIANGLE_FAN||void 0===h.mode)d=!0===r.isSkinnedMesh?new No(c,u):new Gs(c,u),!0===d.isSkinnedMesh&&d.normalizeSkinWeights(),h.mode===mm.TRIANGLE_STRIP?d.geometry=gf(d.geometry,Wt):h.mode===mm.TRIANGLE_FAN&&(d.geometry=gf(d.geometry,qt));else if(h.mode===mm.LINES)d=new Fa(c,u);else if(h.mode===mm.LINE_STRIP)d=new Da(c,u);else if(h.mode===mm.LINE_LOOP)d=new ka(c,u);else{if(h.mode!==mm.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);d=new Va(c,u)}Object.keys(d.geometry.morphAttributes).length>0&&Mm(d,r),d.name=t.createUniqueName(r.name||"mesh_"+e),_m(d,r),h.extensions&&wm(i,d,h),t.assignFinalMaterial(d),l.push(d)}for(let n=0,i=l.length;n<i;n++)t.associations.set(l[n],{meshes:e,primitives:n});if(1===l.length)return r.extensions&&wm(i,l[0],r),l[0];const c=new Wa;r.extensions&&wm(i,c,r),t.associations.set(c,{meshes:e});for(let e=0,t=l.length;e<t;e++)c.add(l[e]);return c}))}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(i)return"perspective"===n.type?t=new $s(ei.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(t=new Sh(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),_m(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],n=[];for(let e=0,i=t.joints.length;e<i;e++)n.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then((function(e){const n=e.pop(),i=e,r=[],s=[];for(let e=0,o=i.length;e<o;e++){const o=i[e];if(o){r.push(o);const t=new lr;null!==n&&t.fromArray(n.array,16*e),s.push(t)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new Vo(r,s)}))}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,s=[],o=[],a=[],l=[],c=[];for(let e=0,t=i.channels.length;e<t;e++){const t=i.channels[e],n=i.samplers[t.sampler],r=t.target,h=r.node,d=void 0!==i.parameters?i.parameters[n.input]:n.input,u=void 0!==i.parameters?i.parameters[n.output]:n.output;void 0!==r.node&&(s.push(this.getDependency("node",h)),o.push(this.getDependency("accessor",d)),a.push(this.getDependency("accessor",u)),l.push(n),c.push(r))}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(a),Promise.all(l),Promise.all(c)]).then((function(e){const t=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=[];for(let e=0,r=t.length;e<r;e++){const r=t[e],c=i[e],h=s[e],d=o[e],u=a[e];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();const p=n._createAnimationTracks(r,c,h,d,u);if(p)for(let e=0;e<p.length;e++)l.push(p[e])}return new $c(r,void 0,l)}))}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return void 0===i.mesh?null:n.getDependency("mesh",i.mesh).then((function(e){const t=n._getNodeRef(n.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,n=i.weights.length;t<n;t++)e.morphTargetInfluences[t]=i.weights[t]})),t}))}loadNode(e){const t=this,n=this.json.nodes[e],i=t._loadNodeShallow(e),r=[],s=n.children||[];for(let e=0,n=s.length;e<n;e++)r.push(t.getDependency("node",s[e]));const o=void 0===n.skin?Promise.resolve(null):t.getDependency("skin",n.skin);return Promise.all([i,Promise.all(r),o]).then((function(e){const t=e[0],n=e[1],i=e[2];null!==i&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(i,Tm)}));for(let e=0,i=n.length;e<i;e++)t.add(n[e]);return t}))}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const r=t.nodes[e],s=r.name?i.createUniqueName(r.name):"",o=[],a=i._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return a&&o.push(a),void 0!==r.camera&&o.push(i.getDependency("camera",r.camera).then((function(e){return i._getNodeRef(i.cameraCache,r.camera,e)}))),i._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){o.push(e)})),this.nodeCache[e]=Promise.all(o).then((function(t){let o;if(o=!0===r.isBone?new Qo:t.length>1?new Wa:1===t.length?t[0]:new Ur,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(r.name&&(o.userData.name=r.name,o.name=s),_m(o,r),r.extensions&&wm(n,o,r),void 0!==r.matrix){const e=new lr;e.fromArray(r.matrix),o.applyMatrix4(e)}else void 0!==r.translation&&o.position.fromArray(r.translation),void 0!==r.rotation&&o.quaternion.fromArray(r.rotation),void 0!==r.scale&&o.scale.fromArray(r.scale);return i.associations.has(o)||i.associations.set(o,{}),i.associations.get(o).nodes=e,o})),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,r=new Wa;n.name&&(r.name=i.createUniqueName(n.name)),_m(r,n),n.extensions&&wm(t,r,n);const s=n.nodes||[],o=[];for(let e=0,t=s.length;e<t;e++)o.push(i.getDependency("node",s[e]));return Promise.all(o).then((function(e){for(let t=0,n=e.length;t<n;t++)r.add(e[t]);return i.associations=(e=>{const t=new Map;for(const[e,n]of i.associations)(e instanceof is||e instanceof Ci)&&t.set(e,n);return e.traverse((e=>{const n=i.associations.get(e);null!=n&&t.set(e,n)})),t})(r),r}))}_createAnimationTracks(e,t,n,i,r){const s=[],o=e.name?e.name:e.uuid,a=[];let l;switch(bm[r.path]===bm.weights?e.traverse((function(e){e.morphTargetInfluences&&a.push(e.name?e.name:e.uuid)})):a.push(o),bm[r.path]){case bm.weights:l=Xc;break;case bm.rotation:l=Jc;break;case bm.position:case bm.scale:l=Zc;break;default:l=1===n.itemSize?Xc:Zc}const c=void 0!==i.interpolation?Cm[i.interpolation]:kt,h=this._getArrayFromAccessor(n);for(let e=0,n=a.length;e<n;e++){const n=new l(a[e]+"."+bm[r.path],t.array,h,c);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(n),s.push(n)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=Bm(t.constructor),n=new Float32Array(t.length);for(let i=0,r=t.length;i<r;i++)n[i]=t[i]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof Jc?fm:pm)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Lm(e,t,n){const i=t.attributes,r=[];function s(t,i){return n.getDependency("accessor",t).then((function(t){e.setAttribute(i,t)}))}for(const t in i){const n=xm[t]||t.toLowerCase();n in e.attributes||r.push(s(i[t],n))}if(void 0!==t.indices&&!e.index){const i=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));r.push(i)}return Ai.workingColorSpace!==nn&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ai.workingColorSpace}" not supported.`),_m(e,t),function(e,t,n){const i=t.attributes,r=new Ui;if(void 0===i.POSITION)return;{const e=n.json.accessors[i.POSITION],t=e.min,s=e.max;if(void 0===t||void 0===s)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new Li(t[0],t[1],t[2]),new Li(s[0],s[1],s[2])),e.normalized){const t=Bm(gm[e.componentType]);r.min.multiplyScalar(t),r.max.multiplyScalar(t)}}const s=t.targets;if(void 0!==s){const e=new Li,t=new Li;for(let i=0,r=s.length;i<r;i++){const r=s[i];if(void 0!==r.POSITION){const i=n.json.accessors[r.POSITION],s=i.min,o=i.max;if(void 0!==s&&void 0!==o){if(t.setX(Math.max(Math.abs(s[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(s[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(s[2]),Math.abs(o[2]))),i.normalized){const e=Bm(gm[i.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(e)}e.boundingBox=r;const o=new $i;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=o}(e,t,n),Promise.all(r).then((function(){return void 0!==t.targets?function(e,t,n){let i=!1,r=!1,s=!1;for(let e=0,n=t.length;e<n;e++){const n=t[e];if(void 0!==n.POSITION&&(i=!0),void 0!==n.NORMAL&&(r=!0),void 0!==n.COLOR_0&&(s=!0),i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(e);const o=[],a=[],l=[];for(let c=0,h=t.length;c<h;c++){const h=t[c];if(i){const t=void 0!==h.POSITION?n.getDependency("accessor",h.POSITION):e.attributes.position;o.push(t)}if(r){const t=void 0!==h.NORMAL?n.getDependency("accessor",h.NORMAL):e.attributes.normal;a.push(t)}if(s){const t=void 0!==h.COLOR_0?n.getDependency("accessor",h.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l)]).then((function(t){const n=t[0],o=t[1],a=t[2];return i&&(e.morphAttributes.position=n),r&&(e.morphAttributes.normal=o),s&&(e.morphAttributes.color=a),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}class Dm{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const n=this.workersResolve[e];if(n&&n(t),this.queue.length){const{resolve:t,msg:n,transfer:i}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(n,i)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise((n=>{const i=this._getIdleWorker();-1!==i?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=n,this.workers[i].postMessage(e,t)):this.queue.push({resolve:n,msg:e,transfer:t})}))}dispose(){this.workers.forEach((e=>e.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const Pm=9,Um=15,Om=16,Fm=22,km=37,Nm=43,Qm=76,Gm=83,zm=97,Hm=100,Vm=103,jm=109,Wm=165,qm=166,Xm=1000066e3;class Ym{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Jm{constructor(e,t,n,i){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,n),this._littleEndian=i,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t){void 0===t&&(t=0);const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}new Uint8Array([0]);const Km=[171,75,84,88,32,50,48,187,13,10,26,10];function Zm(e){return(new TextDecoder).decode(e)}var $m=n(9922).hp;let eg,tg,ng;const ig={env:{emscripten_notify_memory_growth:function(e){ng=new Uint8Array(tg.exports.memory.buffer)}}};class rg{init(){return eg||(eg="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+sg).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,ig))).then(this._init):WebAssembly.instantiate($m.from(sg,"base64"),ig).then(this._init),eg)}_init(e){tg=e.instance,ig.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!tg)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=e.byteLength,i=tg.exports.malloc(n);ng.set(e,i),t=t||Number(tg.exports.ZSTD_findDecompressedSize(i,n));const r=tg.exports.malloc(t),s=tg.exports.ZSTD_decompress(r,t,i,n),o=ng.slice(r,r+s);return tg.exports.free(i),tg.exports.free(r),o}}const sg="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",og=new WeakMap;let ag,lg=0;class cg extends rh{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new Dm,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const e=new ah(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),n=new ah(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,i]).then((([e,t])=>{const n=cg.BasisWorker.toString(),i=["/* constants */","let _EngineFormat = "+JSON.stringify(cg.EngineFormat),"let _EngineType = "+JSON.stringify(cg.EngineType),"let _TranscoderFormat = "+JSON.stringify(cg.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(cg.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i])),this.transcoderBinary=t,this.workerPool.setWorkerCreator((()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e}))})),lg>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),lg++}return this.transcoderPending}load(e,t,n,i){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new ah(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(e,(e=>{this.parse(e,t,i)}),n,i)}parse(e,t,n){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(og.has(e))return og.get(e).promise.then(t).catch(n);this._createTexture(e).then((e=>t?t(e):null)).catch(n)}_createTextureFrom(e,t){const{type:n,error:i,data:{faces:r,width:s,height:o,format:a,type:l,dfdFlags:c}}=e;if("error"===n)return Promise.reject(i);let h;if(6===t.faceCount)h=new Ka(r,a,l);else{const e=r[0].mipmaps;h=t.layerCount>1?new Ja(e,s,o,t.layerCount,a,l):new Ya(e,s,o,a,l)}return h.minFilter=1===r[0].mipmaps.length?Me:Be,h.magFilter=Me,h.generateMipmaps=!1,h.needsUpdate=!0,h.colorSpace=pg(t),h.premultiplyAlpha=!!(1&c),h}async _createTexture(e,t={}){const n=function(e){const t=new Uint8Array(e.buffer,e.byteOffset,Km.length);if(t[0]!==Km[0]||t[1]!==Km[1]||t[2]!==Km[2]||t[3]!==Km[3]||t[4]!==Km[4]||t[5]!==Km[5]||t[6]!==Km[6]||t[7]!==Km[7]||t[8]!==Km[8]||t[9]!==Km[9]||t[10]!==Km[10]||t[11]!==Km[11])throw new Error("Missing KTX 2.0 identifier.");const n=new Ym,i=17*Uint32Array.BYTES_PER_ELEMENT,r=new Jm(e,Km.length,i,!0);n.vkFormat=r._nextUint32(),n.typeSize=r._nextUint32(),n.pixelWidth=r._nextUint32(),n.pixelHeight=r._nextUint32(),n.pixelDepth=r._nextUint32(),n.layerCount=r._nextUint32(),n.faceCount=r._nextUint32();const s=r._nextUint32();n.supercompressionScheme=r._nextUint32();const o=r._nextUint32(),a=r._nextUint32(),l=r._nextUint32(),c=r._nextUint32(),h=r._nextUint64(),d=r._nextUint64(),u=new Jm(e,Km.length+i,3*s*8,!0);for(let t=0;t<s;t++)n.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+u._nextUint64(),u._nextUint64()),uncompressedByteLength:u._nextUint64()});const p=new Jm(e,o,a,!0),A={vendorId:p._skip(4)._nextUint16(),descriptorType:p._nextUint16(),versionNumber:p._nextUint16(),descriptorBlockSize:p._nextUint16(),colorModel:p._nextUint8(),colorPrimaries:p._nextUint8(),transferFunction:p._nextUint8(),flags:p._nextUint8(),texelBlockDimension:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],bytesPlane:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],samples:[]},f=(A.descriptorBlockSize/4-6)/4;for(let e=0;e<f;e++){const t={bitOffset:p._nextUint16(),bitLength:p._nextUint8(),channelType:p._nextUint8(),samplePosition:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=p._nextInt32(),t.sampleUpper=p._nextInt32()):(t.sampleLower=p._nextUint32(),t.sampleUpper=p._nextUint32()),A.samples[e]=t}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(A);const m=new Jm(e,l,c,!0);for(;m._offset<c;){const e=m._nextUint32(),t=m._scan(e),i=Zm(t);if(n.keyValue[i]=m._nextUint8Array(e-t.byteLength-1),i.match(/^ktx/i)){const e=Zm(n.keyValue[i]);n.keyValue[i]=e.substring(0,e.lastIndexOf("\0"))}m._skip(e%4?4-e%4:0)}if(d<=0)return n;const g=new Jm(e,h,d,!0),v=g._nextUint16(),y=g._nextUint16(),E=g._nextUint32(),x=g._nextUint32(),b=g._nextUint32(),C=g._nextUint32(),w=[];for(let e=0;e<s;e++)w.push({imageFlags:g._nextUint32(),rgbSliceByteOffset:g._nextUint32(),rgbSliceByteLength:g._nextUint32(),alphaSliceByteOffset:g._nextUint32(),alphaSliceByteLength:g._nextUint32()});const _=h+g._offset,M=_+E,S=M+x,I=S+b,B=new Uint8Array(e.buffer,e.byteOffset+_,E),T=new Uint8Array(e.buffer,e.byteOffset+M,x),R=new Uint8Array(e.buffer,e.byteOffset+S,b),L=new Uint8Array(e.buffer,e.byteOffset+I,C);return n.globalData={endpointCount:v,selectorCount:y,imageDescs:w,endpointsData:B,selectorsData:T,tablesData:R,extendedData:L},n}(new Uint8Array(e)),i=n.vkFormat===Xm&&167===n.dataFormatDescriptor[0].colorModel;if(0!==n.vkFormat&&(!i||this.workerConfig.astcHDRSupported))return async function(e){const{vkFormat:t}=e;if(void 0===dg[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let n;2===e.supercompressionScheme&&(ag||(ag=new Promise((async e=>{const t=new rg;await t.init(),e(t)}))),n=await ag);const i=[];for(let r=0;r<e.levels.length;r++){const s=Math.max(1,e.pixelWidth>>r),o=Math.max(1,e.pixelHeight>>r),a=e.pixelDepth?Math.max(1,e.pixelDepth>>r):0,l=e.levels[r];let c,h;if(0===e.supercompressionScheme)c=l.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");c=n.decode(l.levelData,l.uncompressedByteLength)}h=ug[t]===Fe?new Float32Array(c.buffer,c.byteOffset,c.byteLength/Float32Array.BYTES_PER_ELEMENT):ug[t]===ke?new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT):c,i.push({data:h,width:s,height:o,depth:a})}let r;if(hg.has(dg[t]))r=0===e.pixelDepth?new Go(i[0].data,e.pixelWidth,e.pixelHeight):new Bi(i[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");r=new Ya(i,e.pixelWidth,e.pixelHeight),r.minFilter=1===i.length?Me:Be,r.magFilter=Me}return r.mipmaps=i,r.type=ug[t],r.format=dg[t],r.colorSpace=pg(e),r.needsUpdate=!0,Promise.resolve(r)}(n);const r=t,s=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:r},[e]))).then((e=>this._createTextureFrom(e.data,n)));return og.set(e,{promise:s}),s}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),lg--,this}}cg.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},cg.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25},cg.EngineFormat={RGBAFormat:je,RGBA_ASTC_4x4_Format:pt,RGB_BPTC_UNSIGNED_Format:Bt,RGBA_BPTC_Format:St,RGBA_ETC2_EAC_Format:ut,RGBA_PVRTC_4BPPV1_Format:lt,RGBA_S3TC_DXT5_Format:st,RGB_ETC1_Format:ht,RGB_ETC2_Format:dt,RGB_PVRTC_4BPPV1_Format:ot,RGBA_S3TC_DXT1_Format:it},cg.EngineType={UnsignedByteType:Re,HalfFloatType:ke,FloatType:Fe},cg.BasisWorker=function(){let e,t,n;const i=_EngineFormat,r=_EngineType,s=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",(function(i){const s=i.data;switch(s.type){case"init":e=s.config,a=s.transcoderBinary,t=new Promise((e=>{n={wasmBinary:a,onRuntimeInitialized:e},BASIS(n)})).then((()=>{n.initializeBasis(),void 0===n.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}));break;case"transcode":t.then((()=>{try{const{faces:t,buffers:i,width:a,height:d,hasAlpha:u,format:p,type:A,dfdFlags:f}=function(t){const i=new n.KTX2File(new Uint8Array(t));function s(){i.close(),i.delete()}if(!i.isValid())throw s(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");let a;if(i.isUASTC())a=o.UASTC;else if(i.isETC1S())a=o.ETC1S;else{if(!i.isHDR())throw new Error("THREE.KTX2Loader: Unknown Basis encoding");a=o.UASTC_HDR}const d=i.getWidth(),u=i.getHeight(),p=i.getLayers()||1,A=i.getLevels(),f=i.getFaces(),m=i.getHasAlpha(),g=i.getDFDFlags(),{transcoderFormat:v,engineFormat:y,engineType:E}=function(t,n,i,r){const s=l[t];for(let o=0;o<s.length;o++){const a=s[o];if((!a.if||e[a.if])&&(a.basisFormat.includes(t)&&!(r&&a.transcoderFormat.length<2)&&(!a.needsPowerOfTwo||c(n)&&c(i))))return{transcoderFormat:a.transcoderFormat[r?1:0],engineFormat:a.engineFormat[r?1:0],engineType:a.engineType[0]}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}(a,d,u,m);if(!d||!u||!A)throw s(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!i.startTranscoding())throw s(),new Error("THREE.KTX2Loader: .startTranscoding failed");const x=[],b=[];for(let e=0;e<f;e++){const t=[];for(let n=0;n<A;n++){const o=[];let a,l;for(let t=0;t<p;t++){const c=i.getImageLevelInfo(n,t,e);0!==e||0!==n||0!==t||c.origWidth%4==0&&c.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),A>1?(a=c.origWidth,l=c.origHeight):(a=c.width,l=c.height);let h=new Uint8Array(i.getImageTranscodedSizeInBytes(n,t,0,v));const d=i.transcodeImage(h,n,t,e,v,0,-1,-1);if(E===r.HalfFloatType&&(h=new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!d)throw s(),new Error("THREE.KTX2Loader: .transcodeImage failed.");o.push(h)}const c=h(o);t.push({data:c,width:a,height:l}),b.push(c.buffer)}x.push({mipmaps:t,width:d,height:u,format:y,type:E})}return s(),{faces:x,buffers:b,width:d,height:u,hasAlpha:m,dfdFlags:g,format:y,type:E}}(s.buffer);self.postMessage({type:"transcode",id:s.id,data:{faces:t,width:a,height:d,hasAlpha:u,format:p,type:A,dfdFlags:f}},i)}catch(e){console.error(e),self.postMessage({type:"error",id:s.id,error:e.message})}}))}var a}));const a=[{if:"astcSupported",basisFormat:[o.UASTC],transcoderFormat:[s.ASTC_4x4,s.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],engineType:[r.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC7_M5,s.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],engineType:[r.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC1,s.BC3],engineFormat:[i.RGBA_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],engineType:[r.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1,s.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],engineType:[r.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1],engineFormat:[i.RGB_ETC1_Format],engineType:[r.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.PVRTC1_4_RGB,s.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],engineType:[r.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[o.UASTC_HDR],transcoderFormat:[s.BC6H],engineFormat:[i.RGB_BPTC_UNSIGNED_Format],engineType:[r.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.RGBA32,s.RGBA32],engineFormat:[i.RGBAFormat,i.RGBAFormat],engineType:[r.UnsignedByteType,r.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[o.UASTC_HDR],transcoderFormat:[s.RGBA_HALF],engineFormat:[i.RGBAFormat],engineType:[r.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],l={[o.ETC1S]:a.filter((e=>e.basisFormat.includes(o.ETC1S))).sort(((e,t)=>e.priorityUASTC-t.priorityUASTC)),[o.UASTC]:a.filter((e=>e.basisFormat.includes(o.UASTC))).sort(((e,t)=>e.priorityUASTC-t.priorityUASTC)),[o.UASTC_HDR]:a.filter((e=>e.basisFormat.includes(o.UASTC_HDR))).sort(((e,t)=>e.priorityHDR-t.priorityHDR))};function c(e){return e<=2||!(e&e-1)&&0!==e}function h(e){if(1===e.length)return e[0];let t=0;for(let n=0;n<e.length;n++)t+=e[n].byteLength;const n=new Uint8Array(t);let i=0;for(let t=0;t<e.length;t++){const r=e[t];n.set(r,i),i+=r.byteLength}return n}};const hg=new Set([je,Ze,Je]),dg={[jm]:je,[zm]:je,[km]:je,[Nm]:je,[Vm]:Ze,[Gm]:Ze,[Om]:Ze,[Fm]:Ze,[Hm]:Je,[Qm]:Je,[Um]:Je,[Pm]:Je,[Xm]:pt,[qm]:gt,[Wm]:gt},ug={[jm]:Fe,[zm]:ke,[km]:Re,[Nm]:Re,[Vm]:Fe,[Gm]:ke,[Om]:Re,[Fm]:Re,[Hm]:Fe,[Qm]:ke,[Um]:Re,[Pm]:Re,[Xm]:ke,[qm]:Re,[Wm]:Re};function pg(e){const t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?tn:nn:10===t.colorPrimaries?2===t.transferFunction?"display-p3":"display-p3-linear":(0===t.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),en)}const Ag={c:null,u:[new Li,new Li,new Li],e:[]},fg={c:null,u:[new Li,new Li,new Li],e:[]},mg=[[],[],[]],gg=[[],[],[]],vg=[],yg=new Li,Eg=new Li,xg=new Li,bg=new Li,Cg=new Li,wg=new Li,_g=new ni,Mg=new Ui,Sg=new lr,Ig=new lr,Bg=new ar;class Tg{constructor(e=new Li,t=new Li,n=new ni){this.center=e,this.halfSize=t,this.rotation=n}set(e,t,n){return this.center=e,this.halfSize=t,this.rotation=n,this}copy(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this}clone(){return(new this.constructor).copy(this)}getSize(e){return e.copy(this.halfSize).multiplyScalar(2)}clampPoint(e,t){const n=this.halfSize;bg.subVectors(e,this.center),this.rotation.extractBasis(yg,Eg,xg),t.copy(this.center);const i=ei.clamp(bg.dot(yg),-n.x,n.x);t.add(yg.multiplyScalar(i));const r=ei.clamp(bg.dot(Eg),-n.y,n.y);t.add(Eg.multiplyScalar(r));const s=ei.clamp(bg.dot(xg),-n.z,n.z);return t.add(xg.multiplyScalar(s)),t}containsPoint(e){return bg.subVectors(e,this.center),this.rotation.extractBasis(yg,Eg,xg),Math.abs(bg.dot(yg))<=this.halfSize.x&&Math.abs(bg.dot(Eg))<=this.halfSize.y&&Math.abs(bg.dot(xg))<=this.halfSize.z}intersectsBox3(e){return this.intersectsOBB(Rg.fromBox3(e))}intersectsSphere(e){return this.clampPoint(e.center,wg),wg.distanceToSquared(e.center)<=e.radius*e.radius}intersectsOBB(e,t=Number.EPSILON){Ag.c=this.center,Ag.e[0]=this.halfSize.x,Ag.e[1]=this.halfSize.y,Ag.e[2]=this.halfSize.z,this.rotation.extractBasis(Ag.u[0],Ag.u[1],Ag.u[2]),fg.c=e.center,fg.e[0]=e.halfSize.x,fg.e[1]=e.halfSize.y,fg.e[2]=e.halfSize.z,e.rotation.extractBasis(fg.u[0],fg.u[1],fg.u[2]);for(let e=0;e<3;e++)for(let t=0;t<3;t++)mg[e][t]=Ag.u[e].dot(fg.u[t]);bg.subVectors(fg.c,Ag.c),vg[0]=bg.dot(Ag.u[0]),vg[1]=bg.dot(Ag.u[1]),vg[2]=bg.dot(Ag.u[2]);for(let e=0;e<3;e++)for(let n=0;n<3;n++)gg[e][n]=Math.abs(mg[e][n])+t;let n,i;for(let e=0;e<3;e++)if(n=Ag.e[e],i=fg.e[0]*gg[e][0]+fg.e[1]*gg[e][1]+fg.e[2]*gg[e][2],Math.abs(vg[e])>n+i)return!1;for(let e=0;e<3;e++)if(n=Ag.e[0]*gg[0][e]+Ag.e[1]*gg[1][e]+Ag.e[2]*gg[2][e],i=fg.e[e],Math.abs(vg[0]*mg[0][e]+vg[1]*mg[1][e]+vg[2]*mg[2][e])>n+i)return!1;return n=Ag.e[1]*gg[2][0]+Ag.e[2]*gg[1][0],i=fg.e[1]*gg[0][2]+fg.e[2]*gg[0][1],!(Math.abs(vg[2]*mg[1][0]-vg[1]*mg[2][0])>n+i||(n=Ag.e[1]*gg[2][1]+Ag.e[2]*gg[1][1],i=fg.e[0]*gg[0][2]+fg.e[2]*gg[0][0],Math.abs(vg[2]*mg[1][1]-vg[1]*mg[2][1])>n+i||(n=Ag.e[1]*gg[2][2]+Ag.e[2]*gg[1][2],i=fg.e[0]*gg[0][1]+fg.e[1]*gg[0][0],Math.abs(vg[2]*mg[1][2]-vg[1]*mg[2][2])>n+i||(n=Ag.e[0]*gg[2][0]+Ag.e[2]*gg[0][0],i=fg.e[1]*gg[1][2]+fg.e[2]*gg[1][1],Math.abs(vg[0]*mg[2][0]-vg[2]*mg[0][0])>n+i||(n=Ag.e[0]*gg[2][1]+Ag.e[2]*gg[0][1],i=fg.e[0]*gg[1][2]+fg.e[2]*gg[1][0],Math.abs(vg[0]*mg[2][1]-vg[2]*mg[0][1])>n+i||(n=Ag.e[0]*gg[2][2]+Ag.e[2]*gg[0][2],i=fg.e[0]*gg[1][1]+fg.e[1]*gg[1][0],Math.abs(vg[0]*mg[2][2]-vg[2]*mg[0][2])>n+i||(n=Ag.e[0]*gg[1][0]+Ag.e[1]*gg[0][0],i=fg.e[1]*gg[2][2]+fg.e[2]*gg[2][1],Math.abs(vg[1]*mg[0][0]-vg[0]*mg[1][0])>n+i||(n=Ag.e[0]*gg[1][1]+Ag.e[1]*gg[0][1],i=fg.e[0]*gg[2][2]+fg.e[2]*gg[2][0],Math.abs(vg[1]*mg[0][1]-vg[0]*mg[1][1])>n+i||(n=Ag.e[0]*gg[1][2]+Ag.e[1]*gg[0][2],i=fg.e[0]*gg[2][1]+fg.e[1]*gg[2][0],Math.abs(vg[1]*mg[0][2]-vg[0]*mg[1][2])>n+i)))))))))}intersectsPlane(e){this.rotation.extractBasis(yg,Eg,xg);const t=this.halfSize.x*Math.abs(e.normal.dot(yg))+this.halfSize.y*Math.abs(e.normal.dot(Eg))+this.halfSize.z*Math.abs(e.normal.dot(xg)),n=e.normal.dot(this.center)-e.constant;return Math.abs(n)<=t}intersectRay(e,t){return this.getSize(Cg),Mg.setFromCenterAndSize(bg.set(0,0,0),Cg),Sg.setFromMatrix3(this.rotation),Sg.setPosition(this.center),Ig.copy(Sg).invert(),Bg.copy(e).applyMatrix4(Ig),Bg.intersectBox(Mg,t)?t.applyMatrix4(Sg):null}intersectsRay(e){return null!==this.intersectRay(e,bg)}fromBox3(e){return e.getCenter(this.center),e.getSize(this.halfSize).multiplyScalar(.5),this.rotation.identity(),this}equals(e){return e.center.equals(this.center)&&e.halfSize.equals(this.halfSize)&&e.rotation.equals(this.rotation)}applyMatrix4(e){const t=e.elements;let n=bg.set(t[0],t[1],t[2]).length();const i=bg.set(t[4],t[5],t[6]).length(),r=bg.set(t[8],t[9],t[10]).length();e.determinant()<0&&(n=-n),_g.setFromMatrix4(e);const s=1/n,o=1/i,a=1/r;return _g.elements[0]*=s,_g.elements[1]*=s,_g.elements[2]*=s,_g.elements[3]*=o,_g.elements[4]*=o,_g.elements[5]*=o,_g.elements[6]*=a,_g.elements[7]*=a,_g.elements[8]*=a,this.rotation.multiply(_g),this.halfSize.x*=n,this.halfSize.y*=i,this.halfSize.z*=r,bg.setFromMatrixPosition(e),this.center.add(bg),this}}const Rg=new Tg,Lg=/^[og]\s*(.+)?/,Dg=/^mtllib /,Pg=/^usemtl /,Ug=/^usemap /,Og=/\s+/,Fg=new Li,kg=new Li,Ng=new Li,Qg=new Li,Gg=new Li,zg=new es;function Hg(){const e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);const n=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){const n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);const i={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){const t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(i),i},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){const t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},n&&n.name&&"function"==typeof n.clone){const e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseNormalIndex:function(e,t){const n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseUVIndex:function(e,t){const n=parseInt(e,10);return 2*(n>=0?n-1:n+t/2)},addVertex:function(e,t,n){const i=this.vertices,r=this.object.geometry.vertices;r.push(i[e+0],i[e+1],i[e+2]),r.push(i[t+0],i[t+1],i[t+2]),r.push(i[n+0],i[n+1],i[n+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){const i=this.normals,r=this.object.geometry.normals;r.push(i[e+0],i[e+1],i[e+2]),r.push(i[t+0],i[t+1],i[t+2]),r.push(i[n+0],i[n+1],i[n+2])},addFaceNormal:function(e,t,n){const i=this.vertices,r=this.object.geometry.normals;Fg.fromArray(i,e),kg.fromArray(i,t),Ng.fromArray(i,n),Gg.subVectors(Ng,kg),Qg.subVectors(Fg,kg),Gg.cross(Qg),Gg.normalize(),r.push(Gg.x,Gg.y,Gg.z),r.push(Gg.x,Gg.y,Gg.z),r.push(Gg.x,Gg.y,Gg.z)},addColor:function(e,t,n){const i=this.colors,r=this.object.geometry.colors;void 0!==i[e]&&r.push(i[e+0],i[e+1],i[e+2]),void 0!==i[t]&&r.push(i[t+0],i[t+1],i[t+2]),void 0!==i[n]&&r.push(i[n+0],i[n+1],i[n+2])},addUV:function(e,t,n){const i=this.uvs,r=this.object.geometry.uvs;r.push(i[e+0],i[e+1]),r.push(i[t+0],i[t+1]),r.push(i[n+0],i[n+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,i,r,s,o,a,l){const c=this.vertices.length;let h=this.parseVertexIndex(e,c),d=this.parseVertexIndex(t,c),u=this.parseVertexIndex(n,c);if(this.addVertex(h,d,u),this.addColor(h,d,u),void 0!==o&&""!==o){const e=this.normals.length;h=this.parseNormalIndex(o,e),d=this.parseNormalIndex(a,e),u=this.parseNormalIndex(l,e),this.addNormal(h,d,u)}else this.addFaceNormal(h,d,u);if(void 0!==i&&""!==i){const e=this.uvs.length;h=this.parseUVIndex(i,e),d=this.parseUVIndex(r,e),u=this.parseUVIndex(s,e),this.addUV(h,d,u),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let n=0,i=e.length;n<i;n++){const i=this.parseVertexIndex(e[n],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const n=this.vertices.length,i=this.uvs.length;for(let t=0,i=e.length;t<i;t++)this.addVertexLine(this.parseVertexIndex(e[t],n));for(let e=0,n=t.length;e<n;e++)this.addUVLine(this.parseUVIndex(t[e],i))}};return e.startObject("",!1),e}class Vg{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:m,this.wrap=void 0!==this.options.wrap?this.options.wrap:ve}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],i={name:e,side:this.side};function r(e,n){if(i[e])return;const r=t.getTextureParams(n,i),s=t.loadTexture((o=t.baseUrl,"string"!=typeof(a=r.url)||""===a?"":/^https?:\/\//i.test(a)?a:o+a));var o,a;s.repeat.copy(r.scale),s.offset.copy(r.offset),s.wrapS=t.wrap,s.wrapT=t.wrap,"map"!==e&&"emissiveMap"!==e||(s.colorSpace=tn),i[e]=s}for(const e in n){const t=n[e];let s;if(""!==t)switch(e.toLowerCase()){case"kd":i.color=Ai.toWorkingColorSpace((new es).fromArray(t),tn);break;case"ks":i.specular=Ai.toWorkingColorSpace((new es).fromArray(t),tn);break;case"ke":i.emissive=Ai.toWorkingColorSpace((new es).fromArray(t),tn);break;case"map_kd":r("map",t);break;case"map_ks":r("specularMap",t);break;case"map_ke":r("emissiveMap",t);break;case"norm":r("normalMap",t);break;case"map_bump":case"bump":r("bumpMap",t);break;case"map_d":r("alphaMap",t),i.transparent=!0;break;case"ns":i.shininess=parseFloat(t);break;case"d":s=parseFloat(t),s<1&&(i.opacity=s,i.transparent=!0);break;case"tr":s=parseFloat(t),this.options&&this.options.invertTrProperty&&(s=1-s),s>0&&(i.opacity=1-s,i.transparent=!0)}}return this.materials[e]=new Sc(i),this.materials[e]}getTextureParams(e,t){const n={scale:new ti(1,1),offset:new ti(0,0)},i=e.split(/\s+/);let r;return r=i.indexOf("-bm"),r>=0&&(t.bumpScale=parseFloat(i[r+1]),i.splice(r,2)),r=i.indexOf("-s"),r>=0&&(n.scale.set(parseFloat(i[r+1]),parseFloat(i[r+2])),i.splice(r,4)),r=i.indexOf("-o"),r>=0&&(n.offset.set(parseFloat(i[r+1]),parseFloat(i[r+2])),i.splice(r,4)),n.url=i.join(" ").trim(),n}loadTexture(e,t,n,i,r){const s=void 0!==this.manager?this.manager:ih;let o=s.getHandler(e);null===o&&(o=new ph(s)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin);const a=o.load(e,n,i,r);return void 0!==t&&(a.mapping=t),a}}function jg(e,t){switch(t){case tn:e.convertSRGBToLinear();break;case nn:case en:break;default:console.warn("WARNING: LightProbeGenerator convertColorToLinear() encountered an unsupported color space.")}return e}var Wg={...i};Wg.DRACOLoader=class extends rh{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){const r=new ah(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,(e=>{this.parse(e,t,i)}),n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,tn,n).catch(n)}decodeDracoFile(e,t,n,i,r=nn,s=()=>{}){const o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(e,o).then(t).catch(s)}decodeGeometry(e,t){const n=JSON.stringify(t);if(of.has(e)){const t=of.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,s=e.byteLength,o=this._getWorker(r,s).then((n=>(i=n,new Promise(((n,s)=>{i._callbacks[r]={resolve:n,reject:s},i.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return o.catch((()=>!0)).then((()=>{i&&r&&this._releaseTask(i,r)})),of.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new Bs;e.index&&t.setIndex(new us(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const i=e.attributes[n],r=i.name,s=i.array,o=i.itemSize,a=new us(s,o);"color"===r&&(this._assignVertexColorSpace(a,i.vertexColorSpace),a.normalized=s instanceof Float32Array==0),t.setAttribute(r,a)}return t}_assignVertexColorSpace(e,t){if(t!==tn)return;const n=new es;for(let t=0,i=e.count;t<i;t++)n.fromBufferAttribute(e,t),Ai.toWorkingColorSpace(n,tn),e.setXYZ(t,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new ah(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise(((t,i)=>{n.load(e,t,void 0,i)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const i=af.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const n=t.data;switch(n.type){case"decode":e._callbacks[n.id].resolve(n);break;case"error":e._callbacks[n.id].reject(n);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+n.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}},Wg.GLTFLoader=class extends rh{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new qf(e)})),this.register((function(e){return new Xf(e)})),this.register((function(e){return new im(e)})),this.register((function(e){return new rm(e)})),this.register((function(e){return new sm(e)})),this.register((function(e){return new Jf(e)})),this.register((function(e){return new Kf(e)})),this.register((function(e){return new Zf(e)})),this.register((function(e){return new $f(e)})),this.register((function(e){return new Wf(e)})),this.register((function(e){return new em(e)})),this.register((function(e){return new Yf(e)})),this.register((function(e){return new nm(e)})),this.register((function(e){return new tm(e)})),this.register((function(e){return new Vf(e)})),this.register((function(e){return new om(e)})),this.register((function(e){return new am(e)}))}load(e,t,n,i){const r=this;let s;if(""!==this.resourcePath)s=this.resourcePath;else if(""!==this.path){const t=Uh.extractUrlBase(e);s=Uh.resolveURL(t,this.path)}else s=Uh.extractUrlBase(e);this.manager.itemStart(e);const o=function(t){i?i(t):console.error(t),r.manager.itemError(e),r.manager.itemEnd(e)},a=new ah(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{r.parse(n,s,(function(n){t(n),r.manager.itemEnd(e)}),o)}catch(e){o(e)}}),n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let r;const s={},o={},a=new TextDecoder;if("string"==typeof e)r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(a.decode(new Uint8Array(e,0,4))===lm){try{s[bf]=new cm(e)}catch(e){return void(i&&i(e))}r=JSON.parse(s[bf].content)}else r=JSON.parse(a.decode(e));else r=e;if(void 0===r.asset||r.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new Rm(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](l);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[t.name]=t,s[t.name]=!0}if(r.extensionsUsed)for(let e=0;e<r.extensionsUsed.length;++e){const t=r.extensionsUsed[e],n=r.extensionsRequired||[];switch(t){case Df:s[t]=new jf;break;case Cf:s[t]=new hm(r,this.dracoLoader);break;case Of:s[t]=new dm;break;case Ff:s[t]=new um;break;default:n.indexOf(t)>=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(s),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise((function(i,r){n.parse(e,t,i,r)}))}},Wg.KTX2Loader=cg,Wg.OBJLoader=class extends rh{constructor(e){super(e),this.materials=null}load(e,t,n,i){const r=this,s=new ah(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{t(r.parse(n))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}setMaterials(e){return this.materials=e,this}parse(e){const t=new Hg;-1!==e.indexOf("\r\n")&&(e=e.replace(/\r\n/g,"\n")),-1!==e.indexOf("\\\n")&&(e=e.replace(/\\\n/g,""));const n=e.split("\n");let i=[];for(let e=0,r=n.length;e<r;e++){const r=n[e].trimStart();if(0===r.length)continue;const s=r.charAt(0);if("#"!==s)if("v"===s){const e=r.split(Og);switch(e[0]){case"v":t.vertices.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),e.length>=7?(zg.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6]),tn),t.colors.push(zg.r,zg.g,zg.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case"vt":t.uvs.push(parseFloat(e[1]),parseFloat(e[2]))}}else if("f"===s){const e=r.slice(1).trim().split(Og),n=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];if(i.length>0){const e=i.split("/");n.push(e)}}const i=n[0];for(let e=1,r=n.length-1;e<r;e++){const r=n[e],s=n[e+1];t.addFace(i[0],r[0],s[0],i[1],r[1],s[1],i[2],r[2],s[2])}}else if("l"===s){const e=r.substring(1).trim().split(" ");let n=[];const i=[];if(-1===r.indexOf("/"))n=e;else for(let t=0,r=e.length;t<r;t++){const r=e[t].split("/");""!==r[0]&&n.push(r[0]),""!==r[1]&&i.push(r[1])}t.addLineGeometry(n,i)}else if("p"===s){const e=r.slice(1).trim().split(" ");t.addPointGeometry(e)}else if(null!==(i=Lg.exec(r))){const e=(" "+i[0].slice(1).trim()).slice(1);t.startObject(e)}else if(Pg.test(r))t.object.startMaterial(r.substring(7).trim(),t.materialLibraries);else if(Dg.test(r))t.materialLibraries.push(r.substring(7).trim());else if(Ug.test(r))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if("s"===s){if(i=r.split(" "),i.length>1){const e=i[1].trim().toLowerCase();t.object.smooth="0"!==e&&"off"!==e}else t.object.smooth=!0;const e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if("\0"===r)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+r+'"')}}t.finalize();const r=new Wa;if(r.materialLibraries=[].concat(t.materialLibraries),!0==!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length))for(let e=0,n=t.objects.length;e<n;e++){const n=t.objects[e],i=n.geometry,s=n.materials,o="Line"===i.type,a="Points"===i.type;let l=!1;if(0===i.vertices.length)continue;const c=new Bs;c.setAttribute("position",new xs(i.vertices,3)),i.normals.length>0&&c.setAttribute("normal",new xs(i.normals,3)),i.colors.length>0&&(l=!0,c.setAttribute("color",new xs(i.colors,3))),!0===i.hasUVIndices&&c.setAttribute("uv",new xs(i.uvs,2));const h=[];for(let e=0,n=s.length;e<n;e++){const n=s[e],i=n.name+"_"+n.smooth+"_"+l;let r=t.materials[i];if(null!==this.materials)if(r=this.materials.create(n.name),!o||!r||r instanceof _a){if(a&&r&&!(r instanceof Na)){const e=new Na({size:10,sizeAttenuation:!1});is.prototype.copy.call(e,r),e.color.copy(r.color),e.map=r.map,r=e}}else{const e=new _a;is.prototype.copy.call(e,r),e.color.copy(r.color),r=e}void 0===r&&(r=o?new _a:a?new Na({size:1,sizeAttenuation:!1}):new Sc,r.name=n.name,r.flatShading=!n.smooth,r.vertexColors=l,t.materials[i]=r),h.push(r)}let d;if(h.length>1){for(let e=0,t=s.length;e<t;e++){const t=s[e];c.addGroup(t.groupStart,t.groupCount,e)}d=o?new Fa(c,h):a?new Va(c,h):new Gs(c,h)}else d=o?new Fa(c,h[0]):a?new Va(c,h[0]):new Gs(c,h[0]);d.name=n.name,r.add(d)}else if(t.vertices.length>0){const e=new Na({size:1,sizeAttenuation:!1}),n=new Bs;n.setAttribute("position",new xs(t.vertices,3)),t.colors.length>0&&void 0!==t.colors[0]&&(n.setAttribute("color",new xs(t.colors,3)),e.vertexColors=!0);const i=new Va(n,e);r.add(i)}return r}},Wg.MTLLoader=class extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=""===this.path?Uh.extractUrlBase(e):this.path,o=new ah(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){try{t(r.parse(n,s))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){const n=e.split("\n");let i={};const r=/\s+/,s={};for(let e=0;e<n.length;e++){let t=n[e];if(t=t.trim(),0===t.length||"#"===t.charAt(0))continue;const o=t.indexOf(" ");let a=o>=0?t.substring(0,o):t;a=a.toLowerCase();let l=o>=0?t.substring(o+1):"";if(l=l.trim(),"newmtl"===a)i={name:l},s[l]=i;else if("ka"===a||"kd"===a||"ks"===a||"ke"===a){const e=l.split(r,3);i[a]=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2])]}else i[a]=l}const o=new Vg(this.resourcePath||t,this.materialOptions);return o.setCrossOrigin(this.crossOrigin),o.setManager(this.manager),o.setMaterials(s),o}},Wg.OBB=Tg,Wg.BufferGeometryUtils=r,Wg.LightProbeGenerator=class{static fromCubeTexture(e){let t=0;const n=new Li,i=new Li,r=new es,s=[0,0,0,0,0,0,0,0,0],o=new Lh,a=o.coefficients;for(let o=0;o<6;o++){const l=e.image[o],c=l.width,h=l.height,d=document.createElement("canvas");d.width=c,d.height=h;const u=d.getContext("2d");u.drawImage(l,0,0,c,h);const p=u.getImageData(0,0,c,h),A=p.data,f=p.width,m=2/f;for(let l=0,c=A.length;l<c;l+=4){r.setRGB(A[l]/255,A[l+1]/255,A[l+2]/255),jg(r,e.colorSpace);const c=l/4,h=(c%f+.5)*m-1,d=1-(Math.floor(c/f)+.5)*m;switch(o){case 0:n.set(-1,d,-h);break;case 1:n.set(1,d,h);break;case 2:n.set(-h,1,-d);break;case 3:n.set(-h,-1,d);break;case 4:n.set(-h,d,1);break;case 5:n.set(h,d,-1)}const u=n.lengthSq(),p=4/(Math.sqrt(u)*u);t+=p,i.copy(n).normalize(),Lh.getBasisAt(i,s);for(let e=0;e<9;e++)a[e].x+=s[e]*r.r*p,a[e].y+=s[e]*r.g*p,a[e].z+=s[e]*r.b*p}}const l=4*Math.PI/t;for(let e=0;e<9;e++)a[e].x*=l,a[e].y*=l,a[e].z*=l;return new Dh(o)}static async fromCubeRenderTarget(e,t){const n=e.coordinateSystem===Gn?-1:1;let i=0;const r=new Li,s=new Li,o=new es,a=[0,0,0,0,0,0,0,0,0],l=new Lh,c=l.coefficients,h=t.texture.type,d=t.width;let u;e.isWebGLRenderer&&(u=h===ke?new Uint16Array(d*d*4):new Uint8Array(d*d*4));for(let l=0;l<6;l++){e.isWebGLRenderer?await e.readRenderTargetPixelsAsync(t,0,0,d,d,u,l):u=await e.readRenderTargetPixelsAsync(t,0,0,d,d,0,l);const p=2/d;for(let e=0,A=u.length;e<A;e+=4){let A,f,m;h===ke?(A=cs.fromHalfFloat(u[e]),f=cs.fromHalfFloat(u[e+1]),m=cs.fromHalfFloat(u[e+2])):(A=u[e]/255,f=u[e+1]/255,m=u[e+2]/255),o.setRGB(A,f,m),jg(o,t.texture.colorSpace);const g=e/4,v=(1-(g%d+.5)*p)*n,y=1-(Math.floor(g/d)+.5)*p;switch(l){case 0:r.set(-1*n,y,v*n);break;case 1:r.set(1*n,y,-v*n);break;case 2:r.set(v,1,-y);break;case 3:r.set(v,-1,y);break;case 4:r.set(v,y,1);break;case 5:r.set(-v,y,-1)}const E=r.lengthSq(),x=4/(Math.sqrt(E)*E);i+=x,s.copy(r).normalize(),Lh.getBasisAt(s,a);for(let e=0;e<9;e++)c[e].x+=a[e]*o.r*x,c[e].y+=a[e]*o.g*x,c[e].z+=a[e]*o.b*x}}const p=4*Math.PI/i;for(let e=0;e<9;e++)c[e].x*=p,c[e].y*=p,c[e].z*=p;return new Dh(l)}};const qg=Wg},8330:e=>{"use strict";e.exports=JSON.parse('{"name":"aframe","version":"1.6.0","description":"A web framework for building virtual reality experiences.","homepage":"https://aframe.io/","main":"dist/aframe-master.js","scripts":{"dev":"cross-env INSPECTOR_VERSION=dev webpack serve --port 8080","dist":"node scripts/updateVersionLog.js && npm run dist:min && npm run dist:max","dist:max":"webpack --config webpack.config.js","dist:min":"webpack --config webpack.prod.config.js","docs":"markserv --dir docs --port 9001","preghpages":"node ./scripts/preghpages.js","ghpages":"ghpages -p gh-pages/","lint":"standardx -v | snazzy","lint:fix":"standardx --fix","precommit":"npm run lint","prepush":"node scripts/testOnlyCheck.js","prerelease":"node scripts/release.js 1.5.0 1.6.0","start":"npm run dev","start:https":"npm run dev -- --server-type https","test":"karma start ./tests/karma.conf.js","test:docs":"node scripts/docsLint.js","test:firefox":"npm test -- --browsers Firefox","test:chrome":"npm test -- --browsers Chrome","test:nobrowser":"NO_BROWSER=true npm test","test:node":"node --experimental-require-module ./node_modules/mocha/bin/mocha --ui tdd tests/node"},"repository":"aframevr/aframe","license":"MIT","files":["dist/*","docs/**/*","src/**/*","vendor/**/*"],"dependencies":{"buffer":"^6.0.3","debug":"^4.3.4","deep-assign":"^2.0.0","load-bmfont":"^1.2.3","super-animejs":"^3.1.0","three":"npm:super-three@0.171.0","three-bmfont-text":"dmarcos/three-bmfont-text#eed4878795be9b3e38cf6aec6b903f56acd1f695"},"devDependencies":{"@babel/core":"^7.24.0","babel-loader":"^9.1.3","babel-plugin-istanbul":"^6.1.1","chai":"^4.3.6","chai-shallow-deep-equal":"^1.4.0","chalk":"^1.1.3","cross-env":"^7.0.3","css-loader":"^7.1.2","eslint":"^8.45.0","eslint-config-semistandard":"^17.0.0","eslint-config-standard-jsx":"^11.0.0","ghpages":"0.0.8","git-rev":"^0.2.1","glob":"^8.0.3","husky":"^0.11.7","jsdom":"^24.0.0","jsdom-global":"^3.0.2","karma":"^6.4.0","karma-chai-shallow-deep-equal":"0.0.4","karma-chrome-launcher":"^3.1.1","karma-coverage":"^2.2.0","karma-env-preprocessor":"^0.1.1","karma-firefox-launcher":"^2.1.2","karma-mocha":"^2.0.1","karma-mocha-reporter":"^2.2.5","karma-sinon-chai":"^2.0.2","karma-webpack":"^5.0.0","markserv":"github:sukima/markserv#feature/fix-broken-websoketio-link","mocha":"^10.0.0","replace-in-file":"^2.5.3","shelljs":"^0.8.5","shx":"^0.2.2","sinon":"<12.0.0","sinon-chai":"^3.7.0","snazzy":"^5.0.0","standardx":"^7.0.0","style-loader":"^4.0.0","too-wordy":"ngokevin/too-wordy","webpack":"^5.91.0","webpack-cli":"^5.1.4","webpack-dev-server":"^5.0.4","write-good":"^1.0.8"},"link":true,"standardx":{"ignore":["build/**","dist/**","examples/**/shaders/*.js","**/vendor/**"]},"keywords":["3d","aframe","cardboard","components","oculus","three","three.js","rift","vive","vr","quest","meta","web-components","webvr","webxr"],"engines":{"node":">= 4.6.0","npm":">= 2.15.9"}}')}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={id:i,exports:{}};return e[i](s,s.exports,n),s.exports}return n.m=e,n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.b=document.baseURI||self.location.href,n.nc=void 0,n(4497)})())); +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.AFRAME=e():t.AFRAME=e()}(self,(()=>(()=>{var t={8167:t=>{var e=Object.prototype.toString;t.exports=function(t){return t.BYTES_PER_ELEMENT&&"[object ArrayBuffer]"===e.call(t.buffer)||Array.isArray(t)}},5734:t=>{t.exports=function(t,e){return"number"==typeof t?t:"number"==typeof e?e:0}},7961:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),n=e[0],i=e[1];return 3*(n+i)/4-i},e.toByteArray=function(t){var e,n,s=a(t),o=s[0],l=s[1],c=new r(function(t,e,n){return 3*(e+n)/4-n}(0,o,l)),h=0,u=l>0?o-4:o;for(n=0;n<u;n+=4)e=i[t.charCodeAt(n)]<<18|i[t.charCodeAt(n+1)]<<12|i[t.charCodeAt(n+2)]<<6|i[t.charCodeAt(n+3)],c[h++]=e>>16&255,c[h++]=e>>8&255,c[h++]=255&e;return 2===l&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,c[h++]=255&e),1===l&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,c[h++]=e>>8&255,c[h++]=255&e),c},e.fromByteArray=function(t){for(var e,i=t.length,r=i%3,s=[],o=16383,a=0,c=i-r;a<c;a+=o)s.push(l(t,a,a+o>c?c:a+o));return 1===r?(e=t[i-1],s.push(n[e>>2]+n[e<<4&63]+"==")):2===r&&(e=(t[i-2]<<8)+t[i-1],s.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),s.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)n[o]=s[o],i[s.charCodeAt(o)]=o;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function l(t,e,i){for(var r,s,o=[],a=e;a<i;a+=3)r=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(n[(s=r)>>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},911:(t,e,n)=>{var i=n(9922).hp;t.exports=function(t,e){if(i.isBuffer(t)&&i.isBuffer(e)){if("function"==typeof t.equals)return t.equals(e);if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}}},9922:(t,e,n)=>{"use strict";const i=n(7961),r=n(1024),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=l,e.IS=50;const o=2147483647;function a(t){if(t>o)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,l.prototype),e}function l(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return c(t,e,n)}function c(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!l.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|f(t,e);let i=a(n);const r=i.write(t,e);return r!==n&&(i=i.slice(0,r)),i}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return p(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return p(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return l.from(i,e,n);const r=function(t){if(l.isBuffer(t)){const e=0|A(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||J(t.length)?a(0):d(t):"Buffer"===t.type&&Array.isArray(t.data)?d(t.data):void 0}(t);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return l.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return h(t),a(t<0?0:0|A(t))}function d(t){const e=t.length<0?0:0|A(t.length),n=a(e);for(let i=0;i<e;i+=1)n[i]=255&t[i];return n}function p(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(i,l.prototype),i}function A(t){if(t>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function f(t,e){if(l.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;let r=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(r)return i?-1:W(t).length;e=(""+e).toLowerCase(),r=!0}}function m(t,e,n){let i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,n);case"utf8":case"utf-8":return M(this,e,n);case"ascii":return I(this,e,n);case"latin1":case"binary":return B(this,e,n);case"base64":return _(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function g(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function v(t,e,n,i,r){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof e&&(e=l.from(e,i)),l.isBuffer(e))return 0===e.length?-1:y(t,e,n,i,r);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,i,r){let s,o=1,a=t.length,l=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,a/=2,l/=2,n/=2}function c(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(r){let i=-1;for(s=n;s<a;s++)if(c(t,s)===c(e,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===l)return i*o}else-1!==i&&(s-=s-i),i=-1}else for(n+l>a&&(n=a-l),s=n;s>=0;s--){let n=!0;for(let i=0;i<l;i++)if(c(t,s+i)!==c(e,i)){n=!1;break}if(n)return s}return-1}function E(t,e,n,i){n=Number(n)||0;const r=t.length-n;i?(i=Number(i))>r&&(i=r):i=r;const s=e.length;let o;for(i>s/2&&(i=s/2),o=0;o<i;++o){const i=parseInt(e.substr(2*o,2),16);if(J(i))return o;t[n+o]=i}return o}function x(t,e,n,i){return X(W(e,t.length-n),t,n,i)}function b(t,e,n,i){return X(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,i)}function C(t,e,n,i){return X(q(e),t,n,i)}function w(t,e,n,i){return X(function(t,e){let n,i,r;const s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)n=t.charCodeAt(o),i=n>>8,r=n%256,s.push(r),s.push(i);return s}(e,t.length-n),t,n,i)}function _(t,e,n){return 0===e&&n===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,n))}function M(t,e,n){n=Math.min(t.length,n);const i=[];let r=e;for(;r<n;){const e=t[r];let s=null,o=e>239?4:e>223?3:e>191?2:1;if(r+o<=n){let n,i,a,l;switch(o){case 1:e<128&&(s=e);break;case 2:n=t[r+1],128==(192&n)&&(l=(31&e)<<6|63&n,l>127&&(s=l));break;case 3:n=t[r+1],i=t[r+2],128==(192&n)&&128==(192&i)&&(l=(15&e)<<12|(63&n)<<6|63&i,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:n=t[r+1],i=t[r+2],a=t[r+3],128==(192&n)&&128==(192&i)&&128==(192&a)&&(l=(15&e)<<18|(63&n)<<12|(63&i)<<6|63&a,l>65535&&l<1114112&&(s=l))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),r+=o}return function(t){const e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);let n="",i=0;for(;i<e;)n+=String.fromCharCode.apply(String,t.slice(i,i+=S));return n}(i)}l.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(t,e,n){return c(t,e,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(t,e,n){return function(t,e,n){return h(t),t<=0?a(t):void 0!==e?"string"==typeof n?a(t).fill(e,n):a(t).fill(e):a(t)}(t,e,n)},l.allocUnsafe=function(t){return u(t)},l.allocUnsafeSlow=function(t){return u(t)},l.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==l.prototype},l.compare=function(t,e){if(Y(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(t)||!l.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,i=e.length;for(let r=0,s=Math.min(n,i);r<s;++r)if(t[r]!==e[r]){n=t[r],i=e[r];break}return n<i?-1:i<n?1:0},l.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return l.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const i=l.allocUnsafe(e);let r=0;for(n=0;n<t.length;++n){let e=t[n];if(Y(e,Uint8Array))r+e.length>i.length?(l.isBuffer(e)||(e=l.from(e)),e.copy(i,r)):Uint8Array.prototype.set.call(i,e,r);else{if(!l.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(i,r)}r+=e.length}return i},l.byteLength=f,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)g(this,e,e+1);return this},l.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},l.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},l.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?M(this,0,t):m.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(t){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===l.compare(this,t)},l.prototype.inspect=function(){let t="";const n=e.IS;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},s&&(l.prototype[s]=l.prototype.inspect),l.prototype.compare=function(t,e,n,i,r){if(Y(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(this===t)return 0;let s=(r>>>=0)-(i>>>=0),o=(n>>>=0)-(e>>>=0);const a=Math.min(s,o),c=this.slice(i,r),h=t.slice(e,n);for(let t=0;t<a;++t)if(c[t]!==h[t]){s=c[t],o=h[t];break}return s<o?-1:o<s?1:0},l.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},l.prototype.indexOf=function(t,e,n){return v(this,t,e,n,!0)},l.prototype.lastIndexOf=function(t,e,n){return v(this,t,e,n,!1)},l.prototype.write=function(t,e,n,i){if(void 0===e)i="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)i=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}const r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return E(this,t,e,n);case"utf8":case"utf-8":return x(this,t,e,n);case"ascii":case"latin1":case"binary":return b(this,t,e,n);case"base64":return C(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const S=4096;function I(t,e,n){let i="";n=Math.min(t.length,n);for(let r=e;r<n;++r)i+=String.fromCharCode(127&t[r]);return i}function B(t,e,n){let i="";n=Math.min(t.length,n);for(let r=e;r<n;++r)i+=String.fromCharCode(t[r]);return i}function T(t,e,n){const i=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>i)&&(n=i);let r="";for(let i=e;i<n;++i)r+=K[t[i]];return r}function R(t,e,n){const i=t.slice(e,n);let r="";for(let t=0;t<i.length-1;t+=2)r+=String.fromCharCode(i[t]+256*i[t+1]);return r}function L(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,n,i,r,s){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||e<s)throw new RangeError('"value" argument is out of bounds');if(n+i>t.length)throw new RangeError("Index out of range")}function P(t,e,n,i,r){z(e,i,r,t,n,7);let s=Number(e&BigInt(4294967295));t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,n}function U(t,e,n,i,r){z(e,i,r,t,n,7);let s=Number(e&BigInt(4294967295));t[n+7]=s,s>>=8,t[n+6]=s,s>>=8,t[n+5]=s,s>>=8,t[n+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=o,o>>=8,t[n+2]=o,o>>=8,t[n+1]=o,o>>=8,t[n]=o,n+8}function O(t,e,n,i,r,s){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(t,e,n,i,s){return e=+e,n>>>=0,s||O(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function k(t,e,n,i,s){return e=+e,n>>>=0,s||O(t,0,n,8),r.write(t,e,n,i,52,8),n+8}l.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const i=this.subarray(t,e);return Object.setPrototypeOf(i,l.prototype),i},l.prototype.readUintLE=l.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let i=this[t],r=1,s=0;for(;++s<e&&(r*=256);)i+=this[t+s]*r;return i},l.prototype.readUintBE=l.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let i=this[t+--e],r=1;for(;e>0&&(r*=256);)i+=this[t+--e]*r;return i},l.prototype.readUint8=l.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readBigUInt64LE=Z((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const i=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,r=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(i)+(BigInt(r)<<BigInt(32))})),l.prototype.readBigUInt64BE=Z((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const i=e*2**24+65536*this[++t]+256*this[++t]+this[++t],r=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(i)<<BigInt(32))+BigInt(r)})),l.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let i=this[t],r=1,s=0;for(;++s<e&&(r*=256);)i+=this[t+s]*r;return r*=128,i>=r&&(i-=Math.pow(2,8*e)),i},l.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let i=e,r=1,s=this[t+--i];for(;i>0&&(r*=256);)s+=this[t+--i]*r;return r*=128,s>=r&&(s-=Math.pow(2,8*e)),s},l.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readBigInt64LE=Z((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const i=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),l.prototype.readBigInt64BE=Z((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const i=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),l.prototype.readFloatLE=function(t,e){return t>>>=0,e||L(t,4,this.length),r.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),r.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),r.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),r.read(this,t,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(t,e,n,i){t=+t,e>>>=0,n>>>=0,i||D(this,t,e,n,Math.pow(2,8*n)-1,0);let r=1,s=0;for(this[e]=255&t;++s<n&&(r*=256);)this[e+s]=t/r&255;return e+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(t,e,n,i){t=+t,e>>>=0,n>>>=0,i||D(this,t,e,n,Math.pow(2,8*n)-1,0);let r=n-1,s=1;for(this[e+r]=255&t;--r>=0&&(s*=256);)this[e+r]=t/s&255;return e+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,1,255,0),this[e]=255&t,e+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},l.prototype.writeBigUInt64LE=Z((function(t,e=0){return P(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=Z((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*n-1);D(this,t,e,n,i-1,-i)}let r=0,s=1,o=0;for(this[e]=255&t;++r<n&&(s*=256);)t<0&&0===o&&0!==this[e+r-1]&&(o=1),this[e+r]=(t/s|0)-o&255;return e+n},l.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*n-1);D(this,t,e,n,i-1,-i)}let r=n-1,s=1,o=0;for(this[e+r]=255&t;--r>=0&&(s*=256);)t<0&&0===o&&0!==this[e+r+1]&&(o=1),this[e+r]=(t/s|0)-o&255;return e+n},l.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},l.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},l.prototype.writeBigInt64LE=Z((function(t,e=0){return P(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=Z((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(t,e,n){return F(this,t,e,!0,n)},l.prototype.writeFloatBE=function(t,e,n){return F(this,t,e,!1,n)},l.prototype.writeDoubleLE=function(t,e,n){return k(this,t,e,!0,n)},l.prototype.writeDoubleBE=function(t,e,n){return k(this,t,e,!1,n)},l.prototype.copy=function(t,e,n,i){if(!l.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);const r=i-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),e),r},l.prototype.fill=function(t,e,n,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){const e=t.charCodeAt(0);("utf8"===i&&e<128||"latin1"===i)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let r;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(r=e;r<n;++r)this[r]=t;else{const s=l.isBuffer(t)?t:l.from(t,i),o=s.length;if(0===o)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(r=0;r<n-e;++r)this[r+e]=s[r%o]}return this};const N={};function Q(t,e,n){N[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function G(t){let e="",n=t.length;const i="-"===t[0]?1:0;for(;n>=i+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function z(t,e,n,i,r,s){if(t>n||t<e){const i="bigint"==typeof e?"n":"";let r;throw r=s>3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${e}${i} and <= ${n}${i}`,new N.ERR_OUT_OF_RANGE("value",r,t)}!function(t,e,n){H(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||V(e,t.length-(n+1))}(i,r,s)}function H(t,e){if("number"!=typeof t)throw new N.ERR_INVALID_ARG_TYPE(e,"number",t)}function V(t,e,n){if(Math.floor(t)!==t)throw H(t,n),new N.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new N.ERR_BUFFER_OUT_OF_BOUNDS;throw new N.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}Q("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),Q("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),Q("ERR_OUT_OF_RANGE",(function(t,e,n){let i=`The value of "${t}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=G(String(n)):"bigint"==typeof n&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=G(r)),r+="n"),i+=` It must be ${e}. Received ${r}`,i}),RangeError);const j=/[^+/0-9A-Za-z-_]/g;function W(t,e){let n;e=e||1/0;const i=t.length;let r=null;const s=[];for(let o=0;o<i;++o){if(n=t.charCodeAt(o),n>55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;s.push(n)}else if(n<2048){if((e-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function q(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(j,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,n,i){let r;for(r=0;r<i&&!(r+n>=e.length||r>=t.length);++r)e[r+n]=t[r];return r}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const K=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const i=16*n;for(let r=0;r<16;++r)e[i+r]=t[n]+t[r]}return e}();function Z(t){return"undefined"==typeof BigInt?$:t}function $(){throw new Error("BigInt not supported")}},9089:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,r,s){"string"==typeof t&&(t=[[null,t,void 0]]);var o={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(o[l]=!0)}for(var c=0;c<t.length;c++){var h=[].concat(t[c]);i&&o[h[0]]||(void 0!==s&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=s),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),e.push(h))}},e}},6492:t=>{"use strict";t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]|(%20)/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t):t}},963:t=>{"use strict";t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),s="/*# ".concat(r," */");return[e].concat([s]).join("\n")}return[e].join("\n")}},8878:(t,e,n)=>{e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let i=0,r=0;e[0].replace(/%[a-zA-Z%]/g,(t=>{"%%"!==t&&(i++,"%c"===t&&(r=i))})),e.splice(r,0,n)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}return!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG),t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=n(8945)(e);const{formatters:i}=t.exports;i.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},8945:(t,e,n)=>{t.exports=function(t){function e(t){let n,r,s,o=null;function a(...t){if(!a.enabled)return;const i=a,r=Number(new Date),s=r-(n||r);i.diff=s,i.prev=n,i.curr=r,n=r,t[0]=e.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let o=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,((n,r)=>{if("%%"===n)return"%";o++;const s=e.formatters[r];if("function"==typeof s){const e=t[o];n=s.call(i,e),t.splice(o,1),o--}return n})),e.formatArgs.call(i,t),(i.log||e.log).apply(i,t)}return a.namespace=t,a.useColors=e.useColors(),a.color=e.selectColor(t),a.extend=i,a.destroy=e.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(r!==e.namespaces&&(r=e.namespaces,s=e.enabled(t)),s),set:t=>{o=t}}),"function"==typeof e.init&&e.init(a),a}function i(t,n){const i=e(this.namespace+(void 0===n?":":n)+t);return i.log=this.log,i}function r(t,e){let n=0,i=0,r=-1,s=0;for(;n<t.length;)if(i<e.length&&(e[i]===t[n]||"*"===e[i]))"*"===e[i]?(r=i,s=n,i++):(n++,i++);else{if(-1===r)return!1;i=r+1,s++,n=s}for(;i<e.length&&"*"===e[i];)i++;return i===e.length}return e.debug=e,e.default=e,e.coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){const t=[...e.names,...e.skips.map((t=>"-"+t))].join(",");return e.enable(""),t},e.enable=function(t){e.save(t),e.namespaces=t,e.names=[],e.skips=[];const n=("string"==typeof t?t:"").trim().replace(" ",",").split(",").filter(Boolean);for(const t of n)"-"===t[0]?e.skips.push(t.slice(1)):e.names.push(t)},e.enabled=function(t){for(const n of e.skips)if(r(t,n))return!1;for(const n of e.names)if(r(t,n))return!0;return!1},e.humanize=n(9192),e.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((n=>{e[n]=t[n]})),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n|=0;return e.colors[Math.abs(n)%e.colors.length]},e.enable(e.load()),e}},1124:(t,e,n)=>{"use strict";var i=n(6240),r=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function o(t,e,n){var s=e[n];if(null!=s){if(r.call(t,n)&&(void 0===t[n]||null===t[n]))throw new TypeError("Cannot convert undefined or null to object ("+n+")");r.call(t,n)&&i(s)?t[n]=a(Object(t[n]),e[n]):t[n]=s}}function a(t,e){if(t===e)return t;for(var n in e=Object(e))r.call(e,n)&&o(t,e,n);if(Object.getOwnPropertySymbols)for(var i=Object.getOwnPropertySymbols(e),a=0;a<i.length;a++)s.call(e,i[a])&&o(t,e,i[a]);return t}t.exports=function(t){t=function(t){if(null==t)throw new TypeError("Sources cannot be null or undefined");return Object(t)}(t);for(var e=1;e<arguments.length;e++)a(t,arguments[e]);return t}},8480:t=>{t.exports=function(t){switch(t){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},919:(t,e,n)=>{var i;i="undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},t.exports=i},1024:(t,e)=>{e.read=function(t,e,n,i,r){var s,o,a=8*r-i-1,l=(1<<a)-1,c=l>>1,h=-7,u=n?r-1:0,d=n?-1:1,p=t[e+u];for(u+=d,s=p&(1<<-h)-1,p>>=-h,h+=a;h>0;s=256*s+t[e+u],u+=d,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=i;h>0;o=256*o+t[e+u],u+=d,h-=8);if(0===s)s=1-c;else{if(s===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),s-=c}return(p?-1:1)*o*Math.pow(2,s-i)},e.write=function(t,e,n,i,r,s){var o,a,l,c=8*s-r-1,h=(1<<c)-1,u=h>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,A=i?1:-1,f=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=h):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(o++,l/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(e*l-1)*Math.pow(2,r),o+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,r),o=0));r>=8;t[n+p]=255&a,p+=A,a/=256,r-=8);for(o=o<<r|a,c+=r;c>0;t[n+p]=255&o,p+=A,o/=256,c-=8);t[n+p-A]|=128*f}},2225:t=>{function e(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}t.exports=function(t){return null!=t&&(e(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&e(t.slice(0,0))}(t)||!!t._isBuffer)}},8847:t=>{t.exports=function(t){if(!t)return!1;var n=e.call(t);return"[object Function]"===n||"function"==typeof t&&"[object RegExp]"!==n||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var e=Object.prototype.toString},6240:t=>{"use strict";t.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},5651:(t,e,n)=>{var i=n(5406),r=n(4597),s=n(5734),o=["x","e","a","o","n","s","r","c","u","m","v","w","z"],a=["m","w"],l=["H","I","N","E","F","K","L","T","U","V","W","X","Y","Z"],c="\t".charCodeAt(0),h=" ".charCodeAt(0);function u(t){this.glyphs=[],this._measure=this.computeMetrics.bind(this),this.update(t)}function d(t){return new Function(["return function "+t+"() {"," return this._"+t,"}"].join("\n"))()}function p(t,e){if(!t.chars||0===t.chars.length)return null;var n=f(t.chars,e);return n>=0?t.chars[n]:null}function A(t,e,n){if(!t.kernings||0===t.kernings.length)return 0;for(var i=t.kernings,r=0;r<i.length;r++){var s=i[r];if(s.first===e&&s.second===n)return s.amount}return 0}function f(t,e,n){for(var i=n=n||0;i<t.length;i++)if(t[i].id===e)return i;return-1}t.exports=function(t){return new u(t)},u.prototype.update=function(t){if(t=r({measure:this._measure},t),this._opt=t,this._opt.tabSize=s(this._opt.tabSize,4),!t.font)throw new Error("must provide a valid bitmap font");var e=this.glyphs,n=t.text||"",a=t.font;this._setupSpaceGlyphs(a);var c=i.lines(n,t),h=t.width||0;e.length=0;var u=c.reduce((function(t,e){return Math.max(t,e.width,h)}),0),d=0,p=0,m=s(t.lineHeight,a.common.lineHeight),g=a.common.base,v=m-g,y=t.letterSpacing||0,E=m*c.length-v,x=function(t){return"center"===t?1:"right"===t?2:0}(this._opt.align);p-=E,this._width=u,this._height=E,this._descender=m-g,this._baseline=g,this._xHeight=function(t){for(var e=0;e<o.length;e++){var n=o[e].charCodeAt(0),i=f(t.chars,n);if(i>=0)return t.chars[i].height}return 0}(a),this._capHeight=function(t){for(var e=0;e<l.length;e++){var n=l[e].charCodeAt(0),i=f(t.chars,n);if(i>=0)return t.chars[i].height}return 0}(a),this._lineHeight=m,this._ascender=m-v-this._xHeight;var b=this;c.forEach((function(t,i){for(var r,s=t.start,o=t.end,l=t.width,c=s;c<o;c++){var h=n.charCodeAt(c),f=b.getGlyph(a,h);if(f){r&&(d+=A(a,r.id,f.id));var g=d;1===x?g+=(u-l)/2:2===x&&(g+=u-l),e.push({position:[g,p],data:f,index:c,line:i}),d+=f.xadvance+y,r=f}}p+=m,d=0})),this._linesTotal=c.length},u.prototype._setupSpaceGlyphs=function(t){if(this._fallbackSpaceGlyph=null,this._fallbackTabGlyph=null,t.chars&&0!==t.chars.length){var e=p(t,h)||function(t){for(var e=0;e<a.length;e++){var n=a[e].charCodeAt(0),i=f(t.chars,n);if(i>=0)return t.chars[i]}return 0}(t)||t.chars[0],n=this._opt.tabSize*e.xadvance;this._fallbackSpaceGlyph=e,this._fallbackTabGlyph=r(e,{x:0,y:0,xadvance:n,id:c,xoffset:0,yoffset:0,width:0,height:0})}},u.prototype.getGlyph=function(t,e){return p(t,e)||(e===c?this._fallbackTabGlyph:e===h?this._fallbackSpaceGlyph:null)},u.prototype.computeMetrics=function(t,e,n,i){var r,s=this._opt.letterSpacing||0,o=this._opt.font,a=0,l=0,c=0;if(!o.chars||0===o.chars.length)return{start:e,end:e,width:0};n=Math.min(t.length,n);for(var h=e;h<n;h++){var u,d=t.charCodeAt(h);if(u=this.getGlyph(o,d)){u.xoffset;var p=(a+=r?A(o,r.id,u.id):0)+u.xadvance+s,f=a+u.width;if(f>=i||p>=i)break;a=p,l=f,r=u}c++}return r&&(l+=r.xoffset),{start:e,end:e+c,width:l}},["width","height","descender","ascender","xHeight","baseline","capHeight","lineHeight"].forEach((function(t){Object.defineProperty(u.prototype,t,{get:d(t),configurable:!0})}))},5751:(t,e,n)=>{var i=n(9922).hp,r=n(3558),s=function(){},o=n(1476),a=n(7034),l=n(7480),c=n(573),h=n(4597),u=self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;t.exports=function(t,e){e="function"==typeof e?e:s,"string"==typeof t?t={uri:t}:t||(t={}),t.binary&&(t=function(t){if(u)return h(t,{responseType:"arraybuffer"});if(void 0===self.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var e=new self.XMLHttpRequest;return e.overrideMimeType("text/plain; charset=x-user-defined"),h({xhr:e},t)}(t)),r(t,(function(n,r,h){if(n)return e(n);if(!/^2/.test(r.statusCode))return e(new Error("http status code: "+r.statusCode));if(!h)return e(new Error("no body result"));var u,d,p=!1;if(u=h,"[object ArrayBuffer]"===Object.prototype.toString.call(u)){var A=new Uint8Array(h);h=i.from(A,"binary")}c(h)&&(p=!0,"string"==typeof h&&(h=i.from(h,"binary"))),p||(i.isBuffer(h)&&(h=h.toString(t.encoding)),h=h.trim());try{var f=r.headers["content-type"];d=p?l(h):/json/.test(f)||"{"===h.charAt(0)?JSON.parse(h):/xml/.test(f)||"<"===h.charAt(0)?a(h):o(h)}catch(t){e(new Error("error parsing font "+t.message)),e=s}e(null,d)}))}},573:(t,e,n)=>{var i=n(9922).hp,r=n(911),s=i.from([66,77,70,3]);t.exports=function(t){return"string"==typeof t?"BMF"===t.substring(0,3):t.length>4&&r(t.slice(0,4),s)}},9192:t=>{var e=1e3,n=60*e,i=60*n,r=24*i,s=7*r;function o(t,e,n,i){var r=e>=1.5*n;return Math.round(t/n)+" "+i+(r?"s":"")}t.exports=function(t,a){a=a||{};var l,c,h=typeof t;if("string"===h&&t.length>0)return function(t){if(!((t=String(t)).length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(o){var a=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return a*s;case"days":case"day":case"d":return a*r;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(t);if("number"===h&&isFinite(t))return a.long?(l=t,(c=Math.abs(l))>=r?o(l,c,r,"day"):c>=i?o(l,c,i,"hour"):c>=n?o(l,c,n,"minute"):c>=e?o(l,c,e,"second"):l+" ms"):function(t){var s=Math.abs(t);return s>=r?Math.round(t/r)+"d":s>=i?Math.round(t/i)+"h":s>=n?Math.round(t/n)+"m":s>=e?Math.round(t/e)+"s":t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},1476:t=>{function e(t,e){if(!(t=t.replace(/\t+/g," ").trim()))return null;var i=t.indexOf(" ");if(-1===i)throw new Error("no named row at line "+e);var r=t.substring(0,i);t=(t=(t=(t=t.substring(i+1)).replace(/letter=[\'\"]\S+[\'\"]/gi,"")).split("=")).map((function(t){return t.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)}));for(var s=[],o=0;o<t.length;o++){var a=t[o];0===o?s.push({key:a[0],data:""}):o===t.length-1?s[s.length-1].data=n(a[0]):(s[s.length-1].data=n(a[0]),s.push({key:a[1],data:""}))}var l={key:r,data:{}};return s.forEach((function(t){l.data[t.key]=t.data})),l}function n(t){return t&&0!==t.length?0===t.indexOf('"')||0===t.indexOf("'")?t.substring(1,t.length-1):-1!==t.indexOf(",")?function(t){return t.split(",").map((function(t){return parseInt(t,10)}))}(t):parseInt(t,10):""}t.exports=function(t){if(!t)throw new Error("no data provided");var n={pages:[],chars:[],kernings:[]},i=(t=t.toString().trim()).split(/\r\n?|\n/g);if(0===i.length)throw new Error("no data in BMFont file");for(var r=0;r<i.length;r++){var s=e(i[r],r);if(s)if("page"===s.key){if("number"!=typeof s.data.id)throw new Error("malformed file at line "+r+" -- needs page id=N");if("string"!=typeof s.data.file)throw new Error("malformed file at line "+r+' -- needs page file="path"');n.pages[s.data.id]=s.data.file}else"chars"===s.key||"kernings"===s.key||("char"===s.key?n.chars.push(s.data):"kerning"===s.key?n.kernings.push(s.data):n[s.key]=s.data)}return n}},7480:t=>{var e=[66,77,70];function n(t,e,n){if(n>e.length-1)return 0;var r=e.readUInt8(n++),s=e.readInt32LE(n);switch(n+=4,r){case 1:t.info=function(t,e){var n={};n.size=t.readInt16LE(e);var r=t.readUInt8(e+2);return n.smooth=r>>7&1,n.unicode=r>>6&1,n.italic=r>>5&1,n.bold=r>>4&1,r>>3&1&&(n.fixedHeight=1),n.charset=t.readUInt8(e+3)||"",n.stretchH=t.readUInt16LE(e+4),n.aa=t.readUInt8(e+6),n.padding=[t.readInt8(e+7),t.readInt8(e+8),t.readInt8(e+9),t.readInt8(e+10)],n.spacing=[t.readInt8(e+11),t.readInt8(e+12)],n.outline=t.readUInt8(e+13),n.face=function(t,e){return i(t,e).toString("utf8")}(t,e+14),n}(e,n);break;case 2:t.common=function(t,e){var n={};return n.lineHeight=t.readUInt16LE(e),n.base=t.readUInt16LE(e+2),n.scaleW=t.readUInt16LE(e+4),n.scaleH=t.readUInt16LE(e+6),n.pages=t.readUInt16LE(e+8),t.readUInt8(e+10),n.packed=0,n.alphaChnl=t.readUInt8(e+11),n.redChnl=t.readUInt8(e+12),n.greenChnl=t.readUInt8(e+13),n.blueChnl=t.readUInt8(e+14),n}(e,n);break;case 3:t.pages=function(t,e,n){for(var r=[],s=i(t,e),o=s.length+1,a=n/o,l=0;l<a;l++)r[l]=t.slice(e,e+s.length).toString("utf8"),e+=o;return r}(e,n,s);break;case 4:t.chars=function(t,e,n){for(var i=[],r=n/20,s=0;s<r;s++){var o={},a=20*s;o.id=t.readUInt32LE(e+0+a),o.x=t.readUInt16LE(e+4+a),o.y=t.readUInt16LE(e+6+a),o.width=t.readUInt16LE(e+8+a),o.height=t.readUInt16LE(e+10+a),o.xoffset=t.readInt16LE(e+12+a),o.yoffset=t.readInt16LE(e+14+a),o.xadvance=t.readInt16LE(e+16+a),o.page=t.readUInt8(e+18+a),o.chnl=t.readUInt8(e+19+a),i[s]=o}return i}(e,n,s);break;case 5:t.kernings=function(t,e,n){for(var i=[],r=n/10,s=0;s<r;s++){var o={},a=10*s;o.first=t.readUInt32LE(e+0+a),o.second=t.readUInt32LE(e+4+a),o.amount=t.readInt16LE(e+8+a),i[s]=o}return i}(e,n,s)}return 5+s}function i(t,e){for(var n=e;n<t.length&&0!==t[n];n++);return t.slice(e,n)}t.exports=function(t){if(t.length<6)throw new Error("invalid buffer length for BMFont");var i=e.every((function(e,n){return t.readUInt8(n)===e}));if(!i)throw new Error("BMFont missing BMF byte header");var r=3;if(t.readUInt8(r++)>3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var s={kernings:[],chars:[]},o=0;o<5;o++)r+=n(s,t,r);return s}},7034:(t,e,n)=>{var i=n(7829),r=n(1896),s={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"};function o(t){var e=function(t){for(var e=[],n=0;n<t.attributes.length;n++)e.push(t.attributes[n]);return e}(t);return e.reduce((function(t,e){var n;return t[(n=e.nodeName,s[n.toLowerCase()]||n)]=e.nodeValue,t}),{})}t.exports=function(t){t=t.toString();var e=r(t),n={pages:[],chars:[],kernings:[]};["info","common"].forEach((function(t){var r=e.getElementsByTagName(t)[0];r&&(n[t]=i(o(r)))}));var s=e.getElementsByTagName("pages")[0];if(!s)throw new Error("malformed file -- no <pages> element");for(var a=s.getElementsByTagName("page"),l=0;l<a.length;l++){var c=a[l],h=parseInt(c.getAttribute("id"),10),u=c.getAttribute("file");if(isNaN(h))throw new Error('malformed file -- page "id" attribute is NaN');if(!u)throw new Error('malformed file -- needs page "file" attribute');n.pages[parseInt(h,10)]=u}return["chars","kernings"].forEach((function(t){var r=e.getElementsByTagName(t)[0];if(r)for(var s=t.substring(0,t.length-1),a=r.getElementsByTagName(s),l=0;l<a.length;l++){var c=a[l];n[t].push(i(o(c)))}})),n}},7829:t=>{var e="chasrset";t.exports=function(t){for(var n in t=Object.assign({},t),e in t&&(t.charset=t[e],delete t[e]),t)"face"!==n&&"charset"!==n&&(t[n]="padding"===n||"spacing"===n?t[n].split(",").map((function(t){return parseInt(t,10)})):parseInt(t[n],10));return t}},3216:t=>{var e=function(t){return t.replace(/^\s+|\s+$/g,"")};t.exports=function(t){if(!t)return{};for(var n,i={},r=e(t).split("\n"),s=0;s<r.length;s++){var o=r[s],a=o.indexOf(":"),l=e(o.slice(0,a)).toLowerCase(),c=e(o.slice(a+1));void 0===i[l]?i[l]=c:(n=i[l],"[object Array]"===Object.prototype.toString.call(n)?i[l].push(c):i[l]=[i[l],c])}return i}},9035:(t,e,n)=>{var i=n(8480),r=n(8167),s=n(2225),o=[0,2,3],a=[2,1,3];t.exports=function(t,e){t&&(r(t)||s(t))||(e=t||{},t=null);for(var n="string"==typeof(e="number"==typeof e?{count:e}:e||{}).type?e.type:"uint16",l="number"==typeof e.count?e.count:1,c=e.start||0,h=!1!==e.clockwise?o:a,u=h[0],d=h[1],p=h[2],A=6*l,f=t||new(i(n))(A),m=0,g=0;m<A;m+=6,g+=4){var v=m+c;f[v+0]=g+0,f[v+1]=g+1,f[v+2]=g+2,f[v+3]=g+u,f[v+4]=g+d,f[v+5]=g+p}return f}},4433:(t,e,n)=>{var i=n(5651),r=n(9035),s=n(7106),o=n(1684);t.exports=function(t){return new a(t)};class a extends THREE.BufferGeometry{constructor(t){super(),"string"==typeof t&&(t={text:t}),this._opt=Object.assign({},t),t&&this.update(t)}update(t){if("string"==typeof t&&(t={text:t}),!(t=Object.assign({},this._opt,t)).font)throw new TypeError("must specify a { font } in options");this.layout=i(t);var e=!1!==t.flipY,n=t.font,o=n.common.scaleW,a=n.common.scaleH,l=this.layout.glyphs.filter((function(t){var e=t.data;return e.width*e.height>0}));this.visibleGlyphs=l;var c=s.positions(l),h=s.uvs(l,o,a,e),u=r([],{clockwise:!0,type:"uint16",count:l.length});if(this.setIndex(u),this.setAttribute("position",new THREE.BufferAttribute(c,2)),this.setAttribute("uv",new THREE.BufferAttribute(h,2)),!t.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(t.multipage){var d=s.pages(l);this.setAttribute("page",new THREE.BufferAttribute(d,1))}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var t=this.attributes.position.array,e=this.attributes.position.itemSize;if(!t||!e||t.length<2)return this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0);o.computeSphere(t,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var t=this.boundingBox,e=this.attributes.position.array,n=this.attributes.position.itemSize;!e||!n||e.length<2?t.makeEmpty():o.computeBox(e,t)}}},1684:t=>{var e={min:[0,0],max:[0,0]};function n(t){var n=t.length/2;e.min[0]=t[0],e.min[1]=t[1],e.max[0]=t[0],e.max[1]=t[1];for(var i=0;i<n;i++){var r=t[2*i+0],s=t[2*i+1];e.min[0]=Math.min(r,e.min[0]),e.min[1]=Math.min(s,e.min[1]),e.max[0]=Math.max(r,e.max[0]),e.max[1]=Math.max(s,e.max[1])}}t.exports.computeBox=function(t,i){n(t),i.min.set(e.min[0],e.min[1],0),i.max.set(e.max[0],e.max[1],0)},t.exports.computeSphere=function(t,i){n(t);var r=e.min[0],s=e.min[1],o=e.max[0]-r,a=e.max[1]-s,l=Math.sqrt(o*o+a*a);i.center.set(r+o/2,s+a/2,0),i.radius=l/2}},7106:t=>{t.exports.pages=function(t){var e=new Float32Array(4*t.length*1),n=0;return t.forEach((function(t){var i=t.data.page||0;e[n++]=i,e[n++]=i,e[n++]=i,e[n++]=i})),e},t.exports.uvs=function(t,e,n,i){var r=new Float32Array(4*t.length*2),s=0;return t.forEach((function(t){var o=t.data,a=o.x+o.width,l=o.y+o.height,c=o.x/e,h=o.y/n,u=a/e,d=l/n;i&&(h=(n-o.y)/n,d=(n-l)/n),r[s++]=c,r[s++]=h,r[s++]=c,r[s++]=d,r[s++]=u,r[s++]=d,r[s++]=u,r[s++]=h})),r},t.exports.positions=function(t){var e=new Float32Array(4*t.length*2),n=0;return t.forEach((function(t){var i=t.data,r=t.position[0]+i.xoffset,s=t.position[1]+i.yoffset,o=i.width,a=i.height;e[n++]=r,e[n++]=s,e[n++]=r,e[n++]=s+a,e[n++]=r+o,e[n++]=s+a,e[n++]=r+o,e[n++]=s})),e}},5406:t=>{var e=/\n/,n=/\s/;function i(t,e,n,i){var r=t.indexOf(e,n);return-1===r||r>i?i:r}function r(t){return n.test(t)}function s(t,e,n,i){return{start:e,end:e+Math.min(i,n-e)}}t.exports=function(e,n){return t.exports.lines(e,n).map((function(t){return e.substring(t.start,t.end)})).join("\n")},t.exports.lines=function(t,n){if(0===(n=n||{}).width&&"nowrap"!==n.mode)return[];t=t||"";var o="number"==typeof n.width?n.width:Number.MAX_VALUE,a=Math.max(0,n.start||0),l="number"==typeof n.end?n.end:t.length,c=n.mode,h=n.measure||s;return"pre"===c?function(t,n,i,r,s){for(var o=[],a=i,l=i;l<r&&l<n.length;l++){var c=n.charAt(l),h=e.test(c);if(h||l===r-1){var u=t(n,a,h?l:l+1,s);o.push(u),a=l+1}}return o}(h,t,a,l,o):function(t,e,n,s,o,a){var l=[],c=o;for("nowrap"===a&&(c=Number.MAX_VALUE);n<s&&n<e.length;){for(var h=i(e,"\n",n,s);n<h&&r(e.charAt(n));)n++;var u=t(e,n,h,c),d=n+(u.end-u.start),p=d+1;if(d<h){for(;d>n&&!r(e.charAt(d));)d--;if(d===n)p>n+1&&p--,d=p;else for(p=d;d>n&&r(e.charAt(d-1));)d--}if(d>=n){var A=t(e,n,d,c);l.push(A)}n=p}return l}(h,t,a,l,o,c)}},3558:(t,e,n)=>{"use strict";var i=n(919),r=n(8847),s=n(3216),o=n(4597);function a(t,e,n){var i=t;return r(e)?(n=e,"string"==typeof t&&(i={uri:t})):i=o(e,{uri:t}),i.callback=n,i}function l(t,e,n){return c(e=a(t,e,n))}function c(t){if(void 0===t.callback)throw new Error("callback argument missing");var e=!1,n=function(n,i,r){e||(e=!0,t.callback(n,i,r))};function i(){var t=void 0;if(t=h.response?h.response:h.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(h),g)try{t=JSON.parse(t)}catch(t){}return t}function r(t){return clearTimeout(u),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,n(t,v)}function o(){if(!c){var e;clearTimeout(u),e=t.useXDR&&void 0===h.status?200:1223===h.status?204:h.status;var r=v,o=null;return 0!==e?(r={body:i(),statusCode:e,method:p,headers:{},url:d,rawRequest:h},h.getAllResponseHeaders&&(r.headers=s(h.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var a,c,h=t.xhr||null;h||(h=t.cors||t.useXDR?new l.XDomainRequest:new l.XMLHttpRequest);var u,d=h.url=t.uri||t.url,p=h.method=t.method||"GET",A=t.body||t.data,f=h.headers=t.headers||{},m=!!t.sync,g=!1,v={body:void 0,headers:{},statusCode:0,method:p,url:d,rawRequest:h};if("json"in t&&!1!==t.json&&(g=!0,f.accept||f.Accept||(f.Accept="application/json"),"GET"!==p&&"HEAD"!==p&&(f["content-type"]||f["Content-Type"]||(f["Content-Type"]="application/json"),A=JSON.stringify(!0===t.json?A:t.json))),h.onreadystatechange=function(){4===h.readyState&&setTimeout(o,0)},h.onload=o,h.onerror=r,h.onprogress=function(){},h.onabort=function(){c=!0},h.ontimeout=r,h.open(p,d,!m,t.username,t.password),m||(h.withCredentials=!!t.withCredentials),!m&&t.timeout>0&&(u=setTimeout((function(){if(!c){c=!0,h.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",r(t)}}),t.timeout)),h.setRequestHeader)for(a in f)f.hasOwnProperty(a)&&h.setRequestHeader(a,f[a]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(h.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(h),h.send(A||null),h}t.exports=l,t.exports.default=l,l.XMLHttpRequest=i.XMLHttpRequest||function(){},l.XDomainRequest="withCredentials"in new l.XMLHttpRequest?l.XMLHttpRequest:i.XDomainRequest,function(t,e){for(var n=0;n<t.length;n++)e(t[n])}(["get","put","post","patch","head","delete"],(function(t){l["delete"===t?"del":t]=function(e,n,i){return(n=a(e,n,i)).method=t.toUpperCase(),c(n)}}))},1896:t=>{t.exports=void 0!==self.DOMParser?function(t){return(new self.DOMParser).parseFromString(t,"application/xml")}:void 0!==self.ActiveXObject&&new self.ActiveXObject("Microsoft.XMLDOM")?function(t){var e=new self.ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e}:function(t){var e=document.createElement("div");return e.innerHTML=t,e}},4597:t=>{t.exports=function(){for(var t={},n=0;n<arguments.length;n++){var i=arguments[n];for(var r in i)e.call(i,r)&&(t[r]=i[r])}return t};var e=Object.prototype.hasOwnProperty},8132:()=>{window.aframeStats=function(t){var e=null,n=t;return{update:function(){var t;e("te").set((t=n.querySelectorAll("*"),Array.prototype.slice.call(t).filter((function(t){return t.isEntity})),t.length)),window.performance.getEntriesByName&&e("lt").set(window.performance.getEntriesByName("render-started")[0].startTime.toFixed(0))},start:function(){},end:function(){},attach:function(t){e=t},values:{te:{caption:"Entities"},lt:{caption:"Load Time"}},groups:[{caption:"A-Frame",values:["te","lt"]}],fractions:[]}}},3729:t=>{window.glStats=function(){var t=null,e=0,n=0,i=0,r=0,s=0,o=0,a=0;function l(t,e){return function(){e.apply(this,arguments),t.apply(this,arguments)}}return WebGLRenderingContext.prototype.drawArrays=l(WebGLRenderingContext.prototype.drawArrays,(function(){e++,arguments[0]==this.POINTS?o+=arguments[2]:s+=arguments[2]})),WebGLRenderingContext.prototype.drawElements=l(WebGLRenderingContext.prototype.drawElements,(function(){n++,r+=arguments[1]/3,s+=arguments[1]})),WebGLRenderingContext.prototype.useProgram=l(WebGLRenderingContext.prototype.useProgram,(function(){i++})),WebGLRenderingContext.prototype.bindTexture=l(WebGLRenderingContext.prototype.bindTexture,(function(){a++})),{update:function(){t("allcalls").set(e+n),t("drawElements").set(n),t("drawArrays").set(e),t("bindTexture").set(a),t("useProgram").set(i),t("glfaces").set(r),t("glvertices").set(s),t("glpoints").set(o)},start:function(){e=0,n=0,i=0,r=0,s=0,o=0,a=0},end:function(){},attach:function(e){t=e},values:{allcalls:{over:3e3,caption:"Calls (hook)"},drawelements:{caption:"drawElements (hook)"},drawarrays:{caption:"drawArrays (hook)"}},groups:[{caption:"WebGL",values:["allcalls","drawelements","drawarrays","useprogram","bindtexture","glfaces","glvertices","glpoints"]}],fractions:[{base:"allcalls",steps:["drawelements","drawarrays"]}]}},window.threeStats=function(t){var e=null;return{update:function(){e("renderer.info.memory.geometries").set(t.info.memory.geometries),e("renderer.info.programs").set(t.info.programs.length),e("renderer.info.memory.textures").set(t.info.memory.textures),e("renderer.info.render.calls").set(t.info.render.calls),e("renderer.info.render.triangles").set(t.info.render.triangles),e("renderer.info.render.points").set(t.info.render.points)},start:function(){},end:function(){},attach:function(t){e=t},values:{"renderer.info.memory.geometries":{caption:"Geometries"},"renderer.info.memory.textures":{caption:"Textures"},"renderer.info.programs":{caption:"Programs"},"renderer.info.render.calls":{caption:"Calls"},"renderer.info.render.triangles":{caption:"Triangles",over:1e3},"renderer.info.render.points":{caption:"Points"}},groups:[{caption:"Three.js - Memory",values:["renderer.info.memory.geometries","renderer.info.programs","renderer.info.memory.textures"]},{caption:"Three.js - Render",values:["renderer.info.render.calls","renderer.info.render.triangles","renderer.info.render.points"]}],fractions:[]}},window.BrowserStats=function(){var t=null,e=0,n=0;window.performance&&!performance.memory&&(performance.memory={usedJSHeapSize:0,totalJSHeapSize:0}),0===performance.memory.totalJSHeapSize&&console.warn("totalJSHeapSize === 0... performance.memory is only available in Chrome .");var i=Math.log(1024);function r(t){var e=Math.floor(Math.log(t)/i);return Math.round(100*t/Math.pow(1024,e))/100}return{update:function(){e=r(performance.memory.usedJSHeapSize),n=r(performance.memory.totalJSHeapSize),t("memory").set(e),t("total").set(n)},start:function(){e=0},end:function(){},attach:function(e){t=e},values:{memory:{caption:"Used Memory",average:!0,avgMs:1e3,over:22},total:{caption:"Total Memory"}},groups:[{caption:"Browser",values:["memory","total"]}],fractions:[{base:"total",steps:["memory"]}]}},t.exports={glStats:window.glStats,threeStats:window.threeStats,BrowserStats:window.BrowserStats}},282:t=>{"use strict";!function(){"performance"in window==0&&(window.performance={});var t=window.performance;if("now"in t==0){var e=Date.now();t.timing&&t.timing.navigationStart&&(e=t.timing.navigationStart),t.now=function(){return Date.now()-e}}t.mark||(t.mark=function(){}),t.measure||(t.measure=function(){})}(),window.rStats=function(t){function e(t,e){for(var n=Object.keys(t),i=0,r=n.length;i<r;i++)e(n[i])}var n=t||{},i=n.colours||["#850700","#c74900","#fcb300","#284280","#4c7c0c"],r=(n.CSSPath?n.CSSPath:"")+"rStats.css";(n.css||["https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300",r]).forEach((function(t){var e,n;e=t,(n=document.createElement("link")).href=e,n.rel="stylesheet",n.type="text/css",document.getElementsByTagName("head")[0].appendChild(n)})),n.values||(n.values={});var s,o,a=10,l={};function c(t,e,n){var i=n||{},r=document.createElement("canvas"),s=r.getContext("2d"),o=0,l=0,c=i.color?i.color:"#666666",h=document.createElement("canvas"),u=h.getContext("2d");h.width=1,h.height=20,u.fillStyle="#444444",u.fillRect(0,0,1,20),u.fillStyle=c,u.fillRect(0,a,1,a),u.fillStyle="#ffffff",u.globalAlpha=.5,u.fillRect(0,a,1,1),u.globalAlpha=1;var d=document.createElement("canvas"),p=d.getContext("2d");return d.width=1,d.height=20,p.fillStyle="#444444",p.fillRect(0,0,1,20),p.fillStyle="#b70000",p.fillRect(0,a,1,a),p.globalAlpha=.5,p.fillStyle="#ffffff",p.fillRect(0,a,1,1),p.globalAlpha=1,r.width=200,r.height=a,r.style.width=r.width+"px",r.style.height=r.height+"px",r.className="rs-canvas",t.appendChild(r),s.fillStyle="#444444",s.fillRect(0,0,r.width,r.height),{draw:function(t,e){(l+=.1*(t-l))>(o*=.99)&&(o=l),s.drawImage(r,1,0,r.width-1,r.height,0,0,r.width-1,r.height),e?s.drawImage(d,r.width-1,r.height-l*r.height/o-a):s.drawImage(h,r.width-1,r.height-l*r.height/o-a)}}}function h(t,n){var r=document.createElement("canvas"),s=r.getContext("2d");return r.width=200,r.height=a*n,r.style.width=r.width+"px",r.style.height=r.height+"px",r.className="rs-canvas",t.appendChild(r),s.fillStyle="#444444",s.fillRect(0,0,r.width,r.height),{draw:function(t){s.drawImage(r,1,0,r.width-1,r.height,0,0,r.width-1,r.height);var n=0;e(t,(function(e){var o=t[e]*r.height;s.fillStyle=i[e],s.fillRect(r.width-1,n,1,o),n+=o}))}}}function u(t,e){var i,r=t,s=0,a=0,l=0,h=0,u=performance.now(),d=0,p=document.createElement("div"),A=document.createElement("span"),f=document.createElement("div"),m=document.createTextNode(""),g=n?n.values[r.toLowerCase()]:null,v=new c(p,r,g),y=!1;function E(t){if(g&&g.average){h+=t,d++;var e=performance.now();e-u>=(g.avgMs||1e3)&&(l=h/d,h=0,u=e,d=0)}}function x(){i=performance.now(),n.userTimingAPI&&performance.mark(r+"-start"),y=!0}function b(){s=performance.now()-i,n.userTimingAPI&&(performance.mark(r+"-end"),y&&performance.measure(r,r+"-start",r+"-end")),E(s)}return A.className="rs-counter-id",A.textContent=g&&g.caption?g.caption:r,f.className="rs-counter-value",f.appendChild(m),p.appendChild(A),p.appendChild(f),e?e.div.appendChild(p):o.appendChild(p),i=performance.now(),{set:function(t){E(s=t)},start:x,tick:function(){b(),x()},end:b,frame:function(){var t=performance.now(),e=t-i;a++,e>1e3&&(s=g&&!1===g.interpolate?a:1e3*a/e,a=0,i=t,E(s))},value:function(){return s},draw:function(){var t=g&&g.average?l:s;m.nodeValue=Math.round(100*t)/100;var e=g&&(g.below&&s<g.below||g.over&&s>g.over);v.draw(s,e),p.className=e?"rs-counter-base alarm":"rs-counter-base"}}}function d(t){var i=t.toLowerCase();if(void 0===i&&(i="default"),l[i])return l[i];var r=null;n&&n.groups&&e(n.groups,(function(t){var e=n.groups[parseInt(t,10)];r||-1===e.values.indexOf(i.toLowerCase())||(r=e)}));var s=new u(i,r);return l[i]=s,s}function p(){e(n.plugins,(function(t){n.plugins[t].update()})),e(l,(function(t){l[t].draw()})),n&&n.fractions&&e(n.fractions,(function(t){var i=n.fractions[parseInt(t,10)],r=[],s=l[i.base.toLowerCase()];s&&(s=s.value(),e(n.fractions[t].steps,(function(e){var i=n.fractions[t].steps[parseInt(e,10)].toLowerCase(),o=l[i];o&&r.push(o.value()/s)}))),i.graph.draw(r)}))}return function(){if(n.plugins){n.values||(n.values={}),n.groups||(n.groups=[]),n.fractions||(n.fractions=[]);for(var t=0;t<n.plugins.length;t++)n.plugins[t].attach(d),e(n.plugins[t].values,(function(e){n.values[e]=n.plugins[t].values[e]})),n.groups=n.groups.concat(n.plugins[t].groups),n.fractions=n.fractions.concat(n.plugins[t].fractions)}else n.plugins={};(s=document.createElement("div")).className="rs-base",(o=document.createElement("div")).className="rs-container",o.style.height="auto",s.appendChild(o),document.body.appendChild(s),n&&(n.groups&&e(n.groups,(function(t){var e=n.groups[parseInt(t,10)],i=document.createElement("div");i.className="rs-group",e.div=i;var r=document.createElement("h1");r.textContent=e.caption,r.addEventListener("click",function(t){this.classList.toggle("hidden"),t.preventDefault()}.bind(i)),o.appendChild(r),o.appendChild(i)})),n.fractions&&e(n.fractions,(function(t){var r=n.fractions[parseInt(t,10)],s=document.createElement("div");s.className="rs-fraction";var l=document.createElement("div");l.className="rs-legend";var c=0;e(n.fractions[t].steps,(function(e){var r=document.createElement("p");r.textContent=n.fractions[t].steps[e],r.style.color=i[c],l.appendChild(r),c++})),s.appendChild(l),s.style.height=c*a+"px",r.div=s;var u=new h(s,c);r.graph=u,o.appendChild(s)})))}(),function(t){return t?d(t):{element:s,update:p}}},t.exports=window.rStats},2535:t=>{var e={base64:function(t,e){return"data:"+t+";base64,"+e},isMobile:function(){var t,e=!1;return t=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0),e},isIOS:function(){return/(iPad|iPhone|iPod)/g.test(navigator.userAgent)},isIFrame:function(){try{return window.self!==window.top}catch(t){return!0}},appendQueryParameter:function(t,e,n){var i=t.indexOf("?")<0?"?":"&";return t+(i+e+"=")+n},getQueryParameter:function(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))},isLandscapeMode:function(){return 90==window.orientation||-90==window.orientation}};t.exports=e},5928:(t,e,n)=>{var i,r=n(2535);t.exports=(i=navigator.userAgent||navigator.vendor||window.opera).match(/iPhone/i)||i.match(/iPod/i)?function(){var t=null;this.request=function(){t||(t=setInterval((function(){window.location.href="/",setTimeout(window.stop,0)}),15e3))},this.release=function(){t&&(clearInterval(t),t=null)}}:function(){var t=document.createElement("video");t.addEventListener("ended",(function(){t.play()})),this.request=function(){t.paused&&(t.src=r.base64("video/webm","GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4ECQoWBAhhTgGcBAAAAAAAH4xFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsggfG7AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU2LjQwLjEwMVdBjUxhdmY1Ni40MC4xMDFzpJAGSJTMbsLpDt/ySkipgX1fRImIQO1MAAAAAAAWVK5rAQAAAAAAADuuAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDmDgQEj44OEO5rKAOABAAAAAAAABrCBsLqBkB9DtnUBAAAAAAAAo+eBAKOmgQAAgKJJg0IAAV4BHsAHBIODCoAACmH2MAAAZxgz4dPSTFi5JACjloED6ACmAECSnABMQAADYAAAWi0quoCjloEH0ACmAECSnABNwAADYAAAWi0quoCjloELuACmAECSnABNgAADYAAAWi0quoCjloEPoACmAECSnABNYAADYAAAWi0quoCjloETiACmAECSnABNIAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTnghdwo5aBAAAApgBAkpwATOAAA2AAAFotKrqAo5aBA+gApgBAkpwATMAAA2AAAFotKrqAo5aBB9AApgBAkpwATIAAA2AAAFotKrqAo5aBC7gApgBAkpwATEAAA2AAAFotKrqAo5aBD6AApgDAkpwAQ2AAA2AAAFotKrqAo5aBE4gApgBAkpwATCAAA2AAAFotKrqAH0O2dQEAAAAAAACU54Iu4KOWgQAAAKYAQJKcAEvAAANgAABaLSq6gKOWgQPoAKYAQJKcAEtgAANgAABaLSq6gKOWgQfQAKYAQJKcAEsAAANgAABaLSq6gKOWgQu4AKYAQJKcAEqAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEogAANgAABaLSq6gKOWgROIAKYAQJKcAEnAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCRlCjloEAAACmAECSnABJgAADYAAAWi0quoCjloED6ACmAECSnABJIAADYAAAWi0quoCjloEH0ACmAMCSnABDYAADYAAAWi0quoCjloELuACmAECSnABI4AADYAAAWi0quoCjloEPoACmAECSnABIoAADYAAAWi0quoCjloETiACmAECSnABIYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngl3Ao5aBAAAApgBAkpwASCAAA2AAAFotKrqAo5aBA+gApgBAkpwASAAAA2AAAFotKrqAo5aBB9AApgBAkpwAR8AAA2AAAFotKrqAo5aBC7gApgBAkpwAR4AAA2AAAFotKrqAo5aBD6AApgBAkpwAR2AAA2AAAFotKrqAo5aBE4gApgBAkpwARyAAA2AAAFotKrqAH0O2dQEAAAAAAACU54J1MKOWgQAAAKYAwJKcAENgAANgAABaLSq6gKOWgQPoAKYAQJKcAEbgAANgAABaLSq6gKOWgQfQAKYAQJKcAEagAANgAABaLSq6gKOWgQu4AKYAQJKcAEaAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEZAAANgAABaLSq6gKOWgROIAKYAQJKcAEYAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCjKCjloEAAACmAECSnABF4AADYAAAWi0quoCjloED6ACmAECSnABFwAADYAAAWi0quoCjloEH0ACmAECSnABFoAADYAAAWi0quoCjloELuACmAECSnABFgAADYAAAWi0quoCjloEPoACmAMCSnABDYAADYAAAWi0quoCjloETiACmAECSnABFYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngqQQo5aBAAAApgBAkpwARUAAA2AAAFotKrqAo5aBA+gApgBAkpwARSAAA2AAAFotKrqAo5aBB9AApgBAkpwARQAAA2AAAFotKrqAo5aBC7gApgBAkpwARQAAA2AAAFotKrqAo5aBD6AApgBAkpwAROAAA2AAAFotKrqAo5aBE4gApgBAkpwARMAAA2AAAFotKrqAH0O2dQEAAAAAAACU54K7gKOWgQAAAKYAQJKcAESgAANgAABaLSq6gKOWgQPoAKYAQJKcAESAAANgAABaLSq6gKOWgQfQAKYAwJKcAENgAANgAABaLSq6gKOWgQu4AKYAQJKcAERgAANgAABaLSq6gKOWgQ+gAKYAQJKcAERAAANgAABaLSq6gKOWgROIAKYAQJKcAEQgAANgAABaLSq6gB9DtnUBAAAAAAAAlOeC0vCjloEAAACmAECSnABEIAADYAAAWi0quoCjloED6ACmAECSnABEAAADYAAAWi0quoCjloEH0ACmAECSnABD4AADYAAAWi0quoCjloELuACmAECSnABDwAADYAAAWi0quoCjloEPoACmAECSnABDoAADYAAAWi0quoCjloETiACmAECSnABDgAADYAAAWi0quoAcU7trAQAAAAAAABG7j7OBALeK94EB8YIBd/CBAw=="),t.play())},this.release=function(){t.pause(),t.src=""}}},8217:(t,e,n)=>{"use strict";n.d(e,{A:()=>E});var i=n(963),r=n.n(i),s=n(9089),o=n.n(s),a=n(6492),l=n.n(a),c=new URL(n(9169),n.b),h=new URL(n(6085),n.b),u=new URL(n(3931),n.b),d=new URL(n(7889),n.b),p=new URL(n(6517),n.b),A=o()(r()),f=l()(c),m=l()(h),g=l()(u),v=l()(d),y=l()(p);A.push([t.id,`/* .a-fullscreen means not embedded. */\nhtml.a-fullscreen {\n bottom: 0;\n left: 0;\n position: fixed;\n right: 0;\n top: 0;\n}\n\nhtml.a-fullscreen body {\n height: 100%;\n margin: 0;\n overflow: hidden;\n padding: 0;\n width: 100%;\n}\n\n/* Class is removed when doing <a-scene embedded>. */\nhtml.a-fullscreen .a-canvas {\n width: 100% !important;\n height: 100% !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n position: fixed !important;\n}\n\nhtml:not(.a-fullscreen) .a-enter-vr,\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 5px;\n bottom: 5px;\n}\n\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 60px;\n}\n\n/* In chrome mobile the user agent stylesheet set it to white */\n:-webkit-full-screen {\n background-color: transparent;\n}\n\n.a-hidden {\n display: none !important;\n}\n\n.a-canvas {\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.a-canvas.a-grab-cursor:hover {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\ncanvas.a-canvas.a-mouse-cursor-hover:hover {\n cursor: pointer;\n}\n\n.a-inspector-loader {\n background-color: #ed3160;\n position: fixed;\n left: 3px;\n top: 3px;\n padding: 6px 10px;\n color: #fff;\n text-decoration: none;\n font-size: 12px;\n font-family: Roboto,sans-serif;\n text-align: center;\n z-index: 99999;\n width: 204px;\n}\n\n/* Inspector loader animation */\n@keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n@-webkit-keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@-webkit-keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@-webkit-keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n\n.a-inspector-loader .dots span {\n animation: dots-1 2s infinite steps(1);\n -webkit-animation: dots-1 2s infinite steps(1);\n}\n\n.a-inspector-loader .dots span:first-child + span {\n animation-name: dots-2;\n -webkit-animation-name: dots-2;\n}\n\n.a-inspector-loader .dots span:first-child + span + span {\n animation-name: dots-3;\n -webkit-animation-name: dots-3;\n}\n\na-scene {\n display: block;\n position: relative;\n height: 100%;\n width: 100%;\n}\n\na-assets,\na-scene video,\na-scene img,\na-scene audio {\n display: none;\n}\n\n.a-enter-vr-modal,\n.a-orientation-modal {\n font-family: Consolas, Andale Mono, Courier New, monospace;\n}\n\n.a-enter-vr-modal a {\n border-bottom: 1px solid #fff;\n padding: 2px 0;\n text-decoration: none;\n transition: .1s color ease-in;\n}\n\n.a-enter-vr-modal a:hover {\n background-color: #fff;\n color: #111;\n padding: 2px 4px;\n position: relative;\n left: -4px;\n}\n\n.a-enter-vr,\n.a-enter-ar {\n font-family: sans-serif, monospace;\n font-size: 13px;\n width: 100%;\n font-weight: 200;\n line-height: 16px;\n position: absolute;\n right: 20px;\n bottom: 20px;\n}\n\n.a-enter-ar.xr {\n right: 90px;\n}\n\n.a-enter-vr-button,\n.a-enter-vr-modal,\n.a-enter-vr-modal a {\n color: #fff;\n user-select: none;\n outline: none;\n}\n\n.a-enter-vr-button {\n background: rgba(0, 0, 0, 0.35) url(${f}) 50% 50% no-repeat;\n}\n\n.a-enter-ar-button {\n background: rgba(0, 0, 0, 0.20) url(${m}) 50% 50% no-repeat;\n}\n\n.a-enter-vr.fullscreen .a-enter-vr-button {\n background-image: url(${g});\n}\n\n.a-enter-vr-button,\n.a-enter-ar-button {\n background-size: 90% 90%;\n border: 0;\n bottom: 0;\n cursor: pointer;\n min-width: 58px;\n min-height: 34px;\n /* 1.74418604651 */\n /*\n In order to keep the aspect ratio when resizing\n padding-top percentages are relative to the containing block's width.\n http://stackoverflow.com/questions/12121090/responsively-change-div-size-keeping-aspect-ratio\n */\n padding-right: 0;\n padding-top: 0;\n position: absolute;\n right: 0;\n transition: background-color .05s ease;\n -webkit-transition: background-color .05s ease;\n z-index: 9999;\n border-radius: 8px;\n touch-action: manipulation; /* Prevent iOS double tap zoom on the button */\n}\n\n.a-enter-ar-button {\n background-size: 100% 90%;\n border-radius: 7px;\n}\n\n.a-enter-ar-button:active,\n.a-enter-ar-button:hover,\n.a-enter-vr-button:active,\n.a-enter-vr-button:hover {\n background-color: #ef2d5e;\n}\n\n.a-enter-vr-button.resethover {\n background-color: rgba(0, 0, 0, 0.35);\n}\n\n.a-enter-vr-modal {\n background-color: #666;\n border-radius: 0;\n display: none;\n min-height: 32px;\n margin-right: 70px;\n padding: 9px;\n width: 280px;\n right: 2%;\n position: absolute;\n}\n\n.a-enter-vr-modal:after {\n border-bottom: 10px solid transparent;\n border-left: 10px solid #666;\n border-top: 10px solid transparent;\n display: inline-block;\n content: '';\n position: absolute;\n right: -5px;\n top: 5px;\n width: 0;\n height: 0;\n}\n\n.a-enter-vr-modal p,\n.a-enter-vr-modal a {\n display: inline;\n}\n\n.a-enter-vr-modal p {\n margin: 0;\n}\n\n.a-enter-vr-modal p:after {\n content: ' ';\n}\n\n.a-orientation-modal {\n background: rgba(244, 244, 244, 1) url(${v}) center no-repeat;\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-orientation-modal:after {\n color: #666;\n content: "Insert phone into Cardboard holder.";\n display: block;\n position: absolute;\n text-align: center;\n top: 70%;\n transform: translateY(-70%);\n width: 100%;\n}\n\n.a-orientation-modal button {\n background: url(${y}) no-repeat;\n border: none;\n height: 50px;\n text-indent: -9999px;\n width: 50px;\n}\n\n.a-loader-title {\n background-color: rgba(0, 0, 0, 0.6);\n font-family: sans-serif, monospace;\n text-align: center;\n font-size: 20px;\n height: 50px;\n font-weight: 300;\n line-height: 50px;\n position: absolute;\n right: 0px;\n left: 0px;\n top: 0px;\n color: white;\n}\n\n.a-modal {\n position: absolute;\n background: rgba(0, 0, 0, 0.60);\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-dialog {\n position: relative;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n z-index: 199995;\n width: 300px;\n height: 200px;\n background-size: contain;\n background-color: white;\n font-family: sans-serif, monospace;\n font-size: 20px;\n border-radius: 3px;\n padding: 6px;\n}\n\n.a-dialog-text-container {\n width: 100%;\n height: 70%;\n align-self: flex-start;\n display: flex;\n justify-content: center;\n align-content: center;\n flex-direction: column;\n}\n\n.a-dialog-text {\n display: inline-block;\n font-weight: normal;\n font-size: 14pt;\n margin: 8px;\n}\n\n.a-dialog-buttons-container {\n display: inline-flex;\n align-self: flex-end;\n width: 100%;\n height: 30%;\n}\n\n.a-dialog-button {\n cursor: pointer;\n align-self: center;\n opacity: 0.9;\n height: 80%;\n width: 50%;\n font-size: 12pt;\n margin: 4px;\n border-radius: 2px;\n text-align:center;\n border: none;\n display: inline-block;\n -webkit-transition: all 0.25s ease-in-out;\n transition: all 0.25s ease-in-out;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.20);\n user-select: none;\n}\n\n.a-dialog-permission-button:hover {\n box-shadow: 0 7px 14px rgba(0,0,0,0.20), 0 2px 2px rgba(0,0,0,0.20);\n}\n\n.a-dialog-allow-button {\n background-color: #00ceff;\n}\n\n.a-dialog-deny-button {\n background-color: #ff005b;\n}\n\n.a-dialog-ok-button {\n background-color: #00ceff;\n width: 100%;\n}\n\n.a-dom-overlay:not(.a-no-style) {\n overflow: hidden;\n position: absolute;\n pointer-events: none;\n box-sizing: border-box;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n padding: 1em;\n}\n\n.a-dom-overlay:not(.a-no-style)>* {\n pointer-events: auto;\n}\n`,"",{version:3,sources:["webpack://./src/style/aframe.css"],names:[],mappings:"AAAA,sCAAsC;AACtC;EACE,SAAS;EACT,OAAO;EACP,eAAe;EACf,QAAQ;EACR,MAAM;AACR;;AAEA;EACE,YAAY;EACZ,SAAS;EACT,gBAAgB;EAChB,UAAU;EACV,WAAW;AACb;;AAEA,oDAAoD;AACpD;EACE,sBAAsB;EACtB,uBAAuB;EACvB,iBAAiB;EACjB,kBAAkB;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,0BAA0B;AAC5B;;AAEA;;EAEE,UAAU;EACV,WAAW;AACb;;AAEA;EACE,WAAW;AACb;;AAEA,gEAAgE;AAChE;EACE,6BAA6B;AAC/B;;AAEA;EACE,wBAAwB;AAC1B;;AAEA;EACE,YAAY;EACZ,OAAO;EACP,kBAAkB;EAClB,MAAM;EACN,WAAW;AACb;;AAEA;EACE,YAAY;EACZ,iBAAiB;EACjB,oBAAoB;AACtB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,yBAAyB;EACzB,eAAe;EACf,SAAS;EACT,QAAQ;EACR,iBAAiB;EACjB,WAAW;EACX,qBAAqB;EACrB,eAAe;EACf,8BAA8B;EAC9B,kBAAkB;EAClB,cAAc;EACd,YAAY;AACd;;AAEA,+BAA+B;AAC/B,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AACrE,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AACrE,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;;AAErE;EACE,sCAAsC;EACtC,8CAA8C;AAChD;;AAEA;EACE,sBAAsB;EACtB,8BAA8B;AAChC;;AAEA;EACE,sBAAsB;EACtB,8BAA8B;AAChC;;AAEA;EACE,cAAc;EACd,kBAAkB;EAClB,YAAY;EACZ,WAAW;AACb;;AAEA;;;;EAIE,aAAa;AACf;;AAEA;;EAEE,0DAA0D;AAC5D;;AAEA;EACE,6BAA6B;EAC7B,cAAc;EACd,qBAAqB;EACrB,6BAA6B;AAC/B;;AAEA;EACE,sBAAsB;EACtB,WAAW;EACX,gBAAgB;EAChB,kBAAkB;EAClB,UAAU;AACZ;;AAEA;;EAEE,kCAAkC;EAClC,eAAe;EACf,WAAW;EACX,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EAClB,WAAW;EACX,YAAY;AACd;;AAEA;EACE,WAAW;AACb;;AAEA;;;EAGE,WAAW;EACX,iBAAiB;EACjB,aAAa;AACf;;AAEA;EACE,yFAA4qB;AAC9qB;;AAEA;EACE,yFAAkzB;AACpzB;;AAEA;EACE,yDAA2qK;AAC7qK;;AAEA;;EAEE,wBAAwB;EACxB,SAAS;EACT,SAAS;EACT,eAAe;EACf,eAAe;EACf,gBAAgB;EAChB,kBAAkB;EAClB;;;;GAIC;EACD,gBAAgB;EAChB,cAAc;EACd,kBAAkB;EAClB,QAAQ;EACR,sCAAsC;EACtC,8CAA8C;EAC9C,aAAa;EACb,kBAAkB;EAClB,0BAA0B,EAAE,8CAA8C;AAC5E;;AAEA;EACE,yBAAyB;EACzB,kBAAkB;AACpB;;AAEA;;;;EAIE,yBAAyB;AAC3B;;AAEA;EACE,qCAAqC;AACvC;;AAEA;EACE,sBAAsB;EACtB,gBAAgB;EAChB,aAAa;EACb,gBAAgB;EAChB,kBAAkB;EAClB,YAAY;EACZ,YAAY;EACZ,SAAS;EACT,kBAAkB;AACpB;;AAEA;EACE,qCAAqC;EACrC,4BAA4B;EAC5B,kCAAkC;EAClC,qBAAqB;EACrB,WAAW;EACX,kBAAkB;EAClB,WAAW;EACX,QAAQ;EACR,QAAQ;EACR,SAAS;AACX;;AAEA;;EAEE,eAAe;AACjB;;AAEA;EACE,SAAS;AACX;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,2FAAivF;EACjvF,wBAAwB;EACxB,SAAS;EACT,eAAe;EACf,gBAAgB;EAChB,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,eAAe;EACf,MAAM;EACN,gBAAgB;AAClB;;AAEA;EACE,WAAW;EACX,8CAA8C;EAC9C,cAAc;EACd,kBAAkB;EAClB,kBAAkB;EAClB,QAAQ;EACR,2BAA2B;EAC3B,WAAW;AACb;;AAEA;EACE,6DAA25B;EAC35B,YAAY;EACZ,YAAY;EACZ,oBAAoB;EACpB,WAAW;AACb;;AAEA;EACE,oCAAoC;EACpC,kCAAkC;EAClC,kBAAkB;EAClB,eAAe;EACf,YAAY;EACZ,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EAClB,UAAU;EACV,SAAS;EACT,QAAQ;EACR,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,+BAA+B;EAC/B,wBAAwB;EACxB,SAAS;EACT,eAAe;EACf,gBAAgB;EAChB,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,eAAe;EACf,MAAM;EACN,gBAAgB;AAClB;;AAEA;EACE,kBAAkB;EAClB,SAAS;EACT,QAAQ;EACR,gCAAgC;EAChC,eAAe;EACf,YAAY;EACZ,aAAa;EACb,wBAAwB;EACxB,uBAAuB;EACvB,kCAAkC;EAClC,eAAe;EACf,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,WAAW;EACX,WAAW;EACX,sBAAsB;EACtB,aAAa;EACb,uBAAuB;EACvB,qBAAqB;EACrB,sBAAsB;AACxB;;AAEA;EACE,qBAAqB;EACrB,mBAAmB;EACnB,eAAe;EACf,WAAW;AACb;;AAEA;EACE,oBAAoB;EACpB,oBAAoB;EACpB,WAAW;EACX,WAAW;AACb;;AAEA;EACE,eAAe;EACf,kBAAkB;EAClB,YAAY;EACZ,WAAW;EACX,UAAU;EACV,eAAe;EACf,WAAW;EACX,kBAAkB;EAClB,iBAAiB;EACjB,YAAY;EACZ,qBAAqB;EACrB,yCAAyC;EACzC,iCAAiC;EACjC,wEAAwE;EACxE,iBAAiB;AACnB;;AAEA;EACE,mEAAmE;AACrE;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,yBAAyB;EACzB,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,oBAAoB;EACpB,sBAAsB;EACtB,SAAS;EACT,OAAO;EACP,QAAQ;EACR,MAAM;EACN,YAAY;AACd;;AAEA;EACE,oBAAoB;AACtB",sourcesContent:["/* .a-fullscreen means not embedded. */\nhtml.a-fullscreen {\n bottom: 0;\n left: 0;\n position: fixed;\n right: 0;\n top: 0;\n}\n\nhtml.a-fullscreen body {\n height: 100%;\n margin: 0;\n overflow: hidden;\n padding: 0;\n width: 100%;\n}\n\n/* Class is removed when doing <a-scene embedded>. */\nhtml.a-fullscreen .a-canvas {\n width: 100% !important;\n height: 100% !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n position: fixed !important;\n}\n\nhtml:not(.a-fullscreen) .a-enter-vr,\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 5px;\n bottom: 5px;\n}\n\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 60px;\n}\n\n/* In chrome mobile the user agent stylesheet set it to white */\n:-webkit-full-screen {\n background-color: transparent;\n}\n\n.a-hidden {\n display: none !important;\n}\n\n.a-canvas {\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.a-canvas.a-grab-cursor:hover {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\ncanvas.a-canvas.a-mouse-cursor-hover:hover {\n cursor: pointer;\n}\n\n.a-inspector-loader {\n background-color: #ed3160;\n position: fixed;\n left: 3px;\n top: 3px;\n padding: 6px 10px;\n color: #fff;\n text-decoration: none;\n font-size: 12px;\n font-family: Roboto,sans-serif;\n text-align: center;\n z-index: 99999;\n width: 204px;\n}\n\n/* Inspector loader animation */\n@keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n@-webkit-keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@-webkit-keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@-webkit-keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n\n.a-inspector-loader .dots span {\n animation: dots-1 2s infinite steps(1);\n -webkit-animation: dots-1 2s infinite steps(1);\n}\n\n.a-inspector-loader .dots span:first-child + span {\n animation-name: dots-2;\n -webkit-animation-name: dots-2;\n}\n\n.a-inspector-loader .dots span:first-child + span + span {\n animation-name: dots-3;\n -webkit-animation-name: dots-3;\n}\n\na-scene {\n display: block;\n position: relative;\n height: 100%;\n width: 100%;\n}\n\na-assets,\na-scene video,\na-scene img,\na-scene audio {\n display: none;\n}\n\n.a-enter-vr-modal,\n.a-orientation-modal {\n font-family: Consolas, Andale Mono, Courier New, monospace;\n}\n\n.a-enter-vr-modal a {\n border-bottom: 1px solid #fff;\n padding: 2px 0;\n text-decoration: none;\n transition: .1s color ease-in;\n}\n\n.a-enter-vr-modal a:hover {\n background-color: #fff;\n color: #111;\n padding: 2px 4px;\n position: relative;\n left: -4px;\n}\n\n.a-enter-vr,\n.a-enter-ar {\n font-family: sans-serif, monospace;\n font-size: 13px;\n width: 100%;\n font-weight: 200;\n line-height: 16px;\n position: absolute;\n right: 20px;\n bottom: 20px;\n}\n\n.a-enter-ar.xr {\n right: 90px;\n}\n\n.a-enter-vr-button,\n.a-enter-vr-modal,\n.a-enter-vr-modal a {\n color: #fff;\n user-select: none;\n outline: none;\n}\n\n.a-enter-vr-button {\n background: rgba(0, 0, 0, 0.35) url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-vrmode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M68.81,21.56H64.23v8.27h4.58a4.13,4.13,0,0,0,3.1-1.09,4.2,4.2,0,0,0,1-3,4.24,4.24,0,0,0-1-3A4.05,4.05,0,0,0,68.81,21.56Z' fill='%23fff'/%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0ZM41.9,46H34L24,16h8l6,21.84,6-21.84H52Zm39.29,0H73.44L68.15,35.39H64.23V46H57V16H68.81q5.32,0,8.34,2.37a8,8,0,0,1,3,6.69,9.68,9.68,0,0,1-1.27,5.18,8.9,8.9,0,0,1-4,3.34l6.26,12.11Z' fill='%23fff'/%3E%3C/svg%3E\") 50% 50% no-repeat;\n}\n\n.a-enter-ar-button {\n background: rgba(0, 0, 0, 0.20) url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0Zm8,50a8,8,0,0,1-8,8H12a8,8,0,0,1-8-8V12a8,8,0,0,1,8-8H96a8,8,0,0,1,8,8Z' fill='%23fff'/%3E%3Cpath d='M43.35,39.82H32.51L30.45,46H23.88L35,16h5.73L52,46H45.43Zm-9.17-5h7.5L37.91,23.58Z' fill='%23fff'/%3E%3Cpath d='M68.11,35H63.18V46H57V16H68.15q5.31,0,8.2,2.37a8.18,8.18,0,0,1,2.88,6.7,9.22,9.22,0,0,1-1.33,5.12,9.09,9.09,0,0,1-4,3.26l6.49,12.26V46H73.73Zm-4.93-5h5a5.09,5.09,0,0,0,3.6-1.18,4.21,4.21,0,0,0,1.28-3.27,4.56,4.56,0,0,0-1.2-3.34A5,5,0,0,0,68.15,21h-5Z' fill='%23fff'/%3E%3C/svg%3E\") 50% 50% no-repeat;\n}\n\n.a-enter-vr.fullscreen .a-enter-vr-button {\n background-image: url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8' standalone='no'%3F%3E%3Csvg width='108' height='62' viewBox='0 0 108 62' version='1.1' id='svg320' sodipodi:docname='fullscreen-aframe.svg' xml:space='preserve' inkscape:version='1.2.1 (9c6d41e 2022-07-14)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3E%3Cdefs id='defs324' /%3E%3Csodipodi:namedview id='namedview322' pagecolor='%23ffffff' bordercolor='%23000000' borderopacity='0.25' inkscape:showpageshadow='2' inkscape:pageopacity='0.0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23d1d1d1' showgrid='false' inkscape:zoom='3.8064516' inkscape:cx='91.423729' inkscape:cy='-1.4449153' inkscape:window-width='1440' inkscape:window-height='847' inkscape:window-x='32' inkscape:window-y='25' inkscape:window-maximized='0' inkscape:current-layer='svg320' /%3E%3Ctitle id='title312'%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M96 0H12A12 12 0 0 0 0 12V50A12 12 0 0 0 12 62H96a12 12 0 0 0 12-12V12A12 12 0 0 0 96 0Zm8 50a8 8 0 0 1-8 8H12a8 8 0 0 1-8-8V12a8 8 0 0 1 8-8H96a8 8 0 0 1 8 8Z' fill='%23fff' id='path314' style='fill:%23ffffff' /%3E%3Cg id='g356' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g358' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g360' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g362' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g364' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g366' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g368' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g370' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g372' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g374' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g376' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g378' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g380' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g382' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g384' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cmetadata id='metadata561'%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=''%3E%3Cdc:title%3Eaframe-armode-noborder-reduced-tracking%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cpath d='m 98.168511 40.083649 c 0 -1.303681 -0.998788 -2.358041 -2.239389 -2.358041 -1.230088 0.0031 -2.240892 1.05436 -2.240892 2.358041 v 4.881296 l -9.041661 -9.041662 c -0.874129 -0.875631 -2.288954 -0.875631 -3.16308 0 -0.874129 0.874126 -0.874129 2.293459 0 3.167585 l 8.995101 8.992101 h -4.858767 c -1.323206 0.0031 -2.389583 1.004796 -2.389583 2.239386 0 1.237598 1.066377 2.237888 2.389583 2.237888 h 10.154599 c 1.323206 0 2.388082 -0.998789 2.392587 -2.237888 -0.0044 -0.03305 -0.009 -0.05858 -0.0134 -0.09161 0.0046 -0.04207 0.0134 -0.08712 0.0134 -0.13066 V 40.085172 h -1.52e-4' id='path596' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 23.091002 35.921781 -9.026643 9.041662 v -4.881296 c 0 -1.303681 -1.009302 -2.355037 -2.242393 -2.358041 -1.237598 0 -2.237888 1.05436 -2.237888 2.358041 l -0.0031 10.016421 c 0 0.04356 0.01211 0.08862 0.0015 0.130659 -0.0031 0.03153 -0.009 0.05709 -0.01211 0.09161 0.0031 1.239099 1.069379 2.237888 2.391085 2.237888 h 10.156101 c 1.320202 0 2.388079 -1.000291 2.388079 -2.237888 0 -1.234591 -1.067877 -2.236383 -2.388079 -2.239387 h -4.858767 l 8.995101 -8.9921 c 0.871126 -0.874127 0.871126 -2.293459 0 -3.167586 -0.875628 -0.877132 -2.291957 -0.877132 -3.169087 -1.52e-4' id='path598' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 84.649572 25.978033 9.041662 -9.041664 v 4.881298 c 0 1.299176 1.010806 2.350532 2.240891 2.355037 1.240601 0 2.23939 -1.055861 2.23939 -2.355037 V 11.798242 c 0 -0.04356 -0.009 -0.08862 -0.0134 -0.127671 0.0044 -0.03153 0.009 -0.06157 0.0134 -0.09313 -0.0044 -1.240598 -1.069379 -2.2393873 -2.391085 -2.2393873 h -10.1546 c -1.323205 0 -2.38958 0.9987893 -2.38958 2.2393873 0 1.233091 1.066375 2.237887 2.38958 2.240891 h 4.858768 l -8.995102 8.9921 c -0.874129 0.872625 -0.874129 2.288954 0 3.161578 0.874127 0.880137 2.288951 0.880137 3.16308 1.5e-4' id='path600' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 17.264988 13.822853 h 4.857265 c 1.320202 -0.0031 2.388079 -1.0078 2.388079 -2.240889 0 -1.240601 -1.067877 -2.2393893 -2.388079 -2.2393893 H 11.967654 c -1.321707 0 -2.388082 0.9987883 -2.391085 2.2393893 0.0031 0.03153 0.009 0.06157 0.01211 0.09313 -0.0031 0.03905 -0.0015 0.08262 -0.0015 0.127671 l 0.0031 10.020926 c 0 1.299176 1.00029 2.355038 2.237887 2.355038 1.233092 -0.0044 2.242393 -1.055862 2.242393 -2.355038 v -4.881295 l 9.026644 9.041661 c 0.877132 0.878635 2.293459 0.878635 3.169087 0 0.871125 -0.872624 0.871125 -2.288953 0 -3.161577 l -8.995282 -8.993616' id='path602' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3C/svg%3E\");\n}\n\n.a-enter-vr-button,\n.a-enter-ar-button {\n background-size: 90% 90%;\n border: 0;\n bottom: 0;\n cursor: pointer;\n min-width: 58px;\n min-height: 34px;\n /* 1.74418604651 */\n /*\n In order to keep the aspect ratio when resizing\n padding-top percentages are relative to the containing block's width.\n http://stackoverflow.com/questions/12121090/responsively-change-div-size-keeping-aspect-ratio\n */\n padding-right: 0;\n padding-top: 0;\n position: absolute;\n right: 0;\n transition: background-color .05s ease;\n -webkit-transition: background-color .05s ease;\n z-index: 9999;\n border-radius: 8px;\n touch-action: manipulation; /* Prevent iOS double tap zoom on the button */\n}\n\n.a-enter-ar-button {\n background-size: 100% 90%;\n border-radius: 7px;\n}\n\n.a-enter-ar-button:active,\n.a-enter-ar-button:hover,\n.a-enter-vr-button:active,\n.a-enter-vr-button:hover {\n background-color: #ef2d5e;\n}\n\n.a-enter-vr-button.resethover {\n background-color: rgba(0, 0, 0, 0.35);\n}\n\n.a-enter-vr-modal {\n background-color: #666;\n border-radius: 0;\n display: none;\n min-height: 32px;\n margin-right: 70px;\n padding: 9px;\n width: 280px;\n right: 2%;\n position: absolute;\n}\n\n.a-enter-vr-modal:after {\n border-bottom: 10px solid transparent;\n border-left: 10px solid #666;\n border-top: 10px solid transparent;\n display: inline-block;\n content: '';\n position: absolute;\n right: -5px;\n top: 5px;\n width: 0;\n height: 0;\n}\n\n.a-enter-vr-modal p,\n.a-enter-vr-modal a {\n display: inline;\n}\n\n.a-enter-vr-modal p {\n margin: 0;\n}\n\n.a-enter-vr-modal p:after {\n content: ' ';\n}\n\n.a-orientation-modal {\n background: rgba(244, 244, 244, 1) url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E) center no-repeat;\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-orientation-modal:after {\n color: #666;\n content: \"Insert phone into Cardboard holder.\";\n display: block;\n position: absolute;\n text-align: center;\n top: 70%;\n transform: translateY(-70%);\n width: 100%;\n}\n\n.a-orientation-modal button {\n background: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E) no-repeat;\n border: none;\n height: 50px;\n text-indent: -9999px;\n width: 50px;\n}\n\n.a-loader-title {\n background-color: rgba(0, 0, 0, 0.6);\n font-family: sans-serif, monospace;\n text-align: center;\n font-size: 20px;\n height: 50px;\n font-weight: 300;\n line-height: 50px;\n position: absolute;\n right: 0px;\n left: 0px;\n top: 0px;\n color: white;\n}\n\n.a-modal {\n position: absolute;\n background: rgba(0, 0, 0, 0.60);\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-dialog {\n position: relative;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n z-index: 199995;\n width: 300px;\n height: 200px;\n background-size: contain;\n background-color: white;\n font-family: sans-serif, monospace;\n font-size: 20px;\n border-radius: 3px;\n padding: 6px;\n}\n\n.a-dialog-text-container {\n width: 100%;\n height: 70%;\n align-self: flex-start;\n display: flex;\n justify-content: center;\n align-content: center;\n flex-direction: column;\n}\n\n.a-dialog-text {\n display: inline-block;\n font-weight: normal;\n font-size: 14pt;\n margin: 8px;\n}\n\n.a-dialog-buttons-container {\n display: inline-flex;\n align-self: flex-end;\n width: 100%;\n height: 30%;\n}\n\n.a-dialog-button {\n cursor: pointer;\n align-self: center;\n opacity: 0.9;\n height: 80%;\n width: 50%;\n font-size: 12pt;\n margin: 4px;\n border-radius: 2px;\n text-align:center;\n border: none;\n display: inline-block;\n -webkit-transition: all 0.25s ease-in-out;\n transition: all 0.25s ease-in-out;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.20);\n user-select: none;\n}\n\n.a-dialog-permission-button:hover {\n box-shadow: 0 7px 14px rgba(0,0,0,0.20), 0 2px 2px rgba(0,0,0,0.20);\n}\n\n.a-dialog-allow-button {\n background-color: #00ceff;\n}\n\n.a-dialog-deny-button {\n background-color: #ff005b;\n}\n\n.a-dialog-ok-button {\n background-color: #00ceff;\n width: 100%;\n}\n\n.a-dom-overlay:not(.a-no-style) {\n overflow: hidden;\n position: absolute;\n pointer-events: none;\n box-sizing: border-box;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n padding: 1em;\n}\n\n.a-dom-overlay:not(.a-no-style)>* {\n pointer-events: auto;\n}\n"],sourceRoot:""}]);const E=A},2470:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(963),r=n.n(i),s=n(9089),o=n.n(s)()(r());o.push([t.id,".rs-base {\n background-color: #333;\n color: #fafafa;\n border-radius: 0;\n font: 10px monospace;\n left: 5px;\n line-height: 1em;\n opacity: 0.85;\n overflow: hidden;\n padding: 10px;\n position: fixed;\n top: 5px;\n width: 300px;\n z-index: 10000;\n}\n\n.rs-base div.hidden {\n display: none;\n}\n\n.rs-base h1 {\n color: #fff;\n cursor: pointer;\n font-size: 1.4em;\n font-weight: 300;\n margin: 0 0 5px;\n padding: 0;\n}\n\n.rs-group {\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n -webkit-flex-direction: column-reverse;\n flex-direction: column-reverse;\n margin-bottom: 5px;\n}\n\n.rs-group:last-child {\n margin-bottom: 0;\n}\n\n.rs-counter-base {\n align-items: center;\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n height: 10px;\n -webkit-justify-content: space-between;\n justify-content: space-between;\n margin: 2px 0;\n}\n\n.rs-counter-base.alarm {\n color: #b70000;\n text-shadow: 0 0 0 #b70000,\n 0 0 1px #fff,\n 0 0 1px #fff,\n 0 0 2px #fff,\n 0 0 2px #fff,\n 0 0 3px #fff,\n 0 0 3px #fff,\n 0 0 4px #fff,\n 0 0 4px #fff;\n}\n\n.rs-counter-id {\n font-weight: 300;\n -webkit-box-ordinal-group: 0;\n -webkit-order: 0;\n order: 0;\n width: 54px;\n}\n\n.rs-counter-value {\n font-weight: 300;\n -webkit-box-ordinal-group: 1;\n -webkit-order: 1;\n order: 1;\n text-align: right;\n width: 35px;\n}\n\n.rs-canvas {\n -webkit-box-ordinal-group: 2;\n -webkit-order: 2;\n order: 2;\n}\n\n@media (min-width: 480px) {\n .rs-base {\n left: 20px;\n top: 20px;\n }\n}\n","",{version:3,sources:["webpack://./src/style/rStats.css"],names:[],mappings:"AAAA;EACE,sBAAsB;EACtB,cAAc;EACd,gBAAgB;EAChB,oBAAoB;EACpB,SAAS;EACT,gBAAgB;EAChB,aAAa;EACb,gBAAgB;EAChB,aAAa;EACb,eAAe;EACf,QAAQ;EACR,YAAY;EACZ,cAAc;AAChB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,WAAW;EACX,eAAe;EACf,gBAAgB;EAChB,gBAAgB;EAChB,eAAe;EACf,UAAU;AACZ;;AAEA;EACE,oBAAoB;EACpB,qBAAqB;EACrB,aAAa;EACb,sCAAsC;EACtC,8BAA8B;EAC9B,kBAAkB;AACpB;;AAEA;EACE,gBAAgB;AAClB;;AAEA;EACE,mBAAmB;EACnB,oBAAoB;EACpB,qBAAqB;EACrB,aAAa;EACb,YAAY;EACZ,sCAAsC;EACtC,8BAA8B;EAC9B,aAAa;AACf;;AAEA;EACE,cAAc;EACd;;;;;;;;2BAQyB;AAC3B;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;EACR,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;EACR,iBAAiB;EACjB,WAAW;AACb;;AAEA;EACE,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;AACV;;AAEA;EACE;IACE,UAAU;IACV,SAAS;EACX;AACF",sourcesContent:[".rs-base {\n background-color: #333;\n color: #fafafa;\n border-radius: 0;\n font: 10px monospace;\n left: 5px;\n line-height: 1em;\n opacity: 0.85;\n overflow: hidden;\n padding: 10px;\n position: fixed;\n top: 5px;\n width: 300px;\n z-index: 10000;\n}\n\n.rs-base div.hidden {\n display: none;\n}\n\n.rs-base h1 {\n color: #fff;\n cursor: pointer;\n font-size: 1.4em;\n font-weight: 300;\n margin: 0 0 5px;\n padding: 0;\n}\n\n.rs-group {\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n -webkit-flex-direction: column-reverse;\n flex-direction: column-reverse;\n margin-bottom: 5px;\n}\n\n.rs-group:last-child {\n margin-bottom: 0;\n}\n\n.rs-counter-base {\n align-items: center;\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n height: 10px;\n -webkit-justify-content: space-between;\n justify-content: space-between;\n margin: 2px 0;\n}\n\n.rs-counter-base.alarm {\n color: #b70000;\n text-shadow: 0 0 0 #b70000,\n 0 0 1px #fff,\n 0 0 1px #fff,\n 0 0 2px #fff,\n 0 0 2px #fff,\n 0 0 3px #fff,\n 0 0 3px #fff,\n 0 0 4px #fff,\n 0 0 4px #fff;\n}\n\n.rs-counter-id {\n font-weight: 300;\n -webkit-box-ordinal-group: 0;\n -webkit-order: 0;\n order: 0;\n width: 54px;\n}\n\n.rs-counter-value {\n font-weight: 300;\n -webkit-box-ordinal-group: 1;\n -webkit-order: 1;\n order: 1;\n text-align: right;\n width: 35px;\n}\n\n.rs-canvas {\n -webkit-box-ordinal-group: 2;\n -webkit-order: 2;\n order: 2;\n}\n\n@media (min-width: 480px) {\n .rs-base {\n left: 20px;\n top: 20px;\n }\n}\n"],sourceRoot:""}]);const a=o},7180:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>g});var i=n(5072),r=n.n(i),s=n(7825),o=n.n(s),a=n(7659),l=n.n(a),c=n(5056),h=n.n(c),u=n(540),d=n.n(u),p=n(1113),A=n.n(p),f=n(8217),m={};m.styleTagTransform=A(),m.setAttributes=h(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=d(),r()(f.A,m);const g=f.A&&f.A.locals?f.A.locals:void 0},9379:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>g});var i=n(5072),r=n.n(i),s=n(7825),o=n.n(s),a=n(7659),l=n.n(a),c=n(5056),h=n.n(c),u=n(540),d=n.n(u),p=n(1113),A=n.n(p),f=n(2470),m={};m.styleTagTransform=A(),m.setAttributes=h(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=d(),r()(f.A,m);const g=f.A&&f.A.locals?f.A.locals:void 0},5072:t=>{"use strict";var e=[];function n(t){for(var n=-1,i=0;i<e.length;i++)if(e[i].identifier===t){n=i;break}return n}function i(t,i){for(var s={},o=[],a=0;a<t.length;a++){var l=t[a],c=i.base?l[0]+i.base:l[0],h=s[c]||0,u="".concat(c," ").concat(h);s[c]=h+1;var d=n(u),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(p);else{var A=r(p,i);i.byIndex=a,e.splice(a,0,{identifier:u,updater:A,references:1})}o.push(u)}return o}function r(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,r){var s=i(t=t||[],r=r||{});return function(t){t=t||[];for(var o=0;o<s.length;o++){var a=n(s[o]);e[a].references--}for(var l=i(t,r),c=0;c<s.length;c++){var h=n(s[c]);0===e[h].references&&(e[h].updater(),e.splice(h,1))}s=l}}},7659:t=>{"use strict";var e={};t.exports=function(t,n){var i=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},5056:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},7825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},1113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},3931:t=>{"use strict";t.exports="data:image/svg+xml,%3C%3Fxml version=%271.0%27 encoding=%27UTF-8%27 standalone=%27no%27%3F%3E%3Csvg width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27 version=%271.1%27 id=%27svg320%27 sodipodi:docname=%27fullscreen-aframe.svg%27 xml:space=%27preserve%27 inkscape:version=%271.2.1 %289c6d41e 2022-07-14%29%27 xmlns:inkscape=%27http://www.inkscape.org/namespaces/inkscape%27 xmlns:sodipodi=%27http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd%27 xmlns=%27http://www.w3.org/2000/svg%27 xmlns:svg=%27http://www.w3.org/2000/svg%27 xmlns:rdf=%27http://www.w3.org/1999/02/22-rdf-syntax-ns%23%27 xmlns:cc=%27http://creativecommons.org/ns%23%27 xmlns:dc=%27http://purl.org/dc/elements/1.1/%27%3E%3Cdefs id=%27defs324%27 /%3E%3Csodipodi:namedview id=%27namedview322%27 pagecolor=%27%23ffffff%27 bordercolor=%27%23000000%27 borderopacity=%270.25%27 inkscape:showpageshadow=%272%27 inkscape:pageopacity=%270.0%27 inkscape:pagecheckerboard=%270%27 inkscape:deskcolor=%27%23d1d1d1%27 showgrid=%27false%27 inkscape:zoom=%273.8064516%27 inkscape:cx=%2791.423729%27 inkscape:cy=%27-1.4449153%27 inkscape:window-width=%271440%27 inkscape:window-height=%27847%27 inkscape:window-x=%2732%27 inkscape:window-y=%2725%27 inkscape:window-maximized=%270%27 inkscape:current-layer=%27svg320%27 /%3E%3Ctitle id=%27title312%27%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M96 0H12A12 12 0 0 0 0 12V50A12 12 0 0 0 12 62H96a12 12 0 0 0 12-12V12A12 12 0 0 0 96 0Zm8 50a8 8 0 0 1-8 8H12a8 8 0 0 1-8-8V12a8 8 0 0 1 8-8H96a8 8 0 0 1 8 8Z%27 fill=%27%23fff%27 id=%27path314%27 style=%27fill:%23ffffff%27 /%3E%3Cg id=%27g356%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g358%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g360%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g362%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g364%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g366%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g368%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g370%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g372%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g374%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g376%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g378%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g380%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g382%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g384%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cmetadata id=%27metadata561%27%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=%27%27%3E%3Cdc:title%3Eaframe-armode-noborder-reduced-tracking%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cpath d=%27m 98.168511 40.083649 c 0 -1.303681 -0.998788 -2.358041 -2.239389 -2.358041 -1.230088 0.0031 -2.240892 1.05436 -2.240892 2.358041 v 4.881296 l -9.041661 -9.041662 c -0.874129 -0.875631 -2.288954 -0.875631 -3.16308 0 -0.874129 0.874126 -0.874129 2.293459 0 3.167585 l 8.995101 8.992101 h -4.858767 c -1.323206 0.0031 -2.389583 1.004796 -2.389583 2.239386 0 1.237598 1.066377 2.237888 2.389583 2.237888 h 10.154599 c 1.323206 0 2.388082 -0.998789 2.392587 -2.237888 -0.0044 -0.03305 -0.009 -0.05858 -0.0134 -0.09161 0.0046 -0.04207 0.0134 -0.08712 0.0134 -0.13066 V 40.085172 h -1.52e-4%27 id=%27path596%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 23.091002 35.921781 -9.026643 9.041662 v -4.881296 c 0 -1.303681 -1.009302 -2.355037 -2.242393 -2.358041 -1.237598 0 -2.237888 1.05436 -2.237888 2.358041 l -0.0031 10.016421 c 0 0.04356 0.01211 0.08862 0.0015 0.130659 -0.0031 0.03153 -0.009 0.05709 -0.01211 0.09161 0.0031 1.239099 1.069379 2.237888 2.391085 2.237888 h 10.156101 c 1.320202 0 2.388079 -1.000291 2.388079 -2.237888 0 -1.234591 -1.067877 -2.236383 -2.388079 -2.239387 h -4.858767 l 8.995101 -8.9921 c 0.871126 -0.874127 0.871126 -2.293459 0 -3.167586 -0.875628 -0.877132 -2.291957 -0.877132 -3.169087 -1.52e-4%27 id=%27path598%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 84.649572 25.978033 9.041662 -9.041664 v 4.881298 c 0 1.299176 1.010806 2.350532 2.240891 2.355037 1.240601 0 2.23939 -1.055861 2.23939 -2.355037 V 11.798242 c 0 -0.04356 -0.009 -0.08862 -0.0134 -0.127671 0.0044 -0.03153 0.009 -0.06157 0.0134 -0.09313 -0.0044 -1.240598 -1.069379 -2.2393873 -2.391085 -2.2393873 h -10.1546 c -1.323205 0 -2.38958 0.9987893 -2.38958 2.2393873 0 1.233091 1.066375 2.237887 2.38958 2.240891 h 4.858768 l -8.995102 8.9921 c -0.874129 0.872625 -0.874129 2.288954 0 3.161578 0.874127 0.880137 2.288951 0.880137 3.16308 1.5e-4%27 id=%27path600%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 17.264988 13.822853 h 4.857265 c 1.320202 -0.0031 2.388079 -1.0078 2.388079 -2.240889 0 -1.240601 -1.067877 -2.2393893 -2.388079 -2.2393893 H 11.967654 c -1.321707 0 -2.388082 0.9987883 -2.391085 2.2393893 0.0031 0.03153 0.009 0.06157 0.01211 0.09313 -0.0031 0.03905 -0.0015 0.08262 -0.0015 0.127671 l 0.0031 10.020926 c 0 1.299176 1.00029 2.355038 2.237887 2.355038 1.233092 -0.0044 2.242393 -1.055862 2.242393 -2.355038 v -4.881295 l 9.026644 9.041661 c 0.877132 0.878635 2.293459 0.878635 3.169087 0 0.871125 -0.872624 0.871125 -2.288953 0 -3.161577 l -8.995282 -8.993616%27 id=%27path602%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3C/svg%3E"},6085:t=>{"use strict";t.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27%3E%3Ctitle%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0Zm8,50a8,8,0,0,1-8,8H12a8,8,0,0,1-8-8V12a8,8,0,0,1,8-8H96a8,8,0,0,1,8,8Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M43.35,39.82H32.51L30.45,46H23.88L35,16h5.73L52,46H45.43Zm-9.17-5h7.5L37.91,23.58Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M68.11,35H63.18V46H57V16H68.15q5.31,0,8.2,2.37a8.18,8.18,0,0,1,2.88,6.7,9.22,9.22,0,0,1-1.33,5.12,9.09,9.09,0,0,1-4,3.26l6.49,12.26V46H73.73Zm-4.93-5h5a5.09,5.09,0,0,0,3.6-1.18,4.21,4.21,0,0,0,1.28-3.27,4.56,4.56,0,0,0-1.2-3.34A5,5,0,0,0,68.15,21h-5Z%27 fill=%27%23fff%27/%3E%3C/svg%3E"},9169:t=>{"use strict";t.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27%3E%3Ctitle%3Eaframe-vrmode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M68.81,21.56H64.23v8.27h4.58a4.13,4.13,0,0,0,3.1-1.09,4.2,4.2,0,0,0,1-3,4.24,4.24,0,0,0-1-3A4.05,4.05,0,0,0,68.81,21.56Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0ZM41.9,46H34L24,16h8l6,21.84,6-21.84H52Zm39.29,0H73.44L68.15,35.39H64.23V46H57V16H68.81q5.32,0,8.34,2.37a8,8,0,0,1,3,6.69,9.68,9.68,0,0,1-1.27,5.18,8.9,8.9,0,0,1-4,3.34l6.26,12.11Z%27 fill=%27%23fff%27/%3E%3C/svg%3E"},6517:t=>{"use strict";t.exports="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E"},7889:t=>{"use strict";t.exports="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E"}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var s=e[i]={id:i,exports:{}};return t[i](s,s.exports,n),s.exports}n.m=t,n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.b=document.baseURI||self.location.href,n.nc=void 0;var i={};return(()=>{"use strict";n.d(i,{default:()=>sS});var t={};n.r(t),n.d(t,{ACESFilmicToneMapping:()=>De,AddEquation:()=>Zt,AddOperation:()=>Ie,AdditiveAnimationBlendMode:()=>vi,AdditiveBlending:()=>Xt,AgXToneMapping:()=>Ue,AlphaFormat:()=>gn,AlwaysCompare:()=>nr,AlwaysDepth:()=>ye,AlwaysStencilFunc:()=>Xi,AmbientLight:()=>ld,AnimationAction:()=>Zd,AnimationClip:()=>Ru,AnimationLoader:()=>Qu,AnimationMixer:()=>tp,AnimationObjectGroup:()=>Kd,AnimationUtils:()=>vu,ArcCurve:()=>Pc,ArrayCamera:()=>Id,ArrowHelper:()=>Yp,AttachedBindMode:()=>Fe,Audio:()=>Od,AudioAnalyser:()=>zd,AudioContext:()=>bd,AudioListener:()=>Ud,AudioLoader:()=>Cd,AxesHelper:()=>Jp,BackSide:()=>Vt,BasicDepthPacking:()=>bi,BasicShadowMap:()=>Nt,BatchedMesh:()=>nc,Bone:()=>vl,BooleanKeyframeTrack:()=>wu,Box2:()=>mp,Box3:()=>cs,Box3Helper:()=>Vp,BoxGeometry:()=>ya,BoxHelper:()=>Hp,BufferAttribute:()=>zo,BufferGeometry:()=>sa,BufferGeometryLoader:()=>fd,ByteType:()=>on,Cache:()=>Du,Camera:()=>_a,CameraHelper:()=>Qp,CanvasTexture:()=>Tc,CapsuleGeometry:()=>eh,CatmullRomCurve3:()=>Qc,CineonToneMapping:()=>Le,CircleGeometry:()=>nh,ClampToEdgeWrapping:()=>We,Clock:()=>Bd,Color:()=>Bo,ColorKeyframeTrack:()=>_u,ColorManagement:()=>zr,CompressedArrayTexture:()=>Ic,CompressedCubeTexture:()=>Bc,CompressedTexture:()=>Sc,CompressedTextureLoader:()=>Gu,ConeGeometry:()=>rh,ConstantAlphaFactor:()=>me,ConstantColorFactor:()=>Ae,Controls:()=>Zp,CubeCamera:()=>Ra,CubeReflectionMapping:()=>Qe,CubeRefractionMapping:()=>Ge,CubeTexture:()=>La,CubeTextureLoader:()=>Hu,CubeUVReflectionMapping:()=>Ve,CubicBezierCurve:()=>Vc,CubicBezierCurve3:()=>jc,CubicInterpolant:()=>Eu,CullFaceBack:()=>Ot,CullFaceFront:()=>Ft,CullFaceFrontBack:()=>kt,CullFaceNone:()=>Ut,Curve:()=>Lc,CurvePath:()=>Zc,CustomBlending:()=>Kt,CustomToneMapping:()=>Pe,CylinderGeometry:()=>ih,Cylindrical:()=>pp,Data3DTexture:()=>is,DataArrayTexture:()=>es,DataTexture:()=>yl,DataTextureLoader:()=>Vu,DataUtils:()=>ko,DecrementStencilOp:()=>Fi,DecrementWrapStencilOp:()=>Ni,DefaultLoadingManager:()=>Uu,DepthFormat:()=>bn,DepthStencilFormat:()=>Cn,DepthTexture:()=>Rc,DetachedBindMode:()=>ke,DirectionalLight:()=>ad,DirectionalLightHelper:()=>Fp,DiscreteInterpolant:()=>bu,DodecahedronGeometry:()=>oh,DoubleSide:()=>jt,DstAlphaFactor:()=>ce,DstColorFactor:()=>ue,DynamicCopyUsage:()=>hr,DynamicDrawUsage:()=>rr,DynamicReadUsage:()=>ar,EdgesGeometry:()=>uh,EllipseCurve:()=>Dc,EqualCompare:()=>Ki,EqualDepth:()=>be,EqualStencilFunc:()=>Hi,EquirectangularReflectionMapping:()=>ze,EquirectangularRefractionMapping:()=>He,Euler:()=>Ws,EventDispatcher:()=>gr,ExtrudeGeometry:()=>Qh,FileLoader:()=>Nu,Float16BufferAttribute:()=>Jo,Float32BufferAttribute:()=>Ko,FloatType:()=>un,Fog:()=>ka,FogExp2:()=>Fa,FramebufferTexture:()=>Mc,FrontSide:()=>Ht,Frustum:()=>kl,GLBufferAttribute:()=>ap,GLSL1:()=>dr,GLSL3:()=>pr,GreaterCompare:()=>$i,GreaterDepth:()=>we,GreaterEqualCompare:()=>er,GreaterEqualDepth:()=>Ce,GreaterEqualStencilFunc:()=>qi,GreaterStencilFunc:()=>ji,GridHelper:()=>Lp,Group:()=>Pa,HalfFloatType:()=>dn,HemisphereLight:()=>qu,HemisphereLightHelper:()=>Rp,IcosahedronGeometry:()=>zh,ImageBitmapLoader:()=>Ed,ImageLoader:()=>zu,ImageUtils:()=>Wr,IncrementStencilOp:()=>Oi,IncrementWrapStencilOp:()=>ki,InstancedBufferAttribute:()=>Cl,InstancedBufferGeometry:()=>Ad,InstancedInterleavedBuffer:()=>op,InstancedMesh:()=>Rl,Int16BufferAttribute:()=>Wo,Int32BufferAttribute:()=>Xo,Int8BufferAttribute:()=>Ho,IntType:()=>cn,InterleavedBuffer:()=>Qa,InterleavedBufferAttribute:()=>za,Interpolant:()=>yu,InterpolateDiscrete:()=>ui,InterpolateLinear:()=>di,InterpolateSmooth:()=>pi,InvertStencilOp:()=>Qi,KeepStencilOp:()=>Pi,KeyframeTrack:()=>Cu,LOD:()=>al,LatheGeometry:()=>th,Layers:()=>qs,LessCompare:()=>Ji,LessDepth:()=>Ee,LessEqualCompare:()=>Zi,LessEqualDepth:()=>xe,LessEqualStencilFunc:()=>Vi,LessStencilFunc:()=>zi,Light:()=>Wu,LightProbe:()=>ud,Line:()=>uc,Line3:()=>yp,LineBasicMaterial:()=>ic,LineCurve:()=>Wc,LineCurve3:()=>qc,LineDashedMaterial:()=>du,LineLoop:()=>mc,LineSegments:()=>fc,LinearFilter:()=>$e,LinearInterpolant:()=>xu,LinearMipMapLinearFilter:()=>rn,LinearMipMapNearestFilter:()=>en,LinearMipmapLinearFilter:()=>nn,LinearMipmapNearestFilter:()=>tn,LinearSRGBColorSpace:()=>Ti,LinearToneMapping:()=>Te,LinearTransfer:()=>Ri,Loader:()=>Ou,LoaderUtils:()=>pd,LoadingManager:()=>Pu,LoopOnce:()=>li,LoopPingPong:()=>hi,LoopRepeat:()=>ci,LuminanceAlphaFormat:()=>xn,LuminanceFormat:()=>En,MOUSE:()=>Dt,Material:()=>Lo,MaterialLoader:()=>dd,MathUtils:()=>Ir,Matrix2:()=>Ap,Matrix3:()=>Tr,Matrix4:()=>Os,MaxEquation:()=>ne,Mesh:()=>ga,MeshBasicMaterial:()=>Do,MeshDepthMaterial:()=>cu,MeshDistanceMaterial:()=>hu,MeshLambertMaterial:()=>lu,MeshMatcapMaterial:()=>uu,MeshNormalMaterial:()=>au,MeshPhongMaterial:()=>su,MeshPhysicalMaterial:()=>ru,MeshStandardMaterial:()=>iu,MeshToonMaterial:()=>ou,MinEquation:()=>ee,MirroredRepeatWrapping:()=>qe,MixOperation:()=>Se,MultiplyBlending:()=>Jt,MultiplyOperation:()=>Me,NearestFilter:()=>Xe,NearestMipMapLinearFilter:()=>Ze,NearestMipMapNearestFilter:()=>Je,NearestMipmapLinearFilter:()=>Ke,NearestMipmapNearestFilter:()=>Ye,NeutralToneMapping:()=>Oe,NeverCompare:()=>Yi,NeverDepth:()=>ve,NeverStencilFunc:()=>Gi,NoBlending:()=>Wt,NoColorSpace:()=>Ii,NoToneMapping:()=>Be,NormalAnimationBlendMode:()=>gi,NormalBlending:()=>qt,NotEqualCompare:()=>tr,NotEqualDepth:()=>_e,NotEqualStencilFunc:()=>Wi,NumberKeyframeTrack:()=>Mu,Object3D:()=>co,ObjectLoader:()=>md,ObjectSpaceNormalMap:()=>Si,OctahedronGeometry:()=>Hh,OneFactor:()=>re,OneMinusConstantAlphaFactor:()=>ge,OneMinusConstantColorFactor:()=>fe,OneMinusDstAlphaFactor:()=>he,OneMinusDstColorFactor:()=>de,OneMinusSrcAlphaFactor:()=>le,OneMinusSrcColorFactor:()=>oe,OrthographicCamera:()=>sd,PCFShadowMap:()=>Qt,PCFSoftShadowMap:()=>Gt,PMREMGenerator:()=>_A,Path:()=>$c,PerspectiveCamera:()=>Ba,Plane:()=>Ul,PlaneGeometry:()=>Vh,PlaneHelper:()=>jp,PointLight:()=>rd,PointLightHelper:()=>Sp,Points:()=>bc,PointsMaterial:()=>gc,PolarGridHelper:()=>Dp,PolyhedronGeometry:()=>sh,PositionalAudio:()=>Gd,PropertyBinding:()=>Jd,PropertyMixer:()=>Hd,QuadraticBezierCurve:()=>Xc,QuadraticBezierCurve3:()=>Yc,Quaternion:()=>ss,QuaternionKeyframeTrack:()=>Iu,QuaternionLinearInterpolant:()=>Su,RED_GREEN_RGTC2_Format:()=>oi,RED_RGTC1_Format:()=>ri,REVISION:()=>Lt,RGBADepthPacking:()=>Ci,RGBAFormat:()=>yn,RGBAIntegerFormat:()=>Bn,RGBA_ASTC_10x10_Format:()=>Zn,RGBA_ASTC_10x5_Format:()=>Yn,RGBA_ASTC_10x6_Format:()=>Jn,RGBA_ASTC_10x8_Format:()=>Kn,RGBA_ASTC_12x10_Format:()=>$n,RGBA_ASTC_12x12_Format:()=>ti,RGBA_ASTC_4x4_Format:()=>Gn,RGBA_ASTC_5x4_Format:()=>zn,RGBA_ASTC_5x5_Format:()=>Hn,RGBA_ASTC_6x5_Format:()=>Vn,RGBA_ASTC_6x6_Format:()=>jn,RGBA_ASTC_8x5_Format:()=>Wn,RGBA_ASTC_8x6_Format:()=>qn,RGBA_ASTC_8x8_Format:()=>Xn,RGBA_BPTC_Format:()=>ei,RGBA_ETC2_EAC_Format:()=>Qn,RGBA_PVRTC_2BPPV1_Format:()=>Fn,RGBA_PVRTC_4BPPV1_Format:()=>On,RGBA_S3TC_DXT1_Format:()=>Rn,RGBA_S3TC_DXT3_Format:()=>Ln,RGBA_S3TC_DXT5_Format:()=>Dn,RGBDepthPacking:()=>wi,RGBFormat:()=>vn,RGBIntegerFormat:()=>In,RGB_BPTC_SIGNED_Format:()=>ni,RGB_BPTC_UNSIGNED_Format:()=>ii,RGB_ETC1_Format:()=>kn,RGB_ETC2_Format:()=>Nn,RGB_PVRTC_2BPPV1_Format:()=>Un,RGB_PVRTC_4BPPV1_Format:()=>Pn,RGB_S3TC_DXT1_Format:()=>Tn,RGDepthPacking:()=>_i,RGFormat:()=>Mn,RGIntegerFormat:()=>Sn,RawShaderMaterial:()=>nu,Ray:()=>Us,Raycaster:()=>cp,RectAreaLight:()=>cd,RedFormat:()=>wn,RedIntegerFormat:()=>_n,ReinhardToneMapping:()=>Re,RenderTarget:()=>$r,RenderTarget3D:()=>ep,RenderTargetArray:()=>np,RepeatWrapping:()=>je,ReplaceStencilOp:()=>Ui,ReverseSubtractEquation:()=>te,RingGeometry:()=>jh,SIGNED_RED_GREEN_RGTC2_Format:()=>ai,SIGNED_RED_RGTC1_Format:()=>si,SRGBColorSpace:()=>Bi,SRGBTransfer:()=>Li,Scene:()=>Na,ShaderChunk:()=>iA,ShaderLib:()=>sA,ShaderMaterial:()=>wa,ShadowMaterial:()=>eu,Shape:()=>dh,ShapeGeometry:()=>Wh,ShapePath:()=>Kp,ShapeUtils:()=>Fh,ShortType:()=>an,Skeleton:()=>bl,SkeletonHelper:()=>_p,SkinnedMesh:()=>gl,Source:()=>Xr,Sphere:()=>Ss,SphereGeometry:()=>qh,Spherical:()=>dp,SphericalHarmonics3:()=>hd,SplineCurve:()=>Jc,SpotLight:()=>$u,SpotLightHelper:()=>xp,Sprite:()=>il,SpriteMaterial:()=>Ha,SrcAlphaFactor:()=>ae,SrcAlphaSaturateFactor:()=>pe,SrcColorFactor:()=>se,StaticCopyUsage:()=>cr,StaticDrawUsage:()=>ir,StaticReadUsage:()=>or,StereoCamera:()=>Sd,StreamCopyUsage:()=>ur,StreamDrawUsage:()=>sr,StreamReadUsage:()=>lr,StringKeyframeTrack:()=>Bu,SubtractEquation:()=>$t,SubtractiveBlending:()=>Yt,TOUCH:()=>Pt,TangentSpaceNormalMap:()=>Mi,TetrahedronGeometry:()=>Xh,Texture:()=>Kr,TextureLoader:()=>ju,TextureUtils:()=>tA,TimestampQuery:()=>mr,TorusGeometry:()=>Yh,TorusKnotGeometry:()=>Jh,Triangle:()=>wo,TriangleFanDrawMode:()=>xi,TriangleStripDrawMode:()=>Ei,TrianglesDrawMode:()=>yi,TubeGeometry:()=>Kh,UVMapping:()=>Ne,Uint16BufferAttribute:()=>qo,Uint32BufferAttribute:()=>Yo,Uint8BufferAttribute:()=>Vo,Uint8ClampedBufferAttribute:()=>jo,Uniform:()=>ip,UniformsGroup:()=>sp,UniformsLib:()=>rA,UniformsUtils:()=>Ca,UnsignedByteType:()=>sn,UnsignedInt248Type:()=>fn,UnsignedInt5999Type:()=>mn,UnsignedIntType:()=>hn,UnsignedShort4444Type:()=>pn,UnsignedShort5551Type:()=>An,UnsignedShortType:()=>ln,VSMShadowMap:()=>zt,Vector2:()=>Br,Vector3:()=>os,Vector4:()=>Zr,VectorKeyframeTrack:()=>Tu,VideoFrameTexture:()=>_c,VideoTexture:()=>wc,WebGL3DRenderTarget:()=>rs,WebGLArrayRenderTarget:()=>ns,WebGLCoordinateSystem:()=>Ar,WebGLCubeRenderTarget:()=>Da,WebGLRenderTarget:()=>ts,WebGLRenderer:()=>Om,WebGLUtils:()=>Im,WebGPUCoordinateSystem:()=>fr,WebXRController:()=>Oa,WireframeGeometry:()=>Zh,WrapAroundEnding:()=>mi,ZeroCurvatureEnding:()=>Ai,ZeroFactor:()=>ie,ZeroSlopeEnding:()=>fi,ZeroStencilOp:()=>Di,createCanvasElement:()=>Or});var e={};n.r(e),n.d(e,{computeMikkTSpaceTangents:()=>Nm,computeMorphedAttributes:()=>Ym,deepCloneAttribute:()=>zm,deinterleaveAttribute:()=>Vm,deinterleaveGeometry:()=>jm,estimateBytesUsed:()=>Wm,interleaveAttributes:()=>Hm,mergeAttributes:()=>Gm,mergeGeometries:()=>Qm,mergeGroups:()=>Jm,mergeVertices:()=>qm,toCreasedNormals:()=>Km,toTrianglesDrawMode:()=>Xm});var r={};n.r(r),n.d(r,{checkARSupport:()=>zy,checkHeadsetConnected:()=>Gy,checkVRSupport:()=>Hy,isAppleVisionPro:()=>Yy,isBrowserEnvironment:()=>iE,isFirefoxReality:()=>$y,isIOS:()=>Jy,isIpad:()=>Xy,isLandscape:()=>nE,isMobile:()=>Wy,isMobileDeviceRequestingDesktopSite:()=>Ky,isMobileVR:()=>tE,isNodeEnvironment:()=>rE,isOculusBrowser:()=>Zy,isR7:()=>eE,isTablet:()=>qy,isWebXRAvailable:()=>ky});var s={};n.r(s),n.d(s,{clearObject:()=>lE,createPool:()=>aE,removeUnusedKeys:()=>cE});var o={};n.r(o),n.d(o,{equals:()=>mE,isCoordinate:()=>vE,isCoordinates:()=>gE,parse:()=>AE,regex:()=>dE,stringify:()=>fE,toVector3:()=>EE});var a={};n.r(a),n.d(a,{getComponentProperty:()=>CE,getComponentPropertyPath:()=>bE,setComponentProperty:()=>wE});var l={};n.r(l),n.d(l,{parseUrl:()=>TE,validateCubemapSrc:()=>BE,validateEnvMapSrc:()=>IE,validateSrc:()=>SE});var c={};n.r(c),n.d(c,{createCompatibleTexture:()=>zE,handleTextureEvents:()=>QE,isCompatibleTexture:()=>GE,setTextureProperties:()=>PE,updateDistortionMap:()=>FE,updateEnvMap:()=>NE,updateMap:()=>OE,updateMapMaterialFromData:()=>UE});var h={};n.r(h),n.d(h,{parse:()=>VE,stringify:()=>jE,toCamelCase:()=>WE});var u={};n.r(u),n.d(u,{checkControllerPresentAndSetup:()=>ZE,emitIfAxesChanged:()=>ex,findMatchingControllerWebXR:()=>tx,isControllerPresentWebXR:()=>$E,onButtonEvent:()=>nx});var d={};n.r(d),n.d(d,{bind:()=>rx,checkHeadsetConnected:()=>sx,clone:()=>Ax,coordinates:()=>o,debounce:()=>ux,debug:()=>Ly,deepEqual:()=>gx,device:()=>r,diff:()=>vx,entity:()=>a,extend:()=>dx,extendDeep:()=>px,findAllScenes:()=>wx,forceCanvasResizeSafariMobile:()=>_E,getElData:()=>xx,getUrlParameter:()=>bx,isIOS:()=>ox,isIframed:()=>Cx,isMobile:()=>ax,material:()=>c,objectPool:()=>s,shouldCaptureKeyEvent:()=>yx,split:()=>xE,splitString:()=>Ex,srcLoader:()=>l,styleParser:()=>h,throttle:()=>lx,throttleLeadingAndTrailing:()=>cx,throttleTick:()=>hx,trackedControls:()=>u});var p={};n.r(p),n.d(p,{isSingleProperty:()=>eb,parseProperties:()=>sb,parseProperty:()=>ob,process:()=>nb,processPropertyDefinition:()=>ib,stringifyProperties:()=>ab,stringifyProperty:()=>lb});var A={};n.r(A),n.d(A,{Component:()=>Cb,components:()=>cb,registerComponent:()=>_b,registrationOrderWarnings:()=>wb});var f={};n.r(f),n.d(f,{System:()=>Lb,registerSystem:()=>Db,systems:()=>Rb});var m={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},g={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},v=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective"],y={CSS:{},springs:{}};function E(t,e,n){return Math.min(Math.max(t,e),n)}function x(t,e){return t.indexOf(e)>-1}function b(t,e){return t.apply(null,e)}var C=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,w=/^rgb/,_=/^hsl/,M={arr:function(t){return Array.isArray(t)},obj:function(t){return x(Object.prototype.toString.call(t),"Object")},pth:function(t){return M.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return t.nodeType||M.svg(t)},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return void 0===t},hex:function(t){return C.test(t)},rgb:function(t){return w.test(t)},hsl:function(t){return _.test(t)},col:function(t){return M.hex(t)||M.rgb(t)||M.hsl(t)},key:function(t){return!m.hasOwnProperty(t)&&!g.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}},S=/\(([^)]+)\)/;function I(t){var e=S.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function B(t,e){var n=I(t),i=E(M.und(n[0])?1:n[0],.1,100),r=E(M.und(n[1])?100:n[1],.1,100),s=E(M.und(n[2])?10:n[2],.1,100),o=E(M.und(n[3])?0:n[3],.1,100),a=Math.sqrt(r/i),l=s/(2*Math.sqrt(r*i)),c=l<1?a*Math.sqrt(1-l*l):0,h=l<1?(l*a-o)/c:-o+a;function u(t){var n=e?e*t/1e3:t;return n=l<1?Math.exp(-n*l*a)*(1*Math.cos(c*n)+h*Math.sin(c*n)):(1+h*n)*Math.exp(-n*a),0===t||1===t?t:1-n}return e?u:function(){var e=y.springs[t];if(e)return e;for(var n=1/6,i=0,r=0;;)if(1===u(i+=n)){if(++r>=16)break}else r=0;var s=i*n*1e3;return y.springs[t]=s,s}}function T(t,e){void 0===t&&(t=1),void 0===e&&(e=.5);var n=E(t,1,10),i=E(e,.1,2);return function(t){return 0===t||1===t?t:-n*Math.pow(2,10*(t-1))*Math.sin((t-1-i/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/i)}}function R(t){return void 0===t&&(t=10),function(e){return Math.round(e*t)*(1/t)}}var L=function(){var t=.1;function e(t,e){return 1-3*e+3*t}function n(t,e){return 3*e-6*t}function i(t){return 3*t}function r(t,r,s){return((e(r,s)*t+n(r,s))*t+i(r))*t}function s(t,r,s){return 3*e(r,s)*t*t+2*n(r,s)*t+i(r)}return function(e,n,i,o){if(0<=e&&e<=1&&0<=i&&i<=1){var a=new Float32Array(11);if(e!==n||i!==o)for(var l=0;l<11;++l)a[l]=r(l*t,e,i);return function(l){return e===n&&i===o||0===l||1===l?l:r(function(n){for(var o=0,l=1;10!==l&&a[l]<=n;++l)o+=t;--l;var c=o+(n-a[l])/(a[l+1]-a[l])*t,h=s(c,e,i);return h>=.001?function(t,e,n,i){for(var o=0;o<4;++o){var a=s(e,n,i);if(0===a)return e;e-=(r(e,n,i)-t)/a}return e}(n,c,e,i):0===h?c:function(t,e,n,i,s){var o,a,l=0;do{(o=r(a=e+(n-e)/2,i,s)-t)>0?n=a:e=a}while(Math.abs(o)>1e-7&&++l<10);return a}(n,o,o+t,e,i)}(l),n,o)}}}}(),D=function(){var t=["Quad","Cubic","Quart","Quint","Sine","Expo","Circ","Back","Elastic"],e={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],T],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(t,e){return function(n){return 1-T(t,e)(1-n)}}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(t,e){return function(n){return n<.5?T(t,e)(2*n)/2:1-T(t,e)(-2*n+2)/2}}]},n={linear:[.25,.25,.75,.75]};for(var i in e)for(var r=0,s=e[i].length;r<s;r++)n["ease"+i+t[r]]=e[i][r];return n}();function P(t,e){if(M.fnc(t))return t;var n=t.split("(")[0],i=D[n],r=I(t);switch(n){case"spring":return B(t,e);case"cubicBezier":return b(L,r);case"steps":return b(R,r);default:return M.fnc(i)?b(i,r):b(L,i)}}function U(t){try{return document.querySelectorAll(t)}catch(t){return}}var O=[];function F(t,e){for(var n=O,i=t.length,r=arguments.length>=2?arguments[1]:void 0,s=0;s<i;s++)if(s in t){var o=t[s];e.call(r,o,s,t)&&n.push(o)}return(O=t).length=0,n}function k(t,e){e||(e=[]);for(var n=0,i=t.length;n<i;n++){var r=t[n];Array.isArray(r)?k(r,e):e.push(r)}return e}function N(t){return M.arr(t)?t:(M.str(t)&&(t=U(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function Q(t,e){return t.some((function(t){return t===e}))}function G(t){var e={};for(var n in t)e[n]=t[n];return e}function z(t,e){var n=G(t);for(var i in t)n[i]=e.hasOwnProperty(i)?e[i]:t[i];return n}function H(t,e){var n=G(t);for(var i in e)n[i]=M.und(t[i])?e[i]:t[i];return n}var V=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g,j=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,W=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,q=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g,X=/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g;var Y=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/;function J(t){var e=Y.exec(t);if(e)return e[2]}function K(t,e){return M.fnc(t)?t(e.target,e.id,e.total):t}function Z(t,e){return t.getAttribute(e)}function $(t,e,n){if(Q([n,"deg","rad","turn"],J(e)))return e;var i=y.CSS[e+n];if(!M.und(i))return i;var r=document.createElement(t.tagName),s=t.parentNode&&t.parentNode!==document?t.parentNode:document.body;s.appendChild(r),r.style.position="absolute",r.style.width=100+n;var o=100/r.offsetWidth;s.removeChild(r);var a=o*parseFloat(e);return y.CSS[e+n]=a,a}function tt(t,e,n){if(e in t.style){var i=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=t.style[e]||getComputedStyle(t).getPropertyValue(i)||"0";return n?$(t,r,n):r}}function et(t,e){return M.dom(t)&&!M.inp(t)&&(Z(t,e)||M.svg(t)&&t[e])?"attribute":M.dom(t)&&Q(v,e)?"transform":M.dom(t)&&"transform"!==e&&tt(t,e)?"css":null!=t[e]?"object":void 0}var nt=/(\w+)\(([^)]*)\)/g;function it(t){if(M.dom(t)){for(var e,n=t.style.transform||"",i=new Map;e=nt.exec(n);)i.set(e[1],e[2]);return i}}function rt(t,e,n,i){switch(et(t,e)){case"transform":return function(t,e,n,i){var r=x(e,"scale")?1:0+function(t){return x(t,"translate")||"perspective"===t?"px":x(t,"rotate")||x(t,"skew")?"deg":void 0}(e),s=it(t).get(e)||r;return n&&(n.transforms.list.set(e,s),n.transforms.last=e),i?$(t,s,i):s}(t,e,i,n);case"css":return tt(t,e,n);case"attribute":return Z(t,e);default:return t[e]||0}}var st=/^(\*=|\+=|-=)/;function ot(t,e){var n=st.exec(t);if(!n)return t;var i=J(t)||0,r=parseFloat(e),s=parseFloat(t.replace(n[0],""));switch(n[0][0]){case"+":return r+s+i;case"-":return r-s+i;case"*":return r*s+i}}var at=/\s/g;function lt(t,e){if(M.col(t))return function(t){return M.rgb(t)?(e=t,(n=V.exec(e))?"rgba("+n[1]+",1)":e):M.hex(t)?function(t){var e=t.replace(j,(function(t,e,n,i){return e+e+n+n+i+i})),n=W.exec(e);return"rgba("+parseInt(n[1],16)+","+parseInt(n[2],16)+","+parseInt(n[3],16)+",1)"}(t):M.hsl(t)?function(t){var e,n,i,r=q.exec(t)||X.exec(t),s=parseInt(r[1],10)/360,o=parseInt(r[2],10)/100,a=parseInt(r[3],10)/100,l=r[4]||1;function c(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+(e-t)*(2/3-n)*6:t}if(0==o)e=n=i=a;else{var h=a<.5?a*(1+o):a+o-a*o,u=2*a-h;e=c(u,h,s+1/3),n=c(u,h,s),i=c(u,h,s-1/3)}return"rgba("+255*e+","+255*n+","+255*i+","+l+")"}(t):void 0;var e,n}(t);var n=J(t),i=n?t.substr(0,t.length-n.length):t;return e&&!at.test(t)?i+e:i}function ct(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ht(t){for(var e,n=t.points,i=0,r=0;r<n.numberOfItems;r++){var s=n.getItem(r);r>0&&(i+=ct(e,s)),e=s}return i}function ut(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*Z(t,"r")}(t);case"rect":return function(t){return 2*Z(t,"width")+2*Z(t,"height")}(t);case"line":return function(t){return ct({x:Z(t,"x1"),y:Z(t,"y1")},{x:Z(t,"x2"),y:Z(t,"y2")})}(t);case"polyline":return ht(t);case"polygon":return function(t){var e=t.points;return ht(t)+ct(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function dt(t,e){var n=e||{},i=n.el||function(t){for(var e=t.parentNode;M.svg(e)&&(e=e.parentNode,M.svg(e.parentNode)););return e}(t),r=i.getBoundingClientRect(),s=Z(i,"viewBox"),o=r.width,a=r.height,l=n.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:i,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function pt(t,e){function n(n){void 0===n&&(n=0);var i=e+n>=1?e+n:0;return t.el.getPointAtLength(i)}var i=dt(t.el,t.svg),r=n(),s=n(-1),o=n(1);switch(t.property){case"x":return(r.x-i.x)*i.w;case"y":return(r.y-i.y)*i.h;case"angle":return 180*Math.atan2(o.y-s.y,o.x-s.x)/Math.PI}}var At=/-?\d*\.?\d+/g;function ft(t,e){var n=lt(M.pth(t)?t.totalLength:t,e)+"";return{original:n,numbers:n.match(At)?n.match(At).map(Number):[0],strings:M.str(t)||e?n.split(At):[]}}function mt(t){return F(t?k(M.arr(t)?t.map(N):N(t)):[],(function(t,e,n){return n.indexOf(t)===e}))}function gt(t){var e=mt(t);return e.map((function(t,n){return{target:t,id:n,total:e.length,transforms:{list:it(t)}}}))}var vt=/^spring/;function yt(t,e){var n=G(e);if(vt.test(n.easing)&&(n.duration=B(n.easing)),M.arr(t)){var i=t.length;2!==i||M.obj(t[0])?M.fnc(e.duration)||(n.duration=e.duration/i):t={value:t}}var r=M.arr(t)?t:[t];return r.map((function(t,n){var i=M.obj(t)&&!M.pth(t)?t:{value:t};return M.und(i.delay)&&(i.delay=n?0:e.delay),M.und(i.endDelay)&&(i.endDelay=n===r.length-1?e.endDelay:0),i})).map((function(t){return H(t,n)}))}var Et={css:function(t,e,n){return t.style[e]=n},attribute:function(t,e,n){return t.setAttribute(e,n)},object:function(t,e,n){return t[e]=n},transform:function(t,e,n,i,r){if(i.list.set(e,n),e===i.last||r){var s="";i.list.forEach((function(t,e){s+=e+"("+t+") "})),t.style.transform=s}}};function xt(t,e){for(var n=gt(t),i=0,r=n.length;i<r;i++){var s=n[i];for(var o in e){var a=K(e[o],s),l=s.target,c=J(a),h=rt(l,o,c,s),u=ot(lt(a,c||J(h)),h),d=et(l,o);Et[d](l,o,u,s.transforms,!0)}}}function bt(t,e){return F(k(t.map((function(t){return e.map((function(e){return function(t,e){var n=et(t.target,e.name);if(n){var i=function(t,e){var n;return t.tweens.map((function(i){var r=function(t,e){var n={};for(var i in t){var r=K(t[i],e);M.arr(r)&&1===(r=r.map((function(t){return K(t,e)}))).length&&(r=r[0]),n[i]=r}return n.duration=parseFloat(n.duration),n.delay=parseFloat(n.delay),n}(i,e),s=r.value,o=M.arr(s)?s[1]:s,a=J(o),l=rt(e.target,t.name,a,e),c=n?n.to.original:l,h=M.arr(s)?s[0]:c,u=J(h)||J(l),d=a||u;return M.und(o)&&(o=c),r.from=ft(h,d),r.to=ft(ot(o,h),d),r.start=n?n.end:0,r.end=r.start+r.delay+r.duration+r.endDelay,r.easing=P(r.easing,r.duration),r.isPath=M.pth(s),r.isColor=M.col(r.from.original),r.isColor&&(r.round=1),n=r,r}))}(e,t),r=i[i.length-1];return{type:n,property:e.name,animatable:t,tweens:i,duration:r.end,delay:i[0].delay,endDelay:r.endDelay}}}(t,e)}))}))),(function(t){return!M.und(t)}))}function Ct(t,e){var n=t.length,i=function(t){return t.timelineOffset?t.timelineOffset:0},r={};return r.duration=n?Math.max.apply(Math,t.map((function(t){return i(t)+t.duration}))):e.duration,r.delay=n?Math.min.apply(Math,t.map((function(t){return i(t)+t.delay}))):e.delay,r.endDelay=n?r.duration-Math.max.apply(Math,t.map((function(t){return i(t)+t.duration-t.endDelay}))):e.endDelay,r}var wt,_t=0,Mt=[],St=[],It=function(){function t(){wt=requestAnimationFrame(e)}function e(e){var n=Mt.length;if(n){for(var i=0;i<n;){var r=Mt[i];if(r.paused){var s=Mt.indexOf(r);s>-1&&(Mt.splice(s,1),n=Mt.length)}else r.tick(e);i++}t()}else wt=cancelAnimationFrame(wt)}return t}();function Bt(t){void 0===t&&(t={});var e,n=0,i=0,r=0,s=0,o=null;function a(){return window.Promise&&new Promise((function(t){return o=t}))}var l=a(),c=function(t){var e=z(m,t),n=z(g,t),i=function(t,e){var n=[],i=e.keyframes;for(var r in i&&(e=H(function(t){for(var e=F(k(t.map((function(t){return Object.keys(t)}))),(function(t){return M.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),n={},i=function(i){var r=e[i];n[r]=t.map((function(t){var e={};for(var n in t)M.key(n)?n==r&&(e.value=t[n]):e[n]=t[n];return e}))},r=0;r<e.length;r++)i(r);return n}(i),e)),e)M.key(r)&&n.push({name:r,tweens:yt(e[r],t)});return n}(n,t),r=gt(t.targets),s=bt(r,i),o=Ct(s,n),a=_t;return _t++,H(e,{id:a,children:[],animatables:r,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}(t);function h(){c.reversed=!c.reversed;for(var t=0,n=e.length;t<n;t++)e[t].reversed=c.reversed}function u(t){return c.reversed?c.duration-t:t}function d(){n=0,i=u(c.currentTime)*(1/Bt.speed)}function p(t,e){e&&e.seek(t-e.timelineOffset)}function A(t){for(var e=0,n=c.animations,i=n.length;e<i;){var r=n[e],s=r.animatable,o=r.tweens,a=o.length-1,l=o[a];a&&(l=F(o,(function(e){return t<e.end}))[0]||l);for(var h=E(t-l.start-l.delay,0,l.duration)/l.duration,u=isNaN(h)?1:l.easing(h),d=l.to.strings,p=l.round,A=[],f=l.to.numbers.length,m=void 0,g=0;g<f;g++){var v=void 0,y=l.to.numbers[g],x=l.from.numbers[g]||0;v=l.isPath?pt(l.value,u*y):x+u*(y-x),p&&(l.isColor&&g>2||(v=Math.round(v*p)/p)),A.push(v)}var b=d.length;if(b){m=d[0];for(var C=0;C<b;C++){d[C];var w=d[C+1],_=A[C];isNaN(_)||(m+=w?_+w:_+" ")}}else m=A[0];Et[r.type](s.target,r.property,m,s.transforms),r.currentValue=m,e++}}function f(t){c[t]&&!c.passThrough&&c[t](c)}function v(t){var d=c.duration,m=c.delay,g=d-c.endDelay,v=u(t);c.progress=E(v/d*100,0,100),c.reversePlayback=v<c.currentTime,e&&function(t){if(c.reversePlayback)for(var n=s;n--;)p(t,e[n]);else for(var i=0;i<s;i++)p(t,e[i])}(v),!c.began&&c.currentTime>0&&(c.began=!0,f("begin"),f("loopBegin")),v<=m&&0!==c.currentTime&&A(0),(v>=g&&c.currentTime!==d||!d)&&A(d),v>m&&v<g?(c.changeBegan||(c.changeBegan=!0,c.changeCompleted=!1,f("changeBegin")),f("change"),A(v)):c.changeBegan&&(c.changeCompleted=!0,c.changeBegan=!1,f("changeComplete")),c.currentTime=E(v,0,d),c.began&&f("update"),t>=d&&(i=0,c.remaining&&!0!==c.remaining&&c.remaining--,c.remaining?(n=r,f("loopComplete"),f("loopBegin"),"alternate"===c.direction&&h()):(c.paused=!0,c.completed||(c.completed=!0,f("loopComplete"),f("complete"),"Promise"in window&&(o(),l=a()))))}return c.reset=function(){var t=c.direction;c.passThrough=!1,c.currentTime=0,c.progress=0,c.paused=!0,c.began=!1,c.changeBegan=!1,c.completed=!1,c.changeCompleted=!1,c.reversePlayback=!1,c.reversed="reverse"===t,c.remaining=c.loop,e=c.children;for(var n=s=e.length;n--;)c.children[n].reset();(c.reversed&&!0!==c.loop||"alternate"===t&&1===c.loop)&&c.remaining++,A(0)},c.set=function(t,e){return xt(t,e),c},c.tick=function(t){r=t,n||(n=r),v((r+(i-n))*Bt.speed)},c.seek=function(t){v(u(t))},c.pause=function(){c.paused=!0,d()},c.play=function(){c.paused&&(c.paused=!1,Mt.push(c),d(),wt||It())},c.reverse=function(){h(),d()},c.restart=function(){c.reset(),c.play()},c.finished=l,c.reset(),c.autoplay&&c.play(),c}function Tt(t,e){for(var n=e.length;n--;)Q(t,e[n].animatable.target)&&e.splice(n,1)}document.addEventListener("visibilitychange",(function(){if(document.hidden){for(var t=0,e=Mt.length;t<e;t++)activeInstance[t].pause();St=Mt.slice(0),Mt=[]}else for(var n=0,i=St.length;n<i;n++)St[n].play()})),Bt.version="3.0.0",Bt.speed=1,Bt.running=Mt,Bt.remove=function(t){for(var e=mt(t),n=Mt.length;n--;){var i=Mt[n],r=i.animations,s=i.children;Tt(e,r);for(var o=s.length;o--;){var a=s[o],l=a.animations;Tt(e,l),l.length||a.children.length||s.splice(o,1)}r.length||s.length||i.pause()}},Bt.get=rt,Bt.set=xt,Bt.convertPx=$,Bt.path=function(t,e){var n=M.str(t)?U(t)[0]:t,i=e||100;return function(t){return{property:t,el:n,svg:dt(n),totalLength:ut(n)*(i/100)}}},Bt.setDashoffset=function(t){var e=ut(t);return t.setAttribute("stroke-dasharray",e),e},Bt.stagger=function(t,e){void 0===e&&(e={});var n=e.direction||"normal",i=e.easing?P(e.easing):null,r=e.grid,s=e.axis,o=e.from||0,a="first"===o,l="center"===o,c="last"===o,h=M.arr(t),u=h?parseFloat(t[0]):parseFloat(t),d=h?parseFloat(t[1]):0,p=J(h?t[1]:t)||0,A=e.start||0+(h?u:0),f=[],m=0;return function(t,e,g){if(a&&(o=0),l&&(o=(g-1)/2),c&&(o=g-1),!f.length){for(var v=0;v<g;v++){if(r){var y=l?(r[0]-1)/2:o%r[0],E=l?(r[1]-1)/2:Math.floor(o/r[0]),x=y-v%r[0],b=E-Math.floor(v/r[0]),C=Math.sqrt(x*x+b*b);"x"===s&&(C=-x),"y"===s&&(C=-b),f.push(C)}else f.push(Math.abs(o-v));m=Math.max.apply(Math,f)}i&&(f=f.map((function(t){return i(t/m)*m}))),"reverse"===n&&(f=f.map((function(t){return s?t<0?-1*t:-t:Math.abs(m-t)})))}return A+(h?(d-u)/m:u)*(Math.round(100*f[e])/100)+p}},Bt.timeline=function(t){void 0===t&&(t={});var e=Bt(t);return e.duration=0,e.add=function(n,i){var r=Mt.indexOf(e),s=e.children;function o(t){t.passThrough=!0}r>-1&&Mt.splice(r,1);for(var a=0;a<s.length;a++)o(s[a]);var l=H(n,z(g,t));l.targets=l.targets||t.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=M.und(i)?c:ot(i,c),o(e),e.seek(l.timelineOffset);var h=Bt(l);o(h),s.push(h);var u=Ct(s,t);return e.delay=u.delay,e.endDelay=u.endDelay,e.duration=u.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e},Bt.easing=P,Bt.penner=D,Bt.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};const Rt=Bt,Lt="173",Dt={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Pt={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Ut=0,Ot=1,Ft=2,kt=3,Nt=0,Qt=1,Gt=2,zt=3,Ht=0,Vt=1,jt=2,Wt=0,qt=1,Xt=2,Yt=3,Jt=4,Kt=5,Zt=100,$t=101,te=102,ee=103,ne=104,ie=200,re=201,se=202,oe=203,ae=204,le=205,ce=206,he=207,ue=208,de=209,pe=210,Ae=211,fe=212,me=213,ge=214,ve=0,ye=1,Ee=2,xe=3,be=4,Ce=5,we=6,_e=7,Me=0,Se=1,Ie=2,Be=0,Te=1,Re=2,Le=3,De=4,Pe=5,Ue=6,Oe=7,Fe="attached",ke="detached",Ne=300,Qe=301,Ge=302,ze=303,He=304,Ve=306,je=1e3,We=1001,qe=1002,Xe=1003,Ye=1004,Je=1004,Ke=1005,Ze=1005,$e=1006,tn=1007,en=1007,nn=1008,rn=1008,sn=1009,on=1010,an=1011,ln=1012,cn=1013,hn=1014,un=1015,dn=1016,pn=1017,An=1018,fn=1020,mn=35902,gn=1021,vn=1022,yn=1023,En=1024,xn=1025,bn=1026,Cn=1027,wn=1028,_n=1029,Mn=1030,Sn=1031,In=1032,Bn=1033,Tn=33776,Rn=33777,Ln=33778,Dn=33779,Pn=35840,Un=35841,On=35842,Fn=35843,kn=36196,Nn=37492,Qn=37496,Gn=37808,zn=37809,Hn=37810,Vn=37811,jn=37812,Wn=37813,qn=37814,Xn=37815,Yn=37816,Jn=37817,Kn=37818,Zn=37819,$n=37820,ti=37821,ei=36492,ni=36494,ii=36495,ri=36283,si=36284,oi=36285,ai=36286,li=2200,ci=2201,hi=2202,ui=2300,di=2301,pi=2302,Ai=2400,fi=2401,mi=2402,gi=2500,vi=2501,yi=0,Ei=1,xi=2,bi=3200,Ci=3201,wi=3202,_i=3203,Mi=0,Si=1,Ii="",Bi="srgb",Ti="srgb-linear",Ri="linear",Li="srgb",Di=0,Pi=7680,Ui=7681,Oi=7682,Fi=7683,ki=34055,Ni=34056,Qi=5386,Gi=512,zi=513,Hi=514,Vi=515,ji=516,Wi=517,qi=518,Xi=519,Yi=512,Ji=513,Ki=514,Zi=515,$i=516,tr=517,er=518,nr=519,ir=35044,rr=35048,sr=35040,or=35045,ar=35049,lr=35041,cr=35046,hr=35050,ur=35042,dr="100",pr="300 es",Ar=2e3,fr=2001,mr={COMPUTE:"compute",RENDER:"render"};class gr{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){const n=this._listeners;return void 0!==n&&void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){const n=this._listeners;if(void 0===n)return;const i=n[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const n=e[t.type];if(void 0!==n){t.target=this;const e=n.slice(0);for(let n=0,i=e.length;n<i;n++)e[n].call(this,t);t.target=null}}}const vr=["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 yr=1234567;const Er=Math.PI/180,xr=180/Math.PI;function br(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(vr[255&t]+vr[t>>8&255]+vr[t>>16&255]+vr[t>>24&255]+"-"+vr[255&e]+vr[e>>8&255]+"-"+vr[e>>16&15|64]+vr[e>>24&255]+"-"+vr[63&n|128]+vr[n>>8&255]+"-"+vr[n>>16&255]+vr[n>>24&255]+vr[255&i]+vr[i>>8&255]+vr[i>>16&255]+vr[i>>24&255]).toLowerCase()}function Cr(t,e,n){return Math.max(e,Math.min(n,t))}function wr(t,e){return(t%e+e)%e}function _r(t,e,n){return(1-n)*t+n*e}function Mr(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Sr(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const Ir={DEG2RAD:Er,RAD2DEG:xr,generateUUID:br,clamp:Cr,euclideanModulo:wr,mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:_r,damp:function(t,e,n,i){return _r(t,e,1-Math.exp(-n*i))},pingpong:function(t,e=1){return e-Math.abs(wr(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&&(yr=t);let e=yr+=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*Er},radToDeg:function(t){return t*xr},isPowerOfTwo:function(t){return!(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 s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+i)/2),h=o((e+i)/2),u=s((e-i)/2),d=o((e-i)/2),p=s((i-e)/2),A=o((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*A,l*p,a*c);break;case"YXY":t.set(l*p,a*h,l*A,a*c);break;case"ZYZ":t.set(l*A,l*p,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:Sr,denormalize:Mr};class Br{constructor(t=0,e=0){Br.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,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=Cr(this.x,t.x,e.x),this.y=Cr(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=Cr(this.x,t,e),this.y=Cr(this.y,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Cr(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(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}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(Cr(n,-1,1))}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),i=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*n-s*i+t.x,this.y=r*i+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Tr{constructor(t,e,n,i,r,s,o,a,l){Tr.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,o,a,l)}set(t,e,n,i,r,s,o,a,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=o,c[3]=e,c[4]=r,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(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,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],A=i[0],f=i[3],m=i[6],g=i[1],v=i[4],y=i[7],E=i[2],x=i[5],b=i[8];return r[0]=s*A+o*g+a*E,r[3]=s*f+o*v+a*x,r[6]=s*m+o*y+a*b,r[1]=l*A+c*g+h*E,r[4]=l*f+c*v+h*x,r[7]=l*m+c*y+h*b,r[2]=u*A+d*g+p*E,r[5]=u*f+d*v+p*x,r[8]=u*m+d*y+p*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],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8];return e*s*c-e*o*l-n*r*c+n*o*a+i*r*l-i*s*a}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=c*s-o*l,u=o*a-c*r,d=l*r-s*a,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const A=1/p;return t[0]=h*A,t[1]=(i*l-c*n)*A,t[2]=(o*n-i*s)*A,t[3]=u*A,t[4]=(c*e-i*a)*A,t[5]=(i*r-o*e)*A,t[6]=d*A,t[7]=(n*a-l*e)*A,t[8]=(s*e-n*r)*A,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,i,r,s,o){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*s+l*o)+s+t,-i*l,i*a,-i*(-l*s+a*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(Rr.makeScale(t,e)),this}rotate(t){return this.premultiply(Rr.makeRotation(-t)),this}translate(t,e){return this.premultiply(Rr.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),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)}}const Rr=new Tr;function Lr(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const Dr={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Pr(t,e){return new Dr[t](e)}function Ur(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Or(){const t=Ur("canvas");return t.style.display="block",t}const Fr={};function kr(t){t in Fr||(Fr[t]=!0,console.warn(t))}const Nr=(new Tr).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Qr=(new Tr).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Gr(){const t={enabled:!0,workingColorSpace:Ti,spaces:{},convert:function(t,e,n){return!1!==this.enabled&&e!==n&&e&&n?(this.spaces[e].transfer===Li&&(t.r=Hr(t.r),t.g=Hr(t.g),t.b=Hr(t.b)),this.spaces[e].primaries!==this.spaces[n].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===Li&&(t.r=Vr(t.r),t.g=Vr(t.g),t.b=Vr(t.b)),t):t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return t===Ii?Ri:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,n){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[Ti]:{primaries:e,whitePoint:i,transfer:Ri,toXYZ:Nr,fromXYZ:Qr,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Bi},outputColorSpaceConfig:{drawingBufferColorSpace:Bi}},[Bi]:{primaries:e,whitePoint:i,transfer:Li,toXYZ:Nr,fromXYZ:Qr,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Bi}}}),t}const zr=Gr();function Hr(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Vr(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let jr;class Wr{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===jr&&(jr=Ur("canvas")),jr.width=t.width,jr.height=t.height;const n=jr.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=jr}return 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=Ur("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t<r.length;t++)r[t]=255*Hr(r[t]/255);return n.putImageData(i,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*Hr(e[t]/255)):e[t]=Hr(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}}let qr=0;class Xr{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:qr++}),this.uuid=br(),this.data=t,this.dataReady=!0,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:""},i=this.data;if(null!==i){let t;if(Array.isArray(i)){t=[];for(let e=0,n=i.length;e<n;e++)i[e].isDataTexture?t.push(Yr(i[e].image)):t.push(Yr(i[e]))}else t=Yr(i);n.url=t}return e||(t.images[this.uuid]=n),n}}function Yr(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Wr.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 Jr=0;class Kr extends gr{constructor(t=Kr.DEFAULT_IMAGE,e=Kr.DEFAULT_MAPPING,n=We,i=We,r=$e,s=nn,o=yn,a=sn,l=Kr.DEFAULT_ANISOTROPY,c=Ii){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Jr++}),this.uuid=br(),this.name="",this.source=new Xr(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new Br(0,0),this.repeat=new Br(1,1),this.center=new Br(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Tr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){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.channel=t.channel,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.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,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.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Ne)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case je:t.x=t.x-Math.floor(t.x);break;case We:t.x=t.x<0?0:1;break;case qe: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 je:t.y=t.y-Math.floor(t.y);break;case We:t.y=t.y<0?0:1;break;case qe: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)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}Kr.DEFAULT_IMAGE=null,Kr.DEFAULT_MAPPING=Ne,Kr.DEFAULT_ANISOTROPY=1;class Zr{constructor(t=0,e=0,n=0,i=1){Zr.prototype.isVector4=!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){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,i=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*e+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*e+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*e+s[7]*n+s[11]*i+s[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,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 s=.01,o=.1,a=t.elements,l=a[0],c=a[4],h=a[8],u=a[1],d=a[5],p=a[9],A=a[2],f=a[6],m=a[10];if(Math.abs(c-u)<s&&Math.abs(h-A)<s&&Math.abs(p-f)<s){if(Math.abs(c+u)<o&&Math.abs(h+A)<o&&Math.abs(p+f)<o&&Math.abs(l+d+m-3)<o)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,a=(d+1)/2,g=(m+1)/2,v=(c+u)/4,y=(h+A)/4,E=(p+f)/4;return t>a&&t>g?t<s?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(t),i=v/n,r=y/n):a>g?a<s?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(a),n=v/i,r=E/i):g<s?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(g),n=y/r,i=E/r),this.set(n,i,r,e),this}let g=Math.sqrt((f-p)*(f-p)+(h-A)*(h-A)+(u-c)*(u-c));return Math.abs(g)<.001&&(g=1),this.x=(f-p)/g,this.y=(h-A)/g,this.z=(u-c)/g,this.w=Math.acos((l+d+m-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],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=Cr(this.x,t.x,e.x),this.y=Cr(this.y,t.y,e.y),this.z=Cr(this.z,t.z,e.z),this.w=Cr(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=Cr(this.x,t,e),this.y=Cr(this.y,t,e),this.z=Cr(this.z,t,e),this.w=Cr(this.w,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Cr(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(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 $r extends gr{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Zr(0,0,t,e),this.scissorTest=!1,this.viewport=new Zr(0,0,t,e);const i={width:t,height:e,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:$e,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new Kr(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const s=n.count;for(let t=0;t<s;t++)this.textures[t]=r.clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==t&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=t,this.textures[i].image.height=e,this.textures[i].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.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,n=t.textures.length;e<n;e++)this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const e=Object.assign({},t.texture.image);return this.texture.source=new Xr(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ts extends $r{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}}class es extends Kr{constructor(t=null,e=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Xe,this.minFilter=Xe,this.wrapR=We,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class ns extends ts{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new es(null,t,e,n),this.texture.isRenderTargetTexture=!0}}class is extends Kr{constructor(t=null,e=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Xe,this.minFilter=Xe,this.wrapR=We,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class rs extends ts{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new is(null,t,e,n),this.texture.isRenderTargetTexture=!0}}class ss{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,r,s,o){let a=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const u=r[s+0],d=r[s+1],p=r[s+2],A=r[s+3];if(0===o)return t[e+0]=a,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===o)return t[e+0]=u,t[e+1]=d,t[e+2]=p,void(t[e+3]=A);if(h!==A||a!==u||l!==d||c!==p){let t=1-o;const e=a*u+l*d+c*p+h*A,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,e*n);t=Math.sin(t*s)/r,o=Math.sin(o*s)/r}const r=o*n;if(a=a*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+A*r,t===1-o){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,s){const o=n[i],a=n[i+1],l=n[i+2],c=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return t[e]=o*p+c*h+a*d-l*u,t[e+1]=a*p+c*u+l*h-o*d,t[e+2]=l*p+c*d+o*u-a*h,t[e+3]=c*p-o*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=!0){const n=t._x,i=t._y,r=t._z,s=t._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),u=a(n/2),d=a(i/2),p=a(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===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],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],h=e[10],u=n+o+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=(s-i)*t}else if(n>o&&n>h){const t=2*Math.sqrt(1+n-o-h);this._w=(c-a)/t,this._x=.25*t,this._y=(i+s)/t,this._z=(r+l)/t}else if(o>h){const t=2*Math.sqrt(1+o-n-h);this._w=(r-l)/t,this._x=(i+s)/t,this._y=.25*t,this._z=(a+c)/t}else{const t=2*Math.sqrt(1+h-n-o);this._w=(s-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<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(Cr(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)}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,i=t._y,r=t._z,s=t._w,o=e._x,a=e._y,l=e._z,c=e._w;return this._x=n*c+s*o+i*l-r*a,this._y=i*c+s*a+r*o-n*l,this._z=r*c+s*l+n*a-i*o,this._w=s*c-n*o-i*a-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,s=this._w;let o=s*t._w+n*t._x+i*t._y+r*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=s,this._x=n,this._y=i,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*s+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}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}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._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class os{constructor(t=0,e=0,n=0){os.prototype.isVector3=!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){return 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){return 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){return 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 this.applyQuaternion(ls.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(ls.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,s=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])*s,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,s=t.y,o=t.z,a=t.w,l=2*(s*i-o*n),c=2*(o*e-r*i),h=2*(r*n-s*e);return this.x=e+a*l+s*h-o*c,this.y=n+a*c+o*l-r*h,this.z=i+a*h+r*c-s*l,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=Cr(this.x,t.x,e.x),this.y=Cr(this.y,t.y,e.y),this.z=Cr(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=Cr(this.x,t,e),this.y=Cr(this.y,t,e),this.z=Cr(this.z,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Cr(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(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){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,s=e.x,o=e.y,a=e.z;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-i*s,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 as.copy(this).projectOnVector(t),this.sub(as)}reflect(t){return this.sub(as.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(Cr(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)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}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){return 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}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const as=new os,ls=new ss;class cs{constructor(t=new os(1/0,1/0,1/0),e=new os(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(us.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(us.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=us.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const n=t.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===e&&void 0!==i&&!0!==t.isInstancedMesh)for(let e=0,n=i.count;e<n;e++)!0===t.isMesh?t.getVertexPosition(e,us):us.fromBufferAttribute(i,e),us.applyMatrix4(t.matrixWorld),this.expandByPoint(us);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),ds.copy(t.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),ds.copy(n.boundingBox)),ds.applyMatrix4(t.matrixWorld),this.union(ds)}const i=t.children;for(let t=0,n=i.length;t<n;t++)this.expandByObject(i[t],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.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 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.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,us),us.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(ys),Es.subVectors(this.max,ys),ps.subVectors(t.a,ys),As.subVectors(t.b,ys),fs.subVectors(t.c,ys),ms.subVectors(As,ps),gs.subVectors(fs,As),vs.subVectors(ps,fs);let e=[0,-ms.z,ms.y,0,-gs.z,gs.y,0,-vs.z,vs.y,ms.z,0,-ms.x,gs.z,0,-gs.x,vs.z,0,-vs.x,-ms.y,ms.x,0,-gs.y,gs.x,0,-vs.y,vs.x,0];return!!Cs(e,ps,As,fs,Es)&&(e=[1,0,0,0,1,0,0,0,1],!!Cs(e,ps,As,fs,Es)&&(xs.crossVectors(ms,gs),e=[xs.x,xs.y,xs.z],Cs(e,ps,As,fs,Es)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,us).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(us).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()||(hs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),hs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),hs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),hs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),hs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),hs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),hs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),hs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(hs)),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 hs=[new os,new os,new os,new os,new os,new os,new os,new os],us=new os,ds=new cs,ps=new os,As=new os,fs=new os,ms=new os,gs=new os,vs=new os,ys=new os,Es=new os,xs=new os,bs=new os;function Cs(t,e,n,i,r){for(let s=0,o=t.length-3;s<=o;s+=3){bs.fromArray(t,s);const o=r.x*Math.abs(bs.x)+r.y*Math.abs(bs.y)+r.z*Math.abs(bs.z),a=e.dot(bs),l=n.dot(bs),c=i.dot(bs);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const ws=new cs,_s=new os,Ms=new os;class Ss{constructor(t=new os,e=-1){this.isSphere=!0,this.center=t,this.radius=e}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):ws.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;e<r;e++)i=Math.max(i,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return 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}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;_s.subVectors(t,this.center);const e=_s.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.addScaledVector(_s,n/t),this.radius+=n}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(Ms.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(_s.copy(t.center).add(Ms)),this.expandByPoint(_s.copy(t.center).sub(Ms))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Is=new os,Bs=new os,Ts=new os,Rs=new os,Ls=new os,Ds=new os,Ps=new os;class Us{constructor(t=new os,e=new os(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Is)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Is.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Is.copy(this.origin).addScaledVector(this.direction,e),Is.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Bs.copy(t).add(e).multiplyScalar(.5),Ts.copy(e).sub(t).normalize(),Rs.copy(this.origin).sub(Bs);const r=.5*t.distanceTo(e),s=-this.direction.dot(Ts),o=Rs.dot(this.direction),a=-Rs.dot(Ts),l=Rs.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*a-o,u=s*o-a,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+s*u+2*o)+u*(s*h+u+2*a)+l}else u=r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u=-r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-s*r+o)),u=h>0?-r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-a),r),d=u*(u+2*a)+l):(h=Math.max(0,-(s*r+o)),u=h>0?r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(Bs).addScaledVector(Ts,u),d}intersectSphere(t,e){Is.subVectors(t.center,this.origin);const n=Is.dot(this.direction),i=Is.dot(Is)-n*n,r=t.radius*t.radius;if(i>r)return null;const s=Math.sqrt(r-i),o=n-s,a=n+s;return a<0?null:o<0?this.at(a,e):this.at(o,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,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(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,s=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||r>i?null:((r>n||isNaN(n))&&(n=r),(s<i||isNaN(i))&&(i=s),h>=0?(o=(t.min.z-u.z)*h,a=(t.max.z-u.z)*h):(o=(t.max.z-u.z)*h,a=(t.min.z-u.z)*h),n>a||o>i?null:((o>n||n!=n)&&(n=o),(a<i||i!=i)&&(i=a),i<0?null:this.at(n>=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,Is)}intersectTriangle(t,e,n,i,r){Ls.subVectors(e,t),Ds.subVectors(n,t),Ps.crossVectors(Ls,Ds);let s,o=this.direction.dot(Ps);if(o>0){if(i)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}Rs.subVectors(this.origin,t);const a=s*this.direction.dot(Ds.crossVectors(Rs,Ds));if(a<0)return null;const l=s*this.direction.dot(Ls.cross(Rs));if(l<0)return null;if(a+l>o)return null;const c=-s*Rs.dot(Ps);return c<0?null:this.at(c/o,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)}clone(){return(new this.constructor).copy(this)}}class Os{constructor(t,e,n,i,r,s,o,a,l,c,h,u,d,p,A,f){Os.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,o,a,l,c,h,u,d,p,A,f)}set(t,e,n,i,r,s,o,a,l,c,h,u,d,p,A,f){const m=this.elements;return m[0]=t,m[4]=e,m[8]=n,m[12]=i,m[1]=r,m[5]=s,m[9]=o,m[13]=a,m[2]=l,m[6]=c,m[10]=h,m[14]=u,m[3]=d,m[7]=p,m[11]=A,m[15]=f,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 Os).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}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),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/Fs.setFromMatrixColumn(t,0).length(),r=1/Fs.setFromMatrixColumn(t,1).length(),s=1/Fs.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]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=s*c,n=s*h,i=o*c,r=o*h;e[0]=a*c,e[4]=-a*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-o*a,e[2]=r-t*l,e[6]=i+n*l,e[10]=s*a}else if("YXZ"===t.order){const t=a*c,n=a*h,i=l*c,r=l*h;e[0]=t+r*o,e[4]=i*o-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-o,e[2]=n*o-i,e[6]=r+t*o,e[10]=s*a}else if("ZXY"===t.order){const t=a*c,n=a*h,i=l*c,r=l*h;e[0]=t-r*o,e[4]=-s*h,e[8]=i+n*o,e[1]=n+i*o,e[5]=s*c,e[9]=r-t*o,e[2]=-s*l,e[6]=o,e[10]=s*a}else if("ZYX"===t.order){const t=s*c,n=s*h,i=o*c,r=o*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]=o*a,e[10]=s*a}else if("YZX"===t.order){const t=s*a,n=s*l,i=o*a,r=o*l;e[0]=a*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=s*c,e[9]=-o*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=s*a,n=s*l,i=o*a,r=o*l;e[0]=a*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=s*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=o*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(Ns,t,Qs)}lookAt(t,e,n){const i=this.elements;return Hs.subVectors(t,e),0===Hs.lengthSq()&&(Hs.z=1),Hs.normalize(),Gs.crossVectors(n,Hs),0===Gs.lengthSq()&&(1===Math.abs(n.z)?Hs.x+=1e-4:Hs.z+=1e-4,Hs.normalize(),Gs.crossVectors(n,Hs)),Gs.normalize(),zs.crossVectors(Hs,Gs),i[0]=Gs.x,i[4]=zs.x,i[8]=Hs.x,i[1]=Gs.y,i[5]=zs.y,i[9]=Hs.y,i[2]=Gs.z,i[6]=zs.z,i[10]=Hs.z,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,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],A=n[6],f=n[10],m=n[14],g=n[3],v=n[7],y=n[11],E=n[15],x=i[0],b=i[4],C=i[8],w=i[12],_=i[1],M=i[5],S=i[9],I=i[13],B=i[2],T=i[6],R=i[10],L=i[14],D=i[3],P=i[7],U=i[11],O=i[15];return r[0]=s*x+o*_+a*B+l*D,r[4]=s*b+o*M+a*T+l*P,r[8]=s*C+o*S+a*R+l*U,r[12]=s*w+o*I+a*L+l*O,r[1]=c*x+h*_+u*B+d*D,r[5]=c*b+h*M+u*T+d*P,r[9]=c*C+h*S+u*R+d*U,r[13]=c*w+h*I+u*L+d*O,r[2]=p*x+A*_+f*B+m*D,r[6]=p*b+A*M+f*T+m*P,r[10]=p*C+A*S+f*R+m*U,r[14]=p*w+A*I+f*L+m*O,r[3]=g*x+v*_+y*B+E*D,r[7]=g*b+v*M+y*T+E*P,r[11]=g*C+v*S+y*R+E*U,r[15]=g*w+v*I+y*L+E*O,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],s=t[1],o=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*o*u+n*l*u+i*o*d-n*a*d)+t[7]*(+e*a*d-e*l*u+r*s*u-i*s*d+i*l*c-r*a*c)+t[11]*(+e*l*h-e*o*d-r*s*h+n*s*d+r*o*c-n*l*c)+t[15]*(-i*o*c-e*a*h+e*o*u+i*s*h-n*s*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}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],A=t[13],f=t[14],m=t[15],g=h*f*l-A*u*l+A*a*d-o*f*d-h*a*m+o*u*m,v=p*u*l-c*f*l-p*a*d+s*f*d+c*a*m-s*u*m,y=c*A*l-p*h*l+p*o*d-s*A*d-c*o*m+s*h*m,E=p*h*a-c*A*a-p*o*u+s*A*u+c*o*f-s*h*f,x=e*g+n*v+i*y+r*E;if(0===x)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/x;return t[0]=g*b,t[1]=(A*u*r-h*f*r-A*i*d+n*f*d+h*i*m-n*u*m)*b,t[2]=(o*f*r-A*a*r+A*i*l-n*f*l-o*i*m+n*a*m)*b,t[3]=(h*a*r-o*u*r-h*i*l+n*u*l+o*i*d-n*a*d)*b,t[4]=v*b,t[5]=(c*f*r-p*u*r+p*i*d-e*f*d-c*i*m+e*u*m)*b,t[6]=(p*a*r-s*f*r-p*i*l+e*f*l+s*i*m-e*a*m)*b,t[7]=(s*u*r-c*a*r+c*i*l-e*u*l-s*i*d+e*a*d)*b,t[8]=y*b,t[9]=(p*h*r-c*A*r-p*n*d+e*A*d+c*n*m-e*h*m)*b,t[10]=(s*A*r-p*o*r+p*n*l-e*A*l-s*n*m+e*o*m)*b,t[11]=(c*o*r-s*h*r-c*n*l+e*h*l+s*n*d-e*o*d)*b,t[12]=E*b,t[13]=(c*A*i-p*h*i+p*n*u-e*A*u-c*n*f+e*h*f)*b,t[14]=(p*o*i-s*A*i-p*n*a+e*A*a+s*n*f-e*o*f)*b,t[15]=(s*h*i-c*o*i+c*n*a-e*h*a-s*n*u+e*o*u)*b,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 t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):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,s=t.x,o=t.y,a=t.z,l=r*s,c=r*o;return this.set(l*s+n,l*o-i*a,l*a+i*o,0,l*o+i*a,c*o+n,c*a-i*s,0,l*a-i*o,c*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(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,i,r,s){return this.set(1,n,r,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,s=e._y,o=e._z,a=e._w,l=r+r,c=s+s,h=o+o,u=r*l,d=r*c,p=r*h,A=s*c,f=s*h,m=o*h,g=a*l,v=a*c,y=a*h,E=n.x,x=n.y,b=n.z;return i[0]=(1-(A+m))*E,i[1]=(d+y)*E,i[2]=(p-v)*E,i[3]=0,i[4]=(d-y)*x,i[5]=(1-(u+m))*x,i[6]=(f+g)*x,i[7]=0,i[8]=(p+v)*b,i[9]=(f-g)*b,i[10]=(1-(u+A))*b,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=Fs.set(i[0],i[1],i[2]).length();const s=Fs.set(i[4],i[5],i[6]).length(),o=Fs.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],ks.copy(this);const a=1/r,l=1/s,c=1/o;return ks.elements[0]*=a,ks.elements[1]*=a,ks.elements[2]*=a,ks.elements[4]*=l,ks.elements[5]*=l,ks.elements[6]*=l,ks.elements[8]*=c,ks.elements[9]*=c,ks.elements[10]*=c,e.setFromRotationMatrix(ks),n.x=r,n.y=s,n.z=o,this}makePerspective(t,e,n,i,r,s,o=Ar){const a=this.elements,l=2*r/(e-t),c=2*r/(n-i),h=(e+t)/(e-t),u=(n+i)/(n-i);let d,p;if(o===Ar)d=-(s+r)/(s-r),p=-2*s*r/(s-r);else{if(o!==fr)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);d=-s/(s-r),p=-s*r/(s-r)}return a[0]=l,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=c,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,n,i,r,s,o=Ar){const a=this.elements,l=1/(e-t),c=1/(n-i),h=1/(s-r),u=(e+t)*l,d=(n+i)*c;let p,A;if(o===Ar)p=(s+r)*h,A=-2*h;else{if(o!==fr)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);p=r*h,A=-1*h}return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=A,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[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 Fs=new os,ks=new Os,Ns=new os(0,0,0),Qs=new os(1,1,1),Gs=new os,zs=new os,Hs=new os,Vs=new Os,js=new ss;class Ws{constructor(t=0,e=0,n=0,i=Ws.DEFAULT_ORDER){this.isEuler=!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=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,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=this._order,n=!0){const i=t.elements,r=i[0],s=i[4],o=i[8],a=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(Cr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Cr(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Cr(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-Cr(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Cr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-Cr(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Vs.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Vs,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return js.setFromEuler(this),this.setFromQuaternion(js,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}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ws.DEFAULT_ORDER="XYZ";class qs{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return!!(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let Xs=0;const Ys=new os,Js=new ss,Ks=new Os,Zs=new os,$s=new os,to=new os,eo=new ss,no=new os(1,0,0),io=new os(0,1,0),ro=new os(0,0,1),so={type:"added"},oo={type:"removed"},ao={type:"childadded",child:null},lo={type:"childremoved",child:null};class co extends gr{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Xs++}),this.uuid=br(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=co.DEFAULT_UP.clone();const t=new os,e=new Ws,n=new ss,i=new os(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Os},normalMatrix:{value:new Tr}}),this.matrix=new Os,this.matrixWorld=new Os,this.matrixAutoUpdate=co.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=co.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new qs,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Js.setFromAxisAngle(t,e),this.quaternion.multiply(Js),this}rotateOnWorldAxis(t,e){return Js.setFromAxisAngle(t,e),this.quaternion.premultiply(Js),this}rotateX(t){return this.rotateOnAxis(no,t)}rotateY(t){return this.rotateOnAxis(io,t)}rotateZ(t){return this.rotateOnAxis(ro,t)}translateOnAxis(t,e){return Ys.copy(t).applyQuaternion(this.quaternion),this.position.add(Ys.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(no,t)}translateY(t){return this.translateOnAxis(io,t)}translateZ(t){return this.translateOnAxis(ro,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Ks.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Zs.copy(t):Zs.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),$s.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ks.lookAt($s,Zs,this.up):Ks.lookAt(Zs,$s,this.up),this.quaternion.setFromRotationMatrix(Ks),i&&(Ks.extractRotation(i.matrixWorld),Js.setFromRotationMatrix(Ks),this.quaternion.premultiply(Js.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(so),ao.child=t,this.dispatchEvent(ao),ao.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(oo),lo.child=t,this.dispatchEvent(lo),lo.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Ks.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Ks.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ks),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(so),ao.child=t,this.dispatchEvent(ao),ao.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);const i=this.children;for(let r=0,s=i.length;r<s;r++)i[r].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose($s,t,to),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose($s,eo,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map((t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()}))),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(t),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e<i;e++){const i=n[e];r(t.shapes,i)}else r(t.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,i=this.material.length;n<i;n++)e.push(r(t.materials,this.material[n]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];i.animations.push(r(t.animations,n))}}if(e){const e=s(t.geometries),i=s(t.materials),r=s(t.textures),o=s(t.images),a=s(t.shapes),l=s(t.skeletons),c=s(t.animations),h=s(t.nodes);e.length>0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(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.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,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.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}}co.DEFAULT_UP=new os(0,1,0),co.DEFAULT_MATRIX_AUTO_UPDATE=!0,co.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ho=new os,uo=new os,po=new os,Ao=new os,fo=new os,mo=new os,go=new os,vo=new os,yo=new os,Eo=new os,xo=new Zr,bo=new Zr,Co=new Zr;class wo{constructor(t=new os,e=new os,n=new os){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),ho.subVectors(t,e),i.cross(ho);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){ho.subVectors(i,e),uo.subVectors(n,e),po.subVectors(t,e);const s=ho.dot(ho),o=ho.dot(uo),a=ho.dot(po),l=uo.dot(uo),c=uo.dot(po),h=s*l-o*o;if(0===h)return r.set(0,0,0),null;const u=1/h,d=(l*a-o*c)*u,p=(s*c-o*a)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return null!==this.getBarycoord(t,e,n,i,Ao)&&Ao.x>=0&&Ao.y>=0&&Ao.x+Ao.y<=1}static getInterpolation(t,e,n,i,r,s,o,a){return null===this.getBarycoord(t,e,n,i,Ao)?(a.x=0,a.y=0,"z"in a&&(a.z=0),"w"in a&&(a.w=0),null):(a.setScalar(0),a.addScaledVector(r,Ao.x),a.addScaledVector(s,Ao.y),a.addScaledVector(o,Ao.z),a)}static getInterpolatedAttribute(t,e,n,i,r,s){return xo.setScalar(0),bo.setScalar(0),Co.setScalar(0),xo.fromBufferAttribute(t,e),bo.fromBufferAttribute(t,n),Co.fromBufferAttribute(t,i),s.setScalar(0),s.addScaledVector(xo,r.x),s.addScaledVector(bo,r.y),s.addScaledVector(Co,r.z),s}static isFrontFacing(t,e,n,i){return ho.subVectors(n,e),uo.subVectors(t,e),ho.cross(uo).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}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(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 ho.subVectors(this.c,this.b),uo.subVectors(this.a,this.b),.5*ho.cross(uo).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return wo.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return wo.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,r){return wo.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return wo.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return wo.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let s,o;fo.subVectors(i,n),mo.subVectors(r,n),vo.subVectors(t,n);const a=fo.dot(vo),l=mo.dot(vo);if(a<=0&&l<=0)return e.copy(n);yo.subVectors(t,i);const c=fo.dot(yo),h=mo.dot(yo);if(c>=0&&h<=c)return e.copy(i);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return s=a/(a-c),e.copy(n).addScaledVector(fo,s);Eo.subVectors(t,r);const d=fo.dot(Eo),p=mo.dot(Eo);if(p>=0&&d<=p)return e.copy(r);const A=d*l-a*p;if(A<=0&&l>=0&&p<=0)return o=l/(l-p),e.copy(n).addScaledVector(mo,o);const f=c*p-d*h;if(f<=0&&h-c>=0&&d-p>=0)return go.subVectors(r,i),o=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(go,o);const m=1/(f+A+u);return s=A*m,o=u*m,e.copy(n).addScaledVector(fo,s).addScaledVector(mo,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const _o={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},Mo={h:0,s:0,l:0},So={h:0,s:0,l:0};function Io(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}class Bo{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(void 0===e&&void 0===n){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Bi){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,zr.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i=zr.workingColorSpace){return this.r=t,this.g=e,this.b=n,zr.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i=zr.workingColorSpace){if(t=wr(t,1),e=Cr(e,0,1),n=Cr(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=Io(r,i,t+1/3),this.g=Io(r,i,t),this.b=Io(r,i,t-1/3)}return zr.toWorkingColorSpace(this,i),this}setStyle(t,e=Bi){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const s=i[1],o=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(n,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Bi){const n=_o[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=Hr(t.r),this.g=Hr(t.g),this.b=Hr(t.b),this}copyLinearToSRGB(t){return this.r=Vr(t.r),this.g=Vr(t.g),this.b=Vr(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Bi){return zr.fromWorkingColorSpace(To.copy(this),t),65536*Math.round(Cr(255*To.r,0,255))+256*Math.round(Cr(255*To.g,0,255))+Math.round(Cr(255*To.b,0,255))}getHexString(t=Bi){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=zr.workingColorSpace){zr.fromWorkingColorSpace(To.copy(this),e);const n=To.r,i=To.g,r=To.b,s=Math.max(n,i,r),o=Math.min(n,i,r);let a,l;const c=(o+s)/2;if(o===s)a=0,l=0;else{const t=s-o;switch(l=c<=.5?t/(s+o):t/(2-s-o),s){case n:a=(i-r)/t+(i<r?6:0);break;case i:a=(r-n)/t+2;break;case r:a=(n-i)/t+4}a/=6}return t.h=a,t.s=l,t.l=c,t}getRGB(t,e=zr.workingColorSpace){return zr.fromWorkingColorSpace(To.copy(this),e),t.r=To.r,t.g=To.g,t.b=To.b,t}getStyle(t=Bi){zr.fromWorkingColorSpace(To.copy(this),t);const e=To.r,n=To.g,i=To.b;return t!==Bi?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(t,e,n){return this.getHSL(Mo),this.setHSL(Mo.h+t,Mo.s+e,Mo.l+n)}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(Mo),t.getHSL(So);const n=_r(Mo.h,So.h,e),i=_r(Mo.s,So.s,e),r=_r(Mo.l,So.l,e);return this.setHSL(n,i,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,n=this.g,i=this.b,r=t.elements;return this.r=r[0]*e+r[3]*n+r[6]*i,this.g=r[1]*e+r[4]*n+r[7]*i,this.b=r[2]*e+r[5]*n+r[8]*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}}const To=new Bo;Bo.NAMES=_o;let Ro=0;class Lo extends gr{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ro++}),this.uuid=br(),this.name="",this.type="Material",this.blending=qt,this.side=Ht,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ae,this.blendDst=le,this.blendEquation=Zt,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Bo(0,0,0),this.blendAlpha=0,this.depthFunc=xe,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Xi,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Pi,this.stencilZFail=Pi,this.stencilZPass=Pi,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),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(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==qt&&(n.blending=this.blending),this.side!==Ht&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==ae&&(n.blendSrc=this.blendSrc),this.blendDst!==le&&(n.blendDst=this.blendDst),this.blendEquation!==Zt&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==xe&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Xi&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Pi&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Pi&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Pi&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),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=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(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(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,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.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,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.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Do extends Lo{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Bo(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ws,this.combine=Me,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(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.envMapRotation.copy(t.envMapRotation),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.fog=t.fog,this}}const Po=Uo();function Uo(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),i=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(i[t]=0,i[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(i[t]=1024>>-e-14,i[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(i[t]=e+15<<10,i[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(i[t]=31744,i[256|t]=64512,r[t]=24,r[256|t]=24):(i[t]=31744,i[256|t]=64512,r[t]=13,r[256|t]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,n=0;for(;!(8388608&e);)e<<=1,n-=8388608;e&=-8388609,n+=947912704,s[t]=e|n}for(let t=1024;t<2048;++t)s[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)o[t]=t<<23;o[31]=1199570944,o[32]=2147483648;for(let t=33;t<63;++t)o[t]=2147483648+(t-32<<23);o[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(a[t]=1024);return{floatView:e,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function Oo(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Cr(t,-65504,65504),Po.floatView[0]=t;const e=Po.uint32View[0],n=e>>23&511;return Po.baseTable[n]+((8388607&e)>>Po.shiftTable[n])}function Fo(t){const e=t>>10;return Po.uint32View[0]=Po.mantissaTable[Po.offsetTable[e]+(1023&t)]+Po.exponentTable[e],Po.floatView[0]}const ko={toHalfFloat:Oo,fromHalfFloat:Fo},No=new os,Qo=new Br;let Go=0;class zo{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Go++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=n,this.usage=ir,this.updateRanges=[],this.gpuType=un,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(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.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)Qo.fromBufferAttribute(this,e),Qo.applyMatrix3(t),this.setXY(e,Qo.x,Qo.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)No.fromBufferAttribute(this,e),No.applyMatrix3(t),this.setXYZ(e,No.x,No.y,No.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)No.fromBufferAttribute(this,e),No.applyMatrix4(t),this.setXYZ(e,No.x,No.y,No.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)No.fromBufferAttribute(this,e),No.applyNormalMatrix(t),this.setXYZ(e,No.x,No.y,No.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)No.fromBufferAttribute(this,e),No.transformDirection(t),this.setXYZ(e,No.x,No.y,No.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=Mr(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=Sr(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Mr(e,this.array)),e}setX(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Mr(e,this.array)),e}setY(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Mr(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Mr(e,this.array)),e}setW(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array),r=Sr(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==ir&&(t.usage=this.usage),t}}class Ho extends zo{constructor(t,e,n){super(new Int8Array(t),e,n)}}class Vo extends zo{constructor(t,e,n){super(new Uint8Array(t),e,n)}}class jo extends zo{constructor(t,e,n){super(new Uint8ClampedArray(t),e,n)}}class Wo extends zo{constructor(t,e,n){super(new Int16Array(t),e,n)}}class qo extends zo{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Xo extends zo{constructor(t,e,n){super(new Int32Array(t),e,n)}}class Yo extends zo{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class Jo extends zo{constructor(t,e,n){super(new Uint16Array(t),e,n),this.isFloat16BufferAttribute=!0}getX(t){let e=Fo(this.array[t*this.itemSize]);return this.normalized&&(e=Mr(e,this.array)),e}setX(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize]=Oo(e),this}getY(t){let e=Fo(this.array[t*this.itemSize+1]);return this.normalized&&(e=Mr(e,this.array)),e}setY(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+1]=Oo(e),this}getZ(t){let e=Fo(this.array[t*this.itemSize+2]);return this.normalized&&(e=Mr(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+2]=Oo(e),this}getW(t){let e=Fo(this.array[t*this.itemSize+3]);return this.normalized&&(e=Mr(e,this.array)),e}setW(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+3]=Oo(e),this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array)),this.array[t+0]=Oo(e),this.array[t+1]=Oo(n),this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array)),this.array[t+0]=Oo(e),this.array[t+1]=Oo(n),this.array[t+2]=Oo(i),this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array),r=Sr(r,this.array)),this.array[t+0]=Oo(e),this.array[t+1]=Oo(n),this.array[t+2]=Oo(i),this.array[t+3]=Oo(r),this}}class Ko extends zo{constructor(t,e,n){super(new Float32Array(t),e,n)}}let Zo=0;const $o=new Os,ta=new co,ea=new os,na=new cs,ia=new cs,ra=new os;class sa extends gr{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Zo++}),this.uuid=br(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=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(t){return Array.isArray(t)?this.index=new(Lr(t)?Yo:qo)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(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 Tr).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}applyQuaternion(t){return $o.makeRotationFromQuaternion(t),this.applyMatrix4($o),this}rotateX(t){return $o.makeRotationX(t),this.applyMatrix4($o),this}rotateY(t){return $o.makeRotationY(t),this.applyMatrix4($o),this}rotateZ(t){return $o.makeRotationZ(t),this.applyMatrix4($o),this}translate(t,e,n){return $o.makeTranslation(t,e,n),this.applyMatrix4($o),this}scale(t,e,n){return $o.makeScale(t,e,n),this.applyMatrix4($o),this}lookAt(t){return ta.lookAt(t),ta.updateMatrix(),this.applyMatrix4(ta.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ea).negate(),this.translate(ea.x,ea.y,ea.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];e.push(i.x,i.y,i.z||0)}this.setAttribute("position",new Ko(e,3))}else{const n=Math.min(t.length,e.count);for(let i=0;i<n;i++){const n=t[i];e.setXYZ(i,n.x,n.y,n.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new cs);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.",this),void this.boundingBox.set(new os(-1/0,-1/0,-1/0),new os(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];na.setFromBufferAttribute(n),this.morphTargetsRelative?(ra.addVectors(this.boundingBox.min,na.min),this.boundingBox.expandByPoint(ra),ra.addVectors(this.boundingBox.max,na.max),this.boundingBox.expandByPoint(ra)):(this.boundingBox.expandByPoint(na.min),this.boundingBox.expandByPoint(na.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Ss);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new os,1/0);if(t){const n=this.boundingSphere.center;if(na.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];ia.setFromBufferAttribute(n),this.morphTargetsRelative?(ra.addVectors(na.min,ia.min),na.expandByPoint(ra),ra.addVectors(na.max,ia.max),na.expandByPoint(ra)):(na.expandByPoint(ia.min),na.expandByPoint(ia.max))}na.getCenter(n);let i=0;for(let e=0,r=t.count;e<r;e++)ra.fromBufferAttribute(t,e),i=Math.max(i,n.distanceToSquared(ra));if(e)for(let r=0,s=e.length;r<s;r++){const s=e[r],o=this.morphTargetsRelative;for(let e=0,r=s.count;e<r;e++)ra.fromBufferAttribute(s,e),o&&(ea.fromBufferAttribute(t,e),ra.add(ea)),i=Math.max(i,n.distanceToSquared(ra))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=e.position,i=e.normal,r=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new zo(new Float32Array(4*n.count),4));const s=this.getAttribute("tangent"),o=[],a=[];for(let t=0;t<n.count;t++)o[t]=new os,a[t]=new os;const l=new os,c=new os,h=new os,u=new Br,d=new Br,p=new Br,A=new os,f=new os;function m(t,e,i){l.fromBufferAttribute(n,t),c.fromBufferAttribute(n,e),h.fromBufferAttribute(n,i),u.fromBufferAttribute(r,t),d.fromBufferAttribute(r,e),p.fromBufferAttribute(r,i),c.sub(l),h.sub(l),d.sub(u),p.sub(u);const s=1/(d.x*p.y-p.x*d.y);isFinite(s)&&(A.copy(c).multiplyScalar(p.y).addScaledVector(h,-d.y).multiplyScalar(s),f.copy(h).multiplyScalar(d.x).addScaledVector(c,-p.x).multiplyScalar(s),o[t].add(A),o[e].add(A),o[i].add(A),a[t].add(f),a[e].add(f),a[i].add(f))}let g=this.groups;0===g.length&&(g=[{start:0,count:t.count}]);for(let e=0,n=g.length;e<n;++e){const n=g[e],i=n.start;for(let e=i,r=i+n.count;e<r;e+=3)m(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const v=new os,y=new os,E=new os,x=new os;function b(t){E.fromBufferAttribute(i,t),x.copy(E);const e=o[t];v.copy(e),v.sub(E.multiplyScalar(E.dot(e))).normalize(),y.crossVectors(x,e);const n=y.dot(a[t])<0?-1:1;s.setXYZW(t,v.x,v.y,v.z,n)}for(let e=0,n=g.length;e<n;++e){const n=g[e],i=n.start;for(let e=i,r=i+n.count;e<r;e+=3)b(t.getX(e+0)),b(t.getX(e+1)),b(t.getX(e+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new zo(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const i=new os,r=new os,s=new os,o=new os,a=new os,l=new os,c=new os,h=new os;if(t)for(let u=0,d=t.count;u<d;u+=3){const d=t.getX(u+0),p=t.getX(u+1),A=t.getX(u+2);i.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),s.fromBufferAttribute(e,A),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),o.fromBufferAttribute(n,d),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,A),o.add(c),a.add(c),l.add(c),n.setXYZ(d,o.x,o.y,o.z),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(A,l.x,l.y,l.z)}else for(let t=0,o=e.count;t<o;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),s.fromBufferAttribute(e,t+2),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),n.setXYZ(t+0,c.x,c.y,c.z),n.setXYZ(t+1,c.x,c.y,c.z),n.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)ra.fromBufferAttribute(t,e),ra.normalize(),t.setXYZ(e,ra.x,ra.y,ra.z)}toNonIndexed(){function t(t,e){const n=t.array,i=t.itemSize,r=t.normalized,s=new n.constructor(e.length*i);let o=0,a=0;for(let r=0,l=e.length;r<l;r++){o=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*i;for(let t=0;t<i;t++)s[a++]=n[o++]}return new zo(s,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new sa,n=this.index.array,i=this.attributes;for(const r in i){const s=t(i[r],n);e.setAttribute(r,s)}const r=this.morphAttributes;for(const i in r){const s=[],o=r[i];for(let e=0,i=o.length;e<i;e++){const i=t(o[e],n);s.push(i)}e.morphAttributes[i]=s}e.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let t=0,n=s.length;t<n;t++){const n=s[t];e.addGroup(n.start,n.count,n.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(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];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],s=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];s.push(i.toJSON(t.data))}s.length>0&&(i[e]=s,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return(new this.constructor).copy(this)}copy(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;t<r;t++)n.push(i[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const s=t.groups;for(let t=0,e=s.length;t<e;t++){const e=s[t];this.addGroup(e.start,e.count,e.materialIndex)}const o=t.boundingBox;null!==o&&(this.boundingBox=o.clone());const a=t.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const oa=new Os,aa=new Us,la=new Ss,ca=new os,ha=new os,ua=new os,da=new os,pa=new os,Aa=new os,fa=new os,ma=new os;class ga extends co{constructor(t=new sa,e=new Do){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;e.fromBufferAttribute(i,t);const o=this.morphTargetInfluences;if(r&&o){Aa.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=o[n],a=r[n];0!==i&&(pa.fromBufferAttribute(a,t),s?Aa.addScaledVector(pa,i):Aa.addScaledVector(pa.sub(e),i))}e.add(Aa)}return e}raycast(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),la.copy(n.boundingSphere),la.applyMatrix4(r),aa.copy(t.ray).recast(t.near),!1===la.containsPoint(aa.origin)){if(null===aa.intersectSphere(la,ca))return;if(aa.origin.distanceToSquared(ca)>(t.far-t.near)**2)return}oa.copy(r).invert(),aa.copy(t.ray).applyMatrix4(oa),null!==n.boundingBox&&!1===aa.intersectsBox(n.boundingBox)||this._computeIntersections(t,e,aa)}}_computeIntersections(t,e,n){let i;const r=this.geometry,s=this.material,o=r.index,a=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==o)if(Array.isArray(s))for(let r=0,a=u.length;r<a;r++){const a=u[r],p=s[a.materialIndex];for(let r=Math.max(a.start,d.start),s=Math.min(o.count,Math.min(a.start+a.count,d.start+d.count));r<s;r+=3)i=va(this,p,t,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=a.materialIndex,e.push(i))}else for(let r=Math.max(0,d.start),a=Math.min(o.count,d.start+d.count);r<a;r+=3)i=va(this,s,t,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),e.push(i));else if(void 0!==a)if(Array.isArray(s))for(let r=0,o=u.length;r<o;r++){const o=u[r],p=s[o.materialIndex];for(let r=Math.max(o.start,d.start),s=Math.min(a.count,Math.min(o.start+o.count,d.start+d.count));r<s;r+=3)i=va(this,p,t,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,e.push(i))}else for(let r=Math.max(0,d.start),o=Math.min(a.count,d.start+d.count);r<o;r+=3)i=va(this,s,t,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),e.push(i))}}function va(t,e,n,i,r,s,o,a,l,c){t.getVertexPosition(a,ha),t.getVertexPosition(l,ua),t.getVertexPosition(c,da);const h=function(t,e,n,i,r,s,o,a){let l;if(l=e.side===Vt?i.intersectTriangle(o,s,r,!0,a):i.intersectTriangle(r,s,o,e.side===Ht,a),null===l)return null;ma.copy(a),ma.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(ma);return c<n.near||c>n.far?null:{distance:c,point:ma.clone(),object:t}}(t,e,n,i,ha,ua,da,fa);if(h){const t=new os;wo.getBarycoord(fa,ha,ua,da,t),r&&(h.uv=wo.getInterpolatedAttribute(r,a,l,c,t,new Br)),s&&(h.uv1=wo.getInterpolatedAttribute(s,a,l,c,t,new Br)),o&&(h.normal=wo.getInterpolatedAttribute(o,a,l,c,t,new os),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const e={a,b:l,c,normal:new os,materialIndex:0};wo.getNormal(ha,ua,da,e.normal),h.face=e,h.barycoord=t}return h}class ya extends sa{constructor(t=1,e=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const a=[],l=[],c=[],h=[];let u=0,d=0;function p(t,e,n,i,r,s,p,A,f,m,g){const v=s/f,y=p/m,E=s/2,x=p/2,b=A/2,C=f+1,w=m+1;let _=0,M=0;const S=new os;for(let s=0;s<w;s++){const o=s*y-x;for(let a=0;a<C;a++){const u=a*v-E;S[t]=u*i,S[e]=o*r,S[n]=b,l.push(S.x,S.y,S.z),S[t]=0,S[e]=0,S[n]=A>0?1:-1,c.push(S.x,S.y,S.z),h.push(a/f),h.push(1-s/m),_+=1}}for(let t=0;t<m;t++)for(let e=0;e<f;e++){const n=u+e+C*t,i=u+e+C*(t+1),r=u+(e+1)+C*(t+1),s=u+(e+1)+C*t;a.push(n,i,s),a.push(i,r,s),M+=6}o.addGroup(d,M,g),d+=M,u+=_}p("z","y","x",-1,-1,n,e,t,s,r,0),p("z","y","x",1,-1,n,e,-t,s,r,1),p("x","z","y",1,1,t,n,e,i,s,2),p("x","z","y",1,-1,t,n,-e,i,s,3),p("x","y","z",1,-1,t,e,n,i,r,4),p("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(a),this.setAttribute("position",new Ko(l,3)),this.setAttribute("normal",new Ko(c,3)),this.setAttribute("uv",new Ko(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ya(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Ea(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function xa(t){const e={};for(let n=0;n<t.length;n++){const i=Ea(t[n]);for(const t in i)e[t]=i[t]}return e}function ba(t){const e=t.getRenderTarget();return null===e?t.outputColorSpace:!0===e.isXRRenderTarget?e.texture.colorSpace:zr.workingColorSpace}const Ca={clone:Ea,merge:xa};class wa extends Lo{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ea(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?e.uniforms[n]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[n]={type:"m4",value:i.toArray()}:e.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;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}}class _a extends co{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Os,this.projectionMatrix=new Os,this.projectionMatrixInverse=new Os,this.coordinateSystem=Ar}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const Ma=new os,Sa=new Br,Ia=new Br;class Ba extends _a{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(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(t){const e=.5*this.getFilmHeight()/t;this.fov=2*xr*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*Er*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*xr*Math.atan(Math.tan(.5*Er*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){Ma.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Ma.x,Ma.y).multiplyScalar(-t/Ma.z),Ma.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ma.x,Ma.y).multiplyScalar(-t/Ma.z)}getViewSize(t,e){return this.getViewBounds(t,Sa,Ia),e.subVectors(Ia,Sa)}setViewOffset(t,e,n,i,r,s){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=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*Er*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,o=s.fullHeight;r+=s.offsetX*i/t,e-=s.offsetY*n/o,i*=s.width/t,n*=s.height/o}const o=this.filmOffset;0!==o&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(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 Ta=-90;class Ra extends co{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Ba(Ta,1,t,e);i.layers=this.layers,this.add(i);const r=new Ba(Ta,1,t,e);r.layers=this.layers,this.add(r);const s=new Ba(Ta,1,t,e);s.layers=this.layers,this.add(s);const o=new Ba(Ta,1,t,e);o.layers=this.layers,this.add(o);const a=new Ba(Ta,1,t,e);a.layers=this.layers,this.add(a);const l=new Ba(Ta,1,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,i,r,s,o,a]=e;for(const t of e)this.remove(t);if(t===Ar)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),a.up.set(0,1,0),a.lookAt(0,0,-1);else{if(t!==fr)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),a.up.set(0,-1,0),a.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,s,o,a,l,c]=this.children,h=t.getRenderTarget(),u=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const A=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,i),t.render(e,r),t.setRenderTarget(n,1,i),t.render(e,s),t.setRenderTarget(n,2,i),t.render(e,o),t.setRenderTarget(n,3,i),t.render(e,a),t.setRenderTarget(n,4,i),t.render(e,l),n.texture.generateMipmaps=A,t.setRenderTarget(n,5,i),t.render(e,c),t.setRenderTarget(h,u,d),t.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class La extends Kr{constructor(t,e,n,i,r,s,o,a,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:Qe,n,i,r,s,o,a,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Da extends ts{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new La(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:$e}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,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\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",s=new ya(5,5,5),o=new wa({name:"CubemapFromEquirect",uniforms:Ea(n),vertexShader:i,fragmentShader:r,side:Vt,blending:Wt});o.uniforms.tEquirect.value=e;const a=new ga(s,o),l=e.minFilter;return e.minFilter===nn&&(e.minFilter=$e),new Ra(1,10,this).update(t,a),e.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(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)}}class Pa extends co{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Ua={type:"move"};class Oa{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Pa,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Pa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new os,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new os),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Pa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new os,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new os),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(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(t,e,n){let i=null,r=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(l&&t.hand){s=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n),r=this._getHandJoint(l,i);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=i.position.distanceTo(r.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else 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),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));null!==o&&(i=e.getPose(t.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Ua)))}return null!==o&&(o.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const n=new Pa;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}class Fa{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new Bo(t),this.density=e}clone(){return new Fa(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class ka{constructor(t,e=1,n=1e3){this.isFog=!0,this.name="",this.color=new Bo(t),this.near=e,this.far=n}clone(){return new ka(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Na extends co{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ws,this.environmentIntensity=1,this.environmentRotation=new Ws,this.overrideMaterial=null,"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()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class Qa{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=ir,this.updateRanges=[],this.version=0,this.uuid=br()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=br()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=br()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Ga=new os;class za{constructor(t,e,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)Ga.fromBufferAttribute(this,e),Ga.applyMatrix4(t),this.setXYZ(e,Ga.x,Ga.y,Ga.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Ga.fromBufferAttribute(this,e),Ga.applyNormalMatrix(t),this.setXYZ(e,Ga.x,Ga.y,Ga.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Ga.fromBufferAttribute(this,e),Ga.transformDirection(t),this.setXYZ(e,Ga.x,Ga.y,Ga.z);return this}getComponent(t,e){let n=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(n=Mr(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=Sr(n,this.array)),this.data.array[t*this.data.stride+this.offset+e]=n,this}setX(t,e){return this.normalized&&(e=Sr(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=Sr(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=Sr(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=Sr(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Mr(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Mr(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Mr(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Mr(e,this.array)),e}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array),r=Sr(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new zo(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new za(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Ha extends Lo{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Bo(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}let Va;const ja=new os,Wa=new os,qa=new os,Xa=new Br,Ya=new Br,Ja=new Os,Ka=new os,Za=new os,$a=new os,tl=new Br,el=new Br,nl=new Br;class il extends co{constructor(t=new Ha){if(super(),this.isSprite=!0,this.type="Sprite",void 0===Va){Va=new sa;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new Qa(t,5);Va.setIndex([0,1,2,0,2,3]),Va.setAttribute("position",new za(e,3,0,!1)),Va.setAttribute("uv",new za(e,2,3,!1))}this.geometry=Va,this.material=t,this.center=new Br(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Wa.setFromMatrixScale(this.matrixWorld),Ja.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),qa.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Wa.multiplyScalar(-qa.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const s=this.center;rl(Ka.set(-.5,-.5,0),qa,s,Wa,i,r),rl(Za.set(.5,-.5,0),qa,s,Wa,i,r),rl($a.set(.5,.5,0),qa,s,Wa,i,r),tl.set(0,0),el.set(1,0),nl.set(1,1);let o=t.ray.intersectTriangle(Ka,Za,$a,!1,ja);if(null===o&&(rl(Za.set(-.5,.5,0),qa,s,Wa,i,r),el.set(0,1),o=t.ray.intersectTriangle(Ka,$a,Za,!1,ja),null===o))return;const a=t.ray.origin.distanceTo(ja);a<t.near||a>t.far||e.push({distance:a,point:ja.clone(),uv:wo.getInterpolation(ja,Ka,Za,$a,tl,el,nl,new Br),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function rl(t,e,n,i,r,s){Xa.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(Ya.x=s*Xa.x-r*Xa.y,Ya.y=r*Xa.x+s*Xa.y):Ya.copy(Xa),t.copy(e),t.x+=Ya.x,t.y+=Ya.y,t.applyMatrix4(Ja)}const sl=new os,ol=new os;class al extends co{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.addLevel(n.object.clone(),n.distance,n.hysteresis)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0,n=0){e=Math.abs(e);const i=this.levels;let r;for(r=0;r<i.length&&!(e<i[r].distance);r++);return i.splice(r,0,{distance:e,hysteresis:n,object:t}),this.add(t),this}removeLevel(t){const e=this.levels;for(let n=0;n<e.length;n++)if(e[n].distance===t){const t=e.splice(n,1);return this.remove(t[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let n,i;for(n=1,i=e.length;n<i;n++){let i=e[n].distance;if(e[n].object.visible&&(i-=i*e[n].hysteresis),t<i)break}return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){sl.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(sl);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){sl.setFromMatrixPosition(t.matrixWorld),ol.setFromMatrixPosition(this.matrixWorld);const n=sl.distanceTo(ol)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i<r;i++){let t=e[i].distance;if(e[i].object.visible&&(t-=t*e[i].hysteresis),!(n>=t))break;e[i-1].object.visible=!1,e[i].object.visible=!0}for(this._currentLevel=i-1;i<r;i++)e[i].object.visible=!1}}toJSON(t){const e=super.toJSON(t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let t=0,i=n.length;t<i;t++){const i=n[t];e.object.levels.push({object:i.object.uuid,distance:i.distance,hysteresis:i.hysteresis})}return e}}const ll=new os,cl=new Zr,hl=new Zr,ul=new os,dl=new Os,pl=new os,Al=new Ss,fl=new Os,ml=new Us;class gl extends ga{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Fe,this.bindMatrix=new Os,this.bindMatrixInverse=new Os,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new cs),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,pl),this.boundingBox.expandByPoint(pl)}computeBoundingSphere(){const t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new Ss),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,pl),this.boundingSphere.expandByPoint(pl)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),Al.copy(this.boundingSphere),Al.applyMatrix4(i),!1!==t.ray.intersectsSphere(Al)&&(fl.copy(i).invert(),ml.copy(t.ray).applyMatrix4(fl),null!==this.boundingBox&&!1===ml.intersectsBox(this.boundingBox)||this._computeIntersections(t,e,ml)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Zr,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;n<i;n++){t.fromBufferAttribute(e,n);const i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===Fe?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===ke?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const n=this.skeleton,i=this.geometry;cl.fromBufferAttribute(i.attributes.skinIndex,t),hl.fromBufferAttribute(i.attributes.skinWeight,t),ll.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const i=hl.getComponent(t);if(0!==i){const r=cl.getComponent(t);dl.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),e.addScaledVector(ul.copy(ll).applyMatrix4(dl),i)}}return e.applyMatrix4(this.bindMatrixInverse)}}class vl extends co{constructor(){super(),this.isBone=!0,this.type="Bone"}}class yl extends Kr{constructor(t=null,e=1,n=1,i,r,s,o,a,l=Xe,c=Xe,h,u){super(null,s,o,a,l,c,i,r,h,u),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const El=new Os,xl=new Os;class bl{constructor(t=[],e=[]){this.uuid=br(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new Os)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new Os;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=t.length;i<r;i++){const r=t[i]?t[i].matrixWorld:xl;El.multiplyMatrices(r,e[i]),El.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new bl(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const n=new yl(e,t,t,yn,un);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){const n=this.bones[e];if(n.name===t)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,i=t.bones.length;n<i;n++){const i=t.bones[n];let r=e[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new vl),this.bones.push(r),this.boneInverses.push((new Os).fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let i=0,r=e.length;i<r;i++){const r=e[i];t.bones.push(r.uuid);const s=n[i];t.boneInverses.push(s.toArray())}return t}}class Cl extends zo{constructor(t,e,n,i=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const wl=new Os,_l=new Os,Ml=[],Sl=new cs,Il=new Os,Bl=new ga,Tl=new Ss;class Rl extends ga{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new Cl(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let t=0;t<n;t++)this.setMatrixAt(t,Il)}computeBoundingBox(){const t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new cs),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,wl),Sl.copy(t.boundingBox).applyMatrix4(wl),this.boundingBox.union(Sl)}computeBoundingSphere(){const t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new Ss),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,wl),Tl.copy(t.boundingSphere).applyMatrix4(wl),this.boundingSphere.union(Tl)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.morphTexture&&(this.morphTexture=t.morphTexture.clone()),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){const n=e.morphTargetInfluences,i=this.morphTexture.source.data.data,r=t*(n.length+1)+1;for(let t=0;t<n.length;t++)n[t]=i[r+t]}raycast(t,e){const n=this.matrixWorld,i=this.count;if(Bl.geometry=this.geometry,Bl.material=this.material,void 0!==Bl.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Tl.copy(this.boundingSphere),Tl.applyMatrix4(n),!1!==t.ray.intersectsSphere(Tl)))for(let r=0;r<i;r++){this.getMatrixAt(r,wl),_l.multiplyMatrices(n,wl),Bl.matrixWorld=_l,Bl.raycast(t,Ml);for(let t=0,n=Ml.length;t<n;t++){const n=Ml[t];n.instanceId=r,n.object=this,e.push(n)}Ml.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new Cl(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}setMorphAt(t,e){const n=e.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new yl(new Float32Array(i*this.count),i,this.count,wn,un));const r=this.morphTexture.source.data.data;let s=0;for(let t=0;t<n.length;t++)s+=n[t];const o=this.geometry.morphTargetsRelative?1:1-s,a=i*t;r[a]=o,r.set(n,a+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}}const Ll=new os,Dl=new os,Pl=new Tr;class Ul{constructor(t=new os(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Ll.subVectors(n,e).cross(Dl.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(Ll),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)}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 t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Pl.getNormalMatrix(t),i=this.coplanarPoint(Ll).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}clone(){return(new this.constructor).copy(this)}}const Ol=new Ss,Fl=new os;class kl{constructor(t=new Ul,e=new Ul,n=new Ul,i=new Ul,r=new Ul,s=new Ul){this.planes=[t,e,n,i,r,s]}set(t,e,n,i,r,s){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=Ar){const n=this.planes,i=t.elements,r=i[0],s=i[1],o=i[2],a=i[3],l=i[4],c=i[5],h=i[6],u=i[7],d=i[8],p=i[9],A=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];if(n[0].setComponents(a-r,u-l,f-d,y-m).normalize(),n[1].setComponents(a+r,u+l,f+d,y+m).normalize(),n[2].setComponents(a+s,u+c,f+p,y+g).normalize(),n[3].setComponents(a-s,u-c,f-p,y-g).normalize(),n[4].setComponents(a-o,u-h,f-A,y-v).normalize(),e===Ar)n[5].setComponents(a+o,u+h,f+A,y+v).normalize();else{if(e!==fr)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);n[5].setComponents(o,h,A,v).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),Ol.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),Ol.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Ol)}intersectsSprite(t){return Ol.center.set(0,0,0),Ol.radius=.7071067811865476,Ol.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ol)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(n)<i)return!1;return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(Fl.x=i.normal.x>0?t.max.x:t.min.x,Fl.y=i.normal.y>0?t.max.y:t.min.y,Fl.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Fl)<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}clone(){return(new this.constructor).copy(this)}}function Nl(t,e){return t-e}function Ql(t,e){return t.z-e.z}function Gl(t,e){return e.z-t.z}class zl{constructor(){this.index=0,this.pool=[],this.list=[]}push(t,e,n,i){const r=this.pool,s=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const o=r[this.index];s.push(o),this.index++,o.start=t,o.count=e,o.z=n,o.index=i}reset(){this.list.length=0,this.index=0}}const Hl=new Os,Vl=new Bo(1,1,1),jl=new kl,Wl=new cs,ql=new Ss,Xl=new os,Yl=new os,Jl=new os,Kl=new zl,Zl=new ga,$l=[];function tc(t,e,n=0){const i=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const r=t.count;for(let s=0;s<r;s++)for(let r=0;r<i;r++)e.setComponent(s+n,r,t.getComponent(s,r))}else e.array.set(t.array,n*i);e.needsUpdate=!0}function ec(t,e){if(t.constructor!==e.constructor){const n=Math.min(t.length,e.length);for(let i=0;i<n;i++)e[i]=t[i]}else{const n=Math.min(t.length,e.length);e.set(new t.constructor(t.buffer,0,n))}}class nc extends ga{get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}constructor(t,e,n=2*e,i){super(new sa,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=t,this._maxVertexCount=e,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(t),this._multiDrawStarts=new Int32Array(t),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let t=Math.sqrt(4*this._maxInstanceCount);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4),n=new yl(e,t,t,yn,un);this._matricesTexture=n}_initIndirectTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);const e=new Uint32Array(t*t),n=new yl(e,t,t,_n,hn);this._indirectTexture=n}_initColorsTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);const e=new Float32Array(t*t*4).fill(1),n=new yl(e,t,t,yn,un);n.colorSpace=zr.workingColorSpace,this._colorsTexture=n}_initializeGeometry(t){const e=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(!1===this._geometryInitialized){for(const i in t.attributes){const r=t.getAttribute(i),{array:s,itemSize:o,normalized:a}=r,l=new s.constructor(n*o),c=new zo(l,o,a);e.setAttribute(i,c)}if(null!==t.getIndex()){const t=n>65535?new Uint32Array(i):new Uint16Array(i);e.setIndex(new zo(t,1))}this._geometryInitialized=!0}}_validateGeometry(t){const e=this.geometry;if(Boolean(t.getIndex())!==Boolean(e.getIndex()))throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in e.attributes){if(!t.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=t.getAttribute(n),r=e.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){const e=this._instanceInfo;if(t<0||t>=e.length||!1===e[t].active)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){const e=this._geometryInfo;if(t<0||t>=e.length||!1===e[t].active)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new cs);const t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let n=0,i=e.length;n<i;n++){if(!1===e[n].active)continue;const i=e[n].geometryIndex;this.getMatrixAt(n,Hl),this.getBoundingBoxAt(i,Wl).applyMatrix4(Hl),t.union(Wl)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Ss);const t=this.boundingSphere,e=this._instanceInfo;t.makeEmpty();for(let n=0,i=e.length;n<i;n++){if(!1===e[n].active)continue;const i=e[n].geometryIndex;this.getMatrixAt(n,Hl),this.getBoundingSphereAt(i,ql).applyMatrix4(Hl),t.union(ql)}}addInstance(t){if(this._instanceInfo.length>=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const e={visible:!0,active:!0,geometryIndex:t};let n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Nl),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=e):(n=this._instanceInfo.length,this._instanceInfo.push(e));const i=this._matricesTexture;Hl.identity().toArray(i.image.data,16*n),i.needsUpdate=!0;const r=this._colorsTexture;return r&&(Vl.toArray(r.image.data,4*n),r.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(t,e=-1,n=-1){this._initializeGeometry(t),this._validateGeometry(t);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=-1===e?t.getAttribute("position").count:e;const s=t.getIndex();if(null!==s&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=-1===n?s.count:n),-1!==i.indexStart&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let o;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Nl),o=this._availableGeometryIds.shift(),r[o]=i):(o=this._geometryCount,this._geometryCount++,r.push(i)),this.setGeometryAt(o,t),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,o}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const n=this.geometry,i=null!==n.getIndex(),r=n.getIndex(),s=e.getIndex(),o=this._geometryInfo[t];if(i&&s.count>o.reservedIndexCount||e.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const a=o.vertexStart,l=o.reservedVertexCount;o.vertexCount=e.getAttribute("position").count;for(const t in n.attributes){const i=e.getAttribute(t),r=n.getAttribute(t);tc(i,r,a);const s=i.itemSize;for(let t=i.count,e=l;t<e;t++){const e=a+t;for(let t=0;t<s;t++)r.setComponent(e,t,0)}r.needsUpdate=!0,r.addUpdateRange(a*s,l*s)}if(i){const t=o.indexStart,n=o.reservedIndexCount;o.indexCount=e.getIndex().count;for(let e=0;e<s.count;e++)r.setX(t+e,a+s.getX(e));for(let e=s.count,i=n;e<i;e++)r.setX(t+e,a);r.needsUpdate=!0,r.addUpdateRange(t,o.reservedIndexCount)}return o.start=i?o.indexStart:o.vertexStart,o.count=i?o.indexCount:o.vertexCount,o.boundingBox=null,null!==e.boundingBox&&(o.boundingBox=e.boundingBox.clone()),o.boundingSphere=null,null!==e.boundingSphere&&(o.boundingSphere=e.boundingSphere.clone()),this._visibilityChanged=!0,t}deleteGeometry(t){const e=this._geometryInfo;if(t>=e.length||!1===e[t].active)return this;const n=this._instanceInfo;for(let e=0,i=n.length;e<i;e++)n[e].active&&n[e].geometryIndex===t&&this.deleteInstance(e);return e[t].active=!1,this._availableGeometryIds.push(t),this._visibilityChanged=!0,this}deleteInstance(t){return this.validateInstanceId(t),this._instanceInfo[t].active=!1,this._availableInstanceIds.push(t),this._visibilityChanged=!0,this}optimize(){let t=0,e=0;const n=this._geometryInfo,i=n.map(((t,e)=>e)).sort(((t,e)=>n[t].vertexStart-n[e].vertexStart)),r=this.geometry;for(let s=0,o=n.length;s<o;s++){const o=i[s],a=n[o];if(!1!==a.active){if(null!==r.index){if(a.indexStart!==e){const{indexStart:n,vertexStart:i,reservedIndexCount:s}=a,o=r.index,l=o.array,c=t-i;for(let t=n;t<n+s;t++)l[t]=l[t]+c;o.array.copyWithin(e,n,n+s),o.addUpdateRange(e,s),a.indexStart=e}e+=a.reservedIndexCount}if(a.vertexStart!==t){const{vertexStart:e,reservedVertexCount:n}=a,i=r.attributes;for(const r in i){const s=i[r],{array:o,itemSize:a}=s;o.copyWithin(t*a,e*a,(e+n)*a),s.addUpdateRange(t*a,n*a)}a.vertexStart=t}t+=a.reservedVertexCount,a.start=r.index?a.indexStart:a.vertexStart,this._nextIndexStart=r.index?a.indexStart+a.reservedIndexCount:0,this._nextVertexStart=a.vertexStart+a.reservedVertexCount}}return this}getBoundingBoxAt(t,e){if(t>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[t];if(null===i.boundingBox){const t=new cs,e=n.index,r=n.attributes.position;for(let n=i.start,s=i.start+i.count;n<s;n++){let i=n;e&&(i=e.getX(i)),t.expandByPoint(Xl.fromBufferAttribute(r,i))}i.boundingBox=t}return e.copy(i.boundingBox),e}getBoundingSphereAt(t,e){if(t>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[t];if(null===i.boundingSphere){const e=new Ss;this.getBoundingBoxAt(t,Wl),Wl.getCenter(e.center);const r=n.index,s=n.attributes.position;let o=0;for(let t=i.start,n=i.start+i.count;t<n;t++){let n=t;r&&(n=r.getX(n)),Xl.fromBufferAttribute(s,n),o=Math.max(o,e.center.distanceToSquared(Xl))}e.radius=Math.sqrt(o),i.boundingSphere=e}return e.copy(i.boundingSphere),e}setMatrixAt(t,e){this.validateInstanceId(t);const n=this._matricesTexture,i=this._matricesTexture.image.data;return e.toArray(i,16*t),n.needsUpdate=!0,this}getMatrixAt(t,e){return this.validateInstanceId(t),e.fromArray(this._matricesTexture.image.data,16*t)}setColorAt(t,e){return this.validateInstanceId(t),null===this._colorsTexture&&this._initColorsTexture(),e.toArray(this._colorsTexture.image.data,4*t),this._colorsTexture.needsUpdate=!0,this}getColorAt(t,e){return this.validateInstanceId(t),e.fromArray(this._colorsTexture.image.data,4*t)}setVisibleAt(t,e){return this.validateInstanceId(t),this._instanceInfo[t].visible===e||(this._instanceInfo[t].visible=e,this._visibilityChanged=!0),this}getVisibleAt(t){return this.validateInstanceId(t),this._instanceInfo[t].visible}setGeometryIdAt(t,e){return this.validateInstanceId(t),this.validateGeometryId(e),this._instanceInfo[t].geometryIndex=e,this}getGeometryIdAt(t){return this.validateInstanceId(t),this._instanceInfo[t].geometryIndex}getGeometryRangeAt(t,e={}){this.validateGeometryId(t);const n=this._geometryInfo[t];return e.vertexStart=n.vertexStart,e.vertexCount=n.vertexCount,e.reservedVertexCount=n.reservedVertexCount,e.indexStart=n.indexStart,e.indexCount=n.indexCount,e.reservedIndexCount=n.reservedIndexCount,e.start=n.start,e.count=n.count,e}setInstanceCount(t){const e=this._availableInstanceIds,n=this._instanceInfo;for(e.sort(Nl);e[e.length-1]===n.length;)n.pop(),e.pop();if(t<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${t} are being used. Cannot shrink instance count.`);const i=new Int32Array(t),r=new Int32Array(t);ec(this._multiDrawCounts,i),ec(this._multiDrawStarts,r),this._multiDrawCounts=i,this._multiDrawStarts=r,this._maxInstanceCount=t;const s=this._indirectTexture,o=this._matricesTexture,a=this._colorsTexture;s.dispose(),this._initIndirectTexture(),ec(s.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),ec(o.image.data,this._matricesTexture.image.data),a&&(a.dispose(),this._initColorsTexture(),ec(a.image.data,this._colorsTexture.image.data))}setGeometrySize(t,e){const n=[...this._geometryInfo].filter((t=>t.active));if(Math.max(...n.map((t=>t.vertexStart+t.reservedVertexCount)))>t)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map((t=>t.indexStart+t.reservedIndexCount)))>e)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);const i=this.geometry;i.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new sa,this._initializeGeometry(i));const r=this.geometry;i.index&&ec(i.index.array,r.index.array);for(const t in i.attributes)ec(i.attributes[t].array,r.attributes[t].array)}raycast(t,e){const n=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,s=this.geometry;Zl.material=this.material,Zl.geometry.index=s.index,Zl.geometry.attributes=s.attributes,null===Zl.geometry.boundingBox&&(Zl.geometry.boundingBox=new cs),null===Zl.geometry.boundingSphere&&(Zl.geometry.boundingSphere=new Ss);for(let s=0,o=n.length;s<o;s++){if(!n[s].visible||!n[s].active)continue;const o=n[s].geometryIndex,a=i[o];Zl.geometry.setDrawRange(a.start,a.count),this.getMatrixAt(s,Zl.matrixWorld).premultiply(r),this.getBoundingBoxAt(o,Zl.geometry.boundingBox),this.getBoundingSphereAt(o,Zl.geometry.boundingSphere),Zl.raycast(t,$l);for(let t=0,n=$l.length;t<n;t++){const n=$l[t];n.object=this,n.batchId=s,e.push(n)}$l.length=0}Zl.material=null,Zl.geometry.index=null,Zl.geometry.attributes={},Zl.geometry.setDrawRange(0,1/0)}copy(t){return super.copy(t),this.geometry=t.geometry.clone(),this.perObjectFrustumCulled=t.perObjectFrustumCulled,this.sortObjects=t.sortObjects,this.boundingBox=null!==t.boundingBox?t.boundingBox.clone():null,this.boundingSphere=null!==t.boundingSphere?t.boundingSphere.clone():null,this._geometryInfo=t._geometryInfo.map((t=>({...t,boundingBox:null!==t.boundingBox?t.boundingBox.clone():null,boundingSphere:null!==t.boundingSphere?t.boundingSphere.clone():null}))),this._instanceInfo=t._instanceInfo.map((t=>({...t}))),this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._geometryCount=t._geometryCount,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(t,e,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const s=i.getIndex(),o=null===s?1:s.array.BYTES_PER_ELEMENT,a=this._instanceInfo,l=this._multiDrawStarts,c=this._multiDrawCounts,h=this._geometryInfo,u=this.perObjectFrustumCulled,d=this._indirectTexture,p=d.image.data;u&&(Hl.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),jl.setFromProjectionMatrix(Hl,t.coordinateSystem));let A=0;if(this.sortObjects){Hl.copy(this.matrixWorld).invert(),Xl.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Hl),Yl.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Hl);for(let t=0,e=a.length;t<e;t++)if(a[t].visible&&a[t].active){const e=a[t].geometryIndex;this.getMatrixAt(t,Hl),this.getBoundingSphereAt(e,ql).applyMatrix4(Hl);let n=!1;if(u&&(n=!jl.intersectsSphere(ql)),!n){const n=h[e],i=Jl.subVectors(ql.center,Xl).dot(Yl);Kl.push(n.start,n.count,i,t)}}const t=Kl.list,e=this.customSort;null===e?t.sort(r.transparent?Gl:Ql):e.call(this,t,n);for(let e=0,n=t.length;e<n;e++){const n=t[e];l[A]=n.start*o,c[A]=n.count,p[A]=n.index,A++}Kl.reset()}else for(let t=0,e=a.length;t<e;t++)if(a[t].visible&&a[t].active){const e=a[t].geometryIndex;let n=!1;if(u&&(this.getMatrixAt(t,Hl),this.getBoundingSphereAt(e,ql).applyMatrix4(Hl),n=!jl.intersectsSphere(ql)),!n){const n=h[e];l[A]=n.start*o,c[A]=n.count,p[A]=t,A++}}d.needsUpdate=!0,this._multiDrawCount=A,this._visibilityChanged=!1}onBeforeShadow(t,e,n,i,r,s){this.onBeforeRender(t,null,i,r,s)}}class ic extends Lo{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Bo(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const rc=new os,sc=new os,oc=new Os,ac=new Us,lc=new Ss,cc=new os,hc=new os;class uc extends co{constructor(t=new sa,e=new ic){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,i=e.count;t<i;t++)rc.fromBufferAttribute(e,t-1),sc.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=rc.distanceTo(sc);t.setAttribute("lineDistance",new Ko(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),lc.copy(n.boundingSphere),lc.applyMatrix4(i),lc.radius+=r,!1===t.ray.intersectsSphere(lc))return;oc.copy(i).invert(),ac.copy(t.ray).applyMatrix4(oc);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,l=this.isLineSegments?2:1,c=n.index,h=n.attributes.position;if(null!==c){const n=Math.max(0,s.start),i=Math.min(c.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=c.getX(r),i=c.getX(r+1),s=dc(this,t,ac,a,n,i,r);s&&e.push(s)}if(this.isLineLoop){const r=c.getX(i-1),s=c.getX(n),o=dc(this,t,ac,a,r,s,i-1);o&&e.push(o)}}else{const n=Math.max(0,s.start),i=Math.min(h.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=dc(this,t,ac,a,r,r+1,r);n&&e.push(n)}if(this.isLineLoop){const r=dc(this,t,ac,a,i-1,n,i-1);r&&e.push(r)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function dc(t,e,n,i,r,s,o){const a=t.geometry.attributes.position;if(rc.fromBufferAttribute(a,r),sc.fromBufferAttribute(a,s),n.distanceSqToSegment(rc,sc,cc,hc)>i)return;cc.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(cc);return l<e.near||l>e.far?void 0:{distance:l,point:hc.clone().applyMatrix4(t.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:t}}const pc=new os,Ac=new os;class fc extends uc{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;t<i;t+=2)pc.fromBufferAttribute(e,t),Ac.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+pc.distanceTo(Ac);t.setAttribute("lineDistance",new Ko(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class mc extends uc{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class gc extends Lo{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Bo(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const vc=new Os,yc=new Us,Ec=new Ss,xc=new os;class bc extends co{constructor(t=new sa,e=new gc){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ec.copy(n.boundingSphere),Ec.applyMatrix4(i),Ec.radius+=r,!1===t.ray.intersectsSphere(Ec))return;vc.copy(i).invert(),yc.copy(t.ray).applyMatrix4(vc);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,l=n.index,c=n.attributes.position;if(null!==l)for(let n=Math.max(0,s.start),r=Math.min(l.count,s.start+s.count);n<r;n++){const r=l.getX(n);xc.fromBufferAttribute(c,r),Cc(xc,r,a,i,t,e,this)}else for(let n=Math.max(0,s.start),r=Math.min(c.count,s.start+s.count);n<r;n++)xc.fromBufferAttribute(c,n),Cc(xc,n,a,i,t,e,this)}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function Cc(t,e,n,i,r,s,o){const a=yc.distanceSqToPoint(t);if(a<n){const n=new os;yc.closestPointToPoint(t,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class wc extends Kr{constructor(t,e,n,i,r,s,o,a,l){super(t,e,n,i,r,s,o,a,l),this.isVideoTexture=!0,this.minFilter=void 0!==s?s:$e,this.magFilter=void 0!==r?r:$e,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1=="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class _c extends wc{constructor(t,e,n,i,r,s,o,a){super({},t,e,n,i,r,s,o,a),this.isVideoFrameTexture=!0}update(){}clone(){return(new this.constructor).copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}}class Mc extends Kr{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=Xe,this.minFilter=Xe,this.generateMipmaps=!1,this.needsUpdate=!0}}class Sc extends Kr{constructor(t,e,n,i,r,s,o,a,l,c,h,u){super(null,s,o,a,l,c,i,r,h,u),this.isCompressedTexture=!0,this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class Ic extends Sc{constructor(t,e,n,i,r,s){super(t,e,n,r,s),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=We,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class Bc extends Sc{constructor(t,e,n){super(void 0,t[0].width,t[0].height,e,n,Qe),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class Tc extends Kr{constructor(t,e,n,i,r,s,o,a,l){super(t,e,n,i,r,s,o,a,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Rc extends Kr{constructor(t,e,n,i,r,s,o,a,l,c=bn){if(c!==bn&&c!==Cn)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===bn&&(n=hn),void 0===n&&c===Cn&&(n=fn),super(null,i,r,s,o,a,c,n,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==o?o:Xe,this.minFilter=void 0!==a?a:Xe,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class Lc{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(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 s=1;s<=t;s++)n=this.getPoint(s/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const r=n.length;let s;s=e||t*n[r-1];let o,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),o=n[i]-s,o<0)a=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),o=this.getPoint(r),a=e||(s.isVector2?new Br:new os);return a.copy(o).sub(s).normalize(),a}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new os,i=[],r=[],s=[],o=new os,a=new Os;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new os)}r[0]=new os,s[0]=new os;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),s[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),s[e]=s[e-1].clone(),o.crossVectors(i[e-1],i[e]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(Cr(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(a.makeRotationAxis(o,t))}s[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(Cr(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(o.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],e*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Dc extends Lc{constructor(t=0,e=0,n=1,i=1,r=0,s=2*Math.PI,o=!1,a=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(t,e=new Br){const n=e,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=s?0:i),!0!==this.aClockwise||s||(r===i?r=-i:r-=i);const o=this.aStartAngle+t*r;let a=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=a-this.aX,i=l-this.aY;a=n*t-i*e+this.aX,l=n*e+i*t+this.aY}return n.set(a,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class Pc extends Dc{constructor(t,e,n,i,r,s){super(t,e,n,n,i,r,s),this.isArcCurve=!0,this.type="ArcCurve"}}function Uc(){let t=0,e=0,n=0,i=0;function r(r,s,o,a){t=r,e=o,n=-3*r+3*s-2*o-a,i=2*r-2*s+o+a}return{initCatmullRom:function(t,e,n,i,s){r(e,n,s*(n-t),s*(i-e))},initNonuniformCatmullRom:function(t,e,n,i,s,o,a){let l=(e-t)/s-(n-t)/(s+o)+(n-e)/o,c=(n-e)/o-(i-e)/(o+a)+(i-n)/a;l*=o,c*=o,r(e,n,l,c)},calc:function(r){const s=r*r;return t+e*r+n*s+i*(s*r)}}}const Oc=new os,Fc=new Uc,kc=new Uc,Nc=new Uc;class Qc extends Lc{constructor(t=[],e=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(t,e=new os){const n=e,i=this.points,r=i.length,s=(r-(this.closed?0:1))*t;let o,a,l=Math.floor(s),c=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?o=i[(l-1)%r]:(Oc.subVectors(i[0],i[1]).add(i[0]),o=Oc);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2<r?a=i[(l+2)%r]:(Oc.subVectors(i[r-1],i[r-2]).add(i[r-1]),a=Oc),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(o.distanceToSquared(h),t),n=Math.pow(h.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(a),t);n<1e-4&&(n=1),e<1e-4&&(e=n),i<1e-4&&(i=n),Fc.initNonuniformCatmullRom(o.x,h.x,u.x,a.x,e,n,i),kc.initNonuniformCatmullRom(o.y,h.y,u.y,a.y,e,n,i),Nc.initNonuniformCatmullRom(o.z,h.z,u.z,a.z,e,n,i)}else"catmullrom"===this.curveType&&(Fc.initCatmullRom(o.x,h.x,u.x,a.x,this.tension),kc.initCatmullRom(o.y,h.y,u.y,a.y,this.tension),Nc.initCatmullRom(o.z,h.z,u.z,a.z,this.tension));return n.set(Fc.calc(c),kc.calc(c),Nc.calc(c)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new os).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Gc(t,e,n,i,r){const s=.5*(i-e),o=.5*(r-n),a=t*t;return(2*n-2*i+s+o)*(t*a)+(-3*n+3*i-2*s-o)*a+s*t+n}function zc(t,e,n,i){return function(t,e){const n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,i)}function Hc(t,e,n,i,r){return function(t,e){const n=1-t;return n*n*n*e}(t,e)+function(t,e){const n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,i)+function(t,e){return t*t*t*e}(t,r)}class Vc extends Lc{constructor(t=new Br,e=new Br,n=new Br,i=new Br){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new Br){const n=e,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(Hc(t,i.x,r.x,s.x,o.x),Hc(t,i.y,r.y,s.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class jc extends Lc{constructor(t=new os,e=new os,n=new os,i=new os){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new os){const n=e,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(Hc(t,i.x,r.x,s.x,o.x),Hc(t,i.y,r.y,s.y,o.y),Hc(t,i.z,r.z,s.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Wc extends Lc{constructor(t=new Br,e=new Br){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Br){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Br){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class qc extends Lc{constructor(t=new os,e=new os){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new os){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new os){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Xc extends Lc{constructor(t=new Br,e=new Br,n=new Br){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Br){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(zc(t,i.x,r.x,s.x),zc(t,i.y,r.y,s.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Yc extends Lc{constructor(t=new os,e=new os,n=new os){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new os){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(zc(t,i.x,r.x,s.x),zc(t,i.y,r.y,s.y),zc(t,i.z,r.z,s.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Jc extends Lc{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Br){const n=e,i=this.points,r=(i.length-1)*t,s=Math.floor(r),o=r-s,a=i[0===s?s:s-1],l=i[s],c=i[s>i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(Gc(o,a.x,l.x,c.x,h.x),Gc(o,a.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new Br).fromArray(n))}return this}}var Kc=Object.freeze({__proto__:null,ArcCurve:Pc,CatmullRomCurve3:Qc,CubicBezierCurve:Vc,CubicBezierCurve3:jc,EllipseCurve:Dc,LineCurve:Wc,LineCurve3:qc,QuadraticBezierCurve:Xc,QuadraticBezierCurve3:Yc,SplineCurve:Jc});class Zc extends Lc{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const n=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new Kc[n](e,t))}return this}getPoint(t,e){const n=t*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const t=i[r]-n,s=this.curves[r],o=s.getLength(),a=0===o?0:1-t/o;return s.getPointAt(a,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.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 t=[];let e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const s=r[i],o=s.isEllipseCurve?2*t:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?t*s.points.length:t,a=s.getPoints(o);for(let t=0;t<a.length;t++){const i=a[t];n&&n.equals(i)||(e.push(i),n=i)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new Kc[n.type]).fromJSON(n))}return this}}class $c extends Zc{constructor(t){super(),this.type="Path",this.currentPoint=new Br,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new Wc(this.currentPoint.clone(),new Br(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){const r=new Xc(this.currentPoint.clone(),new Br(t,e),new Br(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,r,s){const o=new Vc(this.currentPoint.clone(),new Br(t,e),new Br(n,i),new Br(r,s));return this.curves.push(o),this.currentPoint.set(r,s),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new Jc(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,r,s){const o=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+o,e+a,n,i,r,s),this}absarc(t,e,n,i,r,s){return this.absellipse(t,e,n,n,i,r,s),this}ellipse(t,e,n,i,r,s,o,a){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,n,i,r,s,o,a),this}absellipse(t,e,n,i,r,s,o,a){const l=new Dc(t,e,n,i,r,s,o,a);if(this.curves.length>0){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(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class th extends sa{constructor(t=[new Br(0,-.5),new Br(.5,0),new Br(0,.5)],e=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=Cr(i,0,2*Math.PI);const r=[],s=[],o=[],a=[],l=[],c=1/e,h=new os,u=new Br,d=new os,p=new os,A=new os;let f=0,m=0;for(let e=0;e<=t.length-1;e++)switch(e){case 0:f=t[e+1].x-t[e].x,m=t[e+1].y-t[e].y,d.x=1*m,d.y=-f,d.z=0*m,A.copy(d),d.normalize(),a.push(d.x,d.y,d.z);break;case t.length-1:a.push(A.x,A.y,A.z);break;default:f=t[e+1].x-t[e].x,m=t[e+1].y-t[e].y,d.x=1*m,d.y=-f,d.z=0*m,p.copy(d),d.x+=A.x,d.y+=A.y,d.z+=A.z,d.normalize(),a.push(d.x,d.y,d.z),A.copy(p)}for(let r=0;r<=e;r++){const d=n+r*c*i,p=Math.sin(d),A=Math.cos(d);for(let n=0;n<=t.length-1;n++){h.x=t[n].x*p,h.y=t[n].y,h.z=t[n].x*A,s.push(h.x,h.y,h.z),u.x=r/e,u.y=n/(t.length-1),o.push(u.x,u.y);const i=a[3*n+0]*p,c=a[3*n+1],d=a[3*n+0]*A;l.push(i,c,d)}}for(let n=0;n<e;n++)for(let e=0;e<t.length-1;e++){const i=e+n*t.length,s=i,o=i+t.length,a=i+t.length+1,l=i+1;r.push(s,o,l),r.push(a,l,o)}this.setIndex(r),this.setAttribute("position",new Ko(s,3)),this.setAttribute("uv",new Ko(o,2)),this.setAttribute("normal",new Ko(l,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new th(t.points,t.segments,t.phiStart,t.phiLength)}}class eh extends th{constructor(t=1,e=1,n=4,i=8){const r=new $c;r.absarc(0,-e/2,t,1.5*Math.PI,0),r.absarc(0,e/2,t,0,.5*Math.PI),super(r.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:t,length:e,capSegments:n,radialSegments:i}}static fromJSON(t){return new eh(t.radius,t.length,t.capSegments,t.radialSegments)}}class nh extends sa{constructor(t=1,e=32,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},e=Math.max(3,e);const r=[],s=[],o=[],a=[],l=new os,c=new Br;s.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let r=0,h=3;r<=e;r++,h+=3){const u=n+r/e*i;l.x=t*Math.cos(u),l.y=t*Math.sin(u),s.push(l.x,l.y,l.z),o.push(0,0,1),c.x=(s[h]/t+1)/2,c.y=(s[h+1]/t+1)/2,a.push(c.x,c.y)}for(let t=1;t<=e;t++)r.push(t,t+1,0);this.setIndex(r),this.setAttribute("position",new Ko(s,3)),this.setAttribute("normal",new Ko(o,3)),this.setAttribute("uv",new Ko(a,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new nh(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class ih extends sa{constructor(t=1,e=1,n=1,i=32,r=1,s=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a};const l=this;i=Math.floor(i),r=Math.floor(r);const c=[],h=[],u=[],d=[];let p=0;const A=[],f=n/2;let m=0;function g(n){const r=p,s=new Br,A=new os;let g=0;const v=!0===n?t:e,y=!0===n?1:-1;for(let t=1;t<=i;t++)h.push(0,f*y,0),u.push(0,y,0),d.push(.5,.5),p++;const E=p;for(let t=0;t<=i;t++){const e=t/i*a+o,n=Math.cos(e),r=Math.sin(e);A.x=v*r,A.y=f*y,A.z=v*n,h.push(A.x,A.y,A.z),u.push(0,y,0),s.x=.5*n+.5,s.y=.5*r*y+.5,d.push(s.x,s.y),p++}for(let t=0;t<i;t++){const e=r+t,i=E+t;!0===n?c.push(i,i+1,e):c.push(i+1,i,e),g+=3}l.addGroup(m,g,!0===n?1:2),m+=g}!function(){const s=new os,g=new os;let v=0;const y=(e-t)/n;for(let l=0;l<=r;l++){const c=[],m=l/r,v=m*(e-t)+t;for(let t=0;t<=i;t++){const e=t/i,r=e*a+o,l=Math.sin(r),A=Math.cos(r);g.x=v*l,g.y=-m*n+f,g.z=v*A,h.push(g.x,g.y,g.z),s.set(l,y,A).normalize(),u.push(s.x,s.y,s.z),d.push(e,1-m),c.push(p++)}A.push(c)}for(let n=0;n<i;n++)for(let i=0;i<r;i++){const s=A[i][n],o=A[i+1][n],a=A[i+1][n+1],l=A[i][n+1];(t>0||0!==i)&&(c.push(s,o,l),v+=3),(e>0||i!==r-1)&&(c.push(o,a,l),v+=3)}l.addGroup(m,v,0),m+=v}(),!1===s&&(t>0&&g(!0),e>0&&g(!1)),this.setIndex(c),this.setAttribute("position",new Ko(h,3)),this.setAttribute("normal",new Ko(u,3)),this.setAttribute("uv",new Ko(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ih(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class rh extends ih{constructor(t=1,e=1,n=32,i=1,r=!1,s=0,o=2*Math.PI){super(0,t,e,n,i,r,s,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:o}}static fromJSON(t){return new rh(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class sh extends sa{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],s=[];function o(t,e,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const o=t.clone().lerp(n,i/r),a=e.clone().lerp(n,i/r),l=r-i;for(let t=0;t<=l;t++)s[i][t]=0===t&&i===r?o:o.clone().lerp(a,t/l)}for(let t=0;t<r;t++)for(let e=0;e<2*(r-t)-1;e++){const n=Math.floor(e/2);e%2==0?(a(s[t][n+1]),a(s[t+1][n]),a(s[t][n])):(a(s[t][n+1]),a(s[t+1][n+1]),a(s[t+1][n]))}}function a(t){r.push(t.x,t.y,t.z)}function l(e,n){const i=3*e;n.x=t[i+0],n.y=t[i+1],n.z=t[i+2]}function c(t,e,n,i){i<0&&1===t.x&&(s[e]=t.x-1),0===n.x&&0===n.z&&(s[e]=i/2/Math.PI+.5)}function h(t){return Math.atan2(t.z,-t.x)}!function(t){const n=new os,i=new os,r=new os;for(let s=0;s<e.length;s+=3)l(e[s+0],n),l(e[s+1],i),l(e[s+2],r),o(n,i,r,t)}(i),function(t){const e=new os;for(let n=0;n<r.length;n+=3)e.x=r[n+0],e.y=r[n+1],e.z=r[n+2],e.normalize().multiplyScalar(t),r[n+0]=e.x,r[n+1]=e.y,r[n+2]=e.z}(n),function(){const t=new os;for(let n=0;n<r.length;n+=3){t.x=r[n+0],t.y=r[n+1],t.z=r[n+2];const i=h(t)/2/Math.PI+.5,o=(e=t,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5);s.push(i,1-o)}var e;(function(){const t=new os,e=new os,n=new os,i=new os,o=new Br,a=new Br,l=new Br;for(let u=0,d=0;u<r.length;u+=9,d+=6){t.set(r[u+0],r[u+1],r[u+2]),e.set(r[u+3],r[u+4],r[u+5]),n.set(r[u+6],r[u+7],r[u+8]),o.set(s[d+0],s[d+1]),a.set(s[d+2],s[d+3]),l.set(s[d+4],s[d+5]),i.copy(t).add(e).add(n).divideScalar(3);const p=h(i);c(o,d+0,t,p),c(a,d+2,e,p),c(l,d+4,n,p)}})(),function(){for(let t=0;t<s.length;t+=6){const e=s[t+0],n=s[t+2],i=s[t+4],r=Math.max(e,n,i),o=Math.min(e,n,i);r>.9&&o<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),i<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Ko(r,3)),this.setAttribute("normal",new Ko(r.slice(),3)),this.setAttribute("uv",new Ko(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new sh(t.vertices,t.indices,t.radius,t.details)}}class oh extends sh{constructor(t=1,e=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],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new oh(t.radius,t.detail)}}const ah=new os,lh=new os,ch=new os,hh=new wo;class uh extends sa{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const n=4,i=Math.pow(10,n),r=Math.cos(Er*e),s=t.getIndex(),o=t.getAttribute("position"),a=s?s.count:o.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),u={},d=[];for(let t=0;t<a;t+=3){s?(l[0]=s.getX(t),l[1]=s.getX(t+1),l[2]=s.getX(t+2)):(l[0]=t,l[1]=t+1,l[2]=t+2);const{a:e,b:n,c:a}=hh;if(e.fromBufferAttribute(o,l[0]),n.fromBufferAttribute(o,l[1]),a.fromBufferAttribute(o,l[2]),hh.getNormal(ch),h[0]=`${Math.round(e.x*i)},${Math.round(e.y*i)},${Math.round(e.z*i)}`,h[1]=`${Math.round(n.x*i)},${Math.round(n.y*i)},${Math.round(n.z*i)}`,h[2]=`${Math.round(a.x*i)},${Math.round(a.y*i)},${Math.round(a.z*i)}`,h[0]!==h[1]&&h[1]!==h[2]&&h[2]!==h[0])for(let t=0;t<3;t++){const e=(t+1)%3,n=h[t],i=h[e],s=hh[c[t]],o=hh[c[e]],a=`${n}_${i}`,p=`${i}_${n}`;p in u&&u[p]?(ch.dot(u[p].normal)<=r&&(d.push(s.x,s.y,s.z),d.push(o.x,o.y,o.z)),u[p]=null):a in u||(u[a]={index0:l[t],index1:l[e],normal:ch.clone()})}}for(const t in u)if(u[t]){const{index0:e,index1:n}=u[t];ah.fromBufferAttribute(o,e),lh.fromBufferAttribute(o,n),d.push(ah.x,ah.y,ah.z),d.push(lh.x,lh.y,lh.z)}this.setAttribute("position",new Ko(d,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}class dh extends $c{constructor(t){super(t),this.uuid=br(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new $c).fromJSON(n))}return this}}function ph(t,e,n,i,r){let s,o;if(r===function(t,e,n,i){let r=0;for(let s=e,o=n-i;s<n;s+=i)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}(t,e,n,i)>0)for(s=e;s<n;s+=i)o=Ph(s,t[s],t[s+1],o);else for(s=n-i;s>=e;s-=i)o=Ph(s,t[s],t[s+1],o);return o&&Ih(o,o.next)&&(Uh(o),o=o.next),o}function Ah(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!Ih(i,i.next)&&0!==Sh(i.prev,i,i.next))i=i.next;else{if(Uh(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function fh(t,e,n,i,r,s,o){if(!t)return;!o&&s&&function(t,e,n,i){let r=t;do{0===r.z&&(r.z=Ch(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,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,i=n,a=0,e=0;e<c&&(a++,i=i.nextZ,i);e++);for(l=c;a>0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(o>1)}(r)}(t,i,r,s);let a,l,c=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,s?gh(t,i,r,s):mh(t))e.push(a.i/n|0),e.push(t.i/n|0),e.push(l.i/n|0),Uh(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?fh(t=vh(Ah(t),e,n),e,n,i,r,s,2):2===o&&yh(t,e,n,i,r,s):fh(Ah(t),e,n,i,r,s,1);break}}function mh(t){const e=t.prev,n=t,i=t.next;if(Sh(e,n,i)>=0)return!1;const r=e.x,s=n.x,o=i.x,a=e.y,l=n.y,c=i.y,h=r<s?r<o?r:o:s<o?s:o,u=a<l?a<c?a:c:l<c?l:c,d=r>s?r>o?r:o:s>o?s:o,p=a>l?a>c?a:c:l>c?l:c;let A=i.next;for(;A!==e;){if(A.x>=h&&A.x<=d&&A.y>=u&&A.y<=p&&_h(r,a,s,l,o,c,A.x,A.y)&&Sh(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function gh(t,e,n,i){const r=t.prev,s=t,o=t.next;if(Sh(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,h=r.y,u=s.y,d=o.y,p=a<l?a<c?a:c:l<c?l:c,A=h<u?h<d?h:d:u<d?u:d,f=a>l?a>c?a:c:l>c?l:c,m=h>u?h>d?h:d:u>d?u:d,g=Ch(p,A,e,n,i),v=Ch(f,m,e,n,i);let y=t.prevZ,E=t.nextZ;for(;y&&y.z>=g&&E&&E.z<=v;){if(y.x>=p&&y.x<=f&&y.y>=A&&y.y<=m&&y!==r&&y!==o&&_h(a,h,l,u,c,d,y.x,y.y)&&Sh(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,E.x>=p&&E.x<=f&&E.y>=A&&E.y<=m&&E!==r&&E!==o&&_h(a,h,l,u,c,d,E.x,E.y)&&Sh(E.prev,E,E.next)>=0)return!1;E=E.nextZ}for(;y&&y.z>=g;){if(y.x>=p&&y.x<=f&&y.y>=A&&y.y<=m&&y!==r&&y!==o&&_h(a,h,l,u,c,d,y.x,y.y)&&Sh(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;E&&E.z<=v;){if(E.x>=p&&E.x<=f&&E.y>=A&&E.y<=m&&E!==r&&E!==o&&_h(a,h,l,u,c,d,E.x,E.y)&&Sh(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function vh(t,e,n){let i=t;do{const r=i.prev,s=i.next.next;!Ih(r,s)&&Bh(r,i,i.next,s)&&Lh(r,s)&&Lh(s,r)&&(e.push(r.i/n|0),e.push(i.i/n|0),e.push(s.i/n|0),Uh(i),Uh(i.next),i=t=s),i=i.next}while(i!==t);return Ah(i)}function yh(t,e,n,i,r,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&Mh(o,t)){let a=Dh(o,t);return o=Ah(o,o.next),a=Ah(a,a.next),fh(o,e,n,i,r,s,0),void fh(a,e,n,i,r,s,0)}t=t.next}o=o.next}while(o!==t)}function Eh(t,e){return t.x-e.x}function xh(t,e){const n=function(t,e){let n,i=e,r=-1/0;const s=t.x,o=t.y;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){const t=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=s&&t>r&&(r=t,n=i.x<i.next.x?i:i.next,t===s))return n}i=i.next}while(i!==e);if(!n)return null;const a=n,l=n.x,c=n.y;let h,u=1/0;i=n;do{s>=i.x&&i.x>=l&&s!==i.x&&_h(o<c?s:r,o,l,c,o<c?r:s,o,i.x,i.y)&&(h=Math.abs(o-i.y)/(s-i.x),Lh(i,t)&&(h<u||h===u&&(i.x>n.x||i.x===n.x&&bh(n,i)))&&(n=i,u=h)),i=i.next}while(i!==a);return n}(t,e);if(!n)return e;const i=Dh(n,t);return Ah(i,i.next),Ah(n,n.next)}function bh(t,e){return Sh(t.prev,t,e.prev)<0&&Sh(e.next,t,t.next)<0}function Ch(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function wh(t){let 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 _h(t,e,n,i,r,s,o,a){return(r-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(i-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(r-o)*(i-a)}function Mh(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&&Bh(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Lh(t,e)&&Lh(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,s=(t.y+e.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!==t);return i}(t,e)&&(Sh(t.prev,t,e.prev)||Sh(t,e.prev,e))||Ih(t,e)&&Sh(t.prev,t,t.next)>0&&Sh(e.prev,e,e.next)>0)}function Sh(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Ih(t,e){return t.x===e.x&&t.y===e.y}function Bh(t,e,n,i){const r=Rh(Sh(t,e,n)),s=Rh(Sh(t,e,i)),o=Rh(Sh(n,i,t)),a=Rh(Sh(n,i,e));return r!==s&&o!==a||!(0!==r||!Th(t,n,e))||!(0!==s||!Th(t,i,e))||!(0!==o||!Th(n,t,i))||!(0!==a||!Th(n,e,i))}function Th(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 Rh(t){return t>0?1:t<0?-1:0}function Lh(t,e){return Sh(t.prev,t,t.next)<0?Sh(t,e,t.next)>=0&&Sh(t,t.prev,e)>=0:Sh(t,e,t.prev)<0||Sh(t,t.next,e)<0}function Dh(t,e){const n=new Oh(t.i,t.x,t.y),i=new Oh(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function Ph(t,e,n,i){const r=new Oh(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 Uh(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 Oh(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}class Fh{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n}static isClockWise(t){return Fh.area(t)<0}static triangulateShape(t,e){const n=[],i=[],r=[];kh(t),Nh(n,t);let s=t.length;e.forEach(kh);for(let t=0;t<e.length;t++)i.push(s),s+=e[t].length,Nh(n,e[t]);const o=function(t,e,n=2){const i=e&&e.length,r=i?e[0]*n:t.length;let s=ph(t,0,r,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,h,u,d,p;if(i&&(s=function(t,e,n,i){const r=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:t.length,c=ph(t,a,l,i,!1),c===c.next&&(c.steiner=!0),r.push(wh(c));for(r.sort(Eh),s=0;s<r.length;s++)n=xh(r[s],n);return n}(t,e,s,n)),t.length>80*n){a=c=t[0],l=h=t[1];for(let e=n;e<r;e+=n)u=t[e],d=t[e+1],u<a&&(a=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=0!==p?32767/p:0}return fh(s,o,n,a,l,p,0),o}(n,i);for(let t=0;t<o.length;t+=3)r.push(o.slice(t,t+3));return r}}function kh(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Nh(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class Qh extends sa{constructor(t=new dh([new Br(.5,.5),new Br(-.5,.5),new Br(-.5,-.5),new Br(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,i=[],r=[];for(let e=0,n=t.length;e<n;e++)s(t[e]);function s(t){const s=[],o=void 0!==e.curveSegments?e.curveSegments:12,a=void 0!==e.steps?e.steps:1,l=void 0!==e.depth?e.depth:1;let c=void 0===e.bevelEnabled||e.bevelEnabled,h=void 0!==e.bevelThickness?e.bevelThickness:.2,u=void 0!==e.bevelSize?e.bevelSize:h-.1,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const A=e.extrudePath,f=void 0!==e.UVGenerator?e.UVGenerator:Gh;let m,g,v,y,E,x=!1;A&&(m=A.getSpacedPoints(a),x=!0,c=!1,g=A.computeFrenetFrames(a,!1),v=new os,y=new os,E=new os),c||(p=0,h=0,u=0,d=0);const b=t.extractPoints(o);let C=b.shape;const w=b.holes;if(!Fh.isClockWise(C)){C=C.reverse();for(let t=0,e=w.length;t<e;t++){const e=w[t];Fh.isClockWise(e)&&(w[t]=e.reverse())}}const _=Fh.triangulateShape(C,w),M=C;for(let t=0,e=w.length;t<e;t++){const e=w[t];C=C.concat(e)}function S(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().addScaledVector(e,n)}const I=C.length,B=_.length;function T(t,e,n){let i,r,s;const o=t.x-e.x,a=t.y-e.y,l=n.x-t.x,c=n.y-t.y,h=o*o+a*a,u=o*c-a*l;if(Math.abs(u)>Number.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-a/u,A=e.y+o/u,f=((n.x-c/d-p)*c-(n.y+l/d-A)*l)/(o*c-a*l);i=p+o*f-t.x,r=A+a*f-t.y;const m=i*i+r*r;if(m<=2)return new Br(i,r);s=Math.sqrt(m/2)}else{let t=!1;o>Number.EPSILON?l>Number.EPSILON&&(t=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(c)&&(t=!0),t?(i=-a,r=o,s=Math.sqrt(h)):(i=o,r=a,s=Math.sqrt(h/2))}return new Br(i/s,r/s)}const R=[];for(let t=0,e=M.length,n=e-1,i=t+1;t<e;t++,n++,i++)n===e&&(n=0),i===e&&(i=0),R[t]=T(M[t],M[n],M[i]);const L=[];let D,P=R.concat();for(let t=0,e=w.length;t<e;t++){const e=w[t];D=[];for(let t=0,n=e.length,i=n-1,r=t+1;t<n;t++,i++,r++)i===n&&(i=0),r===n&&(r=0),D[t]=T(e[t],e[i],e[r]);L.push(D),P=P.concat(D)}for(let t=0;t<p;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=M.length;t<e;t++){const e=S(M[t],R[t],i);F(e.x,e.y,-n)}for(let t=0,e=w.length;t<e;t++){const e=w[t];D=L[t];for(let t=0,r=e.length;t<r;t++){const r=S(e[t],D[t],i);F(r.x,r.y,-n)}}}const U=u+d;for(let t=0;t<I;t++){const e=c?S(C[t],P[t],U):C[t];x?(y.copy(g.normals[0]).multiplyScalar(e.x),v.copy(g.binormals[0]).multiplyScalar(e.y),E.copy(m[0]).add(y).add(v),F(E.x,E.y,E.z)):F(e.x,e.y,0)}for(let t=1;t<=a;t++)for(let e=0;e<I;e++){const n=c?S(C[e],P[e],U):C[e];x?(y.copy(g.normals[t]).multiplyScalar(n.x),v.copy(g.binormals[t]).multiplyScalar(n.y),E.copy(m[t]).add(y).add(v),F(E.x,E.y,E.z)):F(n.x,n.y,l/a*t)}for(let t=p-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=M.length;t<e;t++){const e=S(M[t],R[t],i);F(e.x,e.y,l+n)}for(let t=0,e=w.length;t<e;t++){const e=w[t];D=L[t];for(let t=0,r=e.length;t<r;t++){const r=S(e[t],D[t],i);x?F(r.x,r.y+m[a-1].y,m[a-1].x+n):F(r.x,r.y,l+n)}}}function O(t,e){let n=t.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=a+2*p;t<n;t++){const n=I*t,s=I*(t+1);N(e+i+n,e+r+n,e+r+s,e+i+s)}}}function F(t,e,n){s.push(t),s.push(e),s.push(n)}function k(t,e,r){Q(t),Q(e),Q(r);const s=i.length/3,o=f.generateTopUV(n,i,s-3,s-2,s-1);G(o[0]),G(o[1]),G(o[2])}function N(t,e,r,s){Q(t),Q(e),Q(s),Q(e),Q(r),Q(s);const o=i.length/3,a=f.generateSideWallUV(n,i,o-6,o-3,o-2,o-1);G(a[0]),G(a[1]),G(a[3]),G(a[1]),G(a[2]),G(a[3])}function Q(t){i.push(s[3*t+0]),i.push(s[3*t+1]),i.push(s[3*t+2])}function G(t){r.push(t.x),r.push(t.y)}!function(){const t=i.length/3;if(c){let t=0,e=I*t;for(let t=0;t<B;t++){const n=_[t];k(n[2]+e,n[1]+e,n[0]+e)}t=a+2*p,e=I*t;for(let t=0;t<B;t++){const n=_[t];k(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<B;t++){const e=_[t];k(e[2],e[1],e[0])}for(let t=0;t<B;t++){const e=_[t];k(e[0]+I*a,e[1]+I*a,e[2]+I*a)}}n.addGroup(t,i.length/3-t,0)}(),function(){const t=i.length/3;let e=0;O(M,e),e+=M.length;for(let t=0,n=w.length;t<n;t++){const n=w[t];O(n,e),e+=n.length}n.addGroup(t,i.length/3-t,1)}()}this.setAttribute("position",new Ko(i,3)),this.setAttribute("uv",new Ko(r,2)),this.computeVertexNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,i=t.length;e<i;e++){const i=t[e];n.shapes.push(i.uuid)}else n.shapes.push(t.uuid);return n.options=Object.assign({},e),void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}const i=t.options.extrudePath;return void 0!==i&&(t.options.extrudePath=(new Kc[i.type]).fromJSON(i)),new Qh(n,t.options)}}const Gh={generateTopUV:function(t,e,n,i,r){const s=e[3*n],o=e[3*n+1],a=e[3*i],l=e[3*i+1],c=e[3*r],h=e[3*r+1];return[new Br(s,o),new Br(a,l),new Br(c,h)]},generateSideWallUV:function(t,e,n,i,r,s){const o=e[3*n],a=e[3*n+1],l=e[3*n+2],c=e[3*i],h=e[3*i+1],u=e[3*i+2],d=e[3*r],p=e[3*r+1],A=e[3*r+2],f=e[3*s],m=e[3*s+1],g=e[3*s+2];return Math.abs(a-h)<Math.abs(o-c)?[new Br(o,1-l),new Br(c,1-u),new Br(d,1-A),new Br(f,1-g)]:[new Br(a,1-l),new Br(h,1-u),new Br(p,1-A),new Br(m,1-g)]}};class zh extends sh{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new zh(t.radius,t.detail)}}class Hh extends sh{constructor(t=1,e=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Hh(t.radius,t.detail)}}class Vh extends sa{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const r=t/2,s=e/2,o=Math.floor(n),a=Math.floor(i),l=o+1,c=a+1,h=t/o,u=e/a,d=[],p=[],A=[],f=[];for(let t=0;t<c;t++){const e=t*u-s;for(let n=0;n<l;n++){const i=n*h-r;p.push(i,-e,0),A.push(0,0,1),f.push(n/o),f.push(1-t/a)}}for(let t=0;t<a;t++)for(let e=0;e<o;e++){const n=e+l*t,i=e+l*(t+1),r=e+1+l*(t+1),s=e+1+l*t;d.push(n,i,s),d.push(i,r,s)}this.setIndex(d),this.setAttribute("position",new Ko(p,3)),this.setAttribute("normal",new Ko(A,3)),this.setAttribute("uv",new Ko(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Vh(t.width,t.height,t.widthSegments,t.heightSegments)}}class jh extends sa{constructor(t=.5,e=1,n=32,i=1,r=0,s=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:s},n=Math.max(3,n);const o=[],a=[],l=[],c=[];let h=t;const u=(e-t)/(i=Math.max(1,i)),d=new os,p=new Br;for(let t=0;t<=i;t++){for(let t=0;t<=n;t++){const i=r+t/n*s;d.x=h*Math.cos(i),d.y=h*Math.sin(i),a.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/e+1)/2,p.y=(d.y/e+1)/2,c.push(p.x,p.y)}h+=u}for(let t=0;t<i;t++){const e=t*(n+1);for(let t=0;t<n;t++){const i=t+e,r=i,s=i+n+1,a=i+n+2,l=i+1;o.push(r,s,l),o.push(s,a,l)}}this.setIndex(o),this.setAttribute("position",new Ko(a,3)),this.setAttribute("normal",new Ko(l,3)),this.setAttribute("uv",new Ko(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new jh(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class Wh extends sa{constructor(t=new dh([new Br(0,.5),new Br(-.5,-.5),new Br(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],i=[],r=[],s=[];let o=0,a=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(o,a,e),o+=a,a=0;function l(t){const o=i.length/3,l=t.extractPoints(e);let c=l.shape;const h=l.holes;!1===Fh.isClockWise(c)&&(c=c.reverse());for(let t=0,e=h.length;t<e;t++){const e=h[t];!0===Fh.isClockWise(e)&&(h[t]=e.reverse())}const u=Fh.triangulateShape(c,h);for(let t=0,e=h.length;t<e;t++){const e=h[t];c=c.concat(e)}for(let t=0,e=c.length;t<e;t++){const e=c[t];i.push(e.x,e.y,0),r.push(0,0,1),s.push(e.x,e.y)}for(let t=0,e=u.length;t<e;t++){const e=u[t],i=e[0]+o,r=e[1]+o,s=e[2]+o;n.push(i,r,s),a+=3}}this.setIndex(n),this.setAttribute("position",new Ko(i,3)),this.setAttribute("normal",new Ko(r,3)),this.setAttribute("uv",new Ko(s,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,i=t.length;n<i;n++){const i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}return new Wh(n,t.curveSegments)}}class qh extends sa{constructor(t=1,e=32,n=16,i=0,r=2*Math.PI,s=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:s,thetaLength:o},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const a=Math.min(s+o,Math.PI);let l=0;const c=[],h=new os,u=new os,d=[],p=[],A=[],f=[];for(let d=0;d<=n;d++){const m=[],g=d/n;let v=0;0===d&&0===s?v=.5/e:d===n&&a===Math.PI&&(v=-.5/e);for(let n=0;n<=e;n++){const a=n/e;h.x=-t*Math.cos(i+a*r)*Math.sin(s+g*o),h.y=t*Math.cos(s+g*o),h.z=t*Math.sin(i+a*r)*Math.sin(s+g*o),p.push(h.x,h.y,h.z),u.copy(h).normalize(),A.push(u.x,u.y,u.z),f.push(a+v,1-g),m.push(l++)}c.push(m)}for(let t=0;t<n;t++)for(let i=0;i<e;i++){const e=c[t][i+1],r=c[t][i],o=c[t+1][i],l=c[t+1][i+1];(0!==t||s>0)&&d.push(e,r,l),(t!==n-1||a<Math.PI)&&d.push(r,o,l)}this.setIndex(d),this.setAttribute("position",new Ko(p,3)),this.setAttribute("normal",new Ko(A,3)),this.setAttribute("uv",new Ko(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new qh(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Xh extends sh{constructor(t=1,e=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Xh(t.radius,t.detail)}}class Yh extends sa{constructor(t=1,e=.4,n=12,i=48,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const s=[],o=[],a=[],l=[],c=new os,h=new os,u=new os;for(let s=0;s<=n;s++)for(let d=0;d<=i;d++){const p=d/i*r,A=s/n*Math.PI*2;h.x=(t+e*Math.cos(A))*Math.cos(p),h.y=(t+e*Math.cos(A))*Math.sin(p),h.z=e*Math.sin(A),o.push(h.x,h.y,h.z),c.x=t*Math.cos(p),c.y=t*Math.sin(p),u.subVectors(h,c).normalize(),a.push(u.x,u.y,u.z),l.push(d/i),l.push(s/n)}for(let t=1;t<=n;t++)for(let e=1;e<=i;e++){const n=(i+1)*t+e-1,r=(i+1)*(t-1)+e-1,o=(i+1)*(t-1)+e,a=(i+1)*t+e;s.push(n,r,a),s.push(r,o,a)}this.setIndex(s),this.setAttribute("position",new Ko(o,3)),this.setAttribute("normal",new Ko(a,3)),this.setAttribute("uv",new Ko(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Yh(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class Jh extends sa{constructor(t=1,e=.4,n=64,i=8,r=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:s},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],l=[],c=[],h=new os,u=new os,d=new os,p=new os,A=new os,f=new os,m=new os;for(let o=0;o<=n;++o){const v=o/n*r*Math.PI*2;g(v,r,s,t,d),g(v+.01,r,s,t,p),f.subVectors(p,d),m.addVectors(p,d),A.crossVectors(f,m),m.crossVectors(A,f),A.normalize(),m.normalize();for(let t=0;t<=i;++t){const r=t/i*Math.PI*2,s=-e*Math.cos(r),p=e*Math.sin(r);h.x=d.x+(s*m.x+p*A.x),h.y=d.y+(s*m.y+p*A.y),h.z=d.z+(s*m.z+p*A.z),a.push(h.x,h.y,h.z),u.subVectors(h,d).normalize(),l.push(u.x,u.y,u.z),c.push(o/n),c.push(t/i)}}for(let t=1;t<=n;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),s=(i+1)*t+e,a=(i+1)*(t-1)+e;o.push(n,r,a),o.push(r,s,a)}function g(t,e,n,i,r){const s=Math.cos(t),o=Math.sin(t),a=n/e*t,l=Math.cos(a);r.x=i*(2+l)*.5*s,r.y=i*(2+l)*o*.5,r.z=i*Math.sin(a)*.5}this.setIndex(o),this.setAttribute("position",new Ko(a,3)),this.setAttribute("normal",new Ko(l,3)),this.setAttribute("uv",new Ko(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Jh(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class Kh extends sa{constructor(t=new Yc(new os(-1,-1,0),new os(-1,1,0),new os(1,1,0)),e=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r};const s=t.computeFrenetFrames(e,r);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;const o=new os,a=new os,l=new Br;let c=new os;const h=[],u=[],d=[],p=[];function A(r){c=t.getPointAt(r/e,c);const l=s.normals[r],d=s.binormals[r];for(let t=0;t<=i;t++){const e=t/i*Math.PI*2,r=Math.sin(e),s=-Math.cos(e);a.x=s*l.x+r*d.x,a.y=s*l.y+r*d.y,a.z=s*l.z+r*d.z,a.normalize(),u.push(a.x,a.y,a.z),o.x=c.x+n*a.x,o.y=c.y+n*a.y,o.z=c.z+n*a.z,h.push(o.x,o.y,o.z)}}!function(){for(let t=0;t<e;t++)A(t);A(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let n=0;n<=i;n++)l.x=t/e,l.y=n/i,d.push(l.x,l.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),s=(i+1)*t+e,o=(i+1)*(t-1)+e;p.push(n,r,o),p.push(r,s,o)}}()}(),this.setIndex(p),this.setAttribute("position",new Ko(h,3)),this.setAttribute("normal",new Ko(u,3)),this.setAttribute("uv",new Ko(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Kh((new Kc[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class Zh extends sa{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},null!==t){const e=[],n=new Set,i=new os,r=new os;if(null!==t.index){const s=t.attributes.position,o=t.index;let a=t.groups;0===a.length&&(a=[{start:0,count:o.count,materialIndex:0}]);for(let t=0,l=a.length;t<l;++t){const l=a[t],c=l.start;for(let t=c,a=c+l.count;t<a;t+=3)for(let a=0;a<3;a++){const l=o.getX(t+a),c=o.getX(t+(a+1)%3);i.fromBufferAttribute(s,l),r.fromBufferAttribute(s,c),!0===$h(i,r,n)&&(e.push(i.x,i.y,i.z),e.push(r.x,r.y,r.z))}}}else{const s=t.attributes.position;for(let t=0,o=s.count/3;t<o;t++)for(let o=0;o<3;o++){const a=3*t+o,l=3*t+(o+1)%3;i.fromBufferAttribute(s,a),r.fromBufferAttribute(s,l),!0===$h(i,r,n)&&(e.push(i.x,i.y,i.z),e.push(r.x,r.y,r.z))}}this.setAttribute("position",new Ko(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}function $h(t,e,n){const i=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return!0!==n.has(i)&&!0!==n.has(r)&&(n.add(i),n.add(r),!0)}var tu=Object.freeze({__proto__:null,BoxGeometry:ya,CapsuleGeometry:eh,CircleGeometry:nh,ConeGeometry:rh,CylinderGeometry:ih,DodecahedronGeometry:oh,EdgesGeometry:uh,ExtrudeGeometry:Qh,IcosahedronGeometry:zh,LatheGeometry:th,OctahedronGeometry:Hh,PlaneGeometry:Vh,PolyhedronGeometry:sh,RingGeometry:jh,ShapeGeometry:Wh,SphereGeometry:qh,TetrahedronGeometry:Xh,TorusGeometry:Yh,TorusKnotGeometry:Jh,TubeGeometry:Kh,WireframeGeometry:Zh});class eu extends Lo{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Bo(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}}class nu extends wa{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class iu extends Lo{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Bo(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Bo(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ws,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ru extends iu{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Br(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Cr(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Bo(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Bo(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Bo(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class su extends Lo{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Bo(16777215),this.specular=new Bo(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Bo(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ws,this.combine=Me,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),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.flatShading=t.flatShading,this.fog=t.fog,this}}class ou extends Lo{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Bo(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Bo(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class au extends Lo{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class lu extends Lo{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Bo(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Bo(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ws,this.combine=Me,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(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.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),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.flatShading=t.flatShading,this.fog=t.fog,this}}class cu extends Lo{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=bi,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,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}}class hu extends Lo{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class uu extends Lo{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Bo(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class du extends ic{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function pu(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)}function Au(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function fu(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n}function mu(t,e,n){const i=t.length,r=new t.constructor(i);for(let s=0,o=0;o!==i;++s){const i=n[s]*e;for(let n=0;n!==e;++n)r[o++]=t[i+n]}return r}function gu(t,e,n,i){let r=1,s=t[0];for(;void 0!==s&&void 0===s[i];)s=t[r++];if(void 0===s)return;let o=s[i];if(void 0!==o)if(Array.isArray(o))do{o=s[i],void 0!==o&&(e.push(s.time),n.push.apply(n,o)),s=t[r++]}while(void 0!==s);else if(void 0!==o.toArray)do{o=s[i],void 0!==o&&(e.push(s.time),o.toArray(n,n.length)),s=t[r++]}while(void 0!==s);else do{o=s[i],void 0!==o&&(e.push(s.time),n.push(o)),s=t[r++]}while(void 0!==s)}const vu={convertArray:pu,isTypedArray:Au,getKeyframeOrder:fu,sortedArray:mu,flattenJSON:gu,subclip:function(t,e,n,i,r=30){const s=t.clone();s.name=e;const o=[];for(let t=0;t<s.tracks.length;++t){const e=s.tracks[t],a=e.getValueSize(),l=[],c=[];for(let t=0;t<e.times.length;++t){const s=e.times[t]*r;if(!(s<n||s>=i)){l.push(e.times[t]);for(let n=0;n<a;++n)c.push(e.values[t*a+n])}}0!==l.length&&(e.times=pu(l,e.times.constructor),e.values=pu(c,e.values.constructor),o.push(e))}s.tracks=o;let a=1/0;for(let t=0;t<s.tracks.length;++t)a>s.tracks[t].times[0]&&(a=s.tracks[t].times[0]);for(let t=0;t<s.tracks.length;++t)s.tracks[t].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(t,e=0,n=t,i=30){i<=0&&(i=30);const r=n.tracks.length,s=e/i;for(let e=0;e<r;++e){const i=n.tracks[e],r=i.ValueTypeName;if("bool"===r||"string"===r)continue;const o=t.tracks.find((function(t){return t.name===i.name&&t.ValueTypeName===r}));if(void 0===o)continue;let a=0;const l=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let c=0;const h=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=h/3);const u=i.times.length-1;let d;if(s<=i.times[0]){const t=a,e=l-a;d=i.values.slice(t,e)}else if(s>=i.times[u]){const t=u*l+a,e=t+l-a;d=i.values.slice(t,e)}else{const t=i.createInterpolant(),e=a,n=l-a;t.evaluate(s),d=t.resultBuffer.slice(e,n)}"quaternion"===r&&(new ss).fromArray(d).normalize().conjugate().toArray(d);const p=o.times.length;for(let t=0;t<p;++t){const e=t*h+c;if("quaternion"===r)ss.multiplyQuaternionsFlat(o.values,e,d,0,o.values,e);else{const t=h-2*c;for(let n=0;n<t;++n)o.values[e+n]-=d[n]}}}return t.blendMode=vi,t}};class yu{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let s;n:{i:if(!(t<i)){for(let s=n+2;;){if(void 0===i){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===s)break;if(r=i,i=e[++n],t<i)break e}s=e.length;break n}if(t>=r)break t;{const o=e[1];t<o&&(n=2,r=o);for(let s=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===s)break;if(i=r,r=e[--n-1],t>=r)break e}s=n,n=0}}for(;n<s;){const i=n+s>>>1;t<e[i]?s=i:n=i+1}if(i=e[n],r=e[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let t=0;t!==i;++t)e[t]=n[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Eu extends yu{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ai,endingEnd:Ai}}intervalChanged_(t,e,n){const i=this.parameterPositions;let r=t-2,s=t+1,o=i[r],a=i[s];if(void 0===o)switch(this.getSettings_().endingStart){case fi:r=t,o=2*e-n;break;case mi:r=i.length-2,o=e+i[r]-i[r+1];break;default:r=t,o=n}if(void 0===a)switch(this.getSettings_().endingEnd){case fi:s=t,a=2*n-e;break;case mi:s=1,a=n+i[1]-i[0];break;default:s=t-1,a=e}const l=.5*(n-e),c=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(a-n),this._offsetPrev=r*c,this._offsetNext=s*c}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),A=p*p,f=A*p,m=-u*f+2*u*A-u*p,g=(1+u)*f+(-1.5-2*u)*A+(-.5+u)*p+1,v=(-1-d)*f+(1.5+d)*A+.5*p,y=d*f-d*A;for(let t=0;t!==o;++t)r[t]=m*s[c+t]+g*s[l+t]+v*s[a+t]+y*s[h+t];return r}}class xu extends yu{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,c=(n-e)/(i-e),h=1-c;for(let t=0;t!==o;++t)r[t]=s[l+t]*h+s[a+t]*c;return r}}class bu extends yu{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class Cu{constructor(t,e,n,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=pu(e,this.TimeBufferType),this.values=pu(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:pu(t.times,Array),values:pu(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new bu(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new xu(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Eu(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case ui:e=this.InterpolantFactoryMethodDiscrete;break;case di:e=this.InterpolantFactoryMethodLinear;break;case pi:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ui;case this.InterpolantFactoryMethodLinear:return di;case this.InterpolantFactoryMethodSmooth:return pi}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){const n=this.times,i=n.length;let r=0,s=i-1;for(;r!==i&&n[r]<t;)++r;for(;-1!==s&&n[s]>e;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(r*t,s*t)}return this}validate(){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 s=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!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,s),t=!1;break}s=i}if(void 0!==i&&Au(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(){const t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===pi,r=t.length-1;let s=1;for(let o=1;o<r;++o){let r=!1;const a=t[o];if(a!==t[o+1]&&(1!==o||a!==t[0]))if(i)r=!0;else{const t=o*n,i=t-n,s=t+n;for(let o=0;o!==n;++o){const n=e[t+o];if(n!==e[i+o]||n!==e[s+o]){r=!0;break}}}if(r){if(o!==s){t[s]=t[o];const i=o*n,r=s*n;for(let t=0;t!==n;++t)e[r+t]=e[i+t]}++s}}if(r>0){t[s]=t[r];for(let t=r*n,i=s*n,o=0;o!==n;++o)e[i+o]=e[t+o];++s}return s!==t.length?(this.times=t.slice(0,s),this.values=e.slice(0,s*n)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}Cu.prototype.TimeBufferType=Float32Array,Cu.prototype.ValueBufferType=Float32Array,Cu.prototype.DefaultInterpolation=di;class wu extends Cu{constructor(t,e,n){super(t,e,n)}}wu.prototype.ValueTypeName="bool",wu.prototype.ValueBufferType=Array,wu.prototype.DefaultInterpolation=ui,wu.prototype.InterpolantFactoryMethodLinear=void 0,wu.prototype.InterpolantFactoryMethodSmooth=void 0;class _u extends Cu{}_u.prototype.ValueTypeName="color";class Mu extends Cu{}Mu.prototype.ValueTypeName="number";class Su extends yu{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-e)/(i-e);let l=t*o;for(let t=l+o;l!==t;l+=4)ss.slerpFlat(r,0,s,l-o,s,l,a);return r}}class Iu extends Cu{InterpolantFactoryMethodLinear(t){return new Su(this.times,this.values,this.getValueSize(),t)}}Iu.prototype.ValueTypeName="quaternion",Iu.prototype.InterpolantFactoryMethodSmooth=void 0;class Bu extends Cu{constructor(t,e,n){super(t,e,n)}}Bu.prototype.ValueTypeName="string",Bu.prototype.ValueBufferType=Array,Bu.prototype.DefaultInterpolation=ui,Bu.prototype.InterpolantFactoryMethodLinear=void 0,Bu.prototype.InterpolantFactoryMethodSmooth=void 0;class Tu extends Cu{}Tu.prototype.ValueTypeName="vector";class Ru{constructor(t="",e=-1,n=[],i=gi){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=br(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(Lu(n[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(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(Cu.toJSON(n[t]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,s=[];for(let t=0;t<r;t++){let o=[],a=[];o.push((t+r-1)%r,t,(t+1)%r),a.push(0,1,0);const l=fu(o);o=mu(o,1,l),a=mu(a,1,l),i||0!==o[0]||(o.push(r),a.push(a[0])),s.push(new Mu(".morphTargetInfluences["+e[t].name+"]",o,a).scale(1/n))}return new this(t,-1,s)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,n=t.length;e<n;e++){const n=t[e],s=n.name.match(r);if(s&&s.length>1){const t=s[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const s=[];for(const t in i)s.push(this.CreateFromMorphTargetSequence(t,i[t],e,n));return s}static parseAnimation(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 s=[],o=[];gu(n,s,o,i),0!==s.length&&r.push(new t(e,s,o))}},i=[],r=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let n=0;n<r[e].morphTargets.length;n++)t[r[e].morphTargets[n]]=-1;for(const n in t){const t=[],s=[];for(let i=0;i!==r[e].morphTargets.length;++i){const i=r[e];t.push(i.time),s.push(i.morphTarget===n?1:0)}i.push(new Mu(".morphTargetInfluence["+n+"]",t,s))}a=t.length*s}else{const s=".bones["+e[t].name+"]";n(Tu,s+".position",r,"pos",i),n(Iu,s+".quaternion",r,"rot",i),n(Tu,s+".scale",r,"scl",i)}}return 0===i.length?null:new this(r,a,i,o)}resetDuration(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Lu(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Mu;case"vector":case"vector2":case"vector3":case"vector4":return Tu;case"color":return _u;case"quaternion":return Iu;case"bool":case"boolean":return wu;case"string":return Bu}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],n=[];gu(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Du={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Pu{constructor(t,e,n){const i=this;let r,s=!1,o=0,a=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,!1===s&&void 0!==i.onStart&&i.onStart(t,o,a),s=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(s=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e<n;e+=2){const n=l[e],i=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return i}return null}}}const Uu=new Pu;class Ou{constructor(t){this.manager=void 0!==t?t:Uu,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(i,r){n.load(t,i,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}Ou.DEFAULT_MATERIAL_NAME="__DEFAULT";const Fu={};class ku extends Error{constructor(t,e){super(t),this.response=e}}class Nu extends Ou{constructor(t){super(t)}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=Du.get(t);if(void 0!==r)return this.manager.itemStart(t),setTimeout((()=>{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==Fu[t])return void Fu[t].push({onLoad:e,onProgress:n,onError:i});Fu[t]=[],Fu[t].push({onLoad:e,onProgress:n,onError:i});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(s).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=Fu[t],i=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),s=r?parseInt(r):0,o=0!==s;let a=0;const l=new ReadableStream({start(t){!function e(){i.read().then((({done:i,value:r})=>{if(i)t.close();else{a+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:s});for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onProgress&&e.onProgress(i)}t.enqueue(r),e()}}),(e=>{t.error(e)}))}()}});return new Response(l)}throw new ku(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)})).then((t=>{switch(a){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,o)));case"json":return t.json();default:if(void 0===o)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(o),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then((t=>i.decode(t)))}}})).then((e=>{Du.add(t,e);const n=Fu[t];delete Fu[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onLoad&&i.onLoad(e)}})).catch((e=>{const n=Fu[t];if(void 0===n)throw this.manager.itemError(t),e;delete Fu[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Qu extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Nu(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=[];for(let n=0;n<t.length;n++){const i=Ru.parse(t[n]);e.push(i)}return e}}class Gu extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=[],o=new Sc,a=new Nu(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(r.withCredentials);let l=0;function c(c){a.load(t[c],(function(t){const n=r.parse(t,!0);s[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(o.minFilter=$e),o.image=s,o.format=n.format,o.needsUpdate=!0,e&&e(o))}),n,i)}if(Array.isArray(t))for(let e=0,n=t.length;e<n;++e)c(e);else a.load(t,(function(t){const n=r.parse(t,!0);if(n.isCubemap){const t=n.mipmaps.length/n.mipmapCount;for(let e=0;e<t;e++){s[e]={mipmaps:[]};for(let t=0;t<n.mipmapCount;t++)s[e].mipmaps.push(n.mipmaps[e*n.mipmapCount+t]),s[e].format=n.format,s[e].width=n.width,s[e].height=n.height}o.image=s}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=$e),o.format=n.format,o.needsUpdate=!0,e&&e(o)}),n,i);return o}}class zu extends Ou{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Du.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const o=Ur("img");function a(){c(),Du.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){c(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){o.removeEventListener("load",a,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",a,!1),o.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(t),o.src=t,o}}class Hu extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=new La;r.colorSpace=Bi;const s=new zu(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let o=0;function a(n){s.load(t[n],(function(t){r.images[n]=t,o++,6===o&&(r.needsUpdate=!0,e&&e(r))}),void 0,i)}for(let e=0;e<t.length;++e)a(e);return r}}class Vu extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new yl,o=new Nu(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(t,(function(t){let n;try{n=r.parse(t)}catch(t){if(void 0===i)return void console.error(t);i(t)}void 0!==n.image?s.image=n.image:void 0!==n.data&&(s.image.width=n.width,s.image.height=n.height,s.image.data=n.data),s.wrapS=void 0!==n.wrapS?n.wrapS:We,s.wrapT=void 0!==n.wrapT?n.wrapT:We,s.magFilter=void 0!==n.magFilter?n.magFilter:$e,s.minFilter=void 0!==n.minFilter?n.minFilter:$e,s.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(s.colorSpace=n.colorSpace),void 0!==n.flipY&&(s.flipY=n.flipY),void 0!==n.format&&(s.format=n.format),void 0!==n.type&&(s.type=n.type),void 0!==n.mipmaps&&(s.mipmaps=n.mipmaps,s.minFilter=nn),1===n.mipmapCount&&(s.minFilter=$e),void 0!==n.generateMipmaps&&(s.generateMipmaps=n.generateMipmaps),s.needsUpdate=!0,e&&e(s,n)}),n,i),s}}class ju extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=new Kr,s=new zu(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}class Wu extends co{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Bo(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(e.object.target=this.target.uuid),e}}class qu extends Wu{constructor(t,e,n){super(t,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(co.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Bo(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}}const Xu=new Os,Yu=new os,Ju=new os;class Ku{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Br(512,512),this.map=null,this.mapPass=null,this.matrix=new Os,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new kl,this._frameExtents=new Br(1,1),this._viewportCount=1,this._viewports=[new Zr(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Yu.setFromMatrixPosition(t.matrixWorld),e.position.copy(Yu),Ju.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Ju),e.updateMatrixWorld(),Xu.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Xu),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Xu)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 1!==this.intensity&&(t.intensity=this.intensity),0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Zu extends Ku{constructor(){super(new Ba(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,n=2*xr*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class $u extends Wu{constructor(t,e,n=0,i=Math.PI/3,r=0,s=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(co.DEFAULT_UP),this.updateMatrix(),this.target=new co,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new Zu}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const td=new Os,ed=new os,nd=new os;class id extends Ku{constructor(){super(new Ba(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Br(4,2),this._viewportCount=6,this._viewports=[new Zr(2,1,1,1),new Zr(0,1,1,1),new Zr(3,1,1,1),new Zr(1,1,1,1),new Zr(3,0,1,1),new Zr(1,0,1,1)],this._cubeDirections=[new os(1,0,0),new os(-1,0,0),new os(0,0,1),new os(0,0,-1),new os(0,1,0),new os(0,-1,0)],this._cubeUps=[new os(0,1,0),new os(0,1,0),new os(0,1,0),new os(0,1,0),new os(0,0,1),new os(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),ed.setFromMatrixPosition(t.matrixWorld),n.position.copy(ed),nd.copy(n.position),nd.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(nd),n.updateMatrixWorld(),i.makeTranslation(-ed.x,-ed.y,-ed.z),td.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(td)}}class rd extends Wu{constructor(t,e,n=0,i=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new id}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class sd extends _a{constructor(t=-1,e=1,n=1,i=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,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=t,this.view.fullHeight=e,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 t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,s=n+t,o=i+e,a=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,o-=e*this.view.offsetY,a=o-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}class od extends Ku{constructor(){super(new sd(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ad extends Wu{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(co.DEFAULT_UP),this.updateMatrix(),this.target=new co,this.shadow=new od}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class ld extends Wu{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class cd extends Wu{constructor(t,e,n=10,i=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}class hd{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new os)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.282095),e.addScaledVector(s[1],.488603*i),e.addScaledVector(s[2],.488603*r),e.addScaledVector(s[3],.488603*n),e.addScaledVector(s[4],n*i*1.092548),e.addScaledVector(s[5],i*r*1.092548),e.addScaledVector(s[6],.315392*(3*r*r-1)),e.addScaledVector(s[7],n*r*1.092548),e.addScaledVector(s[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.886227),e.addScaledVector(s[1],1.023328*i),e.addScaledVector(s[2],1.023328*r),e.addScaledVector(s[3],1.023328*n),e.addScaledVector(s[4],.858086*n*i),e.addScaledVector(s[5],.858086*i*r),e.addScaledVector(s[6],.743125*r*r-.247708),e.addScaledVector(s[7],.858086*n*r),e.addScaledVector(s[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+3*i);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+3*i);return t}static getBasisAt(t,e){const n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)}}class ud extends Wu{constructor(t=new hd,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class dd extends Ou{constructor(t){super(t),this.textures={}}load(t,e,n,i){const r=this,s=new Nu(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const i=this.createMaterialFromType(t.type);if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&void 0!==i.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.sheen&&(i.sheen=t.sheen),void 0!==t.sheenColor&&(i.sheenColor=(new Bo).setHex(t.sheenColor)),void 0!==t.sheenRoughness&&(i.sheenRoughness=t.sheenRoughness),void 0!==t.emissive&&void 0!==i.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==i.specular&&i.specular.setHex(t.specular),void 0!==t.specularIntensity&&(i.specularIntensity=t.specularIntensity),void 0!==t.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(t.specularColor),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearcoat&&(i.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(i.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.dispersion&&(i.dispersion=t.dispersion),void 0!==t.iridescence&&(i.iridescence=t.iridescence),void 0!==t.iridescenceIOR&&(i.iridescenceIOR=t.iridescenceIOR),void 0!==t.iridescenceThicknessRange&&(i.iridescenceThicknessRange=t.iridescenceThicknessRange),void 0!==t.transmission&&(i.transmission=t.transmission),void 0!==t.thickness&&(i.thickness=t.thickness),void 0!==t.attenuationDistance&&(i.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(t.attenuationColor),void 0!==t.anisotropy&&(i.anisotropy=t.anisotropy),void 0!==t.anisotropyRotation&&(i.anisotropyRotation=t.anisotropyRotation),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.flatShading&&(i.flatShading=t.flatShading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.combine&&(i.combine=t.combine),void 0!==t.side&&(i.side=t.side),void 0!==t.shadowSide&&(i.shadowSide=t.shadowSide),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.alphaHash&&(i.alphaHash=t.alphaHash),void 0!==t.depthFunc&&(i.depthFunc=t.depthFunc),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.blendSrc&&(i.blendSrc=t.blendSrc),void 0!==t.blendDst&&(i.blendDst=t.blendDst),void 0!==t.blendEquation&&(i.blendEquation=t.blendEquation),void 0!==t.blendSrcAlpha&&(i.blendSrcAlpha=t.blendSrcAlpha),void 0!==t.blendDstAlpha&&(i.blendDstAlpha=t.blendDstAlpha),void 0!==t.blendEquationAlpha&&(i.blendEquationAlpha=t.blendEquationAlpha),void 0!==t.blendColor&&void 0!==i.blendColor&&i.blendColor.setHex(t.blendColor),void 0!==t.blendAlpha&&(i.blendAlpha=t.blendAlpha),void 0!==t.stencilWriteMask&&(i.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(i.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(i.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(i.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(i.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(i.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(i.stencilZPass=t.stencilZPass),void 0!==t.stencilWrite&&(i.stencilWrite=t.stencilWrite),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(i.rotation=t.rotation),void 0!==t.linewidth&&(i.linewidth=t.linewidth),void 0!==t.dashSize&&(i.dashSize=t.dashSize),void 0!==t.gapSize&&(i.gapSize=t.gapSize),void 0!==t.scale&&(i.scale=t.scale),void 0!==t.polygonOffset&&(i.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(i.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(i.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.dithering&&(i.dithering=t.dithering),void 0!==t.alphaToCoverage&&(i.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(i.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.forceSinglePass&&(i.forceSinglePass=t.forceSinglePass),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.toneMapped&&(i.toneMapped=t.toneMapped),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?i.vertexColors=t.vertexColors>0: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 Bo).setHex(r.value);break;case"v2":i.uniforms[e].value=(new Br).fromArray(r.value);break;case"v3":i.uniforms[e].value=(new os).fromArray(r.value);break;case"v4":i.uniforms[e].value=(new Zr).fromArray(r.value);break;case"m3":i.uniforms[e].value=(new Tr).fromArray(r.value);break;case"m4":i.uniforms[e].value=(new Os).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.glslVersion&&(i.glslVersion=t.glslVersion),void 0!==t.extensions)for(const e in t.extensions)i.extensions[e]=t.extensions[e];if(void 0!==t.lights&&(i.lights=t.lights),void 0!==t.clipping&&(i.clipping=t.clipping),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 Br).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.specularIntensityMap&&(i.specularIntensityMap=n(t.specularIntensityMap)),void 0!==t.specularColorMap&&(i.specularColorMap=n(t.specularColorMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapRotation&&i.envMapRotation.fromArray(t.envMapRotation),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 Br).fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(i.iridescenceMap=n(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(i.iridescenceThicknessMap=n(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),void 0!==t.thicknessMap&&(i.thicknessMap=n(t.thicknessMap)),void 0!==t.anisotropyMap&&(i.anisotropyMap=n(t.anisotropyMap)),void 0!==t.sheenColorMap&&(i.sheenColorMap=n(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return dd.createMaterialFromType(t)}static createMaterialFromType(t){return new{ShadowMaterial:eu,SpriteMaterial:Ha,RawShaderMaterial:nu,ShaderMaterial:wa,PointsMaterial:gc,MeshPhysicalMaterial:ru,MeshStandardMaterial:iu,MeshPhongMaterial:su,MeshToonMaterial:ou,MeshNormalMaterial:au,MeshLambertMaterial:lu,MeshDepthMaterial:cu,MeshDistanceMaterial:hu,MeshBasicMaterial:Do,MeshMatcapMaterial:uu,LineDashedMaterial:du,LineBasicMaterial:ic,Material:Lo}[t]}}class pd{static decodeText(t){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,i=t.length;n<i;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class Ad extends sa{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){const t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class fd extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Nu(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e={},n={};function i(t,i){if(void 0!==e[i])return e[i];const r=t.interleavedBuffers[i],s=function(t,e){if(void 0!==n[e])return n[e];const i=t.arrayBuffers[e],r=new Uint32Array(i).buffer;return n[e]=r,r}(t,r.buffer),o=Pr(r.type,s),a=new Qa(o,r.stride);return a.uuid=r.uuid,e[i]=a,a}const r=t.isInstancedBufferGeometry?new Ad:new sa,s=t.data.index;if(void 0!==s){const t=Pr(s.type,s.array);r.setIndex(new zo(t,1))}const o=t.data.attributes;for(const e in o){const n=o[e];let s;if(n.isInterleavedBufferAttribute){const e=i(t.data,n.data);s=new za(e,n.itemSize,n.offset,n.normalized)}else{const t=Pr(n.type,n.array);s=new(n.isInstancedBufferAttribute?Cl:zo)(t,n.itemSize,n.normalized)}void 0!==n.name&&(s.name=n.name),void 0!==n.usage&&s.setUsage(n.usage),r.setAttribute(e,s)}const a=t.data.morphAttributes;if(a)for(const e in a){const n=a[e],s=[];for(let e=0,r=n.length;e<r;e++){const r=n[e];let o;if(r.isInterleavedBufferAttribute){const e=i(t.data,r.data);o=new za(e,r.itemSize,r.offset,r.normalized)}else{const t=Pr(r.type,r.array);o=new zo(t,r.itemSize,r.normalized)}void 0!==r.name&&(o.name=r.name),s.push(o)}r.morphAttributes[e]=s}t.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);const l=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==l)for(let t=0,e=l.length;t!==e;++t){const e=l[t];r.addGroup(e.start,e.count,e.materialIndex)}const c=t.data.boundingSphere;if(void 0!==c){const t=new os;void 0!==c.center&&t.fromArray(c.center),r.boundingSphere=new Ss(t,c.radius)}return t.name&&(r.name=t.name),t.userData&&(r.userData=t.userData),r}}class md extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=""===this.path?pd.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||s;const o=new Nu(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){let s=null;try{s=JSON.parse(n)}catch(e){return void 0!==i&&i(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}const o=s.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())return void 0!==i&&i(new Error("THREE.ObjectLoader: Can't load "+t)),void console.error("THREE.ObjectLoader: Can't load "+t);r.parse(s,e)}),n,i)}async loadAsync(t,e){const n=""===this.path?pd.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||n;const i=new Nu(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);const r=await i.loadAsync(t,e),s=JSON.parse(r),o=s.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(s)}parse(t,e){const n=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,i),s=this.parseImages(t.images,(function(){void 0!==e&&e(l)})),o=this.parseTextures(t.textures,s),a=this.parseMaterials(t.materials,o),l=this.parseObject(t.object,r,a,o,n),c=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,c),this.bindLightTargets(l),void 0!==e){let t=!1;for(const e in s)if(s[e].data instanceof HTMLImageElement){t=!0;break}!1===t&&e(l)}return l}async parseAsync(t){const e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,n),r=await this.parseImagesAsync(t.images),s=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,s),a=this.parseObject(t.object,i,o,s,e),l=this.parseSkeletons(t.skeletons,a);return this.bindSkeletons(a,l),this.bindLightTargets(a),a}parseShapes(t){const e={};if(void 0!==t)for(let n=0,i=t.length;n<i;n++){const i=(new dh).fromJSON(t[n]);e[i.uuid]=i}return e}parseSkeletons(t,e){const n={},i={};if(e.traverse((function(t){t.isBone&&(i[t.uuid]=t)})),void 0!==t)for(let e=0,r=t.length;e<r;e++){const r=(new bl).fromJSON(t[e],i);n[r.uuid]=r}return n}parseGeometries(t,e){const n={};if(void 0!==t){const i=new fd;for(let r=0,s=t.length;r<s;r++){let s;const o=t[r];switch(o.type){case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(o);break;case"Geometry":"THREE"in window&&"LegacyJSONLoader"in THREE?s=(new THREE.LegacyJSONLoader).parse(o,this.resourcePath).geometry:console.error('THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".');break;default:o.type in tu?s=tu[o.type].fromJSON(o,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${o.type}"`)}s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.userData&&(s.userData=o.userData),n[o.uuid]=s}}return n}parseMaterials(t,e){const n={},i={};if(void 0!==t){const r=new dd;r.setTextures(e);for(let e=0,s=t.length;e<s;e++){const s=t[e];void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i}parseAnimations(t){const e={};if(void 0!==t)for(let n=0;n<t.length;n++){const i=t[n],r=Ru.parse(i);e[r.uuid]=r}return e}parseImages(t,e){const n=this,i={};let r;function s(t){if("string"==typeof t){const e=t;return function(t){return n.manager.itemStart(t),r.load(t,(function(){n.manager.itemEnd(t)}),void 0,(function(){n.manager.itemError(t),n.manager.itemEnd(t)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:n.resourcePath+e)}return t.data?{data:Pr(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const n=new Pu(e);r=new zu(n),r.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e<n;e++){const n=t[e],r=n.url;if(Array.isArray(r)){const t=[];for(let e=0,n=r.length;e<n;e++){const n=s(r[e]);null!==n&&(n instanceof HTMLImageElement?t.push(n):t.push(new yl(n.data,n.width,n.height)))}i[n.uuid]=new Xr(t)}else{const t=s(n.url);i[n.uuid]=new Xr(t)}}}return i}async parseImagesAsync(t){const e=this,n={};let i;async function r(t){if("string"==typeof t){const n=t,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:e.resourcePath+n;return await i.loadAsync(r)}return t.data?{data:Pr(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){i=new zu(this.manager),i.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.url;if(Array.isArray(s)){const t=[];for(let e=0,n=s.length;e<n;e++){const n=s[e],i=await r(n);null!==i&&(i instanceof HTMLImageElement?t.push(i):t.push(new yl(i.data,i.width,i.height)))}n[i.uuid]=new Xr(t)}else{const t=await r(i.url);n[i.uuid]=new Xr(t)}}}return n}parseTextures(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}const i={};if(void 0!==t)for(let r=0,s=t.length;r<s;r++){const s=t[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===e[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);const o=e[s.image],a=o.data;let l;Array.isArray(a)?(l=new La,6===a.length&&(l.needsUpdate=!0)):(l=a&&a.data?new yl:new Kr,a&&(l.needsUpdate=!0)),l.source=o,l.uuid=s.uuid,void 0!==s.name&&(l.name=s.name),void 0!==s.mapping&&(l.mapping=n(s.mapping,gd)),void 0!==s.channel&&(l.channel=s.channel),void 0!==s.offset&&l.offset.fromArray(s.offset),void 0!==s.repeat&&l.repeat.fromArray(s.repeat),void 0!==s.center&&l.center.fromArray(s.center),void 0!==s.rotation&&(l.rotation=s.rotation),void 0!==s.wrap&&(l.wrapS=n(s.wrap[0],vd),l.wrapT=n(s.wrap[1],vd)),void 0!==s.format&&(l.format=s.format),void 0!==s.internalFormat&&(l.internalFormat=s.internalFormat),void 0!==s.type&&(l.type=s.type),void 0!==s.colorSpace&&(l.colorSpace=s.colorSpace),void 0!==s.minFilter&&(l.minFilter=n(s.minFilter,yd)),void 0!==s.magFilter&&(l.magFilter=n(s.magFilter,yd)),void 0!==s.anisotropy&&(l.anisotropy=s.anisotropy),void 0!==s.flipY&&(l.flipY=s.flipY),void 0!==s.generateMipmaps&&(l.generateMipmaps=s.generateMipmaps),void 0!==s.premultiplyAlpha&&(l.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(l.unpackAlignment=s.unpackAlignment),void 0!==s.compareFunction&&(l.compareFunction=s.compareFunction),void 0!==s.userData&&(l.userData=s.userData),i[s.uuid]=l}return i}parseObject(t,e,n,i,r){let s,o,a;function l(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function c(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let i=0,r=t.length;i<r;i++){const r=t[i];void 0===n[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),e.push(n[r])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}function h(t){return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined texture",t),i[t]}switch(t.type){case"Scene":s=new Na,void 0!==t.background&&(Number.isInteger(t.background)?s.background=new Bo(t.background):s.background=h(t.background)),void 0!==t.environment&&(s.environment=h(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?s.fog=new ka(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(s.fog=new Fa(t.fog.color,t.fog.density)),""!==t.fog.name&&(s.fog.name=t.fog.name)),void 0!==t.backgroundBlurriness&&(s.backgroundBlurriness=t.backgroundBlurriness),void 0!==t.backgroundIntensity&&(s.backgroundIntensity=t.backgroundIntensity),void 0!==t.backgroundRotation&&s.backgroundRotation.fromArray(t.backgroundRotation),void 0!==t.environmentIntensity&&(s.environmentIntensity=t.environmentIntensity),void 0!==t.environmentRotation&&s.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":s=new Ba(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(s.focus=t.focus),void 0!==t.zoom&&(s.zoom=t.zoom),void 0!==t.filmGauge&&(s.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(s.filmOffset=t.filmOffset),void 0!==t.view&&(s.view=Object.assign({},t.view));break;case"OrthographicCamera":s=new sd(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(s.zoom=t.zoom),void 0!==t.view&&(s.view=Object.assign({},t.view));break;case"AmbientLight":s=new ld(t.color,t.intensity);break;case"DirectionalLight":s=new ad(t.color,t.intensity),s.target=t.target||"";break;case"PointLight":s=new rd(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":s=new cd(t.color,t.intensity,t.width,t.height);break;case"SpotLight":s=new $u(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay),s.target=t.target||"";break;case"HemisphereLight":s=new qu(t.color,t.groundColor,t.intensity);break;case"LightProbe":s=(new ud).fromJSON(t);break;case"SkinnedMesh":o=l(t.geometry),a=c(t.material),s=new gl(o,a),void 0!==t.bindMode&&(s.bindMode=t.bindMode),void 0!==t.bindMatrix&&s.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(s.skeleton=t.skeleton);break;case"Mesh":o=l(t.geometry),a=c(t.material),s=new ga(o,a);break;case"InstancedMesh":o=l(t.geometry),a=c(t.material);const e=t.count,n=t.instanceMatrix,i=t.instanceColor;s=new Rl(o,a,e),s.instanceMatrix=new Cl(new Float32Array(n.array),16),void 0!==i&&(s.instanceColor=new Cl(new Float32Array(i.array),i.itemSize));break;case"BatchedMesh":o=l(t.geometry),a=c(t.material),s=new nc(t.maxInstanceCount,t.maxVertexCount,t.maxIndexCount,a),s.geometry=o,s.perObjectFrustumCulled=t.perObjectFrustumCulled,s.sortObjects=t.sortObjects,s._drawRanges=t.drawRanges,s._reservedRanges=t.reservedRanges,s._visibility=t.visibility,s._active=t.active,s._bounds=t.bounds.map((t=>{const e=new cs;e.min.fromArray(t.boxMin),e.max.fromArray(t.boxMax);const n=new Ss;return n.radius=t.sphereRadius,n.center.fromArray(t.sphereCenter),{boxInitialized:t.boxInitialized,box:e,sphereInitialized:t.sphereInitialized,sphere:n}})),s._maxInstanceCount=t.maxInstanceCount,s._maxVertexCount=t.maxVertexCount,s._maxIndexCount=t.maxIndexCount,s._geometryInitialized=t.geometryInitialized,s._geometryCount=t.geometryCount,s._matricesTexture=h(t.matricesTexture.uuid),void 0!==t.colorsTexture&&(s._colorsTexture=h(t.colorsTexture.uuid));break;case"LOD":s=new al;break;case"Line":s=new uc(l(t.geometry),c(t.material));break;case"LineLoop":s=new mc(l(t.geometry),c(t.material));break;case"LineSegments":s=new fc(l(t.geometry),c(t.material));break;case"PointCloud":case"Points":s=new bc(l(t.geometry),c(t.material));break;case"Sprite":s=new il(c(t.material));break;case"Group":s=new Pa;break;case"Bone":s=new vl;break;default:s=new co}if(s.uuid=t.uuid,void 0!==t.name&&(s.name=t.name),void 0!==t.matrix?(s.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(s.matrixAutoUpdate=t.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(void 0!==t.position&&s.position.fromArray(t.position),void 0!==t.rotation&&s.rotation.fromArray(t.rotation),void 0!==t.quaternion&&s.quaternion.fromArray(t.quaternion),void 0!==t.scale&&s.scale.fromArray(t.scale)),void 0!==t.up&&s.up.fromArray(t.up),void 0!==t.castShadow&&(s.castShadow=t.castShadow),void 0!==t.receiveShadow&&(s.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(s.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(s.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(s.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(s.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&s.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(s.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(s.visible=t.visible),void 0!==t.frustumCulled&&(s.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(s.renderOrder=t.renderOrder),void 0!==t.userData&&(s.userData=t.userData),void 0!==t.layers&&(s.layers.mask=t.layers),void 0!==t.children){const o=t.children;for(let t=0;t<o.length;t++)s.add(this.parseObject(o[t],e,n,i,r))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const n=e[t];s.animations.push(r[n])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(s.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const n=e[t],i=s.getObjectByProperty("uuid",n.object);void 0!==i&&s.addLevel(i,n.distance,n.hysteresis)}}return s}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const n=e[t.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(n,t.bindMatrix)}}))}bindLightTargets(t){t.traverse((function(e){if(e.isDirectionalLight||e.isSpotLight){const n=e.target,i=t.getObjectByProperty("uuid",n);e.target=void 0!==i?i:new co}}))}}const gd={UVMapping:Ne,CubeReflectionMapping:Qe,CubeRefractionMapping:Ge,EquirectangularReflectionMapping:ze,EquirectangularRefractionMapping:He,CubeUVReflectionMapping:Ve},vd={RepeatWrapping:je,ClampToEdgeWrapping:We,MirroredRepeatWrapping:qe},yd={NearestFilter:Xe,NearestMipmapNearestFilter:Ye,NearestMipmapLinearFilter:Ke,LinearFilter:$e,LinearMipmapNearestFilter:tn,LinearMipmapLinearFilter:nn};class Ed extends Ou{constructor(t){super(t),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Du.get(t);if(void 0!==s)return r.manager.itemStart(t),s.then?void s.then((n=>{e&&e(n),r.manager.itemEnd(t)})).catch((t=>{i&&i(t)})):(setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s);const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader;const a=fetch(t,o).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){return Du.add(t,n),e&&e(n),r.manager.itemEnd(t),n})).catch((function(e){i&&i(e),Du.remove(t),r.manager.itemError(t),r.manager.itemEnd(t)}));Du.add(t,a),r.manager.itemStart(t)}}let xd;class bd{static getContext(){return void 0===xd&&(xd=new(window.AudioContext||window.webkitAudioContext)),xd}static setContext(t){xd=t}}class Cd extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Nu(this.manager);function o(e){i?i(e):console.error(e),r.manager.itemError(t)}s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(t){try{const n=t.slice(0);bd.getContext().decodeAudioData(n,(function(t){e(t)})).catch(o)}catch(t){o(t)}}),n,i)}}const wd=new Os,_d=new Os,Md=new Os;class Sd{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ba,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ba,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,Md.copy(t.projectionMatrix);const n=e.eyeSep/2,i=n*e.near/e.focus,r=e.near*Math.tan(Er*e.fov*.5)/e.zoom;let s,o;_d.elements[12]=-n,wd.elements[12]=n,s=-r*e.aspect+i,o=r*e.aspect+i,Md.elements[0]=2*e.near/(o-s),Md.elements[8]=(o+s)/(o-s),this.cameraL.projectionMatrix.copy(Md),s=-r*e.aspect-i,o=r*e.aspect-i,Md.elements[0]=2*e.near/(o-s),Md.elements[8]=(o+s)/(o-s),this.cameraR.projectionMatrix.copy(Md)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(_d),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(wd)}}class Id extends Ba{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t,this.index=0}}class Bd{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Td(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Td();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Td(){return performance.now()}const Rd=new os,Ld=new ss,Dd=new os,Pd=new os;class Ud extends co{constructor(){super(),this.type="AudioListener",this.context=bd.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Bd}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Rd,Ld,Dd),Pd.set(0,0,-1).applyQuaternion(Ld),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Rd.x,t),e.positionY.linearRampToValueAtTime(Rd.y,t),e.positionZ.linearRampToValueAtTime(Rd.z,t),e.forwardX.linearRampToValueAtTime(Pd.x,t),e.forwardY.linearRampToValueAtTime(Pd.y,t),e.forwardZ.linearRampToValueAtTime(Pd.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(Rd.x,Rd.y,Rd.z),e.setOrientation(Pd.x,Pd.y,Pd.z,n.x,n.y,n.z)}}class Od extends co{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(t=0){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){return this.detune=t,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}copy(t,e){return super.copy(t,e),"buffer"!==t.sourceType?(console.warn("THREE.Audio: Audio source type cannot be copied."),this):(this.autoplay=t.autoplay,this.buffer=t.buffer,this.detune=t.detune,this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this.offset=t.offset,this.duration=t.duration,this.playbackRate=t.playbackRate,this.hasPlaybackControl=t.hasPlaybackControl,this.sourceType=t.sourceType,this.filters=t.filters.slice(),this)}clone(t){return new this.constructor(this.listener).copy(this,t)}}const Fd=new os,kd=new ss,Nd=new os,Qd=new os;class Gd extends Od{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(Fd,kd,Nd),Qd.set(0,0,1).applyQuaternion(kd);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(Fd.x,t),e.positionY.linearRampToValueAtTime(Fd.y,t),e.positionZ.linearRampToValueAtTime(Fd.z,t),e.orientationX.linearRampToValueAtTime(Qd.x,t),e.orientationY.linearRampToValueAtTime(Qd.y,t),e.orientationZ.linearRampToValueAtTime(Qd.z,t)}else e.setPosition(Fd.x,Fd.y,Fd.z),e.setOrientation(Qd.x,Qd.y,Qd.z)}}class zd{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}}class Hd{constructor(t,e,n){let i,r,s;switch(this.binding=t,this.valueSize=n,e){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,i=this.valueSize,r=t*i+i;let s=this.cumulativeWeight;if(0===s){for(let t=0;t!==i;++t)n[r+t]=n[t];s=e}else{s+=e;const t=e/s;this._mixBufferRegion(n,r,0,t,i)}this.cumulativeWeight=s}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(n,i,t,1-r,e)}s>0&&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]){o.setValue(n,i);break}}saveOriginalState(){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(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)t[e+i]=t[n+i]}_slerp(t,e,n,i){ss.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const s=this._workIndex*r;ss.multiplyQuaternionsFlat(t,s,t,e,t,n),ss.slerpFlat(t,e,t,e,t,s,i)}_lerp(t,e,n,i,r){const s=1-i;for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]*s+t[n+o]*i}}_lerpAdditive(t,e,n,i,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[n+s]*i}}}const Vd="\\[\\]\\.:\\/",jd=new RegExp("["+Vd+"]","g"),Wd="[^"+Vd+"]",qd="[^"+Vd.replace("\\.","")+"]",Xd=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Wd)+/(WCOD+)?/.source.replace("WCOD",qd)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Wd)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Wd)+"$"),Yd=["material","materials","bones","map"];class Jd{constructor(t,e,n){this.path=e,this.parsedPath=n||Jd.parseTrackName(e),this.node=Jd.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Jd.Composite(t,e,n):new Jd(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(jd,"")}static parseTrackName(t){const e=Xd.exec(t);if(null===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!==Yd.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}static findNode(t,e){if(void 0===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<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const s=n(r.children);if(s)return s}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=Jd.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(n){let i=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==i){if(void 0===t[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[i]}}const s=t[i];if(void 0===s){const n=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",t)}let o=this.Versioning.None;this.targetObject=t,!0===t.isMaterial?o=this.Versioning.NeedsUpdate:!0===t.isObject3D&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(a=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Jd.Composite=class{constructor(t,e,n){const i=n||Jd.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},Jd.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Jd.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Jd.prototype.GetterByBindingType=[Jd.prototype._getValue_direct,Jd.prototype._getValue_array,Jd.prototype._getValue_arrayElement,Jd.prototype._getValue_toArray],Jd.prototype.SetterByBindingTypeAndVersioning=[[Jd.prototype._setValue_direct,Jd.prototype._setValue_direct_setNeedsUpdate,Jd.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Jd.prototype._setValue_array,Jd.prototype._setValue_array_setNeedsUpdate,Jd.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Jd.prototype._setValue_arrayElement,Jd.prototype._setValue_arrayElement_setNeedsUpdate,Jd.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Jd.prototype._setValue_fromArray,Jd.prototype._setValue_fromArray_setNeedsUpdate,Jd.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Kd{constructor(){this.isAnimationObjectGroup=!0,this.uuid=br(),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}}}add(){const t=this._objects,e=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,s=r.length;let o,a=t.length,l=this.nCachedObjects_;for(let c=0,h=arguments.length;c!==h;++c){const h=arguments[c],u=h.uuid;let d=e[u];if(void 0===d){d=a++,e[u]=d,t.push(h);for(let t=0,e=s;t!==e;++t)r[t].push(new Jd(h,n[t],i[t]))}else if(d<l){o=t[d];const a=--l,c=t[a];e[c.uuid]=d,t[d]=c,e[u]=a,t[a]=h;for(let t=0,e=s;t!==e;++t){const e=r[t],s=e[a];let o=e[d];e[d]=s,void 0===o&&(o=new Jd(h,n[t],i[t])),e[a]=o}}else t[d]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let s=0,o=arguments.length;s!==o;++s){const o=arguments[s],a=o.uuid,l=e[a];if(void 0!==l&&l>=r){const s=r++,c=t[s];e[c.uuid]=l,t[l]=c,e[a]=s,t[s]=o;for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[s],r=e[l];e[l]=i,e[s]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=t.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=e[a];if(void 0!==l)if(delete e[a],l<r){const o=--r,a=t[o],c=--s,h=t[c];e[a.uuid]=l,t[l]=a,e[h.uuid]=o,t[o]=h,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[o],r=e[c];e[l]=i,e[o]=r,e.pop()}}else{const r=--s,o=t[r];r>0&&(e[o.uuid]=l),t[l]=o,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_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[t]=i,s.push(t),o.push(e),r.push(h);for(let n=c,i=a.length;n!==i;++n){const i=a[n];h[n]=new Jd(i,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];e[t[o]]=n,s[n]=a,s.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}class Zd{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,s=r.length,o=new Array(s),a={endingStart:Ai,endingEnd:Ai};for(let t=0;t!==s;++t){const e=r[t].createInterpolant(null);o[t]=e,e.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ci,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,s=n/i;t.warp(1,r,e),this.warp(s,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,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,a[1]=r+n,l[0]=t/s,l[1]=e/s,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;i<0||0===n?e=0:(this._startTime=null,e=n*i)}e*=this._updateTimeScale(t);const s=this._updateTime(e),o=this._updateWeight(t);if(o>0){const t=this._interpolants,e=this._propertyBindings;if(this.blendMode===vi)for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulateAdditive(o);else for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulate(i,o)}}_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 s=n===hi;if(0===t)return-1===r||!s||1&~r?i:e-i;if(n===li){-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,s)):this._setEndings(0===this.repetitions,!0,s)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const o=this.repetitions-r;if(o<=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===o){const e=t<0;this._setEndings(e,!e,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&~r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=fi,i.endingEnd=fi):(i.endingStart=t?this.zeroSlopeAtStart?fi:Ai:mi,i.endingEnd=e?this.zeroSlopeAtEnd?fi:Ai:mi)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=e,o[1]=r+t,a[1]=n,this}}const $d=new Float32Array(1);class tp extends gr{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,s=t._propertyBindings,o=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)++h.referenceCount,s[t]=h;else{if(h=s[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(Jd.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),s[t]=h}o[t].resultBuffer=h.buffer}}_activateAction(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(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(){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(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const i=this._actions,r=this._actionsByClip;let s=r[e];if(void 0===s)s={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=s;else{const e=s.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=i.length,i.push(t),s.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,s=this._actionsByClip,o=s[r],a=o.knownActions,l=a[a.length-1],c=t._byClipCacheIndex;l._byClipCacheIndex=c,a[c]=l,a.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===a.length&&delete s[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_addInactiveBinding(t,e,n){const i=this._bindingsByRootAndName,r=this._bindings;let s=i[e];void 0===s&&(s={},i[e]=s),s[n]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,o=s[i],a=e[e.length-1],l=t._cacheIndex;a._cacheIndex=l,e[l]=a,e.pop(),delete o[r],0===Object.keys(o).length&&delete s[i]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&(n=new xu(new Float32Array(2),new Float32Array(2),1,$d),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r}clipAction(t,e,n){const i=e||this._root,r=i.uuid;let s="string"==typeof t?Ru.findByName(i,t):t;const o=null!==s?s.uuid:t,a=this._actionsByClip[o];let l=null;if(void 0===n&&(n=null!==s?s.blendMode:gi),void 0!==a){const t=a.actionByRoot[r];if(void 0!==t&&t.blendMode===n)return t;l=a.knownActions[0],null===s&&(s=l._clip)}if(null===s)return null;const c=new Zd(this,s,e,n);return this._bindAction(c,l),this._addInactiveAction(c,o,r),c}existingAction(t,e){const n=e||this._root,i=n.uuid,r="string"==typeof t?Ru.findByName(n,t):t,s=r?r.uuid:t,o=this._actionsByClip[s];return void 0!==o&&o.actionByRoot[i]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let o=0;o!==n;++o)e[o]._update(i,t,r,s);const o=this._bindings,a=this._nActiveBindings;for(let t=0;t!==a;++t)o[t].apply(s);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const t=r.knownActions;for(let n=0,i=t.length;n!==i;++n){const i=t[n];this._deactivateAction(i);const r=i._cacheIndex,s=e[e.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,s._cacheIndex=r,e[r]=s,e.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const t in n){const i=n[t].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}const i=this._bindingsByRootAndName[e];if(void 0!==i)for(const t in i){const e=i[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class ep extends $r{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new is(null,t,e,n),this.texture.isRenderTargetTexture=!0}}class np extends $r{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isRenderTargetArray=!0,this.depth=n,this.texture=new es(null,t,e,n),this.texture.isRenderTargetTexture=!0}}class ip{constructor(t){this.value=t}clone(){return new ip(void 0===this.value.clone?this.value:this.value.clone())}}let rp=0;class sp extends gr{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:rp++}),this.name="",this.usage=ir,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){const e=this.uniforms.indexOf(t);return-1!==e&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(t){this.name=t.name,this.usage=t.usage;const e=t.uniforms;this.uniforms.length=0;for(let t=0,n=e.length;t<n;t++){const n=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0;t<n.length;t++)this.uniforms.push(n[t].clone())}return this}clone(){return(new this.constructor).copy(this)}}class op extends Qa{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}class ap{constructor(t,e,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}const lp=new Os;class cp{constructor(t,e,n=0,i=1/0){this.ray=new Us(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new qs,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return lp.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(lp),this}intersectObject(t,e=!0,n=[]){return up(t,this,n,e),n.sort(hp),n}intersectObjects(t,e=!0,n=[]){for(let i=0,r=t.length;i<r;i++)up(t[i],this,n,e);return n.sort(hp),n}}function hp(t,e){return t.distance-e.distance}function up(t,e,n,i){let r=!0;if(t.layers.test(e.layers)&&!1===t.raycast(e,n)&&(r=!1),!0===r&&!0===i){const i=t.children;for(let t=0,r=i.length;t<r;t++)up(i[t],e,n,!0)}}class dp{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=Cr(this.phi,t,Math.PI-t),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(Cr(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class pp{constructor(t=1,e=0,n=0){return this.radius=t,this.theta=e,this.y=n,this}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return(new this.constructor).copy(this)}}class Ap{constructor(t,e,n,i){Ap.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==t&&this.set(t,e,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let n=0;n<4;n++)this.elements[n]=t[n+e];return this}set(t,e,n,i){const r=this.elements;return r[0]=t,r[2]=e,r[1]=n,r[3]=i,this}}const fp=new Br;class mp{constructor(t=new Br(1/0,1/0),e=new Br(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=fp.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.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 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.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,fp).distanceTo(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}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 gp=new os,vp=new os;class yp{constructor(t=new os,e=new os){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){gp.subVectors(t,this.start),vp.subVectors(this.end,this.start);const n=vp.dot(vp);let i=vp.dot(gp)/n;return e&&(i=Cr(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return 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)}clone(){return(new this.constructor).copy(this)}}const Ep=new os;class xp extends co{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const n=new sa,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<n;t++,e++){const r=t/n*Math.PI*2,s=e/n*Math.PI*2;i.push(Math.cos(r),Math.sin(r),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new Ko(i,3));const r=new ic({fog:!1,toneMapped:!1});this.cone=new fc(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),Ep.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Ep),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const bp=new os,Cp=new Os,wp=new Os;class _p extends fc{constructor(t){const e=Mp(t),n=new sa,i=[],r=[],s=new Bo(0,0,1),o=new Bo(0,1,0);for(let t=0;t<e.length;t++){const n=e[t];n.parent&&n.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(s.r,s.g,s.b),r.push(o.r,o.g,o.b))}n.setAttribute("position",new Ko(i,3)),n.setAttribute("color",new Ko(r,3)),super(n,new ic({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,i=n.getAttribute("position");wp.copy(this.root.matrixWorld).invert();for(let t=0,n=0;t<e.length;t++){const r=e[t];r.parent&&r.parent.isBone&&(Cp.multiplyMatrices(wp,r.matrixWorld),bp.setFromMatrixPosition(Cp),i.setXYZ(n,bp.x,bp.y,bp.z),Cp.multiplyMatrices(wp,r.parent.matrixWorld),bp.setFromMatrixPosition(Cp),i.setXYZ(n+1,bp.x,bp.y,bp.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Mp(t){const e=[];!0===t.isBone&&e.push(t);for(let n=0;n<t.children.length;n++)e.push.apply(e,Mp(t.children[n]));return e}class Sp extends ga{constructor(t,e,n){super(new qh(e,4,2),new Do({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Ip=new os,Bp=new Bo,Tp=new Bo;class Rp extends co{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Hh(e);i.rotateY(.5*Math.PI),this.material=new Do({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),s=new Float32Array(3*r.count);i.setAttribute("color",new zo(s,3)),this.add(new ga(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");Bp.copy(this.light.color),Tp.copy(this.light.groundColor);for(let t=0,n=e.count;t<n;t++){const i=t<n/2?Bp:Tp;e.setXYZ(t,i.r,i.g,i.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(Ip.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Lp extends fc{constructor(t=10,e=10,n=4473924,i=8947848){n=new Bo(n),i=new Bo(i);const r=e/2,s=t/e,o=t/2,a=[],l=[];for(let t=0,c=0,h=-o;t<=e;t++,h+=s){a.push(-o,0,h,o,0,h),a.push(h,0,-o,h,0,o);const e=t===r?n:i;e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3}const c=new sa;c.setAttribute("position",new Ko(a,3)),c.setAttribute("color",new Ko(l,3)),super(c,new ic({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class Dp extends fc{constructor(t=10,e=16,n=8,i=64,r=4473924,s=8947848){r=new Bo(r),s=new Bo(s);const o=[],a=[];if(e>1)for(let n=0;n<e;n++){const i=n/e*(2*Math.PI),l=Math.sin(i)*t,c=Math.cos(i)*t;o.push(0,0,0),o.push(l,0,c);const h=1&n?r:s;a.push(h.r,h.g,h.b),a.push(h.r,h.g,h.b)}for(let e=0;e<n;e++){const l=1&e?r:s,c=t-t/n*e;for(let t=0;t<i;t++){let e=t/i*(2*Math.PI),n=Math.sin(e)*c,r=Math.cos(e)*c;o.push(n,0,r),a.push(l.r,l.g,l.b),e=(t+1)/i*(2*Math.PI),n=Math.sin(e)*c,r=Math.cos(e)*c,o.push(n,0,r),a.push(l.r,l.g,l.b)}}const l=new sa;l.setAttribute("position",new Ko(o,3)),l.setAttribute("color",new Ko(a,3)),super(l,new ic({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Pp=new os,Up=new os,Op=new os;class Fp extends co{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",void 0===e&&(e=1);let i=new sa;i.setAttribute("position",new Ko([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new ic({fog:!1,toneMapped:!1});this.lightPlane=new uc(i,r),this.add(this.lightPlane),i=new sa,i.setAttribute("position",new Ko([0,0,0,0,0,1],3)),this.targetLine=new uc(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Pp.setFromMatrixPosition(this.light.matrixWorld),Up.setFromMatrixPosition(this.light.target.matrixWorld),Op.subVectors(Up,Pp),this.lightPlane.lookAt(Up),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Up),this.targetLine.scale.z=Op.length()}}const kp=new os,Np=new _a;class Qp extends fc{constructor(t){const e=new sa,n=new ic({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={};function o(t,e){a(t),a(e)}function a(t){i.push(0,0,0),r.push(0,0,0),void 0===s[t]&&(s[t]=[]),s[t].push(i.length/3-1)}o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4"),e.setAttribute("position",new Ko(i,3)),e.setAttribute("color",new Ko(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update();const l=new Bo(16755200),c=new Bo(16711680),h=new Bo(43775),u=new Bo(16777215),d=new Bo(3355443);this.setColors(l,c,h,u,d)}setColors(t,e,n,i,r){const s=this.geometry.getAttribute("color");s.setXYZ(0,t.r,t.g,t.b),s.setXYZ(1,t.r,t.g,t.b),s.setXYZ(2,t.r,t.g,t.b),s.setXYZ(3,t.r,t.g,t.b),s.setXYZ(4,t.r,t.g,t.b),s.setXYZ(5,t.r,t.g,t.b),s.setXYZ(6,t.r,t.g,t.b),s.setXYZ(7,t.r,t.g,t.b),s.setXYZ(8,t.r,t.g,t.b),s.setXYZ(9,t.r,t.g,t.b),s.setXYZ(10,t.r,t.g,t.b),s.setXYZ(11,t.r,t.g,t.b),s.setXYZ(12,t.r,t.g,t.b),s.setXYZ(13,t.r,t.g,t.b),s.setXYZ(14,t.r,t.g,t.b),s.setXYZ(15,t.r,t.g,t.b),s.setXYZ(16,t.r,t.g,t.b),s.setXYZ(17,t.r,t.g,t.b),s.setXYZ(18,t.r,t.g,t.b),s.setXYZ(19,t.r,t.g,t.b),s.setXYZ(20,t.r,t.g,t.b),s.setXYZ(21,t.r,t.g,t.b),s.setXYZ(22,t.r,t.g,t.b),s.setXYZ(23,t.r,t.g,t.b),s.setXYZ(24,e.r,e.g,e.b),s.setXYZ(25,e.r,e.g,e.b),s.setXYZ(26,e.r,e.g,e.b),s.setXYZ(27,e.r,e.g,e.b),s.setXYZ(28,e.r,e.g,e.b),s.setXYZ(29,e.r,e.g,e.b),s.setXYZ(30,e.r,e.g,e.b),s.setXYZ(31,e.r,e.g,e.b),s.setXYZ(32,n.r,n.g,n.b),s.setXYZ(33,n.r,n.g,n.b),s.setXYZ(34,n.r,n.g,n.b),s.setXYZ(35,n.r,n.g,n.b),s.setXYZ(36,n.r,n.g,n.b),s.setXYZ(37,n.r,n.g,n.b),s.setXYZ(38,i.r,i.g,i.b),s.setXYZ(39,i.r,i.g,i.b),s.setXYZ(40,r.r,r.g,r.b),s.setXYZ(41,r.r,r.g,r.b),s.setXYZ(42,r.r,r.g,r.b),s.setXYZ(43,r.r,r.g,r.b),s.setXYZ(44,r.r,r.g,r.b),s.setXYZ(45,r.r,r.g,r.b),s.setXYZ(46,r.r,r.g,r.b),s.setXYZ(47,r.r,r.g,r.b),s.setXYZ(48,r.r,r.g,r.b),s.setXYZ(49,r.r,r.g,r.b),s.needsUpdate=!0}update(){const t=this.geometry,e=this.pointMap;Np.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);const n=this.camera.coordinateSystem===Ar?-1:0;Gp("c",e,t,Np,0,0,n),Gp("t",e,t,Np,0,0,1),Gp("n1",e,t,Np,-1,-1,n),Gp("n2",e,t,Np,1,-1,n),Gp("n3",e,t,Np,-1,1,n),Gp("n4",e,t,Np,1,1,n),Gp("f1",e,t,Np,-1,-1,1),Gp("f2",e,t,Np,1,-1,1),Gp("f3",e,t,Np,-1,1,1),Gp("f4",e,t,Np,1,1,1),Gp("u1",e,t,Np,.7,1.1,n),Gp("u2",e,t,Np,-.7,1.1,n),Gp("u3",e,t,Np,0,2,n),Gp("cf1",e,t,Np,-1,0,1),Gp("cf2",e,t,Np,1,0,1),Gp("cf3",e,t,Np,0,-1,1),Gp("cf4",e,t,Np,0,1,1),Gp("cn1",e,t,Np,-1,0,n),Gp("cn2",e,t,Np,1,0,n),Gp("cn3",e,t,Np,0,-1,n),Gp("cn4",e,t,Np,0,1,n),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Gp(t,e,n,i,r,s,o){kp.set(r,s,o).unproject(i);const a=e[t];if(void 0!==a){const t=n.getAttribute("position");for(let e=0,n=a.length;e<n;e++)t.setXYZ(a[e],kp.x,kp.y,kp.z)}}const zp=new cs;class Hp extends fc{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new sa;r.setIndex(new zo(n,1)),r.setAttribute("position",new zo(i,3)),super(r,new ic({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&zp.setFromObject(this.object),zp.isEmpty())return;const e=zp.min,n=zp.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=e.x,r[4]=n.y,r[5]=n.z,r[6]=e.x,r[7]=e.y,r[8]=n.z,r[9]=n.x,r[10]=e.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=e.z,r[15]=e.x,r[16]=n.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=n.x,r[22]=e.y,r[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Vp extends fc{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new sa;i.setIndex(new zo(n,1)),i.setAttribute("position",new Ko([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new ic({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}}class jp extends uc{constructor(t,e=1,n=16776960){const i=n,r=new sa;r.setAttribute("position",new Ko([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),r.computeBoundingSphere(),super(r,new ic({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const s=new sa;s.setAttribute("position",new Ko([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),this.add(new ga(s,new Do({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Wp=new os;let qp,Xp;class Yp extends co{constructor(t=new os(0,0,1),e=new os(0,0,0),n=1,i=16776960,r=.2*n,s=.2*r){super(),this.type="ArrowHelper",void 0===qp&&(qp=new sa,qp.setAttribute("position",new Ko([0,0,0,0,1,0],3)),Xp=new ih(0,.5,1,5,1),Xp.translate(0,-.5,0)),this.position.copy(e),this.line=new uc(qp,new ic({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ga(Xp,new Do({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,s)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{Wp.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Wp,e)}}setLength(t,e=.2*t,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}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class Jp extends fc{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 sa;n.setAttribute("position",new Ko(e,3)),n.setAttribute("color",new Ko([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new ic({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,n){const i=new Bo,r=this.geometry.attributes.color.array;return i.set(t),i.toArray(r,0),i.toArray(r,3),i.set(e),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Kp{constructor(){this.type="ShapePath",this.color=new Bo,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new $c,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this}bezierCurveTo(t,e,n,i,r,s){return this.currentPath.bezierCurveTo(t,e,n,i,r,s),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const n=e.length;let i=!1;for(let r=n-1,s=0;s<n;r=s++){let n=e[r],o=e[s],a=o.x-n.x,l=o.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=e[s],a=-a,o=e[r],l=-l),t.y<n.y||t.y>o.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(o.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=o.x)return!0}}return i}const n=Fh.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,s,o;const a=[];if(1===i.length)return s=i[0],o=new dh,o.curves=s.curves,a.push(o),a;let l=!n(i[0].getPoints());l=t?!l:l;const c=[],h=[];let u,d,p=[],A=0;h[A]=void 0,p[A]=[];for(let e=0,o=i.length;e<o;e++)s=i[e],u=s.getPoints(),r=n(u),r=t?!r:r,r?(!l&&h[A]&&A++,h[A]={s:new dh,p:u},h[A].s.curves=s.curves,l&&A++,p[A]=[]):p[A].push({h:s,p:u[0]});if(!h[0])return function(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n],r=new dh;r.curves=i.curves,e.push(r)}return e}(i);if(h.length>1){let t=!1,n=0;for(let t=0,e=h.length;t<e;t++)c[t]=[];for(let i=0,r=h.length;i<r;i++){const r=p[i];for(let s=0;s<r.length;s++){const o=r[s];let a=!0;for(let r=0;r<h.length;r++)e(o.p,h[r].p)&&(i!==r&&n++,a?(a=!1,c[r].push(o)):t=!0);a&&c[i].push(o)}}n>0&&!1===t&&(p=c)}for(let t=0,e=h.length;t<e;t++){o=h[t].s,a.push(o),d=p[t];for(let t=0,e=d.length;t<e;t++)o.holes.push(d[t].h)}return a}}class Zp extends gr{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}function $p(t,e,n,i){const r=function(t){switch(t){case sn:case on:return{byteLength:1,components:1};case ln:case an:case dn:return{byteLength:2,components:1};case pn:case An:return{byteLength:2,components:4};case hn:case cn:case un:return{byteLength:4,components:1};case mn:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}(i);switch(n){case gn:case En:return t*e;case xn:return t*e*2;case wn:case _n:return t*e/r.components*r.byteLength;case Mn:case Sn:return t*e*2/r.components*r.byteLength;case vn:return t*e*3/r.components*r.byteLength;case yn:case Bn:return t*e*4/r.components*r.byteLength;case Tn:case Rn:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Ln:case Dn:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Un:case Fn:return Math.max(t,16)*Math.max(e,8)/4;case Pn:case On:return Math.max(t,8)*Math.max(e,8)/2;case kn:case Nn:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Qn:case Gn:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case zn:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case Hn:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case Vn:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case jn:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case Wn:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case qn:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case Xn:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case Yn:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case Jn:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case Kn:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case Zn:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case $n:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case ti:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case ei:case ni:case ii:return Math.ceil(t/4)*Math.ceil(e/4)*16;case ri:case si:return Math.ceil(t/4)*Math.ceil(e/4)*8;case oi:case ai:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}const tA={contain:function(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t},cover:function(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t},fill:function(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t},getByteLength:$p};function eA(){let t=null,e=!1,n=null,i=null;function r(e,s){n(e,s),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 nA(t){const e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=e.get(n);i&&(t.deleteBuffer(i.buffer),e.delete(n))},update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const t=e.get(n);return void((!t||t.version<n.version)&&e.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}const r=e.get(n);if(void 0===r)e.set(n,function(e,n){const i=e.array,r=e.usage,s=i.byteLength,o=t.createBuffer();let a;if(t.bindBuffer(n,o),t.bufferData(n,i,r),e.onUploadCallback(),i instanceof Float32Array)a=t.FLOAT;else if(i instanceof Uint16Array)a=e.isFloat16BufferAttribute?t.HALF_FLOAT:t.UNSIGNED_SHORT;else if(i instanceof Int16Array)a=t.SHORT;else if(i instanceof Uint32Array)a=t.UNSIGNED_INT;else if(i instanceof Int32Array)a=t.INT;else if(i instanceof Int8Array)a=t.BYTE;else if(i instanceof Uint8Array)a=t.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);a=t.UNSIGNED_BYTE}return{buffer:o,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version,size:s}}(n,i));else if(r.version<n.version){if(r.size!==n.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(e,n,i){const r=n.array,s=n.updateRanges;if(t.bindBuffer(i,e),0===s.length)t.bufferSubData(i,0,r);else{s.sort(((t,e)=>t.start-e.start));let e=0;for(let t=1;t<s.length;t++){const n=s[e],i=s[t];i.start<=n.start+n.count+1?n.count=Math.max(n.count,i.start+i.count-n.start):(++e,s[e]=i)}s.length=e+1;for(let e=0,n=s.length;e<n;e++){const n=s[e];t.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Lt}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Lt);const iA={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_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 ) || defined( USE_BATCHING_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\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( 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 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in 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( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\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 shadowIntensity;\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\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 shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, 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.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},rA={common:{diffuse:{value:new Bo(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Tr},alphaMap:{value:null},alphaMapTransform:{value:new Tr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Tr}},envmap:{envMap:{value:null},envMapRotation:{value:new Tr},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Tr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Tr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Tr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Tr},normalScale:{value:new Br(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Tr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Tr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Tr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Tr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Bo(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 Bo(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Tr},alphaTest:{value:0},uvTransform:{value:new Tr}},sprite:{diffuse:{value:new Bo(16777215)},opacity:{value:1},center:{value:new Br(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Tr},alphaMap:{value:null},alphaMapTransform:{value:new Tr},alphaTest:{value:0}}},sA={basic:{uniforms:xa([rA.common,rA.specularmap,rA.envmap,rA.aomap,rA.lightmap,rA.fog]),vertexShader:iA.meshbasic_vert,fragmentShader:iA.meshbasic_frag},lambert:{uniforms:xa([rA.common,rA.specularmap,rA.envmap,rA.aomap,rA.lightmap,rA.emissivemap,rA.bumpmap,rA.normalmap,rA.displacementmap,rA.fog,rA.lights,{emissive:{value:new Bo(0)}}]),vertexShader:iA.meshlambert_vert,fragmentShader:iA.meshlambert_frag},phong:{uniforms:xa([rA.common,rA.specularmap,rA.envmap,rA.aomap,rA.lightmap,rA.emissivemap,rA.bumpmap,rA.normalmap,rA.displacementmap,rA.fog,rA.lights,{emissive:{value:new Bo(0)},specular:{value:new Bo(1118481)},shininess:{value:30}}]),vertexShader:iA.meshphong_vert,fragmentShader:iA.meshphong_frag},standard:{uniforms:xa([rA.common,rA.envmap,rA.aomap,rA.lightmap,rA.emissivemap,rA.bumpmap,rA.normalmap,rA.displacementmap,rA.roughnessmap,rA.metalnessmap,rA.fog,rA.lights,{emissive:{value:new Bo(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:iA.meshphysical_vert,fragmentShader:iA.meshphysical_frag},toon:{uniforms:xa([rA.common,rA.aomap,rA.lightmap,rA.emissivemap,rA.bumpmap,rA.normalmap,rA.displacementmap,rA.gradientmap,rA.fog,rA.lights,{emissive:{value:new Bo(0)}}]),vertexShader:iA.meshtoon_vert,fragmentShader:iA.meshtoon_frag},matcap:{uniforms:xa([rA.common,rA.bumpmap,rA.normalmap,rA.displacementmap,rA.fog,{matcap:{value:null}}]),vertexShader:iA.meshmatcap_vert,fragmentShader:iA.meshmatcap_frag},points:{uniforms:xa([rA.points,rA.fog]),vertexShader:iA.points_vert,fragmentShader:iA.points_frag},dashed:{uniforms:xa([rA.common,rA.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:iA.linedashed_vert,fragmentShader:iA.linedashed_frag},depth:{uniforms:xa([rA.common,rA.displacementmap]),vertexShader:iA.depth_vert,fragmentShader:iA.depth_frag},normal:{uniforms:xa([rA.common,rA.bumpmap,rA.normalmap,rA.displacementmap,{opacity:{value:1}}]),vertexShader:iA.meshnormal_vert,fragmentShader:iA.meshnormal_frag},sprite:{uniforms:xa([rA.sprite,rA.fog]),vertexShader:iA.sprite_vert,fragmentShader:iA.sprite_frag},background:{uniforms:{uvTransform:{value:new Tr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:iA.background_vert,fragmentShader:iA.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Tr}},vertexShader:iA.backgroundCube_vert,fragmentShader:iA.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:iA.cube_vert,fragmentShader:iA.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:iA.equirect_vert,fragmentShader:iA.equirect_frag},distanceRGBA:{uniforms:xa([rA.common,rA.displacementmap,{referencePosition:{value:new os},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:iA.distanceRGBA_vert,fragmentShader:iA.distanceRGBA_frag},shadow:{uniforms:xa([rA.lights,rA.fog,{color:{value:new Bo(0)},opacity:{value:1}}]),vertexShader:iA.shadow_vert,fragmentShader:iA.shadow_frag}};sA.physical={uniforms:xa([sA.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Tr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Tr},clearcoatNormalScale:{value:new Br(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Tr},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Tr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Tr},sheen:{value:0},sheenColor:{value:new Bo(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Tr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Tr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Tr},transmissionSamplerSize:{value:new Br},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Tr},attenuationDistance:{value:0},attenuationColor:{value:new Bo(0)},specularColor:{value:new Bo(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Tr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Tr},anisotropyVector:{value:new Br},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Tr}}]),vertexShader:iA.meshphysical_vert,fragmentShader:iA.meshphysical_frag};const oA={r:0,b:0,g:0},aA=new Ws,lA=new Os;function cA(t,e,n,i,r,s,o){const a=new Bo(0);let l,c,h=!0===s?0:1,u=null,d=0,p=null;function A(t){let i=!0===t.isScene?t.background:null;return i&&i.isTexture&&(i=(t.backgroundBlurriness>0?n:e).get(i)),i}function f(e,n){e.getRGB(oA,ba(t)),i.buffers.color.setClear(oA.r,oA.g,oA.b,n,o)}return{getClearColor:function(){return a},setClearColor:function(t,e=1){a.set(t),h=e,f(a,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,f(a,h)},render:function(e){let n=!1;const r=A(e);null===r?f(a,h):r&&r.isColor&&(f(r,1),n=!0);const s=t.xr.getEnvironmentBlendMode();"additive"===s?i.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===s&&i.buffers.color.setClear(0,0,0,0,o),(t.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))},addToRenderList:function(e,n){const i=A(n);i&&(i.isCubeTexture||i.mapping===Ve)?(void 0===c&&(c=new ga(new ya(1e4,1e4,1e4),new wa({name:"BackgroundCubeMaterial",uniforms:Ea(sA.backgroundCube.uniforms),vertexShader:sA.backgroundCube.vertexShader,fragmentShader:sA.backgroundCube.fragmentShader,side:Vt,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),aA.copy(n.backgroundRotation),aA.x*=-1,aA.y*=-1,aA.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(aA.y*=-1,aA.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(lA.makeRotationFromEuler(aA)),c.material.toneMapped=zr.getTransfer(i.colorSpace)!==Li,u===i&&d===i.version&&p===t.toneMapping||(c.material.needsUpdate=!0,u=i,d=i.version,p=t.toneMapping),c.layers.enableAll(),e.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new ga(new Vh(2,2),new wa({name:"BackgroundMaterial",uniforms:Ea(sA.background.uniforms),vertexShader:sA.background.vertexShader,fragmentShader:sA.background.fragmentShader,side:Ht,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=zr.getTransfer(i.colorSpace)!==Li,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),u===i&&d===i.version&&p===t.toneMapping||(l.material.needsUpdate=!0,u=i,d=i.version,p=t.toneMapping),l.layers.enableAll(),e.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==c&&(c.geometry.dispose(),c.material.dispose(),c=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function hA(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=c(null);let s=r,o=!1;function a(e){return t.bindVertexArray(e)}function l(e){return t.deleteVertexArray(e)}function c(t){const e=[],i=[],r=[];for(let t=0;t<n;t++)e[t]=0,i[t]=0,r[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:r,object:t,attributes:{},index:null}}function h(){const t=s.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function u(t){d(t,0)}function d(e,n){const i=s.newAttributes,r=s.enabledAttributes,o=s.attributeDivisors;i[e]=1,0===r[e]&&(t.enableVertexAttribArray(e),r[e]=1),o[e]!==n&&(t.vertexAttribDivisor(e,n),o[e]=n)}function p(){const e=s.newAttributes,n=s.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function A(e,n,i,r,s,o,a){!0===a?t.vertexAttribIPointer(e,n,i,s,o):t.vertexAttribPointer(e,n,i,r,s,o)}function f(){m(),o=!0,s!==r&&(s=r,a(s.object))}function m(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,f,m){let g=!1;const v=function(e,n,r){const s=!0===r.wireframe;let o=i[e.id];void 0===o&&(o={},i[e.id]=o);let a=o[n.id];void 0===a&&(a={},o[n.id]=a);let l=a[s];return void 0===l&&(l=c(t.createVertexArray()),a[s]=l),l}(f,l,r);s!==v&&(s=v,a(s.object)),g=function(t,e,n,i){const r=s.attributes,o=e.attributes;let a=0;const l=n.getAttributes();for(const e in l)if(l[e].location>=0){const n=r[e];let i=o[e];if(void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;a++}return s.attributesNum!==a||s.index!==i}(n,f,l,m),g&&function(t,e,n,i){const r={},o=e.attributes;let a=0;const l=n.getAttributes();for(const e in l)if(l[e].location>=0){let n=o[e];void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[e]=i,a++}s.attributes=r,s.attributesNum=a,s.index=i}(n,f,l,m),null!==m&&e.update(m,t.ELEMENT_ARRAY_BUFFER),(g||o)&&(o=!1,function(n,i,r,s){h();const o=s.attributes,a=r.getAttributes(),l=i.defaultAttributeValues;for(const i in a){const r=a[i];if(r.location>=0){let a=o[i];if(void 0===a&&("instanceMatrix"===i&&n.instanceMatrix&&(a=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(a=n.instanceColor)),void 0!==a){const i=a.normalized,o=a.itemSize,l=e.get(a);if(void 0===l)continue;const c=l.buffer,h=l.type,p=l.bytesPerElement,f=h===t.INT||h===t.UNSIGNED_INT||a.gpuType===cn;if(a.isInterleavedBufferAttribute){const e=a.data,l=e.stride,m=a.offset;if(e.isInstancedInterleavedBuffer){for(let t=0;t<r.locationSize;t++)d(r.location+t,e.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=e.meshPerAttribute*e.count)}else for(let t=0;t<r.locationSize;t++)u(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<r.locationSize;t++)A(r.location+t,o/r.locationSize,h,i,l*p,(m+o/r.locationSize*t)*p,f)}else{if(a.isInstancedBufferAttribute){for(let t=0;t<r.locationSize;t++)d(r.location+t,a.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let t=0;t<r.locationSize;t++)u(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<r.locationSize;t++)A(r.location+t,o/r.locationSize,h,i,o*p,o/r.locationSize*t*p,f)}}else if(void 0!==l){const e=l[i];if(void 0!==e)switch(e.length){case 2:t.vertexAttrib2fv(r.location,e);break;case 3:t.vertexAttrib3fv(r.location,e);break;case 4:t.vertexAttrib4fv(r.location,e);break;default:t.vertexAttrib1fv(r.location,e)}}}}p()}(n,r,l,f),null!==m&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(m).buffer))},reset:f,resetDefaultState:m,dispose:function(){f();for(const t in i){const e=i[t];for(const t in e){const n=e[t];for(const t in n)l(n[t].object),delete n[t];delete e[t]}delete i[t]}},releaseStatesOfGeometry:function(t){if(void 0===i[t.id])return;const e=i[t.id];for(const t in e){const n=e[t];for(const t in n)l(n[t].object),delete n[t];delete e[t]}delete i[t.id]},releaseStatesOfProgram:function(t){for(const e in i){const n=i[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)l(r[t].object),delete r[t];delete n[t.id]}},initAttributes:h,enableAttribute:u,disableUnusedAttributes:p}}function uA(t,e,n){let i;function r(e,r,s){0!==s&&(t.drawArraysInstanced(i,e,r,s),n.update(r,i,s))}this.setMode=function(t){i=t},this.render=function(e,r){t.drawArrays(i,e,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(t,r,s){if(0===s)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,t,0,r,0,s);let o=0;for(let t=0;t<s;t++)o+=r[t];n.update(o,i,1)},this.renderMultiDrawInstances=function(t,s,o,a){if(0===o)return;const l=e.get("WEBGL_multi_draw");if(null===l)for(let e=0;e<t.length;e++)r(t[e],s[e],a[e]);else{l.multiDrawArraysInstancedWEBGL(i,t,0,s,0,a,0,o);let e=0;for(let t=0;t<o;t++)e+=s[t]*a[t];n.update(e,i,1)}}}function dA(t,e,n,i){let r;function s(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==n.precision?n.precision:"highp";const a=s(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=!0===n.logarithmicDepthBuffer,c=!0===n.reverseDepthBuffer&&e.has("EXT_clip_control"),h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:s,textureFormatReadable:function(e){return e===yn||i.convert(e)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===dn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(n!==sn&&i.convert(n)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==un&&!r)},precision:o,logarithmicDepthBuffer:l,reverseDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxCubemapSize:t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:t.getParameter(t.MAX_VERTEX_ATTRIBS),maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:t.getParameter(t.MAX_VARYING_VECTORS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:u>0,maxSamples:t.getParameter(t.MAX_SAMPLES)}}function pA(t){const e=this;let n=null,i=0,r=!1,s=!1;const o=new Ul,a=new Tr,l={value:null,needsUpdate:!1};function c(t,n,i,r){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const e=i+4*s,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,n=i;e!==s;++e,n+=4)o.copy(t[e]).applyMatrix4(r,a),o.normal.toArray(c,n),c[n+3]=o.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=s,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){const n=0!==t.length||e||0!==i||r;return r=e,i=t.length,n},this.beginShadows=function(){s=!0,c(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(t,e){n=c(t,e,0)},this.setState=function(o,a,h){const u=o.clippingPlanes,d=o.clipIntersection,p=o.clipShadows,A=t.get(o);if(!r||null===u||0===u.length||s&&!p)s?c(null):(l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0);else{const t=s?0:i,e=4*t;let r=A.clippingState||null;l.value=r,r=c(u,a,e,h);for(let t=0;t!==e;++t)r[t]=n[t];A.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function AA(t){let e=new WeakMap;function n(t,e){return e===ze?t.mapping=Qe:e===He&&(t.mapping=Ge),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping;if(s===ze||s===He){if(e.has(r))return n(e.get(r).texture,r.mapping);{const s=r.image;if(s&&s.height>0){const o=new Da(s.height);return o.fromEquirectangularTexture(t,r),e.set(r,o),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}const fA=[.125,.215,.35,.446,.526,.582],mA=new sd,gA=new Bo;let vA=null,yA=0,EA=0,xA=!1;const bA=(1+Math.sqrt(5))/2,CA=1/bA,wA=[new os(-bA,CA,0),new os(bA,CA,0),new os(-CA,0,bA),new os(CA,0,bA),new os(0,bA,-CA),new os(0,bA,CA),new os(-1,1,-1),new os(1,1,-1),new os(-1,1,1),new os(1,1,1)];class _A{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){vA=this._renderer.getRenderTarget(),yA=this._renderer.getActiveCubeFace(),EA=this._renderer.getActiveMipmapLevel(),xA=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=BA(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=IA(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(vA,yA,EA),this._renderer.xr.enabled=xA,t.scissorTest=!1,SA(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===Qe||t.mapping===Ge?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),vA=this._renderer.getRenderTarget(),yA=this._renderer.getActiveCubeFace(),EA=this._renderer.getActiveMipmapLevel(),xA=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:$e,minFilter:$e,generateMipmaps:!1,type:dn,format:yn,colorSpace:Ti,depthBuffer:!1},i=MA(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=MA(t,e,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],n=[],i=[];let r=t;const s=t-4+1+fA.length;for(let o=0;o<s;o++){const s=Math.pow(2,r);n.push(s);let a=1/s;o>t-4?a=fA[o-t+4-1]:0===o&&(a=0),i.push(a);const l=1/(s-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,A=3,f=2,m=1,g=new Float32Array(A*p*d),v=new Float32Array(f*p*d),y=new Float32Array(m*p*d);for(let t=0;t<d;t++){const e=t%3*2/3-1,n=t>2?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,A*p*t),v.set(u,f*p*t);const r=[t,t,t,t,t,t];y.set(r,m*p*t)}const E=new sa;E.setAttribute("position",new zo(g,A)),E.setAttribute("uv",new zo(v,f)),E.setAttribute("faceIndex",new zo(y,m)),e.push(E),r>4&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(t,e,n){const i=new Float32Array(20),r=new os(0,1,0);return new wa({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:Wt,depthTest:!1,depthWrite:!1})}(i,t,e)}return i}_compileMaterial(t){const e=new ga(this._lodPlanes[0],t);this._renderer.compile(e,mA)}_sceneToCubeUV(t,e,n,i){const r=new Ba(90,1,e,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,c=a.toneMapping;a.getClearColor(gA),a.toneMapping=Be,a.autoClear=!1;const h=new Do({name:"PMREM.Background",side:Vt,depthWrite:!1,depthTest:!1}),u=new ga(new ya,h);let d=!1;const p=t.background;p?p.isColor&&(h.color.copy(p),t.background=null,d=!0):(h.color.copy(gA),d=!0);for(let e=0;e<6;e++){const n=e%3;0===n?(r.up.set(0,s[e],0),r.lookAt(o[e],0,0)):1===n?(r.up.set(0,0,s[e]),r.lookAt(0,o[e],0)):(r.up.set(0,s[e],0),r.lookAt(0,0,o[e]));const l=this._cubeSize;SA(i,n*l,e>2?l:0,l,l),a.setRenderTarget(i),d&&a.render(u,r),a.render(t,r)}u.geometry.dispose(),u.material.dispose(),a.toneMapping=c,a.autoClear=l,t.background=p}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===Qe||t.mapping===Ge;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=BA()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=IA());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new ga(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const o=this._cubeSize;SA(e,0,0,3*o,2*o),n.setRenderTarget(e),n.render(s,mA)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const i=this._lodPlanes.length;for(let e=1;e<i;e++){const n=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),r=wA[(i-e-1)%wA.length];this._blur(t,e-1,e,n,r)}e.autoClear=n}_blur(t,e,n,i,r){const s=this._pingPongRenderTarget;this._halfBlur(t,s,e,n,i,"latitudinal",r),this._halfBlur(s,t,n,n,i,"longitudinal",r)}_halfBlur(t,e,n,i,r,s,o){const a=this._renderer,l=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new ga(this._lodPlanes[i],l),h=l.uniforms,u=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/d,A=isFinite(r)?1+Math.floor(3*p):20;A>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${A} samples when the maximum is set to 20`);const f=[];let m=0;for(let t=0;t<20;++t){const e=t/p,n=Math.exp(-e*e/2);f.push(n),0===t?m+=n:t<A&&(m+=2*n)}for(let t=0;t<f.length;t++)f[t]=f[t]/m;h.envMap.value=t.texture,h.samples.value=A,h.weights.value=f,h.latitudinal.value="latitudinal"===s,o&&(h.poleAxis.value=o);const{_lodMax:g}=this;h.dTheta.value=d,h.mipInt.value=g-n;const v=this._sizeLods[i];SA(e,3*v*(i>g-4?i-g+4:0),4*(this._cubeSize-v),3*v,2*v),a.setRenderTarget(e),a.render(c,mA)}}function MA(t,e,n){const i=new ts(t,e,n);return i.texture.mapping=Ve,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function SA(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function IA(){return new wa({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:Wt,depthTest:!1,depthWrite:!1})}function BA(){return new wa({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:Wt,depthTest:!1,depthWrite:!1})}function TA(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,o=s===ze||s===He,a=s===Qe||s===Ge;if(o||a){let s=e.get(r);const l=void 0!==s?s.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new _A(t)),s=o?n.fromEquirectangular(r,s):n.fromCubemap(r,s),s.texture.pmremVersion=r.pmremVersion,e.set(r,s),s.texture;if(void 0!==s)return s.texture;{const l=r.image;return o&&l&&l.height>0||a&&l&&function(t){let e=0;for(let n=0;n<6;n++)void 0!==t[n]&&e++;return 6===e}(l)?(null===n&&(n=new _A(t)),s=o?n.fromEquirectangular(r):n.fromCubemap(r),s.texture.pmremVersion=r.pmremVersion,e.set(r,s),r.addEventListener("dispose",i),s.texture):null}}}return r},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function RA(t){const e={};function n(n){if(void 0!==e[n])return 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,i}return{has:function(t){return null!==n(t)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(t){const e=n(t);return null===e&&kr("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function LA(t,e,n,i){const r={},s=new WeakMap;function o(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const t in a.attributes)e.remove(a.attributes[t]);a.removeEventListener("dispose",o),delete r[a.id];const l=s.get(a);l&&(e.remove(l),s.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],i=t.index,r=t.attributes.position;let o=0;if(null!==i){const t=i.array;o=i.version;for(let e=0,i=t.length;e<i;e+=3){const i=t[e+0],r=t[e+1],s=t[e+2];n.push(i,r,r,s,s,i)}}else{if(void 0===r)return;{const t=r.array;o=r.version;for(let e=0,i=t.length/3-1;e<i;e+=3){const t=e+0,i=e+1,r=e+2;n.push(t,i,i,r,r,t)}}}const a=new(Lr(n)?Yo:qo)(n,1);a.version=o;const l=s.get(t);l&&e.remove(l),s.set(t,a)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",o),r[e.id]=!0,n.memory.geometries++),e},update:function(n){const i=n.attributes;for(const n in i)e.update(i[n],t.ARRAY_BUFFER)},getWireframeAttribute:function(t){const e=s.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&a(t)}else a(t);return s.get(t)}}}function DA(t,e,n){let i,r,s;function o(e,o,a){0!==a&&(t.drawElementsInstanced(i,o,r,e*s,a),n.update(o,i,a))}this.setMode=function(t){i=t},this.setIndex=function(t){r=t.type,s=t.bytesPerElement},this.render=function(e,o){t.drawElements(i,o,r,e*s),n.update(o,i,1)},this.renderInstances=o,this.renderMultiDraw=function(t,s,o){if(0===o)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,s,0,r,t,0,o);let a=0;for(let t=0;t<o;t++)a+=s[t];n.update(a,i,1)},this.renderMultiDrawInstances=function(t,a,l,c){if(0===l)return;const h=e.get("WEBGL_multi_draw");if(null===h)for(let e=0;e<t.length;e++)o(t[e]/s,a[e],c[e]);else{h.multiDrawElementsInstancedWEBGL(i,a,0,r,t,0,c,0,l);let e=0;for(let t=0;t<l;t++)e+=a[t]*c[t];n.update(e,i,1)}}}function PA(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(n,i,r){switch(e.calls++,i){case t.TRIANGLES:e.triangles+=r*(n/3);break;case t.LINES:e.lines+=r*(n/2);break;case t.LINE_STRIP:e.lines+=r*(n-1);break;case t.LINE_LOOP:e.lines+=r*n;break;case t.POINTS:e.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function UA(t,e,n){const i=new WeakMap,r=new Zr;return{update:function(s,o,a){const l=s.morphTargetInfluences,c=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=void 0!==c?c.length:0;let u=i.get(o);if(void 0===u||u.count!==h){void 0!==u&&u.texture.dispose();const d=void 0!==o.morphAttributes.position,p=void 0!==o.morphAttributes.normal,A=void 0!==o.morphAttributes.color,f=o.morphAttributes.position||[],m=o.morphAttributes.normal||[],g=o.morphAttributes.color||[];let v=0;!0===d&&(v=1),!0===p&&(v=2),!0===A&&(v=3);let y=o.attributes.position.count*v,E=1;y>e.maxTextureSize&&(E=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const x=new Float32Array(y*E*4*h),b=new es(x,y,E,h);b.type=un,b.needsUpdate=!0;const C=4*v;for(let _=0;_<h;_++){const M=f[_],S=m[_],I=g[_],B=y*E*4*_;for(let T=0;T<M.count;T++){const R=T*C;!0===d&&(r.fromBufferAttribute(M,T),x[B+R+0]=r.x,x[B+R+1]=r.y,x[B+R+2]=r.z,x[B+R+3]=0),!0===p&&(r.fromBufferAttribute(S,T),x[B+R+4]=r.x,x[B+R+5]=r.y,x[B+R+6]=r.z,x[B+R+7]=0),!0===A&&(r.fromBufferAttribute(I,T),x[B+R+8]=r.x,x[B+R+9]=r.y,x[B+R+10]=r.z,x[B+R+11]=4===I.itemSize?r.w:1)}}function w(){b.dispose(),i.delete(o),o.removeEventListener("dispose",w)}u={count:h,texture:b,size:new Br(y,E)},i.set(o,u),o.addEventListener("dispose",w)}if(!0===s.isInstancedMesh&&null!==s.morphTexture)a.getUniforms().setValue(t,"morphTexture",s.morphTexture,n);else{let L=0;for(let P=0;P<l.length;P++)L+=l[P];const D=o.morphTargetsRelative?1:1-L;a.getUniforms().setValue(t,"morphTargetBaseInfluence",D),a.getUniforms().setValue(t,"morphTargetInfluences",l)}a.getUniforms().setValue(t,"morphTargetsTexture",u.texture,n),a.getUniforms().setValue(t,"morphTargetsTextureSize",u.size)}}}class OA{constructor(t,e,n){if(this.renderer=t,this.DEFAULT_NUMVIEWS=2,this.maxNumViews=0,this.gl=n,this.extensions=e,this.available=this.extensions.has("OCULUS_multiview"),this.available){const t=this.extensions.get("OCULUS_multiview");this.maxNumViews=this.gl.getParameter(t.MAX_VIEWS_OVR),this.mat4=[],this.mat3=[],this.cameraArray=[];for(var i=0;i<this.maxNumViews;i++)this.mat4[i]=new Os,this.mat3[i]=new Tr}}getCameraArray(t){return t.isArrayCamera?t.cameras:(this.cameraArray[0]=t,this.cameraArray)}updateCameraProjectionMatricesUniform(t,e){for(var n=this.getCameraArray(t),i=0;i<n.length;i++)this.mat4[i].copy(n[i].projectionMatrix);e.setValue(this.gl,"projectionMatrices",this.mat4)}updateCameraViewMatricesUniform(t,e){for(var n=this.getCameraArray(t),i=0;i<n.length;i++)this.mat4[i].copy(n[i].matrixWorldInverse);e.setValue(this.gl,"viewMatrices",this.mat4)}updateObjectMatricesUniforms(t,e,n){for(var i=this.getCameraArray(e),r=0;r<i.length;r++)this.mat4[r].multiplyMatrices(i[r].matrixWorldInverse,t.matrixWorld),this.mat3[r].getNormalMatrix(this.mat4[r]);n.setValue(this.gl,"modelViewMatrices",this.mat4),n.setValue(this.gl,"normalMatrices",this.mat3)}}function FA(t,e,n,i){let r=new WeakMap;function s(t){const e=t.target;e.removeEventListener("dispose",s),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(o){const a=i.render.frame,l=o.geometry,c=e.get(o,l);if(r.get(c)!==a&&(e.update(c),r.set(c,a)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",s)&&o.addEventListener("dispose",s),r.get(o)!==a&&(n.update(o.instanceMatrix,t.ARRAY_BUFFER),null!==o.instanceColor&&n.update(o.instanceColor,t.ARRAY_BUFFER),r.set(o,a))),o.isSkinnedMesh){const t=o.skeleton;r.get(t)!==a&&(t.update(),r.set(t,a))}return c},dispose:function(){r=new WeakMap}}}const kA=new Kr,NA=new Rc(1,1),QA=new es,GA=new is,zA=new La,HA=[],VA=[],jA=new Float32Array(16),WA=new Float32Array(9),qA=new Float32Array(4);function XA(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let s=HA[r];if(void 0===s&&(s=new Float32Array(r),HA[r]=s),0!==e){i.toArray(s,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(s,r)}return s}function YA(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function JA(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function KA(t,e){let n=VA[e];void 0===n&&(n=new Int32Array(e),VA[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function ZA(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function $A(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(YA(n,e))return;t.uniform2fv(this.addr,e),JA(n,e)}}function tf(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(YA(n,e))return;t.uniform3fv(this.addr,e),JA(n,e)}}function ef(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(YA(n,e))return;t.uniform4fv(this.addr,e),JA(n,e)}}function nf(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(YA(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),JA(n,e)}else{if(YA(n,i))return;qA.set(i),t.uniformMatrix2fv(this.addr,!1,qA),JA(n,i)}}function rf(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(YA(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),JA(n,e)}else{if(YA(n,i))return;WA.set(i),t.uniformMatrix3fv(this.addr,!1,WA),JA(n,i)}}function sf(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(YA(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),JA(n,e)}else{if(YA(n,i))return;jA.set(i),t.uniformMatrix4fv(this.addr,!1,jA),JA(n,i)}}function of(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function af(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(YA(n,e))return;t.uniform2iv(this.addr,e),JA(n,e)}}function lf(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(YA(n,e))return;t.uniform3iv(this.addr,e),JA(n,e)}}function cf(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(YA(n,e))return;t.uniform4iv(this.addr,e),JA(n,e)}}function hf(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function uf(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(YA(n,e))return;t.uniform2uiv(this.addr,e),JA(n,e)}}function df(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(YA(n,e))return;t.uniform3uiv(this.addr,e),JA(n,e)}}function pf(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(YA(n,e))return;t.uniform4uiv(this.addr,e),JA(n,e)}}function Af(t,e,n){const i=this.cache,r=n.allocateTextureUnit();let s;i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),this.type===t.SAMPLER_2D_SHADOW?(NA.compareFunction=Zi,s=NA):s=kA,n.setTexture2D(e||s,r)}function ff(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||GA,r)}function mf(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||zA,r)}function gf(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||QA,r)}function vf(t,e){t.uniform1fv(this.addr,e)}function yf(t,e){const n=XA(e,this.size,2);t.uniform2fv(this.addr,n)}function Ef(t,e){const n=XA(e,this.size,3);t.uniform3fv(this.addr,n)}function xf(t,e){const n=XA(e,this.size,4);t.uniform4fv(this.addr,n)}function bf(t,e){const n=XA(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Cf(t,e){const n=XA(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function wf(t,e){const n=XA(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function _f(t,e){t.uniform1iv(this.addr,e)}function Mf(t,e){t.uniform2iv(this.addr,e)}function Sf(t,e){t.uniform3iv(this.addr,e)}function If(t,e){t.uniform4iv(this.addr,e)}function Bf(t,e){t.uniform1uiv(this.addr,e)}function Tf(t,e){t.uniform2uiv(this.addr,e)}function Rf(t,e){t.uniform3uiv(this.addr,e)}function Lf(t,e){t.uniform4uiv(this.addr,e)}function Df(t,e,n){const i=this.cache,r=e.length,s=KA(n,r);YA(i,s)||(t.uniform1iv(this.addr,s),JA(i,s));for(let t=0;t!==r;++t)n.setTexture2D(e[t]||kA,s[t])}function Pf(t,e,n){const i=this.cache,r=e.length,s=KA(n,r);YA(i,s)||(t.uniform1iv(this.addr,s),JA(i,s));for(let t=0;t!==r;++t)n.setTexture3D(e[t]||GA,s[t])}function Uf(t,e,n){const i=this.cache,r=e.length,s=KA(n,r);YA(i,s)||(t.uniform1iv(this.addr,s),JA(i,s));for(let t=0;t!==r;++t)n.setTextureCube(e[t]||zA,s[t])}function Of(t,e,n){const i=this.cache,r=e.length,s=KA(n,r);YA(i,s)||(t.uniform1iv(this.addr,s),JA(i,s));for(let t=0;t!==r;++t)n.setTexture2DArray(e[t]||QA,s[t])}class Ff{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=function(t){switch(t){case 5126:return ZA;case 35664:return $A;case 35665:return tf;case 35666:return ef;case 35674:return nf;case 35675:return rf;case 35676:return sf;case 5124:case 35670:return of;case 35667:case 35671:return af;case 35668:case 35672:return lf;case 35669:case 35673:return cf;case 5125:return hf;case 36294:return uf;case 36295:return df;case 36296:return pf;case 35678:case 36198:case 36298:case 36306:case 35682:return Af;case 35679:case 36299:case 36307:return ff;case 35680:case 36300:case 36308:case 36293:return mf;case 36289:case 36303:case 36311:case 36292:return gf}}(e.type)}}class kf{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return vf;case 35664:return yf;case 35665:return Ef;case 35666:return xf;case 35674:return bf;case 35675:return Cf;case 35676:return wf;case 5124:case 35670:return _f;case 35667:case 35671:return Mf;case 35668:case 35672:return Sf;case 35669:case 35673:return If;case 5125:return Bf;case 36294:return Tf;case 36295:return Rf;case 36296:return Lf;case 35678:case 36198:case 36298:case 36306:case 35682:return Df;case 35679:case 36299:case 36307:return Pf;case 35680:case 36300:case 36308:case 36293:return Uf;case 36289:case 36303:case 36311:case 36292:return Of}}(e.type)}}class Nf{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){const i=this.seq;for(let r=0,s=i.length;r!==s;++r){const s=i[r];s.setValue(t,e[s.id],n)}}}const Qf=/(\w+)(\])?(\[|\.)?/g;function Gf(t,e){t.seq.push(e),t.map[e.id]=e}function zf(t,e,n){const i=t.name,r=i.length;for(Qf.lastIndex=0;;){const s=Qf.exec(i),o=Qf.lastIndex;let a=s[1];const l="]"===s[2],c=s[3];if(l&&(a|=0),void 0===c||"["===c&&o+2===r){Gf(n,void 0===c?new Ff(a,t,e):new kf(a,t,e));break}{let t=n.map[a];void 0===t&&(t=new Nf(a),Gf(n,t)),n=t}}}class Hf{constructor(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=t.getActiveUniform(e,i);zf(n,t.getUniformLocation(e,n.name),this)}}setValue(t,e,n,i){const r=this.map[e];void 0!==r&&r.setValue(t,n,i)}setOptional(t,e,n){const i=e[n];void 0!==i&&this.setValue(t,n,i)}static upload(t,e,n,i){for(let r=0,s=e.length;r!==s;++r){const s=e[r],o=n[s.id];!1!==o.needsUpdate&&s.setValue(t,o.value,i)}}static seqWithValue(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const r=t[i];r.id in e&&n.push(r)}return n}}function Vf(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}let jf=0;const Wf=new Tr;function qf(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();if(i&&""===r)return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const i=parseInt(s[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(t,e){const n=t.split("\n"),i=[],r=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let t=r;t<s;t++){const r=t+1;i.push(`${r===e?">":" "} ${r}: ${n[t]}`)}return i.join("\n")}(t.getShaderSource(e),i)}return r}function Xf(t,e){const n=function(t){zr._getMatrix(Wf,zr.workingColorSpace,t);const e=`mat3( ${Wf.elements.map((t=>t.toFixed(4)))} )`;switch(zr.getTransfer(t)){case Ri:return[e,"LinearTransferOETF"];case Li:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}(e);return[`vec4 ${t}( vec4 value ) {`,`\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join("\n")}function Yf(t,e){let n;switch(e){case Te:n="Linear";break;case Re:n="Reinhard";break;case Le:n="Cineon";break;case De:n="ACESFilmic";break;case Ue:n="AgX";break;case Oe:n="Neutral";break;case Pe:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const Jf=new os;function Kf(t){return""!==t}function Zf(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function $f(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const tm=/^[ \t]*#include +<([\w\d./]+)>/gm;function em(t){return t.replace(tm,im)}const nm=new Map;function im(t,e){let n=iA[e];if(void 0===n){const t=nm.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");n=iA[t],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,t)}return em(n)}const rm=/#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 sm(t){return t.replace(rm,om)}function om(t,e,n,i){let r="";for(let t=parseInt(e);t<parseInt(n);t++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function am(t){let e=`precision ${t.precision} float;\n\tprecision ${t.precision} int;\n\tprecision ${t.precision} sampler2D;\n\tprecision ${t.precision} samplerCube;\n\tprecision ${t.precision} sampler3D;\n\tprecision ${t.precision} sampler2DArray;\n\tprecision ${t.precision} sampler2DShadow;\n\tprecision ${t.precision} samplerCubeShadow;\n\tprecision ${t.precision} sampler2DArrayShadow;\n\tprecision ${t.precision} isampler2D;\n\tprecision ${t.precision} isampler3D;\n\tprecision ${t.precision} isamplerCube;\n\tprecision ${t.precision} isampler2DArray;\n\tprecision ${t.precision} usampler2D;\n\tprecision ${t.precision} usampler3D;\n\tprecision ${t.precision} usamplerCube;\n\tprecision ${t.precision} usampler2DArray;\n\t`;return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function lm(t,e,n,i){const r=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===Qt?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===Gt?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===zt&&(e="SHADOWMAP_TYPE_VSM"),e}(n),c=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Qe:case Ge:e="ENVMAP_TYPE_CUBE";break;case Ve:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),h=function(t){let e="ENVMAP_MODE_REFLECTION";return t.envMap&&t.envMapMode===Ge&&(e="ENVMAP_MODE_REFRACTION"),e}(n),u=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case Me:e="ENVMAP_BLENDING_MULTIPLY";break;case Se:e="ENVMAP_BLENDING_MIX";break;case Ie:e="ENVMAP_BLENDING_ADD"}return e}(n),d=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),p=function(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Kf).join("\n")}(n),A=function(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(s),f=r.createProgram();let m,g,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";const y=n.numMultiviewViews;n.isRawShaderMaterial?(m=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A].filter(Kf).join("\n"),m.length>0&&(m+="\n"),g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A].filter(Kf).join("\n"),g.length>0&&(g+="\n")):(m=[am(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",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.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Kf).join("\n"),g=[am(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",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 "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",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.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Be?"#define TONE_MAPPING":"",n.toneMapping!==Be?iA.tonemapping_pars_fragment:"",n.toneMapping!==Be?Yf("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",iA.colorspace_pars_fragment,Xf("linearToOutputTexel",n.outputColorSpace),(zr.getLuminanceCoefficients(Jf),["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${Jf.x.toFixed(4)}, ${Jf.y.toFixed(4)}, ${Jf.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Kf).join("\n")),o=em(o),o=Zf(o,n),o=$f(o,n),a=em(a),a=Zf(a,n),a=$f(a,n),o=sm(o),a=sm(a),!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,g=["#define varying in",n.glslVersion===pr?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===pr?"":"#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"+g,y>0&&(m=["#extension GL_OVR_multiview : require","layout(num_views = "+y+") in;","#define VIEW_ID gl_ViewID_OVR"].join("\n")+"\n"+m,m=m.replace(["uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;"].join("\n"),["uniform mat4 modelViewMatrices["+y+"];","uniform mat4 projectionMatrices["+y+"];","uniform mat4 viewMatrices["+y+"];","uniform mat3 normalMatrices["+y+"];","#define modelViewMatrix modelViewMatrices[VIEW_ID]","#define projectionMatrix projectionMatrices[VIEW_ID]","#define viewMatrix viewMatrices[VIEW_ID]","#define normalMatrix normalMatrices[VIEW_ID]"].join("\n")),g=["#extension GL_OVR_multiview : require","#define VIEW_ID gl_ViewID_OVR"].join("\n")+"\n"+g,g=g.replace("uniform mat4 viewMatrix;",["uniform mat4 viewMatrices["+y+"];","#define viewMatrix viewMatrices[VIEW_ID]"].join("\n"))));const E=v+m+o,x=v+g+a,b=Vf(r,r.VERTEX_SHADER,E),C=Vf(r,r.FRAGMENT_SHADER,x);function w(e){if(t.debug.checkShaderErrors){const n=r.getProgramInfoLog(f).trim(),i=r.getShaderInfoLog(b).trim(),s=r.getShaderInfoLog(C).trim();let o=!0,a=!0;if(!1===r.getProgramParameter(f,r.LINK_STATUS))if(o=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(r,f,b,C);else{const t=qf(r,b,"vertex"),i=qf(r,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(f,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+e.name+"\nMaterial Type: "+e.type+"\n\nProgram Info Log: "+n+"\n"+t+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==s||(a=!1);a&&(e.diagnostics={runnable:o,programLog:n,vertexShader:{log:i,prefix:m},fragmentShader:{log:s,prefix:g}})}r.deleteShader(b),r.deleteShader(C),_=new Hf(r,f),M=function(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=t.getActiveAttrib(e,r),s=i.name;let o=1;i.type===t.FLOAT_MAT2&&(o=2),i.type===t.FLOAT_MAT3&&(o=3),i.type===t.FLOAT_MAT4&&(o=4),n[s]={type:i.type,location:t.getAttribLocation(e,s),locationSize:o}}return n}(r,f)}let _,M;r.attachShader(f,b),r.attachShader(f,C),void 0!==n.index0AttributeName?r.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(f,0,"position"),r.linkProgram(f),this.getUniforms=function(){return void 0===_&&w(this),_},this.getAttributes=function(){return void 0===M&&w(this),M};let S=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===S&&(S=r.getProgramParameter(f,37297)),S},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(f),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=jf++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=b,this.fragmentShader=C,this.numMultiviewViews=y,this}let cm=0;class hm{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),s=this._getShaderCacheForMaterial(t);return!1===s.has(i)&&(s.add(i),i.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return void 0===n&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return void 0===n&&(n=new um(t),e.set(t,n)),n}}class um{constructor(t){this.id=cm++,this.code=t,this.usedTimes=0}}function dm(t,e,n,i,r,s,o){const a=new qs,l=new hm,c=new Set,h=[],u=r.logarithmicDepthBuffer,d=r.vertexTextures;let p=r.precision;const A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function f(t){return c.add(t),0===t?"uv":`uv${t}`}return{getParameters:function(s,a,h,m,g){const v=m.fog,y=g.geometry,E=s.isMeshStandardMaterial?m.environment:null,x=(s.isMeshStandardMaterial?n:e).get(s.envMap||E),b=x&&x.mapping===Ve?x.image.height:null,C=A[s.type];null!==s.precision&&(p=r.getMaxPrecision(s.precision),p!==s.precision&&console.warn("THREE.WebGLProgram.getParameters:",s.precision,"not supported, using",p,"instead."));const w=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,_=void 0!==w?w.length:0;let M,S,I,B,T=0;if(void 0!==y.morphAttributes.position&&(T=1),void 0!==y.morphAttributes.normal&&(T=2),void 0!==y.morphAttributes.color&&(T=3),C){const t=sA[C];M=t.vertexShader,S=t.fragmentShader}else M=s.vertexShader,S=s.fragmentShader,l.update(s),I=l.getVertexShaderID(s),B=l.getFragmentShaderID(s);const R=t.getRenderTarget(),L=t.state.buffers.depth.getReversed(),D=R&&R.isWebGLMultiviewRenderTarget?R.numViews:0,P=!0===g.isInstancedMesh,U=!0===g.isBatchedMesh,O=!!s.map,F=!!s.matcap,k=!!x,N=!!s.aoMap,Q=!!s.lightMap,G=!!s.bumpMap,z=!!s.normalMap,H=!!s.displacementMap,V=!!s.emissiveMap,j=!!s.metalnessMap,W=!!s.roughnessMap,q=s.anisotropy>0,X=s.clearcoat>0,Y=s.dispersion>0,J=s.iridescence>0,K=s.sheen>0,Z=s.transmission>0,$=q&&!!s.anisotropyMap,tt=X&&!!s.clearcoatMap,et=X&&!!s.clearcoatNormalMap,nt=X&&!!s.clearcoatRoughnessMap,it=J&&!!s.iridescenceMap,rt=J&&!!s.iridescenceThicknessMap,st=K&&!!s.sheenColorMap,ot=K&&!!s.sheenRoughnessMap,at=!!s.specularMap,lt=!!s.specularColorMap,ct=!!s.specularIntensityMap,ht=Z&&!!s.transmissionMap,ut=Z&&!!s.thicknessMap,dt=!!s.gradientMap,pt=!!s.alphaMap,At=s.alphaTest>0,ft=!!s.alphaHash,mt=!!s.extensions;let gt=Be;s.toneMapped&&(null!==R&&!0!==R.isXRRenderTarget||(gt=t.toneMapping));const vt={shaderID:C,shaderType:s.type,shaderName:s.name,vertexShader:M,fragmentShader:S,defines:s.defines,customVertexShaderID:I,customFragmentShaderID:B,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,batching:U,batchingColor:U&&null!==g._colorsTexture,instancing:P,instancingColor:P&&null!==g.instanceColor,instancingMorph:P&&null!==g.morphTexture,supportsVertexTextures:d,numMultiviewViews:D,outputColorSpace:null===R?t.outputColorSpace:!0===R.isXRRenderTarget?R.texture.colorSpace:Ti,alphaToCoverage:!!s.alphaToCoverage,map:O,matcap:F,envMap:k,envMapMode:k&&x.mapping,envMapCubeUVHeight:b,aoMap:N,lightMap:Q,bumpMap:G,normalMap:z,displacementMap:d&&H,emissiveMap:V,normalMapObjectSpace:z&&s.normalMapType===Si,normalMapTangentSpace:z&&s.normalMapType===Mi,metalnessMap:j,roughnessMap:W,anisotropy:q,anisotropyMap:$,clearcoat:X,clearcoatMap:tt,clearcoatNormalMap:et,clearcoatRoughnessMap:nt,dispersion:Y,iridescence:J,iridescenceMap:it,iridescenceThicknessMap:rt,sheen:K,sheenColorMap:st,sheenRoughnessMap:ot,specularMap:at,specularColorMap:lt,specularIntensityMap:ct,transmission:Z,transmissionMap:ht,thicknessMap:ut,gradientMap:dt,opaque:!1===s.transparent&&s.blending===qt&&!1===s.alphaToCoverage,alphaMap:pt,alphaTest:At,alphaHash:ft,combine:s.combine,mapUv:O&&f(s.map.channel),aoMapUv:N&&f(s.aoMap.channel),lightMapUv:Q&&f(s.lightMap.channel),bumpMapUv:G&&f(s.bumpMap.channel),normalMapUv:z&&f(s.normalMap.channel),displacementMapUv:H&&f(s.displacementMap.channel),emissiveMapUv:V&&f(s.emissiveMap.channel),metalnessMapUv:j&&f(s.metalnessMap.channel),roughnessMapUv:W&&f(s.roughnessMap.channel),anisotropyMapUv:$&&f(s.anisotropyMap.channel),clearcoatMapUv:tt&&f(s.clearcoatMap.channel),clearcoatNormalMapUv:et&&f(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:nt&&f(s.clearcoatRoughnessMap.channel),iridescenceMapUv:it&&f(s.iridescenceMap.channel),iridescenceThicknessMapUv:rt&&f(s.iridescenceThicknessMap.channel),sheenColorMapUv:st&&f(s.sheenColorMap.channel),sheenRoughnessMapUv:ot&&f(s.sheenRoughnessMap.channel),specularMapUv:at&&f(s.specularMap.channel),specularColorMapUv:lt&&f(s.specularColorMap.channel),specularIntensityMapUv:ct&&f(s.specularIntensityMap.channel),transmissionMapUv:ht&&f(s.transmissionMap.channel),thicknessMapUv:ut&&f(s.thicknessMap.channel),alphaMapUv:pt&&f(s.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(z||q),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,pointsUvs:!0===g.isPoints&&!!y.attributes.uv&&(O||pt),fog:!!v,useFog:!0===s.fog,fogExp2:!!v&&v.isFogExp2,flatShading:!0===s.flatShading,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:u,reverseDepthBuffer:L,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:_,morphTextureStride:T,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numSpotLightMaps:a.spotLightMap.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numSpotLightShadowsWithMaps:a.numSpotLightShadowsWithMaps,numLightProbes:a.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:gt,decodeVideoTexture:O&&!0===s.map.isVideoTexture&&zr.getTransfer(s.map.colorSpace)===Li,decodeVideoTextureEmissive:V&&!0===s.emissiveMap.isVideoTexture&&zr.getTransfer(s.emissiveMap.colorSpace)===Li,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===jt,flipSided:s.side===Vt,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionClipCullDistance:mt&&!0===s.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(mt&&!0===s.extensions.multiDraw||U)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:s.customProgramCacheKey()};return vt.vertexUv1s=c.has(1),vt.vertexUv2s=c.has(2),vt.vertexUv3s=c.has(3),c.clear(),vt},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(n,e),function(t,e){a.disableAll(),e.supportsVertexTextures&&a.enable(0),e.instancing&&a.enable(1),e.instancingColor&&a.enable(2),e.instancingMorph&&a.enable(3),e.matcap&&a.enable(4),e.envMap&&a.enable(5),e.normalMapObjectSpace&&a.enable(6),e.normalMapTangentSpace&&a.enable(7),e.clearcoat&&a.enable(8),e.iridescence&&a.enable(9),e.alphaTest&&a.enable(10),e.vertexColors&&a.enable(11),e.vertexAlphas&&a.enable(12),e.vertexUv1s&&a.enable(13),e.vertexUv2s&&a.enable(14),e.vertexUv3s&&a.enable(15),e.vertexTangents&&a.enable(16),e.anisotropy&&a.enable(17),e.alphaHash&&a.enable(18),e.batching&&a.enable(19),e.dispersion&&a.enable(20),e.batchingColor&&a.enable(21),t.push(a.mask),a.disableAll(),e.fog&&a.enable(0),e.useFog&&a.enable(1),e.flatShading&&a.enable(2),e.logarithmicDepthBuffer&&a.enable(3),e.reverseDepthBuffer&&a.enable(4),e.skinning&&a.enable(5),e.morphTargets&&a.enable(6),e.morphNormals&&a.enable(7),e.morphColors&&a.enable(8),e.premultipliedAlpha&&a.enable(9),e.shadowMapEnabled&&a.enable(10),e.doubleSided&&a.enable(11),e.flipSided&&a.enable(12),e.useDepthPacking&&a.enable(13),e.dithering&&a.enable(14),e.transmission&&a.enable(15),e.sheen&&a.enable(16),e.opaque&&a.enable(17),e.pointsUvs&&a.enable(18),e.decodeVideoTexture&&a.enable(19),e.decodeVideoTextureEmissive&&a.enable(20),e.alphaToCoverage&&a.enable(21),e.numMultiviewViews&&a.enable(21),t.push(a.mask)}(n,e),n.push(t.outputColorSpace)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=A[t.type];let n;if(e){const t=sA[e];n=Ca.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=h.length;t<e;t++){const e=h[t];if(e.cacheKey===n){i=e,++i.usedTimes;break}}return void 0===i&&(i=new lm(t,n,e,s),h.push(i)),i},releaseProgram:function(t){if(0==--t.usedTimes){const e=h.indexOf(t);h[e]=h[h.length-1],h.pop(),t.destroy()}},releaseShaderCache:function(t){l.remove(t)},programs:h,dispose:function(){l.dispose()}}}function pm(){let t=new WeakMap;return{has:function(e){return t.has(e)},get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function Am(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function fm(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function mm(){const t=[];let e=0;const n=[],i=[],r=[];function s(n,i,r,s,o,a){let l=t[e];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:s,renderOrder:n.renderOrder,z:o,group:a},t[e]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=s,l.renderOrder=n.renderOrder,l.z=o,l.group=a),e++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){e=0,n.length=0,i.length=0,r.length=0},push:function(t,e,o,a,l,c){const h=s(t,e,o,a,l,c);o.transmission>0?i.push(h):!0===o.transparent?r.push(h):n.push(h)},unshift:function(t,e,o,a,l,c){const h=s(t,e,o,a,l,c);o.transmission>0?i.unshift(h):!0===o.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=e,i=t.length;n<i;n++){const e=t[n];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){n.length>1&&n.sort(t||Am),i.length>1&&i.sort(e||fm),r.length>1&&r.sort(e||fm)}}}function gm(){let t=new WeakMap;return{get:function(e,n){const i=t.get(e);let r;return void 0===i?(r=new mm,t.set(e,[r])):n>=i.length?(r=new mm,i.push(r)):r=i[n],r},dispose:function(){t=new WeakMap}}}function vm(){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 os,color:new Bo};break;case"SpotLight":n={position:new os,direction:new os,color:new Bo,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new os,color:new Bo,distance:0,decay:0};break;case"HemisphereLight":n={direction:new os,skyColor:new Bo,groundColor:new Bo};break;case"RectAreaLight":n={color:new Bo,position:new os,halfWidth:new os,halfHeight:new os}}return t[e.id]=n,n}}}let ym=0;function Em(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function xm(t){const e=new vm,n=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={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Br};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Br,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)i.probe.push(new os);const r=new os,s=new Os,o=new Os;return{setup:function(r){let s=0,o=0,a=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let l=0,c=0,h=0,u=0,d=0,p=0,A=0,f=0,m=0,g=0,v=0;r.sort(Em);for(let t=0,y=r.length;t<y;t++){const y=r[t],E=y.color,x=y.intensity,b=y.distance,C=y.shadow&&y.shadow.map?y.shadow.map.texture:null;if(y.isAmbientLight)s+=E.r*x,o+=E.g*x,a+=E.b*x;else if(y.isLightProbe){for(let t=0;t<9;t++)i.probe[t].addScaledVector(y.sh.coefficients[t],x);v++}else if(y.isDirectionalLight){const t=e.get(y);if(t.color.copy(y.color).multiplyScalar(y.intensity),y.castShadow){const t=y.shadow,e=n.get(y);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,i.directionalShadow[l]=e,i.directionalShadowMap[l]=C,i.directionalShadowMatrix[l]=y.shadow.matrix,p++}i.directional[l]=t,l++}else if(y.isSpotLight){const t=e.get(y);t.position.setFromMatrixPosition(y.matrixWorld),t.color.copy(E).multiplyScalar(x),t.distance=b,t.coneCos=Math.cos(y.angle),t.penumbraCos=Math.cos(y.angle*(1-y.penumbra)),t.decay=y.decay,i.spot[h]=t;const r=y.shadow;if(y.map&&(i.spotLightMap[m]=y.map,m++,r.updateMatrices(y),y.castShadow&&g++),i.spotLightMatrix[h]=r.matrix,y.castShadow){const t=n.get(y);t.shadowIntensity=r.intensity,t.shadowBias=r.bias,t.shadowNormalBias=r.normalBias,t.shadowRadius=r.radius,t.shadowMapSize=r.mapSize,i.spotShadow[h]=t,i.spotShadowMap[h]=C,f++}h++}else if(y.isRectAreaLight){const t=e.get(y);t.color.copy(E).multiplyScalar(x),t.halfWidth.set(.5*y.width,0,0),t.halfHeight.set(0,.5*y.height,0),i.rectArea[u]=t,u++}else if(y.isPointLight){const t=e.get(y);if(t.color.copy(y.color).multiplyScalar(y.intensity),t.distance=y.distance,t.decay=y.decay,y.castShadow){const t=y.shadow,e=n.get(y);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,e.shadowCameraNear=t.camera.near,e.shadowCameraFar=t.camera.far,i.pointShadow[c]=e,i.pointShadowMap[c]=C,i.pointShadowMatrix[c]=y.shadow.matrix,A++}i.point[c]=t,c++}else if(y.isHemisphereLight){const t=e.get(y);t.skyColor.copy(y.color).multiplyScalar(x),t.groundColor.copy(y.groundColor).multiplyScalar(x),i.hemi[d]=t,d++}}u>0&&(!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=rA.LTC_FLOAT_1,i.rectAreaLTC2=rA.LTC_FLOAT_2):(i.rectAreaLTC1=rA.LTC_HALF_1,i.rectAreaLTC2=rA.LTC_HALF_2)),i.ambient[0]=s,i.ambient[1]=o,i.ambient[2]=a;const y=i.hash;y.directionalLength===l&&y.pointLength===c&&y.spotLength===h&&y.rectAreaLength===u&&y.hemiLength===d&&y.numDirectionalShadows===p&&y.numPointShadows===A&&y.numSpotShadows===f&&y.numSpotMaps===m&&y.numLightProbes===v||(i.directional.length=l,i.spot.length=h,i.rectArea.length=u,i.point.length=c,i.hemi.length=d,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=A,i.pointShadowMap.length=A,i.spotShadow.length=f,i.spotShadowMap.length=f,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=A,i.spotLightMatrix.length=f+m-g,i.spotLightMap.length=m,i.numSpotLightShadowsWithMaps=g,i.numLightProbes=v,y.directionalLength=l,y.pointLength=c,y.spotLength=h,y.rectAreaLength=u,y.hemiLength=d,y.numDirectionalShadows=p,y.numPointShadows=A,y.numSpotShadows=f,y.numSpotMaps=m,y.numLightProbes=v,i.version=ym++)},setupView:function(t,e){let n=0,a=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=i.directional[n];t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(u),n++}else if(d.isSpotLight){const t=i.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(u),l++}else if(d.isRectAreaLight){const t=i.rectArea[c];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),o.identity(),s.copy(d.matrixWorld),s.premultiply(u),o.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(o),t.halfHeight.applyMatrix4(o),c++}else if(d.isPointLight){const t=i.point[a];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),a++}else if(d.isHemisphereLight){const t=i.hemi[h];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(u),h++}}},state:i}}function bm(t){const e=new xm(t),n=[],i=[],r={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:function(t){r.camera=t,n.length=0,i.length=0},state:r,setupLights:function(){e.setup(n)},setupLightsView:function(t){e.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){i.push(t)}}}function Cm(t){let e=new WeakMap;return{get:function(n,i=0){const r=e.get(n);let s;return void 0===r?(s=new bm(t),e.set(n,[s])):i>=r.length?(s=new bm(t),r.push(s)):s=r[i],s},dispose:function(){e=new WeakMap}}}function wm(t,e,n){let i=new kl;const r=new Br,s=new Br,o=new Zr,a=new cu({depthPacking:Ci}),l=new hu,c={},h=n.maxTextureSize,u={[Ht]:Vt,[Vt]:Ht,[jt]:jt},d=new wa({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Br},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const A=new sa;A.setAttribute("position",new zo(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const f=new ga(A,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Qt;let g=this.type;function v(n,i){const s=e.update(f);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new ts(r.x,r.y)),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,s,d,f,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,s,p,f,null)}function y(e,n,i,r){let s=null;const o=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==o)s=o;else if(s=!0===i.isPointLight?l:a,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const t=s.uuid,e=n.uuid;let i=c[t];void 0===i&&(i={},c[t]=i);let r=i[e];void 0===r&&(r=s.clone(),i[e]=r,n.addEventListener("dispose",x)),s=r}return s.visible=n.visible,s.wireframe=n.wireframe,s.side=r===zt?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:u[n.side],s.alphaMap=n.alphaMap,s.alphaTest=n.alphaTest,s.map=n.map,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.displacementMap=n.displacementMap,s.displacementScale=n.displacementScale,s.displacementBias=n.displacementBias,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===i.isPointLight&&!0===s.isMeshDistanceMaterial&&(t.properties.get(s).light=i),s}function E(n,r,s,o,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===zt)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=e.update(n),l=n.material;if(Array.isArray(l)){const e=i.groups;for(let c=0,h=e.length;c<h;c++){const h=e[c],u=l[h.materialIndex];if(u&&u.visible){const e=y(n,u,o,a);n.onBeforeShadow(t,n,r,s,i,e,h),t.renderBufferDirect(s,null,i,e,n,h),n.onAfterShadow(t,n,r,s,i,e,h)}}}else if(l.visible){const e=y(n,l,o,a);n.onBeforeShadow(t,n,r,s,i,e,null),t.renderBufferDirect(s,null,i,e,n,null),n.onAfterShadow(t,n,r,s,i,e,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)E(l[t],r,s,o,a)}function x(t){t.target.removeEventListener("dispose",x);for(const e in c){const n=c[e],i=t.target.uuid;i in n&&(n[i].dispose(),delete n[i])}}this.render=function(e,n,a){if(!1===m.enabled)return;if(!1===m.autoUpdate&&!1===m.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),c=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),d=t.state;d.setBlending(Wt),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);const p=g!==zt&&this.type===zt,A=g===zt&&this.type!==zt;for(let l=0,c=e.length;l<c;l++){const c=e[l],u=c.shadow;if(void 0===u){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;r.copy(u.mapSize);const f=u.getFrameExtents();if(r.multiply(f),s.copy(u.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/f.x),r.x=s.x*f.x,u.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/f.y),r.y=s.y*f.y,u.mapSize.y=s.y)),null===u.map||!0===p||!0===A){const t=this.type!==zt?{minFilter:Xe,magFilter:Xe}:{};null!==u.map&&u.map.dispose(),u.map=new ts(r.x,r.y,t),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const m=u.getViewportCount();for(let t=0;t<m;t++){const e=u.getViewport(t);o.set(s.x*e.x,s.y*e.y,s.x*e.z,s.y*e.w),d.viewport(o),u.updateMatrices(c,t),i=u.getFrustum(),E(n,a,u.camera,c,this.type)}!0!==u.isPointLightShadow&&this.type===zt&&v(u,a),u.needsUpdate=!1}g=this.type,m.needsUpdate=!1,t.setRenderTarget(l,c,u)}}const _m={[ve]:ye,[Ee]:we,[be]:_e,[xe]:Ce,[ye]:ve,[we]:Ee,[_e]:be,[Ce]:xe};function Mm(t,e){const n=new function(){let e=!1;const n=new Zr;let i=null;const r=new Zr(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,s,o,a){!0===a&&(e*=o,i*=o,s*=o),n.set(e,i,s,o),!1===r.equals(n)&&(t.clearColor(e,i,s,o),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},i=new function(){let n=!1,i=!1,r=null,s=null,o=null;return{setReversed:function(t){if(i!==t){const t=e.get("EXT_clip_control");i?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT);const n=o;o=null,this.setClear(n)}i=t},getReversed:function(){return i},setTest:function(e){e?Q(t.DEPTH_TEST):G(t.DEPTH_TEST)},setMask:function(e){r===e||n||(t.depthMask(e),r=e)},setFunc:function(e){if(i&&(e=_m[e]),s!==e){switch(e){case ve:t.depthFunc(t.NEVER);break;case ye:t.depthFunc(t.ALWAYS);break;case Ee:t.depthFunc(t.LESS);break;case xe:t.depthFunc(t.LEQUAL);break;case be:t.depthFunc(t.EQUAL);break;case Ce:t.depthFunc(t.GEQUAL);break;case we:t.depthFunc(t.GREATER);break;case _e:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}s=e}},setLocked:function(t){n=t},setClear:function(e){o!==e&&(i&&(e=1-e),t.clearDepth(e),o=e)},reset:function(){n=!1,r=null,s=null,o=null,i=!1}}},r=new function(){let e=!1,n=null,i=null,r=null,s=null,o=null,a=null,l=null,c=null;return{setTest:function(n){e||(n?Q(t.STENCIL_TEST):G(t.STENCIL_TEST))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,o){i===e&&r===n&&s===o||(t.stencilFunc(e,n,o),i=e,r=n,s=o)},setOp:function(e,n,i){o===e&&a===n&&l===i||(t.stencilOp(e,n,i),o=e,a=n,l=i)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,i=null,r=null,s=null,o=null,a=null,l=null,c=null}}},s=new WeakMap,o=new WeakMap;let a={},l={},c=new WeakMap,h=[],u=null,d=!1,p=null,A=null,f=null,m=null,g=null,v=null,y=null,E=new Bo(0,0,0),x=0,b=!1,C=null,w=null,_=null,M=null,S=null;const I=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let B=!1,T=0;const R=t.getParameter(t.VERSION);-1!==R.indexOf("WebGL")?(T=parseFloat(/^WebGL (\d)/.exec(R)[1]),B=T>=1):-1!==R.indexOf("OpenGL ES")&&(T=parseFloat(/^OpenGL ES (\d)/.exec(R)[1]),B=T>=2);let L=null,D={};const P=t.getParameter(t.SCISSOR_BOX),U=t.getParameter(t.VIEWPORT),O=(new Zr).fromArray(P),F=(new Zr).fromArray(U);function k(e,n,i,r){const s=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let o=0;o<i;o++)e===t.TEXTURE_3D||e===t.TEXTURE_2D_ARRAY?t.texImage3D(n,0,t.RGBA,1,1,r,0,t.RGBA,t.UNSIGNED_BYTE,s):t.texImage2D(n+o,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,s);return o}const N={};function Q(e){!0!==a[e]&&(t.enable(e),a[e]=!0)}function G(e){!1!==a[e]&&(t.disable(e),a[e]=!1)}N[t.TEXTURE_2D]=k(t.TEXTURE_2D,t.TEXTURE_2D,1),N[t.TEXTURE_CUBE_MAP]=k(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),N[t.TEXTURE_2D_ARRAY]=k(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),N[t.TEXTURE_3D]=k(t.TEXTURE_3D,t.TEXTURE_3D,1,1),n.setClear(0,0,0,1),i.setClear(1),r.setClear(0),Q(t.DEPTH_TEST),i.setFunc(xe),j(!1),W(Ot),Q(t.CULL_FACE),V(Wt);const z={[Zt]:t.FUNC_ADD,[$t]:t.FUNC_SUBTRACT,[te]:t.FUNC_REVERSE_SUBTRACT};z[ee]=t.MIN,z[ne]=t.MAX;const H={[ie]:t.ZERO,[re]:t.ONE,[se]:t.SRC_COLOR,[ae]:t.SRC_ALPHA,[pe]:t.SRC_ALPHA_SATURATE,[ue]:t.DST_COLOR,[ce]:t.DST_ALPHA,[oe]:t.ONE_MINUS_SRC_COLOR,[le]:t.ONE_MINUS_SRC_ALPHA,[de]:t.ONE_MINUS_DST_COLOR,[he]:t.ONE_MINUS_DST_ALPHA,[Ae]:t.CONSTANT_COLOR,[fe]:t.ONE_MINUS_CONSTANT_COLOR,[me]:t.CONSTANT_ALPHA,[ge]:t.ONE_MINUS_CONSTANT_ALPHA};function V(e,n,i,r,s,o,a,l,c,h){if(e!==Wt){if(!1===d&&(Q(t.BLEND),d=!0),e===Kt)s=s||n,o=o||i,a=a||r,n===A&&s===g||(t.blendEquationSeparate(z[n],z[s]),A=n,g=s),i===f&&r===m&&o===v&&a===y||(t.blendFuncSeparate(H[i],H[r],H[o],H[a]),f=i,m=r,v=o,y=a),!1!==l.equals(E)&&c===x||(t.blendColor(l.r,l.g,l.b,c),E.copy(l),x=c),p=e,b=!1;else if(e!==p||h!==b){if(A===Zt&&g===Zt||(t.blendEquation(t.FUNC_ADD),A=Zt,g=Zt),h)switch(e){case qt:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Xt:t.blendFunc(t.ONE,t.ONE);break;case Yt:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Jt:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case qt:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Xt:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case Yt:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Jt:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}f=null,m=null,v=null,y=null,E.set(0,0,0),x=0,p=e,b=h}}else!0===d&&(G(t.BLEND),d=!1)}function j(e){C!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),C=e)}function W(e){e!==Ut?(Q(t.CULL_FACE),e!==w&&(e===Ot?t.cullFace(t.BACK):e===Ft?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):G(t.CULL_FACE),w=e}function q(e,n,i){e?(Q(t.POLYGON_OFFSET_FILL),M===n&&S===i||(t.polygonOffset(n,i),M=n,S=i)):G(t.POLYGON_OFFSET_FILL)}return{buffers:{color:n,depth:i,stencil:r},enable:Q,disable:G,bindFramebuffer:function(e,n){return l[e]!==n&&(t.bindFramebuffer(e,n),l[e]=n,e===t.DRAW_FRAMEBUFFER&&(l[t.FRAMEBUFFER]=n),e===t.FRAMEBUFFER&&(l[t.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(e,n){let i=h,r=!1;if(e){i=c.get(n),void 0===i&&(i=[],c.set(n,i));const s=e.textures;if(i.length!==s.length||i[0]!==t.COLOR_ATTACHMENT0){for(let e=0,n=s.length;e<n;e++)i[e]=t.COLOR_ATTACHMENT0+e;i.length=s.length,r=!0}}else i[0]!==t.BACK&&(i[0]=t.BACK,r=!0);r&&t.drawBuffers(i)},useProgram:function(e){return u!==e&&(t.useProgram(e),u=e,!0)},setBlending:V,setMaterial:function(e,s){e.side===jt?G(t.CULL_FACE):Q(t.CULL_FACE);let o=e.side===Vt;s&&(o=!o),j(o),e.blending===qt&&!1===e.transparent?V(Wt):V(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.blendColor,e.blendAlpha,e.premultipliedAlpha),i.setFunc(e.depthFunc),i.setTest(e.depthTest),i.setMask(e.depthWrite),n.setMask(e.colorWrite);const a=e.stencilWrite;r.setTest(a),a&&(r.setMask(e.stencilWriteMask),r.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),r.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),q(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?Q(t.SAMPLE_ALPHA_TO_COVERAGE):G(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:j,setCullFace:W,setLineWidth:function(e){e!==_&&(B&&t.lineWidth(e),_=e)},setPolygonOffset:q,setScissorTest:function(e){e?Q(t.SCISSOR_TEST):G(t.SCISSOR_TEST)},activeTexture:function(e){void 0===e&&(e=t.TEXTURE0+I-1),L!==e&&(t.activeTexture(e),L=e)},bindTexture:function(e,n,i){void 0===i&&(i=null===L?t.TEXTURE0+I-1:L);let r=D[i];void 0===r&&(r={type:void 0,texture:void 0},D[i]=r),r.type===e&&r.texture===n||(L!==i&&(t.activeTexture(i),L=i),t.bindTexture(e,n||N[e]),r.type=e,r.texture=n)},unbindTexture:function(){const e=D[L];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexImage3D:function(){try{t.compressedTexImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},updateUBOMapping:function(e,n){let i=o.get(n);void 0===i&&(i=new WeakMap,o.set(n,i));let r=i.get(e);void 0===r&&(r=t.getUniformBlockIndex(n,e.name),i.set(e,r))},uniformBlockBinding:function(e,n){const i=o.get(n).get(e);s.get(n)!==i&&(t.uniformBlockBinding(n,i,e.__bindingPointIndex),s.set(n,i))},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===O.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),O.copy(e))},viewport:function(e){!1===F.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),F.copy(e))},reset:function(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),i.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),a={},L=null,D={},l={},c=new WeakMap,h=[],u=null,d=!1,p=null,A=null,f=null,m=null,g=null,v=null,y=null,E=new Bo(0,0,0),x=0,b=!1,C=null,w=null,_=null,M=null,S=null,O.set(0,0,t.canvas.width,t.canvas.height),F.set(0,0,t.canvas.width,t.canvas.height),n.reset(),i.reset(),r.reset()}}}function Sm(t,e,n,i,r,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=e.has("OCULUS_multiview")?e.get("OCULUS_multiview"):null,h=new Br,u=new WeakMap;let d;const p=new WeakMap;let A=[],f=!1,m=!1;try{m="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function g(t,e){return m?new OffscreenCanvas(t,e):Ur("canvas")}function v(t,e,n){let i=1;const r=W(t);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&t instanceof VideoFrame){const n=Math.floor(i*r.width),s=Math.floor(i*r.height);void 0===d&&(d=g(n,s));const o=e?g(n,s):d;return o.width=n,o.height=s,o.getContext("2d").drawImage(t,0,0,n,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+s+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),t}return t}function y(t){return t.generateMipmaps}function E(e){t.generateMipmap(e)}function x(e){return e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:e.isWebGL3DRenderTarget?t.TEXTURE_3D:e.isWebGLArrayRenderTarget||e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function b(n,i,r,s,o=!1){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 a=i;if(i===t.RED&&(r===t.FLOAT&&(a=t.R32F),r===t.HALF_FLOAT&&(a=t.R16F),r===t.UNSIGNED_BYTE&&(a=t.R8)),i===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(a=t.R8UI),r===t.UNSIGNED_SHORT&&(a=t.R16UI),r===t.UNSIGNED_INT&&(a=t.R32UI),r===t.BYTE&&(a=t.R8I),r===t.SHORT&&(a=t.R16I),r===t.INT&&(a=t.R32I)),i===t.RG&&(r===t.FLOAT&&(a=t.RG32F),r===t.HALF_FLOAT&&(a=t.RG16F),r===t.UNSIGNED_BYTE&&(a=t.RG8)),i===t.RG_INTEGER&&(r===t.UNSIGNED_BYTE&&(a=t.RG8UI),r===t.UNSIGNED_SHORT&&(a=t.RG16UI),r===t.UNSIGNED_INT&&(a=t.RG32UI),r===t.BYTE&&(a=t.RG8I),r===t.SHORT&&(a=t.RG16I),r===t.INT&&(a=t.RG32I)),i===t.RGB_INTEGER&&(r===t.UNSIGNED_BYTE&&(a=t.RGB8UI),r===t.UNSIGNED_SHORT&&(a=t.RGB16UI),r===t.UNSIGNED_INT&&(a=t.RGB32UI),r===t.BYTE&&(a=t.RGB8I),r===t.SHORT&&(a=t.RGB16I),r===t.INT&&(a=t.RGB32I)),i===t.RGBA_INTEGER&&(r===t.UNSIGNED_BYTE&&(a=t.RGBA8UI),r===t.UNSIGNED_SHORT&&(a=t.RGBA16UI),r===t.UNSIGNED_INT&&(a=t.RGBA32UI),r===t.BYTE&&(a=t.RGBA8I),r===t.SHORT&&(a=t.RGBA16I),r===t.INT&&(a=t.RGBA32I)),i===t.RGB&&r===t.UNSIGNED_INT_5_9_9_9_REV&&(a=t.RGB9_E5),i===t.RGBA){const e=o?Ri:zr.getTransfer(s);r===t.FLOAT&&(a=t.RGBA32F),r===t.HALF_FLOAT&&(a=t.RGBA16F),r===t.UNSIGNED_BYTE&&(a=e===Li?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(a=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(a=t.RGB5_A1)}return a!==t.R16F&&a!==t.R32F&&a!==t.RG16F&&a!==t.RG32F&&a!==t.RGBA16F&&a!==t.RGBA32F||e.get("EXT_color_buffer_float"),a}function C(e,n){let i;return e?null===n||n===hn||n===fn?i=t.DEPTH24_STENCIL8:n===un?i=t.DEPTH32F_STENCIL8:n===ln&&(i=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===hn||n===fn?i=t.DEPTH_COMPONENT24:n===un?i=t.DEPTH_COMPONENT32F:n===ln&&(i=t.DEPTH_COMPONENT16),i}function w(t,e){return!0===y(t)||t.isFramebufferTexture&&t.minFilter!==Xe&&t.minFilter!==$e?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function _(t){const e=t.target;e.removeEventListener("dispose",_),function(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=p.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&S(t),0===Object.keys(r).length&&p.delete(n)}i.remove(t)}(e),e.isVideoTexture&&u.delete(e)}function M(e){const n=e.target;n.removeEventListener("dispose",M),function(e){const n=i.get(e);if(e.depthTexture&&(e.depthTexture.dispose(),i.remove(e.depthTexture)),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++){if(Array.isArray(n.__webglFramebuffer[e]))for(let i=0;i<n.__webglFramebuffer[e].length;i++)t.deleteFramebuffer(n.__webglFramebuffer[e][i]);else t.deleteFramebuffer(n.__webglFramebuffer[e]);n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[e])}else{if(Array.isArray(n.__webglFramebuffer))for(let e=0;e<n.__webglFramebuffer.length;e++)t.deleteFramebuffer(n.__webglFramebuffer[e]);else t.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&t.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let e=0;e<n.__webglColorRenderbuffer.length;e++)n.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(n.__webglColorRenderbuffer[e]);n.__webglDepthRenderbuffer&&t.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=e.textures;for(let e=0,n=r.length;e<n;e++){const n=i.get(r[e]);n.__webglTexture&&(t.deleteTexture(n.__webglTexture),o.memory.textures--),i.remove(r[e])}i.remove(e)}(n)}function S(e){const n=i.get(e);t.deleteTexture(n.__webglTexture);const r=e.source;delete p.get(r)[n.__cacheKey],o.memory.textures--}let I=0;function B(e,r){const s=i.get(e);if(e.isVideoTexture&&function(t){const e=o.render.frame;u.get(t)!==e&&(u.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&s.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===t.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else if(O(s,e,r))return}n.bindTexture(t.TEXTURE_2D,s.__webglTexture,t.TEXTURE0+r)}function T(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?O(s,e,r):n.bindTexture(t.TEXTURE_2D_ARRAY,s.__webglTexture,t.TEXTURE0+r)}const R={[je]:t.REPEAT,[We]:t.CLAMP_TO_EDGE,[qe]:t.MIRRORED_REPEAT},L={[Xe]:t.NEAREST,[Ye]:t.NEAREST_MIPMAP_NEAREST,[Ke]:t.NEAREST_MIPMAP_LINEAR,[$e]:t.LINEAR,[tn]:t.LINEAR_MIPMAP_NEAREST,[nn]:t.LINEAR_MIPMAP_LINEAR},D={[Yi]:t.NEVER,[nr]:t.ALWAYS,[Ji]:t.LESS,[Zi]:t.LEQUAL,[Ki]:t.EQUAL,[er]:t.GEQUAL,[$i]:t.GREATER,[tr]:t.NOTEQUAL};function P(n,s){if(s.type!==un||!1!==e.has("OES_texture_float_linear")||s.magFilter!==$e&&s.magFilter!==tn&&s.magFilter!==Ke&&s.magFilter!==nn&&s.minFilter!==$e&&s.minFilter!==tn&&s.minFilter!==Ke&&s.minFilter!==nn||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(n,t.TEXTURE_WRAP_S,R[s.wrapS]),t.texParameteri(n,t.TEXTURE_WRAP_T,R[s.wrapT]),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,R[s.wrapR]),t.texParameteri(n,t.TEXTURE_MAG_FILTER,L[s.magFilter]),t.texParameteri(n,t.TEXTURE_MIN_FILTER,L[s.minFilter]),s.compareFunction&&(t.texParameteri(n,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(n,t.TEXTURE_COMPARE_FUNC,D[s.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){if(s.magFilter===Xe)return;if(s.minFilter!==Ke&&s.minFilter!==nn)return;if(s.type===un&&!1===e.has("OES_texture_float_linear"))return;if(s.anisotropy>1||i.get(s).__currentAnisotropy){const o=e.get("EXT_texture_filter_anisotropic");t.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy}}}function U(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",_));const r=n.source;let s=p.get(r);void 0===s&&(s={},p.set(r,s));const a=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(n);if(a!==e.__cacheKey){void 0===s[a]&&(s[a]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,i=!0),s[a].usedTimes++;const r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&S(n)),e.__cacheKey=a,e.__webglTexture=s[a].texture}return i}function O(e,o,a){if(f)return o.isPendingDeferredUpload||(o.isPendingDeferredUpload=!0,A.push({textureProperties:e,texture:o,slot:a})),!1;let l=t.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),o.isData3DTexture&&(l=t.TEXTURE_3D);const c=U(e,o),h=o.source;n.bindTexture(l,e.__webglTexture,t.TEXTURE0+a);const u=i.get(h);if(h.version!==u.__version||!0===c){n.activeTexture(t.TEXTURE0+a);const e=zr.getPrimaries(zr.workingColorSpace),i=o.colorSpace===Ii?null:zr.getPrimaries(o.colorSpace),d=o.colorSpace===Ii||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,o.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,o.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=v(o.image,!1,r.maxTextureSize);p=j(o,p);const A=s.convert(o.format,o.colorSpace),f=s.convert(o.type);let m,g=b(o.internalFormat,A,f,o.colorSpace,o.isVideoTexture);P(l,o);const x=o.mipmaps,_=!0!==o.isVideoTexture,M=void 0===u.__version||!0===c,S=h.dataReady,I=w(o,p);if(o.isDepthTexture)g=C(o.format===Cn,o.type),M&&(_?n.texStorage2D(t.TEXTURE_2D,1,g,p.width,p.height):n.texImage2D(t.TEXTURE_2D,0,g,p.width,p.height,0,A,f,null));else if(o.isDataTexture)if(x.length>0){_&&M&&n.texStorage2D(t.TEXTURE_2D,I,g,x[0].width,x[0].height);for(let e=0,i=x.length;e<i;e++)m=x[e],_?S&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,m.width,m.height,A,f,m.data):n.texImage2D(t.TEXTURE_2D,e,g,m.width,m.height,0,A,f,m.data);o.generateMipmaps=!1}else _?(M&&n.texStorage2D(t.TEXTURE_2D,I,g,p.width,p.height),S&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,p.width,p.height,A,f,p.data)):n.texImage2D(t.TEXTURE_2D,0,g,p.width,p.height,0,A,f,p.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){_&&M&&n.texStorage3D(t.TEXTURE_2D_ARRAY,I,g,x[0].width,x[0].height,p.depth);for(let e=0,i=x.length;e<i;e++)if(m=x[e],o.format!==yn)if(null!==A)if(_){if(S)if(o.layerUpdates.size>0){const i=$p(m.width,m.height,o.format,o.type);for(const r of o.layerUpdates){const s=m.data.subarray(r*i/m.data.BYTES_PER_ELEMENT,(r+1)*i/m.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,r,m.width,m.height,1,A,s)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,m.width,m.height,p.depth,A,m.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,e,g,m.width,m.height,p.depth,0,m.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else _?S&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,m.width,m.height,p.depth,A,f,m.data):n.texImage3D(t.TEXTURE_2D_ARRAY,e,g,m.width,m.height,p.depth,0,A,f,m.data)}else{_&&M&&n.texStorage2D(t.TEXTURE_2D,I,g,x[0].width,x[0].height);for(let e=0,i=x.length;e<i;e++)m=x[e],o.format!==yn?null!==A?_?S&&n.compressedTexSubImage2D(t.TEXTURE_2D,e,0,0,m.width,m.height,A,m.data):n.compressedTexImage2D(t.TEXTURE_2D,e,g,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_?S&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,m.width,m.height,A,f,m.data):n.texImage2D(t.TEXTURE_2D,e,g,m.width,m.height,0,A,f,m.data)}else if(o.isDataArrayTexture)if(_){if(M&&n.texStorage3D(t.TEXTURE_2D_ARRAY,I,g,p.width,p.height,p.depth),S)if(o.layerUpdates.size>0){const e=$p(p.width,p.height,o.format,o.type);for(const i of o.layerUpdates){const r=p.data.subarray(i*e/p.data.BYTES_PER_ELEMENT,(i+1)*e/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,i,p.width,p.height,1,A,f,r)}o.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,A,f,p.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,g,p.width,p.height,p.depth,0,A,f,p.data);else if(o.isData3DTexture)_?(M&&n.texStorage3D(t.TEXTURE_3D,I,g,p.width,p.height,p.depth),S&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,A,f,p.data)):n.texImage3D(t.TEXTURE_3D,0,g,p.width,p.height,p.depth,0,A,f,p.data);else if(o.isFramebufferTexture){if(M)if(_)n.texStorage2D(t.TEXTURE_2D,I,g,p.width,p.height);else{let e=p.width,i=p.height;for(let r=0;r<I;r++)n.texImage2D(t.TEXTURE_2D,r,g,e,i,0,A,f,null),e>>=1,i>>=1}}else if(x.length>0){if(_&&M){const e=W(x[0]);n.texStorage2D(t.TEXTURE_2D,I,g,e.width,e.height)}for(let e=0,i=x.length;e<i;e++)m=x[e],_?S&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,A,f,m):n.texImage2D(t.TEXTURE_2D,e,g,A,f,m);o.generateMipmaps=!1}else if(_){if(M){const e=W(p);n.texStorage2D(t.TEXTURE_2D,I,g,e.width,e.height)}S&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,A,f,p)}else n.texImage2D(t.TEXTURE_2D,0,g,A,f,p);y(o)&&E(l),u.__version=h.version,o.onUpdate&&o.onUpdate(o)}return e.__version=o.version,!0}function F(e,r,o,l,h,u){const d=s.convert(o.format,o.colorSpace),p=s.convert(o.type),A=b(o.internalFormat,d,p,o.colorSpace),f=i.get(r),m=i.get(o);if(m.__renderTarget=r,!f.__hasExternalTextures){const e=Math.max(1,r.width>>u),i=Math.max(1,r.height>>u);!0===r.isWebGLMultiviewRenderTarget?n.texStorage3D(t.TEXTURE_2D_ARRAY,0,A,r.width,r.height,r.numViews):h===t.TEXTURE_3D||h===t.TEXTURE_2D_ARRAY?n.texImage3D(h,u,A,e,i,r.depth,0,d,p,null):n.texImage2D(h,u,A,e,i,0,d,p,null)}n.bindFramebuffer(t.FRAMEBUFFER,e);const g=V(r);!0===r.isWebGLMultiviewRenderTarget?g?c.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,m.__webglTexture,0,H(r),0,r.numViews):c.framebufferTextureMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,m.__webglTexture,0,0,r.numViews):(h===t.TEXTURE_2D||h>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&h<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&(g?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,l,h,m.__webglTexture,0,H(r)):t.framebufferTexture2D(t.FRAMEBUFFER,l,h,m.__webglTexture,u)),n.bindFramebuffer(t.FRAMEBUFFER,null)}function k(e,n,r){if(t.bindRenderbuffer(t.RENDERBUFFER,e),!0===n.isWebGLMultiviewRenderTarget){const e=V(n),r=n.numViews,s=n.depthTexture;let o=t.DEPTH_COMPONENT24,a=t.DEPTH_ATTACHMENT;s&&s.isDepthTexture&&(s.type===un?o=t.DEPTH_COMPONENT32F:s.type===fn&&(o=t.DEPTH24_STENCIL8,a=t.DEPTH_STENCIL_ATTACHMENT));let l=i.get(n.depthTexture).__webglTexture;void 0===l&&(l=t.createTexture(),t.bindTexture(t.TEXTURE_2D_ARRAY,l),t.texStorage3D(t.TEXTURE_2D_ARRAY,1,o,n.width,n.height,r)),e?c.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,a,l,0,H(n),0,r):c.framebufferTextureMultiviewOVR(t.FRAMEBUFFER,a,l,0,0,r)}else if(n.depthBuffer){const i=n.depthTexture,s=i&&i.isDepthTexture?i.type:null,o=C(n.stencilBuffer,s),l=n.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,c=H(n);V(n)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,c,o,n.width,n.height):r?t.renderbufferStorageMultisample(t.RENDERBUFFER,c,o,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,o,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,l,t.RENDERBUFFER,e)}else{const e=n.textures;for(let i=0;i<e.length;i++){const o=e[i],l=s.convert(o.format,o.colorSpace),c=s.convert(o.type),h=b(o.internalFormat,l,c,o.colorSpace),u=H(n);r&&!1===V(n)?t.renderbufferStorageMultisample(t.RENDERBUFFER,u,h,n.width,n.height):V(n)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,u,h,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,h,n.width,n.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function N(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const s=i.get(r.depthTexture);s.__renderTarget=r,s.__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),1!=r.depthTexture.image.depth?T(r.depthTexture,0):B(r.depthTexture,0);const o=s.__webglTexture,l=H(r);if(!0===r.isWebGLMultiviewRenderTarget){const e=V(r),n=r.numViews;if(r.depthTexture.format===bn)e?c.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,o,0,l,0,n):c.framebufferTextureMultiviewOVR(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,o,0,0,n);else{if(r.depthTexture.format!==Cn)throw new Error("Unknown depthTexture format");e?c.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,o,0,l,0,n):c.framebufferTextureMultiviewOVR(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,o,0,0,n)}}else if(r.depthTexture.format===bn)V(r)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,o,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,o,0);else{if(r.depthTexture.format!==Cn)throw new Error("Unknown depthTexture format");V(r)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,o,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,o,0)}}function Q(e){const r=i.get(e),s=!0===e.isWebGLCubeRenderTarget;if(r.__boundDepthTexture!==e.depthTexture){const t=e.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),t){const e=()=>{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,t.removeEventListener("dispose",e)};t.addEventListener("dispose",e),r.__depthDisposeCallback=e}r.__boundDepthTexture=t}if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(s)throw new Error("target.depthTexture not supported in Cube render targets");N(r.__webglFramebuffer,e)}else if(s){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[i]),void 0===r.__webglDepthbuffer[i])r.__webglDepthbuffer[i]=t.createRenderbuffer(),k(r.__webglDepthbuffer[i],e,!1);else{const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,s=r.__webglDepthbuffer[i];t.bindRenderbuffer(t.RENDERBUFFER,s),t.framebufferRenderbuffer(t.FRAMEBUFFER,n,t.RENDERBUFFER,s)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=t.createRenderbuffer(),k(r.__webglDepthbuffer,e,!1);else{const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,i=r.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,i),t.framebufferRenderbuffer(t.FRAMEBUFFER,n,t.RENDERBUFFER,i)}n.bindFramebuffer(t.FRAMEBUFFER,null)}const G=[],z=[];function H(t){return Math.min(r.maxSamples,t.samples)}function V(t){const n=i.get(t);return t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function j(t,e){const n=t.colorSpace,i=t.format,r=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||n!==Ti&&n!==Ii&&(zr.getTransfer(n)===Li?i===yn&&r===sn||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),e}function W(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?(h.width=t.naturalWidth||t.width,h.height=t.naturalHeight||t.height):"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?(h.width=t.displayWidth,h.height=t.displayHeight):(h.width=t.width,h.height=t.height),h}this.allocateTextureUnit=function(){const t=I;return t>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+r.maxTextures),I+=1,t},this.resetTextureUnits=function(){I=0},this.setTexture2D=B,this.setTexture2DArray=T,this.setTexture3D=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?O(s,e,r):n.bindTexture(t.TEXTURE_3D,s.__webglTexture,t.TEXTURE0+r)},this.setTextureCube=function(e,o){const a=i.get(e);e.version>0&&a.__version!==e.version?function(e,o,a){if(6!==o.image.length)return;const l=U(e,o),c=o.source;n.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+a);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(t.TEXTURE0+a);const e=zr.getPrimaries(zr.workingColorSpace),i=o.colorSpace===Ii?null:zr.getPrimaries(o.colorSpace),u=o.colorSpace===Ii||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,o.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,o.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);const d=o.isCompressedTexture||o.image[0].isCompressedTexture,p=o.image[0]&&o.image[0].isDataTexture,A=[];for(let t=0;t<6;t++)A[t]=d||p?p?o.image[t].image:o.image[t]:v(o.image[t],!0,r.maxCubemapSize),A[t]=j(o,A[t]);const f=A[0],m=s.convert(o.format,o.colorSpace),g=s.convert(o.type),x=b(o.internalFormat,m,g,o.colorSpace),C=!0!==o.isVideoTexture,_=void 0===h.__version||!0===l,M=c.dataReady;let S,I=w(o,f);if(P(t.TEXTURE_CUBE_MAP,o),d){C&&_&&n.texStorage2D(t.TEXTURE_CUBE_MAP,I,x,f.width,f.height);for(let e=0;e<6;e++){S=A[e].mipmaps;for(let i=0;i<S.length;i++){const r=S[i];o.format!==yn?null!==m?C?M&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,0,0,r.width,r.height,m,r.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,x,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):C?M&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,0,0,r.width,r.height,m,g,r.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,x,r.width,r.height,0,m,g,r.data)}}}else{if(S=o.mipmaps,C&&_){S.length>0&&I++;const e=W(A[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,I,x,e.width,e.height)}for(let e=0;e<6;e++)if(p){C?M&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,A[e].width,A[e].height,m,g,A[e].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,x,A[e].width,A[e].height,0,m,g,A[e].data);for(let i=0;i<S.length;i++){const r=S[i].image[e].image;C?M&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,0,0,r.width,r.height,m,g,r.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,x,r.width,r.height,0,m,g,r.data)}}else{C?M&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,m,g,A[e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,x,m,g,A[e]);for(let i=0;i<S.length;i++){const r=S[i];C?M&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,0,0,m,g,r.image[e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,x,m,g,r.image[e])}}}y(o)&&E(t.TEXTURE_CUBE_MAP),h.__version=c.version,o.onUpdate&&o.onUpdate(o)}e.__version=o.version}(a,e,o):n.bindTexture(t.TEXTURE_CUBE_MAP,a.__webglTexture,t.TEXTURE0+o)},this.rebindTextures=function(e,n,r){const s=i.get(e);void 0!==n&&F(s.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==r&&Q(e)},this.uploadTexture=O,this.setupRenderTarget=function(e){const r=e.texture,a=i.get(e),l=i.get(r);e.addEventListener("dispose",M);const c=e.textures,h=!0===e.isWebGLCubeRenderTarget,u=c.length>1;if(u||(void 0===l.__webglTexture&&(l.__webglTexture=t.createTexture()),l.__version=r.version,o.memory.textures++),h){a.__webglFramebuffer=[];for(let e=0;e<6;e++)if(r.mipmaps&&r.mipmaps.length>0){a.__webglFramebuffer[e]=[];for(let n=0;n<r.mipmaps.length;n++)a.__webglFramebuffer[e][n]=t.createFramebuffer()}else a.__webglFramebuffer[e]=t.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){a.__webglFramebuffer=[];for(let e=0;e<r.mipmaps.length;e++)a.__webglFramebuffer[e]=t.createFramebuffer()}else a.__webglFramebuffer=t.createFramebuffer();if(u)for(let e=0,n=c.length;e<n;e++){const n=i.get(c[e]);void 0===n.__webglTexture&&(n.__webglTexture=t.createTexture(),o.memory.textures++)}if(e.samples>0&&!1===V(e)){a.__webglMultisampledFramebuffer=t.createFramebuffer(),a.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,a.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const i=c[n];a.__webglColorRenderbuffer[n]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,a.__webglColorRenderbuffer[n]);const r=s.convert(i.format,i.colorSpace),o=s.convert(i.type),l=b(i.internalFormat,r,o,i.colorSpace,!0===e.isXRRenderTarget),h=H(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,h,l,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+n,t.RENDERBUFFER,a.__webglColorRenderbuffer[n])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(a.__webglDepthRenderbuffer=t.createRenderbuffer(),k(a.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(h){n.bindTexture(t.TEXTURE_CUBE_MAP,l.__webglTexture),P(t.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)F(a.__webglFramebuffer[n][i],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else F(a.__webglFramebuffer[n],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);y(r)&&E(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(u){for(let r=0,s=c.length;r<s;r++){const s=c[r],o=i.get(s);n.bindTexture(t.TEXTURE_2D,o.__webglTexture),P(t.TEXTURE_2D,s),F(a.__webglFramebuffer,e,s,t.COLOR_ATTACHMENT0+r,t.TEXTURE_2D,0),y(s)&&E(t.TEXTURE_2D)}n.unbindTexture()}else{let i=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(i=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),!0===e.isWebGLMultiviewRenderTarget&&(i=t.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),P(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)F(a.__webglFramebuffer[n],e,r,t.COLOR_ATTACHMENT0,i,n);else F(a.__webglFramebuffer,e,r,t.COLOR_ATTACHMENT0,i,0);y(r)&&E(i),n.unbindTexture()}(e.depthBuffer||!0===e.isWebGLMultiviewRenderTarget)&&this.setupDepthRenderbuffer(e)},this.updateRenderTargetMipmap=function(t){const e=t.textures;for(let r=0,s=e.length;r<s;r++){const s=e[r];if(y(s)){const e=x(t),r=i.get(s).__webglTexture;n.bindTexture(e,r),E(e),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.samples>0)if(!1===V(e)){const r=e.textures,s=e.width,o=e.height;let a=t.COLOR_BUFFER_BIT;const c=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,h=i.get(e),u=r.length>1;if(u)for(let e=0;e<r.length;e++)n.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let n=0;n<r.length;n++){if(e.resolveDepthBuffer&&(e.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&e.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT)),u){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,h.__webglColorRenderbuffer[n]);const e=i.get(r[n]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}t.blitFramebuffer(0,0,s,o,0,0,s,o,a,t.NEAREST),!0===l&&(G.length=0,z.length=0,G.push(t.COLOR_ATTACHMENT0+n),e.depthBuffer&&!1===e.resolveDepthBuffer&&(G.push(c),z.push(c),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,z)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,G))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),u)for(let e=0;e<r.length;e++){n.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,h.__webglColorRenderbuffer[e]);const s=i.get(r[e]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,s,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(e.depthBuffer&&!1===e.resolveDepthBuffer&&l){const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[n])}},this.setupDepthTexture=N,this.setupDepthRenderbuffer=Q,this.setupFrameBufferTexture=F,this.useMultisampledRTT=V,this.runDeferredUploads=function(){const t=f;f=!1;for(const t of A)O(t.textureProperties,t.texture,t.slot),t.texture.isPendingDeferredUpload=!1;A=[],f=t},this.setDeferTextureUploads=function(t){f=t}}function Im(t,e){return{convert:function(n,i=Ii){let r;const s=zr.getTransfer(i);if(n===sn)return t.UNSIGNED_BYTE;if(n===pn)return t.UNSIGNED_SHORT_4_4_4_4;if(n===An)return t.UNSIGNED_SHORT_5_5_5_1;if(n===mn)return t.UNSIGNED_INT_5_9_9_9_REV;if(n===on)return t.BYTE;if(n===an)return t.SHORT;if(n===ln)return t.UNSIGNED_SHORT;if(n===cn)return t.INT;if(n===hn)return t.UNSIGNED_INT;if(n===un)return t.FLOAT;if(n===dn)return t.HALF_FLOAT;if(n===gn)return t.ALPHA;if(n===vn)return t.RGB;if(n===yn)return t.RGBA;if(n===En)return t.LUMINANCE;if(n===xn)return t.LUMINANCE_ALPHA;if(n===bn)return t.DEPTH_COMPONENT;if(n===Cn)return t.DEPTH_STENCIL;if(n===wn)return t.RED;if(n===_n)return t.RED_INTEGER;if(n===Mn)return t.RG;if(n===Sn)return t.RG_INTEGER;if(n===Bn)return t.RGBA_INTEGER;if(n===Tn||n===Rn||n===Ln||n===Dn)if(s===Li){if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===Tn)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Rn)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ln)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Dn)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=e.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===Tn)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Rn)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ln)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Dn)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Pn||n===Un||n===On||n===Fn){if(r=e.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===Pn)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Un)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===On)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Fn)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===kn||n===Nn||n===Qn){if(r=e.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===kn||n===Nn)return s===Li?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Qn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===Gn||n===zn||n===Hn||n===Vn||n===jn||n===Wn||n===qn||n===Xn||n===Yn||n===Jn||n===Kn||n===Zn||n===$n||n===ti){if(r=e.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===Gn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===zn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Hn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Vn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===jn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Wn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===qn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Xn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Yn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Jn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Kn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Zn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===$n)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ti)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===ei||n===ni||n===ii){if(r=e.get("EXT_texture_compression_bptc"),null===r)return null;if(n===ei)return s===Li?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===ni)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ii)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===ri||n===si||n===oi||n===ai){if(r=e.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===ei)return r.COMPRESSED_RED_RGTC1_EXT;if(n===si)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===oi)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===ai)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===fn?t.UNSIGNED_INT_24_8:void 0!==t[n]?t[n]:null}}}class Bm extends ts{constructor(t,e,n,i={}){super(t,e,i),this.depthBuffer=!1,this.stencilBuffer=!1,this.numViews=n}copy(t){return super.copy(t),this.numViews=t.numViews,this}}Bm.prototype.isWebGLMultiviewRenderTarget=!0;class Tm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(null===this.texture){const i=new Kr;t.properties.get(i).__webglTexture=e.texture,e.depthNear===n.depthNear&&e.depthFar===n.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(t){if(null!==this.texture&&null===this.mesh){const e=t.cameras[0].viewport,n=new wa({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new ga(new Vh(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Rm extends gr{constructor(t,e,n,i){super();const r=this;let s=null,o=1;var a=null;let l=null,c="local-floor",h=1,u=null,d=null;var p=[];let A=null,f=null,m=null,g=null;const v=new Tm,y=e.getContextAttributes();let E=null,x=null;const b=[],C=[],w=new Br;let _=null;const M=new Ba;M.viewport=new Zr;const S=new Ba;S.viewport=new Zr;const I=[M,S],B=new Id;let T=null,R=null;function L(t){const e=C.indexOf(t.inputSource);if(-1===e)return;const n=b[e];void 0!==n&&(n.update(t.inputSource,t.frame,u||l),n.dispatchEvent({type:t.type,data:t.inputSource}))}function D(){s.removeEventListener("select",L),s.removeEventListener("selectstart",L),s.removeEventListener("selectend",L),s.removeEventListener("squeeze",L),s.removeEventListener("squeezestart",L),s.removeEventListener("squeezeend",L),s.removeEventListener("end",D),s.removeEventListener("inputsourceschange",P);for(let t=0;t<b.length;t++){const e=C[t];null!==e&&(C[t]=null,b[t].disconnect(e))}T=null,R=null,v.reset(),t.setRenderTarget(E),m=null,f=null,A=null,s=null,x=null,N.stop(),r.isPresenting=!1,t.setPixelRatio(_),t.setSize(w.width,w.height,!1),r.dispatchEvent({type:"sessionend"})}function P(t){for(let e=0;e<t.removed.length;e++){const n=t.removed[e],i=C.indexOf(n);i>=0&&(C[i]=null,b[i].disconnect(n))}for(let e=0;e<t.added.length;e++){const n=t.added[e];let i=C.indexOf(n);if(-1===i){for(let t=0;t<b.length;t++){if(t>=C.length){C.push(n),i=t;break}if(null===C[t]){C[t]=n,i=t;break}}if(-1===i)break}const r=b[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.layersEnabled=!1,this.enabled=!1,this.isPresenting=!1,this.isMultiview=!1,this.getCameraPose=function(){return d},this.getController=function(t){let e=b[t];return void 0===e&&(e=new Oa,b[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=b[t];return void 0===e&&(e=new Oa,b[t]=e),e.getGripSpace()},this.getHand=function(t){let e=b[t];return void 0===e&&(e=new Oa,b[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){o=t,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){c=t,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return u||l},this.setReferenceSpace=function(t){u=t},this.getBaseLayer=function(){return null!==f?f:m},this.getBinding=function(){return A},this.getRenderTarget=function(){return x},this.getFrame=function(){return g},this.getSession=function(){return s},this.setSession=async function(a){if(s=a,null!==s){if(E=t.getRenderTarget(),s.addEventListener("select",L),s.addEventListener("selectstart",L),s.addEventListener("selectend",L),s.addEventListener("squeeze",L),s.addEventListener("squeezestart",L),s.addEventListener("squeezeend",L),s.addEventListener("end",D),s.addEventListener("inputsourceschange",P),!0!==y.xrCompatible&&await e.makeXRCompatible(),_=t.getPixelRatio(),t.getSize(w),"undefined"!=typeof XRWebGLBinding&&"createProjectionLayer"in XRWebGLBinding.prototype){let a=null,l=null,c=null;y.depth&&(c=y.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,a=y.stencil?Cn:bn,l=y.stencil?fn:hn),r.isMultiview=i&&n.has("OCULUS_multiview");const h={colorFormat:e.RGBA8,depthFormat:c,scaleFactor:o};r.isMultiview&&(h.textureType="texture-array"),A=new XRWebGLBinding(s,e),f=A.createProjectionLayer(h),s.updateRenderState({layers:[f]}),t.setPixelRatio(1),t.setSize(f.textureWidth,f.textureHeight,!1);const u={format:yn,type:sn,depthTexture:new Rc(f.textureWidth,f.textureHeight,l,void 0,void 0,void 0,void 0,void 0,void 0,a),stencilBuffer:y.stencil,colorSpace:t.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:!1===f.ignoreDepthValues};if(r.isMultiview){const t=n.get("OCULUS_multiview");this.maxNumViews=e.getParameter(t.MAX_VIEWS_OVR),x=new Bm(f.textureWidth,f.textureHeight,2,u)}else x=new ts(f.textureWidth,f.textureHeight,u)}else{const n={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:o};m=new XRWebGLLayer(s,e,n),s.updateRenderState({baseLayer:m}),t.setPixelRatio(1),t.setSize(m.framebufferWidth,m.framebufferHeight,!1),x=new ts(m.framebufferWidth,m.framebufferHeight,{format:yn,type:sn,colorSpace:t.outputColorSpace,stencilBuffer:y.stencil})}x.isXRRenderTarget=!0,this.setFoveation(h),u=null,l=await s.requestReferenceSpace(c),N.setContext(s),N.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==s)return s.environmentBlendMode},this.addLayer=function(t){window.XRWebGLBinding&&this.layersEnabled&&s&&(p.push(t),this.updateLayers())},this.removeLayer=function(t){p.splice(p.indexOf(t),1),window.XRWebGLBinding&&this.layersEnabled&&s&&this.updateLayers()},this.updateLayers=function(){var t=p.map((function(t){return t}));t.unshift(s.renderState.layers[0]),s.updateRenderState({layers:t})},this.getDepthTexture=function(){return v.getDepthTexture()};const U=new os,O=new os;function F(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.setPoseTarget=function(t){void 0!==t&&(a=t)},this.updateCamera=function(t){if(null===s)return;let e=t.near,n=t.far;null!==v.texture&&(v.depthNear>0&&(e=v.depthNear),v.depthFar>0&&(n=v.depthFar)),B.near=S.near=M.near=e,B.far=S.far=M.far=n,T===B.near&&R===B.far||(s.updateRenderState({depthNear:B.near,depthFar:B.far}),T=B.near,R=B.far),M.layers.mask=2|t.layers.mask,S.layers.mask=4|t.layers.mask,B.layers.mask=M.layers.mask|S.layers.mask;const i=B.cameras;var r=a||t;const o=r.parent;F(B,o);for(let t=0;t<i.length;t++)F(i[t],o);2===i.length?function(t,e,n){U.setFromMatrixPosition(e.matrixWorld),O.setFromMatrixPosition(n.matrixWorld);const i=U.distanceTo(O),r=e.projectionMatrix.elements,s=n.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(s[8]+1)/s[0],d=o*h,p=o*u,A=i/(-h+u),f=A*-h;if(e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(f),t.translateZ(A),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert(),-1===r[10])t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{const e=o+A,n=a+A,r=d-f,s=p+(i-f),h=l*a/n*e,u=c*a/n*e;t.projectionMatrix.makePerspective(r,s,h,u,e,n),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}}(B,M,S):B.projectionMatrix.copy(M.projectionMatrix),function(t,e,n){e.matrixWorld.decompose(e.position,e.quaternion,e.scale),null===n.parent?n.matrix.copy(e.matrixWorld):(n.matrix.copy(n.parent.matrixWorld),n.matrix.invert(),n.matrix.multiply(e.matrixWorld)),n.matrix.decompose(n.position,n.quaternion,n.scale),n.updateMatrixWorld(!0),t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*xr*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,B,r)},this.getCamera=function(){return B},this.getFoveation=function(){if(null!==f||null!==m)return h},this.setFoveation=function(t){h=t,null!==f&&(f.fixedFoveation=t),null!==m&&void 0!==m.fixedFoveation&&(m.fixedFoveation=t)},this.hasDepthSensing=function(){return null!==v.texture},this.getDepthSensingMesh=function(){return v.getMesh(B)};let k=null;const N=new eA;N.setAnimationLoop((function(e,n){if(d=n.getViewerPose(u||l),g=n,null!==d){const e=d.views;null!==m&&(t.setRenderTargetFramebuffer(x,m.framebuffer),t.setRenderTarget(x));let n=!1;e.length!==B.cameras.length&&(B.cameras.length=0,n=!0);for(let i=0;i<e.length;i++){const r=e[i];let s=null;if(null!==m)s=m.getViewport(r);else{const e=A.getViewSubImage(f,r);s=e.viewport,0===i&&(t.setRenderTargetTextures(x,e.colorTexture,f.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(x))}let o=I[i];void 0===o&&(o=new Ba,o.layers.enable(i),o.viewport=new Zr,I[i]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(s.x,s.y,s.width,s.height),0===i&&(B.matrix.copy(o.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),!0===n&&B.cameras.push(o)}const i=s.enabledFeatures;if(i&&i.includes("depth-sensing")&&"gpu-optimized"==s.depthUsage&&A){const n=A.getDepthInformation(e[0]);n&&n.isValid&&n.texture&&v.init(t,n,s.renderState)}}for(let t=0;t<b.length;t++){const e=C[t],i=b[t];null!==e&&void 0!==i&&i.update(e,n,u||l)}k&&k(e,n),n.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:n}),g=null})),this.setAnimationLoop=function(t){k=t},this.dispose=function(){}}}const Lm=new Ws,Dm=new Os;function Pm(t,e){function n(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function i(t,i){t.opacity.value=i.opacity,i.color&&t.diffuse.value.copy(i.color),i.emissive&&t.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(t.map.value=i.map,n(i.map,t.mapTransform)),i.alphaMap&&(t.alphaMap.value=i.alphaMap,n(i.alphaMap,t.alphaMapTransform)),i.bumpMap&&(t.bumpMap.value=i.bumpMap,n(i.bumpMap,t.bumpMapTransform),t.bumpScale.value=i.bumpScale,i.side===Vt&&(t.bumpScale.value*=-1)),i.normalMap&&(t.normalMap.value=i.normalMap,n(i.normalMap,t.normalMapTransform),t.normalScale.value.copy(i.normalScale),i.side===Vt&&t.normalScale.value.negate()),i.displacementMap&&(t.displacementMap.value=i.displacementMap,n(i.displacementMap,t.displacementMapTransform),t.displacementScale.value=i.displacementScale,t.displacementBias.value=i.displacementBias),i.emissiveMap&&(t.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,t.emissiveMapTransform)),i.specularMap&&(t.specularMap.value=i.specularMap,n(i.specularMap,t.specularMapTransform)),i.alphaTest>0&&(t.alphaTest.value=i.alphaTest);const r=e.get(i),s=r.envMap,o=r.envMapRotation;s&&(t.envMap.value=s,Lm.copy(o),Lm.x*=-1,Lm.y*=-1,Lm.z*=-1,s.isCubeTexture&&!1===s.isRenderTargetTexture&&(Lm.y*=-1,Lm.z*=-1),t.envMapRotation.value.setFromMatrix4(Dm.makeRotationFromEuler(Lm)),t.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,t.reflectivity.value=i.reflectivity,t.ior.value=i.ior,t.refractionRatio.value=i.refractionRatio),i.lightMap&&(t.lightMap.value=i.lightMap,t.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,t.lightMapTransform)),i.aoMap&&(t.aoMap.value=i.aoMap,t.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,t.aoMapTransform))}return{refreshFogUniforms:function(e,n){n.color.getRGB(e.fogColor.value,ba(t)),n.isFog?(e.fogNear.value=n.near,e.fogFar.value=n.far):n.isFogExp2&&(e.fogDensity.value=n.density)},refreshMaterialUniforms:function(t,r,s,o,a){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(t,r):r.isMeshToonMaterial?(i(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(i(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(i(t,r),function(t,e){t.metalness.value=e.metalness,e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap,n(e.metalnessMap,t.metalnessMapTransform)),t.roughness.value=e.roughness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap,n(e.roughnessMap,t.roughnessMapTransform)),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,n(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,n(e.sheenRoughnessMap,t.sheenRoughnessMapTransform))),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,n(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,n(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,n(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),e.side===Vt&&t.clearcoatNormalScale.value.negate())),e.dispersion>0&&(t.dispersion.value=e.dispersion),e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,n(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,n(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform))),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,n(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,n(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,n(e.anisotropyMap,t.anisotropyMapTransform))),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,n(e.specularColorMap,t.specularColorMapTransform)),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,n(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r,a)):r.isMeshMatcapMaterial?(i(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?i(t,r):r.isMeshDistanceMaterial?(i(t,r),function(t,n){const i=e.get(n).light;t.referencePosition.value.setFromMatrixPosition(i.matrixWorld),t.nearDistance.value=i.shadow.camera.near,t.farDistance.value=i.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?i(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,i,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*r,e.map&&(t.map.value=e.map,n(e.map,t.uvTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,s,o):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Um(t,e,n,i){let r={},s={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(t,e,n,i){const r=t.value,s=e+"_"+n;if(void 0===i[s])return i[s]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const t=i[s];if("number"==typeof r||"boolean"==typeof r){if(t!==r)return i[s]=r,!0}else if(!1===t.equals(r))return t.copy(r),!0}return!1}function c(t){const e={boundary:0,storage:0};return"number"==typeof t||"boolean"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),e}function h(e){const n=e.target;n.removeEventListener("dispose",h);const i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),t.deleteBuffer(r[n.id]),delete r[n.id],delete s[n.id]}return{bind:function(t,e){const n=e.program;i.uniformBlockBinding(t,n)},update:function(n,u){let d=r[n.id];void 0===d&&(function(t){const e=t.uniforms;let n=0;for(let t=0,i=e.length;t<i;t++){const i=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0,e=i.length;t<e;t++){const e=i[t],r=Array.isArray(e.value)?e.value:[e.value];for(let t=0,i=r.length;t<i;t++){const i=c(r[t]),s=n%16,o=s%i.boundary,a=s+o;n+=o,0!==a&&16-a<i.storage&&(n+=16-a),e.__data=new Float32Array(i.storage/Float32Array.BYTES_PER_ELEMENT),e.__offset=n,n+=i.storage}}}const i=n%16;i>0&&(n+=16-i),t.__size=n,t.__cache={}}(n),d=function(e){const n=function(){for(let t=0;t<a;t++)if(-1===o.indexOf(t))return o.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=n;const i=t.createBuffer(),r=e.__size,s=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,i),t.bufferData(t.UNIFORM_BUFFER,r,s),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=d,n.addEventListener("dispose",h));const p=u.program;i.updateUBOMapping(n,p);const A=e.render.frame;s[n.id]!==A&&(function(e){const n=r[e.id],i=e.uniforms,s=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,n);for(let e=0,n=i.length;e<n;e++){const n=Array.isArray(i[e])?i[e]:[i[e]];for(let i=0,r=n.length;i<r;i++){const r=n[i];if(!0===l(r,e,i,s)){const e=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let s=0;s<n.length;s++){const o=n[s],a=c(o);"number"==typeof o||"boolean"==typeof o?(r.__data[0]=o,t.bufferSubData(t.UNIFORM_BUFFER,e+i,r.__data)):o.isMatrix3?(r.__data[0]=o.elements[0],r.__data[1]=o.elements[1],r.__data[2]=o.elements[2],r.__data[3]=0,r.__data[4]=o.elements[3],r.__data[5]=o.elements[4],r.__data[6]=o.elements[5],r.__data[7]=0,r.__data[8]=o.elements[6],r.__data[9]=o.elements[7],r.__data[10]=o.elements[8],r.__data[11]=0):(o.toArray(r.__data,i),i+=a.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,e,r.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(n),s[n.id]=A)},dispose:function(){for(const e in r)t.deleteBuffer(r[e]);o=[],r={},s={}}}}class Om{constructor(t={}){const{canvas:e=Or(),context:n=null,depth:i=!0,stencil:r=!1,alpha:s=!1,antialias:o=!1,premultipliedAlpha:a=!0,preserveDrawingBuffer:l=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:h=!1,reverseDepthBuffer:u=!1,multiviewStereo:d=!1}=t;let p;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=s;const A=new Uint32Array(4),f=new Int32Array(4);let m=null,g=null;const v=[],y=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Bi,this.toneMapping=Be,this.toneMappingExposure=1;const E=this;let x=!1,b=0,C=0,w=null,_=-1,M=null;const S=new Zr,I=new Zr;let B=null;const T=new Bo(0);let R=0,L=e.width,D=e.height,P=1,U=null,O=null;const F=new Zr(0,0,L,D),k=new Zr(0,0,L,D);let N=!1;const Q=new kl;let G=!1,z=!1;this.transmissionResolutionScale=1;const H=new Os,V=new Os,j=new os,W=new Zr,q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let X=!1;function Y(){return null===w?P:1}let J,K,Z,$,tt,et,nt,it,rt,st,ot,at,lt,ct,ht,ut,dt,pt,At,ft,mt,gt,vt,yt,Et,xt=n;function bt(t,n){return e.getContext(t,n)}try{const t={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Lt}`),e.addEventListener("webglcontextlost",_t,!1),e.addEventListener("webglcontextrestored",Mt,!1),e.addEventListener("webglcontextcreationerror",St,!1),null===xt){const e="webgl2";if(xt=bt(e,t),null===xt)throw bt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function Ct(){J=new RA(xt),J.init(),vt=new Im(xt,J),K=new dA(xt,J,t,vt),Z=new Mm(xt,J),K.reverseDepthBuffer&&u&&Z.buffers.depth.setReversed(!0),$=new PA(xt),tt=new pm,et=new Sm(xt,J,Z,tt,K,vt,$),nt=new AA(E),it=new TA(E),rt=new nA(xt),yt=new hA(xt,rt),st=new LA(xt,rt,$,yt),ot=new FA(xt,st,rt,$),ft=new UA(xt,K,et),ut=new pA(tt),at=new dm(E,nt,it,J,K,yt,ut),lt=new Pm(E,tt),ct=new gm,ht=new Cm(J),At=new cA(E,nt,it,Z,ot,p,a),pt=new OA(E,J,xt),dt=new wm(E,ot,K),Et=new Um(xt,$,K,Z),mt=new uA(xt,J,$),gt=new DA(xt,J,$),$.programs=at.programs,E.capabilities=K,E.extensions=J,E.properties=tt,E.renderLists=ct,E.shadowMap=dt,E.state=Z,E.info=$}Ct();const wt=new Rm(E,xt);function _t(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function Mt(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;const t=$.autoReset,e=dt.enabled,n=dt.autoUpdate,i=dt.needsUpdate,r=dt.type;Ct(),$.autoReset=t,dt.enabled=e,dt.autoUpdate=n,dt.needsUpdate=i,dt.type=r}function St(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function It(t){const e=t.target;e.removeEventListener("dispose",It),function(t){(function(t){const e=tt.get(t).programs;void 0!==e&&(e.forEach((function(t){at.releaseProgram(t)})),t.isShaderMaterial&&at.releaseShaderCache(t))})(t),tt.remove(t)}(e)}function Bt(t,e,n){!0===t.transparent&&t.side===jt&&!1===t.forceSinglePass?(t.side=Vt,t.needsUpdate=!0,Qt(t,e,n),t.side=Ht,t.needsUpdate=!0,Qt(t,e,n),t.side=jt):Qt(t,e,n)}this.xr=wt,this.getContext=function(){return xt},this.getContextAttributes=function(){return xt.getContextAttributes()},this.forceContextLoss=function(){const t=J.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=J.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(t){void 0!==t&&(P=t,this.setSize(L,D,!1))},this.getSize=function(t){return t.set(L,D)},this.setSize=function(t,n,i=!0){wt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(L=t,D=n,e.width=Math.floor(t*P),e.height=Math.floor(n*P),!0===i&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(L*P,D*P).floor()},this.setDrawingBufferSize=function(t,n,i){L=t,D=n,P=i,e.width=Math.floor(t*i),e.height=Math.floor(n*i),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(S)},this.getViewport=function(t){return t.copy(F)},this.setViewport=function(t,e,n,i){t.isVector4?F.set(t.x,t.y,t.z,t.w):F.set(t,e,n,i),Z.viewport(S.copy(F).multiplyScalar(P).round())},this.getScissor=function(t){return t.copy(k)},this.setScissor=function(t,e,n,i){t.isVector4?k.set(t.x,t.y,t.z,t.w):k.set(t,e,n,i),Z.scissor(I.copy(k).multiplyScalar(P).round())},this.getScissorTest=function(){return N},this.setScissorTest=function(t){Z.setScissorTest(N=t)},this.setOpaqueSort=function(t){U=t},this.setTransparentSort=function(t){O=t},this.getClearColor=function(t){return t.copy(At.getClearColor())},this.setClearColor=function(){At.setClearColor.apply(At,arguments)},this.getClearAlpha=function(){return At.getClearAlpha()},this.setClearAlpha=function(){At.setClearAlpha.apply(At,arguments)},this.clear=function(t=!0,e=!0,n=!0){let i=0;if(t){let t=!1;if(null!==w){const e=w.texture.format;t=e===Bn||e===Sn||e===_n}if(t){const t=w.texture.type,e=t===sn||t===hn||t===ln||t===fn||t===pn||t===An,n=At.getClearColor(),i=At.getClearAlpha(),r=n.r,s=n.g,o=n.b;e?(A[0]=r,A[1]=s,A[2]=o,A[3]=i,xt.clearBufferuiv(xt.COLOR,0,A)):(f[0]=r,f[1]=s,f[2]=o,f[3]=i,xt.clearBufferiv(xt.COLOR,0,f))}else i|=xt.COLOR_BUFFER_BIT}e&&(i|=xt.DEPTH_BUFFER_BIT),n&&(i|=xt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),xt.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",_t,!1),e.removeEventListener("webglcontextrestored",Mt,!1),e.removeEventListener("webglcontextcreationerror",St,!1),At.dispose(),ct.dispose(),ht.dispose(),tt.dispose(),nt.dispose(),it.dispose(),ot.dispose(),yt.dispose(),Et.dispose(),at.dispose(),wt.dispose(),wt.removeEventListener("sessionstart",Rt),wt.removeEventListener("sessionend",Dt),Pt.stop()},this.renderBufferDirect=function(t,e,n,i,r,s){null===e&&(e=q);const o=r.isMesh&&r.matrixWorld.determinant()<0,a=function(t,e,n,i,r){!0!==e.isScene&&(e=q),et.resetTextureUnits();const s=e.fog,o=i.isMeshStandardMaterial?e.environment:null,a=null===w?E.outputColorSpace:!0===w.isXRRenderTarget?w.texture.colorSpace:Ti,l=(i.isMeshStandardMaterial?it:nt).get(i.envMap||o),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),u=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let A=Be;i.toneMapped&&(null!==w&&!0!==w.isXRRenderTarget||(A=E.toneMapping));const f=w&&w.isWebGLMultiviewRenderTarget?w.numViews:0,m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==m?m.length:0,y=tt.get(i),x=g.state.lights;if(!0===G&&(!0===z||t!==M)){const e=t===M&&i.id===_;ut.setState(i,t,e)}let b=!1;i.version===y.__version?y.needsLights&&y.lightsStateVersion!==x.state.version||y.outputColorSpace!==a||r.isBatchedMesh&&!1===y.batching?b=!0:r.isBatchedMesh||!0!==y.batching?r.isBatchedMesh&&!0===y.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===y.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===y.instancing?b=!0:r.isInstancedMesh||!0!==y.instancing?r.isSkinnedMesh&&!1===y.skinning?b=!0:r.isSkinnedMesh||!0!==y.skinning?r.isInstancedMesh&&!0===y.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===y.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===y.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===y.instancingMorph&&null!==r.morphTexture||y.envMap!==l||!0===i.fog&&y.fog!==s?b=!0:void 0===y.numClippingPlanes||y.numClippingPlanes===ut.numPlanes&&y.numIntersection===ut.numIntersection?(y.vertexAlphas!==c||y.vertexTangents!==h||y.morphTargets!==u||y.morphNormals!==d||y.morphColors!==p||y.toneMapping!==A||y.morphTargetsCount!==v||y.numMultiviewViews!==f)&&(b=!0):b=!0:b=!0:b=!0:b=!0:(b=!0,y.__version=i.version);let C=y.currentProgram;!0===b&&(C=Qt(i,e,r));let S=!1,I=!1,B=!1;const T=C.getUniforms(),R=y.uniforms;if(Z.useProgram(C.program)&&(S=!0,I=!0,B=!0),i.id!==_&&(_=i.id,I=!0),S||M!==t){C.numMultiviewViews>0?(pt.updateCameraProjectionMatricesUniform(t,T),pt.updateCameraViewMatricesUniform(t,T)):(Z.buffers.depth.getReversed()?(H.copy(t.projectionMatrix),function(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}(H),function(t){const e=t.elements;-1===e[11]?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=1-e[14])}(H),T.setValue(xt,"projectionMatrix",H)):T.setValue(xt,"projectionMatrix",t.projectionMatrix),T.setValue(xt,"viewMatrix",t.matrixWorldInverse));const e=T.map.cameraPosition;void 0!==e&&e.setValue(xt,j.setFromMatrixPosition(t.matrixWorld)),K.logarithmicDepthBuffer&&T.setValue(xt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&T.setValue(xt,"isOrthographic",!0===t.isOrthographicCamera),M!==t&&(M=t,I=!0,B=!0)}if(r.isSkinnedMesh){T.setOptional(xt,r,"bindMatrix"),T.setOptional(xt,r,"bindMatrixInverse");const t=r.skeleton;t&&(null===t.boneTexture&&t.computeBoneTexture(),T.setValue(xt,"boneTexture",t.boneTexture,et))}r.isBatchedMesh&&(T.setOptional(xt,r,"batchingTexture"),T.setValue(xt,"batchingTexture",r._matricesTexture,et),T.setOptional(xt,r,"batchingIdTexture"),T.setValue(xt,"batchingIdTexture",r._indirectTexture,et),T.setOptional(xt,r,"batchingColorTexture"),null!==r._colorsTexture&&T.setValue(xt,"batchingColorTexture",r._colorsTexture,et));const L=n.morphAttributes;var U,O;if(void 0===L.position&&void 0===L.normal&&void 0===L.color||ft.update(r,n,C),(I||y.receiveShadow!==r.receiveShadow)&&(y.receiveShadow=r.receiveShadow,T.setValue(xt,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(R.envMap.value=l,R.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==e.environment&&(R.envMapIntensity.value=e.environmentIntensity),I&&(T.setValue(xt,"toneMappingExposure",E.toneMappingExposure),y.needsLights&&(O=B,(U=R).ambientLightColor.needsUpdate=O,U.lightProbe.needsUpdate=O,U.directionalLights.needsUpdate=O,U.directionalLightShadows.needsUpdate=O,U.pointLights.needsUpdate=O,U.pointLightShadows.needsUpdate=O,U.spotLights.needsUpdate=O,U.spotLightShadows.needsUpdate=O,U.rectAreaLights.needsUpdate=O,U.hemisphereLights.needsUpdate=O),s&&!0===i.fog&<.refreshFogUniforms(R,s),lt.refreshMaterialUniforms(R,i,P,D,g.state.transmissionRenderTarget[t.id]),Hf.upload(xt,Gt(y),R,et)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Hf.upload(xt,Gt(y),R,et),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&T.setValue(xt,"center",r.center),C.numMultiviewViews>0?pt.updateObjectMatricesUniforms(r,t,T):(T.setValue(xt,"modelViewMatrix",r.modelViewMatrix),T.setValue(xt,"normalMatrix",r.normalMatrix)),T.setValue(xt,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const t=i.uniformsGroups;for(let e=0,n=t.length;e<n;e++){const n=t[e];Et.update(n,C),Et.bind(n,C)}}return C}(t,e,n,i,r);Z.setMaterial(i,o);let l=n.index,c=1;if(!0===i.wireframe){if(l=st.getWireframeAttribute(n),void 0===l)return;c=2}const h=n.drawRange,u=n.attributes.position;let d=h.start*c,p=(h.start+h.count)*c;null!==s&&(d=Math.max(d,s.start*c),p=Math.min(p,(s.start+s.count)*c)),null!==l?(d=Math.max(d,0),p=Math.min(p,l.count)):null!=u&&(d=Math.max(d,0),p=Math.min(p,u.count));const A=p-d;if(A<0||A===1/0)return;let f;yt.setup(r,i,a,n,l);let m=mt;if(null!==l&&(f=rt.get(l),m=gt,m.setIndex(f)),r.isMesh)!0===i.wireframe?(Z.setLineWidth(i.wireframeLinewidth*Y()),m.setMode(xt.LINES)):m.setMode(xt.TRIANGLES);else if(r.isLine){let t=i.linewidth;void 0===t&&(t=1),Z.setLineWidth(t*Y()),r.isLineSegments?m.setMode(xt.LINES):r.isLineLoop?m.setMode(xt.LINE_LOOP):m.setMode(xt.LINE_STRIP)}else r.isPoints?m.setMode(xt.POINTS):r.isSprite&&m.setMode(xt.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)m.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(J.get("WEBGL_multi_draw"))m.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const t=r._multiDrawStarts,e=r._multiDrawCounts,n=r._multiDrawCount,s=l?rt.get(l).bytesPerElement:1,o=tt.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)o.setValue(xt,"_gl_DrawID",i),m.render(t[i]/s,e[i])}else if(r.isInstancedMesh)m.renderInstances(d,A,r.count);else if(n.isInstancedBufferGeometry){const t=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,e=Math.min(n.instanceCount,t);m.renderInstances(d,A,e)}else m.render(d,A)},this.compile=function(t,e,n=null){null===n&&(n=t),g=ht.get(n),g.init(e),y.push(g),n.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(g.pushLight(t),t.castShadow&&g.pushShadow(t))})),t!==n&&t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(g.pushLight(t),t.castShadow&&g.pushShadow(t))})),g.setupLights();const i=new Set;return t.traverse((function(t){if(!(t.isMesh||t.isPoints||t.isLine||t.isSprite))return;const e=t.material;if(e)if(Array.isArray(e))for(let r=0;r<e.length;r++){const s=e[r];Bt(s,n,t),i.add(s)}else Bt(e,n,t),i.add(e)})),y.pop(),g=null,i},this.compileAsync=function(t,e,n=null){const i=this.compile(t,e,n);return new Promise((e=>{function n(){i.forEach((function(t){tt.get(t).currentProgram.isReady()&&i.delete(t)})),0!==i.size?setTimeout(n,10):e(t)}null!==J.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};let Tt=null;function Rt(){Pt.stop()}function Dt(){Pt.start()}const Pt=new eA;function Ut(t,e,n,i){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)g.pushLight(t),t.castShadow&&g.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||Q.intersectsSprite(t)){i&&W.setFromMatrixPosition(t.matrixWorld).applyMatrix4(V);const e=ot.update(t),r=t.material;r.visible&&m.push(t,e,r,n,W.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||Q.intersectsObject(t))){const e=ot.update(t),r=t.material;if(i&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),W.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),W.copy(e.boundingSphere.center)),W.applyMatrix4(t.matrixWorld).applyMatrix4(V)),Array.isArray(r)){const i=e.groups;for(let s=0,o=i.length;s<o;s++){const o=i[s],a=r[o.materialIndex];a&&a.visible&&m.push(t,e,a,n,W.z,o)}}else r.visible&&m.push(t,e,r,n,W.z,null)}const r=t.children;for(let t=0,s=r.length;t<s;t++)Ut(r[t],e,n,i)}function Ot(t,e,n,i){const r=t.opaque,s=t.transmissive,o=t.transparent;g.setupLightsView(n),!0===G&&ut.setGlobalState(E.clippingPlanes,n),i&&Z.viewport(S.copy(i)),r.length>0&&kt(r,e,n),s.length>0&&kt(s,e,n),o.length>0&&kt(o,e,n),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Ft(t,e,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===g.state.transmissionRenderTarget[i.id]&&(g.state.transmissionRenderTarget[i.id]=new ts(1,1,{generateMipmaps:!0,type:J.has("EXT_color_buffer_half_float")||J.has("EXT_color_buffer_float")?dn:sn,minFilter:nn,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:zr.workingColorSpace}));const s=g.state.transmissionRenderTarget[i.id],o=i.viewport||S;s.setSize(o.z*E.transmissionResolutionScale,o.w*E.transmissionResolutionScale);const a=E.getRenderTarget();E.setRenderTarget(s),E.getClearColor(T),R=E.getClearAlpha(),R<1&&E.setClearColor(16777215,.5),E.clear(),X&&At.render(n);const l=E.toneMapping;E.toneMapping=Be;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),g.setupLightsView(i),!0===G&&ut.setGlobalState(E.clippingPlanes,i),kt(t,n,i),et.updateMultisampleRenderTarget(s),et.updateRenderTargetMipmap(s),!1===J.has("WEBGL_multisampled_render_to_texture")){let t=!1;for(let r=0,s=e.length;r<s;r++){const s=e[r],o=s.object,a=s.geometry,l=s.material,c=s.group;if(l.side===jt&&o.layers.test(i.layers)){const e=l.side;l.side=Vt,l.needsUpdate=!0,Nt(o,n,i,a,l,c),l.side=e,l.needsUpdate=!0,t=!0}}!0===t&&(et.updateMultisampleRenderTarget(s),et.updateRenderTargetMipmap(s))}E.setRenderTarget(a),E.setClearColor(T,R),void 0!==c&&(i.viewport=c),E.toneMapping=l}function kt(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r<s;r++){const s=t[r],o=s.object,a=s.geometry,l=null===i?s.material:i,c=s.group;o.layers.test(n.layers)&&Nt(o,e,n,a,l,c)}}function Nt(t,e,n,i,r,s){t.onBeforeRender(E,e,n,i,r,s),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(E,e,n,i,t,s),!0===r.transparent&&r.side===jt&&!1===r.forceSinglePass?(r.side=Vt,r.needsUpdate=!0,E.renderBufferDirect(n,e,i,r,t,s),r.side=Ht,r.needsUpdate=!0,E.renderBufferDirect(n,e,i,r,t,s),r.side=jt):E.renderBufferDirect(n,e,i,r,t,s),t.onAfterRender(E,e,n,i,r,s)}function Qt(t,e,n){!0!==e.isScene&&(e=q);const i=tt.get(t),r=g.state.lights,s=g.state.shadowsArray,o=r.state.version,a=at.getParameters(t,r.state,s,e,n),l=at.getProgramCacheKey(a);let c=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=(t.isMeshStandardMaterial?it:nt).get(t.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===t.envMap?e.environmentRotation:t.envMapRotation,void 0===c&&(t.addEventListener("dispose",It),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===o)return zt(t,a),h}else a.uniforms=at.getUniforms(t),t.onBeforeCompile(a,E),h=at.acquireProgram(a,l),c.set(l,h),i.uniforms=a.uniforms;const u=i.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(u.clippingPlanes=ut.uniform),zt(t,a),i.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),i.lightsStateVersion=o,i.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotLightMatrix.value=r.state.spotLightMatrix,u.spotLightMap.value=r.state.spotLightMap,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=h,i.uniformsList=null,h}function Gt(t){if(null===t.uniformsList){const e=t.currentProgram.getUniforms();t.uniformsList=Hf.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function zt(t,e){const n=tt.get(t);n.outputColorSpace=e.outputColorSpace,n.batching=e.batching,n.batchingColor=e.batchingColor,n.instancing=e.instancing,n.instancingColor=e.instancingColor,n.instancingMorph=e.instancingMorph,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphColors=e.morphColors,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents,n.toneMapping=e.toneMapping,n.numMultiviewViews=e.numMultiviewViews}var Wt;Pt.setAnimationLoop((function(t){Tt&&Tt(t)})),"undefined"!=typeof self&&Pt.setContext(self),this.setAnimationLoop=function(t){Tt=t,wt.setAnimationLoop(t),null===t?Pt.stop():Pt.start()},wt.addEventListener("sessionstart",Rt),wt.addEventListener("sessionend",Dt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===x)return;if(!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===wt.enabled&&!0===wt.isPresenting&&(!0===wt.cameraAutoUpdate&&wt.updateCamera(e),e=wt.getCamera()),!0===t.isScene&&t.onBeforeRender(E,t,e,w),g=ht.get(t,y.length),g.init(e),y.push(g),V.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Q.setFromProjectionMatrix(V),z=this.localClippingEnabled,G=ut.init(this.clippingPlanes,z),m=ct.get(t,v.length),m.init(),v.push(m),!0===wt.enabled&&!0===wt.isPresenting){const t=E.xr.getDepthSensingMesh();null!==t&&Ut(t,e,-1/0,E.sortObjects)}Ut(t,e,0,E.sortObjects),m.finish(),!0===E.sortObjects&&m.sort(U,O),X=!1===wt.enabled||!1===wt.isPresenting||!1===wt.hasDepthSensing(),X&&At.addToRenderList(m,t),this.info.render.frame++,!0===G&&ut.beginShadows();const n=g.state.shadowsArray;dt.render(n,t,e),!0===G&&ut.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=m.opaque,r=m.transmissive;if(g.setupLights(),e.isArrayCamera){const n=e.cameras;if(r.length>0)for(let e=0,s=n.length;e<s;e++)Ft(i,r,t,n[e]);if(X&&At.render(t),wt.enabled&&wt.isMultiview)et.setDeferTextureUploads(!0),Ot(m,t,e,e.cameras[0].viewport);else for(let e=0,i=n.length;e<i;e++){const i=n[e];Ot(m,t,i,i.viewport)}}else r.length>0&&Ft(i,r,t,e),X&&At.render(t),Ot(m,t,e);null!==w&&0===C&&(et.updateMultisampleRenderTarget(w),et.updateRenderTargetMipmap(w)),!0===t.isScene&&t.onAfterRender(E,t,e),yt.resetDefaultState(),_=-1,M=null,y.pop(),y.length>0?(g=y[y.length-1],!0===G&&ut.setGlobalState(E.clippingPlanes,g.state.camera)):g=null,v.pop(),m=v.length>0?v[v.length-1]:null},this.setTexture2D=(Wt=!1,function(t,e){t&&t.isWebGLRenderTarget&&(Wt||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),Wt=!0),t=t.texture),et.setTexture2D(t,e)}),this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(t,e,n){tt.get(t.texture).__webglTexture=e,tt.get(t.depthTexture).__webglTexture=n;const i=tt.get(t);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||w&&w.isWebGLMultiviewRenderTarget||!0===J.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(t,e){const n=tt.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e};const qt=xt.createFramebuffer();this.setRenderTarget=function(t,e=0,n=0){null===t&&this.xr.isPresenting&&(t=this.xr.getRenderTarget()),w=t,b=e,C=n;let i=!0,r=null,s=!1,o=!1;if(t){const a=tt.get(t);if(void 0!==a.__useDefaultFramebuffer)Z.bindFramebuffer(xt.FRAMEBUFFER,null),i=!1;else if(void 0===a.__webglFramebuffer)et.setupRenderTarget(t);else if(a.__hasExternalTextures)et.rebindTextures(t,tt.get(t.texture).__webglTexture,tt.get(t.depthTexture).__webglTexture);else if(t.depthBuffer){const e=t.depthTexture;if(a.__boundDepthTexture!==e){if(null!==e&&tt.has(e)&&(t.width!==e.image.width||t.height!==e.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");et.setupDepthRenderbuffer(t)}}const l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);const c=tt.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=Array.isArray(c[e])?c[e][n]:c[e],s=!0):r=t.samples>0&&!1===et.useMultisampledRTT(t)?tt.get(t).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,S.copy(t.viewport),I.copy(t.scissor),B=t.scissorTest}else S.copy(F).multiplyScalar(P).floor(),I.copy(k).multiplyScalar(P).floor(),B=N;if(0!==n&&(r=qt),Z.bindFramebuffer(xt.FRAMEBUFFER,r)&&i&&Z.drawBuffers(t,r),Z.viewport(S),Z.scissor(I),Z.setScissorTest(B),s){const i=tt.get(t.texture);xt.framebufferTexture2D(xt.FRAMEBUFFER,xt.COLOR_ATTACHMENT0,xt.TEXTURE_CUBE_MAP_POSITIVE_X+e,i.__webglTexture,n)}else if(o){const i=tt.get(t.texture),r=e;xt.framebufferTextureLayer(xt.FRAMEBUFFER,xt.COLOR_ATTACHMENT0,i.__webglTexture,n,r)}else if(null!==t&&0!==n){const e=tt.get(t.texture);xt.framebufferTexture2D(xt.FRAMEBUFFER,xt.COLOR_ATTACHMENT0,xt.TEXTURE_2D,e.__webglTexture,n)}_=-1},this.readRenderTargetPixels=function(t,e,n,i,r,s,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=tt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){Z.bindFramebuffer(xt.FRAMEBUFFER,a);try{const o=t.texture,a=o.format,l=o.type;if(!K.textureFormatReadable(a))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!K.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&xt.readPixels(e,n,i,r,vt.convert(a),vt.convert(l),s)}finally{const t=null!==w?tt.get(w).__webglFramebuffer:null;Z.bindFramebuffer(xt.FRAMEBUFFER,t)}}},this.readRenderTargetPixelsAsync=async function(t,e,n,i,r,s,o){if(!t||!t.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=tt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){const o=t.texture,l=o.format,c=o.type;if(!K.textureFormatReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!K.textureTypeReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r){Z.bindFramebuffer(xt.FRAMEBUFFER,a);const t=xt.createBuffer();xt.bindBuffer(xt.PIXEL_PACK_BUFFER,t),xt.bufferData(xt.PIXEL_PACK_BUFFER,s.byteLength,xt.STREAM_READ),xt.readPixels(e,n,i,r,vt.convert(l),vt.convert(c),0);const o=null!==w?tt.get(w).__webglFramebuffer:null;Z.bindFramebuffer(xt.FRAMEBUFFER,o);const h=xt.fenceSync(xt.SYNC_GPU_COMMANDS_COMPLETE,0);return xt.flush(),await function(t,e){return new Promise((function(n,i){setTimeout((function r(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:i();break;case t.TIMEOUT_EXPIRED:setTimeout(r,4);break;default:n()}}),4)}))}(xt,h),xt.bindBuffer(xt.PIXEL_PACK_BUFFER,t),xt.getBufferSubData(xt.PIXEL_PACK_BUFFER,0,s),xt.deleteBuffer(t),xt.deleteSync(h),s}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(t,e=null,n=0){!0!==t.isTexture&&(kr("WebGLRenderer: copyFramebufferToTexture function signature has changed."),e=arguments[0]||null,t=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),s=Math.floor(t.image.height*i),o=null!==e?e.x:0,a=null!==e?e.y:0;et.setTexture2D(t,0),xt.copyTexSubImage2D(xt.TEXTURE_2D,n,0,0,o,a,r,s),Z.unbindTexture()};const Xt=xt.createFramebuffer(),Yt=xt.createFramebuffer();this.copyTextureToTexture=function(t,e,n=null,i=null,r=0,s=null){let o,a,l,c,h,u,d,p,A;!0!==t.isTexture&&(kr("WebGLRenderer: copyTextureToTexture function signature has changed."),i=arguments[0]||null,t=arguments[1],e=arguments[2],s=arguments[3]||0,n=null),null===s&&(0!==r?(kr("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),s=r,r=0):s=0);const f=t.isCompressedTexture?t.mipmaps[s]:t.image;if(null!==n)o=n.max.x-n.min.x,a=n.max.y-n.min.y,l=n.isBox3?n.max.z-n.min.z:1,c=n.min.x,h=n.min.y,u=n.isBox3?n.min.z:0;else{const e=Math.pow(2,-r);o=Math.floor(f.width*e),a=Math.floor(f.height*e),l=t.isDataArrayTexture?f.depth:t.isData3DTexture?Math.floor(f.depth*e):1,c=0,h=0,u=0}null!==i?(d=i.x,p=i.y,A=i.z):(d=0,p=0,A=0);const m=vt.convert(e.format),g=vt.convert(e.type);let v;e.isData3DTexture?(et.setTexture3D(e,0),v=xt.TEXTURE_3D):e.isDataArrayTexture||e.isCompressedArrayTexture?(et.setTexture2DArray(e,0),v=xt.TEXTURE_2D_ARRAY):(et.setTexture2D(e,0),v=xt.TEXTURE_2D),xt.pixelStorei(xt.UNPACK_FLIP_Y_WEBGL,e.flipY),xt.pixelStorei(xt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),xt.pixelStorei(xt.UNPACK_ALIGNMENT,e.unpackAlignment);const y=xt.getParameter(xt.UNPACK_ROW_LENGTH),E=xt.getParameter(xt.UNPACK_IMAGE_HEIGHT),x=xt.getParameter(xt.UNPACK_SKIP_PIXELS),b=xt.getParameter(xt.UNPACK_SKIP_ROWS),C=xt.getParameter(xt.UNPACK_SKIP_IMAGES);xt.pixelStorei(xt.UNPACK_ROW_LENGTH,f.width),xt.pixelStorei(xt.UNPACK_IMAGE_HEIGHT,f.height),xt.pixelStorei(xt.UNPACK_SKIP_PIXELS,c),xt.pixelStorei(xt.UNPACK_SKIP_ROWS,h),xt.pixelStorei(xt.UNPACK_SKIP_IMAGES,u);const w=t.isDataArrayTexture||t.isData3DTexture,_=e.isDataArrayTexture||e.isData3DTexture;if(t.isDepthTexture){const n=tt.get(t),i=tt.get(e),f=tt.get(n.__renderTarget),m=tt.get(i.__renderTarget);Z.bindFramebuffer(xt.READ_FRAMEBUFFER,f.__webglFramebuffer),Z.bindFramebuffer(xt.DRAW_FRAMEBUFFER,m.__webglFramebuffer);for(let n=0;n<l;n++)w&&(xt.framebufferTextureLayer(xt.READ_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,tt.get(t).__webglTexture,r,u+n),xt.framebufferTextureLayer(xt.DRAW_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,tt.get(e).__webglTexture,s,A+n)),xt.blitFramebuffer(c,h,o,a,d,p,o,a,xt.DEPTH_BUFFER_BIT,xt.NEAREST);Z.bindFramebuffer(xt.READ_FRAMEBUFFER,null),Z.bindFramebuffer(xt.DRAW_FRAMEBUFFER,null)}else if(0!==r||t.isRenderTargetTexture||tt.has(t)){const n=tt.get(t),i=tt.get(e);Z.bindFramebuffer(xt.READ_FRAMEBUFFER,Xt),Z.bindFramebuffer(xt.DRAW_FRAMEBUFFER,Yt);for(let t=0;t<l;t++)w?xt.framebufferTextureLayer(xt.READ_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,n.__webglTexture,r,u+t):xt.framebufferTexture2D(xt.READ_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,xt.TEXTURE_2D,n.__webglTexture,r),_?xt.framebufferTextureLayer(xt.DRAW_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,i.__webglTexture,s,A+t):xt.framebufferTexture2D(xt.DRAW_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,xt.TEXTURE_2D,i.__webglTexture,s),0!==r?xt.blitFramebuffer(c,h,o,a,d,p,o,a,xt.COLOR_BUFFER_BIT,xt.NEAREST):_?xt.copyTexSubImage3D(v,s,d,p,A+t,c,h,o,a):xt.copyTexSubImage2D(v,s,d,p,c,h,o,a);Z.bindFramebuffer(xt.READ_FRAMEBUFFER,null),Z.bindFramebuffer(xt.DRAW_FRAMEBUFFER,null)}else _?t.isDataTexture||t.isData3DTexture?xt.texSubImage3D(v,s,d,p,A,o,a,l,m,g,f.data):e.isCompressedArrayTexture?xt.compressedTexSubImage3D(v,s,d,p,A,o,a,l,m,f.data):xt.texSubImage3D(v,s,d,p,A,o,a,l,m,g,f):t.isDataTexture?xt.texSubImage2D(xt.TEXTURE_2D,s,d,p,o,a,m,g,f.data):t.isCompressedTexture?xt.compressedTexSubImage2D(xt.TEXTURE_2D,s,d,p,f.width,f.height,m,f.data):xt.texSubImage2D(xt.TEXTURE_2D,s,d,p,o,a,m,g,f);xt.pixelStorei(xt.UNPACK_ROW_LENGTH,y),xt.pixelStorei(xt.UNPACK_IMAGE_HEIGHT,E),xt.pixelStorei(xt.UNPACK_SKIP_PIXELS,x),xt.pixelStorei(xt.UNPACK_SKIP_ROWS,b),xt.pixelStorei(xt.UNPACK_SKIP_IMAGES,C),0===s&&e.generateMipmaps&&xt.generateMipmap(v),Z.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n=null,i=null,r=0){return!0!==t.isTexture&&(kr("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,i=arguments[1]||null,t=arguments[2],e=arguments[3],r=arguments[4]||0),kr('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(t,e,n,i,r)},this.initRenderTarget=function(t){void 0===tt.get(t).__webglFramebuffer&&et.setupRenderTarget(t)},this.initTexture=function(t){t.isCubeTexture?et.setTextureCube(t,0):t.isData3DTexture?et.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?et.setTexture2DArray(t,0):et.setTexture2D(t,0),Z.unbindTexture()},this.resetState=function(){b=0,C=0,w=null,Z.reset(),yt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ar}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorspace=zr._getDrawingBufferColorSpace(t),e.unpackColorSpace=zr._getUnpackColorSpace()}}const Fm=new WeakMap;function km(){let t,e;function n(t,e,n,i,r,s){const o=s.num_components(),a=n.num_points()*o,l=a*r.BYTES_PER_ELEMENT,c=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32}}(t,r),h=t._malloc(l);e.GetAttributeDataArrayForAllPoints(n,s,c,l,h);const u=new r(t.HEAPF32.buffer,h,a).slice();return t._free(h),{name:i,array:u,itemSize:o}}onmessage=function(i){const r=i.data;switch(r.type){case"init":t=r.decoderConfig,e=new Promise((function(e){t.onModuleLoaded=function(t){e({draco:t})},DracoDecoderModule(t)}));break;case"decode":const i=r.buffer,s=r.taskConfig;e.then((t=>{const e=t.draco,o=new e.Decoder;try{const t=function(t,e,i,r){const s=r.attributeIDs,o=r.attributeTypes;let a,l;const c=e.GetEncodedGeometryType(i);if(c===t.TRIANGULAR_MESH)a=new t.Mesh,l=e.DecodeArrayToMesh(i,i.byteLength,a);else{if(c!==t.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new t.PointCloud,l=e.DecodeArrayToPointCloud(i,i.byteLength,a)}if(!l.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in s){const l=self[o[i]];let c,u;if(r.useUniqueIDs)u=s[i],c=e.GetAttributeByUniqueId(a,u);else{if(u=e.GetAttributeId(a,t[s[i]]),-1===u)continue;c=e.GetAttribute(a,u)}const d=n(t,e,a,i,l,c);"color"===i&&(d.vertexColorSpace=r.vertexColorSpace),h.attributes.push(d)}return c===t.TRIANGULAR_MESH&&(h.index=function(t,e,n){const i=3*n.num_faces(),r=4*i,s=t._malloc(r);e.GetTrianglesUInt32Array(n,r,s);const o=new Uint32Array(t.HEAPF32.buffer,s,i).slice();return t._free(s),{array:o,itemSize:1}}(t,e,a)),t.destroy(a),h}(e,o,new Int8Array(i),s),a=t.attributes.map((t=>t.array.buffer));t.index&&a.push(t.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:t},a)}catch(t){console.error(t),self.postMessage({type:"error",id:r.id,error:t.message})}finally{e.destroy(o)}}))}}}function Nm(t,e,n=!0){if(!e||!e.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!t.hasAttribute("position")||!t.hasAttribute("normal")||!t.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function i(t){if(t.normalized||t.isInterleavedBufferAttribute){const e=new Float32Array(t.count*t.itemSize);for(let n=0,i=0;n<t.count;n++)e[i++]=t.getX(n),e[i++]=t.getY(n),t.itemSize>2&&(e[i++]=t.getZ(n));return e}return t.array instanceof Float32Array?t.array:new Float32Array(t.array)}const r=t.index?t.toNonIndexed():t,s=e.generateTangents(i(r.attributes.position),i(r.attributes.normal),i(r.attributes.uv));if(n)for(let t=3;t<s.length;t+=4)s[t]*=-1;return r.setAttribute("tangent",new zo(s,4)),t!==r&&t.copy(r),t}function Qm(t,e=!1){const n=null!==t[0].index,i=new Set(Object.keys(t[0].attributes)),r=new Set(Object.keys(t[0].morphAttributes)),s={},o={},a=t[0].morphTargetsRelative,l=new sa;let c=0;for(let h=0;h<t.length;++h){const u=t[h];let d=0;if(n!==(null!==u.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const t in u.attributes){if(!i.has(t))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+t+'" attribute exists among all geometries, or in none of them.'),null;void 0===s[t]&&(s[t]=[]),s[t].push(u.attributes[t]),d++}if(d!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const t in u.morphAttributes){if(!r.has(t))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;void 0===o[t]&&(o[t]=[]),o[t].push(u.morphAttributes[t])}if(e){let t;if(n)t=u.index.count;else{if(void 0===u.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;t=u.attributes.position.count}l.addGroup(c,t,h),c+=t}}if(n){let e=0;const n=[];for(let i=0;i<t.length;++i){const r=t[i].index;for(let t=0;t<r.count;++t)n.push(r.getX(t)+e);e+=t[i].attributes.position.count}l.setIndex(n)}for(const t in s){const e=Gm(s[t]);if(!e)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+t+" attribute."),null;l.setAttribute(t,e)}for(const t in o){const e=o[t][0].length;if(0===e)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[t]=[];for(let n=0;n<e;++n){const e=[];for(let i=0;i<o[t].length;++i)e.push(o[t][i][n]);const i=Gm(e);if(!i)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+t+" morphAttribute."),null;l.morphAttributes[t].push(i)}}return l}function Gm(t){let e,n,i,r=-1,s=0;for(let o=0;o<t.length;++o){const a=t[o];if(void 0===e&&(e=a.array.constructor),e!==a.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===n&&(n=a.itemSize),n!==a.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===i&&(i=a.normalized),i!==a.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===r&&(r=a.gpuType),r!==a.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=a.count*n}const o=new e(s),a=new zo(o,n,i);let l=0;for(let e=0;e<t.length;++e){const i=t[e];if(i.isInterleavedBufferAttribute){const t=l/n;for(let e=0,r=i.count;e<r;e++)for(let r=0;r<n;r++){const n=i.getComponent(e,r);a.setComponent(e+t,r,n)}}else o.set(i.array,l);l+=i.count*n}return void 0!==r&&(a.gpuType=r),a}function zm(t){return t.isInstancedInterleavedBufferAttribute||t.isInterleavedBufferAttribute?Vm(t):t.isInstancedBufferAttribute?(new Cl).copy(t):(new zo).copy(t)}function Hm(t){let e,n=0,i=0;for(let r=0,s=t.length;r<s;++r){const s=t[r];if(void 0===e&&(e=s.array.constructor),e!==s.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;n+=s.array.length,i+=s.itemSize}const r=new Qa(new e(n),i);let s=0;const o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let e=0,n=t.length;e<n;e++){const n=t[e],i=n.itemSize,c=n.count,h=new za(r,i,s,n.normalized);o.push(h),s+=i;for(let t=0;t<c;t++)for(let e=0;e<i;e++)h[l[e]](t,n[a[e]](t))}return o}function Vm(t){const e=t.data.array.constructor,n=t.count,i=t.itemSize,r=t.normalized,s=new e(n*i);let o;o=t.isInstancedInterleavedBufferAttribute?new Cl(s,i,r,t.meshPerAttribute):new zo(s,i,r);for(let e=0;e<n;e++)o.setX(e,t.getX(e)),i>=2&&o.setY(e,t.getY(e)),i>=3&&o.setZ(e,t.getZ(e)),i>=4&&o.setW(e,t.getW(e));return o}function jm(t){const e=t.attributes,n=t.morphTargets,i=new Map;for(const t in e){const n=e[t];n.isInterleavedBufferAttribute&&(i.has(n)||i.set(n,Vm(n)),e[t]=i.get(n))}for(const t in n){const e=n[t];e.isInterleavedBufferAttribute&&(i.has(e)||i.set(e,Vm(e)),n[t]=i.get(e))}}function Wm(t){let e=0;for(const n in t.attributes){const i=t.getAttribute(n);e+=i.count*i.itemSize*i.array.BYTES_PER_ELEMENT}const n=t.getIndex();return e+=n?n.count*n.itemSize*n.array.BYTES_PER_ELEMENT:0,e}function qm(t,e=1e-4){e=Math.max(e,Number.EPSILON);const n={},i=t.getIndex(),r=t.getAttribute("position"),s=i?i.count:r.count;let o=0;const a=Object.keys(t.attributes),l={},c={},h=[],u=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"];for(let e=0,n=a.length;e<n;e++){const n=a[e],i=t.attributes[n];l[n]=new i.constructor(new i.array.constructor(i.count*i.itemSize),i.itemSize,i.normalized);const r=t.morphAttributes[n];r&&(c[n]||(c[n]=[]),r.forEach(((t,e)=>{const i=new t.array.constructor(t.count*t.itemSize);c[n][e]=new t.constructor(i,t.itemSize,t.normalized)})))}const p=.5*e,A=Math.log10(1/e),f=Math.pow(10,A),m=p*f;for(let e=0;e<s;e++){const r=i?i.getX(e):e;let s="";for(let e=0,n=a.length;e<n;e++){const n=a[e],i=t.getAttribute(n),o=i.itemSize;for(let t=0;t<o;t++)s+=~~(i[u[t]](r)*f+m)+","}if(s in n)h.push(n[s]);else{for(let e=0,n=a.length;e<n;e++){const n=a[e],i=t.getAttribute(n),s=t.morphAttributes[n],h=i.itemSize,p=l[n],A=c[n];for(let t=0;t<h;t++){const e=u[t],n=d[t];if(p[n](o,i[e](r)),s)for(let t=0,i=s.length;t<i;t++)A[t][n](o,s[t][e](r))}}n[s]=o,h.push(o),o++}}const g=t.clone();for(const e in t.attributes){const t=l[e];if(g.setAttribute(e,new t.constructor(t.array.slice(0,o*t.itemSize),t.itemSize,t.normalized)),e in c)for(let t=0;t<c[e].length;t++){const n=c[e][t];g.morphAttributes[e][t]=new n.constructor(n.array.slice(0,o*n.itemSize),n.itemSize,n.normalized)}}return g.setIndex(h),g}function Xm(t,e){if(e===yi)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===xi||e===Ei){let n=t.getIndex();if(null===n){const e=[],i=t.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(let t=0;t<i.count;t++)e.push(t);t.setIndex(e),n=t.getIndex()}const i=n.count-2,r=[];if(e===xi)for(let t=1;t<=i;t++)r.push(n.getX(0)),r.push(n.getX(t)),r.push(n.getX(t+1));else for(let t=0;t<i;t++)t%2==0?(r.push(n.getX(t)),r.push(n.getX(t+1)),r.push(n.getX(t+2))):(r.push(n.getX(t+2)),r.push(n.getX(t+1)),r.push(n.getX(t)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=t.clone();return s.setIndex(r),s.clearGroups(),s}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t}function Ym(t){const e=new os,n=new os,i=new os,r=new os,s=new os,o=new os,a=new os,l=new os,c=new os;function h(t,h,u,d,p,A,f,m){e.fromBufferAttribute(h,p),n.fromBufferAttribute(h,A),i.fromBufferAttribute(h,f);const g=t.morphTargetInfluences;if(u&&g){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let t=0,h=u.length;t<h;t++){const h=g[t],m=u[t];0!==h&&(r.fromBufferAttribute(m,p),s.fromBufferAttribute(m,A),o.fromBufferAttribute(m,f),d?(a.addScaledVector(r,h),l.addScaledVector(s,h),c.addScaledVector(o,h)):(a.addScaledVector(r.sub(e),h),l.addScaledVector(s.sub(n),h),c.addScaledVector(o.sub(i),h)))}e.add(a),n.add(l),i.add(c)}t.isSkinnedMesh&&(t.applyBoneTransform(p,e),t.applyBoneTransform(A,n),t.applyBoneTransform(f,i)),m[3*p+0]=e.x,m[3*p+1]=e.y,m[3*p+2]=e.z,m[3*A+0]=n.x,m[3*A+1]=n.y,m[3*A+2]=n.z,m[3*f+0]=i.x,m[3*f+1]=i.y,m[3*f+2]=i.z}const u=t.geometry,d=t.material;let p,A,f;const m=u.index,g=u.attributes.position,v=u.morphAttributes.position,y=u.morphTargetsRelative,E=u.attributes.normal,x=u.morphAttributes.position,b=u.groups,C=u.drawRange;let w,_,M,S,I,B,T;const R=new Float32Array(g.count*g.itemSize),L=new Float32Array(E.count*E.itemSize);if(null!==m)if(Array.isArray(d))for(w=0,M=b.length;w<M;w++)for(I=b[w],B=Math.max(I.start,C.start),T=Math.min(I.start+I.count,C.start+C.count),_=B,S=T;_<S;_+=3)p=m.getX(_),A=m.getX(_+1),f=m.getX(_+2),h(t,g,v,y,p,A,f,R),h(t,E,x,y,p,A,f,L);else for(B=Math.max(0,C.start),T=Math.min(m.count,C.start+C.count),w=B,M=T;w<M;w+=3)p=m.getX(w),A=m.getX(w+1),f=m.getX(w+2),h(t,g,v,y,p,A,f,R),h(t,E,x,y,p,A,f,L);else if(Array.isArray(d))for(w=0,M=b.length;w<M;w++)for(I=b[w],B=Math.max(I.start,C.start),T=Math.min(I.start+I.count,C.start+C.count),_=B,S=T;_<S;_+=3)p=_,A=_+1,f=_+2,h(t,g,v,y,p,A,f,R),h(t,E,x,y,p,A,f,L);else for(B=Math.max(0,C.start),T=Math.min(g.count,C.start+C.count),w=B,M=T;w<M;w+=3)p=w,A=w+1,f=w+2,h(t,g,v,y,p,A,f,R),h(t,E,x,y,p,A,f,L);return{positionAttribute:g,normalAttribute:E,morphedPositionAttribute:new Ko(R,3),morphedNormalAttribute:new Ko(L,3)}}function Jm(t){if(0===t.groups.length)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),t;let e=t.groups;if(e=e.sort(((t,e)=>t.materialIndex!==e.materialIndex?t.materialIndex-e.materialIndex:t.start-e.start)),null===t.getIndex()){const e=t.getAttribute("position"),n=[];for(let t=0;t<e.count;t+=3)n.push(t,t+1,t+2);t.setIndex(n)}const n=t.getIndex(),i=[];for(let t=0;t<e.length;t++){const r=e[t],s=r.start,o=s+r.count;for(let t=s;t<o;t++)i.push(n.getX(t))}t.dispose(),t.setIndex(i);let r=0;for(let t=0;t<e.length;t++){const n=e[t];n.start=r,r+=n.count}let s=e[0];t.groups=[s];for(let n=1;n<e.length;n++){const i=e[n];s.materialIndex===i.materialIndex?s.count+=i.count:(s=i,t.groups.push(s))}return t}function Km(t,e=Math.PI/3){const n=Math.cos(e),i=100*(1+1e-10),r=[new os,new os,new os],s=new os,o=new os,a=new os,l=new os;function c(t){return`${~~(t.x*i)},${~~(t.y*i)},${~~(t.z*i)}`}const h=t.index?t.toNonIndexed():t,u=h.attributes.position,d={};for(let t=0,e=u.count/3;t<e;t++){const e=3*t,n=r[0].fromBufferAttribute(u,e+0),i=r[1].fromBufferAttribute(u,e+1),a=r[2].fromBufferAttribute(u,e+2);s.subVectors(a,i),o.subVectors(n,i);const l=(new os).crossVectors(s,o).normalize();for(let t=0;t<3;t++){const e=c(r[t]);e in d||(d[e]=[]),d[e].push(l)}}const p=new Float32Array(3*u.count),A=new zo(p,3,!1);for(let t=0,e=u.count/3;t<e;t++){const e=3*t,i=r[0].fromBufferAttribute(u,e+0),h=r[1].fromBufferAttribute(u,e+1),p=r[2].fromBufferAttribute(u,e+2);s.subVectors(p,h),o.subVectors(i,h),a.crossVectors(s,o).normalize();for(let t=0;t<3;t++){const i=d[c(r[t])];l.set(0,0,0);for(let t=0,e=i.length;t<e;t++){const e=i[t];a.dot(e)>n&&l.add(e)}l.normalize(),A.setXYZ(e+t,l.x,l.y,l.z)}}return h.setAttribute("normal",A),h}function Zm(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const $m="KHR_binary_glTF",tg="KHR_draco_mesh_compression",eg="KHR_lights_punctual",ng="KHR_materials_clearcoat",ig="KHR_materials_dispersion",rg="KHR_materials_ior",sg="KHR_materials_sheen",og="KHR_materials_specular",ag="KHR_materials_transmission",lg="KHR_materials_iridescence",cg="KHR_materials_anisotropy",hg="KHR_materials_unlit",ug="KHR_materials_volume",dg="KHR_texture_basisu",pg="KHR_texture_transform",Ag="KHR_mesh_quantization",fg="KHR_materials_emissive_strength",mg="EXT_materials_bump",gg="EXT_texture_webp",vg="EXT_texture_avif",yg="EXT_meshopt_compression",Eg="EXT_mesh_gpu_instancing";class xg{constructor(t){this.parser=t,this.name=eg,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let n=0,i=e.length;n<i;n++){const i=e[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&t._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(t){const e=this.parser,n="light:"+t;let i=e.cache.get(n);if(i)return i;const r=e.json,s=((r.extensions&&r.extensions[this.name]||{}).lights||[])[t];let o;const a=new Bo(16777215);void 0!==s.color&&a.setRGB(s.color[0],s.color[1],s.color[2],Ti);const l=void 0!==s.range?s.range:0;switch(s.type){case"directional":o=new ad(a),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new rd(a),o.distance=l;break;case"spot":o=new $u(a),o.distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,o.angle=s.spot.outerConeAngle,o.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return o.position.set(0,0,0),iv(o,s),void 0!==s.intensity&&(o.intensity=s.intensity),o.name=e.createUniqueName(s.name||"light_"+t),i=Promise.resolve(o),e.cache.add(n,i),i}getDependency(t,e){if("light"===t)return this._loadLight(e)}createNodeAttachment(t){const e=this,n=this.parser,i=n.json.nodes[t],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(t){return n._getNodeRef(e.cache,r,t)}))}}class bg{constructor(){this.name=hg}getMaterialType(){return Do}extendParams(t,e,n){const i=[];t.color=new Bo(1,1,1),t.opacity=1;const r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;t.color.setRGB(e[0],e[1],e[2],Ti),t.opacity=e[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(t,"map",r.baseColorTexture,Bi))}return Promise.all(i)}}class Cg{constructor(t){this.parser=t,this.name=fg}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return void 0!==i&&(e.emissiveIntensity=i),Promise.resolve()}}class wg{constructor(t){this.parser=t,this.name=ng}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];if(void 0!==s.clearcoatFactor&&(e.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&r.push(n.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&r.push(n.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(r.push(n.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){const t=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new Br(t,t)}return Promise.all(r)}}class _g{constructor(t){this.parser=t,this.name=ig}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return e.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class Mg{constructor(t){this.parser=t,this.name=lg}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.iridescenceFactor&&(e.iridescence=s.iridescenceFactor),void 0!==s.iridescenceTexture&&r.push(n.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),void 0!==s.iridescenceIor&&(e.iridescenceIOR=s.iridescenceIor),void 0===e.iridescenceThicknessRange&&(e.iridescenceThicknessRange=[100,400]),void 0!==s.iridescenceThicknessMinimum&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),void 0!==s.iridescenceThicknessMaximum&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),void 0!==s.iridescenceThicknessTexture&&r.push(n.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class Sg{constructor(t){this.parser=t,this.name=sg}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];e.sheenColor=new Bo(0,0,0),e.sheenRoughness=0,e.sheen=1;const s=i.extensions[this.name];if(void 0!==s.sheenColorFactor){const t=s.sheenColorFactor;e.sheenColor.setRGB(t[0],t[1],t[2],Ti)}return void 0!==s.sheenRoughnessFactor&&(e.sheenRoughness=s.sheenRoughnessFactor),void 0!==s.sheenColorTexture&&r.push(n.assignTexture(e,"sheenColorMap",s.sheenColorTexture,Bi)),void 0!==s.sheenRoughnessTexture&&r.push(n.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(r)}}class Ig{constructor(t){this.parser=t,this.name=ag}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.transmissionFactor&&(e.transmission=s.transmissionFactor),void 0!==s.transmissionTexture&&r.push(n.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class Bg{constructor(t){this.parser=t,this.name=ug}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];e.thickness=void 0!==s.thicknessFactor?s.thicknessFactor:0,void 0!==s.thicknessTexture&&r.push(n.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const o=s.attenuationColor||[1,1,1];return e.attenuationColor=(new Bo).setRGB(o[0],o[1],o[2],Ti),Promise.all(r)}}class Tg{constructor(t){this.parser=t,this.name=rg}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return e.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class Rg{constructor(t){this.parser=t,this.name=og}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];e.specularIntensity=void 0!==s.specularFactor?s.specularFactor:1,void 0!==s.specularTexture&&r.push(n.assignTexture(e,"specularIntensityMap",s.specularTexture));const o=s.specularColorFactor||[1,1,1];return e.specularColor=(new Bo).setRGB(o[0],o[1],o[2],Ti),void 0!==s.specularColorTexture&&r.push(n.assignTexture(e,"specularColorMap",s.specularColorTexture,Bi)),Promise.all(r)}}class Lg{constructor(t){this.parser=t,this.name=mg}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return e.bumpScale=void 0!==s.bumpFactor?s.bumpFactor:1,void 0!==s.bumpTexture&&r.push(n.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(r)}}class Dg{constructor(t){this.parser=t,this.name=cg}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.anisotropyStrength&&(e.anisotropy=s.anisotropyStrength),void 0!==s.anisotropyRotation&&(e.anisotropyRotation=s.anisotropyRotation),void 0!==s.anisotropyTexture&&r.push(n.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class Pg{constructor(t){this.parser=t,this.name=dg}loadTexture(t){const e=this.parser,n=e.json,i=n.textures[t];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],s=e.options.ktx2Loader;if(!s){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,s)}}class Ug{constructor(t){this.parser=t,this.name=gg,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,i=n.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],o=i.images[s.source];let a=n.textureLoader;if(o.uri){const t=n.options.manager.getHandler(o.uri);null!==t&&(a=t)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(t,s.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class Og{constructor(t){this.parser=t,this.name=vg,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,i=n.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],o=i.images[s.source];let a=n.textureLoader;if(o.uri){const t=n.options.manager.getHandler(o.uri);null!==t&&(a=t)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(t,s.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class Fg{constructor(t){this.name=yg,this.parser=t}loadBufferView(t){const e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){const t=n.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(e){const n=t.byteOffset||0,i=t.byteLength||0,s=t.count,o=t.byteStride,a=new Uint8Array(e,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(s,o,a,t.mode,t.filter).then((function(t){return t.buffer})):r.ready.then((function(){const e=new ArrayBuffer(s*o);return r.decodeGltfBuffer(new Uint8Array(e),s,o,a,t.mode,t.filter),e}))}))}return null}}class kg{constructor(t){this.name=Eg,this.parser=t}createNodeMesh(t){const e=this.parser.json,n=e.nodes[t];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=e.meshes[n.mesh];for(const t of i.primitives)if(t.mode!==qg.TRIANGLES&&t.mode!==qg.TRIANGLE_STRIP&&t.mode!==qg.TRIANGLE_FAN&&void 0!==t.mode)return null;const r=n.extensions[this.name].attributes,s=[],o={};for(const t in r)s.push(this.parser.getDependency("accessor",r[t]).then((e=>(o[t]=e,o[t]))));return s.length<1?null:(s.push(this.parser.createNodeMesh(t)),Promise.all(s).then((t=>{const e=t.pop(),n=e.isGroup?e.children:[e],i=t[0].count,r=[];for(const t of n){const e=new Os,n=new os,s=new ss,a=new os(1,1,1),l=new Rl(t.geometry,t.material,i);for(let t=0;t<i;t++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,t),o.ROTATION&&s.fromBufferAttribute(o.ROTATION,t),o.SCALE&&a.fromBufferAttribute(o.SCALE,t),l.setMatrixAt(t,e.compose(n,s,a));for(const e in o)if("_COLOR_0"===e){const t=o[e];l.instanceColor=new Cl(t.array,t.itemSize,t.normalized)}else"TRANSLATION"!==e&&"ROTATION"!==e&&"SCALE"!==e&&t.geometry.setAttribute(e,o[e]);co.prototype.copy.call(l,t),this.parser.assignFinalMaterial(l),r.push(l)}return e.isGroup?(e.clear(),e.add(...r),e):r[0]})))}}const Ng="glTF";class Qg{constructor(t){this.name=$m,this.content=null,this.body=null;const e=new DataView(t,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Ng)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,r=new DataView(t,12);let s=0;for(;s<i;){const e=r.getUint32(s,!0);s+=4;const i=r.getUint32(s,!0);if(s+=4,1313821514===i){const i=new Uint8Array(t,12+s,e);this.content=n.decode(i)}else if(5130562===i){const n=12+s;this.body=t.slice(n,n+e)}s+=e}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Gg{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=tg,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const n=this.json,i=this.dracoLoader,r=t.extensions[this.name].bufferView,s=t.extensions[this.name].attributes,o={},a={},l={};for(const t in s){const e=Zg[t]||t.toLowerCase();o[e]=s[t]}for(const e in t.attributes){const i=Zg[e]||e.toLowerCase();if(void 0!==s[e]){const r=n.accessors[t.attributes[e]],s=Xg[r.componentType];l[i]=s.name,a[i]=!0===r.normalized}}return e.getDependency("bufferView",r).then((function(t){return new Promise((function(e,n){i.decodeDracoFile(t,(function(t){for(const e in t.attributes){const n=t.attributes[e],i=a[e];void 0!==i&&(n.normalized=i)}e(t)}),o,l,Ti,n)}))}))}}class zg{constructor(){this.name=pg}extendTexture(t,e){return void 0!==e.texCoord&&e.texCoord!==t.channel||void 0!==e.offset||void 0!==e.rotation||void 0!==e.scale?(t=t.clone(),void 0!==e.texCoord&&(t.channel=e.texCoord),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0,t):t}}class Hg{constructor(){this.name=Ag}}class Vg extends yu{constructor(t,e,n,i){super(t,e,n,i)}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i*3+i;for(let t=0;t!==i;t++)e[t]=n[r+t];return e}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=2*o,l=3*o,c=i-e,h=(n-e)/c,u=h*h,d=u*h,p=t*l,A=p-l,f=-2*d+3*u,m=d-u,g=1-f,v=m-u+h;for(let t=0;t!==o;t++){const e=s[A+t+o],n=s[A+t+a]*c,i=s[p+t+o],l=s[p+t]*c;r[t]=g*e+v*n+f*i+m*l}return r}}const jg=new ss;class Wg extends Vg{interpolate_(t,e,n,i){const r=super.interpolate_(t,e,n,i);return jg.fromArray(r).normalize().toArray(r),r}}const qg={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Xg={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Yg={9728:Xe,9729:$e,9984:Ye,9985:tn,9986:Ke,9987:nn},Jg={33071:We,33648:qe,10497:je},Kg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Zg={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},$g={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},tv={CUBICSPLINE:void 0,LINEAR:di,STEP:ui};function ev(t){return void 0===t.DefaultMaterial&&(t.DefaultMaterial=new iu({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Ht})),t.DefaultMaterial}function nv(t,e,n){for(const i in n.extensions)void 0===t[i]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=n.extensions[i])}function iv(t,e){void 0!==e.extras&&("object"==typeof e.extras?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function rv(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(let n=0,i=e.weights.length;n<i;n++)t.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){const n=e.extras.targetNames;if(t.morphTargetInfluences.length===n.length){t.morphTargetDictionary={};for(let e=0,i=n.length;e<i;e++)t.morphTargetDictionary[n[e]]=e}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function sv(t){let e;const n=t.extensions&&t.extensions[tg];if(e=n?"draco:"+n.bufferView+":"+n.indices+":"+ov(n.attributes):t.indices+":"+ov(t.attributes)+":"+t.mode,void 0!==t.targets)for(let n=0,i=t.targets.length;n<i;n++)e+=":"+ov(t.targets[n]);return e}function ov(t){let e="";const n=Object.keys(t).sort();for(let i=0,r=n.length;i<r;i++)e+=n[i]+":"+t[n[i]]+";";return e}function av(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const lv=new Os;class cv{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new Zm,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,s=-1;if("undefined"!=typeof navigator){const t=navigator.userAgent;n=!0===/^((?!chrome|android).)*safari/i.test(t);const e=t.match(/Version\/(\d+)/);i=n&&e?parseInt(e[1],10):-1,r=t.indexOf("Firefox")>-1,s=r?t.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||n&&i<17||r&&s<98?this.textureLoader=new ju(this.options.manager):this.textureLoader=new Ed(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Nu(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(e){const s={scene:e[0][i.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:i.asset,parser:n,userData:{}};return nv(r,s,i),iv(s,i),Promise.all(n._invokeAll((function(t){return t.afterRoot&&t.afterRoot(s)}))).then((function(){for(const t of s.scenes)t.updateMatrixWorld();t(s)}))})).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=e.length;n<i;n++){const i=e[n].joints;for(let e=0,n=i.length;e<n;e++)t[i[e]].isBone=!0}for(let e=0,i=t.length;e<i;e++){const i=t[e];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(n[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,n){if(t.refs[e]<=1)return n;const i=n.clone(),r=(t,e)=>{const n=this.associations.get(t);null!=n&&this.associations.set(e,n);for(const[n,i]of t.children.entries())r(i,e.children[n])};return r(n,i),i.name+="_instance_"+t.uses[e]++,i}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let n=0;n<e.length;n++){const i=t(e[n]);if(i)return i}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const n=[];for(let i=0;i<e.length;i++){const r=t(e[i]);r&&n.push(r)}return n}getDependency(t,e){const n=t+":"+e;let i=this.cache.get(n);if(!i){switch(t){case"scene":i=this.loadScene(e);break;case"node":i=this._invokeOne((function(t){return t.loadNode&&t.loadNode(e)}));break;case"mesh":i=this._invokeOne((function(t){return t.loadMesh&&t.loadMesh(e)}));break;case"accessor":i=this.loadAccessor(e);break;case"bufferView":i=this._invokeOne((function(t){return t.loadBufferView&&t.loadBufferView(e)}));break;case"buffer":i=this.loadBuffer(e);break;case"material":i=this._invokeOne((function(t){return t.loadMaterial&&t.loadMaterial(e)}));break;case"texture":i=this._invokeOne((function(t){return t.loadTexture&&t.loadTexture(e)}));break;case"skin":i=this.loadSkin(e);break;case"animation":i=this._invokeOne((function(t){return t.loadAnimation&&t.loadAnimation(e)}));break;case"camera":i=this.loadCamera(e);break;default:if(i=this._invokeOne((function(n){return n!=this&&n.getDependency&&n.getDependency(t,e)})),!i)throw new Error("Unknown type: "+t)}this.cache.add(n,i)}return i}getDependencies(t){let e=this.cache.get(t);if(!e){const n=this,i=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(i.map((function(e,i){return n.getDependency(t,i)}))),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],n=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[$m].body);const i=this.options;return new Promise((function(t,r){n.load(pd.resolveURL(e.uri,i.path),t,void 0,(function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))}))}))}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){const n=e.byteLength||0,i=e.byteOffset||0;return t.slice(i,i+n)}))}loadAccessor(t){const e=this,n=this.json,i=this.json.accessors[t];if(void 0===i.bufferView&&void 0===i.sparse){const t=Kg[i.type],e=Xg[i.componentType],n=!0===i.normalized,r=new e(i.count*t);return Promise.resolve(new zo(r,t,n))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then((function(t){const r=t[0],s=Kg[i.type],o=Xg[i.componentType],a=o.BYTES_PER_ELEMENT,l=a*s,c=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,u=!0===i.normalized;let d,p;if(h&&h!==l){const t=Math.floor(c/h),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+t+":"+i.count;let l=e.cache.get(n);l||(d=new o(r,t*h,i.count*h/a),l=new Qa(d,h/a),e.cache.add(n,l)),p=new za(l,s,c%h/a,u)}else d=null===r?new o(i.count*s):new o(r,c,i.count*s),p=new zo(d,s,u);if(void 0!==i.sparse){const e=Kg.SCALAR,n=Xg[i.sparse.indices.componentType],a=i.sparse.indices.byteOffset||0,l=i.sparse.values.byteOffset||0,c=new n(t[1],a,i.sparse.count*e),h=new o(t[2],l,i.sparse.count*s);null!==r&&(p=new zo(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let t=0,e=c.length;t<e;t++){const e=c[t];if(p.setX(e,h[t*s]),s>=2&&p.setY(e,h[t*s+1]),s>=3&&p.setZ(e,h[t*s+2]),s>=4&&p.setW(e,h[t*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}p.normalized=u}return p}))}loadTexture(t){const e=this.json,n=this.options,i=e.textures[t].source,r=e.images[i];let s=this.textureLoader;if(r.uri){const t=n.manager.getHandler(r.uri);null!==t&&(s=t)}return this.loadTextureImage(t,i,s)}loadTextureImage(t,e,n){const i=this,r=this.json,s=r.textures[t],o=r.images[e],a=(o.uri||o.bufferView)+":"+s.sampler;if(this.textureCache[a])return this.textureCache[a];const l=this.loadImageSource(e,n).then((function(e){e.flipY=!1,e.name=s.name||o.name||"",""===e.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(e.name=o.uri);const n=(r.samplers||{})[s.sampler]||{};return e.magFilter=Yg[n.magFilter]||$e,e.minFilter=Yg[n.minFilter]||nn,e.wrapS=Jg[n.wrapS]||je,e.wrapT=Jg[n.wrapT]||je,e.generateMipmaps=!e.isCompressedTexture&&e.minFilter!==Xe&&e.minFilter!==$e,i.associations.set(e,{textures:t}),e})).catch((function(){return null}));return this.textureCache[a]=l,l}loadImageSource(t,e){const n=this.json,i=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then((t=>t.clone()));const r=n.images[t],s=self.URL||self.webkitURL;let o=r.uri||"",a=!1;if(void 0!==r.bufferView)o=this.getDependency("bufferView",r.bufferView).then((function(t){a=!0;const e=new Blob([t],{type:r.mimeType});return o=s.createObjectURL(e),o}));else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const l=Promise.resolve(o).then((function(t){return new Promise((function(n,r){let s=n;!0===e.isImageBitmapLoader&&(s=function(t){const e=new Kr(t);e.needsUpdate=!0,n(e)}),e.load(pd.resolveURL(t,i.path),s,void 0,r)}))})).then((function(t){var e;return!0===a&&s.revokeObjectURL(o),iv(t,r),t.userData.mimeType=r.mimeType||((e=r.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":e.search(/\.ktx2($|\?)/i)>0||0===e.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),t})).catch((function(t){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),t}));return this.sourceCache[t]=l,l}assignTexture(t,e,n,i){const r=this;return this.getDependency("texture",n.index).then((function(s){if(!s)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((s=s.clone()).channel=n.texCoord),r.extensions[pg]){const t=void 0!==n.extensions?n.extensions[pg]:void 0;if(t){const e=r.associations.get(s);s=r.extensions[pg].extendTexture(s,t),r.associations.set(s,e)}}return void 0!==i&&(s.colorSpace=i),t[e]=s,s}))}assignFinalMaterial(t){const e=t.geometry;let n=t.material;const i=void 0===e.attributes.tangent,r=void 0!==e.attributes.color,s=void 0===e.attributes.normal;if(t.isPoints){const t="PointsMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new gc,Lo.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,e.sizeAttenuation=!1,this.cache.add(t,e)),n=e}else if(t.isLine){const t="LineBasicMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new ic,Lo.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,this.cache.add(t,e)),n=e}if(i||r||s){let t="ClonedMaterial:"+n.uuid+":";i&&(t+="derivative-tangents:"),r&&(t+="vertex-colors:"),s&&(t+="flat-shading:");let e=this.cache.get(t);e||(e=n.clone(),r&&(e.vertexColors=!0),s&&(e.flatShading=!0),i&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(n))),n=e}t.material=n}getMaterialType(){return iu}loadMaterial(t){const e=this,n=this.json,i=this.extensions,r=n.materials[t];let s;const o={},a=[];if((r.extensions||{})[hg]){const t=i[hg];s=t.getMaterialType(),a.push(t.extendParams(o,r,e))}else{const n=r.pbrMetallicRoughness||{};if(o.color=new Bo(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){const t=n.baseColorFactor;o.color.setRGB(t[0],t[1],t[2],Ti),o.opacity=t[3]}void 0!==n.baseColorTexture&&a.push(e.assignTexture(o,"map",n.baseColorTexture,Bi)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(a.push(e.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),a.push(e.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),s=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),a.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,o)}))))}!0===r.doubleSided&&(o.side=jt);const l=r.alphaMode||"OPAQUE";if("BLEND"===l?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,"MASK"===l&&(o.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&s!==Do&&(a.push(e.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new Br(1,1),void 0!==r.normalTexture.scale)){const t=r.normalTexture.scale;o.normalScale.set(t,t)}if(void 0!==r.occlusionTexture&&s!==Do&&(a.push(e.assignTexture(o,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(o.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&s!==Do){const t=r.emissiveFactor;o.emissive=(new Bo).setRGB(t[0],t[1],t[2],Ti)}return void 0!==r.emissiveTexture&&s!==Do&&a.push(e.assignTexture(o,"emissiveMap",r.emissiveTexture,Bi)),Promise.all(a).then((function(){const n=new s(o);return r.name&&(n.name=r.name),iv(n,r),e.associations.set(n,{materials:t}),r.extensions&&nv(i,n,r),n}))}createUniqueName(t){const e=Jd.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,n=this.extensions,i=this.primitiveCache;function r(t){return n[tg].decodePrimitive(t,e).then((function(n){return hv(n,t,e)}))}const s=[];for(let n=0,o=t.length;n<o;n++){const o=t[n],a=sv(o),l=i[a];if(l)s.push(l.promise);else{let t;t=o.extensions&&o.extensions[tg]?r(o):hv(new sa,o,e),i[a]={primitive:o,promise:t},s.push(t)}}return Promise.all(s)}loadMesh(t){const e=this,n=this.json,i=this.extensions,r=n.meshes[t],s=r.primitives,o=[];for(let t=0,e=s.length;t<e;t++){const e=void 0===s[t].material?ev(this.cache):this.getDependency("material",s[t].material);o.push(e)}return o.push(e.loadGeometries(s)),Promise.all(o).then((function(n){const o=n.slice(0,n.length-1),a=n[n.length-1],l=[];for(let n=0,c=a.length;n<c;n++){const c=a[n],h=s[n];let u;const d=o[n];if(h.mode===qg.TRIANGLES||h.mode===qg.TRIANGLE_STRIP||h.mode===qg.TRIANGLE_FAN||void 0===h.mode)u=!0===r.isSkinnedMesh?new gl(c,d):new ga(c,d),!0===u.isSkinnedMesh&&u.normalizeSkinWeights(),h.mode===qg.TRIANGLE_STRIP?u.geometry=Xm(u.geometry,Ei):h.mode===qg.TRIANGLE_FAN&&(u.geometry=Xm(u.geometry,xi));else if(h.mode===qg.LINES)u=new fc(c,d);else if(h.mode===qg.LINE_STRIP)u=new uc(c,d);else if(h.mode===qg.LINE_LOOP)u=new mc(c,d);else{if(h.mode!==qg.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);u=new bc(c,d)}Object.keys(u.geometry.morphAttributes).length>0&&rv(u,r),u.name=e.createUniqueName(r.name||"mesh_"+t),iv(u,r),h.extensions&&nv(i,u,h),e.assignFinalMaterial(u),l.push(u)}for(let n=0,i=l.length;n<i;n++)e.associations.set(l[n],{meshes:t,primitives:n});if(1===l.length)return r.extensions&&nv(i,l[0],r),l[0];const c=new Pa;r.extensions&&nv(i,c,r),e.associations.set(c,{meshes:t});for(let t=0,e=l.length;t<e;t++)c.add(l[t]);return c}))}loadCamera(t){let e;const n=this.json.cameras[t],i=n[n.type];if(i)return"perspective"===n.type?e=new Ba(Ir.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(e=new sd(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),iv(e,n),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(t){const e=this.json.skins[t],n=[];for(let t=0,i=e.joints.length;t<i;t++)n.push(this._loadNodeShallow(e.joints[t]));return void 0!==e.inverseBindMatrices?n.push(this.getDependency("accessor",e.inverseBindMatrices)):n.push(null),Promise.all(n).then((function(t){const n=t.pop(),i=t,r=[],s=[];for(let t=0,o=i.length;t<o;t++){const o=i[t];if(o){r.push(o);const e=new Os;null!==n&&e.fromArray(n.array,16*t),s.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[t])}return new bl(r,s)}))}loadAnimation(t){const e=this.json,n=this,i=e.animations[t],r=i.name?i.name:"animation_"+t,s=[],o=[],a=[],l=[],c=[];for(let t=0,e=i.channels.length;t<e;t++){const e=i.channels[t],n=i.samplers[e.sampler],r=e.target,h=r.node,u=void 0!==i.parameters?i.parameters[n.input]:n.input,d=void 0!==i.parameters?i.parameters[n.output]:n.output;void 0!==r.node&&(s.push(this.getDependency("node",h)),o.push(this.getDependency("accessor",u)),a.push(this.getDependency("accessor",d)),l.push(n),c.push(r))}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(a),Promise.all(l),Promise.all(c)]).then((function(t){const e=t[0],i=t[1],s=t[2],o=t[3],a=t[4],l=[];for(let t=0,r=e.length;t<r;t++){const r=e[t],c=i[t],h=s[t],u=o[t],d=a[t];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();const p=n._createAnimationTracks(r,c,h,u,d);if(p)for(let t=0;t<p.length;t++)l.push(p[t])}return new Ru(r,void 0,l)}))}createNodeMesh(t){const e=this.json,n=this,i=e.nodes[t];return void 0===i.mesh?null:n.getDependency("mesh",i.mesh).then((function(t){const e=n._getNodeRef(n.meshCache,i.mesh,t);return void 0!==i.weights&&e.traverse((function(t){if(t.isMesh)for(let e=0,n=i.weights.length;e<n;e++)t.morphTargetInfluences[e]=i.weights[e]})),e}))}loadNode(t){const e=this,n=this.json.nodes[t],i=e._loadNodeShallow(t),r=[],s=n.children||[];for(let t=0,n=s.length;t<n;t++)r.push(e.getDependency("node",s[t]));const o=void 0===n.skin?Promise.resolve(null):e.getDependency("skin",n.skin);return Promise.all([i,Promise.all(r),o]).then((function(t){const e=t[0],n=t[1],i=t[2];null!==i&&e.traverse((function(t){t.isSkinnedMesh&&t.bind(i,lv)}));for(let t=0,i=n.length;t<i;t++)e.add(n[t]);return e}))}_loadNodeShallow(t){const e=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[t])return this.nodeCache[t];const r=e.nodes[t],s=r.name?i.createUniqueName(r.name):"",o=[],a=i._invokeOne((function(e){return e.createNodeMesh&&e.createNodeMesh(t)}));return a&&o.push(a),void 0!==r.camera&&o.push(i.getDependency("camera",r.camera).then((function(t){return i._getNodeRef(i.cameraCache,r.camera,t)}))),i._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){o.push(t)})),this.nodeCache[t]=Promise.all(o).then((function(e){let o;if(o=!0===r.isBone?new vl:e.length>1?new Pa:1===e.length?e[0]:new co,o!==e[0])for(let t=0,n=e.length;t<n;t++)o.add(e[t]);if(r.name&&(o.userData.name=r.name,o.name=s),iv(o,r),r.extensions&&nv(n,o,r),void 0!==r.matrix){const t=new Os;t.fromArray(r.matrix),o.applyMatrix4(t)}else void 0!==r.translation&&o.position.fromArray(r.translation),void 0!==r.rotation&&o.quaternion.fromArray(r.rotation),void 0!==r.scale&&o.scale.fromArray(r.scale);return i.associations.has(o)||i.associations.set(o,{}),i.associations.get(o).nodes=t,o})),this.nodeCache[t]}loadScene(t){const e=this.extensions,n=this.json.scenes[t],i=this,r=new Pa;n.name&&(r.name=i.createUniqueName(n.name)),iv(r,n),n.extensions&&nv(e,r,n);const s=n.nodes||[],o=[];for(let t=0,e=s.length;t<e;t++)o.push(i.getDependency("node",s[t]));return Promise.all(o).then((function(t){for(let e=0,n=t.length;e<n;e++)r.add(t[e]);return i.associations=(t=>{const e=new Map;for(const[t,n]of i.associations)(t instanceof Lo||t instanceof Kr)&&e.set(t,n);return t.traverse((t=>{const n=i.associations.get(t);null!=n&&e.set(t,n)})),e})(r),r}))}_createAnimationTracks(t,e,n,i,r){const s=[],o=t.name?t.name:t.uuid,a=[];let l;switch($g[r.path]===$g.weights?t.traverse((function(t){t.morphTargetInfluences&&a.push(t.name?t.name:t.uuid)})):a.push(o),$g[r.path]){case $g.weights:l=Mu;break;case $g.rotation:l=Iu;break;case $g.position:case $g.scale:l=Tu;break;default:l=1===n.itemSize?Mu:Tu}const c=void 0!==i.interpolation?tv[i.interpolation]:di,h=this._getArrayFromAccessor(n);for(let t=0,n=a.length;t<n;t++){const n=new l(a[t]+"."+$g[r.path],e.array,h,c);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(n),s.push(n)}return s}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const t=av(e.constructor),n=new Float32Array(e.length);for(let i=0,r=e.length;i<r;i++)n[i]=e[i]*t;e=n}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(t){return new(this instanceof Iu?Wg:Vg)(this.times,this.values,this.getValueSize()/3,t)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function hv(t,e,n){const i=e.attributes,r=[];function s(e,i){return n.getDependency("accessor",e).then((function(e){t.setAttribute(i,e)}))}for(const e in i){const n=Zg[e]||e.toLowerCase();n in t.attributes||r.push(s(i[e],n))}if(void 0!==e.indices&&!t.index){const i=n.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));r.push(i)}return zr.workingColorSpace!==Ti&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${zr.workingColorSpace}" not supported.`),iv(t,e),function(t,e,n){const i=e.attributes,r=new cs;if(void 0===i.POSITION)return;{const t=n.json.accessors[i.POSITION],e=t.min,s=t.max;if(void 0===e||void 0===s)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new os(e[0],e[1],e[2]),new os(s[0],s[1],s[2])),t.normalized){const e=av(Xg[t.componentType]);r.min.multiplyScalar(e),r.max.multiplyScalar(e)}}const s=e.targets;if(void 0!==s){const t=new os,e=new os;for(let i=0,r=s.length;i<r;i++){const r=s[i];if(void 0!==r.POSITION){const i=n.json.accessors[r.POSITION],s=i.min,o=i.max;if(void 0!==s&&void 0!==o){if(e.setX(Math.max(Math.abs(s[0]),Math.abs(o[0]))),e.setY(Math.max(Math.abs(s[1]),Math.abs(o[1]))),e.setZ(Math.max(Math.abs(s[2]),Math.abs(o[2]))),i.normalized){const t=av(Xg[i.componentType]);e.multiplyScalar(t)}t.max(e)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(t)}t.boundingBox=r;const o=new Ss;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,t.boundingSphere=o}(t,e,n),Promise.all(r).then((function(){return void 0!==e.targets?function(t,e,n){let i=!1,r=!1,s=!1;for(let t=0,n=e.length;t<n;t++){const n=e[t];if(void 0!==n.POSITION&&(i=!0),void 0!==n.NORMAL&&(r=!0),void 0!==n.COLOR_0&&(s=!0),i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(t);const o=[],a=[],l=[];for(let c=0,h=e.length;c<h;c++){const h=e[c];if(i){const e=void 0!==h.POSITION?n.getDependency("accessor",h.POSITION):t.attributes.position;o.push(e)}if(r){const e=void 0!==h.NORMAL?n.getDependency("accessor",h.NORMAL):t.attributes.normal;a.push(e)}if(s){const e=void 0!==h.COLOR_0?n.getDependency("accessor",h.COLOR_0):t.attributes.color;l.push(e)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l)]).then((function(e){const n=e[0],o=e[1],a=e[2];return i&&(t.morphAttributes.position=n),r&&(t.morphAttributes.normal=o),s&&(t.morphAttributes.color=a),t.morphTargetsRelative=!0,t}))}(t,e.targets,n):t}))}class uv{constructor(t=4){this.pool=t,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(t){if(!this.workers[t]){const e=this.workerCreator();e.addEventListener("message",this._onMessage.bind(this,t)),this.workers[t]=e}}_getIdleWorker(){for(let t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1}_onMessage(t,e){const n=this.workersResolve[t];if(n&&n(e),this.queue.length){const{resolve:e,msg:n,transfer:i}=this.queue.shift();this.workersResolve[t]=e,this.workers[t].postMessage(n,i)}else this.workerStatus^=1<<t}setWorkerCreator(t){this.workerCreator=t}setWorkerLimit(t){this.pool=t}postMessage(t,e){return new Promise((n=>{const i=this._getIdleWorker();-1!==i?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=n,this.workers[i].postMessage(t,e)):this.queue.push({resolve:n,msg:t,transfer:e})}))}dispose(){this.workers.forEach((t=>t.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const dv=9,pv=15,Av=16,fv=22,mv=37,gv=43,vv=76,yv=83,Ev=97,xv=100,bv=103,Cv=109,wv=165,_v=166,Mv=1000066e3;class Sv{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Iv{constructor(t,e,n,i){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(t.buffer,t.byteOffset+e,n),this._littleEndian=i,this._offset=0}_nextUint8(){const t=this._dataView.getUint8(this._offset);return this._offset+=1,t}_nextUint16(){const t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}_nextUint32(){const t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint64(){const t=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,t}_nextInt32(){const t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint8Array(t){const e=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,t);return this._offset+=t,e}_skip(t){return this._offset+=t,this}_scan(t,e){void 0===e&&(e=0);const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==e&&i<t;)i++,this._offset++;return i<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}new Uint8Array([0]);const Bv=[171,75,84,88,32,50,48,187,13,10,26,10];function Tv(t){return(new TextDecoder).decode(t)}var Rv=n(9922).hp;let Lv,Dv,Pv;const Uv={env:{emscripten_notify_memory_growth:function(t){Pv=new Uint8Array(Dv.exports.memory.buffer)}}};class Ov{init(){return Lv||(Lv="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Fv).then((t=>t.arrayBuffer())).then((t=>WebAssembly.instantiate(t,Uv))).then(this._init):WebAssembly.instantiate(Rv.from(Fv,"base64"),Uv).then(this._init),Lv)}_init(t){Dv=t.instance,Uv.env.emscripten_notify_memory_growth(0)}decode(t,e=0){if(!Dv)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=t.byteLength,i=Dv.exports.malloc(n);Pv.set(t,i),e=e||Number(Dv.exports.ZSTD_findDecompressedSize(i,n));const r=Dv.exports.malloc(e),s=Dv.exports.ZSTD_decompress(r,e,i,n),o=Pv.slice(r,r+s);return Dv.exports.free(i),Dv.exports.free(r),o}}const Fv="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",kv=new WeakMap;let Nv,Qv=0;class Gv extends Ou{constructor(t){super(t),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new uv,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(t){return this.transcoderPath=t,this}setWorkerLimit(t){return this.workerPool.setWorkerLimit(t),this}async detectSupportAsync(t){return this.workerConfig={astcSupported:await t.hasFeatureAsync("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:await t.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await t.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await t.hasFeatureAsync("texture-compression-bc"),bptcSupported:await t.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await t.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(t){return!0===t.isWebGPURenderer?this.workerConfig={astcSupported:t.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:t.hasFeature("texture-compression-etc1"),etc2Supported:t.hasFeature("texture-compression-etc2"),dxtSupported:t.hasFeature("texture-compression-bc"),bptcSupported:t.hasFeature("texture-compression-bptc"),pvrtcSupported:t.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:t.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:t.extensions.has("WEBGL_compressed_texture_astc")&&t.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:t.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:t.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:t.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:t.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:t.extensions.has("WEBGL_compressed_texture_pvrtc")||t.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const t=new Nu(this.manager);t.setPath(this.transcoderPath),t.setWithCredentials(this.withCredentials);const e=t.loadAsync("basis_transcoder.js"),n=new Nu(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([e,i]).then((([t,e])=>{const n=Gv.BasisWorker.toString(),i=["/* constants */","let _EngineFormat = "+JSON.stringify(Gv.EngineFormat),"let _EngineType = "+JSON.stringify(Gv.EngineType),"let _TranscoderFormat = "+JSON.stringify(Gv.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Gv.BasisFormat),"/* basis_transcoder.js */",t,"/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i])),this.transcoderBinary=e,this.workerPool.setWorkerCreator((()=>{const t=new Worker(this.workerSourceURL),e=this.transcoderBinary.slice(0);return t.postMessage({type:"init",config:this.workerConfig,transcoderBinary:e},[e]),t}))})),Qv>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Qv++}return this.transcoderPending}load(t,e,n,i){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new Nu(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(t,(t=>{this.parse(t,e,i)}),n,i)}parse(t,e,n){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(kv.has(t))return kv.get(t).promise.then(e).catch(n);this._createTexture(t).then((t=>e?e(t):null)).catch(n)}_createTextureFrom(t,e){const{type:n,error:i,data:{faces:r,width:s,height:o,format:a,type:l,dfdFlags:c}}=t;if("error"===n)return Promise.reject(i);let h;if(6===e.faceCount)h=new Bc(r,a,l);else{const t=r[0].mipmaps;h=e.layerCount>1?new Ic(t,s,o,e.layerCount,a,l):new Sc(t,s,o,a,l)}return h.minFilter=1===r[0].mipmaps.length?$e:nn,h.magFilter=$e,h.generateMipmaps=!1,h.needsUpdate=!0,h.colorSpace=jv(e),h.premultiplyAlpha=!!(1&c),h}async _createTexture(t,e={}){const n=function(t){const e=new Uint8Array(t.buffer,t.byteOffset,Bv.length);if(e[0]!==Bv[0]||e[1]!==Bv[1]||e[2]!==Bv[2]||e[3]!==Bv[3]||e[4]!==Bv[4]||e[5]!==Bv[5]||e[6]!==Bv[6]||e[7]!==Bv[7]||e[8]!==Bv[8]||e[9]!==Bv[9]||e[10]!==Bv[10]||e[11]!==Bv[11])throw new Error("Missing KTX 2.0 identifier.");const n=new Sv,i=17*Uint32Array.BYTES_PER_ELEMENT,r=new Iv(t,Bv.length,i,!0);n.vkFormat=r._nextUint32(),n.typeSize=r._nextUint32(),n.pixelWidth=r._nextUint32(),n.pixelHeight=r._nextUint32(),n.pixelDepth=r._nextUint32(),n.layerCount=r._nextUint32(),n.faceCount=r._nextUint32();const s=r._nextUint32();n.supercompressionScheme=r._nextUint32();const o=r._nextUint32(),a=r._nextUint32(),l=r._nextUint32(),c=r._nextUint32(),h=r._nextUint64(),u=r._nextUint64(),d=new Iv(t,Bv.length+i,3*s*8,!0);for(let e=0;e<s;e++)n.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});const p=new Iv(t,o,a,!0),A={vendorId:p._skip(4)._nextUint16(),descriptorType:p._nextUint16(),versionNumber:p._nextUint16(),descriptorBlockSize:p._nextUint16(),colorModel:p._nextUint8(),colorPrimaries:p._nextUint8(),transferFunction:p._nextUint8(),flags:p._nextUint8(),texelBlockDimension:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],bytesPlane:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],samples:[]},f=(A.descriptorBlockSize/4-6)/4;for(let t=0;t<f;t++){const e={bitOffset:p._nextUint16(),bitLength:p._nextUint8(),channelType:p._nextUint8(),samplePosition:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&e.channelType?(e.sampleLower=p._nextInt32(),e.sampleUpper=p._nextInt32()):(e.sampleLower=p._nextUint32(),e.sampleUpper=p._nextUint32()),A.samples[t]=e}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(A);const m=new Iv(t,l,c,!0);for(;m._offset<c;){const t=m._nextUint32(),e=m._scan(t),i=Tv(e);if(n.keyValue[i]=m._nextUint8Array(t-e.byteLength-1),i.match(/^ktx/i)){const t=Tv(n.keyValue[i]);n.keyValue[i]=t.substring(0,t.lastIndexOf("\0"))}m._skip(t%4?4-t%4:0)}if(u<=0)return n;const g=new Iv(t,h,u,!0),v=g._nextUint16(),y=g._nextUint16(),E=g._nextUint32(),x=g._nextUint32(),b=g._nextUint32(),C=g._nextUint32(),w=[];for(let t=0;t<s;t++)w.push({imageFlags:g._nextUint32(),rgbSliceByteOffset:g._nextUint32(),rgbSliceByteLength:g._nextUint32(),alphaSliceByteOffset:g._nextUint32(),alphaSliceByteLength:g._nextUint32()});const _=h+g._offset,M=_+E,S=M+x,I=S+b,B=new Uint8Array(t.buffer,t.byteOffset+_,E),T=new Uint8Array(t.buffer,t.byteOffset+M,x),R=new Uint8Array(t.buffer,t.byteOffset+S,b),L=new Uint8Array(t.buffer,t.byteOffset+I,C);return n.globalData={endpointCount:v,selectorCount:y,imageDescs:w,endpointsData:B,selectorsData:T,tablesData:R,extendedData:L},n}(new Uint8Array(t)),i=n.vkFormat===Mv&&167===n.dataFormatDescriptor[0].colorModel;if(0!==n.vkFormat&&(!i||this.workerConfig.astcHDRSupported))return async function(t){const{vkFormat:e}=t;if(void 0===Hv[e])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let n;2===t.supercompressionScheme&&(Nv||(Nv=new Promise((async t=>{const e=new Ov;await e.init(),t(e)}))),n=await Nv);const i=[];for(let r=0;r<t.levels.length;r++){const s=Math.max(1,t.pixelWidth>>r),o=Math.max(1,t.pixelHeight>>r),a=t.pixelDepth?Math.max(1,t.pixelDepth>>r):0,l=t.levels[r];let c,h;if(0===t.supercompressionScheme)c=l.levelData;else{if(2!==t.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");c=n.decode(l.levelData,l.uncompressedByteLength)}h=Vv[e]===un?new Float32Array(c.buffer,c.byteOffset,c.byteLength/Float32Array.BYTES_PER_ELEMENT):Vv[e]===dn?new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT):c,i.push({data:h,width:s,height:o,depth:a})}let r;if(zv.has(Hv[e]))r=0===t.pixelDepth?new yl(i[0].data,t.pixelWidth,t.pixelHeight):new is(i[0].data,t.pixelWidth,t.pixelHeight,t.pixelDepth);else{if(t.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");r=new Sc(i,t.pixelWidth,t.pixelHeight),r.minFilter=1===i.length?$e:nn,r.magFilter=$e}return r.mipmaps=i,r.type=Vv[e],r.format=Hv[e],r.colorSpace=jv(t),r.needsUpdate=!0,Promise.resolve(r)}(n);const r=e,s=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:t,taskConfig:r},[t]))).then((t=>this._createTextureFrom(t.data,n)));return kv.set(t,{promise:s}),s}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Qv--,this}}Gv.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},Gv.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25},Gv.EngineFormat={RGBAFormat:yn,RGBA_ASTC_4x4_Format:Gn,RGB_BPTC_UNSIGNED_Format:ii,RGBA_BPTC_Format:ei,RGBA_ETC2_EAC_Format:Qn,RGBA_PVRTC_4BPPV1_Format:On,RGBA_S3TC_DXT5_Format:Dn,RGB_ETC1_Format:kn,RGB_ETC2_Format:Nn,RGB_PVRTC_4BPPV1_Format:Pn,RGBA_S3TC_DXT1_Format:Rn},Gv.EngineType={UnsignedByteType:sn,HalfFloatType:dn,FloatType:un},Gv.BasisWorker=function(){let t,e,n;const i=_EngineFormat,r=_EngineType,s=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",(function(i){const s=i.data;switch(s.type){case"init":t=s.config,a=s.transcoderBinary,e=new Promise((t=>{n={wasmBinary:a,onRuntimeInitialized:t},BASIS(n)})).then((()=>{n.initializeBasis(),void 0===n.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}));break;case"transcode":e.then((()=>{try{const{faces:e,buffers:i,width:a,height:u,hasAlpha:d,format:p,type:A,dfdFlags:f}=function(e){const i=new n.KTX2File(new Uint8Array(e));function s(){i.close(),i.delete()}if(!i.isValid())throw s(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");let a;if(i.isUASTC())a=o.UASTC;else if(i.isETC1S())a=o.ETC1S;else{if(!i.isHDR())throw new Error("THREE.KTX2Loader: Unknown Basis encoding");a=o.UASTC_HDR}const u=i.getWidth(),d=i.getHeight(),p=i.getLayers()||1,A=i.getLevels(),f=i.getFaces(),m=i.getHasAlpha(),g=i.getDFDFlags(),{transcoderFormat:v,engineFormat:y,engineType:E}=function(e,n,i,r){const s=l[e];for(let o=0;o<s.length;o++){const a=s[o];if((!a.if||t[a.if])&&(a.basisFormat.includes(e)&&!(r&&a.transcoderFormat.length<2)&&(!a.needsPowerOfTwo||c(n)&&c(i))))return{transcoderFormat:a.transcoderFormat[r?1:0],engineFormat:a.engineFormat[r?1:0],engineType:a.engineType[0]}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}(a,u,d,m);if(!u||!d||!A)throw s(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!i.startTranscoding())throw s(),new Error("THREE.KTX2Loader: .startTranscoding failed");const x=[],b=[];for(let t=0;t<f;t++){const e=[];for(let n=0;n<A;n++){const o=[];let a,l;for(let e=0;e<p;e++){const c=i.getImageLevelInfo(n,e,t);0!==t||0!==n||0!==e||c.origWidth%4==0&&c.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),A>1?(a=c.origWidth,l=c.origHeight):(a=c.width,l=c.height);let h=new Uint8Array(i.getImageTranscodedSizeInBytes(n,e,0,v));const u=i.transcodeImage(h,n,e,t,v,0,-1,-1);if(E===r.HalfFloatType&&(h=new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!u)throw s(),new Error("THREE.KTX2Loader: .transcodeImage failed.");o.push(h)}const c=h(o);e.push({data:c,width:a,height:l}),b.push(c.buffer)}x.push({mipmaps:e,width:u,height:d,format:y,type:E})}return s(),{faces:x,buffers:b,width:u,height:d,hasAlpha:m,dfdFlags:g,format:y,type:E}}(s.buffer);self.postMessage({type:"transcode",id:s.id,data:{faces:e,width:a,height:u,hasAlpha:d,format:p,type:A,dfdFlags:f}},i)}catch(t){console.error(t),self.postMessage({type:"error",id:s.id,error:t.message})}}))}var a}));const a=[{if:"astcSupported",basisFormat:[o.UASTC],transcoderFormat:[s.ASTC_4x4,s.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],engineType:[r.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC7_M5,s.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],engineType:[r.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC1,s.BC3],engineFormat:[i.RGBA_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],engineType:[r.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1,s.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],engineType:[r.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1],engineFormat:[i.RGB_ETC1_Format],engineType:[r.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.PVRTC1_4_RGB,s.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],engineType:[r.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[o.UASTC_HDR],transcoderFormat:[s.BC6H],engineFormat:[i.RGB_BPTC_UNSIGNED_Format],engineType:[r.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.RGBA32,s.RGBA32],engineFormat:[i.RGBAFormat,i.RGBAFormat],engineType:[r.UnsignedByteType,r.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[o.UASTC_HDR],transcoderFormat:[s.RGBA_HALF],engineFormat:[i.RGBAFormat],engineType:[r.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],l={[o.ETC1S]:a.filter((t=>t.basisFormat.includes(o.ETC1S))).sort(((t,e)=>t.priorityUASTC-e.priorityUASTC)),[o.UASTC]:a.filter((t=>t.basisFormat.includes(o.UASTC))).sort(((t,e)=>t.priorityUASTC-e.priorityUASTC)),[o.UASTC_HDR]:a.filter((t=>t.basisFormat.includes(o.UASTC_HDR))).sort(((t,e)=>t.priorityHDR-e.priorityHDR))};function c(t){return t<=2||!(t&t-1)&&0!==t}function h(t){if(1===t.length)return t[0];let e=0;for(let n=0;n<t.length;n++)e+=t[n].byteLength;const n=new Uint8Array(e);let i=0;for(let e=0;e<t.length;e++){const r=t[e];n.set(r,i),i+=r.byteLength}return n}};const zv=new Set([yn,Mn,wn]),Hv={[Cv]:yn,[Ev]:yn,[mv]:yn,[gv]:yn,[bv]:Mn,[yv]:Mn,[Av]:Mn,[fv]:Mn,[xv]:wn,[vv]:wn,[pv]:wn,[dv]:wn,[Mv]:Gn,[_v]:jn,[wv]:jn},Vv={[Cv]:un,[Ev]:dn,[mv]:sn,[gv]:sn,[bv]:un,[yv]:dn,[Av]:sn,[fv]:sn,[xv]:un,[vv]:dn,[pv]:sn,[dv]:sn,[Mv]:dn,[_v]:sn,[wv]:sn};function jv(t){const e=t.dataFormatDescriptor[0];return 1===e.colorPrimaries?2===e.transferFunction?Bi:Ti:10===e.colorPrimaries?2===e.transferFunction?"display-p3":"display-p3-linear":(0===e.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),Ii)}const Wv={c:null,u:[new os,new os,new os],e:[]},qv={c:null,u:[new os,new os,new os],e:[]},Xv=[[],[],[]],Yv=[[],[],[]],Jv=[],Kv=new os,Zv=new os,$v=new os,ty=new os,ey=new os,ny=new os,iy=new Tr,ry=new cs,sy=new Os,oy=new Os,ay=new Us;class ly{constructor(t=new os,e=new os,n=new Tr){this.center=t,this.halfSize=e,this.rotation=n}set(t,e,n){return this.center=t,this.halfSize=e,this.rotation=n,this}copy(t){return this.center.copy(t.center),this.halfSize.copy(t.halfSize),this.rotation.copy(t.rotation),this}clone(){return(new this.constructor).copy(this)}getSize(t){return t.copy(this.halfSize).multiplyScalar(2)}clampPoint(t,e){const n=this.halfSize;ty.subVectors(t,this.center),this.rotation.extractBasis(Kv,Zv,$v),e.copy(this.center);const i=Ir.clamp(ty.dot(Kv),-n.x,n.x);e.add(Kv.multiplyScalar(i));const r=Ir.clamp(ty.dot(Zv),-n.y,n.y);e.add(Zv.multiplyScalar(r));const s=Ir.clamp(ty.dot($v),-n.z,n.z);return e.add($v.multiplyScalar(s)),e}containsPoint(t){return ty.subVectors(t,this.center),this.rotation.extractBasis(Kv,Zv,$v),Math.abs(ty.dot(Kv))<=this.halfSize.x&&Math.abs(ty.dot(Zv))<=this.halfSize.y&&Math.abs(ty.dot($v))<=this.halfSize.z}intersectsBox3(t){return this.intersectsOBB(cy.fromBox3(t))}intersectsSphere(t){return this.clampPoint(t.center,ny),ny.distanceToSquared(t.center)<=t.radius*t.radius}intersectsOBB(t,e=Number.EPSILON){Wv.c=this.center,Wv.e[0]=this.halfSize.x,Wv.e[1]=this.halfSize.y,Wv.e[2]=this.halfSize.z,this.rotation.extractBasis(Wv.u[0],Wv.u[1],Wv.u[2]),qv.c=t.center,qv.e[0]=t.halfSize.x,qv.e[1]=t.halfSize.y,qv.e[2]=t.halfSize.z,t.rotation.extractBasis(qv.u[0],qv.u[1],qv.u[2]);for(let t=0;t<3;t++)for(let e=0;e<3;e++)Xv[t][e]=Wv.u[t].dot(qv.u[e]);ty.subVectors(qv.c,Wv.c),Jv[0]=ty.dot(Wv.u[0]),Jv[1]=ty.dot(Wv.u[1]),Jv[2]=ty.dot(Wv.u[2]);for(let t=0;t<3;t++)for(let n=0;n<3;n++)Yv[t][n]=Math.abs(Xv[t][n])+e;let n,i;for(let t=0;t<3;t++)if(n=Wv.e[t],i=qv.e[0]*Yv[t][0]+qv.e[1]*Yv[t][1]+qv.e[2]*Yv[t][2],Math.abs(Jv[t])>n+i)return!1;for(let t=0;t<3;t++)if(n=Wv.e[0]*Yv[0][t]+Wv.e[1]*Yv[1][t]+Wv.e[2]*Yv[2][t],i=qv.e[t],Math.abs(Jv[0]*Xv[0][t]+Jv[1]*Xv[1][t]+Jv[2]*Xv[2][t])>n+i)return!1;return n=Wv.e[1]*Yv[2][0]+Wv.e[2]*Yv[1][0],i=qv.e[1]*Yv[0][2]+qv.e[2]*Yv[0][1],!(Math.abs(Jv[2]*Xv[1][0]-Jv[1]*Xv[2][0])>n+i||(n=Wv.e[1]*Yv[2][1]+Wv.e[2]*Yv[1][1],i=qv.e[0]*Yv[0][2]+qv.e[2]*Yv[0][0],Math.abs(Jv[2]*Xv[1][1]-Jv[1]*Xv[2][1])>n+i||(n=Wv.e[1]*Yv[2][2]+Wv.e[2]*Yv[1][2],i=qv.e[0]*Yv[0][1]+qv.e[1]*Yv[0][0],Math.abs(Jv[2]*Xv[1][2]-Jv[1]*Xv[2][2])>n+i||(n=Wv.e[0]*Yv[2][0]+Wv.e[2]*Yv[0][0],i=qv.e[1]*Yv[1][2]+qv.e[2]*Yv[1][1],Math.abs(Jv[0]*Xv[2][0]-Jv[2]*Xv[0][0])>n+i||(n=Wv.e[0]*Yv[2][1]+Wv.e[2]*Yv[0][1],i=qv.e[0]*Yv[1][2]+qv.e[2]*Yv[1][0],Math.abs(Jv[0]*Xv[2][1]-Jv[2]*Xv[0][1])>n+i||(n=Wv.e[0]*Yv[2][2]+Wv.e[2]*Yv[0][2],i=qv.e[0]*Yv[1][1]+qv.e[1]*Yv[1][0],Math.abs(Jv[0]*Xv[2][2]-Jv[2]*Xv[0][2])>n+i||(n=Wv.e[0]*Yv[1][0]+Wv.e[1]*Yv[0][0],i=qv.e[1]*Yv[2][2]+qv.e[2]*Yv[2][1],Math.abs(Jv[1]*Xv[0][0]-Jv[0]*Xv[1][0])>n+i||(n=Wv.e[0]*Yv[1][1]+Wv.e[1]*Yv[0][1],i=qv.e[0]*Yv[2][2]+qv.e[2]*Yv[2][0],Math.abs(Jv[1]*Xv[0][1]-Jv[0]*Xv[1][1])>n+i||(n=Wv.e[0]*Yv[1][2]+Wv.e[1]*Yv[0][2],i=qv.e[0]*Yv[2][1]+qv.e[1]*Yv[2][0],Math.abs(Jv[1]*Xv[0][2]-Jv[0]*Xv[1][2])>n+i)))))))))}intersectsPlane(t){this.rotation.extractBasis(Kv,Zv,$v);const e=this.halfSize.x*Math.abs(t.normal.dot(Kv))+this.halfSize.y*Math.abs(t.normal.dot(Zv))+this.halfSize.z*Math.abs(t.normal.dot($v)),n=t.normal.dot(this.center)-t.constant;return Math.abs(n)<=e}intersectRay(t,e){return this.getSize(ey),ry.setFromCenterAndSize(ty.set(0,0,0),ey),sy.setFromMatrix3(this.rotation),sy.setPosition(this.center),oy.copy(sy).invert(),ay.copy(t).applyMatrix4(oy),ay.intersectBox(ry,e)?e.applyMatrix4(sy):null}intersectsRay(t){return null!==this.intersectRay(t,ty)}fromBox3(t){return t.getCenter(this.center),t.getSize(this.halfSize).multiplyScalar(.5),this.rotation.identity(),this}equals(t){return t.center.equals(this.center)&&t.halfSize.equals(this.halfSize)&&t.rotation.equals(this.rotation)}applyMatrix4(t){const e=t.elements;let n=ty.set(e[0],e[1],e[2]).length();const i=ty.set(e[4],e[5],e[6]).length(),r=ty.set(e[8],e[9],e[10]).length();t.determinant()<0&&(n=-n),iy.setFromMatrix4(t);const s=1/n,o=1/i,a=1/r;return iy.elements[0]*=s,iy.elements[1]*=s,iy.elements[2]*=s,iy.elements[3]*=o,iy.elements[4]*=o,iy.elements[5]*=o,iy.elements[6]*=a,iy.elements[7]*=a,iy.elements[8]*=a,this.rotation.multiply(iy),this.halfSize.x*=n,this.halfSize.y*=i,this.halfSize.z*=r,ty.setFromMatrixPosition(t),this.center.add(ty),this}}const cy=new ly,hy=/^[og]\s*(.+)?/,uy=/^mtllib /,dy=/^usemtl /,py=/^usemap /,Ay=/\s+/,fy=new os,my=new os,gy=new os,vy=new os,yy=new os,Ey=new Bo;function xy(){const t={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(t,e){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=t,void(this.object.fromDeclaration=!1!==e);const n=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:t||"",fromDeclaration:!1!==e,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(t,e){const n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);const i={index:this.materials.length,name:t||"",mtllib:Array.isArray(e)&&e.length>0?e[e.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(t){const e={index:"number"==typeof t?t:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return e.clone=this.clone.bind(e),e}};return this.materials.push(i),i},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(t){const e=this.currentMaterial();if(e&&-1===e.groupEnd&&(e.groupEnd=this.geometry.vertices.length/3,e.groupCount=e.groupEnd-e.groupStart,e.inherited=!1),t&&this.materials.length>1)for(let t=this.materials.length-1;t>=0;t--)this.materials[t].groupCount<=0&&this.materials.splice(t,1);return t&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),e}},n&&n.name&&"function"==typeof n.clone){const t=n.clone(0);t.inherited=!0,this.object.materials.push(t)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(t,e){const n=parseInt(t,10);return 3*(n>=0?n-1:n+e/3)},parseNormalIndex:function(t,e){const n=parseInt(t,10);return 3*(n>=0?n-1:n+e/3)},parseUVIndex:function(t,e){const n=parseInt(t,10);return 2*(n>=0?n-1:n+e/2)},addVertex:function(t,e,n){const i=this.vertices,r=this.object.geometry.vertices;r.push(i[t+0],i[t+1],i[t+2]),r.push(i[e+0],i[e+1],i[e+2]),r.push(i[n+0],i[n+1],i[n+2])},addVertexPoint:function(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addVertexLine:function(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addNormal:function(t,e,n){const i=this.normals,r=this.object.geometry.normals;r.push(i[t+0],i[t+1],i[t+2]),r.push(i[e+0],i[e+1],i[e+2]),r.push(i[n+0],i[n+1],i[n+2])},addFaceNormal:function(t,e,n){const i=this.vertices,r=this.object.geometry.normals;fy.fromArray(i,t),my.fromArray(i,e),gy.fromArray(i,n),yy.subVectors(gy,my),vy.subVectors(fy,my),yy.cross(vy),yy.normalize(),r.push(yy.x,yy.y,yy.z),r.push(yy.x,yy.y,yy.z),r.push(yy.x,yy.y,yy.z)},addColor:function(t,e,n){const i=this.colors,r=this.object.geometry.colors;void 0!==i[t]&&r.push(i[t+0],i[t+1],i[t+2]),void 0!==i[e]&&r.push(i[e+0],i[e+1],i[e+2]),void 0!==i[n]&&r.push(i[n+0],i[n+1],i[n+2])},addUV:function(t,e,n){const i=this.uvs,r=this.object.geometry.uvs;r.push(i[t+0],i[t+1]),r.push(i[e+0],i[e+1]),r.push(i[n+0],i[n+1])},addDefaultUV:function(){const t=this.object.geometry.uvs;t.push(0,0),t.push(0,0),t.push(0,0)},addUVLine:function(t){const e=this.uvs;this.object.geometry.uvs.push(e[t+0],e[t+1])},addFace:function(t,e,n,i,r,s,o,a,l){const c=this.vertices.length;let h=this.parseVertexIndex(t,c),u=this.parseVertexIndex(e,c),d=this.parseVertexIndex(n,c);if(this.addVertex(h,u,d),this.addColor(h,u,d),void 0!==o&&""!==o){const t=this.normals.length;h=this.parseNormalIndex(o,t),u=this.parseNormalIndex(a,t),d=this.parseNormalIndex(l,t),this.addNormal(h,u,d)}else this.addFaceNormal(h,u,d);if(void 0!==i&&""!==i){const t=this.uvs.length;h=this.parseUVIndex(i,t),u=this.parseUVIndex(r,t),d=this.parseUVIndex(s,t),this.addUV(h,u,d),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(t){this.object.geometry.type="Points";const e=this.vertices.length;for(let n=0,i=t.length;n<i;n++){const i=this.parseVertexIndex(t[n],e);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(t,e){this.object.geometry.type="Line";const n=this.vertices.length,i=this.uvs.length;for(let e=0,i=t.length;e<i;e++)this.addVertexLine(this.parseVertexIndex(t[e],n));for(let t=0,n=e.length;t<n;t++)this.addUVLine(this.parseUVIndex(e[t],i))}};return t.startObject("",!1),t}class by{constructor(t="",e={}){this.baseUrl=t,this.options=e,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=void 0!==this.options.side?this.options.side:Ht,this.wrap=void 0!==this.options.wrap?this.options.wrap:je}setCrossOrigin(t){return this.crossOrigin=t,this}setManager(t){this.manager=t}setMaterials(t){this.materialsInfo=this.convert(t),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(t){if(!this.options)return t;const e={};for(const n in t){const i=t[n],r={};e[n]=r;for(const t in i){let e=!0,n=i[t];const s=t.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]&&(e=!1)}e&&(r[s]=n)}}return e}preload(){for(const t in this.materialsInfo)this.create(t)}getIndex(t){return this.nameLookup[t]}getAsArray(){let t=0;for(const e in this.materialsInfo)this.materialsArray[t]=this.create(e),this.nameLookup[e]=t,t++;return this.materialsArray}create(t){return void 0===this.materials[t]&&this.createMaterial_(t),this.materials[t]}createMaterial_(t){const e=this,n=this.materialsInfo[t],i={name:t,side:this.side};function r(t,n){if(i[t])return;const r=e.getTextureParams(n,i),s=e.loadTexture((o=e.baseUrl,"string"!=typeof(a=r.url)||""===a?"":/^https?:\/\//i.test(a)?a:o+a));var o,a;s.repeat.copy(r.scale),s.offset.copy(r.offset),s.wrapS=e.wrap,s.wrapT=e.wrap,"map"!==t&&"emissiveMap"!==t||(s.colorSpace=Bi),i[t]=s}for(const t in n){const e=n[t];let s;if(""!==e)switch(t.toLowerCase()){case"kd":i.color=zr.toWorkingColorSpace((new Bo).fromArray(e),Bi);break;case"ks":i.specular=zr.toWorkingColorSpace((new Bo).fromArray(e),Bi);break;case"ke":i.emissive=zr.toWorkingColorSpace((new Bo).fromArray(e),Bi);break;case"map_kd":r("map",e);break;case"map_ks":r("specularMap",e);break;case"map_ke":r("emissiveMap",e);break;case"norm":r("normalMap",e);break;case"map_bump":case"bump":r("bumpMap",e);break;case"map_d":r("alphaMap",e),i.transparent=!0;break;case"ns":i.shininess=parseFloat(e);break;case"d":s=parseFloat(e),s<1&&(i.opacity=s,i.transparent=!0);break;case"tr":s=parseFloat(e),this.options&&this.options.invertTrProperty&&(s=1-s),s>0&&(i.opacity=1-s,i.transparent=!0)}}return this.materials[t]=new su(i),this.materials[t]}getTextureParams(t,e){const n={scale:new Br(1,1),offset:new Br(0,0)},i=t.split(/\s+/);let r;return r=i.indexOf("-bm"),r>=0&&(e.bumpScale=parseFloat(i[r+1]),i.splice(r,2)),r=i.indexOf("-s"),r>=0&&(n.scale.set(parseFloat(i[r+1]),parseFloat(i[r+2])),i.splice(r,4)),r=i.indexOf("-o"),r>=0&&(n.offset.set(parseFloat(i[r+1]),parseFloat(i[r+2])),i.splice(r,4)),n.url=i.join(" ").trim(),n}loadTexture(t,e,n,i,r){const s=void 0!==this.manager?this.manager:Uu;let o=s.getHandler(t);null===o&&(o=new ju(s)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin);const a=o.load(t,n,i,r);return void 0!==e&&(a.mapping=e),a}}function Cy(t,e){switch(e){case Bi:t.convertSRGBToLinear();break;case Ti:case Ii:break;default:console.warn("WARNING: LightProbeGenerator convertColorToLinear() encountered an unsupported color space.")}return t}var wy=globalThis.THREE={...t};wy.DRACOLoader=class extends Ou{constructor(t){super(t),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,n,i){const r=new Nu(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,(t=>{this.parse(t,e,i)}),n,i)}parse(t,e,n=()=>{}){this.decodeDracoFile(t,e,null,null,Bi,n).catch(n)}decodeDracoFile(t,e,n,i,r=Ti,s=()=>{}){const o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(t,o).then(e).catch(s)}decodeGeometry(t,e){const n=JSON.stringify(e);if(Fm.has(t)){const e=Fm.get(t);if(e.key===n)return e.promise;if(0===t.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,s=t.byteLength,o=this._getWorker(r,s).then((n=>(i=n,new Promise(((n,s)=>{i._callbacks[r]={resolve:n,reject:s},i.postMessage({type:"decode",id:r,taskConfig:e,buffer:t},[t])}))))).then((t=>this._createGeometry(t.geometry)));return o.catch((()=>!0)).then((()=>{i&&r&&this._releaseTask(i,r)})),Fm.set(t,{key:n,promise:o}),o}_createGeometry(t){const e=new sa;t.index&&e.setIndex(new zo(t.index.array,1));for(let n=0;n<t.attributes.length;n++){const i=t.attributes[n],r=i.name,s=i.array,o=i.itemSize,a=new zo(s,o);"color"===r&&(this._assignVertexColorSpace(a,i.vertexColorSpace),a.normalized=s instanceof Float32Array==0),e.setAttribute(r,a)}return e}_assignVertexColorSpace(t,e){if(e!==Bi)return;const n=new Bo;for(let e=0,i=t.count;e<i;e++)n.fromBufferAttribute(t,e),zr.toWorkingColorSpace(n,Bi),t.setXYZ(e,n.r,n.g,n.b)}_loadLibrary(t,e){const n=new Nu(this.manager);return n.setPath(this.decoderPath),n.setResponseType(e),n.setWithCredentials(this.withCredentials),new Promise(((e,i)=>{n.load(t,e,void 0,i)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const t="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,e=[];return t?e.push(this._loadLibrary("draco_decoder.js","text")):(e.push(this._loadLibrary("draco_wasm_wrapper.js","text")),e.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(e).then((e=>{const n=e[0];t||(this.decoderConfig.wasmBinary=e[1]);const i=km.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))})),this.decoderPending}_getWorker(t,e){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const t=new Worker(this.workerSourceURL);t._callbacks={},t._taskCosts={},t._taskLoad=0,t.postMessage({type:"init",decoderConfig:this.decoderConfig}),t.onmessage=function(e){const n=e.data;switch(n.type){case"decode":t._callbacks[n.id].resolve(n);break;case"error":t._callbacks[n.id].reject(n);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+n.type+'"')}},this.workerPool.push(t)}else this.workerPool.sort((function(t,e){return t._taskLoad>e._taskLoad?-1:1}));const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[t]=e,n._taskLoad+=e,n}))}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map((t=>t._taskLoad)))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}},wy.GLTFLoader=class extends Ou{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(t){return new wg(t)})),this.register((function(t){return new _g(t)})),this.register((function(t){return new Pg(t)})),this.register((function(t){return new Ug(t)})),this.register((function(t){return new Og(t)})),this.register((function(t){return new Sg(t)})),this.register((function(t){return new Ig(t)})),this.register((function(t){return new Bg(t)})),this.register((function(t){return new Tg(t)})),this.register((function(t){return new Cg(t)})),this.register((function(t){return new Rg(t)})),this.register((function(t){return new Mg(t)})),this.register((function(t){return new Dg(t)})),this.register((function(t){return new Lg(t)})),this.register((function(t){return new xg(t)})),this.register((function(t){return new Fg(t)})),this.register((function(t){return new kg(t)}))}load(t,e,n,i){const r=this;let s;if(""!==this.resourcePath)s=this.resourcePath;else if(""!==this.path){const e=pd.extractUrlBase(t);s=pd.resolveURL(e,this.path)}else s=pd.extractUrlBase(t);this.manager.itemStart(t);const o=function(e){i?i(e):console.error(e),r.manager.itemError(t),r.manager.itemEnd(t)},a=new Nu(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){try{r.parse(n,s,(function(n){e(n),r.manager.itemEnd(t)}),o)}catch(t){o(t)}}),n,o)}setDRACOLoader(t){return this.dracoLoader=t,this}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,n,i){let r;const s={},o={},a=new TextDecoder;if("string"==typeof t)r=JSON.parse(t);else if(t instanceof ArrayBuffer)if(a.decode(new Uint8Array(t,0,4))===Ng){try{s[$m]=new Qg(t)}catch(t){return void(i&&i(t))}r=JSON.parse(s[$m].content)}else r=JSON.parse(a.decode(t));else r=t;if(void 0===r.asset||r.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new cv(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let t=0;t<this.pluginCallbacks.length;t++){const e=this.pluginCallbacks[t](l);e.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[e.name]=e,s[e.name]=!0}if(r.extensionsUsed)for(let t=0;t<r.extensionsUsed.length;++t){const e=r.extensionsUsed[t],n=r.extensionsRequired||[];switch(e){case hg:s[e]=new bg;break;case tg:s[e]=new Gg(r,this.dracoLoader);break;case pg:s[e]=new zg;break;case Ag:s[e]=new Hg;break;default:n.indexOf(e)>=0&&void 0===o[e]&&console.warn('THREE.GLTFLoader: Unknown extension "'+e+'".')}}l.setExtensions(s),l.setPlugins(o),l.parse(n,i)}parseAsync(t,e){const n=this;return new Promise((function(i,r){n.parse(t,e,i,r)}))}},wy.KTX2Loader=Gv,wy.OBJLoader=class extends Ou{constructor(t){super(t),this.materials=null}load(t,e,n,i){const r=this,s=new Nu(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{e(r.parse(n))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}setMaterials(t){return this.materials=t,this}parse(t){const e=new xy;-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n")),-1!==t.indexOf("\\\n")&&(t=t.replace(/\\\n/g,""));const n=t.split("\n");let i=[];for(let t=0,r=n.length;t<r;t++){const r=n[t].trimStart();if(0===r.length)continue;const s=r.charAt(0);if("#"!==s)if("v"===s){const t=r.split(Ay);switch(t[0]){case"v":e.vertices.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])),t.length>=7?(Ey.setRGB(parseFloat(t[4]),parseFloat(t[5]),parseFloat(t[6]),Bi),e.colors.push(Ey.r,Ey.g,Ey.b)):e.colors.push(void 0,void 0,void 0);break;case"vn":e.normals.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3]));break;case"vt":e.uvs.push(parseFloat(t[1]),parseFloat(t[2]))}}else if("f"===s){const t=r.slice(1).trim().split(Ay),n=[];for(let e=0,i=t.length;e<i;e++){const i=t[e];if(i.length>0){const t=i.split("/");n.push(t)}}const i=n[0];for(let t=1,r=n.length-1;t<r;t++){const r=n[t],s=n[t+1];e.addFace(i[0],r[0],s[0],i[1],r[1],s[1],i[2],r[2],s[2])}}else if("l"===s){const t=r.substring(1).trim().split(" ");let n=[];const i=[];if(-1===r.indexOf("/"))n=t;else for(let e=0,r=t.length;e<r;e++){const r=t[e].split("/");""!==r[0]&&n.push(r[0]),""!==r[1]&&i.push(r[1])}e.addLineGeometry(n,i)}else if("p"===s){const t=r.slice(1).trim().split(" ");e.addPointGeometry(t)}else if(null!==(i=hy.exec(r))){const t=(" "+i[0].slice(1).trim()).slice(1);e.startObject(t)}else if(dy.test(r))e.object.startMaterial(r.substring(7).trim(),e.materialLibraries);else if(uy.test(r))e.materialLibraries.push(r.substring(7).trim());else if(py.test(r))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if("s"===s){if(i=r.split(" "),i.length>1){const t=i[1].trim().toLowerCase();e.object.smooth="0"!==t&&"off"!==t}else e.object.smooth=!0;const t=e.object.currentMaterial();t&&(t.smooth=e.object.smooth)}else{if("\0"===r)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+r+'"')}}e.finalize();const r=new Pa;if(r.materialLibraries=[].concat(e.materialLibraries),!0==!(1===e.objects.length&&0===e.objects[0].geometry.vertices.length))for(let t=0,n=e.objects.length;t<n;t++){const n=e.objects[t],i=n.geometry,s=n.materials,o="Line"===i.type,a="Points"===i.type;let l=!1;if(0===i.vertices.length)continue;const c=new sa;c.setAttribute("position",new Ko(i.vertices,3)),i.normals.length>0&&c.setAttribute("normal",new Ko(i.normals,3)),i.colors.length>0&&(l=!0,c.setAttribute("color",new Ko(i.colors,3))),!0===i.hasUVIndices&&c.setAttribute("uv",new Ko(i.uvs,2));const h=[];for(let t=0,n=s.length;t<n;t++){const n=s[t],i=n.name+"_"+n.smooth+"_"+l;let r=e.materials[i];if(null!==this.materials)if(r=this.materials.create(n.name),!o||!r||r instanceof ic){if(a&&r&&!(r instanceof gc)){const t=new gc({size:10,sizeAttenuation:!1});Lo.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,r=t}}else{const t=new ic;Lo.prototype.copy.call(t,r),t.color.copy(r.color),r=t}void 0===r&&(r=o?new ic:a?new gc({size:1,sizeAttenuation:!1}):new su,r.name=n.name,r.flatShading=!n.smooth,r.vertexColors=l,e.materials[i]=r),h.push(r)}let u;if(h.length>1){for(let t=0,e=s.length;t<e;t++){const e=s[t];c.addGroup(e.groupStart,e.groupCount,t)}u=o?new fc(c,h):a?new bc(c,h):new ga(c,h)}else u=o?new fc(c,h[0]):a?new bc(c,h[0]):new ga(c,h[0]);u.name=n.name,r.add(u)}else if(e.vertices.length>0){const t=new gc({size:1,sizeAttenuation:!1}),n=new sa;n.setAttribute("position",new Ko(e.vertices,3)),e.colors.length>0&&void 0!==e.colors[0]&&(n.setAttribute("color",new Ko(e.colors,3)),t.vertexColors=!0);const i=new bc(n,t);r.add(i)}return r}},wy.MTLLoader=class extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=""===this.path?pd.extractUrlBase(t):this.path,o=new Nu(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){try{e(r.parse(n,s))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}setMaterialOptions(t){return this.materialOptions=t,this}parse(t,e){const n=t.split("\n");let i={};const r=/\s+/,s={};for(let t=0;t<n.length;t++){let e=n[t];if(e=e.trim(),0===e.length||"#"===e.charAt(0))continue;const o=e.indexOf(" ");let a=o>=0?e.substring(0,o):e;a=a.toLowerCase();let l=o>=0?e.substring(o+1):"";if(l=l.trim(),"newmtl"===a)i={name:l},s[l]=i;else if("ka"===a||"kd"===a||"ks"===a||"ke"===a){const t=l.split(r,3);i[a]=[parseFloat(t[0]),parseFloat(t[1]),parseFloat(t[2])]}else i[a]=l}const o=new by(this.resourcePath||e,this.materialOptions);return o.setCrossOrigin(this.crossOrigin),o.setManager(this.manager),o.setMaterials(s),o}},wy.OBB=ly,wy.BufferGeometryUtils=e,wy.LightProbeGenerator=class{static fromCubeTexture(t){let e=0;const n=new os,i=new os,r=new Bo,s=[0,0,0,0,0,0,0,0,0],o=new hd,a=o.coefficients;for(let o=0;o<6;o++){const l=t.image[o],c=l.width,h=l.height,u=document.createElement("canvas");u.width=c,u.height=h;const d=u.getContext("2d");d.drawImage(l,0,0,c,h);const p=d.getImageData(0,0,c,h),A=p.data,f=p.width,m=2/f;for(let l=0,c=A.length;l<c;l+=4){r.setRGB(A[l]/255,A[l+1]/255,A[l+2]/255),Cy(r,t.colorSpace);const c=l/4,h=(c%f+.5)*m-1,u=1-(Math.floor(c/f)+.5)*m;switch(o){case 0:n.set(-1,u,-h);break;case 1:n.set(1,u,h);break;case 2:n.set(-h,1,-u);break;case 3:n.set(-h,-1,u);break;case 4:n.set(-h,u,1);break;case 5:n.set(h,u,-1)}const d=n.lengthSq(),p=4/(Math.sqrt(d)*d);e+=p,i.copy(n).normalize(),hd.getBasisAt(i,s);for(let t=0;t<9;t++)a[t].x+=s[t]*r.r*p,a[t].y+=s[t]*r.g*p,a[t].z+=s[t]*r.b*p}}const l=4*Math.PI/e;for(let t=0;t<9;t++)a[t].x*=l,a[t].y*=l,a[t].z*=l;return new ud(o)}static async fromCubeRenderTarget(t,e){const n=t.coordinateSystem===Ar?-1:1;let i=0;const r=new os,s=new os,o=new Bo,a=[0,0,0,0,0,0,0,0,0],l=new hd,c=l.coefficients,h=e.texture.type,u=e.width;let d;t.isWebGLRenderer&&(d=h===dn?new Uint16Array(u*u*4):new Uint8Array(u*u*4));for(let l=0;l<6;l++){t.isWebGLRenderer?await t.readRenderTargetPixelsAsync(e,0,0,u,u,d,l):d=await t.readRenderTargetPixelsAsync(e,0,0,u,u,0,l);const p=2/u;for(let t=0,A=d.length;t<A;t+=4){let A,f,m;h===dn?(A=ko.fromHalfFloat(d[t]),f=ko.fromHalfFloat(d[t+1]),m=ko.fromHalfFloat(d[t+2])):(A=d[t]/255,f=d[t+1]/255,m=d[t+2]/255),o.setRGB(A,f,m),Cy(o,e.texture.colorSpace);const g=t/4,v=(1-(g%u+.5)*p)*n,y=1-(Math.floor(g/u)+.5)*p;switch(l){case 0:r.set(-1*n,y,v*n);break;case 1:r.set(1*n,y,-v*n);break;case 2:r.set(v,1,-y);break;case 3:r.set(v,-1,y);break;case 4:r.set(v,y,1);break;case 5:r.set(-v,y,-1)}const E=r.lengthSq(),x=4/(Math.sqrt(E)*E);i+=x,s.copy(r).normalize(),hd.getBasisAt(s,a);for(let t=0;t<9;t++)c[t].x+=a[t]*o.r*x,c[t].y+=a[t]*o.g*x,c[t].z+=a[t]*o.b*x}}const p=4*Math.PI/i;for(let t=0;t<9;t++)c[t].x*=p,c[t].y*=p,c[t].z*=p;return new ud(l)}},wy.DeviceOrientationControls=function(t){var e=this;this.object=t,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0,this.alphaOffset=0;var n,i,r,s,o=function(t){e.deviceOrientation=t},a=function(){e.screenOrientation=window.orientation||0},l=(n=new THREE.Vector3(0,0,1),i=new THREE.Euler,r=new THREE.Quaternion,s=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),function(t,e,o,a,l){i.set(o,e,-a,"YXZ"),t.setFromEuler(i),t.multiply(s),t.multiply(r.setFromAxisAngle(n,-l))});this.connect=function(){a(),window.addEventListener("orientationchange",a,!1),window.addEventListener("deviceorientation",o,!1),e.enabled=!0},this.disconnect=function(){window.removeEventListener("orientationchange",a,!1),window.removeEventListener("deviceorientation",o,!1),e.enabled=!1},this.update=function(){if(!1!==e.enabled){var t=e.deviceOrientation;if(t){var n=t.alpha?THREE.MathUtils.degToRad(t.alpha)+e.alphaOffset:0,i=t.beta?THREE.MathUtils.degToRad(t.beta):0,r=t.gamma?THREE.MathUtils.degToRad(t.gamma):0,s=e.screenOrientation?THREE.MathUtils.degToRad(e.screenOrientation):0;l(e.object.quaternion,n,i,r,s)}}},this.dispose=function(){e.disconnect()},this.connect()},wy.Cache.enabled=!0;const _y=wy;var My=window.AFRAME_CDN_ROOT||"https://cdn.aframe.io/",Sy="aframe-injected",Iy=n(8878),By=n.n(Iy),Ty={colors:{debug:"gray",error:"red",info:"gray",warn:"orange"}};By().formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" "),this.useColors){var e;this.color=(e=function(t){var e=t.split(":");return e[e.length-1]}(this.namespace),Ty.colors&&Ty.colors[e]||null);var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var i=0,r=0;t[0].replace(/%[a-zA-Z%]/g,(function(t){"%%"!==t&&(i++,"%c"===t&&(r=i))})),t.splice(r,0,n)}};var Ry=function(){try{return window.localStorage}catch(t){}}();Ry&&(parseInt(Ry.logs,10)||"true"===Ry.logs)?By().enable("*"):By().enable("*:error,*:info,*:warn");const Ly=By();var Dy=n(1124),Py=n.n(Dy),Uy=Ly("device:error"),Oy=!1,Fy=!1,ky=void 0!==navigator.xr;if(ky){var Ny=function(){var t=document.querySelector("a-scene");t?t.hasLoaded?t.components["xr-mode-ui"].updateEnterInterfaces():t.addEventListener("loaded",Ny):window.addEventListener("DOMContentLoaded",Ny)},Qy=function(t){Uy("WebXR session support error: "+t.message)};navigator.xr.isSessionSupported?(navigator.xr.isSessionSupported("immersive-vr").then((function(t){Oy=t,Ny()})).catch(Qy),navigator.xr.isSessionSupported("immersive-ar").then((function(t){Fy=t,Ny()})).catch((function(){}))):navigator.xr.supportsSession?(navigator.xr.supportsSession("immersive-vr").then((function(){Oy=!0,Ny()})).catch(Qy),navigator.xr.supportsSession("immersive-ar").then((function(){Fy=!0,Ny()})).catch((function(){}))):Uy("WebXR has neither isSessionSupported or supportsSession?!")}function Gy(){return Oy||Fy}function zy(){return Fy}function Hy(){return Oy}var Vy,jy,Wy=(Vy=!1,jy=window.navigator.userAgent||window.navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(jy)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(jy.substr(0,4)))&&(Vy=!0),(Jy()||qy()||eE())&&(Vy=!0),tE()&&(Vy=!1),function(){return Vy});function qy(t){var e=t||window.navigator.userAgent;return/Nexus (7|9)|xoom|sch-i800|playbook|tablet|kindle/i.test(e)||Xy()}function Xy(t,e,n){var i=t||window.navigator.userAgent,r=e||window.navigator.platform,s=n||window.navigator.maxTouchPoints||0;return("iPad"===r||"MacIntel"===r)&&s>0&&/Macintosh|Intel|iPad|ipad/i.test(i)&&!window.MSStream}function Yy(){var t=navigator.userAgent.includes("Macintosh"),e=5===navigator.maxTouchPoints;return t&&e&&ky}function Jy(){return/iPad|iPhone|iPod/.test(window.navigator.platform)}function Ky(){return!Wy()&&!tE()&&void 0!==window.orientation}function Zy(){return/(OculusBrowser)/i.test(window.navigator.userAgent)}function $y(){return/(Mobile VR)/i.test(window.navigator.userAgent)}function tE(){return Zy()||$y()||Yy()}function eE(){return/R7 Build/.test(window.navigator.userAgent)}function nE(){var t=window.orientation;return eE()&&(t+=90),90===t||-90===t}var iE="undefined"==typeof process,rE=!iE,sE=Object.freeze(Object.create(null));function oE(){return{}}function aE(t){var e=[],n=null;function i(i){var r,s;if((i=void 0===i?e.length:i)>0&&null==n&&(n=0),i>0)for(r=e.length,e.length+=Number(i),s=r;s<e.length;s++)e[s]=t();return e.length}return t=t||oE,{grow:i,pool:e,recycle:function(t){t instanceof Object&&(null!==n&&-1!==n?e[--n]=t:e[e.length]=t)},size:function(){return e.length},use:function(){var t;return null!==n&&n!==e.length||i(e.length||5),t=e[n],e[n++]=sE,lE(t),t}}}function lE(t){var e;if(t&&t.constructor===Object)for(e in t)t[e]=void 0}function cE(t,e){var n;if(t&&t.constructor===Object)for(n in t)n in e||delete t[n]}var hE=Ly("utils:coordinates:warn"),uE=["x","y","z","w"],dE=/^\s*((-?\d*\.{0,1}\d+(e-?\d+)?)\s+){2,3}(-?\d*\.{0,1}\d+(e-?\d+)?)\s*$/,pE=/\s+/g;function AE(t,e,n){var i,r,s,o,a,l,c,h,u=n&&"object"==typeof n?n:{};if(t&&t instanceof Object)return a=void 0===t.x?e&&e.x:t.x,l=void 0===t.y?e&&e.y:t.y,c=void 0===t.z?e&&e.z:t.z,h=void 0===t.w?e&&e.w:t.w,null!=a&&(u.x=yE(a)),null!=l&&(u.y=yE(l)),null!=c&&(u.z=yE(c)),null!=h&&(u.w=yE(h)),u;if(null==t)return"object"==typeof e?Object.assign(u,e):e;for(i=t.trim().split(pE),o=0;o<uE.length;o++)if(s=uE[o],i[o])u[s]=parseFloat(i[o],10);else{if(void 0===(r=e&&e[s]))continue;u[s]=yE(r)}return u}function fE(t){var e;return"object"!=typeof t?t:(e=t.x+" "+t.y,null!=t.z&&(e+=" "+t.z),null!=t.w&&(e+=" "+t.w),e)}function mE(t,e){return"object"!=typeof t||"object"!=typeof e?t===e:t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w}function gE(t){return dE.test(t)}function vE(t){return hE("`AFRAME.utils.isCoordinate` has been renamed to `AFRAME.utils.isCoordinates`"),gE(t)}function yE(t){return null!=t&&t.constructor===String?parseFloat(t,10):t}function EE(t){return new THREE.Vector3(t.x,t.y,t.z)}var xE=function(){var t={};return function(e,n){return n in t||(t[n]={}),e in t[n]||(t[n][e]=e.split(n)),t[n][e]}}();function bE(t,e){var n=xE(t,e=e||".");return 1===n.length?n[0]:n}function CE(t,e,n){var i;return n=n||".",-1!==e.indexOf(n)?(i=bE(e,n)).constructor===String?t.getAttribute(i):t.getAttribute(i[0])[i[1]]:t.getAttribute(e)}function wE(t,e,n,i){var r;i=i||".",-1===e.indexOf(i)?t.setAttribute(e,n):(r=bE(e,i)).constructor===String?t.setAttribute(r,n):t.setAttribute(r[0],r[1],n)}function _E(t){var e=t.style.width,n=t.style.height;t.style.width=parseInt(e,10)+1+"px",t.style.height=parseInt(n,10)+1+"px",setTimeout((function(){t.style.width=e,t.style.height=n}),200)}var ME=Ly("utils:src-loader:warn");function SE(t,e,n){!function(t,e){var n;t.tagName?e("IMG"===t.tagName):((n=new XMLHttpRequest).open("HEAD",t),n.addEventListener("load",(function(i){var r;n.status>=200&&n.status<300?null==(r=n.getResponseHeader("Content-Type"))?RE(t,e):r.startsWith("image")?e(!0):e(!1):RE(t,e),n.abort()})),n.send())}(t,(function(i){i?e(t):n(t)}))}function IE(t,e,n){var i,r,s,o="",a=[];if("string"==typeof t){for(r=0;r<5;r++)o+="(url\\((?:[^\\)]+)\\),\\s*)";function l(t){a.push(t),6===a.length&&e(a)}if(o+="(url\\((?:[^\\)]+)\\)\\s*)",s=t.match(new RegExp(o))){for(r=1;r<7;r++)SE(TE(s[r]),l);return}if(!t.startsWith("#"))return void SE(TE(t)||t,n)}if(i=t.tagName?t:function(t){try{var e=document.querySelector(t);return e||ME('No element was found matching the selector: "%s"',t),e}catch(e){return void ME('"%s" is not a valid selector',t)}}(t))return"A-CUBEMAP"===i.tagName&&i.srcs?e(i.srcs):"IMG"===i.tagName?n(i):void ME('Selector "%s" does not point to <a-cubemap> or <img>',t)}function BE(t,e){return IE(t,e,(function(){ME("Expected cubemap but got image")}))}function TE(t){var e=t.match(/url\((.+)\)/);if(e)return e[1]}function RE(t,e){var n=new Image;n.addEventListener("load",(function(){e(!0)})),n.addEventListener("error",(function(){e(!1)})),n.src=t}var LE=Ly("utils:material:warn"),DE=new Set(["emissiveMap","envMap","map","specularMap"]);function PE(t,e){var n=e.offset||{x:0,y:0},i=e.repeat||{x:1,y:1},r=e.npot||!1,s=e.anisotropy||_y.Texture.DEFAULT_ANISOTROPY,o=t.wrapS,a=t.wrapT,l=t.magFilter,c=t.minFilter;r&&(o=_y.ClampToEdgeWrapping,a=_y.ClampToEdgeWrapping,l=_y.LinearFilter,c=_y.LinearFilter),1===i.x&&1===i.y||(o=_y.RepeatWrapping,a=_y.RepeatWrapping),t.offset.set(n.x,n.y),t.repeat.set(i.x,i.y),t.wrapS===o&&t.wrapT===a&&t.magFilter===l&&t.minFilter===c&&t.anisotropy===s||(t.wrapS=o,t.wrapT=a,t.magFilter=l,t.minFilter=c,t.anisotropy=s,t.needsUpdate=!0)}function UE(t,e,n,i){var r=n.el,s=n.material,o=r.sceneEl.systems.renderer,a=i[e];if(n.materialSrcs||(n.materialSrcs={}),!a)return delete n.materialSrcs[t],void l(null);function l(e){s[t]!==e&&(s[t]&&s[t].dispose(),s[t]=e,s.needsUpdate=!0,QE(r,e))}a===n.materialSrcs[t]&&s[t]?PE(s[t],i):(n.materialSrcs[t]=a,a instanceof _y.Texture?l(a):r.sceneEl.systems.material.loadTextureSource(a,(function(e){if(n.materialSrcs[t]===a){var r=s[t];!r||null!==e&&GE(r,e)||(r=null),!r&&e&&(r=zE(e)),r&&(r.source!==e&&(r.source=e,r.needsUpdate=!0),DE.has(t)&&o.applyColorCorrection(r),PE(r,i)),l(r)}})))}function OE(t,e){return UE("map","src",t,e)}function FE(t,e,n){var i=t;"ambientOcclusion"===t&&(i="ao");var r={};return r.src=n[t+"Map"],r.offset=n[t+"TextureOffset"],r.repeat=n[t+"TextureRepeat"],r.wrap=n[t+"TextureWrap"],UE(i+"Map","src",e,r)}var kE={};function NE(t,e){var n=t.material,i=t.el,r="envMap",s=e.envMap,o=e.sphericalEnvMap,a=e.refract;if(o&&(s=o,LE("`sphericalEnvMap` property is deprecated, using spherical map as equirectangular map instead. Use `envMap` property with a CubeMap or Equirectangular image instead.")),t.materialSrcs||(t.materialSrcs={}),!s)return delete t.materialSrcs[r],n.envMap=null,void(n.needsUpdate=!0);function l(e){t.materialSrcs[r]===s&&(n.envMap=e,n.needsUpdate=!0,QE(i,e))}t.materialSrcs[r]=s,kE[s]?kE[s].then(l):kE[s]=new Promise((function(t){IE(s,(function(e){i.sceneEl.systems.material.loadCubeMapTexture(e,(function(e){e.mapping=a?_y.CubeRefractionMapping:_y.CubeReflectionMapping,l(e),t(e)}))}),(function(e){i.sceneEl.systems.material.loadTexture(e,{src:e},(function(e){e.mapping=a?_y.EquirectangularRefractionMapping:_y.EquirectangularReflectionMapping,l(e),t(e)}))}))}))}function QE(t,e){function n(){t.emit("materialvideoloadeddata",{src:e.image,texture:e})}function i(){t.emit("materialvideoended",{src:e.image,texture:e})}e&&(t.emit("materialtextureloaded",{src:e.image,texture:e}),e.image&&"VIDEO"===e.image.tagName&&(e.image.addEventListener("loadeddata",n),e.image.addEventListener("ended",i),e.addEventListener("dispose",(function(){e.image.removeEventListener("loadeddata",n),e.image.removeEventListener("ended",i)}))))}function GE(t,e){return t.source===e&&(e.data instanceof HTMLCanvasElement?t.isCanvasTexture:e.data instanceof HTMLVideoElement?t.isVideoTexture:t.isTexture&&!t.isCanvasTexture&&!t.isVideoTexture)}function zE(t){var e;return(e=t.data instanceof HTMLCanvasElement?new _y.CanvasTexture:t.data instanceof HTMLVideoElement?new _y.VideoTexture(t.data):new _y.Texture).source=t,e.needsUpdate=!0,e}var HE=/-([a-z])/g;function VE(t,e){var n;return"string"!=typeof t?t:(n=function(t,e){var n,i,r,s,o,a;for(e=e||{},n=YE(t),i=0;i<n.length;i++)(r=n[i])&&(s=r.indexOf(":"),o=r.substr(0,s).trim(),a=r.substr(s+1).trim(),e[WE(o)]=a);return e}(t,e),n[""]?t:n)}function jE(t){return"string"==typeof t?t:function(t){var e,n=0,i=0,r="";for(e in t)n++;for(e in t)r+=e+": "+t[e],i<n-1&&(r+="; "),i++;return r}(t)}function WE(t){return t.replace(HE,JE)}var qE,XE,YE=(qE=[],XE=/url\([^)]+$/,function(t){var e,n="",i=0;for(qE.length=0;i<t.length;)-1===(e=t.indexOf(";",i))&&(e=t.length),n+=t.substring(i,e),XE.test(n)?(n+=";",i=e+1):(qE.push(n.trim()),n="",i=e+1);return qE});function JE(t){return t[1].toUpperCase()}var KE=["x","y","z","w"];function ZE(t,e,n){var i,r,s=t.el;if((r=!!(i=$E(t,e,n)))===t.controllerPresent)return r;t.controllerPresent=r,r?(t.addEventListeners(),t.injectTrackedControls(i),s.emit("controllerconnected",{name:t.name,component:t})):(t.removeEventListeners(),s.emit("controllerdisconnected",{name:t.name,component:t}))}function $E(t,e,n){var i,r=t.el.sceneEl,s=r&&r.systems["tracked-controls"];return!!s&&!(!(i=s.controllers)||!i.length)&&tx(i,e,n.hand,n.index,n.iterateControllerProfiles,n.handTracking)}function tx(t,e,n,i,r,s){var o,a,l,c,h=!1;for(o=0;o<t.length;o++){if(c=(l=t[o]).profiles,s)h=l.hand;else if(r)for(a=0;a<c.length&&!(h=c[a].startsWith(e));a++);else h=c.length>0&&c[0].startsWith(e);if(h)if("right"===l.handedness||"left"===l.handedness){if(l.handedness===n)return t[o]}else if(o===i)return t[o]}}function ex(t,e,n){var i,r,s,o,a;for(r in e){for(i=e[r],s=!1,a=0;a<i.length;a++)n.detail.changed[i[a]]&&(s=!0);if(s){for(o={},a=0;a<i.length;a++)o[KE[a]]=n.detail.axis[i[a]];t.el.emit(r+"moved",o)}}}function nx(t,e,n,i){var r=(i?n.mapping[i]:n.mapping).buttons[t];n.el.emit(r+e),n.updateModel&&n.updateModel(r,e)}var ix=Ly("utils:warn");function rx(t){return t.bind.apply(t,Array.prototype.slice.call(arguments,1))}function sx(){return ix("`utils.checkHeadsetConnected` has moved to `utils.device.checkHeadsetConnected`"),Gy()}function ox(){return ix("`utils.isIOS` has moved to `utils.device.isIOS`"),Jy()}function ax(){return ix("`utils.isMobile has moved to `utils.device.isMobile`"),Wy(arguments)}function lx(t,e,n){var i;return n&&(t=t.bind(n)),function(){var n=Date.now();(void 0===i||(void 0===i?e:n-i)>=e)&&(i=n,t.apply(null,arguments))}}function cx(t,e,n){var i,r,s;n&&(t=t.bind(n));var o=function(){i=Date.now(),t.apply(this,s),r=void 0};return function(){var n=Date.now(),a=void 0===i?e:n-i;a>=e?(clearTimeout(r),r=void 0,i=n,t.apply(null,arguments)):(r=r||setTimeout(o,e-a),s=arguments)}}function hx(t,e,n){var i;return n&&(t=t.bind(n)),function(n,r){var s=void 0===i?r:n-i;(void 0===i||s>=e)&&(i=n,t(n,s))}}function ux(t,e,n){var i;return function(){var r=this,s=arguments,o=n&&!i;clearTimeout(i),i=setTimeout((function(){i=null,n||t.apply(r,s)}),e),o&&t.apply(r,s)}}var dx=Object.assign,px=Py();function Ax(t){return JSON.parse(JSON.stringify(t))}var fx,mx,gx=(fx=aE((function(){return[]})),function(t,e){var n,i,r,s,o,a;if(void 0===t||void 0===e||null===t||null===e||!(t&&e&&t.constructor===Object&&e.constructor===Object||t.constructor===Array&&e.constructor===Array))return t===e;for(n in i=fx.use(),r=fx.use(),i.length=0,r.length=0,t)i.push(n);for(n in e)r.push(n);if(i.length!==r.length)return fx.recycle(i),fx.recycle(r),!1;for(s=0;s<i.length;++s)if(o=t[i[s]],a=e[i[s]],"object"==typeof o||"object"==typeof a||Array.isArray(o)&&Array.isArray(a)){if(o===a)continue;if(!gx(o,a))return fx.recycle(i),fx.recycle(r),!1}else if(o!==a)return fx.recycle(i),fx.recycle(r),!1;return fx.recycle(i),fx.recycle(r),!0}),vx=(mx=[],function(t,e,n){var i,r,s,o,a,l,c;for(a in o=n||{},mx.length=0,t)mx.push(a);if(!e)return o;for(s in e)-1===mx.indexOf(s)&&mx.push(s);for(l=0;l<mx.length;l++)i=t[a=mx[l]],r=e[a],((c=i&&r&&i.constructor===Object&&r.constructor===Object)&&!gx(i,r)||!c&&i!==r)&&(o[a]=r);return o});function yx(t){return!t.metaKey&&document.activeElement===document.body}function Ex(t,e){void 0===e&&(e=" ");var n=new RegExp(e,"g");return(t=(t||"").replace(n,e)).split(e)}function xx(t,e){e=e||{};var n={};return Object.keys(e).forEach((function(e){t.hasAttribute(e)&&(n[e]=t.getAttribute(e))})),n}function bx(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))}function Cx(){return window.top!==window.self}function wx(t){for(var e=[],n=t.getElementsByTagName("*"),i=0,r=n.length;i<r;i++)n[i].isScene&&e.push(n[i]);return e}var _x,Mx=[Ix({name:"viewport",content:"width=device-width,initial-scale=1,maximum-scale=1,shrink-to-fit=no,user-scalable=no,minimal-ui,viewport-fit=cover"}),Ix({name:"mobile-web-app-capable",content:"yes"}),Ix({name:"theme-color",content:"black"})],Sx=[Ix({name:"apple-mobile-web-app-capable",content:"yes"}),Ix({name:"apple-mobile-web-app-status-bar-style",content:"black"}),(_x={rel:"apple-touch-icon",href:"https://aframe.io/images/aframe-logo-152.png"},{tagName:"link",attributes:_x,exists:function(){return document.querySelector('link[rel="'+_x.rel+'"]')}})];function Ix(t){return{tagName:"meta",attributes:t,exists:function(){return document.querySelector('meta[name="'+t.name+'"]')}}}var Bx,Tx,Rx,Lx=n(5928),Dx=n.n(Lx),Px=h,Ux="loading-screen";function Ox(t){var e=Bx.hasAttribute("embedded"),n=Rx(Bx.canvas,e,Bx.maxCanvasSize,Bx.is("vr-mode"));t.aspect=n.width/n.height,t.updateProjectionMatrix(),Bx.renderer.setSize(n.width,n.height,!1)}const Fx=[];var kx=By()("core:propertyTypes:warn"),Nx={},Qx=/[,> .[\]:]/,Gx=/url\((.+)\)/;function zx(t,e,n,i,r,s){if(t in Nx)throw new Error("Property type "+t+" is already registered.");Nx[t]={default:e,parse:n||Wx,stringify:i||qx,equals:r||Xx,isCacheable:!1!==s}}function Hx(t,e){if(!Array.isArray(t)||!Array.isArray(e))return t===e;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function Vx(t){var e,n;return"string"!=typeof t?t:(n=t.match(Gx))?n[1]:"#"===t.charAt(0)?(e=document.getElementById(t.substring(1)))?"CANVAS"===e.tagName||"VIDEO"===e.tagName||"IMG"===e.tagName?e:e.getAttribute("src"):void kx('"'+t+'" asset not found.'):t}function jx(t){return t.getAttribute?t.getAttribute("id")?"#"+t.getAttribute("id"):t.getAttribute("src"):qx(t)}function Wx(t){return t}function qx(t){return null===t?"null":t.toString()}function Xx(t,e){return t===e}function Yx(t){return parseInt(t,10)}function Jx(t,e,n){return AE(t,e,n)}function Kx(t,e){if(null===t)return!0;if("object"!=typeof t)return!1;if(Object.keys(t).length!==e)return!1;var n=t.x,i=t.y,r=t.z,s=t.w;return!("number"!=typeof n||"number"!=typeof i||e>2&&"number"!=typeof r||e>3&&"number"!=typeof s)}zx("audio","",Vx,jx),zx("array",[],(function(t){return Array.isArray(t)?t:t&&"string"==typeof t?t.split(",").map((function(t){return t.trim()})):[]}),(function(t){return t.join(", ")}),Hx),zx("asset","",Vx,jx),zx("boolean",!1,(function(t){return"false"!==t&&!1!==t})),zx("color","#FFF"),zx("int",0,Yx),zx("number",0,(function(t){return parseFloat(t,10)})),zx("map","",Vx,jx),zx("model","",Vx,jx),zx("selector",null,(function(t){return t?"string"!=typeof t?t:"#"!==t[0]||Qx.test(t)?document.querySelector(t):document.getElementById(t.substring(1)):null}),(function(t){return t.getAttribute?"#"+t.getAttribute("id"):qx(t)}),Xx,!1),zx("selectorAll",null,(function(t){return t?"string"!=typeof t?t:Array.prototype.slice.call(document.querySelectorAll(t),0):null}),(function(t){return t instanceof Array?t.map((function(t){return"#"+t.getAttribute("id")})).join(", "):qx(t)}),Hx,!1),zx("src","",(function(t){return kx("`src` property type is deprecated. Use `asset` instead."),Vx(t)}),jx),zx("string",""),zx("time",0,Yx),zx("vec2",{x:0,y:0},Jx,fE,mE),zx("vec3",{x:0,y:0,z:0},Jx,fE,mE),zx("vec4",{x:0,y:0,z:0,w:1},Jx,fE,mE);var Zx=function(t,e){return("audio"!==t||"string"==typeof e)&&!("array"===t&&!Array.isArray(e))&&("asset"!==t||"string"==typeof e)&&("boolean"!==t||"boolean"==typeof e)&&("color"!==t||"string"==typeof e)&&("int"!==t||"number"==typeof e)&&("number"!==t||"number"==typeof e)&&("map"!==t||"string"==typeof e)&&("model"!==t||"string"==typeof e)&&("selector"!==t||"string"==typeof e||null===e)&&("selectorAll"!==t||"string"==typeof e||null===e)&&("src"!==t||"string"==typeof e)&&("string"!==t||"string"==typeof e)&&("time"!==t||"number"==typeof e)&&("vec2"===t?Kx(e,2):"vec3"===t?Kx(e,3):"vec4"!==t||Kx(e,4))},$x=Nx,tb=Ly("core:schema:warn");function eb(t){return"type"in t?"string"==typeof t.type:"default"in t}function nb(t,e){var n;if(eb(t))return ib(t,e);for(n in t)t[n]=ib(t[n],e);return t}function ib(t,e){var n,i,r=t.default,s=t.type;return t.type?"bool"===t.type?s="boolean":"float"===t.type&&(s="number"):s=void 0===r||"boolean"!=typeof r&&"number"!=typeof r?Array.isArray(r)?"array":"string":typeof r,(i=$x[s])||tb("Unknown property type for component `"+e+"`: "+s),n=!!t.parse,t.parse=t.parse||i.parse,t.stringify=t.stringify||i.stringify,t.equals=t.equals||i.equals,t.isCacheable=!0===t.isCacheable||i.isCacheable,t.type=s,"default"in t?n||Zx(s,r)||tb("Default value `"+r+"` does not match type `"+s+"` in component `"+e+"`"):t.default=i.default,t}var rb,sb=(rb=[],function(t,e,n,i,r){var s,o,a,l;for(o in rb.length=0,n?t:e)n&&void 0===t[o]||rb.push(o);if(null===t||"object"!=typeof t)return t;for(o in t)void 0===t[o]||e[o]||r||tb("Unknown property `"+o+"` for component/system `"+i+"`.");for(s=0;s<rb.length;s++){if(a=e[o=rb[s]],l=t[o],!e[o])return;t[o]=ob(l,a)}return t});function ob(t,e,n){return null!=t&&""!==t||(t=e.default,Array.isArray(t)&&(t=t.slice())),e.parse(t,e.default,n)}function ab(t,e){var n,i,r,s,o={};for(n in t)i=e[n],"object"==typeof(s=r=t[n])&&(s=lb(r,i),i||tb("Unknown component property: "+n)),void 0!==s&&(o[n]=s);return o}function lb(t,e){return"object"!=typeof t?t:e&&null!==t?e.stringify(t):JSON.stringify(t)}var cb={},hb=ob,ub=nb,db=eb,pb=ab,Ab=lb,fb=h,mb=Ly("core:component:warn"),gb=document.currentScript,vb=new RegExp("[A-Z]+"),yb={},Eb=Object.freeze({}),xb=[],bb={get:function(t,e){return t.getComputedPropertyValue(e)},set:function(t,e,n){return e in t.schema?t.recomputeProperty(e,n):void 0!==n&&t.handleUnknownProperty(e,n),!0}},Cb=function(t,e,n){var i=this;if(this.sceneOnly&&!t.isScene)throw new Error("Component `"+this.name+"` can only be applied to <a-scene>");if(n&&!this.multiple)throw new Error("Trying to initialize multiple components of type `"+this.name+"`. There can only be one component of this type per entity.");this.el=t,this.id=n,this.attrName=this.name+(n?"__"+n:""),this.evtDetail={id:this.id,name:this.name},this.initialized=!1,this.el.components[this.attrName]=this,this.objectPool=yb[this.name];var r=this.events;this.events={},function(t,e){var n;for(n in e)t.events[n]=e[n].bind(t)}(this,r),this.attrValue=void 0,this.isObjectBased?(this.data=this.objectPool.use(),cE(this.data,this.schema),this.oldData=this.objectPool.use(),cE(this.oldData,this.schema),this.attrValueProxy=new Proxy(this,bb)):(this.data=void 0,this.oldData=void 0,this.attrValueProxy=void 0),this.deferUnknownPropertyWarnings=!!this.updateSchema,this.throttledEmitComponentChanged=cx((function(){t.emit("componentchanged",i.evtDetail,!1)}),200),this.updateProperties(e,!0)};Cb.prototype={schema:{},init:function(){},events:{},update:function(t){},updateSchema:void 0,tick:void 0,tock:void 0,play:function(){},pause:function(){},remove:function(){},stringify:function(t){var e=this.schema;return"string"==typeof t?t:this.isSingleProperty?Ab(t,e):(t=pb(t,e),fb.stringify(t))},flushToDOM:function(t){var e=t?this.data:this.attrValue;null!=e&&window.HTMLElement.prototype.setAttribute.call(this.el,this.attrName,this.stringify(e))},updateProperties:function(t,e){var n=this.el;this.updateData(t,e),(n.hasLoaded||n.isLoading)&&(this.initialized?this.callUpdateHandler():this.initComponent())},initComponent:function(){var t,e=this.el;e.initializingComponents[this.name]||(e.initializingComponents[this.name]=!0,this.init(),this.initialized=!0,delete e.initializingComponents[this.name],t=this.isObjectBased?Eb:void 0,this.dataChanged=!1,this.storeOldData(),this.update(t),e.isPlaying&&this.play(),e.emit("componentinitialized",this.evtDetail,!1))},updateData:function(t,e){this.isSingleProperty?this.recomputeProperty(void 0,t):(e?(lE(this.attrValue),this.recomputeData(t),this.schemaChangeRequired=!!this.updateSchema):"string"==typeof t?fb.parse(t,this.attrValueProxy):dx(this.attrValueProxy,t),this.updateSchemaIfNeeded(t))},updateSchemaIfNeeded:function(t){if(this.schemaChangeRequired&&this.updateSchema)for(var e in xb.length=0,this.updateSchema(this.data),cE(this.data,this.schema),this.recomputeData(t),this.schemaChangeRequired=!1,this.attrValue)void 0!==this.attrValue[e]&&-1===xb.indexOf(e)&&(e in this.schema||mb("Unknown property `"+e+"` for component `"+this.name+"`."));for(var n=0;n<xb.length;n++)mb("Unknown property `"+xb[n]+"` for component `"+this.name+"`.");xb.length=0},callUpdateHandler:function(){if(this.isPositionRotationScale||this.dataChanged){this.dataChanged=!1;var t=this.oldData;this.oldDataInUse=!0,this.update(t),t!==this.oldData&&this.objectPool.recycle(t),this.oldDataInUse=!1,this.storeOldData(),this.throttledEmitComponentChanged()}},handleMixinUpdate:function(){this.recomputeData(),this.updateSchemaIfNeeded(),this.callUpdateHandler()},resetProperty:function(t){(this.isSingleProperty||t in this.schema)&&(t?this.attrValue[t]=void 0:(this.isObjectBased&&this.objectPool.recycle(this.attrValue),this.attrValue=void 0),this.recomputeProperty(t,void 0),this.updateSchemaIfNeeded(),this.callUpdateHandler())},extendSchema:function(t){var e;e=dx({},cb[this.name].schema),dx(e,t),this.schema=ub(e),this.el.emit("schemachanged",this.evtDetail)},getComputedPropertyValue:function(t){var e=this.el.mixinEls,n=this.attrValue&&t?this.attrValue[t]:this.attrValue;if(void 0!==n)return n;for(var i=e.length-1;i>=0;i--){var r=e[i].getAttribute(this.attrName);if(null!==r&&(!t||t in r))return t?r[t]:r}return t?this.schema[t].default:this.schema.default},recomputeProperty:function(t,e){var n=t?this.schema[t]:this.schema;if(null!=e){void 0===this.attrValue&&this.isObjectBased&&(this.attrValue=this.objectPool.use());var i=t?this.attrValue[t]:this.attrValue;"string"==typeof(i=n.isCacheable?hb(e,n,i):e)&&(i=""===e?void 0:e),t?this.attrValue[t]=i:this.attrValue=i}this.oldDataInUse&&(this.oldData=this.objectPool.use(),cE(this.oldData,this.schema),this.storeOldData(),this.oldDataInUse=!1);var r=t?this.oldData[t]:this.oldData,s=t?this.data[t]:this.data,o=hb(this.getComputedPropertyValue(t),n,s);return"array"!==n.type||t||(o=Ax(o)),n.equals(o,r)||(this.dataChanged=!0,n.schemaChange&&(this.schemaChangeRequired=!0)),t?this.data[t]=o:this.data=o,o},handleUnknownProperty:function(t,e){void 0===this.attrValue&&(this.attrValue=this.objectPool.use()),this.attrValue[t]=e,this.deferUnknownPropertyWarnings?xb.push(t):this.silenceUnknownPropertyWarnings||mb("Unknown property `"+t+"` for component `"+this.name+"`.")},storeOldData:function(){var t;if(this.isObjectBased)if(this.isSingleProperty)this.oldData=hb(this.data,this.schema,this.oldData);else for(t in this.schema)void 0!==this.data[t]&&(this.data[t]&&"object"==typeof this.data[t]?this.oldData[t]=hb(this.data[t],this.schema[t],this.oldData[t]):this.oldData[t]=this.data[t]);else this.oldData=this.data},recomputeData:function(t){var e;if(this.isSingleProperty)this.recomputeProperty(void 0,t);else{for(e in this.schema)this.attrValueProxy[e]=void 0;t&&"object"==typeof t?dx(this.attrValueProxy,t):"string"==typeof t&&fb.parse(t,this.attrValueProxy)}},eventsAttach:function(){var t;for(t in this.eventsDetach(),this.events)this.el.addEventListener(t,this.events[t])},eventsDetach:function(){var t;for(t in this.events)this.el.removeEventListener(t,this.events[t])},destroy:function(){this.objectPool.recycle(this.attrValue),this.objectPool.recycle(this.data),this.objectPool.recycle(this.oldData),this.attrValue=this.data=this.oldData=this.attrValueProxy=void 0}};var wb={};function _b(t,e){var n,i,r,s,o,a={};if(document.currentScript&&document.currentScript!==gb&&Fx.forEach((function(e){e.hasLoaded||document.currentScript.compareDocumentPosition(e)!==Node.DOCUMENT_POSITION_FOLLOWING&&(mb("The component `"+t+"` was registered in a <script> tag after the scene. Component <script> tags in an HTML file should be declared *before* the scene such that the component is available to entities during scene initialization."),window.debug&&(wb[t]=!0))})),!0===vb.test(t)&&mb("The component name `"+t+"` contains uppercase characters, but HTML will ignore the capitalization of attribute names. Change the name to be lowercase: `"+t.toLowerCase()+"`"),-1!==t.indexOf("__"))throw new Error("The component name `"+t+"` is not allowed. The sequence __ (double underscore) is reserved to specify an id for multiple components of the same type");if(Object.keys(e).forEach((function(t){a[t]={value:e[t],writable:!0}})),cb[t])throw new Error("The component `"+t+"` has been already registered. Check that you are not loading two versions of the same component or two different components of the same name.");((n=function(t,e,n){Cb.call(this,t,e,n)}).prototype=Object.create(Cb.prototype,a)).name=t,n.prototype.isPositionRotationScale="position"===t||"rotation"===t||"scale"===t,n.prototype.constructor=n,n.prototype.system=f&&Rb[t],n.prototype.play=(s=n.prototype.play,function(){var t=this.el.sceneEl,e=this.el.isPlaying&&!this.isPlaying;this.initialized&&e&&(s.call(this),this.isPlaying=!0,this.eventsAttach(),Mb(this)&&t.addBehavior(this))}),n.prototype.pause=(o=n.prototype.pause,function(){var t=this.el.sceneEl;this.isPlaying&&(o.call(this),this.isPlaying=!1,this.eventsDetach(),Mb(this)&&t.removeBehavior(this))}),i=dx(ub(n.prototype.schema,n.prototype.name)),n.prototype.isSingleProperty=r=db(n.prototype.schema),n.prototype.isObjectBased=!r||r&&(Sb(i.default)||Sb(hb(void 0,i))),yb[t]=aE(),cb[t]={Component:n,dependencies:n.prototype.dependencies,before:n.prototype.before,after:n.prototype.after,isSingleProperty:n.prototype.isSingleProperty,isObjectBased:n.prototype.isObjectBased,multiple:n.prototype.multiple,sceneOnly:n.prototype.sceneOnly,name:t,schema:i,stringify:n.prototype.stringify};for(var l=0;l<Fx.length;l++)Fx[l].emit("componentregistered",{name:t},!1);return n}function Mb(t){return t.tick||t.tock}function Sb(t){return t&&t.constructor===Object&&!(t instanceof window.HTMLElement)}var Ib=!1;function Bb(){Ib||(Ib=!0,setTimeout((function(){document.dispatchEvent(new CustomEvent("aframeready"))})))}var Tb=h,Rb={},Lb=function(t){var e=A&&cb[this.name];this.el=t,this.sceneEl=t,e&&(e.Component.prototype.system=this),this.buildData(),this.init(),this.update({})};function Db(t,e){var n,i,r={},s=wx(document);if(Object.keys(e).forEach((function(t){r[t]={value:e[t],writable:!0}})),Rb[t])throw new Error("The system `"+t+"` has been already registered. Check that you are not loading two versions of the same system or two different systems of the same name.");if(i=function(t){Lb.call(this,t)},(i.prototype=Object.create(Lb.prototype,r)).name=t,i.prototype.constructor=i,i.prototype.schema=dx(nb(i.prototype.schema)),Rb[t]=i,Ib)for(n=0;n<s.length;n++)s[n].initSystem(t)}Lb.prototype={schema:{},init:function(){},update:function(t){},updateProperties:function(t){var e=this.data;0!==Object.keys(this.schema).length&&(this.buildData(t),this.update(e))},buildData:function(t){var e=this.schema;0!==Object.keys(e).length&&(t=t||window.HTMLElement.prototype.getAttribute.call(this.sceneEl,this.name),eb(e)?this.data=ob(t,e):this.data=sb(Tb.parse(t)||{},e,!1,this.name))},tick:void 0,tock:void 0,play:function(){},pause:function(){}};var Pb=Ly("core:a-node:warn"),Ub={"a-scene":!0,"a-assets":!0,"a-assets-items":!0,"a-cubemap":!0,"a-mixin":!0,"a-node":!0,"a-entity":!0};function Ob(t){return t.tagName.toLowerCase()in Ub||t.isNode}class Fb extends HTMLElement{constructor(){super(),this.computedMixinStr="",this.hasLoaded=!1,this.isNode=!0,this.mixinEls=[]}connectedCallback(){Ib?this.doConnectedCallback():document.addEventListener("aframeready",this.connectedCallback.bind(this))}doConnectedCallback(){var t;this.sceneEl=this.closestScene(),this.sceneEl||Pb("You are attempting to attach <"+this.tagName+"> outside of an A-Frame scene. Append this element to `<a-scene>` instead."),this.hasLoaded=!1,this.emit("nodeready",void 0,!1),this.isMixin||(t=this.getAttribute("mixin"))&&this.updateMixins(t)}attributeChangedCallback(t,e,n){n!==this.computedMixinStr&&("mixin"!==t||this.isMixin||this.updateMixins(n,e))}closestScene(){for(var t=this;t&&!t.isScene;)t=t.parentElement;return t}closest(t){for(var e=this.matches||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector,n=this;n&&!e.call(n,t);)n=n.parentElement;return n}disconnectedCallback(){this.hasLoaded=!1}load(t,e){var n,i=this;this.hasLoaded||(e=e||Ob,n=this.getChildren().filter(e).map((function(t){return new Promise((function(e,n){if(t.hasLoaded)return e();t.addEventListener("loaded",e),t.addEventListener("error",n)}))})),Promise.allSettled(n).then((function(e){e.forEach((function(t){"rejected"===t.status&&Pb("Rendering scene with errors on node: ",t.reason.target)})),i.isLoading=!0,i.setupMutationObserver(),t&&t(),i.isLoading=!1,i.hasLoaded=!0,i.emit("loaded-private",void 0,!1),i.emit("loaded",void 0,!1)})))}setupMutationObserver(){var t=this;new MutationObserver((function(e){var n;for(n=0;n<e.length;n++)if("attributes"===e[n].type){var i=e[n].attributeName,r=window.HTMLElement.prototype.getAttribute.call(t,i),s=e[n].oldValue;t.attributeChangedCallback(i,s,r)}})).observe(this,{attributes:!0,attributeOldValue:!0})}getChildren(){return Array.prototype.slice.call(this.children,0)}updateMixins(t,e){var n,i,r,s=Fb.newMixinIdArray,o=Fb.oldMixinIdArray,a=Fb.mixinIds;for(s.length=0,o.length=0,i=t?xE(t.trim(),/\s+/):s,r=e?xE(e.trim(),/\s+/):o,a.newMixinIds=i,a.oldMixinIds=r,n=0;n<r.length;n++)-1===i.indexOf(r[n])&&this.unregisterMixin(r[n]);for(this.computedMixinStr="",this.mixinEls.length=0,n=0;n<i.length;n++)this.registerMixin(i[n]);return this.computedMixinStr&&(this.computedMixinStr=this.computedMixinStr.trim(),window.HTMLElement.prototype.setAttribute.call(this,"mixin",this.computedMixinStr)),0===i.length&&window.HTMLElement.prototype.removeAttribute.call(this,"mixin"),a}registerMixin(t){var e,n,i,r=document.getElementById(t);if(r){if(i=r.getAttribute("mixin"))for(e=xE(i.trim(),/\s+/),n=0;n<e.length;n++)this.registerMixin(e[n]);this.computedMixinStr=this.computedMixinStr+" "+r.id,this.mixinEls.push(r)}else Pb("No mixin was found with id `%s`",t)}setAttribute(t,e){"mixin"===t&&this.updateMixins(e),window.HTMLElement.prototype.setAttribute.call(this,t,e)}unregisterMixin(t){var e,n=this.mixinEls;for(e=0;e<n.length;++e)if(t===n[e].id){n.splice(e,1);break}}emit(t,e,n,i){var r=Fb.evtData;void 0===n&&(n=!0),r.bubbles=!!n,r.detail=e,i&&(r=dx({},i,r)),this.dispatchEvent(new CustomEvent(t,r))}}Fb.evtData={},Fb.newMixinIdArray=[],Fb.oldMixinIdArray=[],Fb.mixinIds={},customElements.define("a-node",Fb);var kb=Ly("core:a-entity:debug"),Nb=Ly("core:a-entity:warn"),Qb="__",Gb=["position","rotation","scale","visible"],zb={once:!0};class Hb extends Fb{constructor(){super(),this.components={},this.initializingComponents={},this.componentsToUpdate={},this.isEntity=!0,this.isPlaying=!1,this.object3D=new _y.Group,this.object3D.rotation.order="YXZ",this.object3D.el=this,this.object3DMap={},this.parentEl=null,this.rotationObj={},this.states=[]}attributeChangedCallback(t,e,n){var i=this.components[t];super.attributeChangedCallback(),i&&i.justInitialized&&""===n?delete i.justInitialized:(i||null!==n)&&this.setEntityAttribute(t,e,n)}doConnectedCallback(){var t,e,n=this;super.doConnectedCallback(),e=this.sceneEl,this.addToParent(),this.isScene||(e?!(t=e.querySelector("a-assets"))||t.hasLoaded?this.load():t.addEventListener("loaded",(function(){n.load()})):this.load())}disconnectedCallback(){var t;if(this.parentEl){for(t in this.components)this.removeComponent(t,!1);this.isScene||(this.removeFromParent(),super.disconnectedCallback(),this.object3D.el=null)}}getObject3D(t){return this.object3DMap[t]}setObject3D(t,e){var n,i=this;if(!(e instanceof _y.Object3D))throw new Error("`Entity.setObject3D` was called with an object that was not an instance of THREE.Object3D.");(n=this.getObject3D(t))&&this.object3D.remove(n),e.el=this,e.children.length&&e.traverse((function(t){t.el=i})),this.object3D.add(e),this.object3DMap[t]=e,this.emit("object3dset",{object:e,type:t})}removeObject3D(t){var e=this.getObject3D(t);e?(this.object3D.remove(e),delete this.object3DMap[t],this.emit("object3dremove",{type:t})):Nb("Tried to remove `Object3D` of type:",t,"which was not defined.")}getOrCreateObject3D(t,e){var n=this.getObject3D(t);return!n&&e&&(n=new e,this.setObject3D(t,n)),Nb("`getOrCreateObject3D` has been deprecated. Use `setObject3D()` and `object3dset` event instead."),n}add(t){if(!t.object3D)throw new Error("Trying to add an element that doesn't have an `object3D`");this.object3D.add(t.object3D),this.emit("child-attached",{el:t})}addToParent(){var t=this.parentEl=this.parentNode;t&&t.add&&!this.attachedToParent&&(t.add(this),this.attachedToParent=!0)}removeFromParent(){var t=this.parentEl;this.parentEl.remove(this),this.attachedToParent=!1,this.parentEl=null,t.emit("child-detached",{el:this})}load(){var t=this;!this.hasLoaded&&this.parentEl&&super.load.call(this,(function(){t.parentEl&&(t.updateComponents(),(t.isScene||t.parentEl.isPlaying)&&t.play())}))}remove(t){t?this.object3D.remove(t.object3D):this.parentNode.removeChild(this)}getChildEntities(){for(var t=this.children,e=[],n=0;n<t.length;n++){var i=t[n];i instanceof Hb&&e.push(i)}return e}initComponent(t,e,n){var i,r,s,o;o=(s=xE(t,Qb))[0],r=s.length>2?s.slice(1).join("__"):s[1],cb[o]&&(Vb(this,t)||void 0!==e||n)&&(t in this.components||(this.initComponentDependencies(o),i=new cb[o].Component(this,e,r),this.isPlaying&&i.play(),this.hasAttribute(t)||(i.justInitialized=!0,window.HTMLElement.prototype.setAttribute.call(this,t,"")),kb("Component initialized: %s",t)))}initComponentDependencies(t){var e,n;if(cb[t]&&(e=cb[t].dependencies))for(n=0;n<e.length;n++)this.initComponent(e[n],window.HTMLElement.prototype.getAttribute.call(this,e[n])||void 0,!0)}removeComponent(t,e){var n;(n=this.components[t])&&(n.initialized?(n.pause(),n.remove(),e&&(n.destroy(),delete this.components[t],this.hasAttribute(t)&&window.HTMLElement.prototype.removeAttribute.call(this,t)),this.emit("componentremoved",n.evtDetail,!1)):this.addEventListener("componentinitialized",(function n(i){i.detail.name===t&&(this.removeComponent(t,e),this.removeEventListener("componentinitialized",n))})))}updateComponents(){var t,e,n,i,r,s,o=this.componentsToUpdate;if(this.hasLoaded||this.isLoading){for(n=0;n<this.mixinEls.length;n++)for(i in this.mixinEls[n].componentCache)jb(i)&&(o[i]=!0);if(this.getExtraComponents)for(i in e=this.getExtraComponents())jb(i)&&(o[i]=!0);for(n=0;n<this.attributes.length;++n)i=this.attributes[n].name,-1===Gb.indexOf(i)&&jb(i)&&(o[i]=!0);for(n=0;n<Gb.length;n++)i=Gb[n],this.hasAttribute(i)&&this.updateComponent(i,this.getDOMAttribute(i));for(i in o)r=this.getDOMAttribute(i),t=(s=e&&e[i])?s.constructor===Object?dx(s,VE(r||{})):r||s:r,this.updateComponent(i,t),delete o[i]}}updateComponent(t,e,n){var i=this.components[t];if(i)return null!==e||Vb(this,t)?void i.updateProperties(e,n):void this.removeComponent(t,!0);this.initComponent(t,e,!1)}removeAttribute(t,e){var n=this.components[t];n&&void 0===e&&this.removeComponent(t,!0),n&&void 0!==e?n.resetProperty(e):("mixin"===t&&this.mixinUpdate(""),window.HTMLElement.prototype.removeAttribute.call(this,t))}play(){var t,e,n;if(!this.isPlaying&&(this.hasLoaded||this.isLoading)){for(n in this.isPlaying=!0,this.components)this.components[n].play();for(t=this.getChildEntities(),e=0;e<t.length;e++)t[e].play();this.emit("play")}}pause(){var t,e,n;if(this.isPlaying){for(n in this.isPlaying=!1,this.components)this.components[n].pause();for(t=this.getChildEntities(),e=0;e<t.length;e++)t[e].pause();this.emit("pause")}}setEntityAttribute(t,e,n){if(cb[t]||this.components[t])this.updateComponent(t,n);else if("mixin"===t){if(n===this.computedMixinStr)return;this.mixinUpdate(n,e)}}mixinUpdate(t,e,n){var i,r,s,o,a=Hb.componentsUpdated,l=this;if(n||(e=e||this.getAttribute("mixin")),this.hasLoaded){for(s=this.updateMixins(t,e),a.length=0,o=0;o<this.mixinEls.length;o++)for(i in this.mixinEls[o].componentCache)-1===a.indexOf(i)&&(this.components[i]?this.components[i].handleMixinUpdate():this.initComponent(i,null),a.push(i));for(o=0;o<s.oldMixinIds.length;o++)if(r=document.getElementById(s.oldMixinIds[o]))for(i in r.componentCache)-1===a.indexOf(i)&&this.components[i]&&(this.getDOMAttribute(i)?this.components[i].handleMixinUpdate():this.removeComponent(i,!0))}else this.addEventListener("loaded-private",(function(){l.mixinUpdate(t,e,!0)}),zb)}setAttribute(t,e,n){var i,r,s,o,a,l=Hb.singlePropUpdate;if(s=(o=t.indexOf(Qb))>0?t.substring(0,o):t,!cb[s])return"mixin"===t&&this.mixinUpdate(e),void super.setAttribute.call(this,t,e);if(!this.components[t]&&this.hasAttribute(t)&&this.updateComponent(t,window.HTMLElement.prototype.getAttribute.call(this,t)),void 0!==n&&"string"==typeof e&&e.length>0&&"string"==typeof VE(e)){for(a in l)delete l[a];(i=l)[e]=n,r=!1}else i=e,r=!0===n;this.updateComponent(t,i,r),this.sceneEl&&this.sceneEl.getAttribute("debug")&&this.components[t].flushToDOM()}flushToDOM(t){var e,n,i,r=this.components,s=this.children;for(i in r)r[i].flushToDOM();if(t)for(n=0;n<s.length;++n)(e=s[n]).flushToDOM&&e.flushToDOM(t)}getAttribute(t){var e,n,i,r,s;return"position"===t?this.object3D.position:"rotation"===t?(n=this,i=_y.MathUtils.radToDeg,r=n.object3D.rotation,(s=n.rotationObj).x=i(r.x),s.y=i(r.y),s.z=i(r.z),s):"scale"===t?this.object3D.scale:"visible"===t?this.object3D.visible:(e=this.components[t])?e.data:window.HTMLElement.prototype.getAttribute.call(this,t)}getDOMAttribute(t){var e=this.components[t];return e?e.attrValue:window.HTMLElement.prototype.getAttribute.call(this,t)}addState(t){this.is(t)||(this.states.push(t),this.emit("stateadded",t))}removeState(t){var e=this.states.indexOf(t);-1!==e&&(this.states.splice(e,1),this.emit("stateremoved",t))}is(t){return-1!==this.states.indexOf(t)}inspect(){this.sceneEl.components.inspector.openInspector(this)}destroy(){var t;if(this.parentNode)Nb("Entity can only be destroyed if detached from scenegraph.");else for(t in this.components)this.components[t].destroy()}}function Vb(t,e){return!(!t.components[e]||!t.components[e].attrValue)||function(t,e){var n,i=!1;for(n=0;n<e.length&&!(i=e[n].hasAttribute(t));++n);return i}(e,t.mixinEls)}function jb(t){return-1!==t.indexOf(Qb)&&(t=xE(t,Qb)[0]),!!cb[t]}function Wb(t){if(t.data&&"vr"===t.data.type)switch(t.data.data){case"enter":this.enterVR();break;case"exit":this.exitVR()}}Hb.componentsUpdated=[],Hb.singlePropUpdate={},customElements.define("a-entity",Hb),Jy()&&window.addEventListener("orientationchange",(function(){document.documentElement.style.height="initial",setTimeout((function(){document.documentElement.style.height="100%",setTimeout((function(){window.scrollTo(0,1)}),500)}),500)}));var qb=Ly("core:a-scene:warn"),Xb=Jy(),Yb=Wy(),Jb=ky;class Kb extends Hb{constructor(){var t;super(),(t=this).clock=new _y.Clock,t.isIOS=Xb,t.isMobile=Yb,t.hasWebXR=Jb,t.isAR=!1,t.isScene=!0,t.object3D=new _y.Scene,t.object3D.onAfterRender=function(e,n,i){t.isPlaying&&t.tock(t.time,t.delta,i)},t.resize=t.resize.bind(t),t.render=t.render.bind(t),t.systems={},t.systemNames=[],t.time=t.delta=0,t.usedOfferSession=!1,t.componentOrder=[],t.behaviors={},t.hasLoaded=!1,t.isPlaying=!1,t.originalHTML=t.innerHTML}addFullScreenStyles(){document.documentElement.classList.add("a-fullscreen")}removeFullScreenStyles(){document.documentElement.classList.remove("a-fullscreen")}doConnectedCallback(){var t=this,e=this.hasAttribute("embedded");this.setAttribute("inspector",""),this.setAttribute("keyboard-shortcuts",""),this.setAttribute("screenshot",""),this.setAttribute("xr-mode-ui",""),this.setAttribute("device-orientation-permission-ui",""),super.doConnectedCallback(),function(t){var e;function n(){document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||t.exitVR(),document.activeElement.blur(),document.body.focus()}(e=document.createElement("canvas")).classList.add("a-canvas"),e.dataset.aframeCanvas=!0,t.appendChild(e),document.addEventListener("fullscreenchange",n),document.addEventListener("mozfullscreenchange",n),document.addEventListener("webkitfullscreenchange",n),document.addEventListener("MSFullscreenChange",n),e.addEventListener("touchmove",(function(t){t.preventDefault()}),{passive:!1}),t.canvas=e,t.emit("render-target-loaded",{target:e}),setTimeout(t.resize.bind(t),0)}(this),this.setupRenderer(),function(t,e){Rx=e;var n,i,r,s,o,a,l,c,h,u,d=(Bx=t).hasAttribute(Ux)?Px.parse(Bx.getAttribute(Ux)):void 0,p=d&&d.dotsColor||"white",A=d&&d.backgroundColor||"#24CAFF";(void 0===d||"true"===d.enabled||void 0===d.enabled)&&(n=new THREE.Scene,i=new THREE.SphereGeometry(.2,36,18,0,2*Math.PI,0,Math.PI),r=new THREE.MeshBasicMaterial({color:p}),s=new THREE.Mesh(i,r),o=s.clone(),a=s.clone(),l=new THREE.PerspectiveCamera(80,window.innerWidth/window.innerHeight,5e-4,1e4),c=new THREE.Clock,h=0,u=function(){Bx.renderer.render(n,l),h=c.getElapsedTime()%4,s.visible=h>=1,o.visible=h>=2,a.visible=h>=3},n.background=new THREE.Color(A),n.add(l),s.position.set(-1,0,-15),o.position.set(0,0,-15),a.position.set(1,0,-15),l.add(s),l.add(o),l.add(a),(Tx=document.createElement("div")).className="a-loader-title",Tx.innerHTML=document.title,Tx.style.display="none",Tx.setAttribute(Sy,""),Bx.appendChild(Tx),setTimeout((function(){Bx.hasLoaded||(Ox(l),Tx.style.display="block",window.addEventListener("resize",(function(){Ox(l)})),Bx.renderer.setAnimationLoop(u))}),200))}(this,tC),this.resize(),e||this.addFullScreenStyles(),Cx()&&window.addEventListener("message",Wb.bind(this)),function(t){var e,n=document.head,i=n.querySelector("script"),r=[];return Mx.forEach(s),t.isIOS&&Sx.forEach(s),r;function s(t){t&&!t.exists()&&(e=function(t){if(t&&t.tagName){var e=document.createElement(t.tagName);return e.setAttribute(Sy,""),dx(e,t.attributes)}}(t),e&&(i?i.parentNode.insertBefore(e,i):n.appendChild(e),r.push(e)))}}(this),function(t){if(t.isMobile){var e=t.wakelock=new(Dx());t.addEventListener("enter-vr",(function(){e.request()})),t.addEventListener("exit-vr",(function(){e.release()}))}}(this),this.enterVRBound=function(){t.enterVR()},this.exitVRBound=function(){t.exitVR()},window.addEventListener("sessionend",this.resize),this.addEventListener("cameraready",(function(){t.attachedCallbackPostCamera()})),this.initSystems(),this.componentOrder=Zb(cb,this.componentOrder),this.addEventListener("componentregistered",(function(){t.componentOrder=Zb(cb,t.componentOrder)})),this.hasWebXR&&navigator.xr&&navigator.xr.addEventListener&&navigator.xr.addEventListener("sessiongranted",(function(){t.enterVR()}))}attachedCallbackPostCamera(){var t=this;window.addEventListener("load",void 0),window.addEventListener("resize",(function(){t.isIOS?setTimeout(t.resize,100):t.resize()})),this.play(),Fx.push(this)}initSystems(){var t;for(t in this.initSystem("camera"),Rb)"camera"!==t&&this.initSystem(t)}initSystem(t){this.systems[t]||(this.systems[t]=new Rb[t](this),this.systemNames.push(t))}disconnectedCallback(){var t=Fx.indexOf(this);super.disconnectedCallback(),Fx.splice(t,1),window.removeEventListener("sessionend",this.resize),this.removeFullScreenStyles(),this.renderer.dispose()}addBehavior(t){var e,n,i=this.behaviors[t.name];for(n in i||(i=this.behaviors[t.name]={tick:{inUse:!1,array:[],markedForRemoval:[]},tock:{inUse:!1,array:[],markedForRemoval:[]}}),i)if(t[n]){if((e=i[n]).inUse){var r=e.markedForRemoval.indexOf(t);-1!==r&&e.markedForRemoval.splice(r,1)}-1===e.array.indexOf(t)&&e.array.push(t)}}getPointerLockElement(){return document.pointerLockElement}checkHeadsetConnected(){return Gy()}enterAR(){var t;if(!this.hasWebXR)throw t="Failed to enter AR mode, WebXR not supported.",new Error(t);if(!zy())throw t="Failed to enter AR, WebXR immersive-ar mode not supported in your browser or device.",new Error(t);return this.enterVR(!0)}enterVR(t,e){var n,i=this,r=i.renderer.xr;if(e&&(!navigator.xr||!navigator.xr.offerSession))return Promise.resolve("OfferSession is not supported.");if(i.usedOfferSession&&e)return Promise.resolve("OfferSession was already called.");if(this.is("vr-mode"))return Promise.resolve("Already in VR.");if(this.checkHeadsetConnected()||this.isMobile){var s=i.getAttribute("renderer");if(r.enabled=!0,this.hasWebXR){this.xrSession&&this.xrSession.removeEventListener("end",this.exitVRBound);var o=this.sceneEl.systems.webxr.sessionReferenceSpaceType;r.setReferenceSpaceType(o);var a=t?"immersive-ar":"immersive-vr";return n=this.sceneEl.systems.webxr.sessionConfiguration,new Promise((function(t,o){var c=e?navigator.xr.offerSession.bind(navigator.xr):navigator.xr.requestSession.bind(navigator.xr);i.usedOfferSession|=e,c(a,n).then((function(o){e&&(i.usedOfferSession=!1),r.layersEnabled=-1!==n.requiredFeatures.indexOf("layers"),r.setSession(o).then((function(){r.setFoveation(s.foveationLevel),i.xrSession=o,i.systems.renderer.setWebXRFrameRate(o),o.addEventListener("end",i.exitVRBound),l(t)}))}),(function(t){o(new Error("Failed to enter "+("immersive-ar"===a?"AR":"VR")+" mode (`requestSession`)",{cause:t}))}))}))}throw new Error("Failed to enter "+(t?"AR":"VR")+" no WebXR")}return l(),Promise.resolve();function l(e){var n;t?i.addState("ar-mode"):i.addState("vr-mode"),i.emit("enter-vr",{target:i}),!i.hasWebXR&&i.isMobile&&screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape"),i.addFullScreenStyles(),i.isMobile||i.checkHeadsetConnected()||((n=i.canvas).requestFullscreen||n.webkitRequestFullscreen||n.mozRequestFullScreen||n.msRequestFullscreen).apply(n,[{navigationUI:"hide"}]),i.resize(),e&&e()}}exitVR(){var t=this,e=this.renderer.xr;if(!this.is("vr-mode")&&!this.is("ar-mode"))return Promise.resolve("Not in immersive mode.");if(this.checkHeadsetConnected()||this.isMobile){if(e.enabled=!1,!this.hasWebXR)throw Error("Failed to exit VR - no WebXR");this.xrSession.removeEventListener("end",this.exitVRBound),this.xrSession.end().then((function(){}),(function(){})),this.xrSession=void 0}else(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen());return t.removeState("vr-mode"),t.removeState("ar-mode"),t.isMobile&&screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),t.hasAttribute("embedded")&&t.removeFullScreenStyles(),t.resize(),t.isIOS&&_E(t.canvas),t.renderer.setPixelRatio(window.devicePixelRatio),t.emit("exit-vr",{target:t}),Promise.resolve()}getAttribute(t){var e=this.systems[t];return e?e.data:Hb.prototype.getAttribute.call(this,t)}getDOMAttribute(t){var e=this.systems[t];return e?e.data:Hb.prototype.getDOMAttribute.call(this,t)}setAttribute(t,e,n){if(Rb[t]){Fb.prototype.setAttribute.call(this,t,e);var i=this.systems[t];i&&i.updateProperties(e)}else Hb.prototype.setAttribute.call(this,t,e,n)}removeBehavior(t){var e,n,i,r=this.behaviors[t.name];for(n in r)t[n]&&-1!==(i=(e=r[n]).array.indexOf(t))&&(e.inUse?-1===e.markedForRemoval.indexOf(t)&&e.markedForRemoval.push(t):(e.array[i]=e.array[e.array.length-1],e.array.pop()))}resize(){var t,e,n=this.camera,i=this.canvas,r=this.renderer.xr.isPresenting;t=this.renderer.xr.enabled&&r,!n||!i||this.is("vr-mode")&&(this.isMobile||t)||(e=tC(i,this.getAttribute("embedded")&&!this.is("vr-mode"),this.maxCanvasSize,this.is("vr-mode")),n.aspect=e.width/e.height,n.updateProjectionMatrix(),this.renderer.setSize(e.width,e.height,!1),this.emit("rendererresize",null,!1))}setupRenderer(){var t,e,n,i=this;n={alpha:!0,antialias:!Yb,canvas:this.canvas,logarithmicDepthBuffer:!1,powerPreference:"high-performance"},this.maxCanvasSize={height:-1,width:-1},this.hasAttribute("renderer")&&((e=VE(this.getAttribute("renderer"))).precision&&(n.precision=e.precision+"p"),e.antialias&&"auto"!==e.antialias&&(n.antialias="true"===e.antialias),e.logarithmicDepthBuffer&&"auto"!==e.logarithmicDepthBuffer&&(n.logarithmicDepthBuffer="true"===e.logarithmicDepthBuffer),e.alpha&&(n.alpha="true"===e.alpha),e.stencil&&(n.stencil="true"===e.stencil),e.multiviewStereo&&(n.multiviewStereo="true"===e.multiviewStereo),this.maxCanvasSize={width:e.maxCanvasWidth?parseInt(e.maxCanvasWidth):this.maxCanvasSize.width,height:e.maxCanvasHeight?parseInt(e.maxCanvasHeight):this.maxCanvasSize.height}),(t=this.renderer=new _y.WebGLRenderer(n)).setPixelRatio(window.devicePixelRatio),this.camera&&t.xr.setPoseTarget(this.camera.el.object3D),this.addEventListener("camera-set-active",(function(){t.xr.setPoseTarget(i.camera.el.object3D)}))}play(){var t=this,e=this;this.renderStarted?Hb.prototype.play.call(this):(this.addEventListener("loaded",(function(){var t=this.renderer;Hb.prototype.play.call(this),e.renderStarted||(e.resize(),e.renderer&&(window.performance&&window.performance.mark("render-started"),window.removeEventListener("resize",Ox),Tx&&(Tx.style.display="none"),t.setAnimationLoop(this.render),e.renderStarted=!0,e.emit("renderstart")))})),setTimeout((function(){Hb.prototype.load.call(t)})))}updateComponent(t){t in Rb||Hb.prototype.updateComponent.apply(this,arguments)}tick(t,e){var n,i=this.systems;for(this.callComponentBehaviors("tick",t,e),n=0;n<this.systemNames.length;n++)i[this.systemNames[n]].tick&&i[this.systemNames[n]].tick(t,e)}tock(t,e,n){var i,r=this.systems;for(this.callComponentBehaviors("tock",t,e),i=0;i<this.systemNames.length;i++)r[this.systemNames[i]].tock&&r[this.systemNames[i]].tock(t,e,n)}render(t,e){var n=this.renderer;this.frame=e,this.delta=1e3*this.clock.getDelta(),this.time=1e3*this.clock.elapsedTime,this.isPlaying&&this.tick(this.time,this.delta);var i=null;this.is("ar-mode")&&(i=this.object3D.background,this.object3D.background=null),n.render(this.object3D,this.camera),i&&(this.object3D.background=i)}callComponentBehaviors(t,e,n){for(var i,r=0;r<this.componentOrder.length;r++){var s=this.behaviors[this.componentOrder[r]];if(s){var o=s[t];for(o.inUse=!0,i=0;i<o.array.length;i++)o.array[i].isPlaying&&o.array[i][t](e,n);for(o.inUse=!1,i=0;i<o.markedForRemoval.length;i++)this.removeBehavior(o.markedForRemoval[i]);o.markedForRemoval.length=0}}}}function Zb(t,e){var n,i,r={},s=e||[];for(i in s.length=0,t){var o=t[i];if(void 0!==o){var a=o.before?o.before.slice(0):[],l=o.after?o.after.slice(0):[];r[i]={before:a,after:l,visited:!1,done:!1}}}for(i in r)for(n=0;n<r[i].before.length;n++){var c=r[i].before[n];c in r?r[c].after.push(i):qb("Invalid ordering constraint, no component named `"+c+"` referenced by `"+i+"`")}function h(t){if(t in r&&!r[t].done)if(r[t].visited)qb("Cycle detected, ignoring one or more before/after constraints. The resulting order might be incorrect");else{r[t].visited=!0;for(var e=0;e<r[t].after.length;e++){var n=r[t].after[e];n in r||qb("Invalid before/after constraint, no component named `"+n+"` referenced in `"+t+"`"),h(n)}r[t].done=!0,s.push(t)}}for(i in r)r[i].done||h(i);return s}function $b(t,e){var n,i=window.devicePixelRatio;return!e||-1===e.width&&-1===e.height||t.width*i<e.width&&t.height*i<e.height||(n=t.width/t.height,t.width*i>e.width&&-1!==e.width&&(t.width=Math.round(e.width/i),t.height=Math.round(e.width/n/i)),t.height*i>e.height&&-1!==e.height&&(t.height=Math.round(e.height/i),t.width=Math.round(e.height*n/i))),t}function tC(t,e,n,i){return t.parentElement?e?$b({height:t.parentElement.offsetHeight,width:t.parentElement.offsetWidth},n):function(t,e){var n;return n={height:document.body.offsetHeight,width:document.body.offsetWidth},e?n:$b(n,t)}(n,i):{height:0,width:0}}customElements.define("a-scene",Kb);var eC=nb,nC={},iC=[],rC=function(){};function sC(t,e){var n,i={};if(Object.keys(e).forEach((function(t){i[t]={value:e[t],writable:!0}})),nC[t])throw new Error("The geometry `"+t+"` has been already registered");return((n=function(){rC.call(this)}).prototype=Object.create(rC.prototype,i)).name=t,n.prototype.constructor=n,nC[t]={Geometry:n,schema:eC(n.prototype.schema)},iC.push(t),n}rC.prototype={schema:{},init:function(t){return this.geometry=new _y.BufferGeometry,this.geometry},update:function(t){}};var oC=Ly,aC=wE,lC=oC("extras:primitives:debug"),cC=oC("extras:primitives:warn"),hC=oC("extras:primitives:error"),uC={};function dC(t,e){if(t=t.toLowerCase(),!Ub[t]){Ub[t]=!0,lC("Registering <%s>",t),e.defaultAttributes&&cC("The 'defaultAttributes' object is deprecated. Use 'defaultComponents' instead.");var n=e.mappings||{},i=class extends Hb{constructor(){super(),this.defaultComponentsFromPrimitive=e.defaultComponents||e.defaultAttributes||{},this.deprecated=e.deprecated||null,this.deprecatedMappings=e.deprecatedMappings||{},this.mappings=n,e.deprecated&&console.warn(e.deprecated),this.resolveMappingCollisions()}resolveMappingCollisions(){var t=this.mappings,e=this;Object.keys(t).forEach((function(n){var i;n!==n.toLowerCase()&&cC("Mapping keys should be specified in lower case. The mapping key "+n+" may not be recognized"),cb[n]&&(i=t[n].replace(".","-"),t[i]=t[n],delete t[n],console.warn("The primitive "+e.tagName.toLowerCase()+" has a mapping collision. The attribute "+n+" has the same name as a registered component and has been renamed to "+i))}))}getExtraComponents(){var t,e,n,i,r,s=this;for(e=Ax(this.defaultComponentsFromPrimitive),(r=this.getAttribute("mixin"))&&(r=xE(r.trim(),/\s+/)).forEach((function(t){var n,r,c=document.getElementById(t);if(c){var h=c.rawAttributeCache,u=c.componentCache;for(var d in h){if(i=s.mappings[d])return void pC(i,h[d],e);d in u&&(e[d]=(n=e[d],r=u[d],o(n)?a(r):o(r)?a(n):l(n)&&l(r)?px(n,r):a(r)))}}})),n=0;n<this.attributes.length;n++)t=this.attributes[n],(i=this.mappings[t.name])&&pC(i,t.value,e);return e;function o(t){return void 0===t}function a(t){return l(t)?px({},t):t}function l(t){return null!==t&&t.constructor===Object}}attributeChangedCallback(t,e,n){var i=this.mappings[t];t in this.deprecatedMappings&&console.warn(this.deprecatedMappings[t]),t&&i?aC(this,i,n):super.attributeChangedCallback(t,e,n)}};return customElements.define(t,i),i.mappings=n,uC[t]=i,i}hC("Trying to register primitive "+t+" that has been already previously registered")}function pC(t,e,n){var i=bE(t);i.constructor===Array?(n[i[0]]=n[i[0]]||{},n[i[0]][i[1]]=e.trim()):n[i]=e.trim()}var AC={},fC=[],mC={array:"v3",color:"v3",int:"i",number:"f",map:"t",time:"f",vec2:"v2",vec3:"v3",vec4:"v4"},gC=function(){};function vC(t,e){var n,i={};if(Object.keys(e).forEach((function(t){i[t]={value:e[t],writable:!0}})),AC[t])throw new Error("The shader "+t+" has already been registered");return((n=function(){gC.call(this)}).prototype=Object.create(gC.prototype,i)).name=t,n.prototype.constructor=n,AC[t]={Shader:n,schema:nb(n.prototype.schema)},fC.push(t),n}gC.prototype={schema:{},vertexShader:"void main() {gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);}",fragmentShader:"void main() {gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);}",init:function(t){return this.uniforms=this.initUniforms(),this.material=new(this.raw?_y.RawShaderMaterial:_y.ShaderMaterial)({uniforms:this.uniforms,glslVersion:this.raw||this.glsl3?_y.GLSL3:null,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader}),this.material},initUniforms:function(){var t,e,n=this.schema,i={};for(t in n)"uniform"===n[t].is&&(e=mC[n[t].type],i[t]={type:e,value:void 0});return i},update:function(t){var e,n,i=this.schema,r=this.uniforms;for(e in t)if(i[e]&&"uniform"===i[e].is)if("map"!==i[e].type)r[e].value=this.parseValue(i[e].type,t[e]),r[e].needsUpdate=!0;else{if(!r[e]||r[e].value===t[e])continue;n="_texture_"+e,this.setMapOnTextureLoad(r,e,n),UE(n,e,this,t)}},parseValue:function(t,e){var n;switch(t){case"vec2":return new _y.Vector2(e.x,e.y);case"vec3":return new _y.Vector3(e.x,e.y,e.z);case"vec4":return new _y.Vector4(e.x,e.y,e.z,e.w);case"color":return n=new _y.Color(e),new _y.Vector3(n.r,n.g,n.b);default:return e}},setMapOnTextureLoad:function(t,e,n){var i=this;this.el.addEventListener("materialtextureloaded",(function(){t[e].value=i.material[n],t[e].needsUpdate=!0}))}};var yC=new _y.FileLoader,EC=Ly("core:a-assets:warn");function xC(t){if(t.hasAttribute("autoplay")||"auto"===t.getAttribute("preload"))return new Promise((function(e,n){if(4===t.readyState)return e();if(t.error)return n();function i(){for(var n=0,i=0;i<t.buffered.length;i++)n+=t.buffered.end(i)-t.buffered.start(i);n>=t.duration&&("VIDEO"===t.tagName&&_y.Cache.add(t.getAttribute("src"),t),e())}t.addEventListener("loadeddata",i,!1),t.addEventListener("progress",i,!1),t.addEventListener("error",n,!1)}))}function bC(t){var e=function(t){var e,n,i;if(t.hasAttribute("crossorigin"))return t;if(null!==(e=t.getAttribute("src"))){if(-1===e.indexOf("://"))return t;if((i=(n=e).indexOf("://")>-1?n.split("/")[2]:n.split("/")[0]).substring(0,i.indexOf(":"))===window.location.host)return t}return EC('Cross-origin element (e.g., <img>) was requested without `crossorigin` set. A-Frame will re-request the asset with `crossorigin` attribute set. Please set `crossorigin` on the element (e.g., <img crossorigin="anonymous">)',e),t.crossOrigin="anonymous",t.cloneNode(!0)}(t);return e.tagName&&"video"===e.tagName.toLowerCase()&&(e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline","")),e!==t&&(t.parentNode.appendChild(e),t.parentNode.removeChild(t)),e}customElements.define("a-assets",class extends Fb{constructor(){super(),this.isAssets=!0,this.fileLoader=yC,this.timeout=null}doConnectedCallback(){var t,e,n,i,r,s,o=this,a=[];if(super.doConnectedCallback(),!this.parentNode.isScene)throw new Error("<a-assets> must be a child of a <a-scene>.");for(r=this.querySelectorAll("img"),t=0;t<r.length;t++)i=bC(r[t]),a.push(new Promise((function(e,n){_y.Cache.add(r[t].getAttribute("src"),i),i.complete?e():(i.onload=e,i.onerror=n)})));for(n=this.querySelectorAll("audio, video"),t=0;t<n.length;t++)(e=bC(n[t])).src||e.srcObject||EC("Audio/video asset has neither `src` nor `srcObject` attributes."),a.push(xC(e));this.getChildren().forEach((function(t){t.isAssetItem&&t.hasAttribute("src")&&a.push(new Promise((function(e,n){if(t.hasLoaded)return e();t.addEventListener("loaded",e),t.addEventListener("error",n)})))})),Promise.allSettled(a).then((function(){null!==o.timeout&&o.load()})),s=parseInt(this.getAttribute("timeout"),10)||3e3,this.timeout=setTimeout((function(){o.hasLoaded||(EC("Asset loading timed out in",s,"ms"),o.timeout=null,o.emit("timeout"),o.load())}),s)}disconnectedCallback(){super.disconnectedCallback(),this.timeout&&clearTimeout(this.timeout)}load(){super.load.call(this,null,(function(){return!1}))}}),customElements.define("a-asset-item",class extends Fb{constructor(){super(),this.data=null,this.isAssetItem=!0}connectedCallback(){var t=this,e=this.getAttribute("src");yC.setResponseType(this.getAttribute("response-type")||function(t){var e=function(t){var e=document.createElement("a");e.href=t;var n=e.search.replace(/^\?/,""),i=t.replace(n,"").replace("?","");return i.substring(i.lastIndexOf("/")+1)}(t),n=e.lastIndexOf(".");return n>=0&&".glb"===e.slice(n,t.search(/\?|#|$/))?"arraybuffer":"text"}(e)),yC.load(e,(function(e){t.data=e,Fb.prototype.load.call(t)}),(function(e){t.emit("progress",{loadedBytes:e.loaded,totalBytes:e.total,xhr:e})}),(function(e){t.emit("error",{xhr:e},!1)}))}});var CC=Ly("core:cubemap:warn");class wC extends HTMLElement{constructor(t){return super(t)}onReadyStateChange(){"complete"===document.readyState&&this.doConnectedCallback()}connectedCallback(){"complete"===document.readyState?wC.prototype.doConnectedCallback.call(this):document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){this.srcs=this.validate()}validate(){var t,e=this.querySelectorAll("[src]"),n=[];if(6===e.length){for(t=0;t<e.length;t++)"IMG"===e[t].tagName?n.push(e[t]):n.push(e[t].getAttribute("src"));return n}CC("<a-cubemap> did not contain exactly six elements each with a `src` attribute.")}}customElements.define("a-cubemap",wC),customElements.define("a-mixin",class extends Fb{constructor(){super(),this.componentCache={},this.rawAttributeCache={},this.isMixin=!0}doConnectedCallback(){super.doConnectedCallback(),this.sceneEl=this.closestScene(),this.id=this.getAttribute("id"),this.cacheAttributes(),this.updateEntities(),this.load()}attributeChangedCallback(t,e,n){super.attributeChangedCallback(),this.cacheAttribute(t,n),this.updateEntities()}setAttribute(t,e){window.HTMLElement.prototype.setAttribute.call(this,t,e),this.cacheAttribute(t,e)}cacheAttribute(t,e){var n,i;i=xE(t,"__")[0],n=cb[i],void 0===e&&(e=window.HTMLElement.prototype.getAttribute.call(this,t)),this.rawAttributeCache[t]=e,n&&(this.componentCache[t]=this.parseComponentAttrValue(n,e))}parseComponentAttrValue(t,e){var n;return"string"!=typeof e?e:(t.isSingleProperty?"string"==typeof(n=t.schema.parse(e))&&(n=e):n=VE(e),n)}getAttribute(t){return this.componentCache[t]||window.HTMLElement.prototype.getAttribute.call(this,t)}cacheAttributes(){var t,e,n=this.attributes;for(e=0;e<n.length;e++)t=n[e].name,this.cacheAttribute(t)}updateEntities(){var t,e,n;if(this.sceneEl)for(e=this.sceneEl.querySelectorAll("[mixin~="+this.id+"]"),n=0;n<e.length;n++)(t=e[n]).hasLoaded&&!t.isMixin&&t.mixinUpdate(this.id)}});const _C="1.6.0";var MC=new _y.Color,SC=new _y.Color,IC=CE,BC=wE,TC={},RC="color",LC="rotation",DC="components";function PC(t){t.x=_y.MathUtils.degToRad(t.x),t.y=_y.MathUtils.degToRad(t.y),t.z=_y.MathUtils.degToRad(t.z)}function UC(t,e,n){var i;for(i=0;i<e.length;i++)t.addEventListener(e[i],n)}function OC(t,e,n){var i;for(i=0;i<e.length;i++)t.removeEventListener(e[i],n)}function FC(t,e){var n,i,r;for(i=NC(e),r=t,n=0;n<i.length;n++)r=r[i[n]];if(void 0===r)throw console.log(t),new Error("[animation] property ("+e+") could not be found");return r}function kC(t,e,n,i){var r,s,o,a;for(e.startsWith("object3D.rotation")&&(n=_y.MathUtils.degToRad(n)),s=NC(e),a=t,r=0;r<s.length-1;r++)a=a[s[r]];o=s[s.length-1],i!==RC?a[o]=n:"r"in a[o]?(a[o].r=n.r,a[o].g=n.g,a[o].b=n.b):(a[o].x=n.r,a[o].y=n.g,a[o].z=n.b)}function NC(t){return t in TC||(TC[t]=t.split(".")),TC[t]}function QC(t){return t.isRawProperty||t.property.startsWith(DC)||t.property.startsWith("object3D")}_b("animation",{schema:{autoplay:{default:!0},delay:{default:0},dir:{default:""},dur:{default:1e3},easing:{default:"easeInQuad"},elasticity:{default:400},enabled:{default:!0},from:{default:""},loop:{default:0,parse:function(t){return!0===t||"true"===t||!1!==t&&"false"!==t&&parseInt(t,10)}},property:{default:""},startEvents:{type:"array"},pauseEvents:{type:"array"},resumeEvents:{type:"array"},round:{default:!1},to:{default:""},type:{default:""},isRawProperty:{default:!1}},multiple:!0,init:function(){var t=this;this.eventDetail={name:this.attrName},this.time=0,this.animation=null,this.animationIsPlaying=!1,this.onStartEvent=this.onStartEvent.bind(this),this.beginAnimation=this.beginAnimation.bind(this),this.pauseAnimation=this.pauseAnimation.bind(this),this.resumeAnimation=this.resumeAnimation.bind(this),this.fromColor={},this.toColor={},this.targets={},this.targetsArray=[],this.updateConfigForDefault=this.updateConfigForDefault.bind(this),this.updateConfigForRawColor=this.updateConfigForRawColor.bind(this),this.config={complete:function(){t.animationIsPlaying=!1,t.el.emit("animationcomplete",t.eventDetail,!1),t.id&&t.el.emit("animationcomplete__"+t.id,t.eventDetail,!1)}}},update:function(t){var e=this.config,n=this.data;this.animationIsPlaying=!1,this.data.enabled&&n.property&&(e.autoplay=!1,e.direction=n.dir,e.duration=n.dur,e.easing=n.easing,e.elasticity=n.elasticity,e.loop=n.loop,e.round=n.round,this.createAndStartAnimation())},tick:function(t,e){this.animationIsPlaying&&(this.time+=e,this.animation.tick(this.time))},remove:function(){this.pauseAnimation(),this.removeEventListeners()},pause:function(){this.paused=!0,this.pausedWasPlaying=this.animationIsPlaying,this.pauseAnimation(),this.removeEventListeners()},play:function(){this.paused&&(this.paused=!1,this.addEventListeners(),this.pausedWasPlaying&&(this.resumeAnimation(),this.pausedWasPlaying=!1))},createAndStartAnimation:function(){var t=this.data;this.updateConfig(),this.animationIsPlaying=!1,this.animation=Rt(this.config),this.animation.began=!0,this.removeEventListeners(),this.addEventListeners(),!t.autoplay||t.startEvents&&t.startEvents.length||(t.delay?setTimeout(this.beginAnimation,t.delay):this.beginAnimation())},beginAnimation:function(){this.updateConfig(),this.animation.began=!0,this.time=0,this.animationIsPlaying=!0,this.stopRelatedAnimations(),this.el.emit("animationbegin",this.eventDetail,!1)},pauseAnimation:function(){this.animationIsPlaying=!1},resumeAnimation:function(){this.animationIsPlaying=!0},onStartEvent:function(){this.data.enabled&&(this.updateConfig(),this.animation&&this.animation.pause(),this.animation=Rt(this.config),this.data.delay?setTimeout(this.beginAnimation,this.data.delay):this.beginAnimation())},updateConfigForRawColor:function(){var t,e,n,i=this.config,r=this.data,s=this.el;if(!this.waitComponentInitRawProperty(this.updateConfigForRawColor)){for(e in t=""===r.from?FC(s,r.property):r.from,n=r.to,this.setColorConfig(t,n),t=this.fromColor,n=this.toColor,this.targetsArray.length=0,this.targetsArray.push(t),i.targets=this.targetsArray,n)i[e]=n[e];var o;i.update=(o={},function(t){var e;(e=t.animatables[0].target).r===o.r&&e.g===o.g&&e.b===o.b||kC(s,r.property,e,r.type)})}},updateConfigForDefault:function(){var t,e,n,i,r=this.config,s=this.data,o=this.el;this.waitComponentInitRawProperty(this.updateConfigForDefault)||(t=""===s.from?QC(s)?FC(o,s.property):IC(o,s.property):s.from,n=s.to,isNaN(t||n)?(t=t?t.toString():t,n=n?n.toString():n):(t=parseFloat(t),n=parseFloat(n)),(e="true"===s.to||"false"===s.to||!0===s.to||!1===s.to)&&(t="true"===s.from||!0===s.from?1:0,n="true"===s.to||!0===s.to?1:0),this.targets.aframeProperty=t,r.targets=this.targets,r.aframeProperty=n,r.update=function(t){var n;(n=t.animatables[0].target.aframeProperty)!==i&&(i=n,e&&(n=n>=1),QC(s)?kC(o,s.property,n,s.type):BC(o,s.property,n))})},updateConfigForVector:function(){var t,e,n,i,r=this.config,s=this.data,o=this.el,a=NC(s.property),l="object3D"===a[0]?a[1]:a[0];for(t in e=""!==s.from?AE(s.from):IC(o,l),n=AE(s.to),l===LC&&(PC(e),PC(n)),this.targetsArray.length=0,this.targetsArray.push(e),r.targets=this.targetsArray,n)r[t]=n[t];r.update="position"!==l&&l!==LC&&"scale"!==l?function(){var t={};return function(e){var n=e.animatables[0].target;n.x===t.x&&n.y===t.y&&n.z===t.z||(t.x=n.x,t.y=n.y,t.z=n.z,BC(o,s.property,n))}}():(i={},function(t){var e=t.animatables[0].target;e.x===i.x&&e.y===i.y&&e.z===i.z||(i.x=e.x,i.y=e.y,i.z=e.z,o.object3D[l].set(e.x,e.y,e.z))})},updateConfig:function(){var t;t=function(t,e){var n,i,r,s;return"object3D"!==(r=e.split("."))[0]||r[2]||"position"!==r[1]&&"rotation"!==r[1]&&"scale"!==r[1]?(i=r[0],s=r[1],(n=t.components[i]||cb[i])?s&&!n.schema[s]?null:s?n.schema[s].type:n.schema.type:null):"vec3"}(this.el,this.data.property),QC(this.data)&&this.data.type===RC?this.updateConfigForRawColor():"vec2"===t||"vec3"===t||"vec4"===t?this.updateConfigForVector():this.updateConfigForDefault()},waitComponentInitRawProperty:function(t){var e,n=this.data,i=this.el,r=this;return""===n.from&&!!n.property.startsWith(DC)&&(e=NC(n.property)[1],!i.components[e]&&(i.addEventListener("componentinitialized",(function n(s){s.detail.name===e&&(t(),r.animation=Rt(r.config),i.removeEventListener("componentinitialized",n))})),!0))},stopRelatedAnimations:function(){var t,e;for(e in this.el.components)t=this.el.components[e],e!==this.attrName&&"animation"===t.name&&t.animationIsPlaying&&t.data.property===this.data.property&&(t.animationIsPlaying=!1)},addEventListeners:function(){var t=this.data,e=this.el;UC(e,t.startEvents,this.onStartEvent),UC(e,t.pauseEvents,this.pauseAnimation),UC(e,t.resumeEvents,this.resumeAnimation)},removeEventListeners:function(){var t=this.data,e=this.el;OC(e,t.startEvents,this.onStartEvent),OC(e,t.pauseEvents,this.pauseAnimation),OC(e,t.resumeEvents,this.resumeAnimation)},setColorConfig:function(t,e){MC.set(t),SC.set(e),t=this.fromColor,e=this.toColor,t.r=MC.r,t.g=MC.g,t.b=MC.b,e.r=SC.r,e.g=SC.g,e.b=SC.b}});var GC=Ly("components:anchored:warn");_b("anchored",{schema:{persistent:{default:!1}},init:function(){var t=this.el.sceneEl.getAttribute("webxr"),e=t.optionalFeatures;-1===e.indexOf("anchors")&&(e.push("anchors"),this.el.sceneEl.setAttribute("webxr",t)),this.auxQuaternion=new THREE.Quaternion,this.onEnterVR=this.onEnterVR.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR)},onEnterVR:function(){this.anchor=void 0,this.requestPersistentAnchorPending=this.data.persistent,this.requestAnchorPending=!this.data.persistent},tick:function(){var t,e,n,i=this.el.sceneEl,r=i.renderer.xr,s=this.el.object3D;(i.is("ar-mode")||i.is("vr-mode"))&&(!this.anchor&&this.requestPersistentAnchorPending&&this.restorePersistentAnchor(),!this.anchor&&this.requestAnchorPending&&this.createAnchor(),this.anchor&&(t=i.frame,e=r.getReferenceSpace(),n=t.getPose(this.anchor.anchorSpace,e),s.position.copy(n.transform.position),s.quaternion.copy(n.transform.orientation)))},createAnchor:async function(t,e){var n,i,r,s,o=this.el.sceneEl,a=o.renderer.xr,l=this.el.object3D;t=t||l.position,e=e||this.auxQuaternion.setFromEuler(l.rotation),function(t){var e=t.renderer.xr.getSession();return e&&e.restorePersistentAnchor}(o)?(this.anchor&&this.deleteAnchor(),n=o.frame,i=a.getReferenceSpace(),r=new XRRigidTransform({x:t.x,y:t.y,z:t.z},{x:e.x,y:e.y,z:e.z,w:e.w}),this.requestAnchorPending=!1,s=await n.createAnchor(r,i),this.data.persistent&&(this.el.id?(this.persistentHandle=await s.requestPersistentHandle(),localStorage.setItem(this.el.id,this.persistentHandle)):GC("The anchor won't be persisted because the entity has no assigned id.")),o.object3D.attach(this.el.object3D),this.anchor=s):GC("This browser doesn't support the WebXR anchors module")},restorePersistentAnchor:async function(){var t,e=this.el.sceneEl.renderer.xr.getSession(),n=e.persistentAnchors;if(this.requestPersistentAnchorPending=!1,!this.el.id)return GC("The entity associated to the persistent anchor cannot be retrieved because it doesn't have an assigned id."),void(this.requestAnchorPending=!0);if(n){t=localStorage.getItem(this.el.id);for(var i=0;i<n.length;++i)if(t===n[i]){this.anchor=await e.restorePersistentAnchor(n[i]),this.anchor&&(this.persistentHandle=n[i]);break}this.anchor||(this.requestAnchorPending=!0)}else this.requestPersistentAnchorPending=!0},deleteAnchor:function(){var t,e=this.anchor;e&&(t=this.el.sceneEl.renderer.xr.getSession(),e.delete(),this.el.sceneEl.object3D.add(this.el.object3D),this.persistentHandle&&t.deletePersistentAnchor(this.persistentHandle),this.anchor=void 0)}}),_b("camera",{schema:{active:{default:!0},far:{default:1e4},fov:{default:80,min:0},near:{default:.005,min:0},spectator:{default:!1},zoom:{default:1,min:0}},init:function(){var t,e=this.el;t=this.camera=new _y.PerspectiveCamera,e.setObject3D("camera",t)},update:function(t){var e=this.data,n=this.camera;n.aspect=e.aspect||window.innerWidth/window.innerHeight,n.far=e.far,n.fov=e.fov,n.near=e.near,n.zoom=e.zoom,n.updateProjectionMatrix(),this.updateActiveCamera(t),this.updateSpectatorCamera(t)},updateActiveCamera:function(t){var e=this.data,n=this.el,i=this.system;t&&t.active===e.active||e.spectator||(e.active&&i.activeCameraEl!==n?i.setActiveCamera(n):e.active||i.activeCameraEl!==n||i.disableActiveCamera())},updateSpectatorCamera:function(t){var e=this.data,n=this.el,i=this.system;t&&t.spectator===e.spectator||(e.spectator&&i.spectatorCameraEl!==n?i.setSpectatorCamera(n):e.spectator||i.spectatorCameraEl!==n||i.disableSpectatorCamera())},remove:function(){this.el.removeObject3D("camera")}});var zC,HC,VC,jC,WC="click",qC="mouseup",XC="cursor-fusing",YC="cursor-hovering",JC="cursor-hovered",KC={DOWN:["mousedown","touchstart"],UP:["mouseup","touchend"]},ZC={DOWN:["selectstart"],UP:["selectend"]},$C="a-mouse-cursor-hover",tw=(_b("cursor",{dependencies:["raycaster"],schema:{downEvents:{default:[]},fuse:{default:Wy()},fuseTimeout:{default:1500,min:0},mouseCursorStylesEnabled:{default:!0},upEvents:{default:[]},rayOrigin:{default:"entity",oneOf:["mouse","entity","xrselect"]}},after:["tracked-controls"],multiple:!0,init:function(){var t=this;this.fuseTimeout=void 0,this.cursorDownEl=null,this.intersectedEl=null,this.canvasBounds=document.body.getBoundingClientRect(),this.isCursorDown=!1,this.activeXRInput=null,this.updateCanvasBounds=ux((function(){t.canvasBounds=t.el.sceneEl.canvas.getBoundingClientRect()}),500),this.eventDetail={},this.intersectedEventDetail={cursorEl:this.el},this.onCursorDown=this.onCursorDown.bind(this),this.onCursorUp=this.onCursorUp.bind(this),this.onIntersection=this.onIntersection.bind(this),this.onIntersectionCleared=this.onIntersectionCleared.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onEnterVR=this.onEnterVR.bind(this)},update:function(t){var e=this.data.rayOrigin;e!==t.rayOrigin&&("entity"===e&&this.resetRaycaster(),this.updateMouseEventListeners(),"xrselect"!==e&&"entity"!==e||this.addWebXREventListeners(),"xrselect"!==t.rayOrigin&&"entity"!==t.rayOrigin||this.removeWebXREventListeners())},tick:function(){var t=this.el.sceneEl.frame,e=this.activeXRInput;"xrselect"===this.data.rayOrigin&&t&&e&&this.onMouseMove({frame:t,inputSource:e,type:"fakeselectevent"})},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){var t=this.el;t.removeState(YC),t.removeState(XC),clearTimeout(this.fuseTimeout),this.intersectedEl&&this.intersectedEl.removeState(JC),this.removeEventListeners()},addEventListeners:function(){var t,e=this.data,n=this.el,i=this;function r(){t=n.sceneEl.canvas,e.downEvents.length||e.upEvents.length||(KC.DOWN.forEach((function(e){t.addEventListener(e,i.onCursorDown,{passive:!1})})),KC.UP.forEach((function(e){t.addEventListener(e,i.onCursorUp,{passive:!1})})))}(t=n.sceneEl.canvas)?r():n.sceneEl.addEventListener("render-target-loaded",r),e.downEvents.forEach((function(t){n.addEventListener(t,i.onCursorDown)})),e.upEvents.forEach((function(t){n.addEventListener(t,i.onCursorUp)})),n.addEventListener("raycaster-intersection",this.onIntersection),n.addEventListener("raycaster-closest-entity-changed",this.onIntersection),n.addEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),n.sceneEl.addEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.addEventListener("enter-vr",this.onEnterVR),window.addEventListener("resize",this.updateCanvasBounds),window.addEventListener("scroll",this.updateCanvasBounds),this.updateMouseEventListeners()},removeEventListeners:function(){var t,e=this.data,n=this.el,i=this;!(t=n.sceneEl.canvas)||e.downEvents.length||e.upEvents.length||(KC.DOWN.forEach((function(e){t.removeEventListener(e,i.onCursorDown)})),KC.UP.forEach((function(e){t.removeEventListener(e,i.onCursorUp)}))),e.downEvents.forEach((function(t){n.removeEventListener(t,i.onCursorDown)})),e.upEvents.forEach((function(t){n.removeEventListener(t,i.onCursorUp)})),n.removeEventListener("raycaster-intersection",this.onIntersection),n.removeEventListener("raycaster-closest-entity-changed",this.onIntersection),n.removeEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),t.removeEventListener("mousemove",this.onMouseMove),t.removeEventListener("touchstart",this.onMouseMove),t.removeEventListener("touchmove",this.onMouseMove),n.sceneEl.removeEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.removeEventListener("enter-vr",this.onEnterVR),window.removeEventListener("resize",this.updateCanvasBounds),window.removeEventListener("scroll",this.updateCanvasBounds),this.removeWebXREventListeners()},updateMouseEventListeners:function(){var t,e=this.el;(t=e.sceneEl.canvas).removeEventListener("mousemove",this.onMouseMove),t.removeEventListener("touchmove",this.onMouseMove),e.setAttribute("raycaster","useWorldCoordinates",!1),"mouse"===this.data.rayOrigin&&(t.addEventListener("mousemove",this.onMouseMove),t.addEventListener("touchmove",this.onMouseMove,{passive:!1}),e.setAttribute("raycaster","useWorldCoordinates",!0),this.updateCanvasBounds())},resetRaycaster:function(){this.el.setAttribute("raycaster",{direction:(new THREE.Vector3).set(0,0,-1),origin:new THREE.Vector3})},addWebXREventListeners:function(){var t=this,e=this.el.sceneEl.xrSession;e&&(ZC.DOWN.forEach((function(n){e.addEventListener(n,t.onCursorDown)})),ZC.UP.forEach((function(n){e.addEventListener(n,t.onCursorUp)})))},removeWebXREventListeners:function(){var t=this,e=this.el.sceneEl.xrSession;e&&(ZC.DOWN.forEach((function(n){e.removeEventListener(n,t.onCursorDown)})),ZC.UP.forEach((function(n){e.removeEventListener(n,t.onCursorUp)})))},onMouseMove:(zC=new THREE.Vector3,HC=new THREE.Vector2,VC=new THREE.Vector3,jC={origin:VC,direction:zC},function(t){var e,n,i,r,s,o,a,l,c,h=this.canvasBounds,u=this.el.sceneEl.camera;u.parent.updateMatrixWorld(),n=(i="touchmove"===t.type||"touchstart"===t.type?t.touches.item(0):t).clientX-h.left,r=i.clientY-h.top,HC.x=n/h.width*2-1,HC.y=-r/h.height*2+1,"xrselect"!==this.data.rayOrigin||"selectstart"!==t.type&&"fakeselectevent"!==t.type?"fakeselectout"===t.type?(zC.set(0,1,0),VC.set(0,9999,0)):u&&u.isPerspectiveCamera?(VC.setFromMatrixPosition(u.matrixWorld),zC.set(HC.x,HC.y,.5).unproject(u).sub(VC).normalize()):u&&u.isOrthographicCamera?(VC.set(HC.x,HC.y,(u.near+u.far)/(u.near-u.far)).unproject(u),zC.set(0,0,-1).transformDirection(u.matrixWorld)):console.error("AFRAME.Raycaster: Unsupported camera type: "+u.type):(s=t.frame,o=t.inputSource,a=this.el.sceneEl.renderer.xr.getReferenceSpace(),(l=s.getPose(o.targetRaySpace,a))&&(c=l.transform,zC.set(0,0,-1),zC.applyQuaternion(c.orientation),VC.copy(c.position),(e=u.el.object3D.parent).localToWorld(VC),zC.transformDirection(e.matrixWorld))),this.el.setAttribute("raycaster",jC),"touchmove"===t.type&&t.preventDefault()}),onCursorDown:function(t){this.isCursorDown=!0,"mouse"===this.data.rayOrigin&&"touchstart"===t.type&&(this.onMouseMove(t),this.el.components.raycaster.checkIntersections(),t.preventDefault()),"xrselect"===this.data.rayOrigin&&"selectstart"===t.type&&(this.activeXRInput=t.inputSource,this.onMouseMove(t),this.el.components.raycaster.checkIntersections(),this.el.components.raycaster.intersectedEls.length&&void 0!==this.el.sceneEl.components["ar-hit-test"]&&this.el.sceneEl.getAttribute("ar-hit-test").enabled&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!1),this.reenableARHitTest=!0)),this.twoWayEmit("mousedown",t),this.cursorDownEl=this.intersectedEl},onCursorUp:function(t){if(this.isCursorDown&&("xrselect"!==this.data.rayOrigin||this.activeXRInput===t.inputSource)){this.isCursorDown=!1;var e=this.data;this.twoWayEmit(qC,t),!0===this.reenableARHitTest&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!0),this.reenableARHitTest=void 0),this.cursorDownEl&&this.cursorDownEl!==this.intersectedEl&&(this.intersectedEventDetail.intersection=null,this.cursorDownEl.emit(qC,this.intersectedEventDetail)),e.fuse&&"mouse"!==e.rayOrigin&&"xrselect"!==e.rayOrigin||!this.intersectedEl||this.cursorDownEl!==this.intersectedEl||this.twoWayEmit(WC,t),"xrselect"===e.rayOrigin&&this.onMouseMove({type:"fakeselectout"}),this.activeXRInput=null,this.cursorDownEl=null,"touchend"===t.type&&t.preventDefault()}},onIntersection:function(t){var e,n,i,r,s=this.el;n=t.detail.els[0]===s?1:0,r=t.detail.intersections[n],(i=t.detail.els[n])&&this.intersectedEl!==i&&(this.intersectedEl&&(e=this.el.components.raycaster.getIntersection(this.intersectedEl))&&e.distance<=r.distance||(this.clearCurrentIntersection(!0),this.setIntersection(i,r)))},onIntersectionCleared:function(t){-1!==t.detail.clearedEls.indexOf(this.intersectedEl)&&this.clearCurrentIntersection()},onEnterVR:function(){var t=this.data.rayOrigin;this.clearCurrentIntersection(!0),"xrselect"!==t&&"entity"!==t||this.addWebXREventListeners()},setIntersection:function(t,e){var n=this.el,i=this.data,r=this;this.intersectedEl!==t&&(this.intersectedEl=t,n.addState(YC),t.addState(JC),this.twoWayEmit("mouseenter"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.add($C),0!==i.fuseTimeout&&i.fuse&&"xrselect"!==i.rayOrigin&&"mouse"!==i.rayOrigin&&(n.addState(XC),this.twoWayEmit("fusing"),this.fuseTimeout=setTimeout((function(){n.removeState(XC),r.twoWayEmit(WC)}),i.fuseTimeout)))},clearCurrentIntersection:function(t){var e,n,i=this.el;this.intersectedEl&&(this.intersectedEl.removeState(JC),i.removeState(YC),i.removeState(XC),this.twoWayEmit("mouseleave"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.remove($C),this.intersectedEl=null,clearTimeout(this.fuseTimeout),!0!==t&&0!==(n=this.el.components.raycaster.intersections).length&&(e=n[n[0].object.el===i?1:0])&&this.setIntersection(e.object.el,e))},twoWayEmit:function(t,e){var n,i=this.el,r=this.intersectedEl;function s(t,n){e instanceof MouseEvent?t.mouseEvent=e:"undefined"!=typeof TouchEvent&&e instanceof TouchEvent&&(t.touchEvent=e)}n=this.el.components.raycaster.getIntersection(r),this.eventDetail.intersectedEl=r,this.eventDetail.intersection=n,s(this.eventDetail),i.emit(t,this.eventDetail),r&&(this.intersectedEventDetail.intersection=n,s(this.intersectedEventDetail),r.emit(t,this.intersectedEventDetail))}}),new _y.BufferGeometry),ew=(_b("geometry",{schema:{buffer:{default:!0},primitive:{default:"box",oneOf:iC,schemaChange:!0},skipCache:{default:!1}},init:function(){this.geometry=null},update:function(t){var e,n=this.data,i=this.el,r=this.system;this.geometry&&(r.unuseGeometry(t),this.geometry=null),this.geometry=r.getOrCreateGeometry(n),(e=i.getObject3D("mesh"))?e.geometry=this.geometry:((e=new _y.Mesh).geometry=this.geometry,this.el.getAttribute("material")||(e.material=new _y.MeshStandardMaterial({color:16777215*Math.random(),metalness:0,roughness:.5})),i.setObject3D("mesh",e))},remove:function(){this.system.unuseGeometry(this.data),this.el.getObject3D("mesh").geometry=tw,this.geometry=null},updateSchema:function(t){var e=this.oldData&&this.oldData.primitive,n=t.primitive,i=nC[n]&&nC[n].schema;if(!i)throw new Error("Unknown geometry schema `"+n+"`");e&&e===n||this.extendSchema(i)}}),"generic"),nw=(_b("generic-tracked-controller-controls",{schema:{hand:{default:""},defaultModel:{default:!0},defaultModelColor:{default:"gray"},disabled:{default:!1}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick"]},bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.wasControllerConnected=!1,this.bindMethods(),this.el.addEventListener("controllerconnected",(function(e){e.detail.name!==t.name&&(t.wasControllerConnected=!0,t.removeEventListeners(),t.removeControllersUpdateListener())}))},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data,e=t.hand?t.hand:void 0;ZE(this,ew,{hand:e,iterateControllerProfiles:!0})},play:function(){this.wasControllerConnected||(this.checkIfControllerPresent(),this.addControllersUpdateListener())},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;this.el.components["tracked-controls"]?this.removeEventListeners():(t.setAttribute("tracked-controls",{hand:e.hand,idPrefix:ew,iterateControllerProfiles:!0}),this.data.defaultModel&&this.initDefaultModel())},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.wasControllerConnected&&this.checkIfControllerPresent()},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},initDefaultModel:function(){var t=this.modelEl=document.createElement("a-entity");t.setAttribute("geometry",{primitive:"sphere",radius:.03}),t.setAttribute("material",{color:this.data.color}),this.el.appendChild(t),this.el.emit("controllermodelready",{name:"generic-tracked-controller-controls",model:this.modelEl,rayOrigin:{origin:{x:0,y:0,z:-.01},direction:{x:0,y:0,z:-1}}})}}),Ly("components:gltf-model:warn"));_b("gltf-model",{schema:{type:"model"},init:function(){var t=this,e=this.system.getDRACOLoader(),n=this.system.getMeshoptDecoder(),i=this.system.getKTX2Loader();this.model=null,this.loader=new _y.GLTFLoader,e&&this.loader.setDRACOLoader(e),this.ready=n?n.then((function(e){t.loader.setMeshoptDecoder(e)})):Promise.resolve(),i&&this.loader.setKTX2Loader(i)},update:function(){var t=this,e=this.el,n=this.data;n&&(this.remove(),this.ready.then((function(){t.loader.load(n,(function(n){t.model=n.scene||n.scenes[0],t.model.animations=n.animations,e.setObject3D("mesh",t.model),e.emit("model-loaded",{format:"gltf",model:t.model})}),void 0,(function(t){var i=t&&t.message?t.message:"Failed to load glTF model";nw(i),e.emit("model-error",{format:"gltf",src:n})}))})))},remove:function(){this.model&&this.el.removeObject3D("mesh")}}),_b("grabbable",{init:function(){this.el.setAttribute("obb-collider","centerModel: true")}});var iw,rw=My+"controllers/oculus-hands/v4/left.glb",sw=My+"controllers/oculus-hands/v4/right.glb",ow=["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"];_b("hand-tracking-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},modelStyle:{default:"mesh",oneOf:["dots","mesh"]},modelColor:{default:"white"},modelOpacity:{default:1}},after:["tracked-controls"],bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this)},addEventListeners:function(){this.el.addEventListener("model-loaded",this.onModelLoaded);for(var t=0;t<this.jointEls.length;++t)this.jointEls[t].object3D.visible=!0},removeEventListeners:function(){this.el.removeEventListener("model-loaded",this.onModelLoaded);for(var t=0;t<this.jointEls.length;++t)this.jointEls[t].object3D.visible=!1},init:function(){var t=this.el.sceneEl,e=t.getAttribute("webxr"),n=e.optionalFeatures;-1===n.indexOf("hand-tracking")&&(n.push("hand-tracking"),t.setAttribute("webxr",e)),this.wristObject3D=new THREE.Object3D,this.el.sceneEl.object3D.add(this.wristObject3D),this.onModelLoaded=this.onModelLoaded.bind(this),this.onChildAttached=this.onChildAttached.bind(this),this.jointEls=[],this.controllerPresent=!1,this.isPinched=!1,this.pinchEventDetail={position:new THREE.Vector3,wristRotation:new THREE.Quaternion},this.indexTipPosition=new THREE.Vector3,this.hasPoses=!1,this.jointPoses=new Float32Array(16*ow.length),this.jointRadii=new Float32Array(ow.length),this.bindMethods(),this.updateReferenceSpace=this.updateReferenceSpace.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.updateReferenceSpace),this.el.sceneEl.addEventListener("exit-vr",this.updateReferenceSpace),this.el.addEventListener("child-attached",this.onChildAttached),this.wristObject3D.visible=!1},onChildAttached:function(t){this.addChildEntity(t.detail.el)},update:function(){this.updateModelMaterial()},updateModelMaterial:function(){var t=this.jointEls,e=this.skinnedMesh,n=!(1===this.data.modelOpacity);e&&(this.skinnedMesh.material.color.set(this.data.modelColor),this.skinnedMesh.material.transparent=n,this.skinnedMesh.material.opacity=this.data.modelOpacity);for(var i=0;i<t.length;i++)t[i].setAttribute("material",{color:this.data.modelColor,transparent:n,opacity:this.data.modelOpacity})},updateReferenceSpace:function(){var t=this,e=this.el.sceneEl.xrSession;if(this.referenceSpace=void 0,e){var n=t.el.sceneEl.systems.webxr.sessionReferenceSpaceType;e.requestReferenceSpace(n).then((function(e){t.referenceSpace=e})).catch((function(e){throw t.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(n,"tracked-controls-webxr uses reference space "+n),e}))}},checkIfControllerPresent:function(){var t=this.data;ZE(this,"",{hand:t.hand?t.hand:void 0,iterateControllerProfiles:!0,handTracking:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},tick:function(){var t=this.el.sceneEl,e=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller,n=t.frame,i=this.el.components["tracked-controls"],r=this.referenceSpace;e&&n&&r&&i&&(this.hasPoses=!1,e.hand&&(this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),this.hasPoses=n.fillPoses(e.hand.values(),r,this.jointPoses)&&n.fillJointRadii(e.hand.values(),this.jointRadii),this.updateHandModel(),this.detectGesture(),this.updateWristObject()))},updateWristObject:(iw=new THREE.Matrix4,function(){var t=this.wristObject3D;t&&this.hasPoses&&(iw.fromArray(this.jointPoses,0),t.position.setFromMatrixPosition(iw),t.quaternion.setFromRotationMatrix(iw))}),updateHandModel:function(){this.wristObject3D.visible=!0,this.el.object3D.visible=!0,"dots"===this.data.modelStyle&&this.updateHandDotsModel(),"mesh"===this.data.modelStyle&&this.updateHandMeshModel()},getBone:function(t){for(var e=this.bones,n=0;n<e.length;n++)if(e[n].name===t)return e[n];return null},updateHandMeshModel:function(){var t=new THREE.Matrix4;return function(){var e=0,n=this.jointPoses,i=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller;if(i&&this.mesh&&(this.mesh.visible=!1,this.hasPoses))for(var r of i.hand.values()){var s=this.getBone(r.jointName);null!=s&&(this.mesh.visible=!0,t.fromArray(n,16*e),s.position.setFromMatrixPosition(t),s.quaternion.setFromRotationMatrix(t)),e++}}}(),updateHandDotsModel:function(){for(var t,e,n=this.jointPoses,i=this.jointRadii,r=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller,s=0;s<r.hand.size;s++)e=(t=this.jointEls[s]).object3D,t.object3D.visible=this.hasPoses,this.hasPoses&&(e.matrix.fromArray(n,16*s),e.matrix.decompose(e.position,e.rotation,e.scale),t.setAttribute("scale",{x:i[s],y:i[s],z:i[s]}))},detectGesture:function(){this.detectPinch()},detectPinch:function(){var t=new THREE.Vector3,e=new THREE.Matrix4;return function(){var n=this.indexTipPosition,i=this.pinchEventDetail;if(this.hasPoses){t.setFromMatrixPosition(e.fromArray(this.jointPoses,64)),n.setFromMatrixPosition(e.fromArray(this.jointPoses,144)),i.wristRotation.setFromRotationMatrix(e.fromArray(this.jointPoses,0));var r=n.distanceTo(t);r<.015&&!1===this.isPinched&&(this.isPinched=!0,i.position.copy(n).add(t).multiplyScalar(.5),this.el.emit("pinchstarted",i)),r>.02&&!0===this.isPinched&&(this.isPinched=!1,i.position.copy(n).add(t).multiplyScalar(.5),this.el.emit("pinchended",i)),this.isPinched&&(i.position.copy(n).add(t).multiplyScalar(.5),this.el.emit("pinchmoved",i))}}}(),pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{id:"",hand:e.hand,iterateControllerProfiles:!0,handTrackingEnabled:!0}),this.mesh?this.mesh!==t.getObject3D("mesh")&&t.setObject3D("mesh",this.mesh):this.initDefaultModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){var t,e=this.el;this.checkIfControllerPresent(),t=e.components["tracked-controls"]&&e.components["tracked-controls"].controller,this.mesh&&t&&t.hand&&t.hand instanceof XRHand&&e.setObject3D("mesh",this.mesh)},initDefaultModel:function(){var t=this.data;"dots"===t.modelStyle&&this.initDotsModel(),"mesh"===t.modelStyle&&this.initMeshHandModel(),this.el.object3D.visible=!0,this.wristObject3D.visible=!0},initDotsModel:function(){if(0===this.jointEls.length){for(var t=0;t<ow.length;++t){var e=this.jointEl=document.createElement("a-entity");e.setAttribute("geometry",{primitive:"sphere",radius:1}),e.object3D.visible=!1,this.el.appendChild(e),this.jointEls.push(e)}this.updateModelMaterial()}},initMeshHandModel:function(){var t="left"===this.data.hand?rw:sw;this.el.setAttribute("gltf-model",t)},onModelLoaded:function(){var t=this.mesh=this.el.getObject3D("mesh").children[0],e=this.skinnedMesh=t.getObjectByProperty("type","SkinnedMesh");this.skinnedMesh&&(this.bones=e.skeleton.bones,this.el.removeObject3D("mesh"),t.position.set(0,0,0),t.rotation.set(0,0,0),e.frustumCulled=!1,e.material=new THREE.MeshStandardMaterial,this.updateModelMaterial(),this.setupChildrenEntities(),this.el.setObject3D("mesh",t))},setupChildrenEntities:function(){for(var t=this.el.children,e=0;e<t.length;++e)t[e]instanceof Hb&&this.addChildEntity(t[e])},addChildEntity:function(t){t instanceof Hb&&this.wristObject3D.add(t.object3D)}}),_b("hand-tracking-grab-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},color:{type:"color",default:"white"},hoverColor:{type:"color",default:"#538df1"},hoverEnabled:{default:!1}},init:function(){var t,e=this.el,n=this.data;t="right"===n.hand?"components.hand-tracking-controls.bones.3":"components.hand-tracking-controls.bones.21",e.setAttribute("hand-tracking-controls",{hand:n.hand}),e.setAttribute("obb-collider",{trackedObject3D:t,size:.04}),this.auxMatrix=new _y.Matrix4,this.onCollisionStarted=this.onCollisionStarted.bind(this),this.el.addEventListener("obbcollisionstarted",this.onCollisionStarted),this.onCollisionEnded=this.onCollisionEnded.bind(this),this.el.addEventListener("obbcollisionended",this.onCollisionEnded),this.onPinchStarted=this.onPinchStarted.bind(this),this.el.addEventListener("pinchstarted",this.onPinchStarted),this.onPinchEnded=this.onPinchEnded.bind(this),this.el.addEventListener("pinchended",this.onPinchEnded)},transferEntityOwnership:function(){for(var t,e=this.el.sceneEl.querySelectorAll("[hand-tracking-grab-controls]"),n=0;n<e.length;++n)(t=e[n].components["hand-tracking-grab-controls"])!==this&&this.grabbedEl&&this.grabbedEl===t.grabbedEl&&t.releaseGrabbedEntity();return!1},onCollisionStarted:function(t){var e=t.detail.withEl;this.collidedEl||e.getAttribute("grabbable")&&(this.collidedEl=e,this.grabbingObject3D=t.detail.trackedObject3D,this.data.hoverEnabled&&this.el.setAttribute("hand-tracking-controls","modelColor",this.data.hoverColor))},onCollisionEnded:function(){this.collidedEl=void 0,this.grabbedEl||(this.grabbingObject3D=void 0,this.data.hoverEnabled&&this.el.setAttribute("hand-tracking-controls","modelColor",this.data.color))},onPinchStarted:function(t){this.collidedEl&&(this.grabbedEl=this.collidedEl,this.transferEntityOwnership(),this.grab())},onPinchEnded:function(){this.releaseGrabbedEntity()},releaseGrabbedEntity:function(){var t=this.grabbedEl;if(t){var e=t.object3D,n=e.parent,i=this.originalParent;e.applyMatrix4(n.matrixWorld),e.applyMatrix4(this.auxMatrix.copy(i.matrixWorld).invert()),n.remove(e),i.add(e),this.el.emit("grabended",{grabbedEl:t}),this.grabbedEl=void 0,this.originalParent=void 0}},grab:function(){var t=this.grabbedEl,e=t.object3D,n=e.parent;this.originalParent=n;var i=this.el.components["hand-tracking-controls"].wristObject3D;e.applyMatrix4(n.matrixWorld),e.applyMatrix4(this.auxMatrix.copy(i.matrixWorld).invert()),n.remove(e),i.add(e),this.el.emit("grabstarted",{grabbedEl:t})}});var aw={toonLeft:My+"controllers/hands/leftHand.glb",toonRight:My+"controllers/hands/rightHand.glb",lowPolyLeft:My+"controllers/hands/leftHandLow.glb",lowPolyRight:My+"controllers/hands/rightHandLow.glb",highPolyLeft:My+"controllers/hands/leftHandHigh.glb",highPolyRight:My+"controllers/hands/rightHandHigh.glb"},lw="Point",cw="Fist",hw="Thumb Up",uw={};function dw(t,e){var n;if(t)return"grip"===(n=uw[t])?n+(e?"close":"open"):"point"===n?n+(e?"up":"down"):"pointing"===n||"pistol"===n?n+(e?"start":"end"):void 0}uw[cw]="grip",uw[hw]="pistol",uw[lw]="pointing",_b("hand-controls",{schema:{color:{default:"white",type:"color"},hand:{default:"left"},handModelStyle:{default:"lowPoly",oneOf:["lowPoly","highPoly","toon"]}},after:["tracked-controls"],init:function(){var t=this,e=this.el;this.pressedButtons={},this.touchedButtons={},this.loader=new THREE.GLTFLoader,this.loader.setCrossOrigin("anonymous"),this.onGripDown=function(){t.handleButton("grip","down")},this.onGripUp=function(){t.handleButton("grip","up")},this.onTrackpadDown=function(){t.handleButton("trackpad","down")},this.onTrackpadUp=function(){t.handleButton("trackpad","up")},this.onTrackpadTouchStart=function(){t.handleButton("trackpad","touchstart")},this.onTrackpadTouchEnd=function(){t.handleButton("trackpad","touchend")},this.onTriggerDown=function(){t.handleButton("trigger","down")},this.onTriggerUp=function(){t.handleButton("trigger","up")},this.onTriggerTouchStart=function(){t.handleButton("trigger","touchstart")},this.onTriggerTouchEnd=function(){t.handleButton("trigger","touchend")},this.onGripTouchStart=function(){t.handleButton("grip","touchstart")},this.onGripTouchEnd=function(){t.handleButton("grip","touchend")},this.onThumbstickDown=function(){t.handleButton("thumbstick","down")},this.onThumbstickUp=function(){t.handleButton("thumbstick","up")},this.onAorXTouchStart=function(){t.handleButton("AorX","touchstart")},this.onAorXTouchEnd=function(){t.handleButton("AorX","touchend")},this.onBorYTouchStart=function(){t.handleButton("BorY","touchstart")},this.onBorYTouchEnd=function(){t.handleButton("BorY","touchend")},this.onSurfaceTouchStart=function(){t.handleButton("surface","touchstart")},this.onSurfaceTouchEnd=function(){t.handleButton("surface","touchend")},this.onControllerConnected=this.onControllerConnected.bind(this),this.onControllerDisconnected=this.onControllerDisconnected.bind(this),e.addEventListener("controllerconnected",this.onControllerConnected),e.addEventListener("controllerdisconnected",this.onControllerDisconnected),e.object3D.visible=!1},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},tick:function(t,e){var n=this.el.getObject3D("mesh");n&&n.mixer&&n.mixer.update(e/1e3)},onControllerConnected:function(t){var e=this.el,n=this.data.hand,i=this.el.getObject3D("mesh");e.object3D.visible=!0;var r="left"===n?Math.PI/2:-Math.PI/2,s=e.sceneEl.hasWebXR?-Math.PI/2:0;"pico-controls"===t.detail.name&&(s+=Math.PI/4),i.position.set(0,0,0),i.rotation.set(s,0,r)},onControllerDisconnected:function(){this.el.object3D.visible=!1},addEventListeners:function(){var t=this.el;t.addEventListener("gripdown",this.onGripDown),t.addEventListener("gripup",this.onGripUp),t.addEventListener("trackpaddown",this.onTrackpadDown),t.addEventListener("trackpadup",this.onTrackpadUp),t.addEventListener("trackpadtouchstart",this.onTrackpadTouchStart),t.addEventListener("trackpadtouchend",this.onTrackpadTouchEnd),t.addEventListener("triggerdown",this.onTriggerDown),t.addEventListener("triggerup",this.onTriggerUp),t.addEventListener("triggertouchstart",this.onTriggerTouchStart),t.addEventListener("triggertouchend",this.onTriggerTouchEnd),t.addEventListener("griptouchstart",this.onGripTouchStart),t.addEventListener("griptouchend",this.onGripTouchEnd),t.addEventListener("thumbstickdown",this.onThumbstickDown),t.addEventListener("thumbstickup",this.onThumbstickUp),t.addEventListener("abuttontouchstart",this.onAorXTouchStart),t.addEventListener("abuttontouchend",this.onAorXTouchEnd),t.addEventListener("bbuttontouchstart",this.onBorYTouchStart),t.addEventListener("bbuttontouchend",this.onBorYTouchEnd),t.addEventListener("xbuttontouchstart",this.onAorXTouchStart),t.addEventListener("xbuttontouchend",this.onAorXTouchEnd),t.addEventListener("ybuttontouchstart",this.onBorYTouchStart),t.addEventListener("ybuttontouchend",this.onBorYTouchEnd),t.addEventListener("surfacetouchstart",this.onSurfaceTouchStart),t.addEventListener("surfacetouchend",this.onSurfaceTouchEnd)},removeEventListeners:function(){var t=this.el;t.removeEventListener("gripdown",this.onGripDown),t.removeEventListener("gripup",this.onGripUp),t.removeEventListener("trackpaddown",this.onTrackpadDown),t.removeEventListener("trackpadup",this.onTrackpadUp),t.removeEventListener("trackpadtouchstart",this.onTrackpadTouchStart),t.removeEventListener("trackpadtouchend",this.onTrackpadTouchEnd),t.removeEventListener("triggerdown",this.onTriggerDown),t.removeEventListener("triggerup",this.onTriggerUp),t.removeEventListener("triggertouchstart",this.onTriggerTouchStart),t.removeEventListener("triggertouchend",this.onTriggerTouchEnd),t.removeEventListener("griptouchstart",this.onGripTouchStart),t.removeEventListener("griptouchend",this.onGripTouchEnd),t.removeEventListener("thumbstickdown",this.onThumbstickDown),t.removeEventListener("thumbstickup",this.onThumbstickUp),t.removeEventListener("abuttontouchstart",this.onAorXTouchStart),t.removeEventListener("abuttontouchend",this.onAorXTouchEnd),t.removeEventListener("bbuttontouchstart",this.onBorYTouchStart),t.removeEventListener("bbuttontouchend",this.onBorYTouchEnd),t.removeEventListener("xbuttontouchstart",this.onAorXTouchStart),t.removeEventListener("xbuttontouchend",this.onAorXTouchEnd),t.removeEventListener("ybuttontouchstart",this.onBorYTouchStart),t.removeEventListener("ybuttontouchend",this.onBorYTouchEnd),t.removeEventListener("surfacetouchstart",this.onSurfaceTouchStart),t.removeEventListener("surfacetouchend",this.onSurfaceTouchEnd)},update:function(t){var e,n=this.el,i=this.data.hand,r=this.data.handModelStyle,s=this.data.color,o=this;if(e={hand:i,model:!1},i!==t){var a=aw[r+i.charAt(0).toUpperCase()+i.slice(1)];this.loader.load(a,(function(t){var i=t.scene.children[0];i.mixer=new THREE.AnimationMixer(i),o.clips=t.animations,n.setObject3D("mesh",i),i.traverse((function(t){t.isMesh&&(t.material.color=new THREE.Color(s))})),n.setAttribute("magicleap-controls",e),n.setAttribute("vive-controls",e),n.setAttribute("meta-touch-controls",e),n.setAttribute("pico-controls",e),n.setAttribute("windows-motion-controls",e),n.setAttribute("hp-mixed-reality-controls",e)}))}},remove:function(){this.el.removeObject3D("mesh")},handleButton:function(t,e){var n,i="down"===e,r="touchstart"===e;if(0===e.indexOf("touch")){if(r===this.touchedButtons[t])return;this.touchedButtons[t]=r}else{if(i===this.pressedButtons[t])return;this.pressedButtons[t]=i}n=this.gesture,this.gesture=this.determineGesture(),this.gesture!==n&&(this.animateGesture(this.gesture,n),this.emitGestureEvents(this.gesture,n))},determineGesture:function(){var t,e,n,i=this.pressedButtons.grip,r=this.pressedButtons.surface||this.touchedButtons.surface,s=this.pressedButtons.trackpad||this.touchedButtons.trackpad,o=this.pressedButtons.trigger||this.touchedButtons.trigger,a=this.touchedButtons.AorX||this.touchedButtons.BorY;return e=this.el.components["tracked-controls"],(n=e&&e.controller)&&(n.id&&0===n.id.indexOf("OpenVR ")||n.profiles&&n.profiles[0]&&"htc-vive"===n.profiles[0])?i||o?t=cw:s&&(t=lw):i?t=r||a||s?o?cw:lw:o?hw:"Point + Thumb":o&&(t="Hold"),t},getClip:function(t){var e,n;for(n=0;n<this.clips.length;n++)if((e=this.clips[n]).name===t)return e},animateGesture:function(t,e){t?this.playAnimation(t||"Open",e,!1):this.playAnimation(e,e,!0)},emitGestureEvents:function(t,e){var n,i=this.el;e!==t&&((n=dw(e,!1))&&i.emit(n),(n=dw(t,!0))&&i.emit(n))},playAnimation:function(t,e,n){var i,r,s=this.el.getObject3D("mesh");if(s){if(i=this.getClip(t),r=s.mixer.clipAction(i),n)return r.paused=!1,void(r.timeScale=-1);if(r.clampWhenFinished=!0,r.loop=THREE.LoopOnce,r.repetitions=0,r.timeScale=1,r.time=0,r.weight=1,!e)return s.mixer.stopAllAction(),void r.play();i=this.getClip(e),r.reset(),r.play(),s.mixer.clipAction(i).crossFadeTo(r,.15,!0)}}}),_b("hide-on-enter-ar",{init:function(){var t=this;this.el.sceneEl.addEventListener("enter-vr",(function(){t.el.sceneEl.is("ar-mode")&&(t.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){t.el.object3D.visible=!0}))}}),_b("hide-on-enter-vr",{init:function(){var t=this;this.el.sceneEl.addEventListener("enter-vr",(function(){t.el.sceneEl.is("vr-mode")&&(t.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){t.el.object3D.visible=!0}))}});var pw="hp-mixed-reality",Aw=My+"controllers/hp/mixed-reality/",fw={x:0,y:0,z:.06},mw={_x:Math.PI/4,_y:0,_z:0,_order:"XYZ"},gw=(_b("hp-mixed-reality-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{left:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var t=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){nx(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t,t.data.hand)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t,t.data.hand)},this.previousButtonValues={},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;ZE(this,pw,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:pw,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",Aw+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping[this.data.hand].buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){var e=t.detail.model;this.data.model&&(e.position.copy(fw),e.rotation.copy(mw),this.el.emit("controllermodelready",{name:"hp-mixed-reality-controls",model:this.data.model,rayOrigin:new _y.Vector3(0,0,0)}))},onAxisMoved:function(t){ex(this,this.mapping.axes,t)}}),Ly("components:layer:warn"));function vw(t,e,n){return(e.dot(t)-e.dot(n))/e.length()}_b("layer",{schema:{type:{default:"quad",oneOf:["quad","monocubemap","stereocubemap"]},src:{type:"map"},rotateCubemap:{default:!1},width:{default:0},height:{default:0}},init:function(){var t=this.el.sceneEl.renderer.getContext();this.quaternion=new THREE.Quaternion,this.position=new THREE.Vector3,this.bindMethods(),this.needsRedraw=!1,this.frameBuffer=t.createFramebuffer();var e=this.el.sceneEl.getAttribute("webxr"),n=e.requiredFeatures;-1===n.indexOf("layers")&&(n.push("layers"),this.el.sceneEl.setAttribute("webxr",e)),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR),this.el.sceneEl.addEventListener("exit-vr",this.onExitVR)},bindMethods:function(){this.onRequestedReferenceSpace=this.onRequestedReferenceSpace.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this)},update:function(t){this.data.src!==t.src&&this.updateSrc()},updateSrc:function(){var t=this.data.type;this.texture=void 0,"quad"!==t?"monocubemap"!==t&&"stereocubemap"!==t||this.loadCubeMapImages():this.loadQuadImage()},loadCubeMapImages:function(){var t,e=this.xrGLFactory,n=this.el.sceneEl.frame,i=this.data.src,r=this.data.type;this.visibilityChanged=!1,this.layer&&("monocubemap"!==r&&"stereocubemap"!==r||(i.complete?this.pendingCubeMapUpdate=!1:this.pendingCubeMapUpdate=!0,this.loadingScreen?this.loadingScreen=!1:this.loadingScreen=!0,"monocubemap"===r?(t=e.getSubImage(this.layer,n),this.loadCubeMapImage(t.colorTexture,i,0)):(t=e.getSubImage(this.layer,n,"left"),this.loadCubeMapImage(t.colorTexture,i,0),t=e.getSubImage(this.layer,n,"right"),this.loadCubeMapImage(t.colorTexture,i,6))))},loadQuadImage:function(){var t=this.data.src,e=this;this.el.sceneEl.systems.material.loadTexture(t,{src:t},(function(n){e.el.sceneEl.renderer.initTexture(n),e.texture=n,"VIDEO"===t.tagName&&setTimeout((function(){e.textureIsVideo=!0}),1e3),e.layer&&(e.layer.height=e.data.height/2||e.texture.image.height/1e3,e.layer.width=e.data.width/2||e.texture.image.width/1e3,e.needsRedraw=!0),e.updateQuadPanel()}))},preGenerateCubeMapTextures:function(t,e){"monocubemap"===this.data.type?this.generateCubeMapTextures(t,0,e):(this.generateCubeMapTextures(t,0,e),this.generateCubeMapTextures(t,6,e))},generateCubeMapTextures:function(t,e,n){for(var i,r,s=this.data,o=this.cubeFaceSize,a=Math.min(t.width,t.height),l=[],c=0;c<6;c++){var h=document.createElement("CANVAS");h.width=h.height=o;var u=h.getContext("2d");s.rotateCubemap&&(2!==c&&3!==c||(u.save(),u.translate(o,o),u.rotate(Math.PI))),u.drawImage(t,(c+e)*a,0,a,a,0,0,o,o),u.restore(),n&&n(),l.push(h)}return s.rotateCubemap&&(i=l[0],r=l[1],l[0]=r,l[1]=i,i=l[4],r=l[5],l[4]=r,l[5]=i),n&&n(),l},loadCubeMapImage:function(t,e,n){var i,r=this.el.sceneEl.renderer.getContext();r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.bindTexture(r.TEXTURE_CUBE_MAP,t),i=!e.complete||this.loadingScreen?this.loadingScreenImages:this.generateCubeMapTextures(e,n);var s=0;i.forEach((function(t,e){r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,r.RGBA,r.UNSIGNED_BYTE,t),s=r.getError()})),0!==s&&console.log("renderingError, WebGL Error Code: "+s),r.bindTexture(r.TEXTURE_CUBE_MAP,null)},tick:function(){this.el.sceneEl.xrSession&&this.referenceSpace&&(this.layer||!this.el.sceneEl.is("vr-mode")&&!this.el.sceneEl.is("ar-mode")||this.initLayer(),this.updateTransform(),this.data.src.complete&&(this.pendingCubeMapUpdate||this.loadingScreen||this.visibilityChanged)&&this.loadCubeMapImages(),(this.needsRedraw||this.layer.needsRedraw||this.textureIsVideo)&&("quad"===this.data.type&&this.draw(),this.needsRedraw=!1))},initLayer:function(){var t=this,e=this.data.type;this.el.sceneEl.xrSession.onvisibilitychange=function(e){t.visibilityChanged="hidden"!==e.session.visibilityState},"quad"!==e?"monocubemap"!==e&&"stereocubemap"!==e||this.initCubeMapLayer():this.initQuadLayer()},initQuadLayer:function(){var t=this.el.sceneEl,e=t.renderer.getContext(),n=this.xrGLFactory=new XRWebGLBinding(t.xrSession,e);this.texture&&(this.layer=n.createQuadLayer({space:this.referenceSpace,viewPixelHeight:2048,viewPixelWidth:2048,height:this.data.height/2||this.texture.image.height/1e3,width:this.data.width/2||this.texture.image.width/1e3}),this.initLoadingScreenImages(),t.renderer.xr.addLayer(this.layer))},initCubeMapLayer:function(){var t=this.data.src,e=this.el.sceneEl,n=e.renderer.getContext(),i=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),r=this.cubeFaceSize=Math.min(i,Math.min(t.width,t.height)),s=this.xrGLFactory=new XRWebGLBinding(e.xrSession,n);this.layer=s.createCubeLayer({space:this.referenceSpace,viewPixelWidth:r,viewPixelHeight:r,layout:"monocubemap"===this.data.type?"mono":"stereo",isStatic:!1}),this.initLoadingScreenImages(),this.loadCubeMapImages(),e.renderer.xr.addLayer(this.layer)},initLoadingScreenImages:function(){for(var t=this.cubeFaceSize,e=this.loadingScreenImages=[],n=0;n<6;n++){var i=document.createElement("CANVAS");i.width=i.height=t;var r=i.getContext("2d");i.width=i.height=t,r.fillStyle="black",r.fillRect(0,0,t,t),2!==n&&3!==n&&(r.translate(t,0),r.scale(-1,1),r.fillStyle="white",r.font="30px Arial",r.fillText("Loading",t/2,t/2)),e.push(i)}},destroyLayer:function(){this.layer&&(this.el.sceneEl.renderer.xr.removeLayer(this.layer),this.layer.destroy(),this.layer=void 0)},toggleCompositorLayer:function(){this.enableCompositorLayer(!this.layerEnabled)},enableCompositorLayer:function(t){this.layerEnabled=t,this.quadPanelEl.object3D.visible=!this.layerEnabled},updateQuadPanel:function(){var t=this.quadPanelEl;this.quadPanelEl||(t=this.quadPanelEl=document.createElement("a-entity"),this.el.appendChild(t)),t.setAttribute("material",{shader:"flat",src:this.data.src,transparent:!0}),t.setAttribute("geometry",{primitive:"plane",height:this.data.height||this.texture.image.height/1e3,width:this.data.width||this.texture.image.height/1e3})},draw:function(){var t=this.el.sceneEl,e=this.el.sceneEl.renderer.getContext(),n=this.xrGLFactory.getSubImage(this.layer,t.frame),i=t.renderer.properties.get(this.texture).__webglTexture,r=e.getParameter(e.FRAMEBUFFER_BINDING);e.viewport(n.viewport.x,n.viewport.y,n.viewport.width,n.viewport.height),e.bindFramebuffer(e.FRAMEBUFFER,this.frameBuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.colorTexture,0),function(t,e,n,i){var r=t.createFramebuffer(),s=n.viewport.x,o=n.viewport.y,a=n.viewport.x+n.viewport.width,l=n.viewport.y+n.viewport.height;"VIDEO"===i.tagName&&(t.bindTexture(t.TEXTURE_2D,e),t.texSubImage2D(t.TEXTURE_2D,0,0,0,i.width,i.height,t.RGB,t.UNSIGNED_BYTE,i)),t.bindFramebuffer(t.READ_FRAMEBUFFER,r),t.framebufferTexture2D(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),t.readBuffer(t.COLOR_ATTACHMENT0),t.blitFramebuffer(0,0,i.width,i.height,s,o,a,l,t.COLOR_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.deleteFramebuffer(r)}(e,i,n,this.data.src),e.bindFramebuffer(e.FRAMEBUFFER,r)},updateTransform:function(){var t=this.el,e=this.position,n=this.quaternion;t.object3D.updateMatrixWorld(),e.setFromMatrixPosition(t.object3D.matrixWorld),n.setFromRotationMatrix(t.object3D.matrixWorld),this.layerEnabled||e.set(0,0,1e8),this.layer.transform=new XRRigidTransform(e,n)},onEnterVR:function(){var t=this.el.sceneEl,e=t.xrSession;t.hasWebXR&&XRWebGLBinding&&e?(e.requestReferenceSpace("local-floor").then(this.onRequestedReferenceSpace),this.layerEnabled=!0,this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!1),this.data.src.play&&this.data.src.play()):gw("The layer component requires WebXR and the layers API enabled")},onExitVR:function(){this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!0),this.destroyLayer()},onRequestedReferenceSpace:function(t){this.referenceSpace=t}}),_b("laser-controls",{schema:{hand:{default:"right"},model:{default:!0},defaultModelColor:{type:"color",default:"grey"}},init:function(){var t=this.config,e=this.data,n=this.el,i=this,r={hand:e.hand,model:e.model};function s(e){var r=t[e.detail.name];if(r){var s=dx({showLine:!0},r.raycaster||{});e.detail.rayOrigin&&(s.origin=e.detail.rayOrigin.origin,s.direction=e.detail.rayOrigin.direction,s.showLine=!0),e.detail.rayOrigin||!i.modelReady?n.setAttribute("raycaster",s):n.setAttribute("raycaster","showLine",!0),n.setAttribute("cursor",dx({fuse:!1},r.cursor))}}n.setAttribute("hp-mixed-reality-controls",r),n.setAttribute("magicleap-controls",r),n.setAttribute("oculus-go-controls",r),n.setAttribute("meta-touch-controls",r),n.setAttribute("pico-controls",r),n.setAttribute("valve-index-controls",r),n.setAttribute("vive-controls",r),n.setAttribute("vive-focus-controls",r),n.setAttribute("windows-motion-controls",r),n.setAttribute("generic-tracked-controller-controls",{hand:r.hand}),n.addEventListener("controllerconnected",s),n.addEventListener("controllerdisconnected",(function(e){t[e.detail.name]&&n.setAttribute("raycaster","showLine",!1)})),n.addEventListener("controllermodelready",(function(t){s(t),i.modelReady=!0}))},config:{"generic-tracked-controller-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"hp-mixed-reality-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"magicleap-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"oculus-go-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:5e-4,z:0}}},"meta-touch-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"pico-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"valve-index-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-focus-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"windows-motion-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{showLine:!1}}}});var yw,Ew,xw,bw,Cw,ww,_w,Mw,Sw,Iw,Bw=_y.MathUtils.degToRad,Tw=Ly("components:light:warn"),Rw=new _y.CubeTextureLoader,Lw={};function Dw(t,e){return!(!t||!e)&&t.x===e.x&&t.y===e.y&&t.z===e.z}_b("light",{schema:{angle:{default:60,if:{type:["spot"]}},color:{type:"color",if:{type:["ambient","directional","hemisphere","point","spot"]}},envMap:{default:"",if:{type:["probe"]}},groundColor:{type:"color",if:{type:["hemisphere"]}},decay:{default:1,if:{type:["point","spot"]}},distance:{default:0,min:0,if:{type:["point","spot"]}},intensity:{default:3.14,min:0,if:{type:["ambient","directional","hemisphere","point","spot","probe"]}},penumbra:{default:0,min:0,max:1,if:{type:["spot"]}},type:{default:"directional",oneOf:["ambient","directional","hemisphere","point","spot","probe"],schemaChange:!0},target:{type:"selector",if:{type:["spot","directional"]}},castShadow:{default:!1,if:{type:["point","spot","directional"]}},shadowBias:{default:0,if:{castShadow:!0}},shadowCameraFar:{default:500,if:{castShadow:!0}},shadowCameraFov:{default:90,if:{castShadow:!0}},shadowCameraNear:{default:.5,if:{castShadow:!0}},shadowCameraTop:{default:5,if:{castShadow:!0}},shadowCameraRight:{default:5,if:{castShadow:!0}},shadowCameraBottom:{default:-5,if:{castShadow:!0}},shadowCameraLeft:{default:-5,if:{castShadow:!0}},shadowCameraVisible:{default:!1,if:{castShadow:!0}},shadowCameraAutomatic:{default:"",if:{type:["directional"]}},shadowMapHeight:{default:512,if:{castShadow:!0}},shadowMapWidth:{default:512,if:{castShadow:!0}},shadowRadius:{default:1,if:{castShadow:!0}}},init:function(){var t=this.el;this.light=null,this.defaultTarget=null,this.system.registerLight(t)},update:function(t){var e=this.data,n=vx(e,t),i=this.light,r=this;if(!i||"type"in n)this.setLight(this.data),this.updateShadow();else{var s=!1;Object.keys(n).forEach((function(t){var n=e[t];switch(t){case"color":i.color.set(n);break;case"groundColor":i.groundColor.set(n);break;case"angle":i.angle=Bw(n);break;case"target":null===n?"spot"!==e.type&&"directional"!==e.type||(i.target=r.defaultTarget):n.hasLoaded?r.onSetTarget(n,i):n.addEventListener("loaded",r.onSetTarget.bind(r,n,i));break;case"envMap":r.updateProbeMap(e,i);break;case"castShadow":case"shadowBias":case"shadowCameraFar":case"shadowCameraFov":case"shadowCameraNear":case"shadowCameraTop":case"shadowCameraRight":case"shadowCameraBottom":case"shadowCameraLeft":case"shadowCameraVisible":case"shadowMapHeight":case"shadowMapWidth":case"shadowRadius":s||(r.updateShadow(),s=!0);break;case"shadowCameraAutomatic":e.shadowCameraAutomatic?r.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(e.shadowCameraAutomatic)):r.shadowCameraAutomaticEls=[];break;default:i[t]=n}}))}},tick:(yw=new _y.Box3,Ew=new _y.Vector3,xw=new _y.Vector3,bw=new _y.Matrix4,Cw=new _y.Sphere,ww=new _y.Vector3,function(){if("directional"===this.data.type&&this.light.shadow&&this.light.shadow.camera instanceof _y.OrthographicCamera&&this.shadowCameraAutomaticEls.length){var t=this.light.shadow.camera;t.getWorldDirection(Ew),t.getWorldPosition(xw),bw.copy(t.matrixWorld),bw.invert(),t.near=1,t.left=1e5,t.right=-1e5,t.top=-1e5,t.bottom=1e5,this.shadowCameraAutomaticEls.forEach((function(e){yw.setFromObject(e.object3D),yw.getBoundingSphere(Cw);var n,i,r,s,o,a=vw(xw,Ew,Cw.center),l=(n=xw,i=Ew,r=Cw.center,s=ww,o=vw(n,i,r),s.copy(i),s.multiplyScalar(o),s.add(r),s).applyMatrix4(bw);t.near=Math.min(-a-Cw.radius-1,t.near),t.left=Math.min(-Cw.radius+l.x,t.left),t.right=Math.max(Cw.radius+l.x,t.right),t.top=Math.max(Cw.radius+l.y,t.top),t.bottom=Math.min(-Cw.radius+l.y,t.bottom)})),t.updateProjectionMatrix()}}),setLight:function(t){var e=this.el,n=this.getLight(t);n&&(this.light&&e.removeObject3D("light"),this.light=n,this.light.el=e,e.setObject3D("light",this.light),"spot"!==t.type&&"directional"!==t.type&&"hemisphere"!==t.type||e.getObject3D("light").translateY(-1),"spot"===t.type&&(e.setObject3D("light-target",this.defaultTarget),e.getObject3D("light-target").position.set(0,0,-1)),t.shadowCameraAutomatic?this.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(t.shadowCameraAutomatic)):this.shadowCameraAutomaticEls=[])},updateShadow:function(){var t=this.el,e=this.data,n=this.light;n.castShadow=e.castShadow;var i=t.getObject3D("cameraHelper");if(e.shadowCameraVisible&&!i?(i=new _y.CameraHelper(n.shadow.camera),t.setObject3D("cameraHelper",i)):!e.shadowCameraVisible&&i&&t.removeObject3D("cameraHelper"),!e.castShadow)return n;n.shadow.bias=e.shadowBias,n.shadow.radius=e.shadowRadius,n.shadow.mapSize.height=e.shadowMapHeight,n.shadow.mapSize.width=e.shadowMapWidth,n.shadow.camera.near=e.shadowCameraNear,n.shadow.camera.far=e.shadowCameraFar,n.shadow.camera instanceof _y.OrthographicCamera?(n.shadow.camera.top=e.shadowCameraTop,n.shadow.camera.right=e.shadowCameraRight,n.shadow.camera.bottom=e.shadowCameraBottom,n.shadow.camera.left=e.shadowCameraLeft):n.shadow.camera.fov=e.shadowCameraFov,n.shadow.camera.updateProjectionMatrix(),i&&i.update()},getLight:function(t){var e=t.angle,n=new _y.Color(t.color);n=n.getHex();var i=t.decay,r=t.distance,s=new _y.Color(t.groundColor);s=s.getHex();var o=t.intensity,a=t.type,l=t.target,c=null;switch(a.toLowerCase()){case"ambient":return new _y.AmbientLight(n,o);case"directional":return c=new _y.DirectionalLight(n,o),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"hemisphere":return new _y.HemisphereLight(n,s,o);case"point":return new _y.PointLight(n,o,r,i);case"spot":return c=new _y.SpotLight(n,o,r,Bw(e),t.penumbra,i),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"probe":return c=new _y.LightProbe,this.updateProbeMap(t,c),c;default:Tw("%s is not a valid light type. Choose from ambient, directional, hemisphere, point, spot.",a)}},updateProbeMap:function(t,e){t.envMap?(void 0===Lw[t.envMap]&&(Lw[t.envMap]=new window.Promise((function(e){BE(t.envMap,(function(n){Rw.load(n,(function(n){var i=_y.LightProbeGenerator.fromCubeTexture(n);Lw[t.envMap]=i,e(i)}))}))}))),Lw[t.envMap]instanceof window.Promise?Lw[t.envMap].then((function(t){e.copy(t)})):Lw[t.envMap]instanceof _y.LightProbe&&e.copy(Lw[t.envMap])):e.copy(new _y.LightProbe)},onSetTarget:function(t,e){e.target=t.object3D},remove:function(){var t=this.el;t.removeObject3D("light"),t.getObject3D("cameraHelper")&&t.removeObject3D("cameraHelper")}}),_b("line",{schema:{start:{type:"vec3",default:{x:0,y:0,z:0}},end:{type:"vec3",default:{x:0,y:0,z:0}},color:{type:"color",default:"#74BEC1"},opacity:{type:"number",default:1},visible:{default:!0}},multiple:!0,init:function(){var t,e,n=this.data;e=this.material=new THREE.LineBasicMaterial({color:n.color,opacity:n.opacity,transparent:n.opacity<1,visible:n.visible}),(t=this.geometry=new THREE.BufferGeometry).setAttribute("position",new THREE.BufferAttribute(new Float32Array(6),3)),this.line=new THREE.Line(t,e),this.el.setObject3D(this.attrName,this.line)},update:function(t){var e=this.data,n=this.geometry,i=!1,r=this.material,s=n.attributes.position.array;Dw(e.start,t.start)||(s[0]=e.start.x,s[1]=e.start.y,s[2]=e.start.z,i=!0),Dw(e.end,t.end)||(s[3]=e.end.x,s[4]=e.end.y,s[5]=e.end.z,i=!0),i&&(n.attributes.position.needsUpdate=!0,n.computeBoundingSphere()),r.color.setStyle(e.color),r.opacity=e.opacity,r.transparent=e.opacity<1,r.visible=e.visible},remove:function(){this.el.removeObject3D(this.attrName,this.line)}}),_b("link",{schema:{backgroundColor:{default:"red",type:"color"},borderColor:{default:"white",type:"color"},highlighted:{default:!1},highlightedColor:{default:"#24CAFF",type:"color"},href:{default:""},image:{type:"asset"},on:{default:"click"},peekMode:{default:!1},title:{default:""},titleColor:{default:"white",type:"color"},visualAspectEnabled:{default:!1}},init:function(){this.navigate=this.navigate.bind(this),this.previousQuaternion=void 0,this.quaternionClone=new _y.Quaternion,this.hiddenEls=[]},update:function(t){var e,n,i=this.data,r=this.el;if(i.visualAspectEnabled){var s=this.el.getAttribute("scale");this.previewDistance=15*(s.x+s.y)/2,this.initVisualAspect(),e=i.highlighted?i.highlightedColor:i.backgroundColor,n=i.highlighted?i.highlightedColor:i.borderColor,r.setAttribute("material","backgroundColor",e),r.setAttribute("material","strokeColor",n),i.on!==t.on&&this.updateEventListener(),void 0!==t.peekMode&&i.peekMode!==t.peekMode&&this.updatePeekMode(),i.image&&t.image!==i.image&&r.setAttribute("material","pano","string"==typeof i.image?i.image:i.image.src)}},updatePeekMode:function(){var t=this.el,e=this.sphereEl;this.data.peekMode?(this.hideAll(),t.getObject3D("mesh").visible=!1,e.setAttribute("visible",!0)):(this.showAll(),t.getObject3D("mesh").visible=!0,e.setAttribute("visible",!1))},play:function(){this.updateEventListener()},pause:function(){this.removeEventListener()},updateEventListener:function(){var t=this.el;t.isPlaying&&(this.removeEventListener(),t.addEventListener(this.data.on,this.navigate))},removeEventListener:function(){var t=this.data.on;t&&this.el.removeEventListener(t,this.navigate)},initVisualAspect:function(){var t,e,n,i=this.el;this.data.visualAspectEnabled&&!this.visualAspectInitialized&&(n=this.textEl=this.textEl||document.createElement("a-entity"),e=this.sphereEl=this.sphereEl||document.createElement("a-entity"),t=this.semiSphereEl=this.semiSphereEl||document.createElement("a-entity"),i.setAttribute("geometry",{primitive:"circle",radius:1,segments:64}),i.setAttribute("material",{shader:"portal",pano:this.data.image,side:"double",previewDistance:this.previewDistance}),n.setAttribute("text",{color:this.data.titleColor,align:"center",font:"kelsonsans",value:this.data.title||this.data.href,width:4}),n.setAttribute("position","0 1.5 0"),i.appendChild(n),t.setAttribute("geometry",{primitive:"sphere",radius:1,phiStart:0,segmentsWidth:64,segmentsHeight:64,phiLength:180,thetaStart:0,thetaLength:360}),t.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back",previewDistance:this.previewDistance}),t.setAttribute("rotation","0 180 0"),t.setAttribute("position","0 0 0"),t.setAttribute("visible",!1),i.appendChild(t),e.setAttribute("geometry",{primitive:"sphere",radius:10,segmentsWidth:64,segmentsHeight:64}),e.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back",previewDistance:this.previewDistance}),e.setAttribute("visible",!1),i.appendChild(e),this.visualAspectInitialized=!0)},navigate:function(){window.location=this.data.href},tick:function(){var t=new _y.Vector3,e=new _y.Vector3,n=new _y.Quaternion,i=new _y.Vector3;return function(){var r,s,o=this.el,a=o.object3D,l=o.sceneEl.camera,c=this.textEl;if(this.data.visualAspectEnabled)if(a.updateMatrixWorld(),l.parent.updateMatrixWorld(),l.updateMatrixWorld(),a.matrix.decompose(e,n,i),e.setFromMatrixPosition(a.matrixWorld),t.setFromMatrixPosition(l.matrixWorld),(s=e.distanceTo(t))>1.33333*this.previewDistance)this.previousQuaternion||(this.quaternionClone.copy(n),this.previousQuaternion=this.quaternionClone),a.lookAt(t);else{if(r=this.calculateCameraPortalOrientation(),s<.5){if(!0===this.semiSphereEl.getAttribute("visible"))return;c.setAttribute("text","width",1.5),r<=0?(c.setAttribute("position","0 0 0.75"),c.setAttribute("rotation","0 180 0"),this.semiSphereEl.setAttribute("rotation","0 0 0")):(c.setAttribute("position","0 0 -0.75"),c.setAttribute("rotation","0 0 0"),this.semiSphereEl.setAttribute("rotation","0 180 0")),o.getObject3D("mesh").visible=!1,this.semiSphereEl.setAttribute("visible",!0),this.peekCameraPortalOrientation=r}else r<=0?c.setAttribute("rotation","0 180 0"):c.setAttribute("rotation","0 0 0"),c.setAttribute("text","width",5),c.setAttribute("position","0 1.5 0"),o.getObject3D("mesh").visible=!0,this.semiSphereEl.setAttribute("visible",!1),this.peekCameraPortalOrientation=void 0;this.previousQuaternion&&(a.quaternion.copy(this.previousQuaternion),this.previousQuaternion=void 0)}}}(),hideAll:function(){var t=this.el,e=this.hiddenEls,n=this;e.length>0||t.sceneEl.object3D.traverse((function(i){i&&i.el&&i.el.hasAttribute("link-controls")||i.el&&i!==t.sceneEl.object3D&&i.el!==t&&i.el!==n.sphereEl&&i.el!==t.sceneEl.cameraEl&&!1!==i.el.getAttribute("visible")&&i.el!==n.textEl&&i.el!==n.semiSphereEl&&(i.el.setAttribute("visible",!1),e.push(i.el))}))},showAll:function(){this.hiddenEls.forEach((function(t){t.setAttribute("visible",!0)})),this.hiddenEls=[]},calculateCameraPortalOrientation:(_w=new _y.Matrix4,Mw=new _y.Vector3,Sw=new _y.Vector3(0,0,1),Iw=new _y.Vector3(0,0,0),function(){var t=this.el,e=t.sceneEl.camera;return Mw.set(0,0,0),Sw.set(0,0,1),Iw.set(0,0,0),t.object3D.matrixWorld.extractRotation(_w),Sw.applyMatrix4(_w),t.object3D.updateMatrixWorld(),t.object3D.localToWorld(Iw),e.parent.parent.updateMatrixWorld(),e.parent.updateMatrixWorld(),e.updateMatrixWorld(),e.localToWorld(Mw),Mw.sub(Iw).normalize(),Sw.normalize(),Math.sign(Sw.dot(Mw))}),remove:function(){this.removeEventListener()}}),vC("portal",{schema:{borderEnabled:{default:1,type:"int",is:"uniform"},backgroundColor:{default:"red",type:"color",is:"uniform"},pano:{type:"map",is:"uniform"},strokeColor:{default:"white",type:"color",is:"uniform"},previewDistance:{default:15,type:"float",is:"uniform"}},vertexShader:["vec3 portalPosition;","varying vec3 vWorldPosition;","varying float vDistanceToCenter;","varying float vDistance;","void main() {","vDistanceToCenter = clamp(length(position - vec3(0.0, 0.0, 0.0)), 0.0, 1.0);","portalPosition = (modelMatrix * vec4(0.0, 0.0, 0.0, 1.0)).xyz;","vDistance = length(portalPosition - cameraPosition);","vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI2 0.15915494","uniform sampler2D pano;","uniform vec3 strokeColor;","uniform vec3 backgroundColor;","uniform float borderEnabled;","uniform float previewDistance;","varying float vDistanceToCenter;","varying float vDistance;","varying vec3 vWorldPosition;","void main() {","vec3 direction = normalize(vWorldPosition - cameraPosition);","vec2 sampleUV;","float borderThickness = clamp(exp(-vDistance / 50.0), 0.6, 0.95);","sampleUV.y = clamp(direction.y * 0.5 + 0.5, 0.0, 1.0);","sampleUV.x = atan(direction.z, -direction.x) * -RECIPROCAL_PI2 + 0.5;","if (vDistanceToCenter > borderThickness && borderEnabled == 1.0) {","gl_FragColor = vec4(strokeColor, 1.0);","} else {","gl_FragColor = mix(texture2D(pano, sampleUV), vec4(backgroundColor, 1.0), clamp(pow((vDistance / previewDistance), 2.0), 0.0, 1.0));","}","}"].join("\n")});var Pw="logitech-mx-ink",Uw=My+"controllers/logitech/",Ow=(_b("logitech-mx-ink-controls",{schema:{hand:{default:"left"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{left:{buttons:["front","back","none","none","none","tip"]},right:{buttons:["front","back","none","none","none","tip"]}},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){nx(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t,t.data.hand)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t,t.data.hand)},this.bindMethods()},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),t.sceneEl.removeEventListener("enter-vr",this.onEnterVR),t.sceneEl.removeEventListener("exit-vr",this.onExitVR),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.controllerObject3D;t&&(t.visible=!1),ZE(this,Pw,{hand:this.data.hand,iterateControllerProfiles:!0})},injectTrackedControls:function(){var t=this.el,e=this.data,n=Pw;t.setAttribute("tracked-controls",{id:n,hand:e.hand,handTrackingEnabled:!1,iterateControllerProfiles:!0,orientationOffset:e.orientationOffset}),this.loadModel()},loadModel:function(){var t=this.controllerObject3D;if(this.data.model)return t?(t.visible=this.el.sceneEl.is("vr-mode"),void this.el.setObject3D("mesh",t)):void this.el.setAttribute("gltf-model",Uw+"logitech-mx-ink.glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping[this.data.hand].buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){t.target===this.el&&this.data.model&&(this.el.emit("controllermodelready",{name:"logitech-mx-ink-controls",model:this.data.model,rayOrigin:new _y.Vector3(0,0,0)}),this.controllerObject3D=this.el.getObject3D("mesh"),this.controllerObject3D.visible=this.el.sceneEl.is("vr-mode"))},onAxisMoved:function(t){ex(this,this.mapping.axes,t)}}),Math.PI/2),Fw=(_b("look-controls",{dependencies:["position","rotation"],schema:{enabled:{default:!0},magicWindowTrackingEnabled:{default:!0},pointerLockEnabled:{default:!1},reverseMouseDrag:{default:!1},reverseTouchDrag:{default:!1},touchEnabled:{default:!0},mouseEnabled:{default:!0}},init:function(){this.deltaYaw=0,this.previousHMDPosition=new _y.Vector3,this.hmdQuaternion=new _y.Quaternion,this.magicWindowAbsoluteEuler=new _y.Euler,this.magicWindowDeltaEuler=new _y.Euler,this.position=new _y.Vector3,this.magicWindowObject=new _y.Object3D,this.rotation={},this.deltaRotation={},this.savedPose=null,this.pointerLocked=!1,this.setupMouseControls(),this.bindMethods(),this.previousMouseEvent={},this.setupMagicWindowControls(),this.savedPose={position:new _y.Vector3,rotation:new _y.Euler},(this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode"))&&this.onEnterVR()},setupMagicWindowControls:function(){var t,e=this.data;(Wy()||Ky())&&(t=this.magicWindowControls=new _y.DeviceOrientationControls(this.magicWindowObject),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission&&(t.enabled=!1,this.el.sceneEl.components["device-orientation-permission-ui"].permissionGranted?t.enabled=e.magicWindowTrackingEnabled:this.el.sceneEl.addEventListener("deviceorientationpermissiongranted",(function(){t.enabled=e.magicWindowTrackingEnabled}))))},update:function(t){var e=this.data;e.enabled!==t.enabled&&this.updateGrabCursor(e.enabled),t&&!e.magicWindowTrackingEnabled&&t.magicWindowTrackingEnabled&&(this.magicWindowAbsoluteEuler.set(0,0,0),this.magicWindowDeltaEuler.set(0,0,0)),this.magicWindowControls&&(this.magicWindowControls.enabled=e.magicWindowTrackingEnabled),t&&!e.pointerLockEnabled!==t.pointerLockEnabled&&(this.removeEventListeners(),this.addEventListeners(),this.pointerLocked&&this.exitPointerLock())},tick:function(t){this.data.enabled&&this.updateOrientation()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},remove:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},bindMethods:function(){this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this),this.onPointerLockChange=this.onPointerLockChange.bind(this),this.onPointerLockError=this.onPointerLockError.bind(this)},setupMouseControls:function(){this.mouseDown=!1,this.pitchObject=new _y.Object3D,this.yawObject=new _y.Object3D,this.yawObject.position.y=10,this.yawObject.add(this.pitchObject)},addEventListeners:function(){var t=this.el.sceneEl,e=t.canvas;e?(e.addEventListener("mousedown",this.onMouseDown,!1),window.addEventListener("mousemove",this.onMouseMove,!1),window.addEventListener("mouseup",this.onMouseUp,!1),e.addEventListener("touchstart",this.onTouchStart,{passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{passive:!0}),t.addEventListener("enter-vr",this.onEnterVR),t.addEventListener("exit-vr",this.onExitVR),this.data.pointerLockEnabled&&(document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.addEventListener("pointerlockerror",this.onPointerLockError,!1))):t.addEventListener("render-target-loaded",this.addEventListeners.bind(this))},removeEventListeners:function(){var t=this.el.sceneEl,e=t&&t.canvas;e&&(e.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),t.removeEventListener("enter-vr",this.onEnterVR),t.removeEventListener("exit-vr",this.onExitVR),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("pointerlockerror",this.onPointerLockError,!1))},updateOrientation:function(){var t=this.el.object3D,e=this.pitchObject,n=this.yawObject,i=this.el.sceneEl;(i.is("vr-mode")||i.is("ar-mode"))&&i.checkHeadsetConnected()||(this.updateMagicWindowOrientation(),t.rotation.x=this.magicWindowDeltaEuler.x+e.rotation.x,t.rotation.y=this.magicWindowDeltaEuler.y+n.rotation.y,t.rotation.z=this.magicWindowDeltaEuler.z)},updateMagicWindowOrientation:function(){var t=this.magicWindowAbsoluteEuler,e=this.magicWindowDeltaEuler;this.magicWindowControls&&this.magicWindowControls.enabled&&(this.magicWindowControls.update(),t.setFromQuaternion(this.magicWindowObject.quaternion,"YXZ"),this.previousMagicWindowYaw||0===t.y||(this.previousMagicWindowYaw=t.y),this.previousMagicWindowYaw&&(e.x=t.x,e.y+=t.y-this.previousMagicWindowYaw,e.z=t.z,this.previousMagicWindowYaw=t.y))},onMouseMove:function(t){var e,n,i,r=this.pitchObject,s=this.previousMouseEvent,o=this.yawObject;this.data.enabled&&(this.mouseDown||this.pointerLocked)&&(this.pointerLocked?(n=t.movementX||t.mozMovementX||0,i=t.movementY||t.mozMovementY||0):(n=t.screenX-s.screenX,i=t.screenY-s.screenY),this.previousMouseEvent.screenX=t.screenX,this.previousMouseEvent.screenY=t.screenY,e=this.data.reverseMouseDrag?1:-1,o.rotation.y+=.002*n*e,r.rotation.x+=.002*i*e,r.rotation.x=Math.max(-Ow,Math.min(Ow,r.rotation.x)))},onMouseDown:function(t){var e=this.el.sceneEl;if(this.data.enabled&&this.data.mouseEnabled&&(!e.is("vr-mode")&&!e.is("ar-mode")||!e.checkHeadsetConnected())&&0===t.button){var n=e&&e.canvas;this.mouseDown=!0,this.previousMouseEvent.screenX=t.screenX,this.previousMouseEvent.screenY=t.screenY,this.showGrabbingCursor(),this.data.pointerLockEnabled&&!this.pointerLocked&&(n.requestPointerLock?n.requestPointerLock():n.mozRequestPointerLock&&n.mozRequestPointerLock())}},showGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor="grabbing"},hideGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor=""},onMouseUp:function(){this.mouseDown=!1,this.hideGrabbingCursor()},onTouchStart:function(t){1!==t.touches.length||!this.data.touchEnabled||this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode")||(this.touchStart={x:t.touches[0].pageX,y:t.touches[0].pageY},this.touchStarted=!0)},onTouchMove:function(t){var e,n,i=this.el.sceneEl.canvas,r=this.yawObject;this.touchStarted&&this.data.touchEnabled&&(n=2*Math.PI*(t.touches[0].pageX-this.touchStart.x)/i.clientWidth,e=this.data.reverseTouchDrag?1:-1,r.rotation.y-=.5*n*e,this.touchStart={x:t.touches[0].pageX,y:t.touches[0].pageY})},onTouchEnd:function(){this.touchStarted=!1},onEnterVR:function(){var t=this.el.sceneEl;t.checkHeadsetConnected()&&(this.saveCameraPose(),this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),t.hasWebXR&&(this.el.object3D.matrixAutoUpdate=!1,this.el.object3D.updateMatrix()))},onExitVR:function(){this.el.sceneEl.checkHeadsetConnected()&&(this.restoreCameraPose(),this.previousHMDPosition.set(0,0,0),this.el.object3D.matrixAutoUpdate=!0)},onPointerLockChange:function(){this.pointerLocked=!(!document.pointerLockElement&&!document.mozPointerLockElement)},onPointerLockError:function(){this.pointerLocked=!1},exitPointerLock:function(){document.exitPointerLock(),this.pointerLocked=!1},updateGrabCursor:function(t){var e=this.el.sceneEl;function n(){e.canvas.classList.add("a-grab-cursor")}function i(){e.canvas.classList.remove("a-grab-cursor")}e.canvas?t?n():i():t?e.addEventListener("render-target-loaded",n):e.addEventListener("render-target-loaded",i)},saveCameraPose:function(){var t=this.el;this.savedPose.position.copy(t.object3D.position),this.savedPose.rotation.copy(t.object3D.rotation),this.hasSavedPose=!0},restoreCameraPose:function(){var t=this.el,e=this.savedPose;this.hasSavedPose&&(t.object3D.position.copy(e.position),t.object3D.rotation.copy(e.rotation),this.hasSavedPose=!1)}}),"magicleap-one"),kw=My+"controllers/magicleap/magicleap-one-controller.glb",Nw=(_b("magicleap-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","menu"]},init:function(){var t=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.previousButtonValues={},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;ZE(this,Fw,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:Fw,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",kw)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping.buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){t.detail.model.scale.set(.01,.01,.01)},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},updateModel:function(t,e){},setButtonColor:function(t,e){}}),Ly("components:material:error"));function Qw(t,e){t.dispose(),e.unregisterMaterial(t),Object.keys(t).filter((function(e){return t[e]&&t[e].isTexture})).forEach((function(e){t[e].dispose()}))}_b("material",{schema:{alphaTest:{default:0,min:0,max:1},depthTest:{default:!0},depthWrite:{default:!0},flatShading:{default:!1},npot:{default:!1},offset:{type:"vec2",default:{x:0,y:0}},opacity:{default:1,min:0,max:1},repeat:{type:"vec2",default:{x:1,y:1}},shader:{default:"standard",oneOf:fC,schemaChange:!0},side:{default:"front",oneOf:["front","back","double"]},transparent:{default:!1},vertexColorsEnabled:{default:!1},visible:{default:!0},blending:{default:"normal",oneOf:["none","normal","additive","subtractive","multiply"]},dithering:{default:!0},anisotropy:{default:0,min:0}},init:function(){this.material=null},update:function(t){var e=this.data;this.shader&&e.shader===t.shader||this.updateShader(e.shader),this.shader.update(this.data),this.updateMaterial(t)},updateSchema:function(t){var e,n,i,r;n=t&&t.shader,e=this.oldData&&this.oldData.shader,(i=AC[r=n||e]&&AC[r].schema)||Nw("Unknown shader schema "+r),e&&n===e||(this.extendSchema(i),this.updateBehavior())},updateBehavior:function(){var t,e,n=this.el.sceneEl,i=this.schema,r=this;function s(t,n){var i;for(i in e)e[i]=t;r.shader.update(e)}for(t in this.tick=void 0,e={},i)"time"===i[t].type&&(this.tick=s,e[t]=!0);n&&(this.tick?n.addBehavior(this):n.removeBehavior(this))},updateShader:function(t){var e,n=this.data,i=AC[t]&&AC[t].Shader;if(!i)throw new Error("Unknown shader "+t);(e=this.shader=new i).el=this.el,e.init(n),this.setMaterial(e.material),this.updateSchema(n)},updateMaterial:function(t){var e,n=this.data,i=this.material;for(e in i.alphaTest=n.alphaTest,i.depthTest=!1!==n.depthTest,i.depthWrite=!1!==n.depthWrite,i.opacity=n.opacity,i.flatShading=n.flatShading,i.side=function(t){switch(t){case"back":return _y.BackSide;case"double":return _y.DoubleSide;default:return _y.FrontSide}}(n.side),i.transparent=!1!==n.transparent||n.opacity<1,i.vertexColors=n.vertexColorsEnabled,i.visible=n.visible,i.blending=function(t){switch(t){case"none":return _y.NoBlending;case"additive":return _y.AdditiveBlending;case"subtractive":return _y.SubtractiveBlending;case"multiply":return _y.MultiplyBlending;default:return _y.NormalBlending}}(n.blending),i.dithering=n.dithering,t)break;!e||t.alphaTest===n.alphaTest&&t.side===n.side&&t.vertexColorsEnabled===n.vertexColorsEnabled||(i.needsUpdate=!0)},remove:function(){var t=new _y.MeshBasicMaterial,e=this.material,n=this.el.getObject3D("mesh");n&&(n.material=t),Qw(e,this.system)},setMaterial:function(t){var e,n=this.el,i=this.system;this.material&&Qw(this.material,i),this.material=t,i.registerMaterial(t),(e=n.getObject3D("mesh"))?e.material=t:n.addEventListener("object3dset",(function e(i){"mesh"===i.detail.type&&i.target===n&&(n.getObject3D("mesh").material=t,n.removeEventListener("object3dset",e))}))}});var Gw,zw,Hw,Vw,jw,Ww="oculus-touch",qw=My+"controllers/oculus/oculus-touch-controller-",Xw=My+"controllers/meta/",Yw={left:{modelUrl:qw+"left.gltf",rayOrigin:{origin:{x:.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new _y.Vector3(-.005,.036,-.037),modelPivotRotation:new _y.Euler(Math.PI/4.5,0,0)},right:{modelUrl:qw+"right.gltf",rayOrigin:{origin:{x:-.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new _y.Vector3(.005,.036,-.037),modelPivotRotation:new _y.Euler(Math.PI/4.5,0,0)}},Jw="oculus-touch",Kw={"oculus-touch":Yw,"oculus-touch-v2":{left:{modelUrl:qw+"gen2-left.gltf",rayOrigin:{origin:{x:-.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new _y.Vector3(0,-.007,-.021),modelPivotRotation:new _y.Euler(-Math.PI/4,0,0)},right:{modelUrl:qw+"gen2-right.gltf",rayOrigin:{origin:{x:.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new _y.Vector3(0,-.007,-.021),modelPivotRotation:new _y.Euler(-Math.PI/4,0,0)}},"oculus-touch-v3":{left:{modelUrl:qw+"v3-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)},right:{modelUrl:qw+"v3-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)}},"meta-quest-touch-pro":{left:{modelUrl:Xw+"quest-touch-pro-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)},right:{modelUrl:Xw+"quest-touch-pro-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)}},"meta-quest-touch-plus":{left:{modelUrl:Xw+"quest-touch-plus-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)},right:{modelUrl:Xw+"quest-touch-plus-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)}}},Zw={schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#999"},buttonTouchColor:{type:"color",default:"#8AB"},buttonHighlightColor:{type:"color",default:"#2DF"},model:{default:!0},controllerType:{default:"auto",oneOf:["auto","oculus-touch","oculus-touch-v2","oculus-touch-v3"]}},after:["tracked-controls"],mapping:{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton","surface"]}},bindMethods:function(){this.onButtonChanged=this.onButtonChanged.bind(this),this.onThumbstickMoved=this.onThumbstickMoved.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonDown=function(e){nx(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){nx(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t,t.data.hand)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t,t.data.hand)},this.controllerPresent=!1,this.previousButtonValues={},this.bindMethods(),this.triggerEuler=new _y.Euler},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.controllerObject3D;t&&(t.visible=!1),ZE(this,Ww,{hand:this.data.hand,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},loadModel:function(t){var e,n=this.data;if(n.model){if(this.controllerObject3D)return this.controllerObject3D.visible=!0,void this.el.setObject3D("mesh",this.controllerObject3D);if(this.displayModel=Kw[n.controllerType]||Kw[Jw],"auto"===n.controllerType){e=Jw;for(var i=Object.keys(Kw),r=0;r<t.profiles.length;r++)if(-1!==i.indexOf(t.profiles[r])){e=t.profiles[r];break}this.displayModel=Kw[e]}var s=this.displayModel[n.hand].modelUrl;this.isTouchV3orPROorPlus=this.displayModel===Kw["oculus-touch-v3"]||this.displayModel===Kw["meta-quest-touch-pro"]||this.displayModel===Kw["meta-quest-touch-plus"],this.el.setAttribute("gltf-model",s)}},injectTrackedControls:function(t){var e=this.data,n=Ww;this.el.setAttribute("tracked-controls",{id:n,hand:e.hand,handTrackingEnabled:!1,iterateControllerProfiles:!0}),this.loadModel(t)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e=this.mapping[this.data.hand].buttons[t.detail.id];if(e){if(this.isTouchV3orPROorPlus)this.onButtonChangedV3orPROorPlus(t);else{var n,i=this.buttonMeshes;"trigger"!==e&&"grip"!==e||(n=t.detail.state.value),i&&("trigger"===e&&i.trigger&&(i.trigger.rotation.x=this.originalXRotationTrigger-n*(Math.PI/26)),"grip"===e&&i.grip&&(n*="left"===this.data.hand?-1:1,i.grip.position.x=this.originalXPositionGrip+.004*n))}this.el.emit(e+"changed",t.detail.state)}},onButtonChangedV3orPROorPlus:function(t){var e,n=this.mapping[this.data.hand].buttons[t.detail.id],i=this.buttonObjects;i&&i[n]&&(e=t.detail.state.value,i[n].quaternion.slerpQuaternions(this.buttonRanges[n].min.quaternion,this.buttonRanges[n].max.quaternion,e),i[n].position.lerpVectors(this.buttonRanges[n].min.position,this.buttonRanges[n].max.position,e))},onModelLoaded:function(t){if(t.target===this.el&&this.data.model){if(this.isTouchV3orPROorPlus)this.onTouchV3orPROorPlusModelLoaded(t);else{var e,n=this.controllerObject3D=t.detail.model;(e=this.buttonMeshes={}).grip=n.getObjectByName("buttonHand"),this.originalXPositionGrip=e.grip&&e.grip.position.x,e.trigger=n.getObjectByName("buttonTrigger"),this.originalXRotationTrigger=e.trigger&&e.trigger.rotation.x,e.thumbstick=n.getObjectByName("stick"),e.xbutton=n.getObjectByName("buttonX"),e.abutton=n.getObjectByName("buttonA"),e.ybutton=n.getObjectByName("buttonY"),e.bbutton=n.getObjectByName("buttonB")}for(var i in this.buttonMeshes)this.buttonMeshes[i]&&$w(this.buttonMeshes[i]);this.applyOffset(t.detail.model),this.el.emit("controllermodelready",{name:"meta-touch-controls",model:this.data.model,rayOrigin:this.displayModel[this.data.hand].rayOrigin})}},applyOffset:function(t){t.position.copy(this.displayModel[this.data.hand].modelPivotOffset),t.rotation.copy(this.displayModel[this.data.hand].modelPivotRotation)},onTouchV3orPROorPlusModelLoaded:function(t){var e=this.controllerObject3D=t.detail.model,n=this.buttonObjects={},i=this.buttonMeshes={},r=this.buttonRanges={};i.grip=e.getObjectByName("squeeze"),n.grip=e.getObjectByName("xr_standard_squeeze_pressed_value"),r.grip={min:e.getObjectByName("xr_standard_squeeze_pressed_min"),max:e.getObjectByName("xr_standard_squeeze_pressed_max")},n.grip.minX=n.grip.position.x,i.thumbstick=e.getObjectByName("thumbstick"),n.thumbstick=e.getObjectByName("xr_standard_thumbstick_pressed_value"),r.thumbstick={min:e.getObjectByName("xr_standard_thumbstick_pressed_min"),max:e.getObjectByName("xr_standard_thumbstick_pressed_max")},n.thumbstickXAxis=e.getObjectByName("xr_standard_thumbstick_xaxis_pressed_value"),r.thumbstickXAxis={min:e.getObjectByName("xr_standard_thumbstick_xaxis_pressed_min"),max:e.getObjectByName("xr_standard_thumbstick_xaxis_pressed_max")},n.thumbstickYAxis=e.getObjectByName("xr_standard_thumbstick_yaxis_pressed_value"),r.thumbstickYAxis={min:e.getObjectByName("xr_standard_thumbstick_yaxis_pressed_min"),max:e.getObjectByName("xr_standard_thumbstick_yaxis_pressed_max")},i.trigger=e.getObjectByName("trigger"),n.trigger=e.getObjectByName("xr_standard_trigger_pressed_value"),r.trigger={min:e.getObjectByName("xr_standard_trigger_pressed_min"),max:e.getObjectByName("xr_standard_trigger_pressed_max")},r.trigger.diff={x:Math.abs(r.trigger.max.rotation.x)-Math.abs(r.trigger.min.rotation.x),y:Math.abs(r.trigger.max.rotation.y)-Math.abs(r.trigger.min.rotation.y),z:Math.abs(r.trigger.max.rotation.z)-Math.abs(r.trigger.min.rotation.z)};var s="left"===this.data.hand?"x":"a",o="left"===this.data.hand?"y":"b",a=s+"button",l=o+"button";i[a]=e.getObjectByName(s+"_button"),n[a]=e.getObjectByName(s+"_button_pressed_value"),r[a]={min:e.getObjectByName(s+"_button_pressed_min"),max:e.getObjectByName(s+"_button_pressed_max")},i[l]=e.getObjectByName(o+"_button"),n[l]=e.getObjectByName(o+"_button_pressed_value"),r[l]={min:e.getObjectByName(o+"_button_pressed_min"),max:e.getObjectByName(o+"_button_pressed_max")}},onAxisMoved:function(t){ex(this,this.mapping[this.data.hand].axes,t)},onThumbstickMoved:function(t){if(this.buttonMeshes&&this.buttonMeshes.thumbstick)if(this.isTouchV3orPROorPlus)this.updateThumbstickTouchV3orPROorPlus(t);else for(var e in t.detail)this.buttonObjects.thumbstick.rotation[this.axisMap[e]]=this.buttonRanges.thumbstick.originalRotation[this.axisMap[e]]-Math.PI/8*t.detail[e]*("y"===e||"right"===this.data.hand?-1:1)},axisMap:{y:"x",x:"z"},updateThumbstickTouchV3orPROorPlus:function(t){var e=(t.detail.x+1)/2;this.buttonObjects.thumbstickXAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickXAxis.min.quaternion,this.buttonRanges.thumbstickXAxis.max.quaternion,e);var n=(t.detail.y+1)/2;this.buttonObjects.thumbstickYAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickYAxis.min.quaternion,this.buttonRanges.thumbstickYAxis.max.quaternion,n)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var n,i=this.buttonMeshes;i&&i[t]&&(n="up"===e||"touchend"===e?i[t].originalColor||this.data.buttonColor:"touchstart"===e?this.data.buttonTouchColor:this.data.buttonHighlightColor,i[t].material.color.set(n))}};function $w(t){t.traverse((function(e){var n;"Mesh"===e.type&&(n=e.material.clone(),t.originalColor=e.material.color,e.material.dispose(),e.material=n)}))}_b("oculus-touch-controls",Zw),_b("meta-touch-controls",Zw),_b("obb-collider",{schema:{size:{default:0},trackedObject3D:{default:""},minimumColliderDimension:{default:.02},centerModel:{default:!1}},init:function(){this.previousScale=(new _y.Vector3).copy(this.el.object3D.scale),this.auxEuler=new _y.Euler,this.boundingBox=new _y.Box3,this.boundingBoxSize=new _y.Vector3,this.updateCollider=this.updateCollider.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.updateBoundingBox=this.updateBoundingBox.bind(this),this.el.addEventListener("model-loaded",this.onModelLoaded),this.updateCollider(),this.system.addCollider(this.el)},remove:function(){this.system.removeCollider(this.el)},update:function(){this.data.trackedObject3D&&(this.trackedObject3DPath=this.data.trackedObject3D.split("."))},onModelLoaded:function(){this.data.centerModel&&this.centerModel(),this.updateCollider()},centerModel:function(){var t,e=this.el,n=e.components["gltf-model"]&&e.components["gltf-model"].model;n&&(this.el.removeObject3D("mesh"),t=(new _y.Box3).setFromObject(n).getCenter(new _y.Vector3),n.position.x+=n.position.x-t.x,n.position.y+=n.position.y-t.y,n.position.z+=n.position.z-t.z,this.el.setObject3D("mesh",n))},updateCollider:function(){var t=this.el,e=this.boundingBoxSize,n=this.aabb=this.aabb||new _y.OBB;this.obb=this.obb||new _y.OBB,t.hasLoaded?(this.updateBoundingBox(),n.halfSize.copy(e).multiplyScalar(.5),this.el.sceneEl.systems["obb-collider"].data.showColliders&&this.showCollider()):t.addEventListener("loaded",this.updateCollider)},showCollider:function(){this.updateColliderMesh(),this.renderColliderMesh.visible=!0},updateColliderMesh:function(){var t=this.renderColliderMesh,e=this.boundingBoxSize;t?(t.geometry.dispose(),t.geometry=new _y.BoxGeometry(e.x,e.y,e.z)):this.initColliderMesh()},hideCollider:function(){this.renderColliderMesh&&(this.renderColliderMesh.visible=!1)},initColliderMesh:function(){var t,e,n;t=this.boundingBoxSize,e=this.renderColliderGeometry=new _y.BoxGeometry(t.x,t.y,t.z),(n=this.renderColliderMesh=new _y.Mesh(e,new _y.MeshLambertMaterial({color:65280,side:_y.DoubleSide}))).matrixAutoUpdate=!1,n.matrixWorldAutoUpdate=!1,n.updateMatrixWorld=function(){},this.el.sceneEl.object3D.add(n)},updateBoundingBox:(Gw=new _y.Vector3,zw=new _y.Vector3,Hw=new _y.Quaternion,Vw=new _y.Quaternion,jw=new _y.Matrix4,function(){var t=this.auxEuler,e=this.boundingBox,n=this.data.size,i=this.trackedObject3D||this.el.object3D,r=this.boundingBoxSize,s=this.data.minimumColliderDimension;if(n)return this.boundingBoxSize.x=n,this.boundingBoxSize.y=n,void(this.boundingBoxSize.z=n);t.copy(i.rotation),i.rotation.set(0,0,0),i.parent.matrixWorld.decompose(Gw,Hw,zw),jw.compose(Gw,Vw,zw),i.parent.matrixWorld.copy(jw),e.setFromObject(i,!0),e.getSize(r),r.x=r.x<s?s:r.x,r.y=r.y<s?s:r.y,r.z=r.z<s?s:r.z,i.parent.matrixWorld.compose(Gw,Hw,zw),this.el.object3D.rotation.copy(t)}),checkTrackedObject:function(){var t,e=this.trackedObject3DPath;if(e&&e.length&&!this.trackedObject3D){t=this.el;for(var n=0;n<e.length&&(t=t[e[n]]);n++);t&&(this.trackedObject3D=t,this.updateCollider())}return this.trackedObject3D},tick:function(){var t=new _y.Vector3,e=new _y.Vector3,n=new _y.Quaternion,i=new _y.Matrix4;return function(){var r=this.obb,s=this.renderColliderMesh,o=this.checkTrackedObject()||this.el.object3D;o&&(o.updateMatrix(),o.updateMatrixWorld(!0),o.matrixWorld.decompose(t,n,e),(Math.abs(e.x-this.previousScale.x)>1e-4||Math.abs(e.y-this.previousScale.y)>1e-4||Math.abs(e.z-this.previousScale.z)>1e-4)&&this.updateCollider(),this.previousScale.copy(e),e.set(1,1,1),i.compose(t,n,e),s&&s.matrixWorld.copy(i),r.copy(this.aabb),r.applyMatrix4(i))}}()});var t_=Ly("components:obj-model:warn"),e_=(_b("obj-model",{schema:{mtl:{type:"model"},obj:{type:"model"}},init:function(){var t=this;this.model=null,this.objLoader=new _y.OBJLoader,this.mtlLoader=new _y.MTLLoader(this.objLoader.manager),this.mtlLoader.crossOrigin="",this.el.addEventListener("componentinitialized",(function(e){t.model&&"material"===e.detail.name&&t.applyMaterial()}))},update:function(){var t=this.data;t.obj&&(this.resetMesh(),this.loadObj(t.obj,t.mtl))},remove:function(){this.resetMesh()},resetMesh:function(){this.model&&this.el.removeObject3D("mesh")},loadObj:function(t,e){var n=this,i=this.el,r=this.mtlLoader,s=this.objLoader,o=this.el.sceneEl.systems.renderer,a=e.substr(0,e.lastIndexOf("/")+1);if(e)return i.hasAttribute("material")&&t_("Material component properties are ignored when a .MTL is provided"),r.setResourcePath(a),void r.load(e,(function(e){e.preload(),s.setMaterials(e),s.load(t,(function(t){n.model=t,n.model.traverse((function(t){if(t.isMesh){var e=t.material;e.map&&o.applyColorCorrection(e.map),e.emissiveMap&&o.applyColorCorrection(e.emissiveMap)}})),i.setObject3D("mesh",t),i.emit("model-loaded",{format:"obj",model:t})}))}));s.load(t,(function(t){n.model=t,n.applyMaterial(),i.setObject3D("mesh",t),i.emit("model-loaded",{format:"obj",model:t})}))},applyMaterial:function(){var t=this.el.components.material;t&&this.model.traverse((function(e){e instanceof _y.Mesh&&(e.material=t.material)}))}}),My+"controllers/oculus/go/oculus-go-controller.gltf"),n_="oculus-go",i_=(_b("oculus-go-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#FFFFFF"},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad"]},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.bindMethods()},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){ZE(this,n_,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{hand:e.hand,idPrefix:n_}),this.data.model&&this.el.setAttribute("gltf-model",e_)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(t){var e,n=t.detail.model;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).trigger=n.getObjectByName("oculus_go_button_trigger"),e.trackpad=n.getObjectByName("oculus_go_touchpad"),e.touchpad=n.getObjectByName("oculus_go_touchpad"))},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var n=this.buttonMeshes;if(n&&n[t]){var i;switch(e){case"down":i=this.data.buttonHighlightColor;break;case"touchstart":i=this.data.buttonTouchedColor;break;default:i=this.data.buttonColor}n[t].material.color.set(i)}}}),"pico-4"),r_=My+"controllers/pico/pico4/",s_=(_b("pico-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){nx(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t,t.data.hand)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t,t.data.hand)},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;ZE(this,i_,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:i_,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",r_+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping[this.data.hand].buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){t.target===this.el&&this.data.model&&this.el.emit("controllermodelready",{name:"pico-controls",model:this.data.model,rayOrigin:new _y.Vector3(0,0,0)})},onAxisMoved:function(t){ex(this,this.mapping[this.data.hand].axes,t)}}),_b("position",{schema:{type:"vec3"},update:function(){var t=this.el.object3D,e=this.data;t.position.set(e.x,e.y,e.z)},remove:function(){this.el.object3D.position.set(0,0,0)}}),Ly("components:raycaster:warn")),o_=/^[\w\s-.,[\]#]*$/,a_={childList:!0,attributes:!0,subtree:!0},l_="raycaster-intersected-cleared",c_="raycaster-intersection-cleared";function h_(t,e){var n;for(t.length=e.length,n=0;n<e.length;n++)t[n]=e[n]}_b("raycaster",{schema:{autoRefresh:{default:!0},direction:{type:"vec3",default:{x:0,y:0,z:-1}},enabled:{default:!0},far:{default:1e3},interval:{default:0},near:{default:0},objects:{default:""},origin:{type:"vec3"},showLine:{default:!1},lineColor:{default:"white"},lineOpacity:{default:1},useWorldCoordinates:{default:!1}},multiple:!0,init:function(){this.clearedIntersectedEls=[],this.unitLineEndVec3=new _y.Vector3,this.intersectedEls=[],this.intersections=[],this.newIntersectedEls=[],this.newIntersections=[],this.objects=[],this.prevCheckTime=void 0,this.prevIntersectedEls=[],this.rawIntersections=[],this.raycaster=new _y.Raycaster,this.updateOriginDirection(),this.setDirty=this.setDirty.bind(this),this.updateLine=this.updateLine.bind(this),this.observer=new MutationObserver(this.setDirty),this.dirty=!0,this.lineEndVec3=new _y.Vector3,this.otherLineEndVec3=new _y.Vector3,this.lineData={end:this.lineEndVec3},this.getIntersection=this.getIntersection.bind(this),this.intersectedDetail={el:this.el,getIntersection:this.getIntersection},this.intersectedClearedDetail={el:this.el},this.intersectionClearedDetail={clearedEls:this.clearedIntersectedEls},this.intersectionDetail={}},update:function(t){var e=this.data,n=this.el,i=this.raycaster;i.far=e.far,i.near=e.near,!e.showLine||e.far===t.far&&e.origin===t.origin&&e.direction===t.direction&&t.showLine||(this.unitLineEndVec3.copy(e.direction).normalize(),this.drawLine()),!e.showLine&&t.showLine&&n.removeAttribute("line"),e.objects===t.objects||o_.test(e.objects)||s_('[raycaster] Selector "'+e.objects+'" may not update automatically with DOM changes.'),e.objects||s_('[raycaster] For performance, please define raycaster.objects when using raycaster or cursor components to whitelist which entities to intersect with. e.g., raycaster="objects: [data-raycastable]".'),e.autoRefresh!==t.autoRefresh&&n.isPlaying&&(e.autoRefresh?this.addEventListeners():this.removeEventListeners()),t.enabled&&!e.enabled&&this.clearAllIntersections(),e.objects!==t.objects&&this.setDirty()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){this.data.showLine&&this.el.removeAttribute("line"),this.clearAllIntersections()},addEventListeners:function(){this.data.autoRefresh&&(this.observer.observe(this.el.sceneEl,a_),this.el.sceneEl.addEventListener("object3dset",this.setDirty),this.el.sceneEl.addEventListener("object3dremove",this.setDirty))},removeEventListeners:function(){this.observer.disconnect(),this.el.sceneEl.removeEventListener("object3dset",this.setDirty),this.el.sceneEl.removeEventListener("object3dremove",this.setDirty)},setDirty:function(){this.dirty=!0},refreshObjects:function(){var t,e=this.data;t=e.objects?this.el.sceneEl.querySelectorAll(e.objects):this.el.sceneEl.querySelectorAll("*"),this.objects=this.flattenObject3DMaps(t),this.dirty=!1},tock:function(t){var e=this.data,n=this.prevCheckTime;e.enabled&&(n&&t-n<e.interval||(this.prevCheckTime=t,this.checkIntersections()))},checkIntersections:function(){var t,e,n=this.clearedIntersectedEls,i=this.el,r=this.data,s=this.intersectedEls,o=this.intersections,a=this.newIntersectedEls,l=this.newIntersections,c=this.prevIntersectedEls,h=this.rawIntersections;for(this.dirty&&this.refreshObjects(),h_(this.prevIntersectedEls,this.intersectedEls),this.updateOriginDirection(),h.length=0,this.raycaster.intersectObjects(this.objects,!0,h),o.length=0,s.length=0,t=0;t<h.length;t++)e=h[t],r.showLine&&e.object===i.getObject3D("line")||e.object.el&&(o.push(e),s.push(e.object.el));for(l.length=0,a.length=0,t=0;t<o.length;t++)-1===c.indexOf(o[t].object.el)&&(l.push(o[t]),a.push(o[t].object.el));for(n.length=0,t=0;t<c.length;t++)-1===s.indexOf(c[t])&&(c[t].emit(l_,this.intersectedClearedDetail),n.push(c[t]));for(n.length&&i.emit(c_,this.intersectionClearedDetail),t=0;t<a.length;t++)a[t].emit("raycaster-intersected",this.intersectedDetail);l.length&&(this.intersectionDetail.els=a,this.intersectionDetail.intersections=l,i.emit("raycaster-intersection",this.intersectionDetail)),(0===c.length&&o.length>0||c.length>0&&0===o.length||c.length&&o.length&&c[0]!==o[0].object.el)&&(this.intersectionDetail.els=this.intersectedEls,this.intersectionDetail.intersections=o,i.emit("raycaster-closest-entity-changed",this.intersectionDetail)),r.showLine&&setTimeout(this.updateLine)},updateLine:function(){var t,e=this.el,n=this.intersections;n.length&&(t=n[0].object.el===e&&n[1]?n[1].distance:n[0].distance),this.drawLine(t)},getIntersection:function(t){var e,n;for(e=0;e<this.intersections.length;e++)if((n=this.intersections[e]).object.el===t)return n;return null},updateOriginDirection:function(){var t=new _y.Vector3,e=new _y.Vector3;return function(){var n=this.el,i=this.data;i.useWorldCoordinates?this.raycaster.set(i.origin,i.direction):(n.object3D.updateMatrixWorld(),e.setFromMatrixPosition(n.object3D.matrixWorld),0===i.origin.x&&0===i.origin.y&&0===i.origin.z||(e=n.object3D.localToWorld(e.copy(i.origin))),t.copy(i.direction).transformDirection(n.object3D.matrixWorld).normalize(),this.raycaster.set(e,t))}}(),drawLine:function(t){var e,n=this.data,i=this.el;e=this.lineData.end===this.lineEndVec3?this.otherLineEndVec3:this.lineEndVec3,void 0===t&&(t=n.far===1/0?1e3:n.far),this.lineData.start=n.origin,this.lineData.end=e.copy(this.unitLineEndVec3).multiplyScalar(t).add(n.origin),this.lineData.color=n.lineColor,this.lineData.opacity=n.lineOpacity,i.setAttribute("line",this.lineData)},flattenObject3DMaps:function(t){var e,n,i=this.objects,r=this.el.sceneEl.object3D;function s(t){return t.parent?s(t.parent):t===r}for(i.length=0,n=0;n<t.length;n++){var o=t[n];if(o.isEntity&&o.object3D&&s(o.object3D))for(e in o.object3DMap)i.push(o.getObject3D(e))}return i},clearAllIntersections:function(){var t;for(t=0;t<this.intersectedEls.length;t++)this.intersectedEls[t].emit(l_,this.intersectedClearedDetail);h_(this.clearedIntersectedEls,this.intersectedEls),this.intersectedEls.length=0,this.intersections.length=0,this.el.emit(c_,this.intersectionClearedDetail)}});var u_,d_,p_,A_,f_=_y.MathUtils.degToRad,m_=(_b("rotation",{schema:{type:"vec3"},update:function(){var t=this.data;this.el.object3D.rotation.set(f_(t.x),f_(t.y),f_(t.z),"YXZ")},remove:function(){this.el.object3D.rotation.set(0,0,0)}}),_b("scale",{schema:{type:"vec3",default:{x:1,y:1,z:1}},update:function(){var t=this.data;this.el.object3D.scale.set(t.x,t.y,t.z)},remove:function(){this.el.object3D.scale.set(1,1,1)}}),_b("shadow",{schema:{cast:{default:!0},receive:{default:!0}},init:function(){this.onMeshChanged=this.update.bind(this),this.el.addEventListener("object3dset",this.onMeshChanged),this.system.setShadowMapEnabled(!0)},update:function(){var t=this.data;this.updateDescendants(t.cast,t.receive)},remove:function(){this.el.removeEventListener("object3dset",this.onMeshChanged),this.updateDescendants(!1,!1)},updateDescendants:function(t,e){var n=this.el.sceneEl;this.el.object3D.traverse((function(i){if(i instanceof _y.Mesh&&(i.castShadow=t,i.receiveShadow=e,n.hasLoaded&&i.material))for(var r=Array.isArray(i.material)?i.material:[i.material],s=0;s<r.length;s++)r[s].needsUpdate=!0}))}}),Ly("components:sound:warn")),g_=(_b("sound",{schema:{autoplay:{default:!1},distanceModel:{default:"inverse",oneOf:["linear","inverse","exponential"]},loop:{default:!1},loopStart:{default:0},loopEnd:{default:0},maxDistance:{default:1e4},on:{default:""},poolSize:{default:1},positional:{default:!0},refDistance:{default:1},rolloffFactor:{default:1},src:{type:"audio"},volume:{default:1}},multiple:!0,init:function(){var t=this;this.listener=null,this.audioLoader=new _y.AudioLoader,this.pool=new _y.Group,this.loaded=!1,this.mustPlay=!1,this.playSoundBound=function(){t.playSound()}},update:function(t){var e,n,i=this.data,r=i.src!==t.src;if(r){if(!i.src)return;this.setupSound()}for(e=0;e<this.pool.children.length;e++)n=this.pool.children[e],i.positional&&(n.setDistanceModel(i.distanceModel),n.setMaxDistance(i.maxDistance),n.setRefDistance(i.refDistance),n.setRolloffFactor(i.rolloffFactor)),n.setLoop(i.loop),n.setLoopStart(i.loopStart),0!==i.loopStart&&0===i.loopEnd?n.setLoopEnd(n.buffer.duration):n.setLoopEnd(i.loopEnd),n.setVolume(i.volume),n.isPaused=!1;if(i.on!==t.on&&this.updateEventListener(t.on),r){var s=this;this.loaded=!1,this.audioLoader.load(i.src,(function(t){for(e=0;e<s.pool.children.length;e++)(n=s.pool.children[e]).setBuffer(t);s.loaded=!0,_y.Cache.remove(i.src),(s.data.autoplay||s.mustPlay)&&s.playSound(s.processSound),s.el.emit("sound-loaded",s.evtDetail,!1)}))}},pause:function(){this.stopSound(),this.removeEventListener()},play:function(){this.data.autoplay&&this.playSound(),this.updateEventListener()},remove:function(){var t;this.removeEventListener(),this.el.getObject3D(this.attrName)&&this.el.removeObject3D(this.attrName);try{for(t=0;t<this.pool.children.length;t++)this.pool.children[t].disconnect()}catch(t){m_("Audio source not properly disconnected")}},updateEventListener:function(t){var e=this.el;t&&e.removeEventListener(t,this.playSoundBound),e.addEventListener(this.data.on,this.playSoundBound)},removeEventListener:function(){this.el.removeEventListener(this.data.on,this.playSoundBound)},setupSound:function(){var t,e,n=this.el,i=n.sceneEl,r=this;this.pool.children.length>0&&(this.stopSound(),n.removeObject3D("sound"));var s=this.listener=i.audioListener||new _y.AudioListener;for(i.audioListener=s,i.camera&&i.camera.add(s),i.addEventListener("camera-set-active",(function(t){t.detail.cameraEl.getObject3D("camera").add(s)})),this.pool=new _y.Group,t=0;t<this.data.poolSize;t++)e=this.data.positional?new _y.PositionalAudio(s):new _y.Audio(s),this.pool.add(e);for(n.setObject3D(this.attrName,this.pool),t=0;t<this.pool.children.length;t++)(e=this.pool.children[t]).onEnded=function(){this.isPlaying=!1,r.el.emit("sound-ended",r.evtDetail,!1)}},pauseSound:function(){var t,e;for(this.isPlaying=!1,t=0;t<this.pool.children.length;t++)(e=this.pool.children[t]).source&&e.source.buffer&&e.isPlaying&&!e.isPaused&&(e.isPaused=!0,e.pause())},playSound:function(t){var e,n,i;if(!this.loaded)return m_("Sound not loaded yet. It will be played once it finished loading"),this.mustPlay=!0,void(this.processSound=t);for(e=!1,this.isPlaying=!0,n=0;n<this.pool.children.length;n++)(i=this.pool.children[n]).isPlaying||!i.buffer||e||(t&&t(i),i.play(),i.isPaused=!1,e=!0);e?(this.mustPlay=!1,this.processSound=void 0):m_("All the sounds are playing. If you need to play more sounds simultaneously consider increasing the size of pool with the `poolSize` attribute.",this.el)},stopSound:function(){var t,e;for(this.isPlaying=!1,t=0;t<this.pool.children.length;t++){if(!(e=this.pool.children[t]).source||!e.source.buffer)return;e.stop()}}}),n(4433)),v_=n.n(g_),y_=n(5751),E_=n.n(y_),x_=Ly("components:text:error"),b_=Ly("components:text:warn"),C_=My+"fonts/",w_={aileronsemibold:C_+"Aileron-Semibold.fnt",dejavu:C_+"DejaVu-sdf.fnt",exo2bold:C_+"Exo2Bold.fnt",exo2semibold:C_+"Exo2SemiBold.fnt",kelsonsans:C_+"KelsonSans.fnt",monoid:C_+"Monoid.fnt",mozillavr:C_+"mozillavr.fnt",roboto:C_+"Roboto-msdf.json",sourcecodepro:C_+"SourceCodePro.fnt"},__=["roboto"],M_="roboto",S_=new function(){var t=this.cache={};this.get=function(e,n){return e in t||(t[e]=n()),t[e]}},I_={},B_={},T_=/^\w+:/;function R_(t,e,n){return t||(.5+e)*n}_b("text",{multiple:!0,schema:{align:{type:"string",default:"left",oneOf:["left","right","center"]},alphaTest:{default:.5},anchor:{default:"center",oneOf:["left","right","center","align"]},baseline:{default:"center",oneOf:["top","center","bottom"]},color:{type:"color",default:"#FFF"},font:{type:"string",default:M_},fontImage:{type:"string"},height:{type:"number"},letterSpacing:{type:"number",default:0},lineHeight:{type:"number"},negate:{type:"boolean",default:!0},opacity:{type:"number",default:1},shader:{default:"sdf",oneOf:AC},side:{default:"front",oneOf:["front","back","double"]},tabSize:{default:4},transparent:{default:!0},value:{type:"string"},whiteSpace:{default:"normal",oneOf:["normal","pre","nowrap"]},width:{type:"number"},wrapCount:{type:"number",default:40},wrapPixels:{type:"number"},xOffset:{type:"number",default:0},yOffset:{type:"number",default:0},zOffset:{type:"number",default:.001}},init:function(){this.shaderData={},this.geometry=v_()(),this.createOrUpdateMaterial(),this.explicitGeoDimensionsChecked=!1},update:function(t){var e=this.data,n=this.currentFont;B_[e.font]?this.texture=B_[e.font]:(this.texture=B_[e.font]=new _y.Texture,this.texture.anisotropy=16),this.createOrUpdateMaterial(),t.font===e.font?n&&(this.updateGeometry(this.geometry,n),this.updateLayout()):this.updateFont()},remove:function(){this.geometry.dispose(),this.geometry=null,this.el.removeObject3D(this.attrName),this.material.dispose(),this.material=null,this.texture.dispose(),this.texture=null,this.shaderObject&&delete this.shaderObject},createOrUpdateMaterial:function(){var t,e,n,i=this.data,r=this.material,s=this.shaderData;if(n=i.shader,-1!==__.indexOf(i.font)||i.font.indexOf("-msdf.")>=0?n="msdf":i.font in w_&&-1===__.indexOf(i.font)&&(n="sdf"),t=(this.shaderObject&&this.shaderObject.name)!==n,s.alphaTest=i.alphaTest,s.color=i.color,s.map=this.texture,s.opacity=i.opacity,s.side=function(t){switch(t){case"back":return _y.FrontSide;case"double":return _y.DoubleSide;default:return _y.BackSide}}(i.side),s.transparent=i.transparent,s.negate=i.negate,!t)return this.shaderObject.update(s),r.transparent=s.transparent,void(r.side=s.side);e=function(t,e,n){var i,r;return(r=new AC[e].Shader).el=t,r.init(n),r.update(n),(i=r.material).transparent=n.transparent,{material:i,shader:r}}(this.el,n,s),this.material=e.material,this.shaderObject=e.shader,this.material.side=s.side,this.mesh&&(this.mesh.material=this.material)},updateFont:function(){var t,e=this.data,n=this.el,i=this.geometry,r=this;e.font||b_("No font specified. Using the default font."),this.mesh&&(this.mesh.visible=!1),t=this.lookupFont(e.font||M_)||e.font,S_.get(t,(function(){return function(t,e){return new Promise((function(n,i){E_()(t,(function(r,s){if(r)return x_("Error loading font",t),void i(r);t.indexOf("/Roboto-msdf.json")>=0&&(e=30),e&&s.chars.forEach((function(t){t.yoffset+=e})),n(s)}))}))}(t,e.yOffset)})).then((function(s){var o;if(1!==s.pages.length)throw new Error("Currently only single-page bitmap fonts are supported.");I_[t]||(s.widthFactor=I_[s]=function(t){var e=0,n=0,i=0;return t.chars.forEach((function(t){e+=t.xadvance,t.id>=48&&t.id<=57&&(i++,n+=t.xadvance)})),i?n/i:e/t.chars.length}(s)),r.currentFont=s,o=r.getFontImageSrc(),S_.get(o,(function(){return function(t){return new Promise((function(e,n){(new _y.ImageLoader).load(t,(function(t){e(t)}),void 0,(function(){x_("Error loading font image",t),n(null)}))}))}(o)})).then((function(t){var o=r.texture;o&&(o.image=t,o.needsUpdate=!0,B_[e.font]=o,r.texture=o,r.initMesh(),r.currentFont=s,r.updateGeometry(i,s),r.updateLayout(),r.mesh.visible=!0,n.emit("textfontset",{font:e.font,fontObj:s}))})).catch((function(t){x_(t.message),x_(t.stack)}))})).catch((function(t){x_(t.message),x_(t.stack)}))},initMesh:function(){this.mesh||(this.mesh=new _y.Mesh(this.geometry,this.material),this.el.setObject3D(this.attrName,this.mesh))},getFontImageSrc:function(){if(this.data.fontImage)return this.data.fontImage;var t=this.lookupFont(this.data.font||M_)||this.data.font,e=this.currentFont.pages[0];return e.match(T_)&&0!==e.indexOf("http")?t.replace(/(\.fnt)|(\.json)/,".png"):_y.LoaderUtils.extractUrlBase(t)+e},updateLayout:function(){var t,e,n,i,r,s,o,a,l,c=this.el,h=this.data,u=this.geometry,d=this.mesh;if(d&&u.layout){if(n=c.getAttribute("geometry"),i=(s=(o=h.width||n&&n.width||1)/R_(h.wrapPixels,h.wrapCount,this.currentFont.widthFactor))*((r=u.layout).height+r.descender),n&&"plane"===n.primitive&&(this.explicitGeoDimensionsChecked||(this.explicitGeoDimensionsChecked=!0,this.hasExplicitGeoWidth=!!n.width,this.hasExplicitGeoHeight=!!n.height),this.hasExplicitGeoWidth||c.setAttribute("geometry","width",o),this.hasExplicitGeoHeight||c.setAttribute("geometry","height",i)),"left"===(t="align"===h.anchor?h.align:h.anchor))a=0;else if("right"===t)a=-1*r.width;else{if("center"!==t)throw new TypeError("Invalid text.anchor property value",t);a=-1*r.width/2}if("bottom"===(e=h.baseline))l=0;else if("top"===e)l=-1*r.height+r.ascender;else{if("center"!==e)throw new TypeError("Invalid text.baseline property value",e);l=-1*r.height/2}d.position.x=a*s+h.xOffset,d.position.y=l*s,d.position.z=h.zOffset,d.scale.set(s,-1*s,s)}},lookupFont:function(t){return w_[t]},updateGeometry:(u_={},d_={},p_=/\\n/g,A_=/\\t/g,function(t,e){var n=this.data;d_.font=e,d_.lineHeight=n.lineHeight&&isFinite(n.lineHeight)?n.lineHeight:e.common.lineHeight,d_.text=n.value.toString().replace(p_,"\n").replace(A_,"\t"),d_.width=R_(n.wrapPixels,n.wrapCount,e.widthFactor),t.update(dx(u_,n,d_))})});var L_,D_,P_=(_b("tracked-controls",{schema:{id:{type:"string",default:""},controller:{default:-1},autoHide:{default:!0},hand:{type:"string",default:""},handTrackingEnabled:{default:!1},iterateControllerProfiles:{default:!1}},init:function(){this.buttonEventDetails={},this.buttonStates=this.el.components["tracked-controls"].buttonStates={},this.axis=this.el.components["tracked-controls"].axis=[0,0,0],this.changedAxes=[],this.axisMoveEventDetail={axis:this.axis,changed:this.changedAxes},this.updateController=this.updateController.bind(this)},update:function(){this.updateController()},play:function(){var t=this.el.sceneEl;this.updateController(),t.addEventListener("controllersupdated",this.updateController)},pause:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.updateController)},isControllerPresent:function(t){return!(!this.controller||this.controller.gamepad||"none"!==t.inputSource.handedness&&t.inputSource.handedness!==this.data.hand)},updateController:function(){this.controller=tx(this.system.controllers,this.data.id,this.data.hand,this.data.controller,this.data.iterateControllerProfiles,this.data.handTrackingEnabled),this.el.components["tracked-controls"].controller=this.controller},tick:function(){var t=this.el.sceneEl,e=this.controller,n=t.frame;this.data.autoHide&&(this.el.object3D.visible=!!e),e&&t.frame&&this.system.referenceSpace&&(e.hand||(this.pose=n.getPose(e.gripSpace,this.system.referenceSpace),this.updatePose(),this.updateButtons()))},updatePose:function(){var t=this.el.object3D,e=this.pose;e&&(t.matrix.elements=e.transform.matrix,t.matrix.decompose(t.position,t.rotation,t.scale))},updateButtons:function(){var t,e,n,i=this.controller;if(i&&i.gamepad){for(n=i.gamepad,e=0;e<n.buttons.length;++e)this.buttonStates[e]||(this.buttonStates[e]={pressed:!1,touched:!1,value:0}),this.buttonEventDetails[e]||(this.buttonEventDetails[e]={id:e,state:this.buttonStates[e]}),t=n.buttons[e],this.handleButton(e,t);this.handleAxes()}},handleButton:function(t,e){return!!(this.handlePress(t,e)|this.handleTouch(t,e)|this.handleValue(t,e))&&(this.el.emit("buttonchanged",this.buttonEventDetails[t],!1),!0)},handleAxes:function(){var t,e=!1,n=this.controller.gamepad.axes,i=this.axis,r=this.changedAxes;for(this.changedAxes.splice(0,this.changedAxes.length),t=0;t<n.length;++t)r.push(i[t]!==n[t]),r[t]&&(e=!0);if(!e)return!1;for(this.axis.splice(0,this.axis.length),t=0;t<n.length;t++)this.axis.push(n[t]);return this.el.emit("axismove",this.axisMoveEventDetail,!1),!0},handlePress:function(t,e){var n,i=this.buttonStates[t];return e.pressed!==i.pressed&&(n=e.pressed?"buttondown":"buttonup",this.el.emit(n,this.buttonEventDetails[t],!1),i.pressed=e.pressed,!0)},handleTouch:function(t,e){var n,i=this.buttonStates[t];return e.touched!==i.touched&&(n=e.touched?"touchstart":"touchend",this.el.emit(n,this.buttonEventDetails[t],!1),i.touched=e.touched,!0)},handleValue:function(t,e){var n=this.buttonStates[t];return e.value!==n.value&&(n.value=e.value,!0)}}),_b("visible",{schema:{default:!0},update:function(){this.el.object3D.visible=this.data}}),My+"controllers/valve/index/valve-index-"),U_={left:P_+"left.glb",right:P_+"right.glb"},O_="valve",F_={left:{x:0,y:-.05,z:.06},right:{x:0,y:-.05,z:.06}},k_={left:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"},right:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"}},N_=(_b("valve-index-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{trackpad:[0,1],thumbstick:[2,3]},buttons:["trigger","grip","trackpad","thumbstick","abutton"]},init:function(){var t=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.previousButtonValues={},this.bindMethods()},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data,e="right"===t.hand?0:"left"===t.hand?1:2;ZE(this,O_,{index:e,iterateControllerProfiles:!0,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:O_,controller:"right"===e.hand?1:"left"===e.hand?0:2,hand:e.hand}),this.loadModel()},loadModel:function(){var t=this.data;t.model&&this.el.setAttribute("gltf-model",""+U_[t.hand])},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping.buttons[t.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(e=t.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=this.triggerOriginalRotationX-e*(Math.PI/40))),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){var e,n=t.detail.model,i=this;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},e.menu=n.getObjectByName("menubutton"),e.system=n.getObjectByName("systembutton"),e.trackpad=n.getObjectByName("touchpad"),e.trigger=n.getObjectByName("trigger"),this.triggerOriginalRotationX=e.trigger.rotation.x,Object.keys(e).forEach((function(t){i.setButtonColor(t,i.data.buttonColor)})),n.position.copy(k_[this.data.hand]),n.rotation.copy(F_[this.data.hand]),this.el.emit("controllermodelready",{name:"valve-index-controls",model:this.data.model,rayOrigin:new _y.Vector3(0,0,0)}))},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},updateModel:function(t,e){var n;this.data.model&&(-1!==e.indexOf("touch")||(n="up"===e?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(t,n)))},setButtonColor:function(t,e){}}),My+"controllers/vive/vr_controller_vive.obj"),Q_=My+"controllers/vive/vr_controller_vive.mtl",G_="htc-vive",z_=(_b("vive-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","none"]},init:function(){var t=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.previousButtonValues={},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;ZE(this,G_,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:G_,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("obj-model",{obj:N_,mtl:Q_})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping.buttons[t.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(e=t.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=-e*(Math.PI/12))),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){var e,n=t.detail.model,i=this;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},e.menu=n.getObjectByName("menubutton"),e.system=n.getObjectByName("systembutton"),e.trackpad=n.getObjectByName("touchpad"),e.touchpad=n.getObjectByName("touchpad"),e.trigger=n.getObjectByName("trigger"),Object.keys(e).forEach((function(t){i.setButtonColor(t,i.data.buttonColor)})),n.position.set(0,-.015,.04))},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},updateModel:function(t,e){var n;this.data.model&&(-1!==e.indexOf("touch")||(n="up"===e?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(t,n)))},setButtonColor:function(t,e){var n=this.buttonMeshes;if(n)return"grip"===t?(n.grip.left.material.color.set(e),void n.grip.right.material.color.set(e)):void n[t].material.color.set(e)}}),My+"controllers/vive/focus-controller/focus-controller.gltf"),H_="htc-vive-focus",V_=(_b("vive-focus-controls",{schema:{hand:{default:""},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad","none","menu"]},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.bindMethods()},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0,this.addControllersUpdateListener()},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1,this.removeControllersUpdateListener()},checkIfControllerPresent:function(){ZE(this,H_,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){this.el.setAttribute("tracked-controls",{idPrefix:H_}),this.data.model&&this.el.setAttribute("gltf-model",z_)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(t){var e,n=t.detail.model;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).trigger=n.getObjectByName("BumperKey"),e.triggerPressed=n.getObjectByName("BumperKey_Press"),e.triggerPressed&&(e.triggerPressed.visible=!1),e.touchpad=n.getObjectByName("TouchPad"),e.touchpadPressed=n.getObjectByName("TouchPad_Press"),e.trackpad=n.getObjectByName("TouchPad"),e.trackpadPressed=n.getObjectByName("TouchPad_Press"),e.trackpadPressed&&(e.trackpadPressed.visible=!1))},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var n=this.buttonMeshes,i=t+"Pressed";if(n&&n[t]&&n[i]){var r;switch(e){case"down":r=this.data.buttonHighlightColor;break;case"touchstart":r=this.data.buttonTouchedColor}r&&n[i].material.color.set(r),n[i].visible=!!r,n[t].visible=!r}}}),{38:"ArrowUp",37:"ArrowLeft",40:"ArrowDown",39:"ArrowRight",87:"KeyW",65:"KeyA",83:"KeyS",68:"KeyD"}),j_=yx,W_=1e-5,q_=["KeyW","KeyA","KeyS","KeyD","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"];_b("wasd-controls",{schema:{acceleration:{default:65},adAxis:{default:"x",oneOf:["x","y","z"]},adEnabled:{default:!0},adInverted:{default:!1},enabled:{default:!0},fly:{default:!1},wsAxis:{default:"z",oneOf:["x","y","z"]},wsEnabled:{default:!0},wsInverted:{default:!1}},after:["look-controls"],init:function(){this.keys={},this.easing=1.1,this.velocity=new _y.Vector3,this.onBlur=this.onBlur.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.onFocus=this.onFocus.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.attachVisibilityEventListeners()},tick:function(t,e){var n=this.data,i=this.el,r=this.velocity;(r[n.adAxis]||r[n.wsAxis]||!function(t){var e;for(e in t)return!1;return!0}(this.keys))&&(e/=1e3,this.updateVelocity(e),(r[n.adAxis]||r[n.wsAxis])&&i.object3D.position.add(this.getMovementVector(e)))},update:function(t){t.adAxis!==this.data.adAxis&&(this.velocity[t.adAxis]=0),t.wsAxis!==this.data.wsAxis&&(this.velocity[t.wsAxis]=0)},remove:function(){this.removeKeyEventListeners(),this.removeVisibilityEventListeners()},play:function(){this.attachKeyEventListeners()},pause:function(){this.keys={},this.removeKeyEventListeners()},updateVelocity:function(t){var e,n,i,r,s,o=this.data,a=this.keys,l=this.velocity;if(n=o.adAxis,r=o.wsAxis,t>.2)return l[n]=0,void(l[r]=0);var c=Math.pow(1/this.easing,60*t);0!==l[n]&&(l[n]=l[n]*c),0!==l[r]&&(l[r]=l[r]*c),Math.abs(l[n])<W_&&(l[n]=0),Math.abs(l[r])<W_&&(l[r]=0),o.enabled&&(e=o.acceleration,o.adEnabled&&(i=o.adInverted?-1:1,(a.KeyA||a.ArrowLeft)&&(l[n]-=i*e*t),(a.KeyD||a.ArrowRight)&&(l[n]+=i*e*t)),o.wsEnabled&&(s=o.wsInverted?-1:1,(a.KeyW||a.ArrowUp)&&(l[r]-=s*e*t),(a.KeyS||a.ArrowDown)&&(l[r]+=s*e*t)))},getMovementVector:(L_=new _y.Vector3(0,0,0),D_=new _y.Euler(0,0,0,"YXZ"),function(t){var e,n=this.el.getAttribute("rotation"),i=this.velocity;return L_.copy(i),L_.multiplyScalar(t),n?(e=this.data.fly?n.x:0,D_.set(_y.MathUtils.degToRad(e),_y.MathUtils.degToRad(n.y),0),L_.applyEuler(D_),L_):L_}),attachVisibilityEventListeners:function(){window.oncontextmenu=this.onContextMenu,window.addEventListener("blur",this.onBlur),window.addEventListener("focus",this.onFocus),document.addEventListener("visibilitychange",this.onVisibilityChange)},removeVisibilityEventListeners:function(){window.removeEventListener("blur",this.onBlur),window.removeEventListener("focus",this.onFocus),document.removeEventListener("visibilitychange",this.onVisibilityChange)},attachKeyEventListeners:function(){window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp)},removeKeyEventListeners:function(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp)},onContextMenu:function(){for(var t=Object.keys(this.keys),e=0;e<t.length;e++)delete this.keys[t[e]]},onBlur:function(){this.pause()},onFocus:function(){this.play()},onVisibilityChange:function(){document.hidden?this.onBlur():this.onFocus()},onKeyDown:function(t){var e;j_(t)&&(e=t.code||V_[t.keyCode],-1!==q_.indexOf(e)&&(this.keys[e]=!0))},onKeyUp:function(t){var e;e=t.code||V_[t.keyCode],delete this.keys[e]}});var X_,Y_,J_,K_=Ly("components:windows-motion-controls:debug"),Z_=Ly("components:windows-motion-controls:warn"),$_=My+"controllers/microsoft/",tM={left:"left.glb",right:"right.glb",default:"universal.glb"},eM="windows-mixed-reality",nM=(_b("windows-motion-controls",{schema:{hand:{default:"right"},pair:{default:0},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick","menu"],axisMeshNames:["TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_X","THUMBSTICK_X","THUMBSTICK_Y"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",squeeze:"GRASP",thumbstick:"THUMBSTICK_PRESS",touchpad:"TOUCHPAD_PRESS"},pointingPoseMeshName:"POINTING_POSE"},bindMethods:function(){this.onModelError=this.onModelError.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this,e=this.el;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.onControllerConnected=function(){t.setModelVisibility(!0)},this.onControllerDisconnected=function(){t.setModelVisibility(!1)},this.controllerPresent=!1,this.previousButtonValues={},this.bindMethods(),this.loadedMeshInfo={buttonMeshes:null,axisMeshes:null},this.rayOrigin={origin:new THREE.Vector3,direction:new THREE.Vector3(0,0,-1),createdFromMesh:!1},e.addEventListener("controllerconnected",this.onControllerConnected),e.addEventListener("controllerdisconnected",this.onControllerDisconnected)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-error",this.onModelError),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-error",this.onModelError),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){ZE(this,eM,{hand:this.data.hand,index:this.data.pair,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},updateControllerModel:function(){if(this.data.model&&!this.rayOrigin.createdFromMesh){var t=this.createControllerModelUrl();this.loadModel(t)}else this.modelReady()},createControllerModelUrl:function(t){var e=this.data.hand;return $_+"default/"+(tM[e]||tM.default)},injectTrackedControls:function(){var t=this.data;this.el.setAttribute("tracked-controls",{idPrefix:eM,controller:t.pair,hand:t.hand}),this.updateControllerModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelError:function(t){var e=this.createControllerModelUrl(!0);t.detail.src!==e?(Z_("Failed to load controller model for device, attempting to load default."),this.loadModel(e)):Z_("Failed to load default controller model.")},loadModel:function(t){this.el.setAttribute("gltf-model","url("+t+")")},onModelLoaded:function(t){var e,n,i,r,s=this.controllerModel=t.detail.model,o=this.loadedMeshInfo;if(t.target===this.el){if(K_("Processing model"),o.buttonMeshes={},o.axisMeshes={},s){for(e=0;e<this.mapping.buttons.length;e++)(n=this.mapping.buttonMeshNames[this.mapping.buttons[e]])?(i=s.getObjectByName(n))?(r={index:e,value:a(i,"VALUE"),pressed:a(i,"PRESSED"),unpressed:a(i,"UNPRESSED")}).value&&r.pressed&&r.unpressed?o.buttonMeshes[this.mapping.buttons[e]]=r:Z_("Missing button submesh under mesh with name: "+n+"(VALUE: "+!!r.value+", PRESSED: "+!!r.pressed+", UNPRESSED:"+!!r.unpressed+")"):Z_("Missing button mesh with name: "+n):K_("Skipping unknown button at index: "+e+" with mapped name: "+this.mapping.buttons[e]);for(e=0;e<this.mapping.axisMeshNames.length;e++)(n=this.mapping.axisMeshNames[e])?(i=s.getObjectByName(n))?(r={index:e,value:a(i,"VALUE"),min:a(i,"MIN"),max:a(i,"MAX")}).value&&r.min&&r.max?o.axisMeshes[e]=r:Z_("Missing axis submesh under mesh with name: "+n+"(VALUE: "+!!r.value+", MIN: "+!!r.min+", MAX:"+!!r.max+")"):Z_("Missing axis mesh with name: "+n):K_("Skipping unknown axis at index: "+e);this.calculateRayOriginFromMesh(s),this.setModelVisibility()}K_("Model load complete.")}function a(t,e){for(var n=0,i=t.children.length;n<i;n++){var r=t.children[n];if(r&&r.name===e)return r}}},calculateRayOriginFromMesh:function(){var t=new THREE.Quaternion;return function(e){var n;if(this.rayOrigin.origin.set(0,0,0),this.rayOrigin.direction.set(0,0,-1),this.rayOrigin.createdFromMesh=!0,n=e.getObjectByName(this.mapping.pointingPoseMeshName)){var i=e.parent;i&&(e.parent=null,e.updateMatrixWorld(!0),e.parent=i),n.getWorldPosition(this.rayOrigin.origin),n.getWorldQuaternion(t),this.rayOrigin.direction.applyQuaternion(t),i&&e.updateMatrixWorld(!0)}else K_("Mesh does not contain pointing origin data, defaulting to none.");this.modelReady()}}(),lerpAxisTransform:function(){var t=new THREE.Quaternion;return function(e,n){var i=this.loadedMeshInfo.axisMeshes[e];if(i){var r=i.min,s=i.max,o=i.value,a=.5*n+.5;o.setRotationFromQuaternion(t.copy(r.quaternion).slerp(s.quaternion,a)),o.position.lerpVectors(r.position,s.position,a)}}}(),lerpButtonTransform:function(){var t=new THREE.Quaternion;return function(e,n){var i=this.loadedMeshInfo.buttonMeshes[e];if(i){var r=i.unpressed,s=i.pressed,o=i.value;o.setRotationFromQuaternion(t.copy(r.quaternion).slerp(s.quaternion,n)),o.position.lerpVectors(r.position,s.position,n)}}}(),modelReady:function(){this.el.emit("controllermodelready",{name:"windows-motion-controls",model:this.data.model,rayOrigin:this.rayOrigin})},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&(this.loadedMeshInfo&&this.loadedMeshInfo.buttonMeshes&&this.lerpButtonTransform(e,t.detail.state.value),this.el.emit(e+"changed",t.detail.state))},onAxisMoved:function(t){var e=this.mapping.axisMeshNames.length;if(this.loadedMeshInfo&&this.loadedMeshInfo.axisMeshes)for(var n=0;n<e;n++)this.lerpAxisTransform(n,t.detail.axis[n]||0);ex(this,this.mapping.axes,t)},setModelVisibility:function(t){var e=this.el.getObject3D("mesh");this.controllerPresent&&(t=void 0!==t?t:this.modelVisible,this.modelVisible=t,e&&(e.visible=t))}}),X_=new _y.Quaternion,Y_=new _y.Vector3,function(t,e,n){e.position.copy(t.transform.position),e.quaternion.copy(t.transform.orientation),Y_.copy(n),X_.copy(t.transform.orientation),Y_.applyQuaternion(X_),e.position.sub(Y_)});function iM(t,e){this.renderer=t,this.xrHitTestSource=null,t.xr.addEventListener("sessionend",function(){this.xrHitTestSource=null}.bind(this)),t.xr.addEventListener("sessionstart",function(){this.sessionStart(e)}.bind(this)),this.renderer.xr.isPresenting&&this.sessionStart(e)}function rM(t){console.warn(t.message),console.warn('Cannot requestHitTestSource Are you missing: webxr="optionalFeatures: hit-test;" from <a-scene>?')}nM.tempFakePose={transform:{orientation:new _y.Quaternion,position:new _y.Vector3}},iM.prototype.previousFrameAnchors=new Set,iM.prototype.anchorToObject3D=new Map,iM.prototype.sessionStart=function(t){this.session=this.renderer.xr.getSession(),"requestHitTestSource"in this.session?t.space?this.session.requestHitTestSource(t).then(function(t){this.xrHitTestSource=t}.bind(this)).catch(rM):t.profile&&this.session.requestHitTestSourceForTransientInput(t).then(function(t){this.xrHitTestSource=t,this.transient=!0}.bind(this)).catch(rM):rM({message:"No requestHitTestSource on the session."})},iM.prototype.anchorFromLastHitTestResult=function(t,e){var n=this.lastHitTest;if(n){var i={object3D:t,offset:e};Array.from(this.anchorToObject3D.entries()).forEach(function(e){var n=e[1].object3D,i=e[0];n===t&&(this.anchorToObject3D.delete(i),i.delete())}.bind(this)),n.createAnchor&&n.createAnchor().then(function(t){this.anchorToObject3D.set(t,i)}.bind(this)).catch((function(t){console.warn(t.message),console.warn('Cannot create anchor, are you missing: webxr="optionalFeatures: anchors;" from <a-scene>?')}))}},iM.prototype.doHit=function(t){if(this.renderer.xr.isPresenting){var e,n,i=this.renderer.xr.getReferenceSpace(),r=t.getViewerPose(i);return this.xrHitTestSource&&r?this.transient?(e=t.getHitTestResultsForTransientInput(this.xrHitTestSource)).length>0&&(n=e[0].results).length>0&&(this.lastHitTest=n[0],n[0].getPose(i)):(e=t.getHitTestResults(this.xrHitTestSource)).length>0&&(this.lastHitTest=e[0],e[0].getPose(i)):void 0}},iM.updateAnchorPoses=function(t,e){var n=t.trackedAnchors||iM.prototype.previousFrameAnchors;iM.prototype.previousFrameAnchors.forEach((function(t){n.has(t)||iM.prototype.anchorToObject3D.delete(t)})),n.forEach((function(n){var i,r,s,o;try{if(i=t.getPose(n.anchorSpace,e)){if(!(r=iM.prototype.anchorToObject3D.get(n)))return;s=r.offset,o=r.object3D,nM(i,o,s)}}catch(t){console.error("while updating anchor poses:",t)}})),iM.prototype.previousFrameAnchors=n},_b("ar-hit-test",{schema:{target:{type:"selector"},enabled:{default:!0},src:{default:"data:image/webp;base64,UklGRkQHAABXRUJQVlA4WAoAAAAQAAAA/wEA/wEAQUxQSL0DAAARDzD/ERGCjrY9sYYFfgo6aa1kJ7K0w9Lo3AadLSVeFxevQwj5kuM8RfR/Atw/C0+ozB/oUBrloFZs6ElSW88j1KA4yExNWQaqRZquIDF0JYmlq0hAuUDTFu66tng3teW7pa3cQf1V1edvur54M/Slm6Wv3Gx9zw0MXlQLntcsBN6wkHjTQuYtC4W3LTw8mGRVG57TbAROtxHfZNhInGkjc5aNwtk2Hg6Mvki14k+NkZzCwQgCxalcAv3kddRTPI1DcUrXId1FLf1uHpzaQz4tquhZVLlKesbVpqKeTj0n0F5PpXDlFN9UqmhalL/ImuZFo6KmToWLoKlddMprqlS8cKovBvHo2kTiFV2LN4msaxKZl3QNiair8xYRdDWivIvXVXmbcMqJ51UebZuFXxZt6xd4laxtciqRtA3Cv0nU1t+kEUFbI8JvCa+tvkm3FDlO/W+OR99+kWEp/YYo+tYfTVnf/K8cE/F///3vv//993eeL+a+uvjawLcX3xjYvJotBFY3kVjTRGFtE+BU2AiMbiQyhpHMWEYeBozAH5qNBYRDB5KBCaTDBKKBAZTDBoKBDjwHAN5ABeCJBsAZcAAC0YHHxAYSMYBiYgGZWEA2MYFCbCCZGAAIANFEB+AnYgMQTDQAYSJ2AN5EBZAm4gDgTDgAeSIu4DGygTIRN1CMLOCZiACykQlg4jsAycgA8AO+BxCNdJyDkcbwRirDGXGnx8w+FDPrkM3MQ9JQZMYhiiwV/RDMtIM3U1/DmXHUo+IR2kSR2ToWkQ1NIn2qf2J8LCqJKiDUiSADHY3whirhdHgZ94HKaR97PhE+twEUJUFoAcgyTct8hfSxSkShASDKdMJ/ritKHwgyQ0sD4D/miCxU5SbhOOUDTnZpccCjYP/i0bZ/8bAgtVGEoGapWIQXyzKVKLwgNJFk2rtMIgoNRJlOZF7SNSSyUEeQmbxBFKEmtYjEe8S8zOZ1AkJVCmS88FJOtF40Ksg4oUaFiygk3C8qlTVNyl8UTevCUdAE2t14PfVqU1FPp57TopKeQZWromddTQp6QOfTOEQt/ZDuipZ11w/wOiqO8dRORcc6BQEkDQMClaHcn5wV9yLbxsNZNgpn2sicYSNxuo34Js1G4FQbnuNsOPa28PCWhcKbFjJvWEi8ZiHwqgXPcxbc5db33Cx95WboSzddX7yp+vyN0+eul7ZyN7Xlu64t3jVt4c5pc4JLV5EYupJE0xUknC4nOjVlmaYpyLit53HCQ0+ScnqceNcS5dzUkd0/CwMAVlA4IGADAAAQXwCdASoAAgACP8ne6Wy/tjCpqJ/IA/A5CWlu4XYBG/Pz8AfwD8APz//f3v8E1fuHZnxKYACtfuHZnxKYACrYTb5mOslhxu843ecbvON3nG7zjd3a0VCn7G1MABVxwH/Xd25gAK1+4dmfEpe2+PHhQaj75++riG6FuYACtfuHZnxKYACRrK3q9xO8Ss3uWKnMhs/rDF1hi6wxdYYusMXWGI5QRcCFDZog5OgqNlse1NDuz/UoFa/cOzPiUwAEsAOK4/nu5eZHK2tlXxJfNYlMABWv3Dsz4bvNJ5YA/LtxJ38SmAArX7h2Z8Sk5vdZUYv7mZPiUwAFa/cOzPh21s5OgZxf1mfEpemRyFr/rM+JS9noA/LtxJ38SmAAlUJIotzAASn6TjdhK+D3Dsz4dyvB7h2Z8O2tnJ0DOL+sz4lL2nKLT4lL/+iSLOocxq639w7M34MNZdm55uJ8v8ra2cpVZnxKTq2F3PN/cNksAfl24k7+JTAASqrD37h2Z7b1W+VtbOUqsz4lJ1bC7nm/uGyWAPy7cSd/EpgAJVVh79w7M9t6rfK2tnKVWZ8Sk6thdzzf3DZLAH5duJO/iUwAEqqw9+4dme29VvlbWzlKrM+JSdWwu55v7hslgD8u3EnfxKYACVVYe/cOzPbeq3ytrZylVme0kYJ8557FLerqFrzIbPrrf3DZLAH5duJO/iUvaVMS9BoaF4p7pSDFTP1XMyfElelrM0DOL+sz4eBJ13nV1OppBGPuKb4YzXQgq9uH19uS/0+JS9t9fr6ZUlQBelDG6GMgq97otb5QMPJwtKyBTbFp8Sl7b6/X0ykkawEOsgdiE6Fi0vb/Eve6xkwsmug0Z4nGNHQO8839bpTsjpz7SWIJxKagvd1QWMa6FYT1KEw3j4XDT6vJ9Xk+nyfT5Pq8n1eEmk5dinMM/9Fcfz4Z3Dsz3KD2dw7LxBRxKrqUUGQPH/7zxr1KIfNpLEJ0MZB2ITM/0Z2EFoh12NlXnEcpYcbvON3nG7zjd5xu84vfcNIAAP7+y8ceyzbVxkakPYY4lcr72fqOnDwipv+yxC71wAADBrjKnAAAAAAAAAAAAAAw7oNGHttqWONcoFN/2WIDc2pa6WVFtFYROlsaMaTXdcOjXHz93+YxAglKa4AAAAA=",type:"map"},type:{default:"footprint",oneOf:["footprint","map"]},footprintDepth:{default:.1},mapSize:{type:"vec2",default:{x:.5,y:.5}}},sceneOnly:!0,init:function(){this.hitTest=null,this.imageDataArray=new Uint8ClampedArray(1048576),this.imageData=new ImageData(this.imageDataArray,512,512),this.textureCache=new Map,this.orthoCam=new _y.OrthographicCamera,this.orthoCam.layers.set(21),this.textureTarget=new _y.WebGLRenderTarget(512,512,{}),this.basicMaterial=new _y.MeshBasicMaterial({color:0,side:_y.DoubleSide}),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.context.imageSmoothingEnabled=!1,this.canvas.width=512,this.canvas.height=512,this.canvasTexture=new _y.CanvasTexture(this.canvas,{alpha:!0}),this.canvasTexture.flipY=!1;var t=this.el.getAttribute("webxr"),e=t.optionalFeatures;e.includes("hit-test")&&e.includes("anchors")||(e.push("hit-test"),e.push("anchors"),this.el.setAttribute("webxr",t)),this.el.sceneEl.renderer.xr.addEventListener("sessionend",function(){this.hitTest=null}.bind(this)),this.el.sceneEl.renderer.xr.addEventListener("sessionstart",function(){if(this.el.is("ar-mode")){var t=this.el.sceneEl.renderer,e=this.session=t.xr.getSession();this.hasPosedOnce=!1,this.bboxMesh.visible=!1,J_||(J_=new Map),e.requestReferenceSpace("viewer").then(function(e){this.viewerHitTest=this.hitTest=new iM(t,{space:e}),this.el.emit("ar-hit-test-start")}.bind(this));var n=this;this.el.sceneEl.addEventListener("controllersupdated",(function(){var e=this.xrSession&&this.xrSession.inputSources;if(e)for(var i=0;i<e.length;++i)if("tracked-pointer"===e[i].targetRayMode){n.hitTest=new iM(t,{space:e[i].targetRaySpace}),J_.set(e[i],n.hitTest),n.viewerHitTest&&"function"==typeof n.viewerHitTest.cancel&&(n.viewerHitTest.cancel(),n.viewerHitTest=null);break}}));var i="generic-touchscreen",r=new iM(t,{profile:i});e.addEventListener("selectstart",function(e){if(!0===this.data.enabled){var n=e.inputSource;this.bboxMesh.visible=!0,!0===this.hasPosedOnce&&(this.el.emit("ar-hit-test-select-start",{inputSource:n,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),n.profiles[0]===i?this.hitTest=r:(this.hitTest=J_.get(n)||new iM(t,{space:n.targetRaySpace}),J_.set(n,this.hitTest)))}}.bind(this)),e.addEventListener("selectend",function(t){if(this.hitTest&&!0===this.data.enabled){var e,n=t.inputSource;!0===this.hasPosedOnce&&(this.bboxMesh.visible=!1,this.data.target&&(e=this.data.target.object3D)&&(nM.tempFakePose.transform.position.copy(this.bboxMesh.position),nM.tempFakePose.transform.orientation.copy(this.bboxMesh.quaternion),nM(nM.tempFakePose,e,this.bboxOffset),e.visible=!0,this.hitTest.anchorFromLastHitTestResult(e,this.bboxOffset)),this.el.emit("ar-hit-test-select",{inputSource:n,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),this.hitTest=null)}else this.hitTest=null}.bind(this))}}.bind(this)),this.bboxOffset=new _y.Vector3,this.update=this.update.bind(this),this.makeBBox()},update:function(){!1===this.data.enabled&&(this.hitTest=null,this.bboxMesh.visible=!1),this.data.target&&(this.data.target.object3D?(this.data.target.addEventListener("model-loaded",this.update),this.data.target.object3D.layers.enable(21),this.data.target.object3D.traverse((function(t){t.layers.enable(21)}))):this.data.target.addEventListener("loaded",this.update,{once:!0})),this.bboxNeedsUpdate=!0},makeBBox:function(){var t=new _y.PlaneGeometry(1,1),e=new _y.MeshBasicMaterial({transparent:!0,color:16777215});t.rotateX(-Math.PI/2),t.rotateY(-Math.PI/2),this.bbox=new _y.Box3,this.bboxMesh=new _y.Mesh(t,e),this.el.setObject3D("ar-hit-test",this.bboxMesh),this.bboxMesh.visible=!1},updateFootprint:function(){var t,e,n,i=this.el.sceneEl.renderer,r=i.xr.enabled;this.bboxMesh.material.map=this.canvasTexture,this.bboxMesh.material.needsUpdate=!0,this.orthoCam.rotation.set(-Math.PI/2,0,-Math.PI/2),this.orthoCam.position.copy(this.bboxMesh.position),this.orthoCam.position.y-=this.bboxMesh.scale.y/2,this.orthoCam.near=.1,this.orthoCam.far=this.orthoCam.near+this.data.footprintDepth*this.bboxMesh.scale.y,this.orthoCam.position.y+=this.orthoCam.far,this.orthoCam.right=this.bboxMesh.scale.z/2,this.orthoCam.left=-this.bboxMesh.scale.z/2,this.orthoCam.top=this.bboxMesh.scale.x/2,this.orthoCam.bottom=-this.bboxMesh.scale.x/2,this.orthoCam.updateProjectionMatrix(),e=i.getRenderTarget(),i.setRenderTarget(this.textureTarget),i.xr.enabled=!1,n=this.el.object3D.background,this.el.object3D.overrideMaterial=this.basicMaterial,this.el.object3D.background=null,i.render(this.el.object3D,this.orthoCam),this.el.object3D.background=n,this.el.object3D.overrideMaterial=null,i.xr.enabled=r,i.setRenderTarget(e),i.readRenderTargetPixels(this.textureTarget,0,0,512,512,this.imageDataArray),this.context.putImageData(this.imageData,0,0),this.context.shadowColor="white",this.context.shadowBlur=10,this.context.drawImage(this.canvas,0,0),t=this.context.getImageData(0,0,512,512);for(var s=0;s<262144;s++)0!==t.data[4*s+3]&&255!==t.data[4*s+3]&&(t.data[4*s+3]=128);this.context.putImageData(t,0,0),this.canvasTexture.needsUpdate=!0},tick:function(){var t,e,n=this.el.sceneEl.frame,i=this.el.sceneEl.renderer;(n&&iM.updateAnchorPoses(n,i.xr.getReferenceSpace()),this.bboxNeedsUpdate)&&(this.bboxNeedsUpdate=!1,this.data.target&&"map"!==this.data.type||(this.textureCache.has(this.data.src)?e=this.textureCache.get(this.data.src):(e=(new _y.TextureLoader).load(this.data.src),this.textureCache.set(this.data.src,e)),this.bboxMesh.material.map=e,this.bboxMesh.material.needsUpdate=!0),this.data.target&&this.data.target.object3D?(this.bbox.setFromObject(this.data.target.object3D),this.bbox.getCenter(this.bboxMesh.position),this.bbox.getSize(this.bboxMesh.scale),"footprint"===this.data.type&&(this.bboxMesh.scale.x*=1.04,this.bboxMesh.scale.z*=1.04,this.updateFootprint()),this.bboxMesh.position.y-=this.bboxMesh.scale.y/2,this.bboxOffset.copy(this.bboxMesh.position),this.bboxOffset.sub(this.data.target.object3D.position)):this.bboxMesh.scale.set(this.data.mapSize.x,1,this.data.mapSize.y));this.hitTest&&(t=this.hitTest.doHit(n))&&(!0!==this.hasPosedOnce&&(this.hasPosedOnce=!0,this.el.emit("ar-hit-test-achieved")),this.bboxMesh.visible=!0,this.bboxMesh.position.copy(t.transform.position),this.bboxMesh.quaternion.copy(t.transform.orientation))}}),_b("background",{schema:{color:{type:"color",default:"black"},transparent:{default:!1}},sceneOnly:!0,update:function(){var t=this.data,e=this.el.object3D;t.transparent?e.background=null:e.background=new THREE.Color(t.color)},remove:function(){this.el.object3D.background=null}}),_b("debug",{schema:{default:!0},sceneOnly:!0});var sM="a-dialog-buttons-container",oM="a-dialog-button";function aM(t,e){var n,i,r,s;return(n=document.createElement("div")).classList.add("a-modal"),n.setAttribute(Sy,""),(i=document.createElement("div")).className="a-dialog",i.setAttribute(Sy,""),n.appendChild(i),(r=document.createElement("div")).classList.add("a-dialog-text-container"),i.appendChild(r),(s=document.createElement("div")).classList.add("a-dialog-text"),s.innerHTML=t,r.appendChild(s),i.appendChild(e),n}_b("device-orientation-permission-ui",{schema:{enabled:{default:!0},deviceMotionMessage:{default:"This immersive website requires access to your device motion sensors."},httpsMessage:{default:"Access this site over HTTPS to enter VR mode and grant access to the device sensors."},denyButtonText:{default:"Deny"},allowButtonText:{default:"Allow"},cancelButtonText:{default:"Cancel"}},sceneOnly:!0,init:function(){var t=this;this.data.enabled&&(window.isSecureContext||this.showHTTPAlert(),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission?(this.onDeviceMotionDialogAllowClicked=this.onDeviceMotionDialogAllowClicked.bind(this),this.onDeviceMotionDialogDenyClicked=this.onDeviceMotionDialogDenyClicked.bind(this),DeviceOrientationEvent.requestPermission().then((function(){t.el.emit("deviceorientationpermissiongranted"),t.permissionGranted=!0})).catch((function(){var e,n,i,r,s,o,a,l;t.devicePermissionDialogEl=(e=t.data.denyButtonText,n=t.data.allowButtonText,i=t.data.deviceMotionMessage,r=t.onDeviceMotionDialogAllowClicked,s=t.onDeviceMotionDialogDenyClicked,(o=document.createElement("div")).classList.add(sM),(a=document.createElement("button")).classList.add(oM,"a-dialog-deny-button"),a.setAttribute(Sy,""),a.innerHTML=e,o.appendChild(a),(l=document.createElement("button")).classList.add(oM,"a-dialog-allow-button"),l.setAttribute(Sy,""),l.innerHTML=n,o.appendChild(l),l.addEventListener("click",(function(t){t.stopPropagation(),r()})),a.addEventListener("click",(function(t){t.stopPropagation(),s()})),aM(i,o)),t.el.appendChild(t.devicePermissionDialogEl)}))):this.permissionGranted=!0)},remove:function(){this.devicePermissionDialogEl&&this.el.removeChild(this.devicePermissionDialogEl)},onDeviceMotionDialogDenyClicked:function(){this.remove()},showHTTPAlert:function(){var t,e,n,i,r,s=this,o=(t=s.data.cancelButtonText,e=s.data.httpsMessage,n=function(){s.el.removeChild(o)},(i=document.createElement("div")).classList.add(sM),(r=document.createElement("button")).classList.add(oM,"a-dialog-ok-button"),r.setAttribute(Sy,""),r.innerHTML=t,i.appendChild(r),r.addEventListener("click",(function(t){t.stopPropagation(),n()})),aM(e,i));this.el.appendChild(o)},onDeviceMotionDialogAllowClicked:function(){var t=this;this.el.emit("deviceorientationpermissionrequested"),DeviceOrientationEvent.requestPermission().then((function(e){"granted"===e?(t.el.emit("deviceorientationpermissiongranted"),t.permissionGranted=!0):t.el.emit("deviceorientationpermissionrejected"),t.remove()})).catch(console.error)}}),_b("embedded",{dependencies:["xr-mode-ui"],schema:{default:!0},sceneOnly:!0,update:function(){var t=this.el,e=t.querySelector(".a-enter-vr");!0===this.data?(e&&e.classList.add("embedded"),t.removeFullScreenStyles()):(e&&e.classList.remove("embedded"),t.addFullScreenStyles())}});var lM="https://unpkg.com/aframe-inspector@"+function(t){var e=t.split(".");return e[2]="x",e.join(".")}(_C)+"/dist/aframe-inspector.min.js";_b("inspector",{schema:{url:{default:lM}},sceneOnly:!0,init:function(){this.firstPlay=!0,this.onKeydown=this.onKeydown.bind(this),this.onMessage=this.onMessage.bind(this),this.initOverlay(),window.addEventListener("keydown",this.onKeydown),window.addEventListener("message",this.onMessage)},play:function(){var t;this.firstPlay&&"false"!==(t=bx("inspector"))&&t&&(this.openInspector(),this.firstPlay=!1)},initOverlay:function(){this.loadingMessageEl=document.createElement("div"),this.loadingMessageEl.classList.add("a-inspector-loader"),this.loadingMessageEl.innerHTML='Loading Inspector<span class="dots"><span>.</span><span>.</span><span>.</span></span>'},remove:function(){this.removeEventListeners()},onKeydown:function(t){73===t.keyCode&&(t.ctrlKey&&t.altKey||t.getModifierState("AltGraph"))&&this.openInspector()},showLoader:function(){document.body.appendChild(this.loadingMessageEl)},hideLoader:function(){document.body.removeChild(this.loadingMessageEl)},onMessage:function(t){"INJECT_AFRAME_INSPECTOR"===t.data&&this.openInspector()},openInspector:function(t){var e,n=this;AFRAME.INSPECTOR||AFRAME.inspectorInjected?AFRAME.INSPECTOR.open(t):(this.showLoader(),(e=document.createElement("script")).src=this.data.url,e.setAttribute("data-name","aframe-inspector"),e.setAttribute(Sy,""),e.onload=function(){AFRAME.INSPECTOR.open(t),n.hideLoader(),n.removeEventListeners()},e.onerror=function(){n.loadingMessageEl.innerHTML="Error loading Inspector"},document.head.appendChild(e),AFRAME.inspectorInjected=!0)},removeEventListeners:function(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("message",this.onMessage)}}),_b("fog",{schema:{color:{type:"color",default:"#000"},density:{default:25e-5},far:{default:1e3,min:0},near:{default:1,min:0},type:{default:"linear",oneOf:["linear","exponential"]}},sceneOnly:!0,update:function(){var t=this.data,e=this.el,n=this.el.object3D.fog;n&&t.type===n.name?Object.keys(this.schema).forEach((function(e){var i=t[e];"color"===e&&(i=new _y.Color(i)),n[e]=i})):e.object3D.fog=function(t){var e;return(e="exponential"===t.type?new _y.FogExp2(t.color,t.density):new _y.Fog(t.color,t.near,t.far)).name=t.type,e}(t)},remove:function(){var t=this.el;this.el.object3D.fog&&(t.object3D.fog=null)}}),_b("keyboard-shortcuts",{schema:{enterVR:{default:!0},exitVR:{default:!0}},sceneOnly:!0,init:function(){this.onKeyup=this.onKeyup.bind(this)},play:function(){window.addEventListener("keyup",this.onKeyup,!1)},pause:function(){window.removeEventListener("keyup",this.onKeyup)},onKeyup:function(t){var e=this.el;yx(t)&&(this.data.enterVR&&70===t.keyCode&&e.enterVR(),this.data.exitVR&&27===t.keyCode&&e.exitVR())}});var cM=Ly("components:pool:warn");_b("pool",{schema:{container:{default:""},mixin:{default:""},size:{default:0},dynamic:{default:!1}},sceneOnly:!0,multiple:!0,initPool:function(){var t;for(this.availableEls=[],this.usedEls=[],this.data.mixin||cM("No mixin provided for pool component."),this.data.container&&(this.container=document.querySelector(this.data.container),this.container||cM("Container "+this.data.container+" not found.")),this.container=this.container||this.el,t=0;t<this.data.size;++t)this.createEntity()},update:function(t){var e=this.data;t.mixin===e.mixin&&t.size===e.size||this.initPool()},createEntity:function(){var t;(t=document.createElement("a-entity")).play=this.wrapPlay(t.play),t.setAttribute("mixin",this.data.mixin),t.object3D.visible=!1,t.pause(),this.container.appendChild(t),this.availableEls.push(t);var e=this.usedEls;t.addEventListener("loaded",(function(){-1===e.indexOf(t)&&(t.object3DParent=t.object3D.parent,t.object3D.parent.remove(t.object3D))}))},wrapPlay:function(t){var e=this.usedEls;return function(){-1!==e.indexOf(this)&&t.call(this)}},requestEntity:function(){var t;if(0===this.availableEls.length){if(!1===this.data.dynamic)return void cM("Requested entity from empty pool: "+this.attrName);cM("Requested entity from empty pool. This pool is dynamic and will resize automatically. You might want to increase its initial size: "+this.attrName),this.createEntity()}return t=this.availableEls.shift(),this.usedEls.push(t),t.object3DParent&&(t.object3DParent.add(t.object3D),this.updateRaycasters()),t.object3D.visible=!0,t},returnEntity:function(t){var e=this.usedEls.indexOf(t);if(-1!==e)return this.usedEls.splice(e,1),this.availableEls.push(t),t.object3DParent=t.object3D.parent,t.object3D.parent.remove(t.object3D),this.updateRaycasters(),t.object3D.visible=!1,t.pause(),t;cM("The returned entity was not previously pooled from "+this.attrName)},updateRaycasters:function(){document.querySelectorAll("[raycaster]").forEach((function(t){t.components.raycaster.setDirty()}))}}),_b("real-world-meshing",{schema:{filterLabels:{type:"array"},meshesEnabled:{default:!0},meshMixin:{default:!0},planesEnabled:{default:!0},planeMixin:{default:""}},sceneOnly:!0,init:function(){var t=this.el.getAttribute("webxr"),e=t.requiredFeatures;-1===e.indexOf("mesh-detection")&&(e.push("mesh-detection"),this.el.setAttribute("webxr",t)),-1===e.indexOf("plane-detection")&&(e.push("plane-detection"),this.el.setAttribute("webxr",t)),this.meshEntities=[],this.initWorldMeshEntity=this.initWorldMeshEntity.bind(this)},tick:function(){this.el.is("ar-mode")&&(this.detectMeshes(),this.updateMeshes())},detectMeshes:function(){var t,e,n,i=this.data,r=this.el,s=this.meshEntities,o=!1,a=[],l=this.data.filterLabels;t=(n=r.frame).detectedMeshes,e=n.detectedPlanes;for(var c=0;c<s.length;c++)s[c].present=!1;if(i.meshesEnabled)for(var h of t.values())if(!l.length||-1!==l.indexOf(h.semanticLabel)){for(c=0;c<s.length;c++)if(h===s[c].mesh){o=!0,s[c].present=!0,s[c].lastChangedTime<h.lastChangedTime&&this.updateMeshGeometry(s[c].el,h),s[c].lastChangedTime=h.lastChangedTime;break}o||a.push(h),o=!1}if(i.planesEnabled)for(h of e.values())if(!l.length||-1!==l.indexOf(h.semanticLabel)){for(c=0;c<s.length;c++)if(h===s[c].mesh){o=!0,s[c].present=!0,s[c].lastChangedTime<h.lastChangedTime&&this.updateMeshGeometry(s[c].el,h),s[c].lastChangedTime=h.lastChangedTime;break}o||a.push(h),o=!1}this.deleteMeshes(),this.createNewMeshes(a)},updateMeshes:function(){var t=new _y.Matrix4;return function(){for(var e,n,i,r=this.el,s=r.frame,o=this.meshEntities,a=r.renderer.xr.getReferenceSpace(),l=0;l<o.length;l++)i=o[l].mesh.meshSpace||o[l].mesh.planeSpace,e=s.getPose(i,a),(n=o[l].el).hasLoaded&&(t.fromArray(e.transform.matrix),t.decompose(n.object3D.position,n.object3D.quaternion,n.object3D.scale))}}(),deleteMeshes:function(){for(var t=this.meshEntities,e=[],n=0;n<t.length;n++)t[n].present?e.push(t[n]):this.el.removeChild(t[n]);this.meshEntities=e},createNewMeshes:function(t){for(var e,n=0;n<t.length;n++)e=document.createElement("a-entity"),this.meshEntities.push({mesh:t[n],el:e}),e.addEventListener("loaded",this.initWorldMeshEntity),this.el.appendChild(e)},initMeshGeometry:function(t){var e,n,i;if(t instanceof XRPlane){n=new _y.Shape,i=t.polygon;for(var r=0;r<i.length;++r)0===r?n.moveTo(i[r].x,i[r].z):n.lineTo(i[r].x,i[r].z);return(e=new _y.ShapeGeometry(n)).rotateX(Math.PI/2),e}return(e=new _y.BufferGeometry).setAttribute("position",new _y.BufferAttribute(t.vertices,3)),e.setIndex(new _y.BufferAttribute(t.indices,1)),e},initWorldMeshEntity:function(t){for(var e,n,i,r=t.target,s=this.meshEntities,o=0;o<s.length;o++)if(s[o].el===r){i=s[o];break}e=this.initMeshGeometry(i.mesh),n=new _y.Mesh(e,new _y.MeshBasicMaterial({color:16777215*Math.random(),side:_y.DoubleSide})),r.setObject3D("mesh",n),i.mesh instanceof XRPlane&&this.data.planeMixin?r.setAttribute("mixin",this.data.planeMixin):this.data.meshMixin&&r.setAttribute("mixin",this.data.meshMixin),r.setAttribute("data-world-mesh",i.mesh.semanticLabel)},updateMeshGeometry:function(t,e){var n=t.getObject3D("mesh");n.geometry.dispose(),n.geometry=this.initMeshGeometry(e)}}),_b("reflection",{schema:{directionalLight:{type:"selector"}},sceneOnly:!0,init:function(){var t=this;this.cubeRenderTarget=new THREE.WebGLCubeRenderTarget(16),this.cubeCamera=new THREE.CubeCamera(.1,1e3,this.cubeRenderTarget),this.lightingEstimationTexture=new THREE.WebGLCubeRenderTarget(16).texture,this.needsVREnvironmentUpdate=!0;var e=this.el.getAttribute("webxr"),n=e.optionalFeatures;n.includes("light-estimation")||(n.push("light-estimation"),this.el.setAttribute("webxr",e)),this.el.addEventListener("enter-vr",(function(){t.el.is("ar-mode")&&t.el.renderer.xr.getSession().requestLightProbe&&t.startLightProbe()})),this.el.addEventListener("exit-vr",(function(){t.xrLightProbe&&t.stopLightProbe()})),this.el.object3D.environment=this.cubeRenderTarget.texture},stopLightProbe:function(){this.xrLightProbe=null,this.probeLight&&(this.probeLight.components.light.light.intensity=0),this.needsVREnvironmentUpdate=!0,this.el.object3D.environment=this.cubeRenderTarget.texture},startLightProbe:function(){this.needsLightProbeUpdate=!0},setupLightProbe:function(){var t=this.el.renderer,e=t.xr.getSession(),n=this,i=t.getContext();if(!this.probeLight){var r=document.createElement("a-light");r.setAttribute("type","probe"),r.setAttribute("intensity",0),this.el.appendChild(r),this.probeLight=r}switch(e.preferredReflectionFormat){case"srgba8":i.getExtension("EXT_sRGB");break;case"rgba16f":i.getExtension("OES_texture_half_float")}this.glBinding=new XRWebGLBinding(e,i),i.getExtension("EXT_sRGB"),i.getExtension("OES_texture_half_float"),e.requestLightProbe().then((function(t){n.xrLightProbe=t,t.addEventListener("reflectionchange",n.updateXRCubeMap.bind(n))})).catch((function(t){console.warn("Lighting estimation not supported: "+t.message),console.warn('Are you missing: webxr="optionalFeatures: light-estimation;" from <a-scene>?')}))},updateXRCubeMap:function(){var t=this.el.renderer,e=this.glBinding.getReflectionCubeMap(this.xrLightProbe);e&&(t.properties.get(this.lightingEstimationTexture).__webglTexture=e,this.lightingEstimationTexture.needsPMREMUpdate=!0,this.el.object3D.environment=this.lightingEstimationTexture)},tick:function(){var t=this.el.object3D,e=this.el.renderer,n=this.el.frame;if(n&&this.xrLightProbe){var i=n.getLightEstimate(this.xrLightProbe);i&&function(t,e,n,i){var r=Math.max(t.primaryLightIntensity.x,Math.max(t.primaryLightIntensity.y,t.primaryLightIntensity.z));e.sh.fromArray(t.sphericalHarmonicsCoefficients),e.intensity=3.14,n&&(n.color.setRGB(t.primaryLightIntensity.x/r,t.primaryLightIntensity.y/r,t.primaryLightIntensity.z/r),n.intensity=r,i.copy(t.primaryLightDirection))}(i,this.probeLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.object3D.position)}this.needsVREnvironmentUpdate&&(t.environment=null,this.needsVREnvironmentUpdate=!1,this.cubeCamera.position.set(0,1.6,0),this.cubeCamera.update(e,t),t.environment=this.cubeRenderTarget.texture),this.needsLightProbeUpdate&&n&&(this.setupLightProbe(),this.needsLightProbeUpdate=!1)},remove:function(){this.el.object3D.environment=null,this.probeLight&&this.el.removeChild(this.probeLight)}});var hM=["attribute vec3 position;","attribute vec2 uv;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","varying vec2 vUv;","void main() {"," vUv = vec2( 1.- uv.x, uv.y );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),uM=["precision mediump float;","uniform samplerCube map;","varying vec2 vUv;","#define M_PI 3.141592653589793238462643383279","void main() {"," vec2 uv = vUv;"," float longitude = uv.x * 2. * M_PI - M_PI + M_PI / 2.;"," float latitude = uv.y * M_PI;"," vec3 dir = vec3("," - sin( longitude ) * sin( latitude ),"," cos( latitude ),"," - cos( longitude ) * sin( latitude )"," );"," normalize( dir );"," gl_FragColor = vec4( textureCube( map, dir ).rgb, 1.0 );","}"].join("\n"),dM=(_b("screenshot",{schema:{width:{default:4096},height:{default:2048},camera:{type:"selector"}},sceneOnly:!0,setup:function(){var t=this.el;if(!this.canvas){var e=t.renderer.getContext();e&&(this.cubeMapSize=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),this.material=new _y.RawShaderMaterial({uniforms:{map:{type:"t",value:null}},vertexShader:hM,fragmentShader:uM,side:_y.DoubleSide}),this.quad=new _y.Mesh(new _y.PlaneGeometry(1,1),this.material),this.quad.visible=!1,this.camera=new _y.OrthographicCamera(-.5,.5,.5,-.5,-1e4,1e4),this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),t.object3D.add(this.quad),this.onKeyDown=this.onKeyDown.bind(this))}},getRenderTarget:function(t,e){return new _y.WebGLRenderTarget(t,e,{colorSpace:this.el.sceneEl.renderer.outputColorSpace,minFilter:_y.LinearFilter,magFilter:_y.LinearFilter,wrapS:_y.ClampToEdgeWrapping,wrapT:_y.ClampToEdgeWrapping,format:_y.RGBAFormat,type:_y.UnsignedByteType})},resize:function(t,e){this.quad.scale.set(t,e,1),this.camera.left=-1*t/2,this.camera.right=t/2,this.camera.top=e/2,this.camera.bottom=-1*e/2,this.camera.updateProjectionMatrix(),this.canvas.width=t,this.canvas.height=e},play:function(){window.addEventListener("keydown",this.onKeyDown)},onKeyDown:function(t){var e=83===t.keyCode&&t.ctrlKey&&t.altKey;if(this.data&&e){var n=t.shiftKey?"equirectangular":"perspective";this.capture(n)}},setCapture:function(t){var e,n,i,r,s=this.el;return"perspective"===t?(this.quad.visible=!1,n=this.data.camera&&this.data.camera.components.camera.camera||s.camera,e={width:this.data.width,height:this.data.height}):(n=this.camera,r=new _y.WebGLCubeRenderTarget(Math.min(this.cubeMapSize,2048),{format:_y.RGBFormat,generateMipmaps:!0,minFilter:_y.LinearMipmapLinearFilter,colorSpace:_y.SRGBColorSpace}),i=new _y.CubeCamera(s.camera.near,s.camera.far,r),s.camera.getWorldPosition(i.position),s.camera.getWorldQuaternion(i.quaternion),i.update(s.renderer,s.object3D),this.quad.material.uniforms.map.value=i.renderTarget.texture,e={width:this.data.width,height:this.data.height},this.quad.visible=!0),{camera:n,size:e,projection:t}},capture:function(t){var e,n=this.el.renderer.xr.enabled,i=this.el.renderer;this.setup(),i.xr.enabled=!1,e=this.setCapture(t),this.renderCapture(e.camera,e.size,e.projection),this.saveCapture(),i.xr.enabled=n},getCanvas:function(t){var e=this.el.renderer.xr.enabled,n=this.el.renderer;this.setup();var i=this.setCapture(t);return n.xr.enabled=!1,this.renderCapture(i.camera,i.size,i.projection),n.xr.enabled=e,this.canvas},renderCapture:function(t,e,n){var i,r,s,o=this.el.renderer.autoClear,a=this.el,l=a.renderer;r=this.getRenderTarget(e.width,e.height),s=new Uint8Array(4*e.width*e.height),this.resize(e.width,e.height),l.autoClear=!0,l.clear(),l.setRenderTarget(r),l.render(a.object3D,t),l.autoClear=o,l.readRenderTargetPixels(r,0,0,e.width,e.height,s),l.setRenderTarget(null),"perspective"===n&&(s=this.flipPixelsVertically(s,e.width,e.height)),i=new ImageData(new Uint8ClampedArray(s),e.width,e.height),this.quad.visible=!1,this.ctx.putImageData(i,0,0)},flipPixelsVertically:function(t,e,n){for(var i=t.slice(0),r=0;r<e;++r)for(var s=0;s<n;++s)i[4*r+s*e*4]=t[4*r+(n-s)*e*4],i[4*r+1+s*e*4]=t[4*r+1+(n-s)*e*4],i[4*r+2+s*e*4]=t[4*r+2+(n-s)*e*4],i[4*r+3+s*e*4]=t[4*r+3+(n-s)*e*4];return i},saveCapture:function(){this.canvas.toBlob((function(t){var e="screenshot-"+document.title.toLowerCase()+"-"+Date.now()+".png",n=document.createElement("a"),i=URL.createObjectURL(t);n.href=i,n.setAttribute("download",e),n.innerHTML="downloading...",n.style.display="none",document.body.appendChild(n),setTimeout((function(){n.click(),document.body.removeChild(n)}),1)}),"image/png")}}),n(282)),pM=n.n(dM),AM=(n(3729),n(8132),window.aframeStats),fM="a-hidden",mM=window.threeStats;_b("stats",{schema:{default:!0},sceneOnly:!0,init:function(){var t=this.el;"false"!==bx("stats")&&(this.stats=function(t){var e=new mM(t.renderer),n=new AM(t),i=t.isMobile?[]:[e,n];return new(pM())({css:[],values:{fps:{caption:"fps",below:30}},groups:[{caption:"Framerate",values:["fps","raf"]}],plugins:i})}(t),this.statsEl=document.querySelector(".rs-base"),this.hideBound=this.hide.bind(this),this.showBound=this.show.bind(this),t.addEventListener("enter-vr",this.hideBound),t.addEventListener("exit-vr",this.showBound))},update:function(){if(this.stats)return this.data?this.show():this.hide()},remove:function(){this.el.removeEventListener("enter-vr",this.hideBound),this.el.removeEventListener("exit-vr",this.showBound),this.statsEl&&this.statsEl.parentNode.removeChild(this.statsEl)},tick:function(){var t=this.stats;t&&(t("rAF").tick(),t("FPS").frame(),t().update())},hide:function(){this.statsEl.classList.add(fM)},show:function(){this.statsEl.classList.remove(fM)}});var gM="a-hidden";function vM(t){t.addEventListener("touchstart",(function(){t.classList.remove("resethover")}),{passive:!0}),t.addEventListener("touchend",(function(){t.classList.add("resethover")}),{passive:!0})}_b("xr-mode-ui",{dependencies:["canvas"],schema:{enabled:{default:!0},enterVRButton:{default:""},enterVREnabled:{default:!0},enterARButton:{default:""},enterAREnabled:{default:!0},XRMode:{default:"vr",oneOf:["vr","ar","xr"]}},sceneOnly:!0,init:function(){var t=this,e=this.el;"false"!==bx("ui")&&(this.insideLoader=!1,this.enterVREl=null,this.enterAREl=null,this.orientationModalEl=null,this.bindMethods(),e.addEventListener("enter-vr",this.updateEnterInterfaces),e.addEventListener("exit-vr",this.updateEnterInterfaces),e.addEventListener("update-vr-devices",this.updateEnterInterfaces),window.addEventListener("message",(function(e){"loaderReady"===e.data.type&&(t.insideLoader=!0,t.remove())})),window.addEventListener("orientationchange",this.toggleOrientationModalIfNeeded))},bindMethods:function(){this.onEnterVRButtonClick=this.onEnterVRButtonClick.bind(this),this.onEnterARButtonClick=this.onEnterARButtonClick.bind(this),this.onModalClick=this.onModalClick.bind(this),this.toggleOrientationModalIfNeeded=this.toggleOrientationModalIfNeeded.bind(this),this.updateEnterInterfaces=this.updateEnterInterfaces.bind(this)},onModalClick:function(){this.el.exitVR()},onEnterVRButtonClick:function(){this.el.enterVR()},onEnterARButtonClick:function(){this.el.enterAR()},update:function(){var t,e,n,i=this.data,r=this.el;if(!i.enabled||this.insideLoader||"false"===bx("ui"))return this.remove();this.enterVREl||this.enterAREl||this.orientationModalEl||(this.enterVREl||!i.enterVREnabled||"xr"!==i.XRMode&&"vr"!==i.XRMode||(i.enterVRButton?(this.enterVREl=document.querySelector(i.enterVRButton),this.enterVREl.addEventListener("click",this.onEnterVRButtonClick)):(this.enterVREl=(t=this.onEnterVRButtonClick,(n=document.createElement("div")).classList.add("a-enter-vr"),n.setAttribute(Sy,""),(e=document.createElement("button")).className="a-enter-vr-button",e.setAttribute("title","Enter VR mode with a headset or fullscreen without"),e.setAttribute(Sy,""),Wy()&&vM(e),n.appendChild(e),e.addEventListener("click",(function(e){t(),e.stopPropagation()})),n),r.appendChild(this.enterVREl))),this.enterAREl||!i.enterAREnabled||"xr"!==i.XRMode&&"ar"!==i.XRMode||(i.enterARButton?(this.enterAREl=document.querySelector(i.enterARButton),this.enterAREl.addEventListener("click",this.onEnterARButtonClick)):(this.enterAREl=function(t,e){var n,i;return(i=document.createElement("div")).classList.add("a-enter-ar"),e&&i.classList.add("xr"),i.setAttribute(Sy,""),(n=document.createElement("button")).className="a-enter-ar-button",n.setAttribute("title","Enter AR mode with a headset or handheld device."),n.setAttribute(Sy,""),Wy()&&vM(n),i.appendChild(n),n.addEventListener("click",(function(e){t(),e.stopPropagation()})),i}(this.onEnterARButtonClick,"xr"===i.XRMode),r.appendChild(this.enterAREl))),this.orientationModalEl=function(t){var e=document.createElement("div");e.className="a-orientation-modal",e.classList.add(gM),e.setAttribute(Sy,"");var n=document.createElement("button");return n.setAttribute(Sy,""),n.innerHTML="Exit VR",n.addEventListener("click",t),e.appendChild(n),e}(this.onModalClick),r.appendChild(this.orientationModalEl),this.updateEnterInterfaces())},remove:function(){[this.enterVREl,this.enterAREl,this.orientationModalEl].forEach((function(t){t&&t.parentNode&&t.parentNode.removeChild(t)})),this.enterVREl=void 0,this.enterAREl=void 0,this.orientationModalEl=void 0},updateEnterInterfaces:function(){this.toggleEnterVRButtonIfNeeded(),this.toggleEnterARButtonIfNeeded(),this.toggleOrientationModalIfNeeded()},toggleEnterVRButtonIfNeeded:function(){var t=this.el;this.enterVREl&&(t.is("vr-mode")||(t.isMobile||Ky())&&!Hy()?this.enterVREl.classList.add(gM):(Hy()||this.enterVREl.classList.add("fullscreen"),this.enterVREl.classList.remove(gM),t.enterVR(!1,!0)))},toggleEnterARButtonIfNeeded:function(){var t=this.el;this.enterAREl&&(t.is("vr-mode")||!zy()?this.enterAREl.classList.add(gM):(this.enterAREl.classList.remove(gM),t.enterVR(!0,!0)))},toggleOrientationModalIfNeeded:function(){var t=this.el,e=this.orientationModalEl;e&&t.isMobile&&(!nE()&&t.is("vr-mode")?e.classList.remove(gM):e.classList.add(gM))}}),sC("box",{schema:{depth:{default:1,min:0},height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"},segmentsDepth:{default:1,min:1,max:20,type:"int"}},init:function(t){this.geometry=new _y.BoxGeometry(t.width,t.height,t.depth,t.segmentsWidth,t.segmentsHeight,t.segmentsDepth)}});var yM=_y.MathUtils.degToRad;sC("circle",{schema:{radius:{default:1,min:0},segments:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(t){this.geometry=new _y.CircleGeometry(t.radius,t.segments,yM(t.thetaStart),yM(t.thetaLength))}});var EM=_y.MathUtils.degToRad;sC("cone",{schema:{height:{default:1,min:0},openEnded:{default:!1},radiusBottom:{default:1,min:0},radiusTop:{default:.01,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(t){this.geometry=new _y.CylinderGeometry(t.radiusTop,t.radiusBottom,t.height,t.segmentsRadial,t.segmentsHeight,t.openEnded,EM(t.thetaStart),EM(t.thetaLength))}});var xM=_y.MathUtils.degToRad;sC("cylinder",{schema:{height:{default:1,min:0},openEnded:{default:!1},radius:{default:1,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(t){this.geometry=new _y.CylinderGeometry(t.radius,t.radius,t.height,t.segmentsRadial,t.segmentsHeight,t.openEnded,xM(t.thetaStart),xM(t.thetaLength))}}),sC("dodecahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(t){this.geometry=new _y.DodecahedronGeometry(t.radius,t.detail)}}),sC("icosahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(t){this.geometry=new _y.IcosahedronGeometry(t.radius,t.detail)}}),sC("octahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(t){this.geometry=new _y.OctahedronGeometry(t.radius,t.detail)}}),sC("plane",{schema:{height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"}},init:function(t){this.geometry=new _y.PlaneGeometry(t.width,t.height,t.segmentsWidth,t.segmentsHeight)}});var bM=_y.MathUtils.degToRad;sC("ring",{schema:{radiusInner:{default:.8,min:0},radiusOuter:{default:1.2,min:0},segmentsPhi:{default:10,min:1,type:"int"},segmentsTheta:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(t){this.geometry=new _y.RingGeometry(t.radiusInner,t.radiusOuter,t.segmentsTheta,t.segmentsPhi,bM(t.thetaStart),bM(t.thetaLength))}});var CM=_y.MathUtils.degToRad;sC("sphere",{schema:{radius:{default:1,min:0},phiLength:{default:360},phiStart:{default:0,min:0},thetaLength:{default:180,min:0},thetaStart:{default:0},segmentsHeight:{default:18,min:2,type:"int"},segmentsWidth:{default:36,min:3,type:"int"}},init:function(t){this.geometry=new _y.SphereGeometry(t.radius,t.segmentsWidth,t.segmentsHeight,CM(t.phiStart),CM(t.phiLength),CM(t.thetaStart),CM(t.thetaLength))}}),sC("tetrahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(t){this.geometry=new _y.TetrahedronGeometry(t.radius,t.detail)}});var wM=_y.MathUtils.degToRad;sC("torus",{schema:{arc:{default:360},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:36,min:2,type:"int"},segmentsTubular:{default:32,min:3,type:"int"}},init:function(t){this.geometry=new _y.TorusGeometry(t.radius,2*t.radiusTubular,t.segmentsRadial,t.segmentsTubular,wM(t.arc))}}),sC("torusKnot",{schema:{p:{default:2,min:1},q:{default:3,min:1},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:8,min:3,type:"int"},segmentsTubular:{default:100,min:3,type:"int"}},init:function(t){this.geometry=new _y.TorusKnotGeometry(t.radius,2*t.radiusTubular,t.segmentsTubular,t.segmentsRadial,t.p,t.q)}});var _M=new _y.Quaternion,MM=new _y.Vector3(0,0,1),SM=new _y.Vector2,IM=new _y.Vector2,BM=new _y.Vector2;function TM(t,e){return e.color.set(t.color),e.fog=t.fog,e.wireframe=t.wireframe,e.toneMapped=t.toneMapped,e.wireframeLinewidth=t.wireframeLinewidth,e}function RM(t,e){return e.color.set(t.color),e.emissive.set(t.emissive),e.emissiveIntensity=t.emissiveIntensity,e.fog=t.fog,e.metalness=t.metalness,e.roughness=t.roughness,e.wireframe=t.wireframe,e.wireframeLinewidth=t.wireframeLinewidth,t.normalMap&&(e.normalScale=t.normalScale),t.ambientOcclusionMap&&(e.aoMapIntensity=t.ambientOcclusionMapIntensity),t.displacementMap&&(e.displacementScale=t.displacementScale,e.displacementBias=t.displacementBias),e}function LM(t,e){switch(e.color.set(t.color),e.specular.set(t.specular),e.emissive.set(t.emissive),e.emissiveIntensity=t.emissiveIntensity,e.fog=t.fog,e.transparent=t.transparent,e.wireframe=t.wireframe,e.wireframeLinewidth=t.wireframeLinewidth,e.shininess=t.shininess,e.flatShading=t.flatShading,e.wireframe=t.wireframe,e.wireframeLinewidth=t.wireframeLinewidth,e.reflectivity=t.reflectivity,e.refractionRatio=t.refractionRatio,t.combine){case"mix":e.combine=_y.MixOperation;break;case"multiply":e.combine=_y.MultiplyOperation;break;case"add":e.combine=_y.AddOperation}return t.normalMap&&(e.normalScale=t.normalScale),t.ambientOcclusionMap&&(e.aoMapIntensity=t.ambientOcclusionMapIntensity),t.bumpMap&&(e.bumpScale=t.bumpMapScale),t.displacementMap&&(e.displacementScale=t.displacementScale,e.displacementBias=t.displacementBias),e}sC("triangle",{schema:{vertexA:{type:"vec3",default:{x:0,y:.5,z:0}},vertexB:{type:"vec3",default:{x:-.5,y:-.5,z:0}},vertexC:{type:"vec3",default:{x:.5,y:-.5,z:0}}},init:function(t){var e,n,i,r,s,o,a,l,c;(i=new _y.Triangle).a.set(t.vertexA.x,t.vertexA.y,t.vertexA.z),i.b.set(t.vertexB.x,t.vertexB.y,t.vertexB.z),i.c.set(t.vertexC.x,t.vertexC.y,t.vertexC.z),n=i.getNormal(new _y.Vector3),_M.setFromUnitVectors(n,MM),r=i.a.clone().applyQuaternion(_M),s=i.b.clone().applyQuaternion(_M),o=i.c.clone().applyQuaternion(_M),SM.set(Math.min(r.x,s.x,o.x),Math.min(r.y,s.y,o.y)),IM.set(Math.max(r.x,s.x,o.x),Math.max(r.y,s.y,o.y)),BM.set(0,0).subVectors(IM,SM),r=(new _y.Vector2).subVectors(r,SM).divide(BM),s=(new _y.Vector2).subVectors(s,SM).divide(BM),o=(new _y.Vector2).subVectors(o,SM).divide(BM),e=this.geometry=new _y.BufferGeometry,a=[i.a.x,i.a.y,i.a.z,i.b.x,i.b.y,i.b.z,i.c.x,i.c.y,i.c.z],l=[n.x,n.y,n.z,n.x,n.y,n.z,n.x,n.y,n.z],c=[r.x,r.y,s.x,s.y,o.x,o.y],e.setAttribute("position",new _y.Float32BufferAttribute(a,3)),e.setAttribute("normal",new _y.Float32BufferAttribute(l,3)),e.setAttribute("uv",new _y.Float32BufferAttribute(c,2))}}),vC("flat",{schema:{color:{type:"color"},fog:{default:!0},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},src:{type:"map"},wireframe:{default:!1},wireframeLinewidth:{default:2},toneMapped:{default:!0}},init:function(t){this.materialData={color:new _y.Color},TM(t,this.materialData),this.material=new _y.MeshBasicMaterial(this.materialData)},update:function(t){this.updateMaterial(t),OE(this,t)},updateMaterial:function(t){var e;for(e in TM(t,this.materialData),this.materialData)this.material[e]=this.materialData[e]}}),vC("standard",{schema:{ambientOcclusionMap:{type:"map"},ambientOcclusionMapIntensity:{default:1},ambientOcclusionTextureOffset:{type:"vec2"},ambientOcclusionTextureRepeat:{type:"vec2",default:{x:1,y:1}},color:{type:"color"},displacementMap:{type:"map"},displacementScale:{default:1},displacementBias:{default:.5},displacementTextureOffset:{type:"vec2"},displacementTextureRepeat:{type:"vec2",default:{x:1,y:1}},emissive:{type:"color",default:"#000"},emissiveIntensity:{default:1},envMap:{default:""},fog:{default:!0},metalness:{default:0,min:0,max:1},metalnessMap:{type:"map"},metalnessTextureOffset:{type:"vec2"},metalnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},normalMap:{type:"map"},normalScale:{type:"vec2",default:{x:1,y:1}},normalTextureOffset:{type:"vec2"},normalTextureRepeat:{type:"vec2",default:{x:1,y:1}},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},roughness:{default:.5,min:0,max:1},roughnessMap:{type:"map"},roughnessTextureOffset:{type:"vec2"},roughnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},sphericalEnvMap:{type:"map"},src:{type:"map"},wireframe:{default:!1},wireframeLinewidth:{default:2}},init:function(t){this.materialData={color:new _y.Color,emissive:new _y.Color},RM(t,this.materialData),this.material=new _y.MeshStandardMaterial(this.materialData)},update:function(t){this.updateMaterial(t),OE(this,t),FE("normal",this,t),FE("displacement",this,t),FE("ambientOcclusion",this,t),FE("metalness",this,t),FE("roughness",this,t),NE(this,t)},updateMaterial:function(t){var e,n=this.material;for(e in RM(t,this.materialData),this.materialData)n[e]=this.materialData[e]}}),vC("phong",{schema:{color:{type:"color"},emissive:{type:"color",default:"black"},emissiveIntensity:{default:1},specular:{type:"color",default:"#111111"},transparent:{default:!1},fog:{default:!0},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},src:{type:"map"},envMap:{default:""},sphericalEnvMap:{type:"map"},shininess:{default:30},flatShading:{default:!1},wireframe:{default:!1},wireframeLinewidth:{default:2},combine:{oneOF:["multiply","mix","add"],default:"mix"},reflectivity:{default:.9},refractionRatio:{default:.98},refract:{default:!1},normalMap:{type:"map"},normalScale:{type:"vec2",default:{x:1,y:1}},normalTextureOffset:{type:"vec2"},normalTextureRepeat:{type:"vec2",default:{x:1,y:1}},ambientOcclusionMap:{type:"map"},ambientOcclusionMapIntensity:{default:1},displacementMap:{type:"map"},displacementScale:{default:1},displacementBias:{default:.5},displacementTextureOffset:{type:"vec2"},displacementTextureRepeat:{type:"vec2",default:{x:1,y:1}},bumpMap:{type:"map"},bumpMapScale:{default:1},bumpTextureOffset:{type:"vec2"},bumpTextureRepeat:{type:"vec2",default:{x:1,y:1}}},init:function(t){this.materialData={color:new _y.Color,specular:new _y.Color,emissive:new _y.Color},LM(t,this.materialData),this.material=new _y.MeshPhongMaterial(this.materialData);var e=this.el.sceneEl;Object.defineProperty(this.material,"envMap",{get:function(){return this._envMap||e.object3D.environment},set:function(t){this._envMap=t}})},update:function(t){this.updateMaterial(t),OE(this,t),FE("normal",this,t),FE("displacement",this,t),FE("ambientOcclusion",this,t),FE("bump",this,t),NE(this,t)},updateMaterial:function(t){var e;for(e in LM(t,this.materialData),this.materialData)this.material[e]=this.materialData[e]}}),vC("sdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},opacity:{type:"number",is:"uniform",default:1}},vertexShader:["#include <common>","#include <fog_pars_vertex>","#include <logdepthbuf_pars_vertex>","out vec2 vUV;","void main(void) {"," vUV = uv;"," #include <begin_vertex>"," #include <project_vertex>"," #include <logdepthbuf_vertex>"," #include <fog_vertex>","}"].join("\n"),fragmentShader:["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","float contour(float width, float value) {"," return smoothstep(0.5 - value, 0.5 + value, width);","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec2 uv = vUV;"," vec4 texColor = texture(map, uv);"," float dist = texColor.a;"," float width = fwidth(dist);"," float alpha = contour(dist, width);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(uv) + dFdy(uv));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * dist;"," }"," if (isBigEnough <= BIG_ENOUGH) {"," vec4 box = vec4 (uv - duv, uv + duv);"," alpha = (alpha + 0.5 * ("," contour(texture(map, box.xy).a, width)"," + contour(texture(map, box.zw).a, width)"," + contour(texture(map, box.xw).a, width)"," + contour(texture(map, box.zy).a, width)"," )) / 3.0;"," }"," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," gl_FragColor = vec4(color, opacity * alpha);"," #include <logdepthbuf_fragment>"," #include <tonemapping_fragment>"," #include <colorspace_fragment>"," #include <fog_fragment>","}"].join("\n"),init:function(){return this.uniforms=_y.UniformsUtils.merge([_y.UniformsLib.fog,this.initUniforms()]),this.material=new _y.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,fog:!0}),this.material}}),vC("msdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},negate:{type:"boolean",is:"uniform",default:!0},opacity:{type:"number",is:"uniform",default:1}},vertexShader:["#include <common>","#include <fog_pars_vertex>","#include <logdepthbuf_pars_vertex>","out vec2 vUV;","void main(void) {"," vUV = uv;"," #include <begin_vertex>"," #include <project_vertex>"," #include <logdepthbuf_vertex>"," #include <fog_vertex>","}"].join("\n"),fragmentShader:["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","uniform bool negate;","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","float median(float r, float g, float b) {"," return max(min(r, g), min(max(r, g), b));","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec3 sampleColor = texture(map, vUV).rgb;"," if (negate) { sampleColor = 1.0 - sampleColor; }"," float sigDist = median(sampleColor.r, sampleColor.g, sampleColor.b) - 0.5;"," float alpha = clamp(sigDist / fwidth(sigDist) + 0.5, 0.0, 1.0);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(vUV) + dFdy(vUV));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," // Do modified alpha test."," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * (sigDist + 0.5);"," }"," // Do modified alpha test."," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," gl_FragColor = vec4(color.xyz, alpha * opacity);"," #include <logdepthbuf_fragment>"," #include <tonemapping_fragment>"," #include <colorspace_fragment>"," #include <fog_fragment>","}"].join("\n"),init:function(){return this.uniforms=_y.UniformsUtils.merge([_y.UniformsLib.fog,this.initUniforms()]),this.material=new _y.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,fog:!0}),this.material}}),vC("shadow",{schema:{opacity:{default:.5},transparent:{default:!0},alphaToCoverage:{default:!0}},init:function(t){this.material=new _y.ShadowMaterial},update:function(t){this.material.opacity=t.opacity,this.material.alphaToCoverage=t.alphaToCoverage,this.material.transparent=t.transparent}});var DM="data-aframe-default-camera";function PM(t){var e=t.primitive,n=nC[e]&&nC[e].Geometry,i=new n;if(!n)throw new Error("Unknown geometry `"+e+"`");return i.init(t),i.geometry}Db("camera",{init:function(){this.activeCameraEl=null,this.render=this.render.bind(this),this.unwrapRender=this.unwrapRender.bind(this),this.wrapRender=this.wrapRender.bind(this),this.initialCameraFound=!1,this.numUserCameras=0,this.numUserCamerasChecked=0,this.setupInitialCamera()},setupInitialCamera:function(){var t,e,n=this.sceneEl,i=this;if(!n.camera||n.camera.el.getAttribute("camera").spectator)if((t=n.querySelectorAll("a-camera, :not(a-mixin)[camera]")).length)for(this.numUserCameras=t.length,e=0;e<t.length;e++)t[e].addEventListener("object3dset",(function(t){"camera"===t.detail.type&&i.checkUserCamera(this)})),t[e].isNode?t[e].load():t[e].addEventListener("nodeready",(function(){this.load()}));else this.createDefaultCamera();else n.emit("cameraready",{cameraEl:n.camera.el})},checkUserCamera:function(t){var e,n=this.el.sceneEl;this.numUserCamerasChecked++,this.initialCameraFound||((e=t.getAttribute("camera")).active&&!e.spectator?(this.initialCameraFound=!0,n.camera=t.getObject3D("camera"),n.emit("cameraready",{cameraEl:t})):this.numUserCamerasChecked===this.numUserCameras&&this.createDefaultCamera())},createDefaultCamera:function(){var t,e=this.sceneEl;(t=document.createElement("a-entity")).setAttribute("camera",{active:!0}),t.setAttribute("position",{x:0,y:1.6,z:0}),t.setAttribute("wasd-controls",""),t.setAttribute("look-controls",""),t.setAttribute(Sy,""),t.addEventListener("object3dset",(function(n){"camera"===n.detail.type&&(e.camera=n.detail.object,e.emit("cameraready",{cameraEl:t}))})),e.appendChild(t)},disableActiveCamera:function(){var t;(t=this.sceneEl.querySelectorAll(":not(a-mixin)[camera]"))[t.length-1].setAttribute("camera","active",!0)},setActiveCamera:function(t){var e,n,i,r,s=this.activeCameraEl,o=this.sceneEl;if((r=t.getObject3D("camera"))&&t!==this.activeCameraEl){var a=o.querySelector("["+DM+"]");for(t!==(a&&a.querySelector(":not(a-mixin)[camera]"))&&function(t){var e;t.camera&&(e=t.querySelector("["+DM+"]"))&&t.removeChild(e)}(o),this.activeCameraEl=t,this.activeCameraEl.play(),o.camera=r,s&&s.setAttribute("camera","active",!1),n=o.querySelectorAll(":not(a-mixin)[camera]"),i=0;i<n.length;i++)(e=n[i]).isEntity&&t!==e&&(e.setAttribute("camera","active",!1),e.pause());o.emit("camera-set-active",{cameraEl:t})}},setSpectatorCamera:function(t){var e,n=this.spectatorCameraEl,i=this.sceneEl;t.getObject3D("camera")&&t!==this.spectatorCameraEl&&(n&&n.setAttribute("camera","spectator",!1),e=this.spectatorCameraEl=t,i.addEventListener("enter-vr",this.wrapRender),i.addEventListener("exit-vr",this.unwrapRender),e.setAttribute("camera","active",!1),e.play(),i.emit("camera-set-spectator",{cameraEl:t}))},disableSpectatorCamera:function(){this.spectatorCameraEl=void 0},wrapRender:function(){this.spectatorCameraEl&&!this.originalRender&&(this.originalRender=this.sceneEl.renderer.render,this.sceneEl.renderer.render=this.render)},unwrapRender:function(){this.originalRender&&(this.sceneEl.renderer.render=this.originalRender,this.originalRender=void 0)},render:function(t,e){var n,i,r=this.sceneEl;n=r.renderer.xr.enabled,this.originalRender.call(r.renderer,t,e),this.spectatorCameraEl&&!r.isMobile&&n&&(i=this.spectatorCameraEl.components.camera.camera,r.renderer.xr.enabled=!1,this.originalRender.call(r.renderer,t,i),r.renderer.xr.enabled=n)}}),Db("geometry",{init:function(){this.cache={},this.cacheCount={}},clearCache:function(){this.cache={},this.cacheCount={}},getOrCreateGeometry:function(t){var e,n,i=this.cache;return t.skipCache?PM(t):(e=i[n=this.hash(t)],function(t,e){t[e]=void 0===t[e]?1:t[e]+1}(this.cacheCount,n),e||(e=PM(t),i[n]=e,e))},unuseGeometry:function(t){var e,n=this.cache,i=this.cacheCount;t.skipCache||n[e=this.hash(t)]&&(function(t,e){t[e]--}(i,e),i[e]>0||(n[e].dispose(),delete n[e],delete i[e]))},hash:function(t){return JSON.stringify(t)}}),Db("gltf-model",{schema:{dracoDecoderPath:{default:"https://www.gstatic.com/draco/versioned/decoders/1.5.7/"},basisTranscoderPath:{default:""},meshoptDecoderPath:{default:""}},init:function(){this.update()},update:function(){var t=this.data.dracoDecoderPath,e=this.data.basisTranscoderPath,n=this.data.meshoptDecoderPath;!this.dracoLoader&&t&&(this.dracoLoader=new _y.DRACOLoader,this.dracoLoader.setDecoderPath(t)),!this.ktx2Loader&&e&&(this.ktx2Loader=new _y.KTX2Loader,this.ktx2Loader.setTranscoderPath(e).detectSupport(this.el.renderer)),!this.meshoptDecoder&&n&&(this.meshoptDecoder=function(t){return new Promise((function(e,n){var i=document.createElement("script");document.body.appendChild(i),i.onload=e,i.onerror=n,i.async=!0,i.src=t}))}(n).then((function(){return window.MeshoptDecoder.ready})).then((function(){return window.MeshoptDecoder})))},getDRACOLoader:function(){return this.dracoLoader},getKTX2Loader:function(){return this.ktx2Loader},getMeshoptDecoder:function(){return this.meshoptDecoder}});var UM="data-aframe-default-light",OM=(Db("light",{schema:{defaultLightsEnabled:{default:!0}},init:function(){this.defaultLights=!1,this.userDefinedLights=!1,this.sceneEl.addEventListener("loaded",this.setupDefaultLights.bind(this))},registerLight:function(t){t.hasAttribute(UM)||(this.removeDefaultLights(),this.userDefinedLights=!0)},removeDefaultLights:function(){var t,e=this.sceneEl;if(this.defaultLights){t=document.querySelectorAll("["+UM+"]");for(var n=0;n<t.length;n++)e.removeChild(t[n]);this.defaultLights=!1}},setupDefaultLights:function(){var t,e,n=this.sceneEl;this.userDefinedLights||this.defaultLights||!this.data.defaultLightsEnabled||((t=document.createElement("a-entity")).setAttribute("light",{color:"#BBB",type:"ambient"}),t.setAttribute(UM,""),t.setAttribute(Sy,""),n.appendChild(t),(e=document.createElement("a-entity")).setAttribute("light",{color:"#FFF",intensity:1.884,castShadow:!0}),e.setAttribute("position",{x:-.5,y:1,z:1}),e.setAttribute(UM,""),e.setAttribute(Sy,""),n.appendChild(e),this.defaultLights=!0)}}),Ly),FM=OM("components:texture:error"),kM=OM("components:texture:warn"),NM=new _y.ImageLoader;Db("material",{init:function(){this.materials={},this.sourceCache={}},clearTextureSourceCache:function(){this.sourceCache={}},loadTexture:function(t,e,n){this.loadTextureSource(t,(function(t){var i=zE(t);PE(i,e),n(i)}))},loadTextureSource:function(t,e){var n=this,i=this.sourceCache,r=this.hash(t);function s(t){i[r]=Promise.resolve(t),i[r].then(e)}i[r]?i[r].then(e):"CANVAS"!==t.tagName?s(new Promise((function(e,i){SE(t,(function(t){n.loadImage(t,e)}),(function(t){n.loadVideo(t,e)}))}))):s(new _y.Source(t))},loadCubeMapTexture:function(t,e){var n=this,i=0,r=new _y.CubeTexture;function s(s){n.loadTextureSource(t[s],(function(t){r.images[s]=t.data,6==++i&&(r.needsUpdate=!0,e(r))}))}if(r.colorSpace=_y.SRGBColorSpace,6===t.length)for(var o=0;o<t.length;o++)s(o);else kM("Cube map texture requires exactly 6 sources, got only %s sources",t.length)},loadImage:function(t,e){e("string"==typeof t?function(t){return new Promise((function(e,n){NM.load(t,(function(t){e(new _y.Source(t))}),(function(){}),(function(t){FM("`$s` could not be fetched (Error code: %s; Response: %s)",t.status,t.statusText)}))}))}(t):new _y.Source(t))},loadVideo:function(t,e){var n;"string"!=typeof t&&function(t){t.autoplay=t.hasAttribute("autoplay")&&"false"!==t.getAttribute("autoplay"),t.controls=t.hasAttribute("controls")&&"false"!==t.getAttribute("controls"),"false"===t.getAttribute("loop")&&t.removeAttribute("loop"),"false"===t.getAttribute("preload")&&(t.preload="none"),t.crossOrigin=t.crossOrigin||"anonymous",t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline","")}(n=t),n=n||function(t){var e=document.createElement("video");return e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline",""),e.autoplay=!0,e.loop=!0,e.crossOrigin="anonymous",e.addEventListener("error",(function(){kM("`%s` is not a valid video",t)}),!0),e.src=t,e}(t),e(new _y.Source(n))},hash:function(t){return t.tagName&&(t.id||t.src)||t},registerMaterial:function(t){this.materials[t.uuid]=t},unregisterMaterial:function(t){delete this.materials[t.uuid]}}),Db("obb-collider",{schema:{showColliders:{default:!1}},init:function(){this.collisions=[],this.colliderEls=[]},addCollider:function(t){this.colliderEls.push(t),this.data.showColliders?t.components["obb-collider"].showCollider():t.components["obb-collider"].hideCollider(),this.tick=this.detectCollisions},removeCollider:function(t){var e=this.colliderEls,n=e.indexOf(t);t.components["obb-collider"].hideCollider(),n>-1&&e.splice(n,1),0===e.length&&(this.tick=void 0)},registerCollision:function(t,e){var n=this.collisions,i=!1,r=t.obb,s=e.obb,o=t.renderColliderMesh,a=e.renderColliderMesh;o&&o.material.color.set(16711680),a&&a.material.color.set(16711680);for(var l=0;l<n.length;l++)if(n[l].componentA.obb===r&&n[l].componentB.obb===s||n[l].componentA.obb===s&&n[l].componentB.obb===r){i=!0,n[l].detected=!0;break}i||(n.push({componentA:t,componentB:e,detected:!0}),t.el.emit("obbcollisionstarted",{trackedObject3D:t.trackedObject3D,withEl:e.el}),e.el.emit("obbcollisionstarted",{trackedObject3D:e.trackedObject3D,withEl:t.el}))},resetCollisions:function(){for(var t=this.collisions,e=0;e<t.length;e++)t[e].detected=!1},clearCollisions:function(){for(var t,e,n,i,r=this.collisions,s=[],o=0;o<r.length;o++)r[o].detected?s.push(r[o]):(t=r[o].componentA,e=r[o].componentB,n=t.renderColliderMesh,i=e.renderColliderMesh,n&&n.material.color.set(65280),t.el.emit("obbcollisionended",{trackedObject3D:this.trackedObject3D,withEl:e.el}),i&&i.material.color.set(65280),e.el.emit("obbcollisionended",{trackedObject3D:this.trackedObject3D,withEl:t.el}));this.collisions=s},detectCollisions:function(){var t,e,n,i,r=this.colliderEls;if(!(r.length<2)){this.resetCollisions();for(var s=0;s<r.length;s++)if(n=r[s].components["obb-collider"],0!==(t=r[s].components["obb-collider"].obb).halfSize.x&&0!==t.halfSize.y&&0!==t.halfSize.z)for(var o=s+1;o<r.length;o++)0!==(e=(i=r[o].components["obb-collider"]).obb).halfSize.x&&0!==e.halfSize.y&&0!==e.halfSize.z&&t.intersectsOBB(e)&&this.registerCollision(n,i);this.clearCollisions()}}});var QM=Ly("components:renderer:warn");function GM(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z-e.z}function zM(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder-e.renderOrder}function HM(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:e.z-t.z}Db("renderer",{schema:{antialias:{default:"auto",oneOf:["true","false","auto"]},highRefreshRate:{default:Zy()},logarithmicDepthBuffer:{default:"auto",oneOf:["true","false","auto"]},maxCanvasWidth:{default:-1},maxCanvasHeight:{default:-1},multiviewStereo:{default:!1},exposure:{default:1,if:{toneMapping:["ACESFilmic","linear","reinhard","cineon","AgX","neutral"]}},toneMapping:{default:"no",oneOf:["no","ACESFilmic","linear","reinhard","cineon","AgX","neutral"]},precision:{default:"high",oneOf:["high","medium","low"]},anisotropy:{default:1},sortTransparentObjects:{default:!1},colorManagement:{default:!0},alpha:{default:!0},stencil:{default:!1},foveationLevel:{default:1}},init:function(){var t=this.data,e=this.el,n=this.data.toneMapping.charAt(0).toUpperCase()+this.data.toneMapping.slice(1),i=e.renderer;i.toneMapping=_y[n+"ToneMapping"],_y.Texture.DEFAULT_ANISOTROPY=t.anisotropy,_y.ColorManagement.enabled=t.colorManagement,i.outputColorSpace=t.colorManagement?_y.SRGBColorSpace:_y.LinearSRGBColorSpace,e.hasAttribute("antialias")&&QM('Component `antialias` is deprecated. Use `renderer="antialias: true"` instead.'),e.hasAttribute("logarithmicDepthBuffer")&&QM('Component `logarithmicDepthBuffer` is deprecated. Use `renderer="logarithmicDepthBuffer: true"` instead.'),i.sortObjects=!0,i.setOpaqueSort(GM)},update:function(){var t=this.data,e=this.el.renderer,n=this.data.toneMapping.charAt(0).toUpperCase()+this.data.toneMapping.slice(1);e.toneMapping=_y[n+"ToneMapping"],e.toneMappingExposure=t.exposure,e.xr.setFoveation(t.foveationLevel),t.sortObjects&&QM('`sortObjects` property is deprecated. Use `renderer="sortTransparentObjects: true"` instead.'),t.sortTransparentObjects?e.setTransparentSort(HM):e.setTransparentSort(zM)},applyColorCorrection:function(t){this.data.colorManagement&&t&&t.isTexture&&t.colorSpace!==_y.SRGBColorSpace&&(t.colorSpace=_y.SRGBColorSpace,t.needsUpdate=!0)},setWebXRFrameRate:function(t){var e,n=this.data,i=t.supportedFrameRates;i&&t.updateTargetFrameRate&&(e=i.includes(90)?n.highRefreshRate?90:72:n.highRefreshRate?72:60,t.updateTargetFrameRate(e).catch((function(t){console.warn("failed to set target frame rate of "+e+". Error info: "+t)})))}});var VM={basic:_y.BasicShadowMap,pcf:_y.PCFShadowMap,pcfsoft:_y.PCFSoftShadowMap};Db("shadow",{schema:{enabled:{default:!0},autoUpdate:{default:!0},type:{default:"pcf",oneOf:["basic","pcf","pcfsoft"]}},init:function(){var t=this.sceneEl,e=this.data;this.shadowMapEnabled=!1,t.renderer.shadowMap.type=VM[e.type],t.renderer.shadowMap.autoUpdate=e.autoUpdate},update:function(t){t.enabled!==this.data.enabled&&this.setShadowMapEnabled(this.shadowMapEnabled)},setShadowMapEnabled:function(t){var e=this.sceneEl,n=this.sceneEl.renderer;this.shadowMapEnabled=t;var i=this.data.enabled&&this.shadowMapEnabled;n&&i!==n.shadowMap.enabled&&(n.shadowMap.enabled=i,function(t){t.hasLoaded&&t.object3D.traverse((function(t){if(t.material)for(var e=Array.isArray(t.material)?t.material:[t.material],n=0;n<e.length;n++)e[n].needsUpdate=!0}))}(e))}}),Db("tracked-controls",{init:function(){this.controllers=[],this.onInputSourcesChange=this.onInputSourcesChange.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.el.addEventListener("enter-vr",this.onEnterVR),this.onExitVR=this.onExitVR.bind(this),this.el.addEventListener("exit-vr",this.onExitVR)},onEnterVR:function(){this.el.xrSession&&this.el.xrSession.addEventListener("inputsourceschange",this.onInputSourcesChange)},onExitVR:function(){this.referenceSpace=void 0,this.controllers=[],this.el.emit("controllersupdated",void 0,!1)},onInputSourcesChange:function(){var t=this,e=this.el.xrSession,n=this.el.sceneEl.systems.webxr.sessionReferenceSpaceType;e.requestReferenceSpace(n).then((function(e){t.referenceSpace=e})).catch((function(e){throw t.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(n,'tracked-controls uses reference space "'+n+'".'),e})),this.controllers=e.inputSources,this.el.emit("controllersupdated",void 0,!1)}});var jM=Ly("systems:webxr:warn"),WM=(Db("webxr",{schema:{referenceSpaceType:{type:"string",default:"local-floor"},requiredFeatures:{type:"array",default:["local-floor"]},optionalFeatures:{type:"array",default:["bounded-floor"]},overlayElement:{type:"selector"}},update:function(){var t=this.data;this.sessionConfiguration={requiredFeatures:t.requiredFeatures,optionalFeatures:t.optionalFeatures},this.sessionReferenceSpaceType=t.referenceSpaceType,t.overlayElement&&(t.overlayElement.classList.remove("a-dom-overlay"),t.optionalFeatures.includes("dom-overlay")||(t.optionalFeatures.push("dom-overlay"),this.el.setAttribute("webxr",t)),this.warnIfFeatureNotRequested("dom-overlay"),this.sessionConfiguration.domOverlay={root:t.overlayElement},t.overlayElement.classList.add("a-dom-overlay"))},wasFeatureRequested:function(t){return"viewer"===t||"local"===t||!(!this.sessionConfiguration.requiredFeatures.includes(t)&&!this.sessionConfiguration.optionalFeatures.includes(t))},warnIfFeatureNotRequested:function(t,e){this.wasFeatureRequested(t)||jM((e?e+" ":"")+'Please add the feature "'+t+"\" to a-scene's webxr system options in requiredFeatures/optionalFeatures.")}}),{});function qM(t){var e=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();"fog"===t&&(e="material-fog"),"visible"===t&&(e="material-visible"),WM[e]="material."+t}function XM(){return{defaultComponents:{material:{}},mappings:dx({},WM)}}Object.keys(cb.material.schema).forEach(qM),Object.keys(AC.standard.schema).forEach(qM);var YM=new _y.Vector3,JM=new _y.Vector3;_b("pivot",{dependencies:["position"],schema:{type:"vec3"},init:function(){var t=this.data,e=this.el,n=e.object3D.parent,i=e.object3D,r=new _y.Group;YM.copy(i.position),JM.copy(i.rotation),n.remove(i),r.add(i),n.add(r),e.object3D=r,i.position.set(-1*t.x,-1*t.y,-1*t.z),r.position.set(t.x+YM.x,t.y+YM.y,t.z+YM.z),r.rotation.copy(i.rotation),i.rotation.set(0,0,0)}}),dC("a-camera",{defaultComponents:{camera:{},"look-controls":{},"wasd-controls":{},position:{x:0,y:1.6,z:0}},mappings:{active:"camera.active",far:"camera.far",fov:"camera.fov","look-controls-enabled":"look-controls.enabled",near:"camera.near","pointer-lock-enabled":"look-controls.pointerLockEnabled","wasd-controls-enabled":"wasd-controls.enabled","reverse-mouse-drag":"look-controls.reverseMouseDrag",zoom:"camera.zoom"}}),dC("a-cursor",px({},XM(),{defaultComponents:{cursor:{},geometry:{primitive:"ring",radiusOuter:.016,radiusInner:.01,segmentsTheta:32},material:{color:"#000",shader:"flat",opacity:.8},position:{x:0,y:0,z:-1}},mappings:{far:"raycaster.far",fuse:"cursor.fuse","fuse-timeout":"cursor.fuseTimeout",interval:"raycaster.interval",objects:"raycaster.objects"}})),dC("a-curvedimage",px({},XM(),{defaultComponents:{geometry:{height:1,primitive:"cylinder",radius:2,segmentsRadial:48,thetaLength:270,openEnded:!0,thetaStart:0},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0,repeat:"-1 1"}},mappings:{height:"geometry.height","open-ended":"geometry.openEnded",radius:"geometry.radius",segments:"geometry.segmentsRadial",start:"geometry.thetaStart","theta-length":"geometry.thetaLength","theta-start":"geometry.thetaStart",width:"geometry.thetaLength"}})),dC("a-gltf-model",{mappings:{src:"gltf-model"}}),dC("a-image",px({},XM(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}})),dC("a-light",{defaultComponents:{light:{}},mappings:{angle:"light.angle",color:"light.color","ground-color":"light.groundColor",decay:"light.decay",distance:"light.distance",intensity:"light.intensity",penumbra:"light.penumbra",type:"light.type",target:"light.target",envmap:"light.envMap","shadow-camera-automatic":"light.shadowCameraAutomatic"}}),dC("a-link",{defaultComponents:{link:{visualAspectEnabled:!0}},mappings:{href:"link.href",image:"link.image",title:"link.title"}}),dC("a-obj-model",px({},XM(),{defaultComponents:{"obj-model":{}},mappings:{src:"obj-model.obj",mtl:"obj-model.mtl"}}));const KM={},ZM=KM;function $M(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var tS,eS;iC.forEach((function(t){var e=nC[t],n=$M(t),i={};Object.keys(e.schema).forEach((function(t){i[$M(t)]="geometry."+t}));var r="a-"+n,s=dC(r,px({},XM(),{defaultComponents:{geometry:{primitive:t}},mappings:i}));KM[r]=s})),dC("a-sky",px({},XM(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",side:"back",shader:"flat",npot:!0},scale:"-1 1 1"},mappings:px({},ZM["a-sphere"].mappings)})),dC("a-sound",{defaultComponents:{sound:{}},mappings:{src:"sound.src",on:"sound.on",autoplay:"sound.autoplay",loop:"sound.loop",volume:"sound.volume"}}),tS={text:{anchor:"align",width:5}},eS=eS||{},Object.keys(tS).forEach((function(t){!function(t,e){var n=cb[t].schema;Object.keys(n).forEach((function(n){var i=n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();void 0!==e[i]&&(i=t+"-"+n),e[i]=t+"."+n}))}(t,eS)})),dC("a-text",px({},null,{defaultComponents:tS,mappings:eS})),dC("a-video",px({},XM(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}})),dC("a-videosphere",px({},XM(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",shader:"flat",side:"back",npot:!0},scale:"-1 1 1"},mappings:{radius:"geometry.radius","segments-height":"geometry.segmentsHeight","segments-width":"geometry.segmentsWidth"}}));var nS=Ly,iS=nS("A-Frame:error"),rS=nS("A-Frame:warn");window.document.currentScript&&window.document.currentScript.parentNode!==window.document.head&&!window.debug&&rS("Put the A-Frame <script> tag in the <head> of the HTML *before* the scene to ensure everything for A-Frame is properly registered before they are used from HTML."),window.cordova||"file:"!==window.location.protocol||iS("This HTML file is currently being served via the file:// protocol. Assets, textures, and models WILL NOT WORK due to cross-origin policy! Please use a local or hosted server: https://aframe.io/docs/1.4.0/introduction/installation.html#use-a-local-server."),iE&&(window.logs=nS,n(7180),n(9379)),console.log("A-Frame Version: 1.6.0 (Date 2025-02-09, Commit #b9e4838)"),console.log("THREE Version (https://github.com/supermedium/three.js):",_y.REVISION),window.AFRAME_ASYNC||("complete"!==document.readyState?document.addEventListener("readystatechange",(function t(){"complete"===document.readyState&&(document.removeEventListener("readystatechange",t),Bb())})):Bb());const sS=globalThis.AFRAME={AComponent:Cb,AEntity:Hb,ANode:Fb,ANIME:Rt,AScene:Kb,components:cb,coreComponents:Object.keys(cb),geometries:nC,registerComponent:_b,registerGeometry:sC,registerPrimitive:dC,registerShader:vC,registerSystem:Db,primitives:{getMeshMixin:XM,primitives:uC},scenes:Fx,schema:p,shaders:AC,systems:Rb,emitReady:Bb,THREE:_y,utils:d,version:_C}})(),i.default})())); //# sourceMappingURL=aframe-master.min.js.map \ No newline at end of file diff --git a/dist/xrfragment.aframe.all.js b/dist/xrfragment.aframe.all.js index 6c6d565..cbae79a 100644 --- a/dist/xrfragment.aframe.all.js +++ b/dist/xrfragment.aframe.all.js @@ -1,11 +1,16 @@ /* + * v0.5.1 generated at Sun Feb 9 12:52:39 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.AFRAME=e():t.AFRAME=e()}(self,(()=>(()=>{var t={8167:t=>{var e=Object.prototype.toString;t.exports=function(t){return t.BYTES_PER_ELEMENT&&"[object ArrayBuffer]"===e.call(t.buffer)||Array.isArray(t)}},5734:t=>{t.exports=function(t,e){return"number"==typeof t?t:"number"==typeof e?e:0}},7961:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),n=e[0],i=e[1];return 3*(n+i)/4-i},e.toByteArray=function(t){var e,n,s=a(t),o=s[0],l=s[1],c=new r(function(t,e,n){return 3*(e+n)/4-n}(0,o,l)),h=0,u=l>0?o-4:o;for(n=0;n<u;n+=4)e=i[t.charCodeAt(n)]<<18|i[t.charCodeAt(n+1)]<<12|i[t.charCodeAt(n+2)]<<6|i[t.charCodeAt(n+3)],c[h++]=e>>16&255,c[h++]=e>>8&255,c[h++]=255&e;return 2===l&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,c[h++]=255&e),1===l&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,c[h++]=e>>8&255,c[h++]=255&e),c},e.fromByteArray=function(t){for(var e,i=t.length,r=i%3,s=[],o=16383,a=0,c=i-r;a<c;a+=o)s.push(l(t,a,a+o>c?c:a+o));return 1===r?(e=t[i-1],s.push(n[e>>2]+n[e<<4&63]+"==")):2===r&&(e=(t[i-2]<<8)+t[i-1],s.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),s.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)n[o]=s[o],i[s.charCodeAt(o)]=o;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function l(t,e,i){for(var r,s,o=[],a=e;a<i;a+=3)r=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(n[(s=r)>>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},911:(t,e,n)=>{var i=n(9922).hp;t.exports=function(t,e){if(i.isBuffer(t)&&i.isBuffer(e)){if("function"==typeof t.equals)return t.equals(e);if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}}},9922:(t,e,n)=>{"use strict";const i=n(7961),r=n(1024),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=l,e.IS=50;const o=2147483647;function a(t){if(t>o)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,l.prototype),e}function l(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return c(t,e,n)}function c(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!l.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|f(t,e);let i=a(n);const r=i.write(t,e);return r!==n&&(i=i.slice(0,r)),i}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return p(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return p(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return l.from(i,e,n);const r=function(t){if(l.isBuffer(t)){const e=0|A(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||J(t.length)?a(0):d(t):"Buffer"===t.type&&Array.isArray(t.data)?d(t.data):void 0}(t);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return l.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return h(t),a(t<0?0:0|A(t))}function d(t){const e=t.length<0?0:0|A(t.length),n=a(e);for(let i=0;i<e;i+=1)n[i]=255&t[i];return n}function p(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(i,l.prototype),i}function A(t){if(t>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function f(t,e){if(l.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;let r=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(r)return i?-1:W(t).length;e=(""+e).toLowerCase(),r=!0}}function m(t,e,n){let i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,n);case"utf8":case"utf-8":return M(this,e,n);case"ascii":return I(this,e,n);case"latin1":case"binary":return B(this,e,n);case"base64":return _(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function g(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function v(t,e,n,i,r){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof e&&(e=l.from(e,i)),l.isBuffer(e))return 0===e.length?-1:y(t,e,n,i,r);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,i,r){let s,o=1,a=t.length,l=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,a/=2,l/=2,n/=2}function c(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(r){let i=-1;for(s=n;s<a;s++)if(c(t,s)===c(e,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===l)return i*o}else-1!==i&&(s-=s-i),i=-1}else for(n+l>a&&(n=a-l),s=n;s>=0;s--){let n=!0;for(let i=0;i<l;i++)if(c(t,s+i)!==c(e,i)){n=!1;break}if(n)return s}return-1}function E(t,e,n,i){n=Number(n)||0;const r=t.length-n;i?(i=Number(i))>r&&(i=r):i=r;const s=e.length;let o;for(i>s/2&&(i=s/2),o=0;o<i;++o){const i=parseInt(e.substr(2*o,2),16);if(J(i))return o;t[n+o]=i}return o}function x(t,e,n,i){return X(W(e,t.length-n),t,n,i)}function b(t,e,n,i){return X(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,i)}function C(t,e,n,i){return X(q(e),t,n,i)}function w(t,e,n,i){return X(function(t,e){let n,i,r;const s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)n=t.charCodeAt(o),i=n>>8,r=n%256,s.push(r),s.push(i);return s}(e,t.length-n),t,n,i)}function _(t,e,n){return 0===e&&n===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,n))}function M(t,e,n){n=Math.min(t.length,n);const i=[];let r=e;for(;r<n;){const e=t[r];let s=null,o=e>239?4:e>223?3:e>191?2:1;if(r+o<=n){let n,i,a,l;switch(o){case 1:e<128&&(s=e);break;case 2:n=t[r+1],128==(192&n)&&(l=(31&e)<<6|63&n,l>127&&(s=l));break;case 3:n=t[r+1],i=t[r+2],128==(192&n)&&128==(192&i)&&(l=(15&e)<<12|(63&n)<<6|63&i,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:n=t[r+1],i=t[r+2],a=t[r+3],128==(192&n)&&128==(192&i)&&128==(192&a)&&(l=(15&e)<<18|(63&n)<<12|(63&i)<<6|63&a,l>65535&&l<1114112&&(s=l))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),r+=o}return function(t){const e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);let n="",i=0;for(;i<e;)n+=String.fromCharCode.apply(String,t.slice(i,i+=S));return n}(i)}l.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(t,e,n){return c(t,e,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(t,e,n){return function(t,e,n){return h(t),t<=0?a(t):void 0!==e?"string"==typeof n?a(t).fill(e,n):a(t).fill(e):a(t)}(t,e,n)},l.allocUnsafe=function(t){return u(t)},l.allocUnsafeSlow=function(t){return u(t)},l.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==l.prototype},l.compare=function(t,e){if(Y(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(t)||!l.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,i=e.length;for(let r=0,s=Math.min(n,i);r<s;++r)if(t[r]!==e[r]){n=t[r],i=e[r];break}return n<i?-1:i<n?1:0},l.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return l.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const i=l.allocUnsafe(e);let r=0;for(n=0;n<t.length;++n){let e=t[n];if(Y(e,Uint8Array))r+e.length>i.length?(l.isBuffer(e)||(e=l.from(e)),e.copy(i,r)):Uint8Array.prototype.set.call(i,e,r);else{if(!l.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(i,r)}r+=e.length}return i},l.byteLength=f,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)g(this,e,e+1);return this},l.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},l.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},l.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?M(this,0,t):m.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(t){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===l.compare(this,t)},l.prototype.inspect=function(){let t="";const n=e.IS;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},s&&(l.prototype[s]=l.prototype.inspect),l.prototype.compare=function(t,e,n,i,r){if(Y(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(this===t)return 0;let s=(r>>>=0)-(i>>>=0),o=(n>>>=0)-(e>>>=0);const a=Math.min(s,o),c=this.slice(i,r),h=t.slice(e,n);for(let t=0;t<a;++t)if(c[t]!==h[t]){s=c[t],o=h[t];break}return s<o?-1:o<s?1:0},l.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},l.prototype.indexOf=function(t,e,n){return v(this,t,e,n,!0)},l.prototype.lastIndexOf=function(t,e,n){return v(this,t,e,n,!1)},l.prototype.write=function(t,e,n,i){if(void 0===e)i="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)i=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}const r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return E(this,t,e,n);case"utf8":case"utf-8":return x(this,t,e,n);case"ascii":case"latin1":case"binary":return b(this,t,e,n);case"base64":return C(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const S=4096;function I(t,e,n){let i="";n=Math.min(t.length,n);for(let r=e;r<n;++r)i+=String.fromCharCode(127&t[r]);return i}function B(t,e,n){let i="";n=Math.min(t.length,n);for(let r=e;r<n;++r)i+=String.fromCharCode(t[r]);return i}function T(t,e,n){const i=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>i)&&(n=i);let r="";for(let i=e;i<n;++i)r+=K[t[i]];return r}function R(t,e,n){const i=t.slice(e,n);let r="";for(let t=0;t<i.length-1;t+=2)r+=String.fromCharCode(i[t]+256*i[t+1]);return r}function L(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,n,i,r,s){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||e<s)throw new RangeError('"value" argument is out of bounds');if(n+i>t.length)throw new RangeError("Index out of range")}function P(t,e,n,i,r){z(e,i,r,t,n,7);let s=Number(e&BigInt(4294967295));t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,n}function U(t,e,n,i,r){z(e,i,r,t,n,7);let s=Number(e&BigInt(4294967295));t[n+7]=s,s>>=8,t[n+6]=s,s>>=8,t[n+5]=s,s>>=8,t[n+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=o,o>>=8,t[n+2]=o,o>>=8,t[n+1]=o,o>>=8,t[n]=o,n+8}function O(t,e,n,i,r,s){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(t,e,n,i,s){return e=+e,n>>>=0,s||O(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function k(t,e,n,i,s){return e=+e,n>>>=0,s||O(t,0,n,8),r.write(t,e,n,i,52,8),n+8}l.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const i=this.subarray(t,e);return Object.setPrototypeOf(i,l.prototype),i},l.prototype.readUintLE=l.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let i=this[t],r=1,s=0;for(;++s<e&&(r*=256);)i+=this[t+s]*r;return i},l.prototype.readUintBE=l.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let i=this[t+--e],r=1;for(;e>0&&(r*=256);)i+=this[t+--e]*r;return i},l.prototype.readUint8=l.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readBigUInt64LE=Z((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const i=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,r=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(i)+(BigInt(r)<<BigInt(32))})),l.prototype.readBigUInt64BE=Z((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const i=e*2**24+65536*this[++t]+256*this[++t]+this[++t],r=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(i)<<BigInt(32))+BigInt(r)})),l.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let i=this[t],r=1,s=0;for(;++s<e&&(r*=256);)i+=this[t+s]*r;return r*=128,i>=r&&(i-=Math.pow(2,8*e)),i},l.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let i=e,r=1,s=this[t+--i];for(;i>0&&(r*=256);)s+=this[t+--i]*r;return r*=128,s>=r&&(s-=Math.pow(2,8*e)),s},l.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readBigInt64LE=Z((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const i=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),l.prototype.readBigInt64BE=Z((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const i=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),l.prototype.readFloatLE=function(t,e){return t>>>=0,e||L(t,4,this.length),r.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),r.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),r.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),r.read(this,t,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(t,e,n,i){t=+t,e>>>=0,n>>>=0,i||D(this,t,e,n,Math.pow(2,8*n)-1,0);let r=1,s=0;for(this[e]=255&t;++s<n&&(r*=256);)this[e+s]=t/r&255;return e+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(t,e,n,i){t=+t,e>>>=0,n>>>=0,i||D(this,t,e,n,Math.pow(2,8*n)-1,0);let r=n-1,s=1;for(this[e+r]=255&t;--r>=0&&(s*=256);)this[e+r]=t/s&255;return e+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,1,255,0),this[e]=255&t,e+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},l.prototype.writeBigUInt64LE=Z((function(t,e=0){return P(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=Z((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*n-1);D(this,t,e,n,i-1,-i)}let r=0,s=1,o=0;for(this[e]=255&t;++r<n&&(s*=256);)t<0&&0===o&&0!==this[e+r-1]&&(o=1),this[e+r]=(t/s|0)-o&255;return e+n},l.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*n-1);D(this,t,e,n,i-1,-i)}let r=n-1,s=1,o=0;for(this[e+r]=255&t;--r>=0&&(s*=256);)t<0&&0===o&&0!==this[e+r+1]&&(o=1),this[e+r]=(t/s|0)-o&255;return e+n},l.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},l.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},l.prototype.writeBigInt64LE=Z((function(t,e=0){return P(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=Z((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(t,e,n){return F(this,t,e,!0,n)},l.prototype.writeFloatBE=function(t,e,n){return F(this,t,e,!1,n)},l.prototype.writeDoubleLE=function(t,e,n){return k(this,t,e,!0,n)},l.prototype.writeDoubleBE=function(t,e,n){return k(this,t,e,!1,n)},l.prototype.copy=function(t,e,n,i){if(!l.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);const r=i-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),e),r},l.prototype.fill=function(t,e,n,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){const e=t.charCodeAt(0);("utf8"===i&&e<128||"latin1"===i)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let r;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(r=e;r<n;++r)this[r]=t;else{const s=l.isBuffer(t)?t:l.from(t,i),o=s.length;if(0===o)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(r=0;r<n-e;++r)this[r+e]=s[r%o]}return this};const N={};function Q(t,e,n){N[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function G(t){let e="",n=t.length;const i="-"===t[0]?1:0;for(;n>=i+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function z(t,e,n,i,r,s){if(t>n||t<e){const i="bigint"==typeof e?"n":"";let r;throw r=s>3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${e}${i} and <= ${n}${i}`,new N.ERR_OUT_OF_RANGE("value",r,t)}!function(t,e,n){H(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||V(e,t.length-(n+1))}(i,r,s)}function H(t,e){if("number"!=typeof t)throw new N.ERR_INVALID_ARG_TYPE(e,"number",t)}function V(t,e,n){if(Math.floor(t)!==t)throw H(t,n),new N.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new N.ERR_BUFFER_OUT_OF_BOUNDS;throw new N.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}Q("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),Q("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),Q("ERR_OUT_OF_RANGE",(function(t,e,n){let i=`The value of "${t}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=G(String(n)):"bigint"==typeof n&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=G(r)),r+="n"),i+=` It must be ${e}. Received ${r}`,i}),RangeError);const j=/[^+/0-9A-Za-z-_]/g;function W(t,e){let n;e=e||1/0;const i=t.length;let r=null;const s=[];for(let o=0;o<i;++o){if(n=t.charCodeAt(o),n>55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;s.push(n)}else if(n<2048){if((e-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function q(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(j,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,n,i){let r;for(r=0;r<i&&!(r+n>=e.length||r>=t.length);++r)e[r+n]=t[r];return r}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const K=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const i=16*n;for(let r=0;r<16;++r)e[i+r]=t[n]+t[r]}return e}();function Z(t){return"undefined"==typeof BigInt?$:t}function $(){throw new Error("BigInt not supported")}},9089:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,r,s){"string"==typeof t&&(t=[[null,t,void 0]]);var o={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(o[l]=!0)}for(var c=0;c<t.length;c++){var h=[].concat(t[c]);i&&o[h[0]]||(void 0!==s&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=s),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),e.push(h))}},e}},6492:t=>{"use strict";t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]|(%20)/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t):t}},963:t=>{"use strict";t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),s="/*# ".concat(r," */");return[e].concat([s]).join("\n")}return[e].join("\n")}},8878:(t,e,n)=>{e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let i=0,r=0;e[0].replace(/%[a-zA-Z%]/g,(t=>{"%%"!==t&&(i++,"%c"===t&&(r=i))})),e.splice(r,0,n)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}return!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG),t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=n(8945)(e);const{formatters:i}=t.exports;i.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},8945:(t,e,n)=>{t.exports=function(t){function e(t){let n,r,s,o=null;function a(...t){if(!a.enabled)return;const i=a,r=Number(new Date),s=r-(n||r);i.diff=s,i.prev=n,i.curr=r,n=r,t[0]=e.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let o=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,((n,r)=>{if("%%"===n)return"%";o++;const s=e.formatters[r];if("function"==typeof s){const e=t[o];n=s.call(i,e),t.splice(o,1),o--}return n})),e.formatArgs.call(i,t),(i.log||e.log).apply(i,t)}return a.namespace=t,a.useColors=e.useColors(),a.color=e.selectColor(t),a.extend=i,a.destroy=e.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(r!==e.namespaces&&(r=e.namespaces,s=e.enabled(t)),s),set:t=>{o=t}}),"function"==typeof e.init&&e.init(a),a}function i(t,n){const i=e(this.namespace+(void 0===n?":":n)+t);return i.log=this.log,i}function r(t,e){let n=0,i=0,r=-1,s=0;for(;n<t.length;)if(i<e.length&&(e[i]===t[n]||"*"===e[i]))"*"===e[i]?(r=i,s=n,i++):(n++,i++);else{if(-1===r)return!1;i=r+1,s++,n=s}for(;i<e.length&&"*"===e[i];)i++;return i===e.length}return e.debug=e,e.default=e,e.coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){const t=[...e.names,...e.skips.map((t=>"-"+t))].join(",");return e.enable(""),t},e.enable=function(t){e.save(t),e.namespaces=t,e.names=[],e.skips=[];const n=("string"==typeof t?t:"").trim().replace(" ",",").split(",").filter(Boolean);for(const t of n)"-"===t[0]?e.skips.push(t.slice(1)):e.names.push(t)},e.enabled=function(t){for(const n of e.skips)if(r(t,n))return!1;for(const n of e.names)if(r(t,n))return!0;return!1},e.humanize=n(9192),e.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((n=>{e[n]=t[n]})),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n|=0;return e.colors[Math.abs(n)%e.colors.length]},e.enable(e.load()),e}},1124:(t,e,n)=>{"use strict";var i=n(6240),r=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function o(t,e,n){var s=e[n];if(null!=s){if(r.call(t,n)&&(void 0===t[n]||null===t[n]))throw new TypeError("Cannot convert undefined or null to object ("+n+")");r.call(t,n)&&i(s)?t[n]=a(Object(t[n]),e[n]):t[n]=s}}function a(t,e){if(t===e)return t;for(var n in e=Object(e))r.call(e,n)&&o(t,e,n);if(Object.getOwnPropertySymbols)for(var i=Object.getOwnPropertySymbols(e),a=0;a<i.length;a++)s.call(e,i[a])&&o(t,e,i[a]);return t}t.exports=function(t){t=function(t){if(null==t)throw new TypeError("Sources cannot be null or undefined");return Object(t)}(t);for(var e=1;e<arguments.length;e++)a(t,arguments[e]);return t}},8480:t=>{t.exports=function(t){switch(t){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},919:(t,e,n)=>{var i;i="undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},t.exports=i},1024:(t,e)=>{e.read=function(t,e,n,i,r){var s,o,a=8*r-i-1,l=(1<<a)-1,c=l>>1,h=-7,u=n?r-1:0,d=n?-1:1,p=t[e+u];for(u+=d,s=p&(1<<-h)-1,p>>=-h,h+=a;h>0;s=256*s+t[e+u],u+=d,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=i;h>0;o=256*o+t[e+u],u+=d,h-=8);if(0===s)s=1-c;else{if(s===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),s-=c}return(p?-1:1)*o*Math.pow(2,s-i)},e.write=function(t,e,n,i,r,s){var o,a,l,c=8*s-r-1,h=(1<<c)-1,u=h>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,A=i?1:-1,f=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=h):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(o++,l/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(e*l-1)*Math.pow(2,r),o+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,r),o=0));r>=8;t[n+p]=255&a,p+=A,a/=256,r-=8);for(o=o<<r|a,c+=r;c>0;t[n+p]=255&o,p+=A,o/=256,c-=8);t[n+p-A]|=128*f}},2225:t=>{function e(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}t.exports=function(t){return null!=t&&(e(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&e(t.slice(0,0))}(t)||!!t._isBuffer)}},8847:t=>{t.exports=function(t){if(!t)return!1;var n=e.call(t);return"[object Function]"===n||"function"==typeof t&&"[object RegExp]"!==n||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var e=Object.prototype.toString},6240:t=>{"use strict";t.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},5651:(t,e,n)=>{var i=n(5406),r=n(4597),s=n(5734),o=["x","e","a","o","n","s","r","c","u","m","v","w","z"],a=["m","w"],l=["H","I","N","E","F","K","L","T","U","V","W","X","Y","Z"],c="\t".charCodeAt(0),h=" ".charCodeAt(0);function u(t){this.glyphs=[],this._measure=this.computeMetrics.bind(this),this.update(t)}function d(t){return new Function(["return function "+t+"() {"," return this._"+t,"}"].join("\n"))()}function p(t,e){if(!t.chars||0===t.chars.length)return null;var n=f(t.chars,e);return n>=0?t.chars[n]:null}function A(t,e,n){if(!t.kernings||0===t.kernings.length)return 0;for(var i=t.kernings,r=0;r<i.length;r++){var s=i[r];if(s.first===e&&s.second===n)return s.amount}return 0}function f(t,e,n){for(var i=n=n||0;i<t.length;i++)if(t[i].id===e)return i;return-1}t.exports=function(t){return new u(t)},u.prototype.update=function(t){if(t=r({measure:this._measure},t),this._opt=t,this._opt.tabSize=s(this._opt.tabSize,4),!t.font)throw new Error("must provide a valid bitmap font");var e=this.glyphs,n=t.text||"",a=t.font;this._setupSpaceGlyphs(a);var c=i.lines(n,t),h=t.width||0;e.length=0;var u=c.reduce((function(t,e){return Math.max(t,e.width,h)}),0),d=0,p=0,m=s(t.lineHeight,a.common.lineHeight),g=a.common.base,v=m-g,y=t.letterSpacing||0,E=m*c.length-v,x=function(t){return"center"===t?1:"right"===t?2:0}(this._opt.align);p-=E,this._width=u,this._height=E,this._descender=m-g,this._baseline=g,this._xHeight=function(t){for(var e=0;e<o.length;e++){var n=o[e].charCodeAt(0),i=f(t.chars,n);if(i>=0)return t.chars[i].height}return 0}(a),this._capHeight=function(t){for(var e=0;e<l.length;e++){var n=l[e].charCodeAt(0),i=f(t.chars,n);if(i>=0)return t.chars[i].height}return 0}(a),this._lineHeight=m,this._ascender=m-v-this._xHeight;var b=this;c.forEach((function(t,i){for(var r,s=t.start,o=t.end,l=t.width,c=s;c<o;c++){var h=n.charCodeAt(c),f=b.getGlyph(a,h);if(f){r&&(d+=A(a,r.id,f.id));var g=d;1===x?g+=(u-l)/2:2===x&&(g+=u-l),e.push({position:[g,p],data:f,index:c,line:i}),d+=f.xadvance+y,r=f}}p+=m,d=0})),this._linesTotal=c.length},u.prototype._setupSpaceGlyphs=function(t){if(this._fallbackSpaceGlyph=null,this._fallbackTabGlyph=null,t.chars&&0!==t.chars.length){var e=p(t,h)||function(t){for(var e=0;e<a.length;e++){var n=a[e].charCodeAt(0),i=f(t.chars,n);if(i>=0)return t.chars[i]}return 0}(t)||t.chars[0],n=this._opt.tabSize*e.xadvance;this._fallbackSpaceGlyph=e,this._fallbackTabGlyph=r(e,{x:0,y:0,xadvance:n,id:c,xoffset:0,yoffset:0,width:0,height:0})}},u.prototype.getGlyph=function(t,e){return p(t,e)||(e===c?this._fallbackTabGlyph:e===h?this._fallbackSpaceGlyph:null)},u.prototype.computeMetrics=function(t,e,n,i){var r,s=this._opt.letterSpacing||0,o=this._opt.font,a=0,l=0,c=0;if(!o.chars||0===o.chars.length)return{start:e,end:e,width:0};n=Math.min(t.length,n);for(var h=e;h<n;h++){var u,d=t.charCodeAt(h);if(u=this.getGlyph(o,d)){u.xoffset;var p=(a+=r?A(o,r.id,u.id):0)+u.xadvance+s,f=a+u.width;if(f>=i||p>=i)break;a=p,l=f,r=u}c++}return r&&(l+=r.xoffset),{start:e,end:e+c,width:l}},["width","height","descender","ascender","xHeight","baseline","capHeight","lineHeight"].forEach((function(t){Object.defineProperty(u.prototype,t,{get:d(t),configurable:!0})}))},5751:(t,e,n)=>{var i=n(9922).hp,r=n(3558),s=function(){},o=n(1476),a=n(7034),l=n(7480),c=n(573),h=n(4597),u=self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;t.exports=function(t,e){e="function"==typeof e?e:s,"string"==typeof t?t={uri:t}:t||(t={}),t.binary&&(t=function(t){if(u)return h(t,{responseType:"arraybuffer"});if(void 0===self.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var e=new self.XMLHttpRequest;return e.overrideMimeType("text/plain; charset=x-user-defined"),h({xhr:e},t)}(t)),r(t,(function(n,r,h){if(n)return e(n);if(!/^2/.test(r.statusCode))return e(new Error("http status code: "+r.statusCode));if(!h)return e(new Error("no body result"));var u,d,p=!1;if(u=h,"[object ArrayBuffer]"===Object.prototype.toString.call(u)){var A=new Uint8Array(h);h=i.from(A,"binary")}c(h)&&(p=!0,"string"==typeof h&&(h=i.from(h,"binary"))),p||(i.isBuffer(h)&&(h=h.toString(t.encoding)),h=h.trim());try{var f=r.headers["content-type"];d=p?l(h):/json/.test(f)||"{"===h.charAt(0)?JSON.parse(h):/xml/.test(f)||"<"===h.charAt(0)?a(h):o(h)}catch(t){e(new Error("error parsing font "+t.message)),e=s}e(null,d)}))}},573:(t,e,n)=>{var i=n(9922).hp,r=n(911),s=i.from([66,77,70,3]);t.exports=function(t){return"string"==typeof t?"BMF"===t.substring(0,3):t.length>4&&r(t.slice(0,4),s)}},9192:t=>{var e=1e3,n=60*e,i=60*n,r=24*i,s=7*r;function o(t,e,n,i){var r=e>=1.5*n;return Math.round(t/n)+" "+i+(r?"s":"")}t.exports=function(t,a){a=a||{};var l,c,h=typeof t;if("string"===h&&t.length>0)return function(t){if(!((t=String(t)).length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(o){var a=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return a*s;case"days":case"day":case"d":return a*r;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(t);if("number"===h&&isFinite(t))return a.long?(l=t,(c=Math.abs(l))>=r?o(l,c,r,"day"):c>=i?o(l,c,i,"hour"):c>=n?o(l,c,n,"minute"):c>=e?o(l,c,e,"second"):l+" ms"):function(t){var s=Math.abs(t);return s>=r?Math.round(t/r)+"d":s>=i?Math.round(t/i)+"h":s>=n?Math.round(t/n)+"m":s>=e?Math.round(t/e)+"s":t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},1476:t=>{function e(t,e){if(!(t=t.replace(/\t+/g," ").trim()))return null;var i=t.indexOf(" ");if(-1===i)throw new Error("no named row at line "+e);var r=t.substring(0,i);t=(t=(t=(t=t.substring(i+1)).replace(/letter=[\'\"]\S+[\'\"]/gi,"")).split("=")).map((function(t){return t.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)}));for(var s=[],o=0;o<t.length;o++){var a=t[o];0===o?s.push({key:a[0],data:""}):o===t.length-1?s[s.length-1].data=n(a[0]):(s[s.length-1].data=n(a[0]),s.push({key:a[1],data:""}))}var l={key:r,data:{}};return s.forEach((function(t){l.data[t.key]=t.data})),l}function n(t){return t&&0!==t.length?0===t.indexOf('"')||0===t.indexOf("'")?t.substring(1,t.length-1):-1!==t.indexOf(",")?function(t){return t.split(",").map((function(t){return parseInt(t,10)}))}(t):parseInt(t,10):""}t.exports=function(t){if(!t)throw new Error("no data provided");var n={pages:[],chars:[],kernings:[]},i=(t=t.toString().trim()).split(/\r\n?|\n/g);if(0===i.length)throw new Error("no data in BMFont file");for(var r=0;r<i.length;r++){var s=e(i[r],r);if(s)if("page"===s.key){if("number"!=typeof s.data.id)throw new Error("malformed file at line "+r+" -- needs page id=N");if("string"!=typeof s.data.file)throw new Error("malformed file at line "+r+' -- needs page file="path"');n.pages[s.data.id]=s.data.file}else"chars"===s.key||"kernings"===s.key||("char"===s.key?n.chars.push(s.data):"kerning"===s.key?n.kernings.push(s.data):n[s.key]=s.data)}return n}},7480:t=>{var e=[66,77,70];function n(t,e,n){if(n>e.length-1)return 0;var r=e.readUInt8(n++),s=e.readInt32LE(n);switch(n+=4,r){case 1:t.info=function(t,e){var n={};n.size=t.readInt16LE(e);var r=t.readUInt8(e+2);return n.smooth=r>>7&1,n.unicode=r>>6&1,n.italic=r>>5&1,n.bold=r>>4&1,r>>3&1&&(n.fixedHeight=1),n.charset=t.readUInt8(e+3)||"",n.stretchH=t.readUInt16LE(e+4),n.aa=t.readUInt8(e+6),n.padding=[t.readInt8(e+7),t.readInt8(e+8),t.readInt8(e+9),t.readInt8(e+10)],n.spacing=[t.readInt8(e+11),t.readInt8(e+12)],n.outline=t.readUInt8(e+13),n.face=function(t,e){return i(t,e).toString("utf8")}(t,e+14),n}(e,n);break;case 2:t.common=function(t,e){var n={};return n.lineHeight=t.readUInt16LE(e),n.base=t.readUInt16LE(e+2),n.scaleW=t.readUInt16LE(e+4),n.scaleH=t.readUInt16LE(e+6),n.pages=t.readUInt16LE(e+8),t.readUInt8(e+10),n.packed=0,n.alphaChnl=t.readUInt8(e+11),n.redChnl=t.readUInt8(e+12),n.greenChnl=t.readUInt8(e+13),n.blueChnl=t.readUInt8(e+14),n}(e,n);break;case 3:t.pages=function(t,e,n){for(var r=[],s=i(t,e),o=s.length+1,a=n/o,l=0;l<a;l++)r[l]=t.slice(e,e+s.length).toString("utf8"),e+=o;return r}(e,n,s);break;case 4:t.chars=function(t,e,n){for(var i=[],r=n/20,s=0;s<r;s++){var o={},a=20*s;o.id=t.readUInt32LE(e+0+a),o.x=t.readUInt16LE(e+4+a),o.y=t.readUInt16LE(e+6+a),o.width=t.readUInt16LE(e+8+a),o.height=t.readUInt16LE(e+10+a),o.xoffset=t.readInt16LE(e+12+a),o.yoffset=t.readInt16LE(e+14+a),o.xadvance=t.readInt16LE(e+16+a),o.page=t.readUInt8(e+18+a),o.chnl=t.readUInt8(e+19+a),i[s]=o}return i}(e,n,s);break;case 5:t.kernings=function(t,e,n){for(var i=[],r=n/10,s=0;s<r;s++){var o={},a=10*s;o.first=t.readUInt32LE(e+0+a),o.second=t.readUInt32LE(e+4+a),o.amount=t.readInt16LE(e+8+a),i[s]=o}return i}(e,n,s)}return 5+s}function i(t,e){for(var n=e;n<t.length&&0!==t[n];n++);return t.slice(e,n)}t.exports=function(t){if(t.length<6)throw new Error("invalid buffer length for BMFont");var i=e.every((function(e,n){return t.readUInt8(n)===e}));if(!i)throw new Error("BMFont missing BMF byte header");var r=3;if(t.readUInt8(r++)>3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var s={kernings:[],chars:[]},o=0;o<5;o++)r+=n(s,t,r);return s}},7034:(t,e,n)=>{var i=n(7829),r=n(1896),s={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"};function o(t){var e=function(t){for(var e=[],n=0;n<t.attributes.length;n++)e.push(t.attributes[n]);return e}(t);return e.reduce((function(t,e){var n;return t[(n=e.nodeName,s[n.toLowerCase()]||n)]=e.nodeValue,t}),{})}t.exports=function(t){t=t.toString();var e=r(t),n={pages:[],chars:[],kernings:[]};["info","common"].forEach((function(t){var r=e.getElementsByTagName(t)[0];r&&(n[t]=i(o(r)))}));var s=e.getElementsByTagName("pages")[0];if(!s)throw new Error("malformed file -- no <pages> element");for(var a=s.getElementsByTagName("page"),l=0;l<a.length;l++){var c=a[l],h=parseInt(c.getAttribute("id"),10),u=c.getAttribute("file");if(isNaN(h))throw new Error('malformed file -- page "id" attribute is NaN');if(!u)throw new Error('malformed file -- needs page "file" attribute');n.pages[parseInt(h,10)]=u}return["chars","kernings"].forEach((function(t){var r=e.getElementsByTagName(t)[0];if(r)for(var s=t.substring(0,t.length-1),a=r.getElementsByTagName(s),l=0;l<a.length;l++){var c=a[l];n[t].push(i(o(c)))}})),n}},7829:t=>{var e="chasrset";t.exports=function(t){for(var n in t=Object.assign({},t),e in t&&(t.charset=t[e],delete t[e]),t)"face"!==n&&"charset"!==n&&(t[n]="padding"===n||"spacing"===n?t[n].split(",").map((function(t){return parseInt(t,10)})):parseInt(t[n],10));return t}},3216:t=>{var e=function(t){return t.replace(/^\s+|\s+$/g,"")};t.exports=function(t){if(!t)return{};for(var n,i={},r=e(t).split("\n"),s=0;s<r.length;s++){var o=r[s],a=o.indexOf(":"),l=e(o.slice(0,a)).toLowerCase(),c=e(o.slice(a+1));void 0===i[l]?i[l]=c:(n=i[l],"[object Array]"===Object.prototype.toString.call(n)?i[l].push(c):i[l]=[i[l],c])}return i}},9035:(t,e,n)=>{var i=n(8480),r=n(8167),s=n(2225),o=[0,2,3],a=[2,1,3];t.exports=function(t,e){t&&(r(t)||s(t))||(e=t||{},t=null);for(var n="string"==typeof(e="number"==typeof e?{count:e}:e||{}).type?e.type:"uint16",l="number"==typeof e.count?e.count:1,c=e.start||0,h=!1!==e.clockwise?o:a,u=h[0],d=h[1],p=h[2],A=6*l,f=t||new(i(n))(A),m=0,g=0;m<A;m+=6,g+=4){var v=m+c;f[v+0]=g+0,f[v+1]=g+1,f[v+2]=g+2,f[v+3]=g+u,f[v+4]=g+d,f[v+5]=g+p}return f}},4433:(t,e,n)=>{var i=n(5651),r=n(9035),s=n(7106),o=n(1684);t.exports=function(t){return new a(t)};class a extends THREE.BufferGeometry{constructor(t){super(),"string"==typeof t&&(t={text:t}),this._opt=Object.assign({},t),t&&this.update(t)}update(t){if("string"==typeof t&&(t={text:t}),!(t=Object.assign({},this._opt,t)).font)throw new TypeError("must specify a { font } in options");this.layout=i(t);var e=!1!==t.flipY,n=t.font,o=n.common.scaleW,a=n.common.scaleH,l=this.layout.glyphs.filter((function(t){var e=t.data;return e.width*e.height>0}));this.visibleGlyphs=l;var c=s.positions(l),h=s.uvs(l,o,a,e),u=r([],{clockwise:!0,type:"uint16",count:l.length});if(this.setIndex(u),this.setAttribute("position",new THREE.BufferAttribute(c,2)),this.setAttribute("uv",new THREE.BufferAttribute(h,2)),!t.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(t.multipage){var d=s.pages(l);this.setAttribute("page",new THREE.BufferAttribute(d,1))}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var t=this.attributes.position.array,e=this.attributes.position.itemSize;if(!t||!e||t.length<2)return this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0);o.computeSphere(t,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var t=this.boundingBox,e=this.attributes.position.array,n=this.attributes.position.itemSize;!e||!n||e.length<2?t.makeEmpty():o.computeBox(e,t)}}},1684:t=>{var e={min:[0,0],max:[0,0]};function n(t){var n=t.length/2;e.min[0]=t[0],e.min[1]=t[1],e.max[0]=t[0],e.max[1]=t[1];for(var i=0;i<n;i++){var r=t[2*i+0],s=t[2*i+1];e.min[0]=Math.min(r,e.min[0]),e.min[1]=Math.min(s,e.min[1]),e.max[0]=Math.max(r,e.max[0]),e.max[1]=Math.max(s,e.max[1])}}t.exports.computeBox=function(t,i){n(t),i.min.set(e.min[0],e.min[1],0),i.max.set(e.max[0],e.max[1],0)},t.exports.computeSphere=function(t,i){n(t);var r=e.min[0],s=e.min[1],o=e.max[0]-r,a=e.max[1]-s,l=Math.sqrt(o*o+a*a);i.center.set(r+o/2,s+a/2,0),i.radius=l/2}},7106:t=>{t.exports.pages=function(t){var e=new Float32Array(4*t.length*1),n=0;return t.forEach((function(t){var i=t.data.page||0;e[n++]=i,e[n++]=i,e[n++]=i,e[n++]=i})),e},t.exports.uvs=function(t,e,n,i){var r=new Float32Array(4*t.length*2),s=0;return t.forEach((function(t){var o=t.data,a=o.x+o.width,l=o.y+o.height,c=o.x/e,h=o.y/n,u=a/e,d=l/n;i&&(h=(n-o.y)/n,d=(n-l)/n),r[s++]=c,r[s++]=h,r[s++]=c,r[s++]=d,r[s++]=u,r[s++]=d,r[s++]=u,r[s++]=h})),r},t.exports.positions=function(t){var e=new Float32Array(4*t.length*2),n=0;return t.forEach((function(t){var i=t.data,r=t.position[0]+i.xoffset,s=t.position[1]+i.yoffset,o=i.width,a=i.height;e[n++]=r,e[n++]=s,e[n++]=r,e[n++]=s+a,e[n++]=r+o,e[n++]=s+a,e[n++]=r+o,e[n++]=s})),e}},5406:t=>{var e=/\n/,n=/\s/;function i(t,e,n,i){var r=t.indexOf(e,n);return-1===r||r>i?i:r}function r(t){return n.test(t)}function s(t,e,n,i){return{start:e,end:e+Math.min(i,n-e)}}t.exports=function(e,n){return t.exports.lines(e,n).map((function(t){return e.substring(t.start,t.end)})).join("\n")},t.exports.lines=function(t,n){if(0===(n=n||{}).width&&"nowrap"!==n.mode)return[];t=t||"";var o="number"==typeof n.width?n.width:Number.MAX_VALUE,a=Math.max(0,n.start||0),l="number"==typeof n.end?n.end:t.length,c=n.mode,h=n.measure||s;return"pre"===c?function(t,n,i,r,s){for(var o=[],a=i,l=i;l<r&&l<n.length;l++){var c=n.charAt(l),h=e.test(c);if(h||l===r-1){var u=t(n,a,h?l:l+1,s);o.push(u),a=l+1}}return o}(h,t,a,l,o):function(t,e,n,s,o,a){var l=[],c=o;for("nowrap"===a&&(c=Number.MAX_VALUE);n<s&&n<e.length;){for(var h=i(e,"\n",n,s);n<h&&r(e.charAt(n));)n++;var u=t(e,n,h,c),d=n+(u.end-u.start),p=d+1;if(d<h){for(;d>n&&!r(e.charAt(d));)d--;if(d===n)p>n+1&&p--,d=p;else for(p=d;d>n&&r(e.charAt(d-1));)d--}if(d>=n){var A=t(e,n,d,c);l.push(A)}n=p}return l}(h,t,a,l,o,c)}},3558:(t,e,n)=>{"use strict";var i=n(919),r=n(8847),s=n(3216),o=n(4597);function a(t,e,n){var i=t;return r(e)?(n=e,"string"==typeof t&&(i={uri:t})):i=o(e,{uri:t}),i.callback=n,i}function l(t,e,n){return c(e=a(t,e,n))}function c(t){if(void 0===t.callback)throw new Error("callback argument missing");var e=!1,n=function(n,i,r){e||(e=!0,t.callback(n,i,r))};function i(){var t=void 0;if(t=h.response?h.response:h.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(h),g)try{t=JSON.parse(t)}catch(t){}return t}function r(t){return clearTimeout(u),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,n(t,v)}function o(){if(!c){var e;clearTimeout(u),e=t.useXDR&&void 0===h.status?200:1223===h.status?204:h.status;var r=v,o=null;return 0!==e?(r={body:i(),statusCode:e,method:p,headers:{},url:d,rawRequest:h},h.getAllResponseHeaders&&(r.headers=s(h.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var a,c,h=t.xhr||null;h||(h=t.cors||t.useXDR?new l.XDomainRequest:new l.XMLHttpRequest);var u,d=h.url=t.uri||t.url,p=h.method=t.method||"GET",A=t.body||t.data,f=h.headers=t.headers||{},m=!!t.sync,g=!1,v={body:void 0,headers:{},statusCode:0,method:p,url:d,rawRequest:h};if("json"in t&&!1!==t.json&&(g=!0,f.accept||f.Accept||(f.Accept="application/json"),"GET"!==p&&"HEAD"!==p&&(f["content-type"]||f["Content-Type"]||(f["Content-Type"]="application/json"),A=JSON.stringify(!0===t.json?A:t.json))),h.onreadystatechange=function(){4===h.readyState&&setTimeout(o,0)},h.onload=o,h.onerror=r,h.onprogress=function(){},h.onabort=function(){c=!0},h.ontimeout=r,h.open(p,d,!m,t.username,t.password),m||(h.withCredentials=!!t.withCredentials),!m&&t.timeout>0&&(u=setTimeout((function(){if(!c){c=!0,h.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",r(t)}}),t.timeout)),h.setRequestHeader)for(a in f)f.hasOwnProperty(a)&&h.setRequestHeader(a,f[a]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(h.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(h),h.send(A||null),h}t.exports=l,t.exports.default=l,l.XMLHttpRequest=i.XMLHttpRequest||function(){},l.XDomainRequest="withCredentials"in new l.XMLHttpRequest?l.XMLHttpRequest:i.XDomainRequest,function(t,e){for(var n=0;n<t.length;n++)e(t[n])}(["get","put","post","patch","head","delete"],(function(t){l["delete"===t?"del":t]=function(e,n,i){return(n=a(e,n,i)).method=t.toUpperCase(),c(n)}}))},1896:t=>{t.exports=void 0!==self.DOMParser?function(t){return(new self.DOMParser).parseFromString(t,"application/xml")}:void 0!==self.ActiveXObject&&new self.ActiveXObject("Microsoft.XMLDOM")?function(t){var e=new self.ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e}:function(t){var e=document.createElement("div");return e.innerHTML=t,e}},4597:t=>{t.exports=function(){for(var t={},n=0;n<arguments.length;n++){var i=arguments[n];for(var r in i)e.call(i,r)&&(t[r]=i[r])}return t};var e=Object.prototype.hasOwnProperty},8132:()=>{window.aframeStats=function(t){var e=null,n=t;return{update:function(){var t;e("te").set((t=n.querySelectorAll("*"),Array.prototype.slice.call(t).filter((function(t){return t.isEntity})),t.length)),window.performance.getEntriesByName&&e("lt").set(window.performance.getEntriesByName("render-started")[0].startTime.toFixed(0))},start:function(){},end:function(){},attach:function(t){e=t},values:{te:{caption:"Entities"},lt:{caption:"Load Time"}},groups:[{caption:"A-Frame",values:["te","lt"]}],fractions:[]}}},3729:t=>{window.glStats=function(){var t=null,e=0,n=0,i=0,r=0,s=0,o=0,a=0;function l(t,e){return function(){e.apply(this,arguments),t.apply(this,arguments)}}return WebGLRenderingContext.prototype.drawArrays=l(WebGLRenderingContext.prototype.drawArrays,(function(){e++,arguments[0]==this.POINTS?o+=arguments[2]:s+=arguments[2]})),WebGLRenderingContext.prototype.drawElements=l(WebGLRenderingContext.prototype.drawElements,(function(){n++,r+=arguments[1]/3,s+=arguments[1]})),WebGLRenderingContext.prototype.useProgram=l(WebGLRenderingContext.prototype.useProgram,(function(){i++})),WebGLRenderingContext.prototype.bindTexture=l(WebGLRenderingContext.prototype.bindTexture,(function(){a++})),{update:function(){t("allcalls").set(e+n),t("drawElements").set(n),t("drawArrays").set(e),t("bindTexture").set(a),t("useProgram").set(i),t("glfaces").set(r),t("glvertices").set(s),t("glpoints").set(o)},start:function(){e=0,n=0,i=0,r=0,s=0,o=0,a=0},end:function(){},attach:function(e){t=e},values:{allcalls:{over:3e3,caption:"Calls (hook)"},drawelements:{caption:"drawElements (hook)"},drawarrays:{caption:"drawArrays (hook)"}},groups:[{caption:"WebGL",values:["allcalls","drawelements","drawarrays","useprogram","bindtexture","glfaces","glvertices","glpoints"]}],fractions:[{base:"allcalls",steps:["drawelements","drawarrays"]}]}},window.threeStats=function(t){var e=null;return{update:function(){e("renderer.info.memory.geometries").set(t.info.memory.geometries),e("renderer.info.programs").set(t.info.programs.length),e("renderer.info.memory.textures").set(t.info.memory.textures),e("renderer.info.render.calls").set(t.info.render.calls),e("renderer.info.render.triangles").set(t.info.render.triangles),e("renderer.info.render.points").set(t.info.render.points)},start:function(){},end:function(){},attach:function(t){e=t},values:{"renderer.info.memory.geometries":{caption:"Geometries"},"renderer.info.memory.textures":{caption:"Textures"},"renderer.info.programs":{caption:"Programs"},"renderer.info.render.calls":{caption:"Calls"},"renderer.info.render.triangles":{caption:"Triangles",over:1e3},"renderer.info.render.points":{caption:"Points"}},groups:[{caption:"Three.js - Memory",values:["renderer.info.memory.geometries","renderer.info.programs","renderer.info.memory.textures"]},{caption:"Three.js - Render",values:["renderer.info.render.calls","renderer.info.render.triangles","renderer.info.render.points"]}],fractions:[]}},window.BrowserStats=function(){var t=null,e=0,n=0;window.performance&&!performance.memory&&(performance.memory={usedJSHeapSize:0,totalJSHeapSize:0}),0===performance.memory.totalJSHeapSize&&console.warn("totalJSHeapSize === 0... performance.memory is only available in Chrome .");var i=Math.log(1024);function r(t){var e=Math.floor(Math.log(t)/i);return Math.round(100*t/Math.pow(1024,e))/100}return{update:function(){e=r(performance.memory.usedJSHeapSize),n=r(performance.memory.totalJSHeapSize),t("memory").set(e),t("total").set(n)},start:function(){e=0},end:function(){},attach:function(e){t=e},values:{memory:{caption:"Used Memory",average:!0,avgMs:1e3,over:22},total:{caption:"Total Memory"}},groups:[{caption:"Browser",values:["memory","total"]}],fractions:[{base:"total",steps:["memory"]}]}},t.exports={glStats:window.glStats,threeStats:window.threeStats,BrowserStats:window.BrowserStats}},282:t=>{"use strict";!function(){"performance"in window==0&&(window.performance={});var t=window.performance;if("now"in t==0){var e=Date.now();t.timing&&t.timing.navigationStart&&(e=t.timing.navigationStart),t.now=function(){return Date.now()-e}}t.mark||(t.mark=function(){}),t.measure||(t.measure=function(){})}(),window.rStats=function(t){function e(t,e){for(var n=Object.keys(t),i=0,r=n.length;i<r;i++)e(n[i])}var n=t||{},i=n.colours||["#850700","#c74900","#fcb300","#284280","#4c7c0c"],r=(n.CSSPath?n.CSSPath:"")+"rStats.css";(n.css||["https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300",r]).forEach((function(t){var e,n;e=t,(n=document.createElement("link")).href=e,n.rel="stylesheet",n.type="text/css",document.getElementsByTagName("head")[0].appendChild(n)})),n.values||(n.values={});var s,o,a=10,l={};function c(t,e,n){var i=n||{},r=document.createElement("canvas"),s=r.getContext("2d"),o=0,l=0,c=i.color?i.color:"#666666",h=document.createElement("canvas"),u=h.getContext("2d");h.width=1,h.height=20,u.fillStyle="#444444",u.fillRect(0,0,1,20),u.fillStyle=c,u.fillRect(0,a,1,a),u.fillStyle="#ffffff",u.globalAlpha=.5,u.fillRect(0,a,1,1),u.globalAlpha=1;var d=document.createElement("canvas"),p=d.getContext("2d");return d.width=1,d.height=20,p.fillStyle="#444444",p.fillRect(0,0,1,20),p.fillStyle="#b70000",p.fillRect(0,a,1,a),p.globalAlpha=.5,p.fillStyle="#ffffff",p.fillRect(0,a,1,1),p.globalAlpha=1,r.width=200,r.height=a,r.style.width=r.width+"px",r.style.height=r.height+"px",r.className="rs-canvas",t.appendChild(r),s.fillStyle="#444444",s.fillRect(0,0,r.width,r.height),{draw:function(t,e){(l+=.1*(t-l))>(o*=.99)&&(o=l),s.drawImage(r,1,0,r.width-1,r.height,0,0,r.width-1,r.height),e?s.drawImage(d,r.width-1,r.height-l*r.height/o-a):s.drawImage(h,r.width-1,r.height-l*r.height/o-a)}}}function h(t,n){var r=document.createElement("canvas"),s=r.getContext("2d");return r.width=200,r.height=a*n,r.style.width=r.width+"px",r.style.height=r.height+"px",r.className="rs-canvas",t.appendChild(r),s.fillStyle="#444444",s.fillRect(0,0,r.width,r.height),{draw:function(t){s.drawImage(r,1,0,r.width-1,r.height,0,0,r.width-1,r.height);var n=0;e(t,(function(e){var o=t[e]*r.height;s.fillStyle=i[e],s.fillRect(r.width-1,n,1,o),n+=o}))}}}function u(t,e){var i,r=t,s=0,a=0,l=0,h=0,u=performance.now(),d=0,p=document.createElement("div"),A=document.createElement("span"),f=document.createElement("div"),m=document.createTextNode(""),g=n?n.values[r.toLowerCase()]:null,v=new c(p,r,g),y=!1;function E(t){if(g&&g.average){h+=t,d++;var e=performance.now();e-u>=(g.avgMs||1e3)&&(l=h/d,h=0,u=e,d=0)}}function x(){i=performance.now(),n.userTimingAPI&&performance.mark(r+"-start"),y=!0}function b(){s=performance.now()-i,n.userTimingAPI&&(performance.mark(r+"-end"),y&&performance.measure(r,r+"-start",r+"-end")),E(s)}return A.className="rs-counter-id",A.textContent=g&&g.caption?g.caption:r,f.className="rs-counter-value",f.appendChild(m),p.appendChild(A),p.appendChild(f),e?e.div.appendChild(p):o.appendChild(p),i=performance.now(),{set:function(t){E(s=t)},start:x,tick:function(){b(),x()},end:b,frame:function(){var t=performance.now(),e=t-i;a++,e>1e3&&(s=g&&!1===g.interpolate?a:1e3*a/e,a=0,i=t,E(s))},value:function(){return s},draw:function(){var t=g&&g.average?l:s;m.nodeValue=Math.round(100*t)/100;var e=g&&(g.below&&s<g.below||g.over&&s>g.over);v.draw(s,e),p.className=e?"rs-counter-base alarm":"rs-counter-base"}}}function d(t){var i=t.toLowerCase();if(void 0===i&&(i="default"),l[i])return l[i];var r=null;n&&n.groups&&e(n.groups,(function(t){var e=n.groups[parseInt(t,10)];r||-1===e.values.indexOf(i.toLowerCase())||(r=e)}));var s=new u(i,r);return l[i]=s,s}function p(){e(n.plugins,(function(t){n.plugins[t].update()})),e(l,(function(t){l[t].draw()})),n&&n.fractions&&e(n.fractions,(function(t){var i=n.fractions[parseInt(t,10)],r=[],s=l[i.base.toLowerCase()];s&&(s=s.value(),e(n.fractions[t].steps,(function(e){var i=n.fractions[t].steps[parseInt(e,10)].toLowerCase(),o=l[i];o&&r.push(o.value()/s)}))),i.graph.draw(r)}))}return function(){if(n.plugins){n.values||(n.values={}),n.groups||(n.groups=[]),n.fractions||(n.fractions=[]);for(var t=0;t<n.plugins.length;t++)n.plugins[t].attach(d),e(n.plugins[t].values,(function(e){n.values[e]=n.plugins[t].values[e]})),n.groups=n.groups.concat(n.plugins[t].groups),n.fractions=n.fractions.concat(n.plugins[t].fractions)}else n.plugins={};(s=document.createElement("div")).className="rs-base",(o=document.createElement("div")).className="rs-container",o.style.height="auto",s.appendChild(o),document.body.appendChild(s),n&&(n.groups&&e(n.groups,(function(t){var e=n.groups[parseInt(t,10)],i=document.createElement("div");i.className="rs-group",e.div=i;var r=document.createElement("h1");r.textContent=e.caption,r.addEventListener("click",function(t){this.classList.toggle("hidden"),t.preventDefault()}.bind(i)),o.appendChild(r),o.appendChild(i)})),n.fractions&&e(n.fractions,(function(t){var r=n.fractions[parseInt(t,10)],s=document.createElement("div");s.className="rs-fraction";var l=document.createElement("div");l.className="rs-legend";var c=0;e(n.fractions[t].steps,(function(e){var r=document.createElement("p");r.textContent=n.fractions[t].steps[e],r.style.color=i[c],l.appendChild(r),c++})),s.appendChild(l),s.style.height=c*a+"px",r.div=s;var u=new h(s,c);r.graph=u,o.appendChild(s)})))}(),function(t){return t?d(t):{element:s,update:p}}},t.exports=window.rStats},2535:t=>{var e={base64:function(t,e){return"data:"+t+";base64,"+e},isMobile:function(){var t,e=!1;return t=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0),e},isIOS:function(){return/(iPad|iPhone|iPod)/g.test(navigator.userAgent)},isIFrame:function(){try{return window.self!==window.top}catch(t){return!0}},appendQueryParameter:function(t,e,n){var i=t.indexOf("?")<0?"?":"&";return t+(i+e+"=")+n},getQueryParameter:function(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))},isLandscapeMode:function(){return 90==window.orientation||-90==window.orientation}};t.exports=e},5928:(t,e,n)=>{var i,r=n(2535);t.exports=(i=navigator.userAgent||navigator.vendor||window.opera).match(/iPhone/i)||i.match(/iPod/i)?function(){var t=null;this.request=function(){t||(t=setInterval((function(){window.location.href="/",setTimeout(window.stop,0)}),15e3))},this.release=function(){t&&(clearInterval(t),t=null)}}:function(){var t=document.createElement("video");t.addEventListener("ended",(function(){t.play()})),this.request=function(){t.paused&&(t.src=r.base64("video/webm","GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4ECQoWBAhhTgGcBAAAAAAAH4xFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsggfG7AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU2LjQwLjEwMVdBjUxhdmY1Ni40MC4xMDFzpJAGSJTMbsLpDt/ySkipgX1fRImIQO1MAAAAAAAWVK5rAQAAAAAAADuuAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDmDgQEj44OEO5rKAOABAAAAAAAABrCBsLqBkB9DtnUBAAAAAAAAo+eBAKOmgQAAgKJJg0IAAV4BHsAHBIODCoAACmH2MAAAZxgz4dPSTFi5JACjloED6ACmAECSnABMQAADYAAAWi0quoCjloEH0ACmAECSnABNwAADYAAAWi0quoCjloELuACmAECSnABNgAADYAAAWi0quoCjloEPoACmAECSnABNYAADYAAAWi0quoCjloETiACmAECSnABNIAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTnghdwo5aBAAAApgBAkpwATOAAA2AAAFotKrqAo5aBA+gApgBAkpwATMAAA2AAAFotKrqAo5aBB9AApgBAkpwATIAAA2AAAFotKrqAo5aBC7gApgBAkpwATEAAA2AAAFotKrqAo5aBD6AApgDAkpwAQ2AAA2AAAFotKrqAo5aBE4gApgBAkpwATCAAA2AAAFotKrqAH0O2dQEAAAAAAACU54Iu4KOWgQAAAKYAQJKcAEvAAANgAABaLSq6gKOWgQPoAKYAQJKcAEtgAANgAABaLSq6gKOWgQfQAKYAQJKcAEsAAANgAABaLSq6gKOWgQu4AKYAQJKcAEqAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEogAANgAABaLSq6gKOWgROIAKYAQJKcAEnAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCRlCjloEAAACmAECSnABJgAADYAAAWi0quoCjloED6ACmAECSnABJIAADYAAAWi0quoCjloEH0ACmAMCSnABDYAADYAAAWi0quoCjloELuACmAECSnABI4AADYAAAWi0quoCjloEPoACmAECSnABIoAADYAAAWi0quoCjloETiACmAECSnABIYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngl3Ao5aBAAAApgBAkpwASCAAA2AAAFotKrqAo5aBA+gApgBAkpwASAAAA2AAAFotKrqAo5aBB9AApgBAkpwAR8AAA2AAAFotKrqAo5aBC7gApgBAkpwAR4AAA2AAAFotKrqAo5aBD6AApgBAkpwAR2AAA2AAAFotKrqAo5aBE4gApgBAkpwARyAAA2AAAFotKrqAH0O2dQEAAAAAAACU54J1MKOWgQAAAKYAwJKcAENgAANgAABaLSq6gKOWgQPoAKYAQJKcAEbgAANgAABaLSq6gKOWgQfQAKYAQJKcAEagAANgAABaLSq6gKOWgQu4AKYAQJKcAEaAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEZAAANgAABaLSq6gKOWgROIAKYAQJKcAEYAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCjKCjloEAAACmAECSnABF4AADYAAAWi0quoCjloED6ACmAECSnABFwAADYAAAWi0quoCjloEH0ACmAECSnABFoAADYAAAWi0quoCjloELuACmAECSnABFgAADYAAAWi0quoCjloEPoACmAMCSnABDYAADYAAAWi0quoCjloETiACmAECSnABFYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngqQQo5aBAAAApgBAkpwARUAAA2AAAFotKrqAo5aBA+gApgBAkpwARSAAA2AAAFotKrqAo5aBB9AApgBAkpwARQAAA2AAAFotKrqAo5aBC7gApgBAkpwARQAAA2AAAFotKrqAo5aBD6AApgBAkpwAROAAA2AAAFotKrqAo5aBE4gApgBAkpwARMAAA2AAAFotKrqAH0O2dQEAAAAAAACU54K7gKOWgQAAAKYAQJKcAESgAANgAABaLSq6gKOWgQPoAKYAQJKcAESAAANgAABaLSq6gKOWgQfQAKYAwJKcAENgAANgAABaLSq6gKOWgQu4AKYAQJKcAERgAANgAABaLSq6gKOWgQ+gAKYAQJKcAERAAANgAABaLSq6gKOWgROIAKYAQJKcAEQgAANgAABaLSq6gB9DtnUBAAAAAAAAlOeC0vCjloEAAACmAECSnABEIAADYAAAWi0quoCjloED6ACmAECSnABEAAADYAAAWi0quoCjloEH0ACmAECSnABD4AADYAAAWi0quoCjloELuACmAECSnABDwAADYAAAWi0quoCjloEPoACmAECSnABDoAADYAAAWi0quoCjloETiACmAECSnABDgAADYAAAWi0quoAcU7trAQAAAAAAABG7j7OBALeK94EB8YIBd/CBAw=="),t.play())},this.release=function(){t.pause(),t.src=""}}},8217:(t,e,n)=>{"use strict";n.d(e,{A:()=>E});var i=n(963),r=n.n(i),s=n(9089),o=n.n(s),a=n(6492),l=n.n(a),c=new URL(n(9169),n.b),h=new URL(n(6085),n.b),u=new URL(n(3931),n.b),d=new URL(n(7889),n.b),p=new URL(n(6517),n.b),A=o()(r()),f=l()(c),m=l()(h),g=l()(u),v=l()(d),y=l()(p);A.push([t.id,`/* .a-fullscreen means not embedded. */\nhtml.a-fullscreen {\n bottom: 0;\n left: 0;\n position: fixed;\n right: 0;\n top: 0;\n}\n\nhtml.a-fullscreen body {\n height: 100%;\n margin: 0;\n overflow: hidden;\n padding: 0;\n width: 100%;\n}\n\n/* Class is removed when doing <a-scene embedded>. */\nhtml.a-fullscreen .a-canvas {\n width: 100% !important;\n height: 100% !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n position: fixed !important;\n}\n\nhtml:not(.a-fullscreen) .a-enter-vr,\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 5px;\n bottom: 5px;\n}\n\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 60px;\n}\n\n/* In chrome mobile the user agent stylesheet set it to white */\n:-webkit-full-screen {\n background-color: transparent;\n}\n\n.a-hidden {\n display: none !important;\n}\n\n.a-canvas {\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.a-canvas.a-grab-cursor:hover {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\ncanvas.a-canvas.a-mouse-cursor-hover:hover {\n cursor: pointer;\n}\n\n.a-inspector-loader {\n background-color: #ed3160;\n position: fixed;\n left: 3px;\n top: 3px;\n padding: 6px 10px;\n color: #fff;\n text-decoration: none;\n font-size: 12px;\n font-family: Roboto,sans-serif;\n text-align: center;\n z-index: 99999;\n width: 204px;\n}\n\n/* Inspector loader animation */\n@keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n@-webkit-keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@-webkit-keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@-webkit-keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n\n.a-inspector-loader .dots span {\n animation: dots-1 2s infinite steps(1);\n -webkit-animation: dots-1 2s infinite steps(1);\n}\n\n.a-inspector-loader .dots span:first-child + span {\n animation-name: dots-2;\n -webkit-animation-name: dots-2;\n}\n\n.a-inspector-loader .dots span:first-child + span + span {\n animation-name: dots-3;\n -webkit-animation-name: dots-3;\n}\n\na-scene {\n display: block;\n position: relative;\n height: 100%;\n width: 100%;\n}\n\na-assets,\na-scene video,\na-scene img,\na-scene audio {\n display: none;\n}\n\n.a-enter-vr-modal,\n.a-orientation-modal {\n font-family: Consolas, Andale Mono, Courier New, monospace;\n}\n\n.a-enter-vr-modal a {\n border-bottom: 1px solid #fff;\n padding: 2px 0;\n text-decoration: none;\n transition: .1s color ease-in;\n}\n\n.a-enter-vr-modal a:hover {\n background-color: #fff;\n color: #111;\n padding: 2px 4px;\n position: relative;\n left: -4px;\n}\n\n.a-enter-vr,\n.a-enter-ar {\n font-family: sans-serif, monospace;\n font-size: 13px;\n width: 100%;\n font-weight: 200;\n line-height: 16px;\n position: absolute;\n right: 20px;\n bottom: 20px;\n}\n\n.a-enter-ar.xr {\n right: 90px;\n}\n\n.a-enter-vr-button,\n.a-enter-vr-modal,\n.a-enter-vr-modal a {\n color: #fff;\n user-select: none;\n outline: none;\n}\n\n.a-enter-vr-button {\n background: rgba(0, 0, 0, 0.35) url(${f}) 50% 50% no-repeat;\n}\n\n.a-enter-ar-button {\n background: rgba(0, 0, 0, 0.20) url(${m}) 50% 50% no-repeat;\n}\n\n.a-enter-vr.fullscreen .a-enter-vr-button {\n background-image: url(${g});\n}\n\n.a-enter-vr-button,\n.a-enter-ar-button {\n background-size: 90% 90%;\n border: 0;\n bottom: 0;\n cursor: pointer;\n min-width: 58px;\n min-height: 34px;\n /* 1.74418604651 */\n /*\n In order to keep the aspect ratio when resizing\n padding-top percentages are relative to the containing block's width.\n http://stackoverflow.com/questions/12121090/responsively-change-div-size-keeping-aspect-ratio\n */\n padding-right: 0;\n padding-top: 0;\n position: absolute;\n right: 0;\n transition: background-color .05s ease;\n -webkit-transition: background-color .05s ease;\n z-index: 9999;\n border-radius: 8px;\n touch-action: manipulation; /* Prevent iOS double tap zoom on the button */\n}\n\n.a-enter-ar-button {\n background-size: 100% 90%;\n border-radius: 7px;\n}\n\n.a-enter-ar-button:active,\n.a-enter-ar-button:hover,\n.a-enter-vr-button:active,\n.a-enter-vr-button:hover {\n background-color: #ef2d5e;\n}\n\n.a-enter-vr-button.resethover {\n background-color: rgba(0, 0, 0, 0.35);\n}\n\n.a-enter-vr-modal {\n background-color: #666;\n border-radius: 0;\n display: none;\n min-height: 32px;\n margin-right: 70px;\n padding: 9px;\n width: 280px;\n right: 2%;\n position: absolute;\n}\n\n.a-enter-vr-modal:after {\n border-bottom: 10px solid transparent;\n border-left: 10px solid #666;\n border-top: 10px solid transparent;\n display: inline-block;\n content: '';\n position: absolute;\n right: -5px;\n top: 5px;\n width: 0;\n height: 0;\n}\n\n.a-enter-vr-modal p,\n.a-enter-vr-modal a {\n display: inline;\n}\n\n.a-enter-vr-modal p {\n margin: 0;\n}\n\n.a-enter-vr-modal p:after {\n content: ' ';\n}\n\n.a-orientation-modal {\n background: rgba(244, 244, 244, 1) url(${v}) center no-repeat;\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-orientation-modal:after {\n color: #666;\n content: "Insert phone into Cardboard holder.";\n display: block;\n position: absolute;\n text-align: center;\n top: 70%;\n transform: translateY(-70%);\n width: 100%;\n}\n\n.a-orientation-modal button {\n background: url(${y}) no-repeat;\n border: none;\n height: 50px;\n text-indent: -9999px;\n width: 50px;\n}\n\n.a-loader-title {\n background-color: rgba(0, 0, 0, 0.6);\n font-family: sans-serif, monospace;\n text-align: center;\n font-size: 20px;\n height: 50px;\n font-weight: 300;\n line-height: 50px;\n position: absolute;\n right: 0px;\n left: 0px;\n top: 0px;\n color: white;\n}\n\n.a-modal {\n position: absolute;\n background: rgba(0, 0, 0, 0.60);\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-dialog {\n position: relative;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n z-index: 199995;\n width: 300px;\n height: 200px;\n background-size: contain;\n background-color: white;\n font-family: sans-serif, monospace;\n font-size: 20px;\n border-radius: 3px;\n padding: 6px;\n}\n\n.a-dialog-text-container {\n width: 100%;\n height: 70%;\n align-self: flex-start;\n display: flex;\n justify-content: center;\n align-content: center;\n flex-direction: column;\n}\n\n.a-dialog-text {\n display: inline-block;\n font-weight: normal;\n font-size: 14pt;\n margin: 8px;\n}\n\n.a-dialog-buttons-container {\n display: inline-flex;\n align-self: flex-end;\n width: 100%;\n height: 30%;\n}\n\n.a-dialog-button {\n cursor: pointer;\n align-self: center;\n opacity: 0.9;\n height: 80%;\n width: 50%;\n font-size: 12pt;\n margin: 4px;\n border-radius: 2px;\n text-align:center;\n border: none;\n display: inline-block;\n -webkit-transition: all 0.25s ease-in-out;\n transition: all 0.25s ease-in-out;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.20);\n user-select: none;\n}\n\n.a-dialog-permission-button:hover {\n box-shadow: 0 7px 14px rgba(0,0,0,0.20), 0 2px 2px rgba(0,0,0,0.20);\n}\n\n.a-dialog-allow-button {\n background-color: #00ceff;\n}\n\n.a-dialog-deny-button {\n background-color: #ff005b;\n}\n\n.a-dialog-ok-button {\n background-color: #00ceff;\n width: 100%;\n}\n\n.a-dom-overlay:not(.a-no-style) {\n overflow: hidden;\n position: absolute;\n pointer-events: none;\n box-sizing: border-box;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n padding: 1em;\n}\n\n.a-dom-overlay:not(.a-no-style)>* {\n pointer-events: auto;\n}\n`,"",{version:3,sources:["webpack://./src/style/aframe.css"],names:[],mappings:"AAAA,sCAAsC;AACtC;EACE,SAAS;EACT,OAAO;EACP,eAAe;EACf,QAAQ;EACR,MAAM;AACR;;AAEA;EACE,YAAY;EACZ,SAAS;EACT,gBAAgB;EAChB,UAAU;EACV,WAAW;AACb;;AAEA,oDAAoD;AACpD;EACE,sBAAsB;EACtB,uBAAuB;EACvB,iBAAiB;EACjB,kBAAkB;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,0BAA0B;AAC5B;;AAEA;;EAEE,UAAU;EACV,WAAW;AACb;;AAEA;EACE,WAAW;AACb;;AAEA,gEAAgE;AAChE;EACE,6BAA6B;AAC/B;;AAEA;EACE,wBAAwB;AAC1B;;AAEA;EACE,YAAY;EACZ,OAAO;EACP,kBAAkB;EAClB,MAAM;EACN,WAAW;AACb;;AAEA;EACE,YAAY;EACZ,iBAAiB;EACjB,oBAAoB;AACtB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,yBAAyB;EACzB,eAAe;EACf,SAAS;EACT,QAAQ;EACR,iBAAiB;EACjB,WAAW;EACX,qBAAqB;EACrB,eAAe;EACf,8BAA8B;EAC9B,kBAAkB;EAClB,cAAc;EACd,YAAY;AACd;;AAEA,+BAA+B;AAC/B,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AACrE,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AACrE,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;;AAErE;EACE,sCAAsC;EACtC,8CAA8C;AAChD;;AAEA;EACE,sBAAsB;EACtB,8BAA8B;AAChC;;AAEA;EACE,sBAAsB;EACtB,8BAA8B;AAChC;;AAEA;EACE,cAAc;EACd,kBAAkB;EAClB,YAAY;EACZ,WAAW;AACb;;AAEA;;;;EAIE,aAAa;AACf;;AAEA;;EAEE,0DAA0D;AAC5D;;AAEA;EACE,6BAA6B;EAC7B,cAAc;EACd,qBAAqB;EACrB,6BAA6B;AAC/B;;AAEA;EACE,sBAAsB;EACtB,WAAW;EACX,gBAAgB;EAChB,kBAAkB;EAClB,UAAU;AACZ;;AAEA;;EAEE,kCAAkC;EAClC,eAAe;EACf,WAAW;EACX,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EAClB,WAAW;EACX,YAAY;AACd;;AAEA;EACE,WAAW;AACb;;AAEA;;;EAGE,WAAW;EACX,iBAAiB;EACjB,aAAa;AACf;;AAEA;EACE,yFAA4qB;AAC9qB;;AAEA;EACE,yFAAkzB;AACpzB;;AAEA;EACE,yDAA2qK;AAC7qK;;AAEA;;EAEE,wBAAwB;EACxB,SAAS;EACT,SAAS;EACT,eAAe;EACf,eAAe;EACf,gBAAgB;EAChB,kBAAkB;EAClB;;;;GAIC;EACD,gBAAgB;EAChB,cAAc;EACd,kBAAkB;EAClB,QAAQ;EACR,sCAAsC;EACtC,8CAA8C;EAC9C,aAAa;EACb,kBAAkB;EAClB,0BAA0B,EAAE,8CAA8C;AAC5E;;AAEA;EACE,yBAAyB;EACzB,kBAAkB;AACpB;;AAEA;;;;EAIE,yBAAyB;AAC3B;;AAEA;EACE,qCAAqC;AACvC;;AAEA;EACE,sBAAsB;EACtB,gBAAgB;EAChB,aAAa;EACb,gBAAgB;EAChB,kBAAkB;EAClB,YAAY;EACZ,YAAY;EACZ,SAAS;EACT,kBAAkB;AACpB;;AAEA;EACE,qCAAqC;EACrC,4BAA4B;EAC5B,kCAAkC;EAClC,qBAAqB;EACrB,WAAW;EACX,kBAAkB;EAClB,WAAW;EACX,QAAQ;EACR,QAAQ;EACR,SAAS;AACX;;AAEA;;EAEE,eAAe;AACjB;;AAEA;EACE,SAAS;AACX;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,2FAAivF;EACjvF,wBAAwB;EACxB,SAAS;EACT,eAAe;EACf,gBAAgB;EAChB,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,eAAe;EACf,MAAM;EACN,gBAAgB;AAClB;;AAEA;EACE,WAAW;EACX,8CAA8C;EAC9C,cAAc;EACd,kBAAkB;EAClB,kBAAkB;EAClB,QAAQ;EACR,2BAA2B;EAC3B,WAAW;AACb;;AAEA;EACE,6DAA25B;EAC35B,YAAY;EACZ,YAAY;EACZ,oBAAoB;EACpB,WAAW;AACb;;AAEA;EACE,oCAAoC;EACpC,kCAAkC;EAClC,kBAAkB;EAClB,eAAe;EACf,YAAY;EACZ,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EAClB,UAAU;EACV,SAAS;EACT,QAAQ;EACR,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,+BAA+B;EAC/B,wBAAwB;EACxB,SAAS;EACT,eAAe;EACf,gBAAgB;EAChB,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,eAAe;EACf,MAAM;EACN,gBAAgB;AAClB;;AAEA;EACE,kBAAkB;EAClB,SAAS;EACT,QAAQ;EACR,gCAAgC;EAChC,eAAe;EACf,YAAY;EACZ,aAAa;EACb,wBAAwB;EACxB,uBAAuB;EACvB,kCAAkC;EAClC,eAAe;EACf,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,WAAW;EACX,WAAW;EACX,sBAAsB;EACtB,aAAa;EACb,uBAAuB;EACvB,qBAAqB;EACrB,sBAAsB;AACxB;;AAEA;EACE,qBAAqB;EACrB,mBAAmB;EACnB,eAAe;EACf,WAAW;AACb;;AAEA;EACE,oBAAoB;EACpB,oBAAoB;EACpB,WAAW;EACX,WAAW;AACb;;AAEA;EACE,eAAe;EACf,kBAAkB;EAClB,YAAY;EACZ,WAAW;EACX,UAAU;EACV,eAAe;EACf,WAAW;EACX,kBAAkB;EAClB,iBAAiB;EACjB,YAAY;EACZ,qBAAqB;EACrB,yCAAyC;EACzC,iCAAiC;EACjC,wEAAwE;EACxE,iBAAiB;AACnB;;AAEA;EACE,mEAAmE;AACrE;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,yBAAyB;EACzB,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,oBAAoB;EACpB,sBAAsB;EACtB,SAAS;EACT,OAAO;EACP,QAAQ;EACR,MAAM;EACN,YAAY;AACd;;AAEA;EACE,oBAAoB;AACtB",sourcesContent:["/* .a-fullscreen means not embedded. */\nhtml.a-fullscreen {\n bottom: 0;\n left: 0;\n position: fixed;\n right: 0;\n top: 0;\n}\n\nhtml.a-fullscreen body {\n height: 100%;\n margin: 0;\n overflow: hidden;\n padding: 0;\n width: 100%;\n}\n\n/* Class is removed when doing <a-scene embedded>. */\nhtml.a-fullscreen .a-canvas {\n width: 100% !important;\n height: 100% !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n position: fixed !important;\n}\n\nhtml:not(.a-fullscreen) .a-enter-vr,\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 5px;\n bottom: 5px;\n}\n\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 60px;\n}\n\n/* In chrome mobile the user agent stylesheet set it to white */\n:-webkit-full-screen {\n background-color: transparent;\n}\n\n.a-hidden {\n display: none !important;\n}\n\n.a-canvas {\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.a-canvas.a-grab-cursor:hover {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\ncanvas.a-canvas.a-mouse-cursor-hover:hover {\n cursor: pointer;\n}\n\n.a-inspector-loader {\n background-color: #ed3160;\n position: fixed;\n left: 3px;\n top: 3px;\n padding: 6px 10px;\n color: #fff;\n text-decoration: none;\n font-size: 12px;\n font-family: Roboto,sans-serif;\n text-align: center;\n z-index: 99999;\n width: 204px;\n}\n\n/* Inspector loader animation */\n@keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n@-webkit-keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@-webkit-keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@-webkit-keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n\n.a-inspector-loader .dots span {\n animation: dots-1 2s infinite steps(1);\n -webkit-animation: dots-1 2s infinite steps(1);\n}\n\n.a-inspector-loader .dots span:first-child + span {\n animation-name: dots-2;\n -webkit-animation-name: dots-2;\n}\n\n.a-inspector-loader .dots span:first-child + span + span {\n animation-name: dots-3;\n -webkit-animation-name: dots-3;\n}\n\na-scene {\n display: block;\n position: relative;\n height: 100%;\n width: 100%;\n}\n\na-assets,\na-scene video,\na-scene img,\na-scene audio {\n display: none;\n}\n\n.a-enter-vr-modal,\n.a-orientation-modal {\n font-family: Consolas, Andale Mono, Courier New, monospace;\n}\n\n.a-enter-vr-modal a {\n border-bottom: 1px solid #fff;\n padding: 2px 0;\n text-decoration: none;\n transition: .1s color ease-in;\n}\n\n.a-enter-vr-modal a:hover {\n background-color: #fff;\n color: #111;\n padding: 2px 4px;\n position: relative;\n left: -4px;\n}\n\n.a-enter-vr,\n.a-enter-ar {\n font-family: sans-serif, monospace;\n font-size: 13px;\n width: 100%;\n font-weight: 200;\n line-height: 16px;\n position: absolute;\n right: 20px;\n bottom: 20px;\n}\n\n.a-enter-ar.xr {\n right: 90px;\n}\n\n.a-enter-vr-button,\n.a-enter-vr-modal,\n.a-enter-vr-modal a {\n color: #fff;\n user-select: none;\n outline: none;\n}\n\n.a-enter-vr-button {\n background: rgba(0, 0, 0, 0.35) url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-vrmode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M68.81,21.56H64.23v8.27h4.58a4.13,4.13,0,0,0,3.1-1.09,4.2,4.2,0,0,0,1-3,4.24,4.24,0,0,0-1-3A4.05,4.05,0,0,0,68.81,21.56Z' fill='%23fff'/%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0ZM41.9,46H34L24,16h8l6,21.84,6-21.84H52Zm39.29,0H73.44L68.15,35.39H64.23V46H57V16H68.81q5.32,0,8.34,2.37a8,8,0,0,1,3,6.69,9.68,9.68,0,0,1-1.27,5.18,8.9,8.9,0,0,1-4,3.34l6.26,12.11Z' fill='%23fff'/%3E%3C/svg%3E\") 50% 50% no-repeat;\n}\n\n.a-enter-ar-button {\n background: rgba(0, 0, 0, 0.20) url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0Zm8,50a8,8,0,0,1-8,8H12a8,8,0,0,1-8-8V12a8,8,0,0,1,8-8H96a8,8,0,0,1,8,8Z' fill='%23fff'/%3E%3Cpath d='M43.35,39.82H32.51L30.45,46H23.88L35,16h5.73L52,46H45.43Zm-9.17-5h7.5L37.91,23.58Z' fill='%23fff'/%3E%3Cpath d='M68.11,35H63.18V46H57V16H68.15q5.31,0,8.2,2.37a8.18,8.18,0,0,1,2.88,6.7,9.22,9.22,0,0,1-1.33,5.12,9.09,9.09,0,0,1-4,3.26l6.49,12.26V46H73.73Zm-4.93-5h5a5.09,5.09,0,0,0,3.6-1.18,4.21,4.21,0,0,0,1.28-3.27,4.56,4.56,0,0,0-1.2-3.34A5,5,0,0,0,68.15,21h-5Z' fill='%23fff'/%3E%3C/svg%3E\") 50% 50% no-repeat;\n}\n\n.a-enter-vr.fullscreen .a-enter-vr-button {\n background-image: url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8' standalone='no'%3F%3E%3Csvg width='108' height='62' viewBox='0 0 108 62' version='1.1' id='svg320' sodipodi:docname='fullscreen-aframe.svg' xml:space='preserve' inkscape:version='1.2.1 (9c6d41e 2022-07-14)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3E%3Cdefs id='defs324' /%3E%3Csodipodi:namedview id='namedview322' pagecolor='%23ffffff' bordercolor='%23000000' borderopacity='0.25' inkscape:showpageshadow='2' inkscape:pageopacity='0.0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23d1d1d1' showgrid='false' inkscape:zoom='3.8064516' inkscape:cx='91.423729' inkscape:cy='-1.4449153' inkscape:window-width='1440' inkscape:window-height='847' inkscape:window-x='32' inkscape:window-y='25' inkscape:window-maximized='0' inkscape:current-layer='svg320' /%3E%3Ctitle id='title312'%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M96 0H12A12 12 0 0 0 0 12V50A12 12 0 0 0 12 62H96a12 12 0 0 0 12-12V12A12 12 0 0 0 96 0Zm8 50a8 8 0 0 1-8 8H12a8 8 0 0 1-8-8V12a8 8 0 0 1 8-8H96a8 8 0 0 1 8 8Z' fill='%23fff' id='path314' style='fill:%23ffffff' /%3E%3Cg id='g356' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g358' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g360' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g362' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g364' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g366' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g368' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g370' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g372' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g374' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g376' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g378' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g380' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g382' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g384' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cmetadata id='metadata561'%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=''%3E%3Cdc:title%3Eaframe-armode-noborder-reduced-tracking%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cpath d='m 98.168511 40.083649 c 0 -1.303681 -0.998788 -2.358041 -2.239389 -2.358041 -1.230088 0.0031 -2.240892 1.05436 -2.240892 2.358041 v 4.881296 l -9.041661 -9.041662 c -0.874129 -0.875631 -2.288954 -0.875631 -3.16308 0 -0.874129 0.874126 -0.874129 2.293459 0 3.167585 l 8.995101 8.992101 h -4.858767 c -1.323206 0.0031 -2.389583 1.004796 -2.389583 2.239386 0 1.237598 1.066377 2.237888 2.389583 2.237888 h 10.154599 c 1.323206 0 2.388082 -0.998789 2.392587 -2.237888 -0.0044 -0.03305 -0.009 -0.05858 -0.0134 -0.09161 0.0046 -0.04207 0.0134 -0.08712 0.0134 -0.13066 V 40.085172 h -1.52e-4' id='path596' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 23.091002 35.921781 -9.026643 9.041662 v -4.881296 c 0 -1.303681 -1.009302 -2.355037 -2.242393 -2.358041 -1.237598 0 -2.237888 1.05436 -2.237888 2.358041 l -0.0031 10.016421 c 0 0.04356 0.01211 0.08862 0.0015 0.130659 -0.0031 0.03153 -0.009 0.05709 -0.01211 0.09161 0.0031 1.239099 1.069379 2.237888 2.391085 2.237888 h 10.156101 c 1.320202 0 2.388079 -1.000291 2.388079 -2.237888 0 -1.234591 -1.067877 -2.236383 -2.388079 -2.239387 h -4.858767 l 8.995101 -8.9921 c 0.871126 -0.874127 0.871126 -2.293459 0 -3.167586 -0.875628 -0.877132 -2.291957 -0.877132 -3.169087 -1.52e-4' id='path598' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 84.649572 25.978033 9.041662 -9.041664 v 4.881298 c 0 1.299176 1.010806 2.350532 2.240891 2.355037 1.240601 0 2.23939 -1.055861 2.23939 -2.355037 V 11.798242 c 0 -0.04356 -0.009 -0.08862 -0.0134 -0.127671 0.0044 -0.03153 0.009 -0.06157 0.0134 -0.09313 -0.0044 -1.240598 -1.069379 -2.2393873 -2.391085 -2.2393873 h -10.1546 c -1.323205 0 -2.38958 0.9987893 -2.38958 2.2393873 0 1.233091 1.066375 2.237887 2.38958 2.240891 h 4.858768 l -8.995102 8.9921 c -0.874129 0.872625 -0.874129 2.288954 0 3.161578 0.874127 0.880137 2.288951 0.880137 3.16308 1.5e-4' id='path600' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 17.264988 13.822853 h 4.857265 c 1.320202 -0.0031 2.388079 -1.0078 2.388079 -2.240889 0 -1.240601 -1.067877 -2.2393893 -2.388079 -2.2393893 H 11.967654 c -1.321707 0 -2.388082 0.9987883 -2.391085 2.2393893 0.0031 0.03153 0.009 0.06157 0.01211 0.09313 -0.0031 0.03905 -0.0015 0.08262 -0.0015 0.127671 l 0.0031 10.020926 c 0 1.299176 1.00029 2.355038 2.237887 2.355038 1.233092 -0.0044 2.242393 -1.055862 2.242393 -2.355038 v -4.881295 l 9.026644 9.041661 c 0.877132 0.878635 2.293459 0.878635 3.169087 0 0.871125 -0.872624 0.871125 -2.288953 0 -3.161577 l -8.995282 -8.993616' id='path602' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3C/svg%3E\");\n}\n\n.a-enter-vr-button,\n.a-enter-ar-button {\n background-size: 90% 90%;\n border: 0;\n bottom: 0;\n cursor: pointer;\n min-width: 58px;\n min-height: 34px;\n /* 1.74418604651 */\n /*\n In order to keep the aspect ratio when resizing\n padding-top percentages are relative to the containing block's width.\n http://stackoverflow.com/questions/12121090/responsively-change-div-size-keeping-aspect-ratio\n */\n padding-right: 0;\n padding-top: 0;\n position: absolute;\n right: 0;\n transition: background-color .05s ease;\n -webkit-transition: background-color .05s ease;\n z-index: 9999;\n border-radius: 8px;\n touch-action: manipulation; /* Prevent iOS double tap zoom on the button */\n}\n\n.a-enter-ar-button {\n background-size: 100% 90%;\n border-radius: 7px;\n}\n\n.a-enter-ar-button:active,\n.a-enter-ar-button:hover,\n.a-enter-vr-button:active,\n.a-enter-vr-button:hover {\n background-color: #ef2d5e;\n}\n\n.a-enter-vr-button.resethover {\n background-color: rgba(0, 0, 0, 0.35);\n}\n\n.a-enter-vr-modal {\n background-color: #666;\n border-radius: 0;\n display: none;\n min-height: 32px;\n margin-right: 70px;\n padding: 9px;\n width: 280px;\n right: 2%;\n position: absolute;\n}\n\n.a-enter-vr-modal:after {\n border-bottom: 10px solid transparent;\n border-left: 10px solid #666;\n border-top: 10px solid transparent;\n display: inline-block;\n content: '';\n position: absolute;\n right: -5px;\n top: 5px;\n width: 0;\n height: 0;\n}\n\n.a-enter-vr-modal p,\n.a-enter-vr-modal a {\n display: inline;\n}\n\n.a-enter-vr-modal p {\n margin: 0;\n}\n\n.a-enter-vr-modal p:after {\n content: ' ';\n}\n\n.a-orientation-modal {\n background: rgba(244, 244, 244, 1) url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E) center no-repeat;\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-orientation-modal:after {\n color: #666;\n content: \"Insert phone into Cardboard holder.\";\n display: block;\n position: absolute;\n text-align: center;\n top: 70%;\n transform: translateY(-70%);\n width: 100%;\n}\n\n.a-orientation-modal button {\n background: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E) no-repeat;\n border: none;\n height: 50px;\n text-indent: -9999px;\n width: 50px;\n}\n\n.a-loader-title {\n background-color: rgba(0, 0, 0, 0.6);\n font-family: sans-serif, monospace;\n text-align: center;\n font-size: 20px;\n height: 50px;\n font-weight: 300;\n line-height: 50px;\n position: absolute;\n right: 0px;\n left: 0px;\n top: 0px;\n color: white;\n}\n\n.a-modal {\n position: absolute;\n background: rgba(0, 0, 0, 0.60);\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-dialog {\n position: relative;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n z-index: 199995;\n width: 300px;\n height: 200px;\n background-size: contain;\n background-color: white;\n font-family: sans-serif, monospace;\n font-size: 20px;\n border-radius: 3px;\n padding: 6px;\n}\n\n.a-dialog-text-container {\n width: 100%;\n height: 70%;\n align-self: flex-start;\n display: flex;\n justify-content: center;\n align-content: center;\n flex-direction: column;\n}\n\n.a-dialog-text {\n display: inline-block;\n font-weight: normal;\n font-size: 14pt;\n margin: 8px;\n}\n\n.a-dialog-buttons-container {\n display: inline-flex;\n align-self: flex-end;\n width: 100%;\n height: 30%;\n}\n\n.a-dialog-button {\n cursor: pointer;\n align-self: center;\n opacity: 0.9;\n height: 80%;\n width: 50%;\n font-size: 12pt;\n margin: 4px;\n border-radius: 2px;\n text-align:center;\n border: none;\n display: inline-block;\n -webkit-transition: all 0.25s ease-in-out;\n transition: all 0.25s ease-in-out;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.20);\n user-select: none;\n}\n\n.a-dialog-permission-button:hover {\n box-shadow: 0 7px 14px rgba(0,0,0,0.20), 0 2px 2px rgba(0,0,0,0.20);\n}\n\n.a-dialog-allow-button {\n background-color: #00ceff;\n}\n\n.a-dialog-deny-button {\n background-color: #ff005b;\n}\n\n.a-dialog-ok-button {\n background-color: #00ceff;\n width: 100%;\n}\n\n.a-dom-overlay:not(.a-no-style) {\n overflow: hidden;\n position: absolute;\n pointer-events: none;\n box-sizing: border-box;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n padding: 1em;\n}\n\n.a-dom-overlay:not(.a-no-style)>* {\n pointer-events: auto;\n}\n"],sourceRoot:""}]);const E=A},2470:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(963),r=n.n(i),s=n(9089),o=n.n(s)()(r());o.push([t.id,".rs-base {\n background-color: #333;\n color: #fafafa;\n border-radius: 0;\n font: 10px monospace;\n left: 5px;\n line-height: 1em;\n opacity: 0.85;\n overflow: hidden;\n padding: 10px;\n position: fixed;\n top: 5px;\n width: 300px;\n z-index: 10000;\n}\n\n.rs-base div.hidden {\n display: none;\n}\n\n.rs-base h1 {\n color: #fff;\n cursor: pointer;\n font-size: 1.4em;\n font-weight: 300;\n margin: 0 0 5px;\n padding: 0;\n}\n\n.rs-group {\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n -webkit-flex-direction: column-reverse;\n flex-direction: column-reverse;\n margin-bottom: 5px;\n}\n\n.rs-group:last-child {\n margin-bottom: 0;\n}\n\n.rs-counter-base {\n align-items: center;\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n height: 10px;\n -webkit-justify-content: space-between;\n justify-content: space-between;\n margin: 2px 0;\n}\n\n.rs-counter-base.alarm {\n color: #b70000;\n text-shadow: 0 0 0 #b70000,\n 0 0 1px #fff,\n 0 0 1px #fff,\n 0 0 2px #fff,\n 0 0 2px #fff,\n 0 0 3px #fff,\n 0 0 3px #fff,\n 0 0 4px #fff,\n 0 0 4px #fff;\n}\n\n.rs-counter-id {\n font-weight: 300;\n -webkit-box-ordinal-group: 0;\n -webkit-order: 0;\n order: 0;\n width: 54px;\n}\n\n.rs-counter-value {\n font-weight: 300;\n -webkit-box-ordinal-group: 1;\n -webkit-order: 1;\n order: 1;\n text-align: right;\n width: 35px;\n}\n\n.rs-canvas {\n -webkit-box-ordinal-group: 2;\n -webkit-order: 2;\n order: 2;\n}\n\n@media (min-width: 480px) {\n .rs-base {\n left: 20px;\n top: 20px;\n }\n}\n","",{version:3,sources:["webpack://./src/style/rStats.css"],names:[],mappings:"AAAA;EACE,sBAAsB;EACtB,cAAc;EACd,gBAAgB;EAChB,oBAAoB;EACpB,SAAS;EACT,gBAAgB;EAChB,aAAa;EACb,gBAAgB;EAChB,aAAa;EACb,eAAe;EACf,QAAQ;EACR,YAAY;EACZ,cAAc;AAChB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,WAAW;EACX,eAAe;EACf,gBAAgB;EAChB,gBAAgB;EAChB,eAAe;EACf,UAAU;AACZ;;AAEA;EACE,oBAAoB;EACpB,qBAAqB;EACrB,aAAa;EACb,sCAAsC;EACtC,8BAA8B;EAC9B,kBAAkB;AACpB;;AAEA;EACE,gBAAgB;AAClB;;AAEA;EACE,mBAAmB;EACnB,oBAAoB;EACpB,qBAAqB;EACrB,aAAa;EACb,YAAY;EACZ,sCAAsC;EACtC,8BAA8B;EAC9B,aAAa;AACf;;AAEA;EACE,cAAc;EACd;;;;;;;;2BAQyB;AAC3B;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;EACR,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;EACR,iBAAiB;EACjB,WAAW;AACb;;AAEA;EACE,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;AACV;;AAEA;EACE;IACE,UAAU;IACV,SAAS;EACX;AACF",sourcesContent:[".rs-base {\n background-color: #333;\n color: #fafafa;\n border-radius: 0;\n font: 10px monospace;\n left: 5px;\n line-height: 1em;\n opacity: 0.85;\n overflow: hidden;\n padding: 10px;\n position: fixed;\n top: 5px;\n width: 300px;\n z-index: 10000;\n}\n\n.rs-base div.hidden {\n display: none;\n}\n\n.rs-base h1 {\n color: #fff;\n cursor: pointer;\n font-size: 1.4em;\n font-weight: 300;\n margin: 0 0 5px;\n padding: 0;\n}\n\n.rs-group {\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n -webkit-flex-direction: column-reverse;\n flex-direction: column-reverse;\n margin-bottom: 5px;\n}\n\n.rs-group:last-child {\n margin-bottom: 0;\n}\n\n.rs-counter-base {\n align-items: center;\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n height: 10px;\n -webkit-justify-content: space-between;\n justify-content: space-between;\n margin: 2px 0;\n}\n\n.rs-counter-base.alarm {\n color: #b70000;\n text-shadow: 0 0 0 #b70000,\n 0 0 1px #fff,\n 0 0 1px #fff,\n 0 0 2px #fff,\n 0 0 2px #fff,\n 0 0 3px #fff,\n 0 0 3px #fff,\n 0 0 4px #fff,\n 0 0 4px #fff;\n}\n\n.rs-counter-id {\n font-weight: 300;\n -webkit-box-ordinal-group: 0;\n -webkit-order: 0;\n order: 0;\n width: 54px;\n}\n\n.rs-counter-value {\n font-weight: 300;\n -webkit-box-ordinal-group: 1;\n -webkit-order: 1;\n order: 1;\n text-align: right;\n width: 35px;\n}\n\n.rs-canvas {\n -webkit-box-ordinal-group: 2;\n -webkit-order: 2;\n order: 2;\n}\n\n@media (min-width: 480px) {\n .rs-base {\n left: 20px;\n top: 20px;\n }\n}\n"],sourceRoot:""}]);const a=o},7180:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>g});var i=n(5072),r=n.n(i),s=n(7825),o=n.n(s),a=n(7659),l=n.n(a),c=n(5056),h=n.n(c),u=n(540),d=n.n(u),p=n(1113),A=n.n(p),f=n(8217),m={};m.styleTagTransform=A(),m.setAttributes=h(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=d(),r()(f.A,m);const g=f.A&&f.A.locals?f.A.locals:void 0},9379:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>g});var i=n(5072),r=n.n(i),s=n(7825),o=n.n(s),a=n(7659),l=n.n(a),c=n(5056),h=n.n(c),u=n(540),d=n.n(u),p=n(1113),A=n.n(p),f=n(2470),m={};m.styleTagTransform=A(),m.setAttributes=h(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=d(),r()(f.A,m);const g=f.A&&f.A.locals?f.A.locals:void 0},5072:t=>{"use strict";var e=[];function n(t){for(var n=-1,i=0;i<e.length;i++)if(e[i].identifier===t){n=i;break}return n}function i(t,i){for(var s={},o=[],a=0;a<t.length;a++){var l=t[a],c=i.base?l[0]+i.base:l[0],h=s[c]||0,u="".concat(c," ").concat(h);s[c]=h+1;var d=n(u),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(p);else{var A=r(p,i);i.byIndex=a,e.splice(a,0,{identifier:u,updater:A,references:1})}o.push(u)}return o}function r(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,r){var s=i(t=t||[],r=r||{});return function(t){t=t||[];for(var o=0;o<s.length;o++){var a=n(s[o]);e[a].references--}for(var l=i(t,r),c=0;c<s.length;c++){var h=n(s[c]);0===e[h].references&&(e[h].updater(),e.splice(h,1))}s=l}}},7659:t=>{"use strict";var e={};t.exports=function(t,n){var i=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},5056:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},7825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},1113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},3931:t=>{"use strict";t.exports="data:image/svg+xml,%3C%3Fxml version=%271.0%27 encoding=%27UTF-8%27 standalone=%27no%27%3F%3E%3Csvg width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27 version=%271.1%27 id=%27svg320%27 sodipodi:docname=%27fullscreen-aframe.svg%27 xml:space=%27preserve%27 inkscape:version=%271.2.1 %289c6d41e 2022-07-14%29%27 xmlns:inkscape=%27http://www.inkscape.org/namespaces/inkscape%27 xmlns:sodipodi=%27http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd%27 xmlns=%27http://www.w3.org/2000/svg%27 xmlns:svg=%27http://www.w3.org/2000/svg%27 xmlns:rdf=%27http://www.w3.org/1999/02/22-rdf-syntax-ns%23%27 xmlns:cc=%27http://creativecommons.org/ns%23%27 xmlns:dc=%27http://purl.org/dc/elements/1.1/%27%3E%3Cdefs id=%27defs324%27 /%3E%3Csodipodi:namedview id=%27namedview322%27 pagecolor=%27%23ffffff%27 bordercolor=%27%23000000%27 borderopacity=%270.25%27 inkscape:showpageshadow=%272%27 inkscape:pageopacity=%270.0%27 inkscape:pagecheckerboard=%270%27 inkscape:deskcolor=%27%23d1d1d1%27 showgrid=%27false%27 inkscape:zoom=%273.8064516%27 inkscape:cx=%2791.423729%27 inkscape:cy=%27-1.4449153%27 inkscape:window-width=%271440%27 inkscape:window-height=%27847%27 inkscape:window-x=%2732%27 inkscape:window-y=%2725%27 inkscape:window-maximized=%270%27 inkscape:current-layer=%27svg320%27 /%3E%3Ctitle id=%27title312%27%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M96 0H12A12 12 0 0 0 0 12V50A12 12 0 0 0 12 62H96a12 12 0 0 0 12-12V12A12 12 0 0 0 96 0Zm8 50a8 8 0 0 1-8 8H12a8 8 0 0 1-8-8V12a8 8 0 0 1 8-8H96a8 8 0 0 1 8 8Z%27 fill=%27%23fff%27 id=%27path314%27 style=%27fill:%23ffffff%27 /%3E%3Cg id=%27g356%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g358%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g360%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g362%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g364%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g366%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g368%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g370%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g372%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g374%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g376%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g378%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g380%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g382%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g384%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cmetadata id=%27metadata561%27%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=%27%27%3E%3Cdc:title%3Eaframe-armode-noborder-reduced-tracking%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cpath d=%27m 98.168511 40.083649 c 0 -1.303681 -0.998788 -2.358041 -2.239389 -2.358041 -1.230088 0.0031 -2.240892 1.05436 -2.240892 2.358041 v 4.881296 l -9.041661 -9.041662 c -0.874129 -0.875631 -2.288954 -0.875631 -3.16308 0 -0.874129 0.874126 -0.874129 2.293459 0 3.167585 l 8.995101 8.992101 h -4.858767 c -1.323206 0.0031 -2.389583 1.004796 -2.389583 2.239386 0 1.237598 1.066377 2.237888 2.389583 2.237888 h 10.154599 c 1.323206 0 2.388082 -0.998789 2.392587 -2.237888 -0.0044 -0.03305 -0.009 -0.05858 -0.0134 -0.09161 0.0046 -0.04207 0.0134 -0.08712 0.0134 -0.13066 V 40.085172 h -1.52e-4%27 id=%27path596%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 23.091002 35.921781 -9.026643 9.041662 v -4.881296 c 0 -1.303681 -1.009302 -2.355037 -2.242393 -2.358041 -1.237598 0 -2.237888 1.05436 -2.237888 2.358041 l -0.0031 10.016421 c 0 0.04356 0.01211 0.08862 0.0015 0.130659 -0.0031 0.03153 -0.009 0.05709 -0.01211 0.09161 0.0031 1.239099 1.069379 2.237888 2.391085 2.237888 h 10.156101 c 1.320202 0 2.388079 -1.000291 2.388079 -2.237888 0 -1.234591 -1.067877 -2.236383 -2.388079 -2.239387 h -4.858767 l 8.995101 -8.9921 c 0.871126 -0.874127 0.871126 -2.293459 0 -3.167586 -0.875628 -0.877132 -2.291957 -0.877132 -3.169087 -1.52e-4%27 id=%27path598%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 84.649572 25.978033 9.041662 -9.041664 v 4.881298 c 0 1.299176 1.010806 2.350532 2.240891 2.355037 1.240601 0 2.23939 -1.055861 2.23939 -2.355037 V 11.798242 c 0 -0.04356 -0.009 -0.08862 -0.0134 -0.127671 0.0044 -0.03153 0.009 -0.06157 0.0134 -0.09313 -0.0044 -1.240598 -1.069379 -2.2393873 -2.391085 -2.2393873 h -10.1546 c -1.323205 0 -2.38958 0.9987893 -2.38958 2.2393873 0 1.233091 1.066375 2.237887 2.38958 2.240891 h 4.858768 l -8.995102 8.9921 c -0.874129 0.872625 -0.874129 2.288954 0 3.161578 0.874127 0.880137 2.288951 0.880137 3.16308 1.5e-4%27 id=%27path600%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 17.264988 13.822853 h 4.857265 c 1.320202 -0.0031 2.388079 -1.0078 2.388079 -2.240889 0 -1.240601 -1.067877 -2.2393893 -2.388079 -2.2393893 H 11.967654 c -1.321707 0 -2.388082 0.9987883 -2.391085 2.2393893 0.0031 0.03153 0.009 0.06157 0.01211 0.09313 -0.0031 0.03905 -0.0015 0.08262 -0.0015 0.127671 l 0.0031 10.020926 c 0 1.299176 1.00029 2.355038 2.237887 2.355038 1.233092 -0.0044 2.242393 -1.055862 2.242393 -2.355038 v -4.881295 l 9.026644 9.041661 c 0.877132 0.878635 2.293459 0.878635 3.169087 0 0.871125 -0.872624 0.871125 -2.288953 0 -3.161577 l -8.995282 -8.993616%27 id=%27path602%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3C/svg%3E"},6085:t=>{"use strict";t.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27%3E%3Ctitle%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0Zm8,50a8,8,0,0,1-8,8H12a8,8,0,0,1-8-8V12a8,8,0,0,1,8-8H96a8,8,0,0,1,8,8Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M43.35,39.82H32.51L30.45,46H23.88L35,16h5.73L52,46H45.43Zm-9.17-5h7.5L37.91,23.58Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M68.11,35H63.18V46H57V16H68.15q5.31,0,8.2,2.37a8.18,8.18,0,0,1,2.88,6.7,9.22,9.22,0,0,1-1.33,5.12,9.09,9.09,0,0,1-4,3.26l6.49,12.26V46H73.73Zm-4.93-5h5a5.09,5.09,0,0,0,3.6-1.18,4.21,4.21,0,0,0,1.28-3.27,4.56,4.56,0,0,0-1.2-3.34A5,5,0,0,0,68.15,21h-5Z%27 fill=%27%23fff%27/%3E%3C/svg%3E"},9169:t=>{"use strict";t.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27%3E%3Ctitle%3Eaframe-vrmode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M68.81,21.56H64.23v8.27h4.58a4.13,4.13,0,0,0,3.1-1.09,4.2,4.2,0,0,0,1-3,4.24,4.24,0,0,0-1-3A4.05,4.05,0,0,0,68.81,21.56Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0ZM41.9,46H34L24,16h8l6,21.84,6-21.84H52Zm39.29,0H73.44L68.15,35.39H64.23V46H57V16H68.81q5.32,0,8.34,2.37a8,8,0,0,1,3,6.69,9.68,9.68,0,0,1-1.27,5.18,8.9,8.9,0,0,1-4,3.34l6.26,12.11Z%27 fill=%27%23fff%27/%3E%3C/svg%3E"},6517:t=>{"use strict";t.exports="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E"},7889:t=>{"use strict";t.exports="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E"}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var s=e[i]={id:i,exports:{}};return t[i](s,s.exports,n),s.exports}n.m=t,n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.b=document.baseURI||self.location.href,n.nc=void 0;var i={};return(()=>{"use strict";n.d(i,{default:()=>sS});var t={};n.r(t),n.d(t,{ACESFilmicToneMapping:()=>De,AddEquation:()=>Zt,AddOperation:()=>Ie,AdditiveAnimationBlendMode:()=>vi,AdditiveBlending:()=>Xt,AgXToneMapping:()=>Ue,AlphaFormat:()=>gn,AlwaysCompare:()=>nr,AlwaysDepth:()=>ye,AlwaysStencilFunc:()=>Xi,AmbientLight:()=>ld,AnimationAction:()=>Zd,AnimationClip:()=>Ru,AnimationLoader:()=>Qu,AnimationMixer:()=>tp,AnimationObjectGroup:()=>Kd,AnimationUtils:()=>vu,ArcCurve:()=>Pc,ArrayCamera:()=>Id,ArrowHelper:()=>Yp,AttachedBindMode:()=>Fe,Audio:()=>Od,AudioAnalyser:()=>zd,AudioContext:()=>bd,AudioListener:()=>Ud,AudioLoader:()=>Cd,AxesHelper:()=>Jp,BackSide:()=>Vt,BasicDepthPacking:()=>bi,BasicShadowMap:()=>Nt,BatchedMesh:()=>nc,Bone:()=>vl,BooleanKeyframeTrack:()=>wu,Box2:()=>mp,Box3:()=>cs,Box3Helper:()=>Vp,BoxGeometry:()=>ya,BoxHelper:()=>Hp,BufferAttribute:()=>zo,BufferGeometry:()=>sa,BufferGeometryLoader:()=>fd,ByteType:()=>on,Cache:()=>Du,Camera:()=>_a,CameraHelper:()=>Qp,CanvasTexture:()=>Tc,CapsuleGeometry:()=>eh,CatmullRomCurve3:()=>Qc,CineonToneMapping:()=>Le,CircleGeometry:()=>nh,ClampToEdgeWrapping:()=>We,Clock:()=>Bd,Color:()=>Bo,ColorKeyframeTrack:()=>_u,ColorManagement:()=>zr,CompressedArrayTexture:()=>Ic,CompressedCubeTexture:()=>Bc,CompressedTexture:()=>Sc,CompressedTextureLoader:()=>Gu,ConeGeometry:()=>rh,ConstantAlphaFactor:()=>me,ConstantColorFactor:()=>Ae,Controls:()=>Zp,CubeCamera:()=>Ra,CubeReflectionMapping:()=>Qe,CubeRefractionMapping:()=>Ge,CubeTexture:()=>La,CubeTextureLoader:()=>Hu,CubeUVReflectionMapping:()=>Ve,CubicBezierCurve:()=>Vc,CubicBezierCurve3:()=>jc,CubicInterpolant:()=>Eu,CullFaceBack:()=>Ot,CullFaceFront:()=>Ft,CullFaceFrontBack:()=>kt,CullFaceNone:()=>Ut,Curve:()=>Lc,CurvePath:()=>Zc,CustomBlending:()=>Kt,CustomToneMapping:()=>Pe,CylinderGeometry:()=>ih,Cylindrical:()=>pp,Data3DTexture:()=>is,DataArrayTexture:()=>es,DataTexture:()=>yl,DataTextureLoader:()=>Vu,DataUtils:()=>ko,DecrementStencilOp:()=>Fi,DecrementWrapStencilOp:()=>Ni,DefaultLoadingManager:()=>Uu,DepthFormat:()=>bn,DepthStencilFormat:()=>Cn,DepthTexture:()=>Rc,DetachedBindMode:()=>ke,DirectionalLight:()=>ad,DirectionalLightHelper:()=>Fp,DiscreteInterpolant:()=>bu,DodecahedronGeometry:()=>oh,DoubleSide:()=>jt,DstAlphaFactor:()=>ce,DstColorFactor:()=>ue,DynamicCopyUsage:()=>hr,DynamicDrawUsage:()=>rr,DynamicReadUsage:()=>ar,EdgesGeometry:()=>uh,EllipseCurve:()=>Dc,EqualCompare:()=>Ki,EqualDepth:()=>be,EqualStencilFunc:()=>Hi,EquirectangularReflectionMapping:()=>ze,EquirectangularRefractionMapping:()=>He,Euler:()=>Ws,EventDispatcher:()=>gr,ExtrudeGeometry:()=>Qh,FileLoader:()=>Nu,Float16BufferAttribute:()=>Jo,Float32BufferAttribute:()=>Ko,FloatType:()=>un,Fog:()=>ka,FogExp2:()=>Fa,FramebufferTexture:()=>Mc,FrontSide:()=>Ht,Frustum:()=>kl,GLBufferAttribute:()=>ap,GLSL1:()=>dr,GLSL3:()=>pr,GreaterCompare:()=>$i,GreaterDepth:()=>we,GreaterEqualCompare:()=>er,GreaterEqualDepth:()=>Ce,GreaterEqualStencilFunc:()=>qi,GreaterStencilFunc:()=>ji,GridHelper:()=>Lp,Group:()=>Pa,HalfFloatType:()=>dn,HemisphereLight:()=>qu,HemisphereLightHelper:()=>Rp,IcosahedronGeometry:()=>zh,ImageBitmapLoader:()=>Ed,ImageLoader:()=>zu,ImageUtils:()=>Wr,IncrementStencilOp:()=>Oi,IncrementWrapStencilOp:()=>ki,InstancedBufferAttribute:()=>Cl,InstancedBufferGeometry:()=>Ad,InstancedInterleavedBuffer:()=>op,InstancedMesh:()=>Rl,Int16BufferAttribute:()=>Wo,Int32BufferAttribute:()=>Xo,Int8BufferAttribute:()=>Ho,IntType:()=>cn,InterleavedBuffer:()=>Qa,InterleavedBufferAttribute:()=>za,Interpolant:()=>yu,InterpolateDiscrete:()=>ui,InterpolateLinear:()=>di,InterpolateSmooth:()=>pi,InvertStencilOp:()=>Qi,KeepStencilOp:()=>Pi,KeyframeTrack:()=>Cu,LOD:()=>al,LatheGeometry:()=>th,Layers:()=>qs,LessCompare:()=>Ji,LessDepth:()=>Ee,LessEqualCompare:()=>Zi,LessEqualDepth:()=>xe,LessEqualStencilFunc:()=>Vi,LessStencilFunc:()=>zi,Light:()=>Wu,LightProbe:()=>ud,Line:()=>uc,Line3:()=>yp,LineBasicMaterial:()=>ic,LineCurve:()=>Wc,LineCurve3:()=>qc,LineDashedMaterial:()=>du,LineLoop:()=>mc,LineSegments:()=>fc,LinearFilter:()=>$e,LinearInterpolant:()=>xu,LinearMipMapLinearFilter:()=>rn,LinearMipMapNearestFilter:()=>en,LinearMipmapLinearFilter:()=>nn,LinearMipmapNearestFilter:()=>tn,LinearSRGBColorSpace:()=>Ti,LinearToneMapping:()=>Te,LinearTransfer:()=>Ri,Loader:()=>Ou,LoaderUtils:()=>pd,LoadingManager:()=>Pu,LoopOnce:()=>li,LoopPingPong:()=>hi,LoopRepeat:()=>ci,LuminanceAlphaFormat:()=>xn,LuminanceFormat:()=>En,MOUSE:()=>Dt,Material:()=>Lo,MaterialLoader:()=>dd,MathUtils:()=>Ir,Matrix2:()=>Ap,Matrix3:()=>Tr,Matrix4:()=>Os,MaxEquation:()=>ne,Mesh:()=>ga,MeshBasicMaterial:()=>Do,MeshDepthMaterial:()=>cu,MeshDistanceMaterial:()=>hu,MeshLambertMaterial:()=>lu,MeshMatcapMaterial:()=>uu,MeshNormalMaterial:()=>au,MeshPhongMaterial:()=>su,MeshPhysicalMaterial:()=>ru,MeshStandardMaterial:()=>iu,MeshToonMaterial:()=>ou,MinEquation:()=>ee,MirroredRepeatWrapping:()=>qe,MixOperation:()=>Se,MultiplyBlending:()=>Jt,MultiplyOperation:()=>Me,NearestFilter:()=>Xe,NearestMipMapLinearFilter:()=>Ze,NearestMipMapNearestFilter:()=>Je,NearestMipmapLinearFilter:()=>Ke,NearestMipmapNearestFilter:()=>Ye,NeutralToneMapping:()=>Oe,NeverCompare:()=>Yi,NeverDepth:()=>ve,NeverStencilFunc:()=>Gi,NoBlending:()=>Wt,NoColorSpace:()=>Ii,NoToneMapping:()=>Be,NormalAnimationBlendMode:()=>gi,NormalBlending:()=>qt,NotEqualCompare:()=>tr,NotEqualDepth:()=>_e,NotEqualStencilFunc:()=>Wi,NumberKeyframeTrack:()=>Mu,Object3D:()=>co,ObjectLoader:()=>md,ObjectSpaceNormalMap:()=>Si,OctahedronGeometry:()=>Hh,OneFactor:()=>re,OneMinusConstantAlphaFactor:()=>ge,OneMinusConstantColorFactor:()=>fe,OneMinusDstAlphaFactor:()=>he,OneMinusDstColorFactor:()=>de,OneMinusSrcAlphaFactor:()=>le,OneMinusSrcColorFactor:()=>oe,OrthographicCamera:()=>sd,PCFShadowMap:()=>Qt,PCFSoftShadowMap:()=>Gt,PMREMGenerator:()=>_A,Path:()=>$c,PerspectiveCamera:()=>Ba,Plane:()=>Ul,PlaneGeometry:()=>Vh,PlaneHelper:()=>jp,PointLight:()=>rd,PointLightHelper:()=>Sp,Points:()=>bc,PointsMaterial:()=>gc,PolarGridHelper:()=>Dp,PolyhedronGeometry:()=>sh,PositionalAudio:()=>Gd,PropertyBinding:()=>Jd,PropertyMixer:()=>Hd,QuadraticBezierCurve:()=>Xc,QuadraticBezierCurve3:()=>Yc,Quaternion:()=>ss,QuaternionKeyframeTrack:()=>Iu,QuaternionLinearInterpolant:()=>Su,RED_GREEN_RGTC2_Format:()=>oi,RED_RGTC1_Format:()=>ri,REVISION:()=>Lt,RGBADepthPacking:()=>Ci,RGBAFormat:()=>yn,RGBAIntegerFormat:()=>Bn,RGBA_ASTC_10x10_Format:()=>Zn,RGBA_ASTC_10x5_Format:()=>Yn,RGBA_ASTC_10x6_Format:()=>Jn,RGBA_ASTC_10x8_Format:()=>Kn,RGBA_ASTC_12x10_Format:()=>$n,RGBA_ASTC_12x12_Format:()=>ti,RGBA_ASTC_4x4_Format:()=>Gn,RGBA_ASTC_5x4_Format:()=>zn,RGBA_ASTC_5x5_Format:()=>Hn,RGBA_ASTC_6x5_Format:()=>Vn,RGBA_ASTC_6x6_Format:()=>jn,RGBA_ASTC_8x5_Format:()=>Wn,RGBA_ASTC_8x6_Format:()=>qn,RGBA_ASTC_8x8_Format:()=>Xn,RGBA_BPTC_Format:()=>ei,RGBA_ETC2_EAC_Format:()=>Qn,RGBA_PVRTC_2BPPV1_Format:()=>Fn,RGBA_PVRTC_4BPPV1_Format:()=>On,RGBA_S3TC_DXT1_Format:()=>Rn,RGBA_S3TC_DXT3_Format:()=>Ln,RGBA_S3TC_DXT5_Format:()=>Dn,RGBDepthPacking:()=>wi,RGBFormat:()=>vn,RGBIntegerFormat:()=>In,RGB_BPTC_SIGNED_Format:()=>ni,RGB_BPTC_UNSIGNED_Format:()=>ii,RGB_ETC1_Format:()=>kn,RGB_ETC2_Format:()=>Nn,RGB_PVRTC_2BPPV1_Format:()=>Un,RGB_PVRTC_4BPPV1_Format:()=>Pn,RGB_S3TC_DXT1_Format:()=>Tn,RGDepthPacking:()=>_i,RGFormat:()=>Mn,RGIntegerFormat:()=>Sn,RawShaderMaterial:()=>nu,Ray:()=>Us,Raycaster:()=>cp,RectAreaLight:()=>cd,RedFormat:()=>wn,RedIntegerFormat:()=>_n,ReinhardToneMapping:()=>Re,RenderTarget:()=>$r,RenderTarget3D:()=>ep,RenderTargetArray:()=>np,RepeatWrapping:()=>je,ReplaceStencilOp:()=>Ui,ReverseSubtractEquation:()=>te,RingGeometry:()=>jh,SIGNED_RED_GREEN_RGTC2_Format:()=>ai,SIGNED_RED_RGTC1_Format:()=>si,SRGBColorSpace:()=>Bi,SRGBTransfer:()=>Li,Scene:()=>Na,ShaderChunk:()=>iA,ShaderLib:()=>sA,ShaderMaterial:()=>wa,ShadowMaterial:()=>eu,Shape:()=>dh,ShapeGeometry:()=>Wh,ShapePath:()=>Kp,ShapeUtils:()=>Fh,ShortType:()=>an,Skeleton:()=>bl,SkeletonHelper:()=>_p,SkinnedMesh:()=>gl,Source:()=>Xr,Sphere:()=>Ss,SphereGeometry:()=>qh,Spherical:()=>dp,SphericalHarmonics3:()=>hd,SplineCurve:()=>Jc,SpotLight:()=>$u,SpotLightHelper:()=>xp,Sprite:()=>il,SpriteMaterial:()=>Ha,SrcAlphaFactor:()=>ae,SrcAlphaSaturateFactor:()=>pe,SrcColorFactor:()=>se,StaticCopyUsage:()=>cr,StaticDrawUsage:()=>ir,StaticReadUsage:()=>or,StereoCamera:()=>Sd,StreamCopyUsage:()=>ur,StreamDrawUsage:()=>sr,StreamReadUsage:()=>lr,StringKeyframeTrack:()=>Bu,SubtractEquation:()=>$t,SubtractiveBlending:()=>Yt,TOUCH:()=>Pt,TangentSpaceNormalMap:()=>Mi,TetrahedronGeometry:()=>Xh,Texture:()=>Kr,TextureLoader:()=>ju,TextureUtils:()=>tA,TimestampQuery:()=>mr,TorusGeometry:()=>Yh,TorusKnotGeometry:()=>Jh,Triangle:()=>wo,TriangleFanDrawMode:()=>xi,TriangleStripDrawMode:()=>Ei,TrianglesDrawMode:()=>yi,TubeGeometry:()=>Kh,UVMapping:()=>Ne,Uint16BufferAttribute:()=>qo,Uint32BufferAttribute:()=>Yo,Uint8BufferAttribute:()=>Vo,Uint8ClampedBufferAttribute:()=>jo,Uniform:()=>ip,UniformsGroup:()=>sp,UniformsLib:()=>rA,UniformsUtils:()=>Ca,UnsignedByteType:()=>sn,UnsignedInt248Type:()=>fn,UnsignedInt5999Type:()=>mn,UnsignedIntType:()=>hn,UnsignedShort4444Type:()=>pn,UnsignedShort5551Type:()=>An,UnsignedShortType:()=>ln,VSMShadowMap:()=>zt,Vector2:()=>Br,Vector3:()=>os,Vector4:()=>Zr,VectorKeyframeTrack:()=>Tu,VideoFrameTexture:()=>_c,VideoTexture:()=>wc,WebGL3DRenderTarget:()=>rs,WebGLArrayRenderTarget:()=>ns,WebGLCoordinateSystem:()=>Ar,WebGLCubeRenderTarget:()=>Da,WebGLRenderTarget:()=>ts,WebGLRenderer:()=>Om,WebGLUtils:()=>Im,WebGPUCoordinateSystem:()=>fr,WebXRController:()=>Oa,WireframeGeometry:()=>Zh,WrapAroundEnding:()=>mi,ZeroCurvatureEnding:()=>Ai,ZeroFactor:()=>ie,ZeroSlopeEnding:()=>fi,ZeroStencilOp:()=>Di,createCanvasElement:()=>Or});var e={};n.r(e),n.d(e,{computeMikkTSpaceTangents:()=>Nm,computeMorphedAttributes:()=>Ym,deepCloneAttribute:()=>zm,deinterleaveAttribute:()=>Vm,deinterleaveGeometry:()=>jm,estimateBytesUsed:()=>Wm,interleaveAttributes:()=>Hm,mergeAttributes:()=>Gm,mergeGeometries:()=>Qm,mergeGroups:()=>Jm,mergeVertices:()=>qm,toCreasedNormals:()=>Km,toTrianglesDrawMode:()=>Xm});var r={};n.r(r),n.d(r,{checkARSupport:()=>zy,checkHeadsetConnected:()=>Gy,checkVRSupport:()=>Hy,isAppleVisionPro:()=>Yy,isBrowserEnvironment:()=>iE,isFirefoxReality:()=>$y,isIOS:()=>Jy,isIpad:()=>Xy,isLandscape:()=>nE,isMobile:()=>Wy,isMobileDeviceRequestingDesktopSite:()=>Ky,isMobileVR:()=>tE,isNodeEnvironment:()=>rE,isOculusBrowser:()=>Zy,isR7:()=>eE,isTablet:()=>qy,isWebXRAvailable:()=>ky});var s={};n.r(s),n.d(s,{clearObject:()=>lE,createPool:()=>aE,removeUnusedKeys:()=>cE});var o={};n.r(o),n.d(o,{equals:()=>mE,isCoordinate:()=>vE,isCoordinates:()=>gE,parse:()=>AE,regex:()=>dE,stringify:()=>fE,toVector3:()=>EE});var a={};n.r(a),n.d(a,{getComponentProperty:()=>CE,getComponentPropertyPath:()=>bE,setComponentProperty:()=>wE});var l={};n.r(l),n.d(l,{parseUrl:()=>TE,validateCubemapSrc:()=>BE,validateEnvMapSrc:()=>IE,validateSrc:()=>SE});var c={};n.r(c),n.d(c,{createCompatibleTexture:()=>zE,handleTextureEvents:()=>QE,isCompatibleTexture:()=>GE,setTextureProperties:()=>PE,updateDistortionMap:()=>FE,updateEnvMap:()=>NE,updateMap:()=>OE,updateMapMaterialFromData:()=>UE});var h={};n.r(h),n.d(h,{parse:()=>VE,stringify:()=>jE,toCamelCase:()=>WE});var u={};n.r(u),n.d(u,{checkControllerPresentAndSetup:()=>ZE,emitIfAxesChanged:()=>ex,findMatchingControllerWebXR:()=>tx,isControllerPresentWebXR:()=>$E,onButtonEvent:()=>nx});var d={};n.r(d),n.d(d,{bind:()=>rx,checkHeadsetConnected:()=>sx,clone:()=>Ax,coordinates:()=>o,debounce:()=>ux,debug:()=>Ly,deepEqual:()=>gx,device:()=>r,diff:()=>vx,entity:()=>a,extend:()=>dx,extendDeep:()=>px,findAllScenes:()=>wx,forceCanvasResizeSafariMobile:()=>_E,getElData:()=>xx,getUrlParameter:()=>bx,isIOS:()=>ox,isIframed:()=>Cx,isMobile:()=>ax,material:()=>c,objectPool:()=>s,shouldCaptureKeyEvent:()=>yx,split:()=>xE,splitString:()=>Ex,srcLoader:()=>l,styleParser:()=>h,throttle:()=>lx,throttleLeadingAndTrailing:()=>cx,throttleTick:()=>hx,trackedControls:()=>u});var p={};n.r(p),n.d(p,{isSingleProperty:()=>eb,parseProperties:()=>sb,parseProperty:()=>ob,process:()=>nb,processPropertyDefinition:()=>ib,stringifyProperties:()=>ab,stringifyProperty:()=>lb});var A={};n.r(A),n.d(A,{Component:()=>Cb,components:()=>cb,registerComponent:()=>_b,registrationOrderWarnings:()=>wb});var f={};n.r(f),n.d(f,{System:()=>Lb,registerSystem:()=>Db,systems:()=>Rb});var m={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},g={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},v=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective"],y={CSS:{},springs:{}};function E(t,e,n){return Math.min(Math.max(t,e),n)}function x(t,e){return t.indexOf(e)>-1}function b(t,e){return t.apply(null,e)}var C=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,w=/^rgb/,_=/^hsl/,M={arr:function(t){return Array.isArray(t)},obj:function(t){return x(Object.prototype.toString.call(t),"Object")},pth:function(t){return M.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return t.nodeType||M.svg(t)},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return void 0===t},hex:function(t){return C.test(t)},rgb:function(t){return w.test(t)},hsl:function(t){return _.test(t)},col:function(t){return M.hex(t)||M.rgb(t)||M.hsl(t)},key:function(t){return!m.hasOwnProperty(t)&&!g.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}},S=/\(([^)]+)\)/;function I(t){var e=S.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function B(t,e){var n=I(t),i=E(M.und(n[0])?1:n[0],.1,100),r=E(M.und(n[1])?100:n[1],.1,100),s=E(M.und(n[2])?10:n[2],.1,100),o=E(M.und(n[3])?0:n[3],.1,100),a=Math.sqrt(r/i),l=s/(2*Math.sqrt(r*i)),c=l<1?a*Math.sqrt(1-l*l):0,h=l<1?(l*a-o)/c:-o+a;function u(t){var n=e?e*t/1e3:t;return n=l<1?Math.exp(-n*l*a)*(1*Math.cos(c*n)+h*Math.sin(c*n)):(1+h*n)*Math.exp(-n*a),0===t||1===t?t:1-n}return e?u:function(){var e=y.springs[t];if(e)return e;for(var n=1/6,i=0,r=0;;)if(1===u(i+=n)){if(++r>=16)break}else r=0;var s=i*n*1e3;return y.springs[t]=s,s}}function T(t,e){void 0===t&&(t=1),void 0===e&&(e=.5);var n=E(t,1,10),i=E(e,.1,2);return function(t){return 0===t||1===t?t:-n*Math.pow(2,10*(t-1))*Math.sin((t-1-i/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/i)}}function R(t){return void 0===t&&(t=10),function(e){return Math.round(e*t)*(1/t)}}var L=function(){var t=.1;function e(t,e){return 1-3*e+3*t}function n(t,e){return 3*e-6*t}function i(t){return 3*t}function r(t,r,s){return((e(r,s)*t+n(r,s))*t+i(r))*t}function s(t,r,s){return 3*e(r,s)*t*t+2*n(r,s)*t+i(r)}return function(e,n,i,o){if(0<=e&&e<=1&&0<=i&&i<=1){var a=new Float32Array(11);if(e!==n||i!==o)for(var l=0;l<11;++l)a[l]=r(l*t,e,i);return function(l){return e===n&&i===o||0===l||1===l?l:r(function(n){for(var o=0,l=1;10!==l&&a[l]<=n;++l)o+=t;--l;var c=o+(n-a[l])/(a[l+1]-a[l])*t,h=s(c,e,i);return h>=.001?function(t,e,n,i){for(var o=0;o<4;++o){var a=s(e,n,i);if(0===a)return e;e-=(r(e,n,i)-t)/a}return e}(n,c,e,i):0===h?c:function(t,e,n,i,s){var o,a,l=0;do{(o=r(a=e+(n-e)/2,i,s)-t)>0?n=a:e=a}while(Math.abs(o)>1e-7&&++l<10);return a}(n,o,o+t,e,i)}(l),n,o)}}}}(),D=function(){var t=["Quad","Cubic","Quart","Quint","Sine","Expo","Circ","Back","Elastic"],e={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],T],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(t,e){return function(n){return 1-T(t,e)(1-n)}}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(t,e){return function(n){return n<.5?T(t,e)(2*n)/2:1-T(t,e)(-2*n+2)/2}}]},n={linear:[.25,.25,.75,.75]};for(var i in e)for(var r=0,s=e[i].length;r<s;r++)n["ease"+i+t[r]]=e[i][r];return n}();function P(t,e){if(M.fnc(t))return t;var n=t.split("(")[0],i=D[n],r=I(t);switch(n){case"spring":return B(t,e);case"cubicBezier":return b(L,r);case"steps":return b(R,r);default:return M.fnc(i)?b(i,r):b(L,i)}}function U(t){try{return document.querySelectorAll(t)}catch(t){return}}var O=[];function F(t,e){for(var n=O,i=t.length,r=arguments.length>=2?arguments[1]:void 0,s=0;s<i;s++)if(s in t){var o=t[s];e.call(r,o,s,t)&&n.push(o)}return(O=t).length=0,n}function k(t,e){e||(e=[]);for(var n=0,i=t.length;n<i;n++){var r=t[n];Array.isArray(r)?k(r,e):e.push(r)}return e}function N(t){return M.arr(t)?t:(M.str(t)&&(t=U(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function Q(t,e){return t.some((function(t){return t===e}))}function G(t){var e={};for(var n in t)e[n]=t[n];return e}function z(t,e){var n=G(t);for(var i in t)n[i]=e.hasOwnProperty(i)?e[i]:t[i];return n}function H(t,e){var n=G(t);for(var i in e)n[i]=M.und(t[i])?e[i]:t[i];return n}var V=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g,j=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,W=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,q=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g,X=/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g;var Y=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/;function J(t){var e=Y.exec(t);if(e)return e[2]}function K(t,e){return M.fnc(t)?t(e.target,e.id,e.total):t}function Z(t,e){return t.getAttribute(e)}function $(t,e,n){if(Q([n,"deg","rad","turn"],J(e)))return e;var i=y.CSS[e+n];if(!M.und(i))return i;var r=document.createElement(t.tagName),s=t.parentNode&&t.parentNode!==document?t.parentNode:document.body;s.appendChild(r),r.style.position="absolute",r.style.width=100+n;var o=100/r.offsetWidth;s.removeChild(r);var a=o*parseFloat(e);return y.CSS[e+n]=a,a}function tt(t,e,n){if(e in t.style){var i=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=t.style[e]||getComputedStyle(t).getPropertyValue(i)||"0";return n?$(t,r,n):r}}function et(t,e){return M.dom(t)&&!M.inp(t)&&(Z(t,e)||M.svg(t)&&t[e])?"attribute":M.dom(t)&&Q(v,e)?"transform":M.dom(t)&&"transform"!==e&&tt(t,e)?"css":null!=t[e]?"object":void 0}var nt=/(\w+)\(([^)]*)\)/g;function it(t){if(M.dom(t)){for(var e,n=t.style.transform||"",i=new Map;e=nt.exec(n);)i.set(e[1],e[2]);return i}}function rt(t,e,n,i){switch(et(t,e)){case"transform":return function(t,e,n,i){var r=x(e,"scale")?1:0+function(t){return x(t,"translate")||"perspective"===t?"px":x(t,"rotate")||x(t,"skew")?"deg":void 0}(e),s=it(t).get(e)||r;return n&&(n.transforms.list.set(e,s),n.transforms.last=e),i?$(t,s,i):s}(t,e,i,n);case"css":return tt(t,e,n);case"attribute":return Z(t,e);default:return t[e]||0}}var st=/^(\*=|\+=|-=)/;function ot(t,e){var n=st.exec(t);if(!n)return t;var i=J(t)||0,r=parseFloat(e),s=parseFloat(t.replace(n[0],""));switch(n[0][0]){case"+":return r+s+i;case"-":return r-s+i;case"*":return r*s+i}}var at=/\s/g;function lt(t,e){if(M.col(t))return function(t){return M.rgb(t)?(e=t,(n=V.exec(e))?"rgba("+n[1]+",1)":e):M.hex(t)?function(t){var e=t.replace(j,(function(t,e,n,i){return e+e+n+n+i+i})),n=W.exec(e);return"rgba("+parseInt(n[1],16)+","+parseInt(n[2],16)+","+parseInt(n[3],16)+",1)"}(t):M.hsl(t)?function(t){var e,n,i,r=q.exec(t)||X.exec(t),s=parseInt(r[1],10)/360,o=parseInt(r[2],10)/100,a=parseInt(r[3],10)/100,l=r[4]||1;function c(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+(e-t)*(2/3-n)*6:t}if(0==o)e=n=i=a;else{var h=a<.5?a*(1+o):a+o-a*o,u=2*a-h;e=c(u,h,s+1/3),n=c(u,h,s),i=c(u,h,s-1/3)}return"rgba("+255*e+","+255*n+","+255*i+","+l+")"}(t):void 0;var e,n}(t);var n=J(t),i=n?t.substr(0,t.length-n.length):t;return e&&!at.test(t)?i+e:i}function ct(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ht(t){for(var e,n=t.points,i=0,r=0;r<n.numberOfItems;r++){var s=n.getItem(r);r>0&&(i+=ct(e,s)),e=s}return i}function ut(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*Z(t,"r")}(t);case"rect":return function(t){return 2*Z(t,"width")+2*Z(t,"height")}(t);case"line":return function(t){return ct({x:Z(t,"x1"),y:Z(t,"y1")},{x:Z(t,"x2"),y:Z(t,"y2")})}(t);case"polyline":return ht(t);case"polygon":return function(t){var e=t.points;return ht(t)+ct(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function dt(t,e){var n=e||{},i=n.el||function(t){for(var e=t.parentNode;M.svg(e)&&(e=e.parentNode,M.svg(e.parentNode)););return e}(t),r=i.getBoundingClientRect(),s=Z(i,"viewBox"),o=r.width,a=r.height,l=n.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:i,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function pt(t,e){function n(n){void 0===n&&(n=0);var i=e+n>=1?e+n:0;return t.el.getPointAtLength(i)}var i=dt(t.el,t.svg),r=n(),s=n(-1),o=n(1);switch(t.property){case"x":return(r.x-i.x)*i.w;case"y":return(r.y-i.y)*i.h;case"angle":return 180*Math.atan2(o.y-s.y,o.x-s.x)/Math.PI}}var At=/-?\d*\.?\d+/g;function ft(t,e){var n=lt(M.pth(t)?t.totalLength:t,e)+"";return{original:n,numbers:n.match(At)?n.match(At).map(Number):[0],strings:M.str(t)||e?n.split(At):[]}}function mt(t){return F(t?k(M.arr(t)?t.map(N):N(t)):[],(function(t,e,n){return n.indexOf(t)===e}))}function gt(t){var e=mt(t);return e.map((function(t,n){return{target:t,id:n,total:e.length,transforms:{list:it(t)}}}))}var vt=/^spring/;function yt(t,e){var n=G(e);if(vt.test(n.easing)&&(n.duration=B(n.easing)),M.arr(t)){var i=t.length;2!==i||M.obj(t[0])?M.fnc(e.duration)||(n.duration=e.duration/i):t={value:t}}var r=M.arr(t)?t:[t];return r.map((function(t,n){var i=M.obj(t)&&!M.pth(t)?t:{value:t};return M.und(i.delay)&&(i.delay=n?0:e.delay),M.und(i.endDelay)&&(i.endDelay=n===r.length-1?e.endDelay:0),i})).map((function(t){return H(t,n)}))}var Et={css:function(t,e,n){return t.style[e]=n},attribute:function(t,e,n){return t.setAttribute(e,n)},object:function(t,e,n){return t[e]=n},transform:function(t,e,n,i,r){if(i.list.set(e,n),e===i.last||r){var s="";i.list.forEach((function(t,e){s+=e+"("+t+") "})),t.style.transform=s}}};function xt(t,e){for(var n=gt(t),i=0,r=n.length;i<r;i++){var s=n[i];for(var o in e){var a=K(e[o],s),l=s.target,c=J(a),h=rt(l,o,c,s),u=ot(lt(a,c||J(h)),h),d=et(l,o);Et[d](l,o,u,s.transforms,!0)}}}function bt(t,e){return F(k(t.map((function(t){return e.map((function(e){return function(t,e){var n=et(t.target,e.name);if(n){var i=function(t,e){var n;return t.tweens.map((function(i){var r=function(t,e){var n={};for(var i in t){var r=K(t[i],e);M.arr(r)&&1===(r=r.map((function(t){return K(t,e)}))).length&&(r=r[0]),n[i]=r}return n.duration=parseFloat(n.duration),n.delay=parseFloat(n.delay),n}(i,e),s=r.value,o=M.arr(s)?s[1]:s,a=J(o),l=rt(e.target,t.name,a,e),c=n?n.to.original:l,h=M.arr(s)?s[0]:c,u=J(h)||J(l),d=a||u;return M.und(o)&&(o=c),r.from=ft(h,d),r.to=ft(ot(o,h),d),r.start=n?n.end:0,r.end=r.start+r.delay+r.duration+r.endDelay,r.easing=P(r.easing,r.duration),r.isPath=M.pth(s),r.isColor=M.col(r.from.original),r.isColor&&(r.round=1),n=r,r}))}(e,t),r=i[i.length-1];return{type:n,property:e.name,animatable:t,tweens:i,duration:r.end,delay:i[0].delay,endDelay:r.endDelay}}}(t,e)}))}))),(function(t){return!M.und(t)}))}function Ct(t,e){var n=t.length,i=function(t){return t.timelineOffset?t.timelineOffset:0},r={};return r.duration=n?Math.max.apply(Math,t.map((function(t){return i(t)+t.duration}))):e.duration,r.delay=n?Math.min.apply(Math,t.map((function(t){return i(t)+t.delay}))):e.delay,r.endDelay=n?r.duration-Math.max.apply(Math,t.map((function(t){return i(t)+t.duration-t.endDelay}))):e.endDelay,r}var wt,_t=0,Mt=[],St=[],It=function(){function t(){wt=requestAnimationFrame(e)}function e(e){var n=Mt.length;if(n){for(var i=0;i<n;){var r=Mt[i];if(r.paused){var s=Mt.indexOf(r);s>-1&&(Mt.splice(s,1),n=Mt.length)}else r.tick(e);i++}t()}else wt=cancelAnimationFrame(wt)}return t}();function Bt(t){void 0===t&&(t={});var e,n=0,i=0,r=0,s=0,o=null;function a(){return window.Promise&&new Promise((function(t){return o=t}))}var l=a(),c=function(t){var e=z(m,t),n=z(g,t),i=function(t,e){var n=[],i=e.keyframes;for(var r in i&&(e=H(function(t){for(var e=F(k(t.map((function(t){return Object.keys(t)}))),(function(t){return M.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),n={},i=function(i){var r=e[i];n[r]=t.map((function(t){var e={};for(var n in t)M.key(n)?n==r&&(e.value=t[n]):e[n]=t[n];return e}))},r=0;r<e.length;r++)i(r);return n}(i),e)),e)M.key(r)&&n.push({name:r,tweens:yt(e[r],t)});return n}(n,t),r=gt(t.targets),s=bt(r,i),o=Ct(s,n),a=_t;return _t++,H(e,{id:a,children:[],animatables:r,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}(t);function h(){c.reversed=!c.reversed;for(var t=0,n=e.length;t<n;t++)e[t].reversed=c.reversed}function u(t){return c.reversed?c.duration-t:t}function d(){n=0,i=u(c.currentTime)*(1/Bt.speed)}function p(t,e){e&&e.seek(t-e.timelineOffset)}function A(t){for(var e=0,n=c.animations,i=n.length;e<i;){var r=n[e],s=r.animatable,o=r.tweens,a=o.length-1,l=o[a];a&&(l=F(o,(function(e){return t<e.end}))[0]||l);for(var h=E(t-l.start-l.delay,0,l.duration)/l.duration,u=isNaN(h)?1:l.easing(h),d=l.to.strings,p=l.round,A=[],f=l.to.numbers.length,m=void 0,g=0;g<f;g++){var v=void 0,y=l.to.numbers[g],x=l.from.numbers[g]||0;v=l.isPath?pt(l.value,u*y):x+u*(y-x),p&&(l.isColor&&g>2||(v=Math.round(v*p)/p)),A.push(v)}var b=d.length;if(b){m=d[0];for(var C=0;C<b;C++){d[C];var w=d[C+1],_=A[C];isNaN(_)||(m+=w?_+w:_+" ")}}else m=A[0];Et[r.type](s.target,r.property,m,s.transforms),r.currentValue=m,e++}}function f(t){c[t]&&!c.passThrough&&c[t](c)}function v(t){var d=c.duration,m=c.delay,g=d-c.endDelay,v=u(t);c.progress=E(v/d*100,0,100),c.reversePlayback=v<c.currentTime,e&&function(t){if(c.reversePlayback)for(var n=s;n--;)p(t,e[n]);else for(var i=0;i<s;i++)p(t,e[i])}(v),!c.began&&c.currentTime>0&&(c.began=!0,f("begin"),f("loopBegin")),v<=m&&0!==c.currentTime&&A(0),(v>=g&&c.currentTime!==d||!d)&&A(d),v>m&&v<g?(c.changeBegan||(c.changeBegan=!0,c.changeCompleted=!1,f("changeBegin")),f("change"),A(v)):c.changeBegan&&(c.changeCompleted=!0,c.changeBegan=!1,f("changeComplete")),c.currentTime=E(v,0,d),c.began&&f("update"),t>=d&&(i=0,c.remaining&&!0!==c.remaining&&c.remaining--,c.remaining?(n=r,f("loopComplete"),f("loopBegin"),"alternate"===c.direction&&h()):(c.paused=!0,c.completed||(c.completed=!0,f("loopComplete"),f("complete"),"Promise"in window&&(o(),l=a()))))}return c.reset=function(){var t=c.direction;c.passThrough=!1,c.currentTime=0,c.progress=0,c.paused=!0,c.began=!1,c.changeBegan=!1,c.completed=!1,c.changeCompleted=!1,c.reversePlayback=!1,c.reversed="reverse"===t,c.remaining=c.loop,e=c.children;for(var n=s=e.length;n--;)c.children[n].reset();(c.reversed&&!0!==c.loop||"alternate"===t&&1===c.loop)&&c.remaining++,A(0)},c.set=function(t,e){return xt(t,e),c},c.tick=function(t){r=t,n||(n=r),v((r+(i-n))*Bt.speed)},c.seek=function(t){v(u(t))},c.pause=function(){c.paused=!0,d()},c.play=function(){c.paused&&(c.paused=!1,Mt.push(c),d(),wt||It())},c.reverse=function(){h(),d()},c.restart=function(){c.reset(),c.play()},c.finished=l,c.reset(),c.autoplay&&c.play(),c}function Tt(t,e){for(var n=e.length;n--;)Q(t,e[n].animatable.target)&&e.splice(n,1)}document.addEventListener("visibilitychange",(function(){if(document.hidden){for(var t=0,e=Mt.length;t<e;t++)activeInstance[t].pause();St=Mt.slice(0),Mt=[]}else for(var n=0,i=St.length;n<i;n++)St[n].play()})),Bt.version="3.0.0",Bt.speed=1,Bt.running=Mt,Bt.remove=function(t){for(var e=mt(t),n=Mt.length;n--;){var i=Mt[n],r=i.animations,s=i.children;Tt(e,r);for(var o=s.length;o--;){var a=s[o],l=a.animations;Tt(e,l),l.length||a.children.length||s.splice(o,1)}r.length||s.length||i.pause()}},Bt.get=rt,Bt.set=xt,Bt.convertPx=$,Bt.path=function(t,e){var n=M.str(t)?U(t)[0]:t,i=e||100;return function(t){return{property:t,el:n,svg:dt(n),totalLength:ut(n)*(i/100)}}},Bt.setDashoffset=function(t){var e=ut(t);return t.setAttribute("stroke-dasharray",e),e},Bt.stagger=function(t,e){void 0===e&&(e={});var n=e.direction||"normal",i=e.easing?P(e.easing):null,r=e.grid,s=e.axis,o=e.from||0,a="first"===o,l="center"===o,c="last"===o,h=M.arr(t),u=h?parseFloat(t[0]):parseFloat(t),d=h?parseFloat(t[1]):0,p=J(h?t[1]:t)||0,A=e.start||0+(h?u:0),f=[],m=0;return function(t,e,g){if(a&&(o=0),l&&(o=(g-1)/2),c&&(o=g-1),!f.length){for(var v=0;v<g;v++){if(r){var y=l?(r[0]-1)/2:o%r[0],E=l?(r[1]-1)/2:Math.floor(o/r[0]),x=y-v%r[0],b=E-Math.floor(v/r[0]),C=Math.sqrt(x*x+b*b);"x"===s&&(C=-x),"y"===s&&(C=-b),f.push(C)}else f.push(Math.abs(o-v));m=Math.max.apply(Math,f)}i&&(f=f.map((function(t){return i(t/m)*m}))),"reverse"===n&&(f=f.map((function(t){return s?t<0?-1*t:-t:Math.abs(m-t)})))}return A+(h?(d-u)/m:u)*(Math.round(100*f[e])/100)+p}},Bt.timeline=function(t){void 0===t&&(t={});var e=Bt(t);return e.duration=0,e.add=function(n,i){var r=Mt.indexOf(e),s=e.children;function o(t){t.passThrough=!0}r>-1&&Mt.splice(r,1);for(var a=0;a<s.length;a++)o(s[a]);var l=H(n,z(g,t));l.targets=l.targets||t.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=M.und(i)?c:ot(i,c),o(e),e.seek(l.timelineOffset);var h=Bt(l);o(h),s.push(h);var u=Ct(s,t);return e.delay=u.delay,e.endDelay=u.endDelay,e.duration=u.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e},Bt.easing=P,Bt.penner=D,Bt.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};const Rt=Bt,Lt="173",Dt={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Pt={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Ut=0,Ot=1,Ft=2,kt=3,Nt=0,Qt=1,Gt=2,zt=3,Ht=0,Vt=1,jt=2,Wt=0,qt=1,Xt=2,Yt=3,Jt=4,Kt=5,Zt=100,$t=101,te=102,ee=103,ne=104,ie=200,re=201,se=202,oe=203,ae=204,le=205,ce=206,he=207,ue=208,de=209,pe=210,Ae=211,fe=212,me=213,ge=214,ve=0,ye=1,Ee=2,xe=3,be=4,Ce=5,we=6,_e=7,Me=0,Se=1,Ie=2,Be=0,Te=1,Re=2,Le=3,De=4,Pe=5,Ue=6,Oe=7,Fe="attached",ke="detached",Ne=300,Qe=301,Ge=302,ze=303,He=304,Ve=306,je=1e3,We=1001,qe=1002,Xe=1003,Ye=1004,Je=1004,Ke=1005,Ze=1005,$e=1006,tn=1007,en=1007,nn=1008,rn=1008,sn=1009,on=1010,an=1011,ln=1012,cn=1013,hn=1014,un=1015,dn=1016,pn=1017,An=1018,fn=1020,mn=35902,gn=1021,vn=1022,yn=1023,En=1024,xn=1025,bn=1026,Cn=1027,wn=1028,_n=1029,Mn=1030,Sn=1031,In=1032,Bn=1033,Tn=33776,Rn=33777,Ln=33778,Dn=33779,Pn=35840,Un=35841,On=35842,Fn=35843,kn=36196,Nn=37492,Qn=37496,Gn=37808,zn=37809,Hn=37810,Vn=37811,jn=37812,Wn=37813,qn=37814,Xn=37815,Yn=37816,Jn=37817,Kn=37818,Zn=37819,$n=37820,ti=37821,ei=36492,ni=36494,ii=36495,ri=36283,si=36284,oi=36285,ai=36286,li=2200,ci=2201,hi=2202,ui=2300,di=2301,pi=2302,Ai=2400,fi=2401,mi=2402,gi=2500,vi=2501,yi=0,Ei=1,xi=2,bi=3200,Ci=3201,wi=3202,_i=3203,Mi=0,Si=1,Ii="",Bi="srgb",Ti="srgb-linear",Ri="linear",Li="srgb",Di=0,Pi=7680,Ui=7681,Oi=7682,Fi=7683,ki=34055,Ni=34056,Qi=5386,Gi=512,zi=513,Hi=514,Vi=515,ji=516,Wi=517,qi=518,Xi=519,Yi=512,Ji=513,Ki=514,Zi=515,$i=516,tr=517,er=518,nr=519,ir=35044,rr=35048,sr=35040,or=35045,ar=35049,lr=35041,cr=35046,hr=35050,ur=35042,dr="100",pr="300 es",Ar=2e3,fr=2001,mr={COMPUTE:"compute",RENDER:"render"};class gr{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){const n=this._listeners;return void 0!==n&&void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){const n=this._listeners;if(void 0===n)return;const i=n[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const n=e[t.type];if(void 0!==n){t.target=this;const e=n.slice(0);for(let n=0,i=e.length;n<i;n++)e[n].call(this,t);t.target=null}}}const vr=["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 yr=1234567;const Er=Math.PI/180,xr=180/Math.PI;function br(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(vr[255&t]+vr[t>>8&255]+vr[t>>16&255]+vr[t>>24&255]+"-"+vr[255&e]+vr[e>>8&255]+"-"+vr[e>>16&15|64]+vr[e>>24&255]+"-"+vr[63&n|128]+vr[n>>8&255]+"-"+vr[n>>16&255]+vr[n>>24&255]+vr[255&i]+vr[i>>8&255]+vr[i>>16&255]+vr[i>>24&255]).toLowerCase()}function Cr(t,e,n){return Math.max(e,Math.min(n,t))}function wr(t,e){return(t%e+e)%e}function _r(t,e,n){return(1-n)*t+n*e}function Mr(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Sr(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const Ir={DEG2RAD:Er,RAD2DEG:xr,generateUUID:br,clamp:Cr,euclideanModulo:wr,mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:_r,damp:function(t,e,n,i){return _r(t,e,1-Math.exp(-n*i))},pingpong:function(t,e=1){return e-Math.abs(wr(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&&(yr=t);let e=yr+=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*Er},radToDeg:function(t){return t*xr},isPowerOfTwo:function(t){return!(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 s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+i)/2),h=o((e+i)/2),u=s((e-i)/2),d=o((e-i)/2),p=s((i-e)/2),A=o((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*A,l*p,a*c);break;case"YXY":t.set(l*p,a*h,l*A,a*c);break;case"ZYZ":t.set(l*A,l*p,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:Sr,denormalize:Mr};class Br{constructor(t=0,e=0){Br.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,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=Cr(this.x,t.x,e.x),this.y=Cr(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=Cr(this.x,t,e),this.y=Cr(this.y,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Cr(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(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}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(Cr(n,-1,1))}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),i=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*n-s*i+t.x,this.y=r*i+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Tr{constructor(t,e,n,i,r,s,o,a,l){Tr.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,o,a,l)}set(t,e,n,i,r,s,o,a,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=o,c[3]=e,c[4]=r,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(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,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],A=i[0],f=i[3],m=i[6],g=i[1],v=i[4],y=i[7],E=i[2],x=i[5],b=i[8];return r[0]=s*A+o*g+a*E,r[3]=s*f+o*v+a*x,r[6]=s*m+o*y+a*b,r[1]=l*A+c*g+h*E,r[4]=l*f+c*v+h*x,r[7]=l*m+c*y+h*b,r[2]=u*A+d*g+p*E,r[5]=u*f+d*v+p*x,r[8]=u*m+d*y+p*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],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8];return e*s*c-e*o*l-n*r*c+n*o*a+i*r*l-i*s*a}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=c*s-o*l,u=o*a-c*r,d=l*r-s*a,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const A=1/p;return t[0]=h*A,t[1]=(i*l-c*n)*A,t[2]=(o*n-i*s)*A,t[3]=u*A,t[4]=(c*e-i*a)*A,t[5]=(i*r-o*e)*A,t[6]=d*A,t[7]=(n*a-l*e)*A,t[8]=(s*e-n*r)*A,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,i,r,s,o){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*s+l*o)+s+t,-i*l,i*a,-i*(-l*s+a*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(Rr.makeScale(t,e)),this}rotate(t){return this.premultiply(Rr.makeRotation(-t)),this}translate(t,e){return this.premultiply(Rr.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),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)}}const Rr=new Tr;function Lr(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const Dr={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Pr(t,e){return new Dr[t](e)}function Ur(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Or(){const t=Ur("canvas");return t.style.display="block",t}const Fr={};function kr(t){t in Fr||(Fr[t]=!0,console.warn(t))}const Nr=(new Tr).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Qr=(new Tr).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Gr(){const t={enabled:!0,workingColorSpace:Ti,spaces:{},convert:function(t,e,n){return!1!==this.enabled&&e!==n&&e&&n?(this.spaces[e].transfer===Li&&(t.r=Hr(t.r),t.g=Hr(t.g),t.b=Hr(t.b)),this.spaces[e].primaries!==this.spaces[n].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===Li&&(t.r=Vr(t.r),t.g=Vr(t.g),t.b=Vr(t.b)),t):t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return t===Ii?Ri:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,n){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[Ti]:{primaries:e,whitePoint:i,transfer:Ri,toXYZ:Nr,fromXYZ:Qr,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Bi},outputColorSpaceConfig:{drawingBufferColorSpace:Bi}},[Bi]:{primaries:e,whitePoint:i,transfer:Li,toXYZ:Nr,fromXYZ:Qr,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Bi}}}),t}const zr=Gr();function Hr(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Vr(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let jr;class Wr{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===jr&&(jr=Ur("canvas")),jr.width=t.width,jr.height=t.height;const n=jr.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=jr}return 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=Ur("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t<r.length;t++)r[t]=255*Hr(r[t]/255);return n.putImageData(i,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*Hr(e[t]/255)):e[t]=Hr(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}}let qr=0;class Xr{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:qr++}),this.uuid=br(),this.data=t,this.dataReady=!0,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:""},i=this.data;if(null!==i){let t;if(Array.isArray(i)){t=[];for(let e=0,n=i.length;e<n;e++)i[e].isDataTexture?t.push(Yr(i[e].image)):t.push(Yr(i[e]))}else t=Yr(i);n.url=t}return e||(t.images[this.uuid]=n),n}}function Yr(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Wr.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 Jr=0;class Kr extends gr{constructor(t=Kr.DEFAULT_IMAGE,e=Kr.DEFAULT_MAPPING,n=We,i=We,r=$e,s=nn,o=yn,a=sn,l=Kr.DEFAULT_ANISOTROPY,c=Ii){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Jr++}),this.uuid=br(),this.name="",this.source=new Xr(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new Br(0,0),this.repeat=new Br(1,1),this.center=new Br(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Tr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){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.channel=t.channel,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.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,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.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Ne)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case je:t.x=t.x-Math.floor(t.x);break;case We:t.x=t.x<0?0:1;break;case qe: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 je:t.y=t.y-Math.floor(t.y);break;case We:t.y=t.y<0?0:1;break;case qe: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)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}Kr.DEFAULT_IMAGE=null,Kr.DEFAULT_MAPPING=Ne,Kr.DEFAULT_ANISOTROPY=1;class Zr{constructor(t=0,e=0,n=0,i=1){Zr.prototype.isVector4=!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){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,i=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*e+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*e+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*e+s[7]*n+s[11]*i+s[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,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 s=.01,o=.1,a=t.elements,l=a[0],c=a[4],h=a[8],u=a[1],d=a[5],p=a[9],A=a[2],f=a[6],m=a[10];if(Math.abs(c-u)<s&&Math.abs(h-A)<s&&Math.abs(p-f)<s){if(Math.abs(c+u)<o&&Math.abs(h+A)<o&&Math.abs(p+f)<o&&Math.abs(l+d+m-3)<o)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,a=(d+1)/2,g=(m+1)/2,v=(c+u)/4,y=(h+A)/4,E=(p+f)/4;return t>a&&t>g?t<s?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(t),i=v/n,r=y/n):a>g?a<s?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(a),n=v/i,r=E/i):g<s?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(g),n=y/r,i=E/r),this.set(n,i,r,e),this}let g=Math.sqrt((f-p)*(f-p)+(h-A)*(h-A)+(u-c)*(u-c));return Math.abs(g)<.001&&(g=1),this.x=(f-p)/g,this.y=(h-A)/g,this.z=(u-c)/g,this.w=Math.acos((l+d+m-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],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=Cr(this.x,t.x,e.x),this.y=Cr(this.y,t.y,e.y),this.z=Cr(this.z,t.z,e.z),this.w=Cr(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=Cr(this.x,t,e),this.y=Cr(this.y,t,e),this.z=Cr(this.z,t,e),this.w=Cr(this.w,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Cr(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(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 $r extends gr{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Zr(0,0,t,e),this.scissorTest=!1,this.viewport=new Zr(0,0,t,e);const i={width:t,height:e,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:$e,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new Kr(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const s=n.count;for(let t=0;t<s;t++)this.textures[t]=r.clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==t&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=t,this.textures[i].image.height=e,this.textures[i].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.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,n=t.textures.length;e<n;e++)this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const e=Object.assign({},t.texture.image);return this.texture.source=new Xr(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ts extends $r{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}}class es extends Kr{constructor(t=null,e=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Xe,this.minFilter=Xe,this.wrapR=We,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class ns extends ts{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new es(null,t,e,n),this.texture.isRenderTargetTexture=!0}}class is extends Kr{constructor(t=null,e=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Xe,this.minFilter=Xe,this.wrapR=We,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class rs extends ts{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new is(null,t,e,n),this.texture.isRenderTargetTexture=!0}}class ss{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,r,s,o){let a=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const u=r[s+0],d=r[s+1],p=r[s+2],A=r[s+3];if(0===o)return t[e+0]=a,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===o)return t[e+0]=u,t[e+1]=d,t[e+2]=p,void(t[e+3]=A);if(h!==A||a!==u||l!==d||c!==p){let t=1-o;const e=a*u+l*d+c*p+h*A,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,e*n);t=Math.sin(t*s)/r,o=Math.sin(o*s)/r}const r=o*n;if(a=a*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+A*r,t===1-o){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,s){const o=n[i],a=n[i+1],l=n[i+2],c=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return t[e]=o*p+c*h+a*d-l*u,t[e+1]=a*p+c*u+l*h-o*d,t[e+2]=l*p+c*d+o*u-a*h,t[e+3]=c*p-o*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=!0){const n=t._x,i=t._y,r=t._z,s=t._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),u=a(n/2),d=a(i/2),p=a(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===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],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],h=e[10],u=n+o+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=(s-i)*t}else if(n>o&&n>h){const t=2*Math.sqrt(1+n-o-h);this._w=(c-a)/t,this._x=.25*t,this._y=(i+s)/t,this._z=(r+l)/t}else if(o>h){const t=2*Math.sqrt(1+o-n-h);this._w=(r-l)/t,this._x=(i+s)/t,this._y=.25*t,this._z=(a+c)/t}else{const t=2*Math.sqrt(1+h-n-o);this._w=(s-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<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(Cr(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)}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,i=t._y,r=t._z,s=t._w,o=e._x,a=e._y,l=e._z,c=e._w;return this._x=n*c+s*o+i*l-r*a,this._y=i*c+s*a+r*o-n*l,this._z=r*c+s*l+n*a-i*o,this._w=s*c-n*o-i*a-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,s=this._w;let o=s*t._w+n*t._x+i*t._y+r*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=s,this._x=n,this._y=i,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*s+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}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}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._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class os{constructor(t=0,e=0,n=0){os.prototype.isVector3=!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){return 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){return 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){return 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 this.applyQuaternion(ls.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(ls.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,s=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])*s,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,s=t.y,o=t.z,a=t.w,l=2*(s*i-o*n),c=2*(o*e-r*i),h=2*(r*n-s*e);return this.x=e+a*l+s*h-o*c,this.y=n+a*c+o*l-r*h,this.z=i+a*h+r*c-s*l,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=Cr(this.x,t.x,e.x),this.y=Cr(this.y,t.y,e.y),this.z=Cr(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=Cr(this.x,t,e),this.y=Cr(this.y,t,e),this.z=Cr(this.z,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Cr(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(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){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,s=e.x,o=e.y,a=e.z;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-i*s,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 as.copy(this).projectOnVector(t),this.sub(as)}reflect(t){return this.sub(as.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(Cr(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)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}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){return 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}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const as=new os,ls=new ss;class cs{constructor(t=new os(1/0,1/0,1/0),e=new os(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(us.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(us.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=us.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const n=t.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===e&&void 0!==i&&!0!==t.isInstancedMesh)for(let e=0,n=i.count;e<n;e++)!0===t.isMesh?t.getVertexPosition(e,us):us.fromBufferAttribute(i,e),us.applyMatrix4(t.matrixWorld),this.expandByPoint(us);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),ds.copy(t.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),ds.copy(n.boundingBox)),ds.applyMatrix4(t.matrixWorld),this.union(ds)}const i=t.children;for(let t=0,n=i.length;t<n;t++)this.expandByObject(i[t],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.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 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.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,us),us.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(ys),Es.subVectors(this.max,ys),ps.subVectors(t.a,ys),As.subVectors(t.b,ys),fs.subVectors(t.c,ys),ms.subVectors(As,ps),gs.subVectors(fs,As),vs.subVectors(ps,fs);let e=[0,-ms.z,ms.y,0,-gs.z,gs.y,0,-vs.z,vs.y,ms.z,0,-ms.x,gs.z,0,-gs.x,vs.z,0,-vs.x,-ms.y,ms.x,0,-gs.y,gs.x,0,-vs.y,vs.x,0];return!!Cs(e,ps,As,fs,Es)&&(e=[1,0,0,0,1,0,0,0,1],!!Cs(e,ps,As,fs,Es)&&(xs.crossVectors(ms,gs),e=[xs.x,xs.y,xs.z],Cs(e,ps,As,fs,Es)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,us).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(us).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()||(hs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),hs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),hs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),hs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),hs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),hs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),hs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),hs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(hs)),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 hs=[new os,new os,new os,new os,new os,new os,new os,new os],us=new os,ds=new cs,ps=new os,As=new os,fs=new os,ms=new os,gs=new os,vs=new os,ys=new os,Es=new os,xs=new os,bs=new os;function Cs(t,e,n,i,r){for(let s=0,o=t.length-3;s<=o;s+=3){bs.fromArray(t,s);const o=r.x*Math.abs(bs.x)+r.y*Math.abs(bs.y)+r.z*Math.abs(bs.z),a=e.dot(bs),l=n.dot(bs),c=i.dot(bs);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const ws=new cs,_s=new os,Ms=new os;class Ss{constructor(t=new os,e=-1){this.isSphere=!0,this.center=t,this.radius=e}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):ws.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;e<r;e++)i=Math.max(i,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return 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}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;_s.subVectors(t,this.center);const e=_s.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.addScaledVector(_s,n/t),this.radius+=n}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(Ms.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(_s.copy(t.center).add(Ms)),this.expandByPoint(_s.copy(t.center).sub(Ms))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Is=new os,Bs=new os,Ts=new os,Rs=new os,Ls=new os,Ds=new os,Ps=new os;class Us{constructor(t=new os,e=new os(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Is)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Is.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Is.copy(this.origin).addScaledVector(this.direction,e),Is.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Bs.copy(t).add(e).multiplyScalar(.5),Ts.copy(e).sub(t).normalize(),Rs.copy(this.origin).sub(Bs);const r=.5*t.distanceTo(e),s=-this.direction.dot(Ts),o=Rs.dot(this.direction),a=-Rs.dot(Ts),l=Rs.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*a-o,u=s*o-a,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+s*u+2*o)+u*(s*h+u+2*a)+l}else u=r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u=-r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-s*r+o)),u=h>0?-r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-a),r),d=u*(u+2*a)+l):(h=Math.max(0,-(s*r+o)),u=h>0?r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(Bs).addScaledVector(Ts,u),d}intersectSphere(t,e){Is.subVectors(t.center,this.origin);const n=Is.dot(this.direction),i=Is.dot(Is)-n*n,r=t.radius*t.radius;if(i>r)return null;const s=Math.sqrt(r-i),o=n-s,a=n+s;return a<0?null:o<0?this.at(a,e):this.at(o,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,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(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,s=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||r>i?null:((r>n||isNaN(n))&&(n=r),(s<i||isNaN(i))&&(i=s),h>=0?(o=(t.min.z-u.z)*h,a=(t.max.z-u.z)*h):(o=(t.max.z-u.z)*h,a=(t.min.z-u.z)*h),n>a||o>i?null:((o>n||n!=n)&&(n=o),(a<i||i!=i)&&(i=a),i<0?null:this.at(n>=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,Is)}intersectTriangle(t,e,n,i,r){Ls.subVectors(e,t),Ds.subVectors(n,t),Ps.crossVectors(Ls,Ds);let s,o=this.direction.dot(Ps);if(o>0){if(i)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}Rs.subVectors(this.origin,t);const a=s*this.direction.dot(Ds.crossVectors(Rs,Ds));if(a<0)return null;const l=s*this.direction.dot(Ls.cross(Rs));if(l<0)return null;if(a+l>o)return null;const c=-s*Rs.dot(Ps);return c<0?null:this.at(c/o,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)}clone(){return(new this.constructor).copy(this)}}class Os{constructor(t,e,n,i,r,s,o,a,l,c,h,u,d,p,A,f){Os.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,o,a,l,c,h,u,d,p,A,f)}set(t,e,n,i,r,s,o,a,l,c,h,u,d,p,A,f){const m=this.elements;return m[0]=t,m[4]=e,m[8]=n,m[12]=i,m[1]=r,m[5]=s,m[9]=o,m[13]=a,m[2]=l,m[6]=c,m[10]=h,m[14]=u,m[3]=d,m[7]=p,m[11]=A,m[15]=f,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 Os).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}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),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/Fs.setFromMatrixColumn(t,0).length(),r=1/Fs.setFromMatrixColumn(t,1).length(),s=1/Fs.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]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=s*c,n=s*h,i=o*c,r=o*h;e[0]=a*c,e[4]=-a*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-o*a,e[2]=r-t*l,e[6]=i+n*l,e[10]=s*a}else if("YXZ"===t.order){const t=a*c,n=a*h,i=l*c,r=l*h;e[0]=t+r*o,e[4]=i*o-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-o,e[2]=n*o-i,e[6]=r+t*o,e[10]=s*a}else if("ZXY"===t.order){const t=a*c,n=a*h,i=l*c,r=l*h;e[0]=t-r*o,e[4]=-s*h,e[8]=i+n*o,e[1]=n+i*o,e[5]=s*c,e[9]=r-t*o,e[2]=-s*l,e[6]=o,e[10]=s*a}else if("ZYX"===t.order){const t=s*c,n=s*h,i=o*c,r=o*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]=o*a,e[10]=s*a}else if("YZX"===t.order){const t=s*a,n=s*l,i=o*a,r=o*l;e[0]=a*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=s*c,e[9]=-o*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=s*a,n=s*l,i=o*a,r=o*l;e[0]=a*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=s*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=o*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(Ns,t,Qs)}lookAt(t,e,n){const i=this.elements;return Hs.subVectors(t,e),0===Hs.lengthSq()&&(Hs.z=1),Hs.normalize(),Gs.crossVectors(n,Hs),0===Gs.lengthSq()&&(1===Math.abs(n.z)?Hs.x+=1e-4:Hs.z+=1e-4,Hs.normalize(),Gs.crossVectors(n,Hs)),Gs.normalize(),zs.crossVectors(Hs,Gs),i[0]=Gs.x,i[4]=zs.x,i[8]=Hs.x,i[1]=Gs.y,i[5]=zs.y,i[9]=Hs.y,i[2]=Gs.z,i[6]=zs.z,i[10]=Hs.z,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,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],A=n[6],f=n[10],m=n[14],g=n[3],v=n[7],y=n[11],E=n[15],x=i[0],b=i[4],C=i[8],w=i[12],_=i[1],M=i[5],S=i[9],I=i[13],B=i[2],T=i[6],R=i[10],L=i[14],D=i[3],P=i[7],U=i[11],O=i[15];return r[0]=s*x+o*_+a*B+l*D,r[4]=s*b+o*M+a*T+l*P,r[8]=s*C+o*S+a*R+l*U,r[12]=s*w+o*I+a*L+l*O,r[1]=c*x+h*_+u*B+d*D,r[5]=c*b+h*M+u*T+d*P,r[9]=c*C+h*S+u*R+d*U,r[13]=c*w+h*I+u*L+d*O,r[2]=p*x+A*_+f*B+m*D,r[6]=p*b+A*M+f*T+m*P,r[10]=p*C+A*S+f*R+m*U,r[14]=p*w+A*I+f*L+m*O,r[3]=g*x+v*_+y*B+E*D,r[7]=g*b+v*M+y*T+E*P,r[11]=g*C+v*S+y*R+E*U,r[15]=g*w+v*I+y*L+E*O,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],s=t[1],o=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*o*u+n*l*u+i*o*d-n*a*d)+t[7]*(+e*a*d-e*l*u+r*s*u-i*s*d+i*l*c-r*a*c)+t[11]*(+e*l*h-e*o*d-r*s*h+n*s*d+r*o*c-n*l*c)+t[15]*(-i*o*c-e*a*h+e*o*u+i*s*h-n*s*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}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],A=t[13],f=t[14],m=t[15],g=h*f*l-A*u*l+A*a*d-o*f*d-h*a*m+o*u*m,v=p*u*l-c*f*l-p*a*d+s*f*d+c*a*m-s*u*m,y=c*A*l-p*h*l+p*o*d-s*A*d-c*o*m+s*h*m,E=p*h*a-c*A*a-p*o*u+s*A*u+c*o*f-s*h*f,x=e*g+n*v+i*y+r*E;if(0===x)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/x;return t[0]=g*b,t[1]=(A*u*r-h*f*r-A*i*d+n*f*d+h*i*m-n*u*m)*b,t[2]=(o*f*r-A*a*r+A*i*l-n*f*l-o*i*m+n*a*m)*b,t[3]=(h*a*r-o*u*r-h*i*l+n*u*l+o*i*d-n*a*d)*b,t[4]=v*b,t[5]=(c*f*r-p*u*r+p*i*d-e*f*d-c*i*m+e*u*m)*b,t[6]=(p*a*r-s*f*r-p*i*l+e*f*l+s*i*m-e*a*m)*b,t[7]=(s*u*r-c*a*r+c*i*l-e*u*l-s*i*d+e*a*d)*b,t[8]=y*b,t[9]=(p*h*r-c*A*r-p*n*d+e*A*d+c*n*m-e*h*m)*b,t[10]=(s*A*r-p*o*r+p*n*l-e*A*l-s*n*m+e*o*m)*b,t[11]=(c*o*r-s*h*r-c*n*l+e*h*l+s*n*d-e*o*d)*b,t[12]=E*b,t[13]=(c*A*i-p*h*i+p*n*u-e*A*u-c*n*f+e*h*f)*b,t[14]=(p*o*i-s*A*i-p*n*a+e*A*a+s*n*f-e*o*f)*b,t[15]=(s*h*i-c*o*i+c*n*a-e*h*a-s*n*u+e*o*u)*b,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 t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):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,s=t.x,o=t.y,a=t.z,l=r*s,c=r*o;return this.set(l*s+n,l*o-i*a,l*a+i*o,0,l*o+i*a,c*o+n,c*a-i*s,0,l*a-i*o,c*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(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,i,r,s){return this.set(1,n,r,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,s=e._y,o=e._z,a=e._w,l=r+r,c=s+s,h=o+o,u=r*l,d=r*c,p=r*h,A=s*c,f=s*h,m=o*h,g=a*l,v=a*c,y=a*h,E=n.x,x=n.y,b=n.z;return i[0]=(1-(A+m))*E,i[1]=(d+y)*E,i[2]=(p-v)*E,i[3]=0,i[4]=(d-y)*x,i[5]=(1-(u+m))*x,i[6]=(f+g)*x,i[7]=0,i[8]=(p+v)*b,i[9]=(f-g)*b,i[10]=(1-(u+A))*b,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=Fs.set(i[0],i[1],i[2]).length();const s=Fs.set(i[4],i[5],i[6]).length(),o=Fs.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],ks.copy(this);const a=1/r,l=1/s,c=1/o;return ks.elements[0]*=a,ks.elements[1]*=a,ks.elements[2]*=a,ks.elements[4]*=l,ks.elements[5]*=l,ks.elements[6]*=l,ks.elements[8]*=c,ks.elements[9]*=c,ks.elements[10]*=c,e.setFromRotationMatrix(ks),n.x=r,n.y=s,n.z=o,this}makePerspective(t,e,n,i,r,s,o=Ar){const a=this.elements,l=2*r/(e-t),c=2*r/(n-i),h=(e+t)/(e-t),u=(n+i)/(n-i);let d,p;if(o===Ar)d=-(s+r)/(s-r),p=-2*s*r/(s-r);else{if(o!==fr)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);d=-s/(s-r),p=-s*r/(s-r)}return a[0]=l,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=c,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,n,i,r,s,o=Ar){const a=this.elements,l=1/(e-t),c=1/(n-i),h=1/(s-r),u=(e+t)*l,d=(n+i)*c;let p,A;if(o===Ar)p=(s+r)*h,A=-2*h;else{if(o!==fr)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);p=r*h,A=-1*h}return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=A,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[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 Fs=new os,ks=new Os,Ns=new os(0,0,0),Qs=new os(1,1,1),Gs=new os,zs=new os,Hs=new os,Vs=new Os,js=new ss;class Ws{constructor(t=0,e=0,n=0,i=Ws.DEFAULT_ORDER){this.isEuler=!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=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,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=this._order,n=!0){const i=t.elements,r=i[0],s=i[4],o=i[8],a=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(Cr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Cr(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Cr(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-Cr(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Cr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-Cr(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Vs.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Vs,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return js.setFromEuler(this),this.setFromQuaternion(js,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}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ws.DEFAULT_ORDER="XYZ";class qs{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return!!(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let Xs=0;const Ys=new os,Js=new ss,Ks=new Os,Zs=new os,$s=new os,to=new os,eo=new ss,no=new os(1,0,0),io=new os(0,1,0),ro=new os(0,0,1),so={type:"added"},oo={type:"removed"},ao={type:"childadded",child:null},lo={type:"childremoved",child:null};class co extends gr{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Xs++}),this.uuid=br(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=co.DEFAULT_UP.clone();const t=new os,e=new Ws,n=new ss,i=new os(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Os},normalMatrix:{value:new Tr}}),this.matrix=new Os,this.matrixWorld=new Os,this.matrixAutoUpdate=co.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=co.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new qs,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Js.setFromAxisAngle(t,e),this.quaternion.multiply(Js),this}rotateOnWorldAxis(t,e){return Js.setFromAxisAngle(t,e),this.quaternion.premultiply(Js),this}rotateX(t){return this.rotateOnAxis(no,t)}rotateY(t){return this.rotateOnAxis(io,t)}rotateZ(t){return this.rotateOnAxis(ro,t)}translateOnAxis(t,e){return Ys.copy(t).applyQuaternion(this.quaternion),this.position.add(Ys.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(no,t)}translateY(t){return this.translateOnAxis(io,t)}translateZ(t){return this.translateOnAxis(ro,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Ks.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Zs.copy(t):Zs.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),$s.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ks.lookAt($s,Zs,this.up):Ks.lookAt(Zs,$s,this.up),this.quaternion.setFromRotationMatrix(Ks),i&&(Ks.extractRotation(i.matrixWorld),Js.setFromRotationMatrix(Ks),this.quaternion.premultiply(Js.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(so),ao.child=t,this.dispatchEvent(ao),ao.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(oo),lo.child=t,this.dispatchEvent(lo),lo.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Ks.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Ks.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ks),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(so),ao.child=t,this.dispatchEvent(ao),ao.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);const i=this.children;for(let r=0,s=i.length;r<s;r++)i[r].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose($s,t,to),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose($s,eo,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map((t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()}))),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(t),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e<i;e++){const i=n[e];r(t.shapes,i)}else r(t.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,i=this.material.length;n<i;n++)e.push(r(t.materials,this.material[n]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];i.animations.push(r(t.animations,n))}}if(e){const e=s(t.geometries),i=s(t.materials),r=s(t.textures),o=s(t.images),a=s(t.shapes),l=s(t.skeletons),c=s(t.animations),h=s(t.nodes);e.length>0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(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.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,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.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}}co.DEFAULT_UP=new os(0,1,0),co.DEFAULT_MATRIX_AUTO_UPDATE=!0,co.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ho=new os,uo=new os,po=new os,Ao=new os,fo=new os,mo=new os,go=new os,vo=new os,yo=new os,Eo=new os,xo=new Zr,bo=new Zr,Co=new Zr;class wo{constructor(t=new os,e=new os,n=new os){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),ho.subVectors(t,e),i.cross(ho);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){ho.subVectors(i,e),uo.subVectors(n,e),po.subVectors(t,e);const s=ho.dot(ho),o=ho.dot(uo),a=ho.dot(po),l=uo.dot(uo),c=uo.dot(po),h=s*l-o*o;if(0===h)return r.set(0,0,0),null;const u=1/h,d=(l*a-o*c)*u,p=(s*c-o*a)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return null!==this.getBarycoord(t,e,n,i,Ao)&&Ao.x>=0&&Ao.y>=0&&Ao.x+Ao.y<=1}static getInterpolation(t,e,n,i,r,s,o,a){return null===this.getBarycoord(t,e,n,i,Ao)?(a.x=0,a.y=0,"z"in a&&(a.z=0),"w"in a&&(a.w=0),null):(a.setScalar(0),a.addScaledVector(r,Ao.x),a.addScaledVector(s,Ao.y),a.addScaledVector(o,Ao.z),a)}static getInterpolatedAttribute(t,e,n,i,r,s){return xo.setScalar(0),bo.setScalar(0),Co.setScalar(0),xo.fromBufferAttribute(t,e),bo.fromBufferAttribute(t,n),Co.fromBufferAttribute(t,i),s.setScalar(0),s.addScaledVector(xo,r.x),s.addScaledVector(bo,r.y),s.addScaledVector(Co,r.z),s}static isFrontFacing(t,e,n,i){return ho.subVectors(n,e),uo.subVectors(t,e),ho.cross(uo).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}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(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 ho.subVectors(this.c,this.b),uo.subVectors(this.a,this.b),.5*ho.cross(uo).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return wo.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return wo.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,r){return wo.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return wo.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return wo.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let s,o;fo.subVectors(i,n),mo.subVectors(r,n),vo.subVectors(t,n);const a=fo.dot(vo),l=mo.dot(vo);if(a<=0&&l<=0)return e.copy(n);yo.subVectors(t,i);const c=fo.dot(yo),h=mo.dot(yo);if(c>=0&&h<=c)return e.copy(i);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return s=a/(a-c),e.copy(n).addScaledVector(fo,s);Eo.subVectors(t,r);const d=fo.dot(Eo),p=mo.dot(Eo);if(p>=0&&d<=p)return e.copy(r);const A=d*l-a*p;if(A<=0&&l>=0&&p<=0)return o=l/(l-p),e.copy(n).addScaledVector(mo,o);const f=c*p-d*h;if(f<=0&&h-c>=0&&d-p>=0)return go.subVectors(r,i),o=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(go,o);const m=1/(f+A+u);return s=A*m,o=u*m,e.copy(n).addScaledVector(fo,s).addScaledVector(mo,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const _o={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},Mo={h:0,s:0,l:0},So={h:0,s:0,l:0};function Io(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}class Bo{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(void 0===e&&void 0===n){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Bi){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,zr.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i=zr.workingColorSpace){return this.r=t,this.g=e,this.b=n,zr.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i=zr.workingColorSpace){if(t=wr(t,1),e=Cr(e,0,1),n=Cr(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=Io(r,i,t+1/3),this.g=Io(r,i,t),this.b=Io(r,i,t-1/3)}return zr.toWorkingColorSpace(this,i),this}setStyle(t,e=Bi){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const s=i[1],o=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(n,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Bi){const n=_o[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=Hr(t.r),this.g=Hr(t.g),this.b=Hr(t.b),this}copyLinearToSRGB(t){return this.r=Vr(t.r),this.g=Vr(t.g),this.b=Vr(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Bi){return zr.fromWorkingColorSpace(To.copy(this),t),65536*Math.round(Cr(255*To.r,0,255))+256*Math.round(Cr(255*To.g,0,255))+Math.round(Cr(255*To.b,0,255))}getHexString(t=Bi){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=zr.workingColorSpace){zr.fromWorkingColorSpace(To.copy(this),e);const n=To.r,i=To.g,r=To.b,s=Math.max(n,i,r),o=Math.min(n,i,r);let a,l;const c=(o+s)/2;if(o===s)a=0,l=0;else{const t=s-o;switch(l=c<=.5?t/(s+o):t/(2-s-o),s){case n:a=(i-r)/t+(i<r?6:0);break;case i:a=(r-n)/t+2;break;case r:a=(n-i)/t+4}a/=6}return t.h=a,t.s=l,t.l=c,t}getRGB(t,e=zr.workingColorSpace){return zr.fromWorkingColorSpace(To.copy(this),e),t.r=To.r,t.g=To.g,t.b=To.b,t}getStyle(t=Bi){zr.fromWorkingColorSpace(To.copy(this),t);const e=To.r,n=To.g,i=To.b;return t!==Bi?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(t,e,n){return this.getHSL(Mo),this.setHSL(Mo.h+t,Mo.s+e,Mo.l+n)}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(Mo),t.getHSL(So);const n=_r(Mo.h,So.h,e),i=_r(Mo.s,So.s,e),r=_r(Mo.l,So.l,e);return this.setHSL(n,i,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,n=this.g,i=this.b,r=t.elements;return this.r=r[0]*e+r[3]*n+r[6]*i,this.g=r[1]*e+r[4]*n+r[7]*i,this.b=r[2]*e+r[5]*n+r[8]*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}}const To=new Bo;Bo.NAMES=_o;let Ro=0;class Lo extends gr{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ro++}),this.uuid=br(),this.name="",this.type="Material",this.blending=qt,this.side=Ht,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ae,this.blendDst=le,this.blendEquation=Zt,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Bo(0,0,0),this.blendAlpha=0,this.depthFunc=xe,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Xi,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Pi,this.stencilZFail=Pi,this.stencilZPass=Pi,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),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(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==qt&&(n.blending=this.blending),this.side!==Ht&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==ae&&(n.blendSrc=this.blendSrc),this.blendDst!==le&&(n.blendDst=this.blendDst),this.blendEquation!==Zt&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==xe&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Xi&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Pi&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Pi&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Pi&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),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=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(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(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,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.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,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.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Do extends Lo{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Bo(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ws,this.combine=Me,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(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.envMapRotation.copy(t.envMapRotation),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.fog=t.fog,this}}const Po=Uo();function Uo(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),i=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(i[t]=0,i[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(i[t]=1024>>-e-14,i[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(i[t]=e+15<<10,i[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(i[t]=31744,i[256|t]=64512,r[t]=24,r[256|t]=24):(i[t]=31744,i[256|t]=64512,r[t]=13,r[256|t]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,n=0;for(;!(8388608&e);)e<<=1,n-=8388608;e&=-8388609,n+=947912704,s[t]=e|n}for(let t=1024;t<2048;++t)s[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)o[t]=t<<23;o[31]=1199570944,o[32]=2147483648;for(let t=33;t<63;++t)o[t]=2147483648+(t-32<<23);o[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(a[t]=1024);return{floatView:e,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function Oo(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Cr(t,-65504,65504),Po.floatView[0]=t;const e=Po.uint32View[0],n=e>>23&511;return Po.baseTable[n]+((8388607&e)>>Po.shiftTable[n])}function Fo(t){const e=t>>10;return Po.uint32View[0]=Po.mantissaTable[Po.offsetTable[e]+(1023&t)]+Po.exponentTable[e],Po.floatView[0]}const ko={toHalfFloat:Oo,fromHalfFloat:Fo},No=new os,Qo=new Br;let Go=0;class zo{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Go++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=n,this.usage=ir,this.updateRanges=[],this.gpuType=un,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(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.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)Qo.fromBufferAttribute(this,e),Qo.applyMatrix3(t),this.setXY(e,Qo.x,Qo.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)No.fromBufferAttribute(this,e),No.applyMatrix3(t),this.setXYZ(e,No.x,No.y,No.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)No.fromBufferAttribute(this,e),No.applyMatrix4(t),this.setXYZ(e,No.x,No.y,No.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)No.fromBufferAttribute(this,e),No.applyNormalMatrix(t),this.setXYZ(e,No.x,No.y,No.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)No.fromBufferAttribute(this,e),No.transformDirection(t),this.setXYZ(e,No.x,No.y,No.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=Mr(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=Sr(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Mr(e,this.array)),e}setX(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Mr(e,this.array)),e}setY(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Mr(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Mr(e,this.array)),e}setW(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array),r=Sr(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==ir&&(t.usage=this.usage),t}}class Ho extends zo{constructor(t,e,n){super(new Int8Array(t),e,n)}}class Vo extends zo{constructor(t,e,n){super(new Uint8Array(t),e,n)}}class jo extends zo{constructor(t,e,n){super(new Uint8ClampedArray(t),e,n)}}class Wo extends zo{constructor(t,e,n){super(new Int16Array(t),e,n)}}class qo extends zo{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Xo extends zo{constructor(t,e,n){super(new Int32Array(t),e,n)}}class Yo extends zo{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class Jo extends zo{constructor(t,e,n){super(new Uint16Array(t),e,n),this.isFloat16BufferAttribute=!0}getX(t){let e=Fo(this.array[t*this.itemSize]);return this.normalized&&(e=Mr(e,this.array)),e}setX(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize]=Oo(e),this}getY(t){let e=Fo(this.array[t*this.itemSize+1]);return this.normalized&&(e=Mr(e,this.array)),e}setY(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+1]=Oo(e),this}getZ(t){let e=Fo(this.array[t*this.itemSize+2]);return this.normalized&&(e=Mr(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+2]=Oo(e),this}getW(t){let e=Fo(this.array[t*this.itemSize+3]);return this.normalized&&(e=Mr(e,this.array)),e}setW(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+3]=Oo(e),this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array)),this.array[t+0]=Oo(e),this.array[t+1]=Oo(n),this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array)),this.array[t+0]=Oo(e),this.array[t+1]=Oo(n),this.array[t+2]=Oo(i),this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array),r=Sr(r,this.array)),this.array[t+0]=Oo(e),this.array[t+1]=Oo(n),this.array[t+2]=Oo(i),this.array[t+3]=Oo(r),this}}class Ko extends zo{constructor(t,e,n){super(new Float32Array(t),e,n)}}let Zo=0;const $o=new Os,ta=new co,ea=new os,na=new cs,ia=new cs,ra=new os;class sa extends gr{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Zo++}),this.uuid=br(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=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(t){return Array.isArray(t)?this.index=new(Lr(t)?Yo:qo)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(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 Tr).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}applyQuaternion(t){return $o.makeRotationFromQuaternion(t),this.applyMatrix4($o),this}rotateX(t){return $o.makeRotationX(t),this.applyMatrix4($o),this}rotateY(t){return $o.makeRotationY(t),this.applyMatrix4($o),this}rotateZ(t){return $o.makeRotationZ(t),this.applyMatrix4($o),this}translate(t,e,n){return $o.makeTranslation(t,e,n),this.applyMatrix4($o),this}scale(t,e,n){return $o.makeScale(t,e,n),this.applyMatrix4($o),this}lookAt(t){return ta.lookAt(t),ta.updateMatrix(),this.applyMatrix4(ta.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ea).negate(),this.translate(ea.x,ea.y,ea.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];e.push(i.x,i.y,i.z||0)}this.setAttribute("position",new Ko(e,3))}else{const n=Math.min(t.length,e.count);for(let i=0;i<n;i++){const n=t[i];e.setXYZ(i,n.x,n.y,n.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new cs);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.",this),void this.boundingBox.set(new os(-1/0,-1/0,-1/0),new os(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];na.setFromBufferAttribute(n),this.morphTargetsRelative?(ra.addVectors(this.boundingBox.min,na.min),this.boundingBox.expandByPoint(ra),ra.addVectors(this.boundingBox.max,na.max),this.boundingBox.expandByPoint(ra)):(this.boundingBox.expandByPoint(na.min),this.boundingBox.expandByPoint(na.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Ss);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new os,1/0);if(t){const n=this.boundingSphere.center;if(na.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];ia.setFromBufferAttribute(n),this.morphTargetsRelative?(ra.addVectors(na.min,ia.min),na.expandByPoint(ra),ra.addVectors(na.max,ia.max),na.expandByPoint(ra)):(na.expandByPoint(ia.min),na.expandByPoint(ia.max))}na.getCenter(n);let i=0;for(let e=0,r=t.count;e<r;e++)ra.fromBufferAttribute(t,e),i=Math.max(i,n.distanceToSquared(ra));if(e)for(let r=0,s=e.length;r<s;r++){const s=e[r],o=this.morphTargetsRelative;for(let e=0,r=s.count;e<r;e++)ra.fromBufferAttribute(s,e),o&&(ea.fromBufferAttribute(t,e),ra.add(ea)),i=Math.max(i,n.distanceToSquared(ra))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=e.position,i=e.normal,r=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new zo(new Float32Array(4*n.count),4));const s=this.getAttribute("tangent"),o=[],a=[];for(let t=0;t<n.count;t++)o[t]=new os,a[t]=new os;const l=new os,c=new os,h=new os,u=new Br,d=new Br,p=new Br,A=new os,f=new os;function m(t,e,i){l.fromBufferAttribute(n,t),c.fromBufferAttribute(n,e),h.fromBufferAttribute(n,i),u.fromBufferAttribute(r,t),d.fromBufferAttribute(r,e),p.fromBufferAttribute(r,i),c.sub(l),h.sub(l),d.sub(u),p.sub(u);const s=1/(d.x*p.y-p.x*d.y);isFinite(s)&&(A.copy(c).multiplyScalar(p.y).addScaledVector(h,-d.y).multiplyScalar(s),f.copy(h).multiplyScalar(d.x).addScaledVector(c,-p.x).multiplyScalar(s),o[t].add(A),o[e].add(A),o[i].add(A),a[t].add(f),a[e].add(f),a[i].add(f))}let g=this.groups;0===g.length&&(g=[{start:0,count:t.count}]);for(let e=0,n=g.length;e<n;++e){const n=g[e],i=n.start;for(let e=i,r=i+n.count;e<r;e+=3)m(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const v=new os,y=new os,E=new os,x=new os;function b(t){E.fromBufferAttribute(i,t),x.copy(E);const e=o[t];v.copy(e),v.sub(E.multiplyScalar(E.dot(e))).normalize(),y.crossVectors(x,e);const n=y.dot(a[t])<0?-1:1;s.setXYZW(t,v.x,v.y,v.z,n)}for(let e=0,n=g.length;e<n;++e){const n=g[e],i=n.start;for(let e=i,r=i+n.count;e<r;e+=3)b(t.getX(e+0)),b(t.getX(e+1)),b(t.getX(e+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new zo(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const i=new os,r=new os,s=new os,o=new os,a=new os,l=new os,c=new os,h=new os;if(t)for(let u=0,d=t.count;u<d;u+=3){const d=t.getX(u+0),p=t.getX(u+1),A=t.getX(u+2);i.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),s.fromBufferAttribute(e,A),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),o.fromBufferAttribute(n,d),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,A),o.add(c),a.add(c),l.add(c),n.setXYZ(d,o.x,o.y,o.z),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(A,l.x,l.y,l.z)}else for(let t=0,o=e.count;t<o;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),s.fromBufferAttribute(e,t+2),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),n.setXYZ(t+0,c.x,c.y,c.z),n.setXYZ(t+1,c.x,c.y,c.z),n.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)ra.fromBufferAttribute(t,e),ra.normalize(),t.setXYZ(e,ra.x,ra.y,ra.z)}toNonIndexed(){function t(t,e){const n=t.array,i=t.itemSize,r=t.normalized,s=new n.constructor(e.length*i);let o=0,a=0;for(let r=0,l=e.length;r<l;r++){o=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*i;for(let t=0;t<i;t++)s[a++]=n[o++]}return new zo(s,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new sa,n=this.index.array,i=this.attributes;for(const r in i){const s=t(i[r],n);e.setAttribute(r,s)}const r=this.morphAttributes;for(const i in r){const s=[],o=r[i];for(let e=0,i=o.length;e<i;e++){const i=t(o[e],n);s.push(i)}e.morphAttributes[i]=s}e.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let t=0,n=s.length;t<n;t++){const n=s[t];e.addGroup(n.start,n.count,n.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(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];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],s=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];s.push(i.toJSON(t.data))}s.length>0&&(i[e]=s,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return(new this.constructor).copy(this)}copy(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;t<r;t++)n.push(i[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const s=t.groups;for(let t=0,e=s.length;t<e;t++){const e=s[t];this.addGroup(e.start,e.count,e.materialIndex)}const o=t.boundingBox;null!==o&&(this.boundingBox=o.clone());const a=t.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const oa=new Os,aa=new Us,la=new Ss,ca=new os,ha=new os,ua=new os,da=new os,pa=new os,Aa=new os,fa=new os,ma=new os;class ga extends co{constructor(t=new sa,e=new Do){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;e.fromBufferAttribute(i,t);const o=this.morphTargetInfluences;if(r&&o){Aa.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=o[n],a=r[n];0!==i&&(pa.fromBufferAttribute(a,t),s?Aa.addScaledVector(pa,i):Aa.addScaledVector(pa.sub(e),i))}e.add(Aa)}return e}raycast(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),la.copy(n.boundingSphere),la.applyMatrix4(r),aa.copy(t.ray).recast(t.near),!1===la.containsPoint(aa.origin)){if(null===aa.intersectSphere(la,ca))return;if(aa.origin.distanceToSquared(ca)>(t.far-t.near)**2)return}oa.copy(r).invert(),aa.copy(t.ray).applyMatrix4(oa),null!==n.boundingBox&&!1===aa.intersectsBox(n.boundingBox)||this._computeIntersections(t,e,aa)}}_computeIntersections(t,e,n){let i;const r=this.geometry,s=this.material,o=r.index,a=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==o)if(Array.isArray(s))for(let r=0,a=u.length;r<a;r++){const a=u[r],p=s[a.materialIndex];for(let r=Math.max(a.start,d.start),s=Math.min(o.count,Math.min(a.start+a.count,d.start+d.count));r<s;r+=3)i=va(this,p,t,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=a.materialIndex,e.push(i))}else for(let r=Math.max(0,d.start),a=Math.min(o.count,d.start+d.count);r<a;r+=3)i=va(this,s,t,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),e.push(i));else if(void 0!==a)if(Array.isArray(s))for(let r=0,o=u.length;r<o;r++){const o=u[r],p=s[o.materialIndex];for(let r=Math.max(o.start,d.start),s=Math.min(a.count,Math.min(o.start+o.count,d.start+d.count));r<s;r+=3)i=va(this,p,t,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,e.push(i))}else for(let r=Math.max(0,d.start),o=Math.min(a.count,d.start+d.count);r<o;r+=3)i=va(this,s,t,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),e.push(i))}}function va(t,e,n,i,r,s,o,a,l,c){t.getVertexPosition(a,ha),t.getVertexPosition(l,ua),t.getVertexPosition(c,da);const h=function(t,e,n,i,r,s,o,a){let l;if(l=e.side===Vt?i.intersectTriangle(o,s,r,!0,a):i.intersectTriangle(r,s,o,e.side===Ht,a),null===l)return null;ma.copy(a),ma.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(ma);return c<n.near||c>n.far?null:{distance:c,point:ma.clone(),object:t}}(t,e,n,i,ha,ua,da,fa);if(h){const t=new os;wo.getBarycoord(fa,ha,ua,da,t),r&&(h.uv=wo.getInterpolatedAttribute(r,a,l,c,t,new Br)),s&&(h.uv1=wo.getInterpolatedAttribute(s,a,l,c,t,new Br)),o&&(h.normal=wo.getInterpolatedAttribute(o,a,l,c,t,new os),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const e={a,b:l,c,normal:new os,materialIndex:0};wo.getNormal(ha,ua,da,e.normal),h.face=e,h.barycoord=t}return h}class ya extends sa{constructor(t=1,e=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const a=[],l=[],c=[],h=[];let u=0,d=0;function p(t,e,n,i,r,s,p,A,f,m,g){const v=s/f,y=p/m,E=s/2,x=p/2,b=A/2,C=f+1,w=m+1;let _=0,M=0;const S=new os;for(let s=0;s<w;s++){const o=s*y-x;for(let a=0;a<C;a++){const u=a*v-E;S[t]=u*i,S[e]=o*r,S[n]=b,l.push(S.x,S.y,S.z),S[t]=0,S[e]=0,S[n]=A>0?1:-1,c.push(S.x,S.y,S.z),h.push(a/f),h.push(1-s/m),_+=1}}for(let t=0;t<m;t++)for(let e=0;e<f;e++){const n=u+e+C*t,i=u+e+C*(t+1),r=u+(e+1)+C*(t+1),s=u+(e+1)+C*t;a.push(n,i,s),a.push(i,r,s),M+=6}o.addGroup(d,M,g),d+=M,u+=_}p("z","y","x",-1,-1,n,e,t,s,r,0),p("z","y","x",1,-1,n,e,-t,s,r,1),p("x","z","y",1,1,t,n,e,i,s,2),p("x","z","y",1,-1,t,n,-e,i,s,3),p("x","y","z",1,-1,t,e,n,i,r,4),p("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(a),this.setAttribute("position",new Ko(l,3)),this.setAttribute("normal",new Ko(c,3)),this.setAttribute("uv",new Ko(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ya(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Ea(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function xa(t){const e={};for(let n=0;n<t.length;n++){const i=Ea(t[n]);for(const t in i)e[t]=i[t]}return e}function ba(t){const e=t.getRenderTarget();return null===e?t.outputColorSpace:!0===e.isXRRenderTarget?e.texture.colorSpace:zr.workingColorSpace}const Ca={clone:Ea,merge:xa};class wa extends Lo{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ea(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?e.uniforms[n]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[n]={type:"m4",value:i.toArray()}:e.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;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}}class _a extends co{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Os,this.projectionMatrix=new Os,this.projectionMatrixInverse=new Os,this.coordinateSystem=Ar}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const Ma=new os,Sa=new Br,Ia=new Br;class Ba extends _a{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(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(t){const e=.5*this.getFilmHeight()/t;this.fov=2*xr*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*Er*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*xr*Math.atan(Math.tan(.5*Er*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){Ma.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Ma.x,Ma.y).multiplyScalar(-t/Ma.z),Ma.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ma.x,Ma.y).multiplyScalar(-t/Ma.z)}getViewSize(t,e){return this.getViewBounds(t,Sa,Ia),e.subVectors(Ia,Sa)}setViewOffset(t,e,n,i,r,s){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=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*Er*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,o=s.fullHeight;r+=s.offsetX*i/t,e-=s.offsetY*n/o,i*=s.width/t,n*=s.height/o}const o=this.filmOffset;0!==o&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(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 Ta=-90;class Ra extends co{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Ba(Ta,1,t,e);i.layers=this.layers,this.add(i);const r=new Ba(Ta,1,t,e);r.layers=this.layers,this.add(r);const s=new Ba(Ta,1,t,e);s.layers=this.layers,this.add(s);const o=new Ba(Ta,1,t,e);o.layers=this.layers,this.add(o);const a=new Ba(Ta,1,t,e);a.layers=this.layers,this.add(a);const l=new Ba(Ta,1,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,i,r,s,o,a]=e;for(const t of e)this.remove(t);if(t===Ar)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),a.up.set(0,1,0),a.lookAt(0,0,-1);else{if(t!==fr)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),a.up.set(0,-1,0),a.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,s,o,a,l,c]=this.children,h=t.getRenderTarget(),u=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const A=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,i),t.render(e,r),t.setRenderTarget(n,1,i),t.render(e,s),t.setRenderTarget(n,2,i),t.render(e,o),t.setRenderTarget(n,3,i),t.render(e,a),t.setRenderTarget(n,4,i),t.render(e,l),n.texture.generateMipmaps=A,t.setRenderTarget(n,5,i),t.render(e,c),t.setRenderTarget(h,u,d),t.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class La extends Kr{constructor(t,e,n,i,r,s,o,a,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:Qe,n,i,r,s,o,a,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Da extends ts{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new La(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:$e}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,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\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",s=new ya(5,5,5),o=new wa({name:"CubemapFromEquirect",uniforms:Ea(n),vertexShader:i,fragmentShader:r,side:Vt,blending:Wt});o.uniforms.tEquirect.value=e;const a=new ga(s,o),l=e.minFilter;return e.minFilter===nn&&(e.minFilter=$e),new Ra(1,10,this).update(t,a),e.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(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)}}class Pa extends co{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Ua={type:"move"};class Oa{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Pa,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Pa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new os,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new os),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Pa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new os,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new os),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(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(t,e,n){let i=null,r=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(l&&t.hand){s=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n),r=this._getHandJoint(l,i);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=i.position.distanceTo(r.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else 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),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));null!==o&&(i=e.getPose(t.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Ua)))}return null!==o&&(o.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const n=new Pa;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}class Fa{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new Bo(t),this.density=e}clone(){return new Fa(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class ka{constructor(t,e=1,n=1e3){this.isFog=!0,this.name="",this.color=new Bo(t),this.near=e,this.far=n}clone(){return new ka(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Na extends co{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ws,this.environmentIntensity=1,this.environmentRotation=new Ws,this.overrideMaterial=null,"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()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class Qa{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=ir,this.updateRanges=[],this.version=0,this.uuid=br()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=br()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=br()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Ga=new os;class za{constructor(t,e,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)Ga.fromBufferAttribute(this,e),Ga.applyMatrix4(t),this.setXYZ(e,Ga.x,Ga.y,Ga.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Ga.fromBufferAttribute(this,e),Ga.applyNormalMatrix(t),this.setXYZ(e,Ga.x,Ga.y,Ga.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Ga.fromBufferAttribute(this,e),Ga.transformDirection(t),this.setXYZ(e,Ga.x,Ga.y,Ga.z);return this}getComponent(t,e){let n=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(n=Mr(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=Sr(n,this.array)),this.data.array[t*this.data.stride+this.offset+e]=n,this}setX(t,e){return this.normalized&&(e=Sr(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=Sr(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=Sr(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=Sr(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Mr(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Mr(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Mr(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Mr(e,this.array)),e}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array),r=Sr(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new zo(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new za(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Ha extends Lo{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Bo(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}let Va;const ja=new os,Wa=new os,qa=new os,Xa=new Br,Ya=new Br,Ja=new Os,Ka=new os,Za=new os,$a=new os,tl=new Br,el=new Br,nl=new Br;class il extends co{constructor(t=new Ha){if(super(),this.isSprite=!0,this.type="Sprite",void 0===Va){Va=new sa;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new Qa(t,5);Va.setIndex([0,1,2,0,2,3]),Va.setAttribute("position",new za(e,3,0,!1)),Va.setAttribute("uv",new za(e,2,3,!1))}this.geometry=Va,this.material=t,this.center=new Br(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Wa.setFromMatrixScale(this.matrixWorld),Ja.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),qa.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Wa.multiplyScalar(-qa.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const s=this.center;rl(Ka.set(-.5,-.5,0),qa,s,Wa,i,r),rl(Za.set(.5,-.5,0),qa,s,Wa,i,r),rl($a.set(.5,.5,0),qa,s,Wa,i,r),tl.set(0,0),el.set(1,0),nl.set(1,1);let o=t.ray.intersectTriangle(Ka,Za,$a,!1,ja);if(null===o&&(rl(Za.set(-.5,.5,0),qa,s,Wa,i,r),el.set(0,1),o=t.ray.intersectTriangle(Ka,$a,Za,!1,ja),null===o))return;const a=t.ray.origin.distanceTo(ja);a<t.near||a>t.far||e.push({distance:a,point:ja.clone(),uv:wo.getInterpolation(ja,Ka,Za,$a,tl,el,nl,new Br),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function rl(t,e,n,i,r,s){Xa.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(Ya.x=s*Xa.x-r*Xa.y,Ya.y=r*Xa.x+s*Xa.y):Ya.copy(Xa),t.copy(e),t.x+=Ya.x,t.y+=Ya.y,t.applyMatrix4(Ja)}const sl=new os,ol=new os;class al extends co{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.addLevel(n.object.clone(),n.distance,n.hysteresis)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0,n=0){e=Math.abs(e);const i=this.levels;let r;for(r=0;r<i.length&&!(e<i[r].distance);r++);return i.splice(r,0,{distance:e,hysteresis:n,object:t}),this.add(t),this}removeLevel(t){const e=this.levels;for(let n=0;n<e.length;n++)if(e[n].distance===t){const t=e.splice(n,1);return this.remove(t[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let n,i;for(n=1,i=e.length;n<i;n++){let i=e[n].distance;if(e[n].object.visible&&(i-=i*e[n].hysteresis),t<i)break}return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){sl.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(sl);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){sl.setFromMatrixPosition(t.matrixWorld),ol.setFromMatrixPosition(this.matrixWorld);const n=sl.distanceTo(ol)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i<r;i++){let t=e[i].distance;if(e[i].object.visible&&(t-=t*e[i].hysteresis),!(n>=t))break;e[i-1].object.visible=!1,e[i].object.visible=!0}for(this._currentLevel=i-1;i<r;i++)e[i].object.visible=!1}}toJSON(t){const e=super.toJSON(t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let t=0,i=n.length;t<i;t++){const i=n[t];e.object.levels.push({object:i.object.uuid,distance:i.distance,hysteresis:i.hysteresis})}return e}}const ll=new os,cl=new Zr,hl=new Zr,ul=new os,dl=new Os,pl=new os,Al=new Ss,fl=new Os,ml=new Us;class gl extends ga{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Fe,this.bindMatrix=new Os,this.bindMatrixInverse=new Os,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new cs),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,pl),this.boundingBox.expandByPoint(pl)}computeBoundingSphere(){const t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new Ss),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,pl),this.boundingSphere.expandByPoint(pl)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),Al.copy(this.boundingSphere),Al.applyMatrix4(i),!1!==t.ray.intersectsSphere(Al)&&(fl.copy(i).invert(),ml.copy(t.ray).applyMatrix4(fl),null!==this.boundingBox&&!1===ml.intersectsBox(this.boundingBox)||this._computeIntersections(t,e,ml)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Zr,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;n<i;n++){t.fromBufferAttribute(e,n);const i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===Fe?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===ke?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const n=this.skeleton,i=this.geometry;cl.fromBufferAttribute(i.attributes.skinIndex,t),hl.fromBufferAttribute(i.attributes.skinWeight,t),ll.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const i=hl.getComponent(t);if(0!==i){const r=cl.getComponent(t);dl.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),e.addScaledVector(ul.copy(ll).applyMatrix4(dl),i)}}return e.applyMatrix4(this.bindMatrixInverse)}}class vl extends co{constructor(){super(),this.isBone=!0,this.type="Bone"}}class yl extends Kr{constructor(t=null,e=1,n=1,i,r,s,o,a,l=Xe,c=Xe,h,u){super(null,s,o,a,l,c,i,r,h,u),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const El=new Os,xl=new Os;class bl{constructor(t=[],e=[]){this.uuid=br(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new Os)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new Os;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=t.length;i<r;i++){const r=t[i]?t[i].matrixWorld:xl;El.multiplyMatrices(r,e[i]),El.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new bl(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const n=new yl(e,t,t,yn,un);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){const n=this.bones[e];if(n.name===t)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,i=t.bones.length;n<i;n++){const i=t.bones[n];let r=e[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new vl),this.bones.push(r),this.boneInverses.push((new Os).fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let i=0,r=e.length;i<r;i++){const r=e[i];t.bones.push(r.uuid);const s=n[i];t.boneInverses.push(s.toArray())}return t}}class Cl extends zo{constructor(t,e,n,i=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const wl=new Os,_l=new Os,Ml=[],Sl=new cs,Il=new Os,Bl=new ga,Tl=new Ss;class Rl extends ga{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new Cl(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let t=0;t<n;t++)this.setMatrixAt(t,Il)}computeBoundingBox(){const t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new cs),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,wl),Sl.copy(t.boundingBox).applyMatrix4(wl),this.boundingBox.union(Sl)}computeBoundingSphere(){const t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new Ss),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,wl),Tl.copy(t.boundingSphere).applyMatrix4(wl),this.boundingSphere.union(Tl)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.morphTexture&&(this.morphTexture=t.morphTexture.clone()),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){const n=e.morphTargetInfluences,i=this.morphTexture.source.data.data,r=t*(n.length+1)+1;for(let t=0;t<n.length;t++)n[t]=i[r+t]}raycast(t,e){const n=this.matrixWorld,i=this.count;if(Bl.geometry=this.geometry,Bl.material=this.material,void 0!==Bl.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Tl.copy(this.boundingSphere),Tl.applyMatrix4(n),!1!==t.ray.intersectsSphere(Tl)))for(let r=0;r<i;r++){this.getMatrixAt(r,wl),_l.multiplyMatrices(n,wl),Bl.matrixWorld=_l,Bl.raycast(t,Ml);for(let t=0,n=Ml.length;t<n;t++){const n=Ml[t];n.instanceId=r,n.object=this,e.push(n)}Ml.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new Cl(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}setMorphAt(t,e){const n=e.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new yl(new Float32Array(i*this.count),i,this.count,wn,un));const r=this.morphTexture.source.data.data;let s=0;for(let t=0;t<n.length;t++)s+=n[t];const o=this.geometry.morphTargetsRelative?1:1-s,a=i*t;r[a]=o,r.set(n,a+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}}const Ll=new os,Dl=new os,Pl=new Tr;class Ul{constructor(t=new os(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Ll.subVectors(n,e).cross(Dl.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(Ll),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)}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 t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Pl.getNormalMatrix(t),i=this.coplanarPoint(Ll).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}clone(){return(new this.constructor).copy(this)}}const Ol=new Ss,Fl=new os;class kl{constructor(t=new Ul,e=new Ul,n=new Ul,i=new Ul,r=new Ul,s=new Ul){this.planes=[t,e,n,i,r,s]}set(t,e,n,i,r,s){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=Ar){const n=this.planes,i=t.elements,r=i[0],s=i[1],o=i[2],a=i[3],l=i[4],c=i[5],h=i[6],u=i[7],d=i[8],p=i[9],A=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];if(n[0].setComponents(a-r,u-l,f-d,y-m).normalize(),n[1].setComponents(a+r,u+l,f+d,y+m).normalize(),n[2].setComponents(a+s,u+c,f+p,y+g).normalize(),n[3].setComponents(a-s,u-c,f-p,y-g).normalize(),n[4].setComponents(a-o,u-h,f-A,y-v).normalize(),e===Ar)n[5].setComponents(a+o,u+h,f+A,y+v).normalize();else{if(e!==fr)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);n[5].setComponents(o,h,A,v).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),Ol.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),Ol.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Ol)}intersectsSprite(t){return Ol.center.set(0,0,0),Ol.radius=.7071067811865476,Ol.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ol)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(n)<i)return!1;return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(Fl.x=i.normal.x>0?t.max.x:t.min.x,Fl.y=i.normal.y>0?t.max.y:t.min.y,Fl.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Fl)<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}clone(){return(new this.constructor).copy(this)}}function Nl(t,e){return t-e}function Ql(t,e){return t.z-e.z}function Gl(t,e){return e.z-t.z}class zl{constructor(){this.index=0,this.pool=[],this.list=[]}push(t,e,n,i){const r=this.pool,s=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const o=r[this.index];s.push(o),this.index++,o.start=t,o.count=e,o.z=n,o.index=i}reset(){this.list.length=0,this.index=0}}const Hl=new Os,Vl=new Bo(1,1,1),jl=new kl,Wl=new cs,ql=new Ss,Xl=new os,Yl=new os,Jl=new os,Kl=new zl,Zl=new ga,$l=[];function tc(t,e,n=0){const i=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const r=t.count;for(let s=0;s<r;s++)for(let r=0;r<i;r++)e.setComponent(s+n,r,t.getComponent(s,r))}else e.array.set(t.array,n*i);e.needsUpdate=!0}function ec(t,e){if(t.constructor!==e.constructor){const n=Math.min(t.length,e.length);for(let i=0;i<n;i++)e[i]=t[i]}else{const n=Math.min(t.length,e.length);e.set(new t.constructor(t.buffer,0,n))}}class nc extends ga{get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}constructor(t,e,n=2*e,i){super(new sa,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=t,this._maxVertexCount=e,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(t),this._multiDrawStarts=new Int32Array(t),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let t=Math.sqrt(4*this._maxInstanceCount);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4),n=new yl(e,t,t,yn,un);this._matricesTexture=n}_initIndirectTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);const e=new Uint32Array(t*t),n=new yl(e,t,t,_n,hn);this._indirectTexture=n}_initColorsTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);const e=new Float32Array(t*t*4).fill(1),n=new yl(e,t,t,yn,un);n.colorSpace=zr.workingColorSpace,this._colorsTexture=n}_initializeGeometry(t){const e=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(!1===this._geometryInitialized){for(const i in t.attributes){const r=t.getAttribute(i),{array:s,itemSize:o,normalized:a}=r,l=new s.constructor(n*o),c=new zo(l,o,a);e.setAttribute(i,c)}if(null!==t.getIndex()){const t=n>65535?new Uint32Array(i):new Uint16Array(i);e.setIndex(new zo(t,1))}this._geometryInitialized=!0}}_validateGeometry(t){const e=this.geometry;if(Boolean(t.getIndex())!==Boolean(e.getIndex()))throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in e.attributes){if(!t.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=t.getAttribute(n),r=e.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){const e=this._instanceInfo;if(t<0||t>=e.length||!1===e[t].active)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){const e=this._geometryInfo;if(t<0||t>=e.length||!1===e[t].active)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new cs);const t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let n=0,i=e.length;n<i;n++){if(!1===e[n].active)continue;const i=e[n].geometryIndex;this.getMatrixAt(n,Hl),this.getBoundingBoxAt(i,Wl).applyMatrix4(Hl),t.union(Wl)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Ss);const t=this.boundingSphere,e=this._instanceInfo;t.makeEmpty();for(let n=0,i=e.length;n<i;n++){if(!1===e[n].active)continue;const i=e[n].geometryIndex;this.getMatrixAt(n,Hl),this.getBoundingSphereAt(i,ql).applyMatrix4(Hl),t.union(ql)}}addInstance(t){if(this._instanceInfo.length>=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const e={visible:!0,active:!0,geometryIndex:t};let n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Nl),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=e):(n=this._instanceInfo.length,this._instanceInfo.push(e));const i=this._matricesTexture;Hl.identity().toArray(i.image.data,16*n),i.needsUpdate=!0;const r=this._colorsTexture;return r&&(Vl.toArray(r.image.data,4*n),r.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(t,e=-1,n=-1){this._initializeGeometry(t),this._validateGeometry(t);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=-1===e?t.getAttribute("position").count:e;const s=t.getIndex();if(null!==s&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=-1===n?s.count:n),-1!==i.indexStart&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let o;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Nl),o=this._availableGeometryIds.shift(),r[o]=i):(o=this._geometryCount,this._geometryCount++,r.push(i)),this.setGeometryAt(o,t),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,o}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const n=this.geometry,i=null!==n.getIndex(),r=n.getIndex(),s=e.getIndex(),o=this._geometryInfo[t];if(i&&s.count>o.reservedIndexCount||e.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const a=o.vertexStart,l=o.reservedVertexCount;o.vertexCount=e.getAttribute("position").count;for(const t in n.attributes){const i=e.getAttribute(t),r=n.getAttribute(t);tc(i,r,a);const s=i.itemSize;for(let t=i.count,e=l;t<e;t++){const e=a+t;for(let t=0;t<s;t++)r.setComponent(e,t,0)}r.needsUpdate=!0,r.addUpdateRange(a*s,l*s)}if(i){const t=o.indexStart,n=o.reservedIndexCount;o.indexCount=e.getIndex().count;for(let e=0;e<s.count;e++)r.setX(t+e,a+s.getX(e));for(let e=s.count,i=n;e<i;e++)r.setX(t+e,a);r.needsUpdate=!0,r.addUpdateRange(t,o.reservedIndexCount)}return o.start=i?o.indexStart:o.vertexStart,o.count=i?o.indexCount:o.vertexCount,o.boundingBox=null,null!==e.boundingBox&&(o.boundingBox=e.boundingBox.clone()),o.boundingSphere=null,null!==e.boundingSphere&&(o.boundingSphere=e.boundingSphere.clone()),this._visibilityChanged=!0,t}deleteGeometry(t){const e=this._geometryInfo;if(t>=e.length||!1===e[t].active)return this;const n=this._instanceInfo;for(let e=0,i=n.length;e<i;e++)n[e].active&&n[e].geometryIndex===t&&this.deleteInstance(e);return e[t].active=!1,this._availableGeometryIds.push(t),this._visibilityChanged=!0,this}deleteInstance(t){return this.validateInstanceId(t),this._instanceInfo[t].active=!1,this._availableInstanceIds.push(t),this._visibilityChanged=!0,this}optimize(){let t=0,e=0;const n=this._geometryInfo,i=n.map(((t,e)=>e)).sort(((t,e)=>n[t].vertexStart-n[e].vertexStart)),r=this.geometry;for(let s=0,o=n.length;s<o;s++){const o=i[s],a=n[o];if(!1!==a.active){if(null!==r.index){if(a.indexStart!==e){const{indexStart:n,vertexStart:i,reservedIndexCount:s}=a,o=r.index,l=o.array,c=t-i;for(let t=n;t<n+s;t++)l[t]=l[t]+c;o.array.copyWithin(e,n,n+s),o.addUpdateRange(e,s),a.indexStart=e}e+=a.reservedIndexCount}if(a.vertexStart!==t){const{vertexStart:e,reservedVertexCount:n}=a,i=r.attributes;for(const r in i){const s=i[r],{array:o,itemSize:a}=s;o.copyWithin(t*a,e*a,(e+n)*a),s.addUpdateRange(t*a,n*a)}a.vertexStart=t}t+=a.reservedVertexCount,a.start=r.index?a.indexStart:a.vertexStart,this._nextIndexStart=r.index?a.indexStart+a.reservedIndexCount:0,this._nextVertexStart=a.vertexStart+a.reservedVertexCount}}return this}getBoundingBoxAt(t,e){if(t>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[t];if(null===i.boundingBox){const t=new cs,e=n.index,r=n.attributes.position;for(let n=i.start,s=i.start+i.count;n<s;n++){let i=n;e&&(i=e.getX(i)),t.expandByPoint(Xl.fromBufferAttribute(r,i))}i.boundingBox=t}return e.copy(i.boundingBox),e}getBoundingSphereAt(t,e){if(t>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[t];if(null===i.boundingSphere){const e=new Ss;this.getBoundingBoxAt(t,Wl),Wl.getCenter(e.center);const r=n.index,s=n.attributes.position;let o=0;for(let t=i.start,n=i.start+i.count;t<n;t++){let n=t;r&&(n=r.getX(n)),Xl.fromBufferAttribute(s,n),o=Math.max(o,e.center.distanceToSquared(Xl))}e.radius=Math.sqrt(o),i.boundingSphere=e}return e.copy(i.boundingSphere),e}setMatrixAt(t,e){this.validateInstanceId(t);const n=this._matricesTexture,i=this._matricesTexture.image.data;return e.toArray(i,16*t),n.needsUpdate=!0,this}getMatrixAt(t,e){return this.validateInstanceId(t),e.fromArray(this._matricesTexture.image.data,16*t)}setColorAt(t,e){return this.validateInstanceId(t),null===this._colorsTexture&&this._initColorsTexture(),e.toArray(this._colorsTexture.image.data,4*t),this._colorsTexture.needsUpdate=!0,this}getColorAt(t,e){return this.validateInstanceId(t),e.fromArray(this._colorsTexture.image.data,4*t)}setVisibleAt(t,e){return this.validateInstanceId(t),this._instanceInfo[t].visible===e||(this._instanceInfo[t].visible=e,this._visibilityChanged=!0),this}getVisibleAt(t){return this.validateInstanceId(t),this._instanceInfo[t].visible}setGeometryIdAt(t,e){return this.validateInstanceId(t),this.validateGeometryId(e),this._instanceInfo[t].geometryIndex=e,this}getGeometryIdAt(t){return this.validateInstanceId(t),this._instanceInfo[t].geometryIndex}getGeometryRangeAt(t,e={}){this.validateGeometryId(t);const n=this._geometryInfo[t];return e.vertexStart=n.vertexStart,e.vertexCount=n.vertexCount,e.reservedVertexCount=n.reservedVertexCount,e.indexStart=n.indexStart,e.indexCount=n.indexCount,e.reservedIndexCount=n.reservedIndexCount,e.start=n.start,e.count=n.count,e}setInstanceCount(t){const e=this._availableInstanceIds,n=this._instanceInfo;for(e.sort(Nl);e[e.length-1]===n.length;)n.pop(),e.pop();if(t<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${t} are being used. Cannot shrink instance count.`);const i=new Int32Array(t),r=new Int32Array(t);ec(this._multiDrawCounts,i),ec(this._multiDrawStarts,r),this._multiDrawCounts=i,this._multiDrawStarts=r,this._maxInstanceCount=t;const s=this._indirectTexture,o=this._matricesTexture,a=this._colorsTexture;s.dispose(),this._initIndirectTexture(),ec(s.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),ec(o.image.data,this._matricesTexture.image.data),a&&(a.dispose(),this._initColorsTexture(),ec(a.image.data,this._colorsTexture.image.data))}setGeometrySize(t,e){const n=[...this._geometryInfo].filter((t=>t.active));if(Math.max(...n.map((t=>t.vertexStart+t.reservedVertexCount)))>t)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map((t=>t.indexStart+t.reservedIndexCount)))>e)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);const i=this.geometry;i.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new sa,this._initializeGeometry(i));const r=this.geometry;i.index&&ec(i.index.array,r.index.array);for(const t in i.attributes)ec(i.attributes[t].array,r.attributes[t].array)}raycast(t,e){const n=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,s=this.geometry;Zl.material=this.material,Zl.geometry.index=s.index,Zl.geometry.attributes=s.attributes,null===Zl.geometry.boundingBox&&(Zl.geometry.boundingBox=new cs),null===Zl.geometry.boundingSphere&&(Zl.geometry.boundingSphere=new Ss);for(let s=0,o=n.length;s<o;s++){if(!n[s].visible||!n[s].active)continue;const o=n[s].geometryIndex,a=i[o];Zl.geometry.setDrawRange(a.start,a.count),this.getMatrixAt(s,Zl.matrixWorld).premultiply(r),this.getBoundingBoxAt(o,Zl.geometry.boundingBox),this.getBoundingSphereAt(o,Zl.geometry.boundingSphere),Zl.raycast(t,$l);for(let t=0,n=$l.length;t<n;t++){const n=$l[t];n.object=this,n.batchId=s,e.push(n)}$l.length=0}Zl.material=null,Zl.geometry.index=null,Zl.geometry.attributes={},Zl.geometry.setDrawRange(0,1/0)}copy(t){return super.copy(t),this.geometry=t.geometry.clone(),this.perObjectFrustumCulled=t.perObjectFrustumCulled,this.sortObjects=t.sortObjects,this.boundingBox=null!==t.boundingBox?t.boundingBox.clone():null,this.boundingSphere=null!==t.boundingSphere?t.boundingSphere.clone():null,this._geometryInfo=t._geometryInfo.map((t=>({...t,boundingBox:null!==t.boundingBox?t.boundingBox.clone():null,boundingSphere:null!==t.boundingSphere?t.boundingSphere.clone():null}))),this._instanceInfo=t._instanceInfo.map((t=>({...t}))),this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._geometryCount=t._geometryCount,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(t,e,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const s=i.getIndex(),o=null===s?1:s.array.BYTES_PER_ELEMENT,a=this._instanceInfo,l=this._multiDrawStarts,c=this._multiDrawCounts,h=this._geometryInfo,u=this.perObjectFrustumCulled,d=this._indirectTexture,p=d.image.data;u&&(Hl.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),jl.setFromProjectionMatrix(Hl,t.coordinateSystem));let A=0;if(this.sortObjects){Hl.copy(this.matrixWorld).invert(),Xl.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Hl),Yl.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Hl);for(let t=0,e=a.length;t<e;t++)if(a[t].visible&&a[t].active){const e=a[t].geometryIndex;this.getMatrixAt(t,Hl),this.getBoundingSphereAt(e,ql).applyMatrix4(Hl);let n=!1;if(u&&(n=!jl.intersectsSphere(ql)),!n){const n=h[e],i=Jl.subVectors(ql.center,Xl).dot(Yl);Kl.push(n.start,n.count,i,t)}}const t=Kl.list,e=this.customSort;null===e?t.sort(r.transparent?Gl:Ql):e.call(this,t,n);for(let e=0,n=t.length;e<n;e++){const n=t[e];l[A]=n.start*o,c[A]=n.count,p[A]=n.index,A++}Kl.reset()}else for(let t=0,e=a.length;t<e;t++)if(a[t].visible&&a[t].active){const e=a[t].geometryIndex;let n=!1;if(u&&(this.getMatrixAt(t,Hl),this.getBoundingSphereAt(e,ql).applyMatrix4(Hl),n=!jl.intersectsSphere(ql)),!n){const n=h[e];l[A]=n.start*o,c[A]=n.count,p[A]=t,A++}}d.needsUpdate=!0,this._multiDrawCount=A,this._visibilityChanged=!1}onBeforeShadow(t,e,n,i,r,s){this.onBeforeRender(t,null,i,r,s)}}class ic extends Lo{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Bo(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const rc=new os,sc=new os,oc=new Os,ac=new Us,lc=new Ss,cc=new os,hc=new os;class uc extends co{constructor(t=new sa,e=new ic){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,i=e.count;t<i;t++)rc.fromBufferAttribute(e,t-1),sc.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=rc.distanceTo(sc);t.setAttribute("lineDistance",new Ko(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),lc.copy(n.boundingSphere),lc.applyMatrix4(i),lc.radius+=r,!1===t.ray.intersectsSphere(lc))return;oc.copy(i).invert(),ac.copy(t.ray).applyMatrix4(oc);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,l=this.isLineSegments?2:1,c=n.index,h=n.attributes.position;if(null!==c){const n=Math.max(0,s.start),i=Math.min(c.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=c.getX(r),i=c.getX(r+1),s=dc(this,t,ac,a,n,i,r);s&&e.push(s)}if(this.isLineLoop){const r=c.getX(i-1),s=c.getX(n),o=dc(this,t,ac,a,r,s,i-1);o&&e.push(o)}}else{const n=Math.max(0,s.start),i=Math.min(h.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=dc(this,t,ac,a,r,r+1,r);n&&e.push(n)}if(this.isLineLoop){const r=dc(this,t,ac,a,i-1,n,i-1);r&&e.push(r)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function dc(t,e,n,i,r,s,o){const a=t.geometry.attributes.position;if(rc.fromBufferAttribute(a,r),sc.fromBufferAttribute(a,s),n.distanceSqToSegment(rc,sc,cc,hc)>i)return;cc.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(cc);return l<e.near||l>e.far?void 0:{distance:l,point:hc.clone().applyMatrix4(t.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:t}}const pc=new os,Ac=new os;class fc extends uc{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;t<i;t+=2)pc.fromBufferAttribute(e,t),Ac.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+pc.distanceTo(Ac);t.setAttribute("lineDistance",new Ko(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class mc extends uc{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class gc extends Lo{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Bo(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const vc=new Os,yc=new Us,Ec=new Ss,xc=new os;class bc extends co{constructor(t=new sa,e=new gc){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ec.copy(n.boundingSphere),Ec.applyMatrix4(i),Ec.radius+=r,!1===t.ray.intersectsSphere(Ec))return;vc.copy(i).invert(),yc.copy(t.ray).applyMatrix4(vc);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,l=n.index,c=n.attributes.position;if(null!==l)for(let n=Math.max(0,s.start),r=Math.min(l.count,s.start+s.count);n<r;n++){const r=l.getX(n);xc.fromBufferAttribute(c,r),Cc(xc,r,a,i,t,e,this)}else for(let n=Math.max(0,s.start),r=Math.min(c.count,s.start+s.count);n<r;n++)xc.fromBufferAttribute(c,n),Cc(xc,n,a,i,t,e,this)}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function Cc(t,e,n,i,r,s,o){const a=yc.distanceSqToPoint(t);if(a<n){const n=new os;yc.closestPointToPoint(t,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class wc extends Kr{constructor(t,e,n,i,r,s,o,a,l){super(t,e,n,i,r,s,o,a,l),this.isVideoTexture=!0,this.minFilter=void 0!==s?s:$e,this.magFilter=void 0!==r?r:$e,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1=="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class _c extends wc{constructor(t,e,n,i,r,s,o,a){super({},t,e,n,i,r,s,o,a),this.isVideoFrameTexture=!0}update(){}clone(){return(new this.constructor).copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}}class Mc extends Kr{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=Xe,this.minFilter=Xe,this.generateMipmaps=!1,this.needsUpdate=!0}}class Sc extends Kr{constructor(t,e,n,i,r,s,o,a,l,c,h,u){super(null,s,o,a,l,c,i,r,h,u),this.isCompressedTexture=!0,this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class Ic extends Sc{constructor(t,e,n,i,r,s){super(t,e,n,r,s),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=We,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class Bc extends Sc{constructor(t,e,n){super(void 0,t[0].width,t[0].height,e,n,Qe),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class Tc extends Kr{constructor(t,e,n,i,r,s,o,a,l){super(t,e,n,i,r,s,o,a,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Rc extends Kr{constructor(t,e,n,i,r,s,o,a,l,c=bn){if(c!==bn&&c!==Cn)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===bn&&(n=hn),void 0===n&&c===Cn&&(n=fn),super(null,i,r,s,o,a,c,n,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==o?o:Xe,this.minFilter=void 0!==a?a:Xe,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class Lc{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(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 s=1;s<=t;s++)n=this.getPoint(s/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const r=n.length;let s;s=e||t*n[r-1];let o,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),o=n[i]-s,o<0)a=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),o=this.getPoint(r),a=e||(s.isVector2?new Br:new os);return a.copy(o).sub(s).normalize(),a}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new os,i=[],r=[],s=[],o=new os,a=new Os;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new os)}r[0]=new os,s[0]=new os;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),s[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),s[e]=s[e-1].clone(),o.crossVectors(i[e-1],i[e]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(Cr(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(a.makeRotationAxis(o,t))}s[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(Cr(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(o.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],e*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Dc extends Lc{constructor(t=0,e=0,n=1,i=1,r=0,s=2*Math.PI,o=!1,a=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(t,e=new Br){const n=e,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=s?0:i),!0!==this.aClockwise||s||(r===i?r=-i:r-=i);const o=this.aStartAngle+t*r;let a=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=a-this.aX,i=l-this.aY;a=n*t-i*e+this.aX,l=n*e+i*t+this.aY}return n.set(a,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class Pc extends Dc{constructor(t,e,n,i,r,s){super(t,e,n,n,i,r,s),this.isArcCurve=!0,this.type="ArcCurve"}}function Uc(){let t=0,e=0,n=0,i=0;function r(r,s,o,a){t=r,e=o,n=-3*r+3*s-2*o-a,i=2*r-2*s+o+a}return{initCatmullRom:function(t,e,n,i,s){r(e,n,s*(n-t),s*(i-e))},initNonuniformCatmullRom:function(t,e,n,i,s,o,a){let l=(e-t)/s-(n-t)/(s+o)+(n-e)/o,c=(n-e)/o-(i-e)/(o+a)+(i-n)/a;l*=o,c*=o,r(e,n,l,c)},calc:function(r){const s=r*r;return t+e*r+n*s+i*(s*r)}}}const Oc=new os,Fc=new Uc,kc=new Uc,Nc=new Uc;class Qc extends Lc{constructor(t=[],e=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(t,e=new os){const n=e,i=this.points,r=i.length,s=(r-(this.closed?0:1))*t;let o,a,l=Math.floor(s),c=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?o=i[(l-1)%r]:(Oc.subVectors(i[0],i[1]).add(i[0]),o=Oc);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2<r?a=i[(l+2)%r]:(Oc.subVectors(i[r-1],i[r-2]).add(i[r-1]),a=Oc),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(o.distanceToSquared(h),t),n=Math.pow(h.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(a),t);n<1e-4&&(n=1),e<1e-4&&(e=n),i<1e-4&&(i=n),Fc.initNonuniformCatmullRom(o.x,h.x,u.x,a.x,e,n,i),kc.initNonuniformCatmullRom(o.y,h.y,u.y,a.y,e,n,i),Nc.initNonuniformCatmullRom(o.z,h.z,u.z,a.z,e,n,i)}else"catmullrom"===this.curveType&&(Fc.initCatmullRom(o.x,h.x,u.x,a.x,this.tension),kc.initCatmullRom(o.y,h.y,u.y,a.y,this.tension),Nc.initCatmullRom(o.z,h.z,u.z,a.z,this.tension));return n.set(Fc.calc(c),kc.calc(c),Nc.calc(c)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new os).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Gc(t,e,n,i,r){const s=.5*(i-e),o=.5*(r-n),a=t*t;return(2*n-2*i+s+o)*(t*a)+(-3*n+3*i-2*s-o)*a+s*t+n}function zc(t,e,n,i){return function(t,e){const n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,i)}function Hc(t,e,n,i,r){return function(t,e){const n=1-t;return n*n*n*e}(t,e)+function(t,e){const n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,i)+function(t,e){return t*t*t*e}(t,r)}class Vc extends Lc{constructor(t=new Br,e=new Br,n=new Br,i=new Br){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new Br){const n=e,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(Hc(t,i.x,r.x,s.x,o.x),Hc(t,i.y,r.y,s.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class jc extends Lc{constructor(t=new os,e=new os,n=new os,i=new os){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new os){const n=e,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(Hc(t,i.x,r.x,s.x,o.x),Hc(t,i.y,r.y,s.y,o.y),Hc(t,i.z,r.z,s.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Wc extends Lc{constructor(t=new Br,e=new Br){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Br){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Br){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class qc extends Lc{constructor(t=new os,e=new os){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new os){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new os){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Xc extends Lc{constructor(t=new Br,e=new Br,n=new Br){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Br){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(zc(t,i.x,r.x,s.x),zc(t,i.y,r.y,s.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Yc extends Lc{constructor(t=new os,e=new os,n=new os){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new os){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(zc(t,i.x,r.x,s.x),zc(t,i.y,r.y,s.y),zc(t,i.z,r.z,s.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Jc extends Lc{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Br){const n=e,i=this.points,r=(i.length-1)*t,s=Math.floor(r),o=r-s,a=i[0===s?s:s-1],l=i[s],c=i[s>i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(Gc(o,a.x,l.x,c.x,h.x),Gc(o,a.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new Br).fromArray(n))}return this}}var Kc=Object.freeze({__proto__:null,ArcCurve:Pc,CatmullRomCurve3:Qc,CubicBezierCurve:Vc,CubicBezierCurve3:jc,EllipseCurve:Dc,LineCurve:Wc,LineCurve3:qc,QuadraticBezierCurve:Xc,QuadraticBezierCurve3:Yc,SplineCurve:Jc});class Zc extends Lc{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const n=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new Kc[n](e,t))}return this}getPoint(t,e){const n=t*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const t=i[r]-n,s=this.curves[r],o=s.getLength(),a=0===o?0:1-t/o;return s.getPointAt(a,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.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 t=[];let e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const s=r[i],o=s.isEllipseCurve?2*t:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?t*s.points.length:t,a=s.getPoints(o);for(let t=0;t<a.length;t++){const i=a[t];n&&n.equals(i)||(e.push(i),n=i)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new Kc[n.type]).fromJSON(n))}return this}}class $c extends Zc{constructor(t){super(),this.type="Path",this.currentPoint=new Br,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new Wc(this.currentPoint.clone(),new Br(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){const r=new Xc(this.currentPoint.clone(),new Br(t,e),new Br(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,r,s){const o=new Vc(this.currentPoint.clone(),new Br(t,e),new Br(n,i),new Br(r,s));return this.curves.push(o),this.currentPoint.set(r,s),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new Jc(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,r,s){const o=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+o,e+a,n,i,r,s),this}absarc(t,e,n,i,r,s){return this.absellipse(t,e,n,n,i,r,s),this}ellipse(t,e,n,i,r,s,o,a){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,n,i,r,s,o,a),this}absellipse(t,e,n,i,r,s,o,a){const l=new Dc(t,e,n,i,r,s,o,a);if(this.curves.length>0){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(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class th extends sa{constructor(t=[new Br(0,-.5),new Br(.5,0),new Br(0,.5)],e=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=Cr(i,0,2*Math.PI);const r=[],s=[],o=[],a=[],l=[],c=1/e,h=new os,u=new Br,d=new os,p=new os,A=new os;let f=0,m=0;for(let e=0;e<=t.length-1;e++)switch(e){case 0:f=t[e+1].x-t[e].x,m=t[e+1].y-t[e].y,d.x=1*m,d.y=-f,d.z=0*m,A.copy(d),d.normalize(),a.push(d.x,d.y,d.z);break;case t.length-1:a.push(A.x,A.y,A.z);break;default:f=t[e+1].x-t[e].x,m=t[e+1].y-t[e].y,d.x=1*m,d.y=-f,d.z=0*m,p.copy(d),d.x+=A.x,d.y+=A.y,d.z+=A.z,d.normalize(),a.push(d.x,d.y,d.z),A.copy(p)}for(let r=0;r<=e;r++){const d=n+r*c*i,p=Math.sin(d),A=Math.cos(d);for(let n=0;n<=t.length-1;n++){h.x=t[n].x*p,h.y=t[n].y,h.z=t[n].x*A,s.push(h.x,h.y,h.z),u.x=r/e,u.y=n/(t.length-1),o.push(u.x,u.y);const i=a[3*n+0]*p,c=a[3*n+1],d=a[3*n+0]*A;l.push(i,c,d)}}for(let n=0;n<e;n++)for(let e=0;e<t.length-1;e++){const i=e+n*t.length,s=i,o=i+t.length,a=i+t.length+1,l=i+1;r.push(s,o,l),r.push(a,l,o)}this.setIndex(r),this.setAttribute("position",new Ko(s,3)),this.setAttribute("uv",new Ko(o,2)),this.setAttribute("normal",new Ko(l,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new th(t.points,t.segments,t.phiStart,t.phiLength)}}class eh extends th{constructor(t=1,e=1,n=4,i=8){const r=new $c;r.absarc(0,-e/2,t,1.5*Math.PI,0),r.absarc(0,e/2,t,0,.5*Math.PI),super(r.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:t,length:e,capSegments:n,radialSegments:i}}static fromJSON(t){return new eh(t.radius,t.length,t.capSegments,t.radialSegments)}}class nh extends sa{constructor(t=1,e=32,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},e=Math.max(3,e);const r=[],s=[],o=[],a=[],l=new os,c=new Br;s.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let r=0,h=3;r<=e;r++,h+=3){const u=n+r/e*i;l.x=t*Math.cos(u),l.y=t*Math.sin(u),s.push(l.x,l.y,l.z),o.push(0,0,1),c.x=(s[h]/t+1)/2,c.y=(s[h+1]/t+1)/2,a.push(c.x,c.y)}for(let t=1;t<=e;t++)r.push(t,t+1,0);this.setIndex(r),this.setAttribute("position",new Ko(s,3)),this.setAttribute("normal",new Ko(o,3)),this.setAttribute("uv",new Ko(a,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new nh(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class ih extends sa{constructor(t=1,e=1,n=1,i=32,r=1,s=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a};const l=this;i=Math.floor(i),r=Math.floor(r);const c=[],h=[],u=[],d=[];let p=0;const A=[],f=n/2;let m=0;function g(n){const r=p,s=new Br,A=new os;let g=0;const v=!0===n?t:e,y=!0===n?1:-1;for(let t=1;t<=i;t++)h.push(0,f*y,0),u.push(0,y,0),d.push(.5,.5),p++;const E=p;for(let t=0;t<=i;t++){const e=t/i*a+o,n=Math.cos(e),r=Math.sin(e);A.x=v*r,A.y=f*y,A.z=v*n,h.push(A.x,A.y,A.z),u.push(0,y,0),s.x=.5*n+.5,s.y=.5*r*y+.5,d.push(s.x,s.y),p++}for(let t=0;t<i;t++){const e=r+t,i=E+t;!0===n?c.push(i,i+1,e):c.push(i+1,i,e),g+=3}l.addGroup(m,g,!0===n?1:2),m+=g}!function(){const s=new os,g=new os;let v=0;const y=(e-t)/n;for(let l=0;l<=r;l++){const c=[],m=l/r,v=m*(e-t)+t;for(let t=0;t<=i;t++){const e=t/i,r=e*a+o,l=Math.sin(r),A=Math.cos(r);g.x=v*l,g.y=-m*n+f,g.z=v*A,h.push(g.x,g.y,g.z),s.set(l,y,A).normalize(),u.push(s.x,s.y,s.z),d.push(e,1-m),c.push(p++)}A.push(c)}for(let n=0;n<i;n++)for(let i=0;i<r;i++){const s=A[i][n],o=A[i+1][n],a=A[i+1][n+1],l=A[i][n+1];(t>0||0!==i)&&(c.push(s,o,l),v+=3),(e>0||i!==r-1)&&(c.push(o,a,l),v+=3)}l.addGroup(m,v,0),m+=v}(),!1===s&&(t>0&&g(!0),e>0&&g(!1)),this.setIndex(c),this.setAttribute("position",new Ko(h,3)),this.setAttribute("normal",new Ko(u,3)),this.setAttribute("uv",new Ko(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ih(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class rh extends ih{constructor(t=1,e=1,n=32,i=1,r=!1,s=0,o=2*Math.PI){super(0,t,e,n,i,r,s,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:o}}static fromJSON(t){return new rh(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class sh extends sa{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],s=[];function o(t,e,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const o=t.clone().lerp(n,i/r),a=e.clone().lerp(n,i/r),l=r-i;for(let t=0;t<=l;t++)s[i][t]=0===t&&i===r?o:o.clone().lerp(a,t/l)}for(let t=0;t<r;t++)for(let e=0;e<2*(r-t)-1;e++){const n=Math.floor(e/2);e%2==0?(a(s[t][n+1]),a(s[t+1][n]),a(s[t][n])):(a(s[t][n+1]),a(s[t+1][n+1]),a(s[t+1][n]))}}function a(t){r.push(t.x,t.y,t.z)}function l(e,n){const i=3*e;n.x=t[i+0],n.y=t[i+1],n.z=t[i+2]}function c(t,e,n,i){i<0&&1===t.x&&(s[e]=t.x-1),0===n.x&&0===n.z&&(s[e]=i/2/Math.PI+.5)}function h(t){return Math.atan2(t.z,-t.x)}!function(t){const n=new os,i=new os,r=new os;for(let s=0;s<e.length;s+=3)l(e[s+0],n),l(e[s+1],i),l(e[s+2],r),o(n,i,r,t)}(i),function(t){const e=new os;for(let n=0;n<r.length;n+=3)e.x=r[n+0],e.y=r[n+1],e.z=r[n+2],e.normalize().multiplyScalar(t),r[n+0]=e.x,r[n+1]=e.y,r[n+2]=e.z}(n),function(){const t=new os;for(let n=0;n<r.length;n+=3){t.x=r[n+0],t.y=r[n+1],t.z=r[n+2];const i=h(t)/2/Math.PI+.5,o=(e=t,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5);s.push(i,1-o)}var e;(function(){const t=new os,e=new os,n=new os,i=new os,o=new Br,a=new Br,l=new Br;for(let u=0,d=0;u<r.length;u+=9,d+=6){t.set(r[u+0],r[u+1],r[u+2]),e.set(r[u+3],r[u+4],r[u+5]),n.set(r[u+6],r[u+7],r[u+8]),o.set(s[d+0],s[d+1]),a.set(s[d+2],s[d+3]),l.set(s[d+4],s[d+5]),i.copy(t).add(e).add(n).divideScalar(3);const p=h(i);c(o,d+0,t,p),c(a,d+2,e,p),c(l,d+4,n,p)}})(),function(){for(let t=0;t<s.length;t+=6){const e=s[t+0],n=s[t+2],i=s[t+4],r=Math.max(e,n,i),o=Math.min(e,n,i);r>.9&&o<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),i<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Ko(r,3)),this.setAttribute("normal",new Ko(r.slice(),3)),this.setAttribute("uv",new Ko(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new sh(t.vertices,t.indices,t.radius,t.details)}}class oh extends sh{constructor(t=1,e=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],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new oh(t.radius,t.detail)}}const ah=new os,lh=new os,ch=new os,hh=new wo;class uh extends sa{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const n=4,i=Math.pow(10,n),r=Math.cos(Er*e),s=t.getIndex(),o=t.getAttribute("position"),a=s?s.count:o.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),u={},d=[];for(let t=0;t<a;t+=3){s?(l[0]=s.getX(t),l[1]=s.getX(t+1),l[2]=s.getX(t+2)):(l[0]=t,l[1]=t+1,l[2]=t+2);const{a:e,b:n,c:a}=hh;if(e.fromBufferAttribute(o,l[0]),n.fromBufferAttribute(o,l[1]),a.fromBufferAttribute(o,l[2]),hh.getNormal(ch),h[0]=`${Math.round(e.x*i)},${Math.round(e.y*i)},${Math.round(e.z*i)}`,h[1]=`${Math.round(n.x*i)},${Math.round(n.y*i)},${Math.round(n.z*i)}`,h[2]=`${Math.round(a.x*i)},${Math.round(a.y*i)},${Math.round(a.z*i)}`,h[0]!==h[1]&&h[1]!==h[2]&&h[2]!==h[0])for(let t=0;t<3;t++){const e=(t+1)%3,n=h[t],i=h[e],s=hh[c[t]],o=hh[c[e]],a=`${n}_${i}`,p=`${i}_${n}`;p in u&&u[p]?(ch.dot(u[p].normal)<=r&&(d.push(s.x,s.y,s.z),d.push(o.x,o.y,o.z)),u[p]=null):a in u||(u[a]={index0:l[t],index1:l[e],normal:ch.clone()})}}for(const t in u)if(u[t]){const{index0:e,index1:n}=u[t];ah.fromBufferAttribute(o,e),lh.fromBufferAttribute(o,n),d.push(ah.x,ah.y,ah.z),d.push(lh.x,lh.y,lh.z)}this.setAttribute("position",new Ko(d,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}class dh extends $c{constructor(t){super(t),this.uuid=br(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new $c).fromJSON(n))}return this}}function ph(t,e,n,i,r){let s,o;if(r===function(t,e,n,i){let r=0;for(let s=e,o=n-i;s<n;s+=i)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}(t,e,n,i)>0)for(s=e;s<n;s+=i)o=Ph(s,t[s],t[s+1],o);else for(s=n-i;s>=e;s-=i)o=Ph(s,t[s],t[s+1],o);return o&&Ih(o,o.next)&&(Uh(o),o=o.next),o}function Ah(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!Ih(i,i.next)&&0!==Sh(i.prev,i,i.next))i=i.next;else{if(Uh(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function fh(t,e,n,i,r,s,o){if(!t)return;!o&&s&&function(t,e,n,i){let r=t;do{0===r.z&&(r.z=Ch(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,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,i=n,a=0,e=0;e<c&&(a++,i=i.nextZ,i);e++);for(l=c;a>0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(o>1)}(r)}(t,i,r,s);let a,l,c=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,s?gh(t,i,r,s):mh(t))e.push(a.i/n|0),e.push(t.i/n|0),e.push(l.i/n|0),Uh(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?fh(t=vh(Ah(t),e,n),e,n,i,r,s,2):2===o&&yh(t,e,n,i,r,s):fh(Ah(t),e,n,i,r,s,1);break}}function mh(t){const e=t.prev,n=t,i=t.next;if(Sh(e,n,i)>=0)return!1;const r=e.x,s=n.x,o=i.x,a=e.y,l=n.y,c=i.y,h=r<s?r<o?r:o:s<o?s:o,u=a<l?a<c?a:c:l<c?l:c,d=r>s?r>o?r:o:s>o?s:o,p=a>l?a>c?a:c:l>c?l:c;let A=i.next;for(;A!==e;){if(A.x>=h&&A.x<=d&&A.y>=u&&A.y<=p&&_h(r,a,s,l,o,c,A.x,A.y)&&Sh(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function gh(t,e,n,i){const r=t.prev,s=t,o=t.next;if(Sh(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,h=r.y,u=s.y,d=o.y,p=a<l?a<c?a:c:l<c?l:c,A=h<u?h<d?h:d:u<d?u:d,f=a>l?a>c?a:c:l>c?l:c,m=h>u?h>d?h:d:u>d?u:d,g=Ch(p,A,e,n,i),v=Ch(f,m,e,n,i);let y=t.prevZ,E=t.nextZ;for(;y&&y.z>=g&&E&&E.z<=v;){if(y.x>=p&&y.x<=f&&y.y>=A&&y.y<=m&&y!==r&&y!==o&&_h(a,h,l,u,c,d,y.x,y.y)&&Sh(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,E.x>=p&&E.x<=f&&E.y>=A&&E.y<=m&&E!==r&&E!==o&&_h(a,h,l,u,c,d,E.x,E.y)&&Sh(E.prev,E,E.next)>=0)return!1;E=E.nextZ}for(;y&&y.z>=g;){if(y.x>=p&&y.x<=f&&y.y>=A&&y.y<=m&&y!==r&&y!==o&&_h(a,h,l,u,c,d,y.x,y.y)&&Sh(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;E&&E.z<=v;){if(E.x>=p&&E.x<=f&&E.y>=A&&E.y<=m&&E!==r&&E!==o&&_h(a,h,l,u,c,d,E.x,E.y)&&Sh(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function vh(t,e,n){let i=t;do{const r=i.prev,s=i.next.next;!Ih(r,s)&&Bh(r,i,i.next,s)&&Lh(r,s)&&Lh(s,r)&&(e.push(r.i/n|0),e.push(i.i/n|0),e.push(s.i/n|0),Uh(i),Uh(i.next),i=t=s),i=i.next}while(i!==t);return Ah(i)}function yh(t,e,n,i,r,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&Mh(o,t)){let a=Dh(o,t);return o=Ah(o,o.next),a=Ah(a,a.next),fh(o,e,n,i,r,s,0),void fh(a,e,n,i,r,s,0)}t=t.next}o=o.next}while(o!==t)}function Eh(t,e){return t.x-e.x}function xh(t,e){const n=function(t,e){let n,i=e,r=-1/0;const s=t.x,o=t.y;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){const t=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=s&&t>r&&(r=t,n=i.x<i.next.x?i:i.next,t===s))return n}i=i.next}while(i!==e);if(!n)return null;const a=n,l=n.x,c=n.y;let h,u=1/0;i=n;do{s>=i.x&&i.x>=l&&s!==i.x&&_h(o<c?s:r,o,l,c,o<c?r:s,o,i.x,i.y)&&(h=Math.abs(o-i.y)/(s-i.x),Lh(i,t)&&(h<u||h===u&&(i.x>n.x||i.x===n.x&&bh(n,i)))&&(n=i,u=h)),i=i.next}while(i!==a);return n}(t,e);if(!n)return e;const i=Dh(n,t);return Ah(i,i.next),Ah(n,n.next)}function bh(t,e){return Sh(t.prev,t,e.prev)<0&&Sh(e.next,t,t.next)<0}function Ch(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function wh(t){let 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 _h(t,e,n,i,r,s,o,a){return(r-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(i-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(r-o)*(i-a)}function Mh(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&&Bh(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Lh(t,e)&&Lh(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,s=(t.y+e.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!==t);return i}(t,e)&&(Sh(t.prev,t,e.prev)||Sh(t,e.prev,e))||Ih(t,e)&&Sh(t.prev,t,t.next)>0&&Sh(e.prev,e,e.next)>0)}function Sh(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Ih(t,e){return t.x===e.x&&t.y===e.y}function Bh(t,e,n,i){const r=Rh(Sh(t,e,n)),s=Rh(Sh(t,e,i)),o=Rh(Sh(n,i,t)),a=Rh(Sh(n,i,e));return r!==s&&o!==a||!(0!==r||!Th(t,n,e))||!(0!==s||!Th(t,i,e))||!(0!==o||!Th(n,t,i))||!(0!==a||!Th(n,e,i))}function Th(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 Rh(t){return t>0?1:t<0?-1:0}function Lh(t,e){return Sh(t.prev,t,t.next)<0?Sh(t,e,t.next)>=0&&Sh(t,t.prev,e)>=0:Sh(t,e,t.prev)<0||Sh(t,t.next,e)<0}function Dh(t,e){const n=new Oh(t.i,t.x,t.y),i=new Oh(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function Ph(t,e,n,i){const r=new Oh(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 Uh(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 Oh(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}class Fh{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n}static isClockWise(t){return Fh.area(t)<0}static triangulateShape(t,e){const n=[],i=[],r=[];kh(t),Nh(n,t);let s=t.length;e.forEach(kh);for(let t=0;t<e.length;t++)i.push(s),s+=e[t].length,Nh(n,e[t]);const o=function(t,e,n=2){const i=e&&e.length,r=i?e[0]*n:t.length;let s=ph(t,0,r,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,h,u,d,p;if(i&&(s=function(t,e,n,i){const r=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:t.length,c=ph(t,a,l,i,!1),c===c.next&&(c.steiner=!0),r.push(wh(c));for(r.sort(Eh),s=0;s<r.length;s++)n=xh(r[s],n);return n}(t,e,s,n)),t.length>80*n){a=c=t[0],l=h=t[1];for(let e=n;e<r;e+=n)u=t[e],d=t[e+1],u<a&&(a=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=0!==p?32767/p:0}return fh(s,o,n,a,l,p,0),o}(n,i);for(let t=0;t<o.length;t+=3)r.push(o.slice(t,t+3));return r}}function kh(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Nh(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class Qh extends sa{constructor(t=new dh([new Br(.5,.5),new Br(-.5,.5),new Br(-.5,-.5),new Br(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,i=[],r=[];for(let e=0,n=t.length;e<n;e++)s(t[e]);function s(t){const s=[],o=void 0!==e.curveSegments?e.curveSegments:12,a=void 0!==e.steps?e.steps:1,l=void 0!==e.depth?e.depth:1;let c=void 0===e.bevelEnabled||e.bevelEnabled,h=void 0!==e.bevelThickness?e.bevelThickness:.2,u=void 0!==e.bevelSize?e.bevelSize:h-.1,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const A=e.extrudePath,f=void 0!==e.UVGenerator?e.UVGenerator:Gh;let m,g,v,y,E,x=!1;A&&(m=A.getSpacedPoints(a),x=!0,c=!1,g=A.computeFrenetFrames(a,!1),v=new os,y=new os,E=new os),c||(p=0,h=0,u=0,d=0);const b=t.extractPoints(o);let C=b.shape;const w=b.holes;if(!Fh.isClockWise(C)){C=C.reverse();for(let t=0,e=w.length;t<e;t++){const e=w[t];Fh.isClockWise(e)&&(w[t]=e.reverse())}}const _=Fh.triangulateShape(C,w),M=C;for(let t=0,e=w.length;t<e;t++){const e=w[t];C=C.concat(e)}function S(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().addScaledVector(e,n)}const I=C.length,B=_.length;function T(t,e,n){let i,r,s;const o=t.x-e.x,a=t.y-e.y,l=n.x-t.x,c=n.y-t.y,h=o*o+a*a,u=o*c-a*l;if(Math.abs(u)>Number.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-a/u,A=e.y+o/u,f=((n.x-c/d-p)*c-(n.y+l/d-A)*l)/(o*c-a*l);i=p+o*f-t.x,r=A+a*f-t.y;const m=i*i+r*r;if(m<=2)return new Br(i,r);s=Math.sqrt(m/2)}else{let t=!1;o>Number.EPSILON?l>Number.EPSILON&&(t=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(c)&&(t=!0),t?(i=-a,r=o,s=Math.sqrt(h)):(i=o,r=a,s=Math.sqrt(h/2))}return new Br(i/s,r/s)}const R=[];for(let t=0,e=M.length,n=e-1,i=t+1;t<e;t++,n++,i++)n===e&&(n=0),i===e&&(i=0),R[t]=T(M[t],M[n],M[i]);const L=[];let D,P=R.concat();for(let t=0,e=w.length;t<e;t++){const e=w[t];D=[];for(let t=0,n=e.length,i=n-1,r=t+1;t<n;t++,i++,r++)i===n&&(i=0),r===n&&(r=0),D[t]=T(e[t],e[i],e[r]);L.push(D),P=P.concat(D)}for(let t=0;t<p;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=M.length;t<e;t++){const e=S(M[t],R[t],i);F(e.x,e.y,-n)}for(let t=0,e=w.length;t<e;t++){const e=w[t];D=L[t];for(let t=0,r=e.length;t<r;t++){const r=S(e[t],D[t],i);F(r.x,r.y,-n)}}}const U=u+d;for(let t=0;t<I;t++){const e=c?S(C[t],P[t],U):C[t];x?(y.copy(g.normals[0]).multiplyScalar(e.x),v.copy(g.binormals[0]).multiplyScalar(e.y),E.copy(m[0]).add(y).add(v),F(E.x,E.y,E.z)):F(e.x,e.y,0)}for(let t=1;t<=a;t++)for(let e=0;e<I;e++){const n=c?S(C[e],P[e],U):C[e];x?(y.copy(g.normals[t]).multiplyScalar(n.x),v.copy(g.binormals[t]).multiplyScalar(n.y),E.copy(m[t]).add(y).add(v),F(E.x,E.y,E.z)):F(n.x,n.y,l/a*t)}for(let t=p-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=M.length;t<e;t++){const e=S(M[t],R[t],i);F(e.x,e.y,l+n)}for(let t=0,e=w.length;t<e;t++){const e=w[t];D=L[t];for(let t=0,r=e.length;t<r;t++){const r=S(e[t],D[t],i);x?F(r.x,r.y+m[a-1].y,m[a-1].x+n):F(r.x,r.y,l+n)}}}function O(t,e){let n=t.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=a+2*p;t<n;t++){const n=I*t,s=I*(t+1);N(e+i+n,e+r+n,e+r+s,e+i+s)}}}function F(t,e,n){s.push(t),s.push(e),s.push(n)}function k(t,e,r){Q(t),Q(e),Q(r);const s=i.length/3,o=f.generateTopUV(n,i,s-3,s-2,s-1);G(o[0]),G(o[1]),G(o[2])}function N(t,e,r,s){Q(t),Q(e),Q(s),Q(e),Q(r),Q(s);const o=i.length/3,a=f.generateSideWallUV(n,i,o-6,o-3,o-2,o-1);G(a[0]),G(a[1]),G(a[3]),G(a[1]),G(a[2]),G(a[3])}function Q(t){i.push(s[3*t+0]),i.push(s[3*t+1]),i.push(s[3*t+2])}function G(t){r.push(t.x),r.push(t.y)}!function(){const t=i.length/3;if(c){let t=0,e=I*t;for(let t=0;t<B;t++){const n=_[t];k(n[2]+e,n[1]+e,n[0]+e)}t=a+2*p,e=I*t;for(let t=0;t<B;t++){const n=_[t];k(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<B;t++){const e=_[t];k(e[2],e[1],e[0])}for(let t=0;t<B;t++){const e=_[t];k(e[0]+I*a,e[1]+I*a,e[2]+I*a)}}n.addGroup(t,i.length/3-t,0)}(),function(){const t=i.length/3;let e=0;O(M,e),e+=M.length;for(let t=0,n=w.length;t<n;t++){const n=w[t];O(n,e),e+=n.length}n.addGroup(t,i.length/3-t,1)}()}this.setAttribute("position",new Ko(i,3)),this.setAttribute("uv",new Ko(r,2)),this.computeVertexNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,i=t.length;e<i;e++){const i=t[e];n.shapes.push(i.uuid)}else n.shapes.push(t.uuid);return n.options=Object.assign({},e),void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}const i=t.options.extrudePath;return void 0!==i&&(t.options.extrudePath=(new Kc[i.type]).fromJSON(i)),new Qh(n,t.options)}}const Gh={generateTopUV:function(t,e,n,i,r){const s=e[3*n],o=e[3*n+1],a=e[3*i],l=e[3*i+1],c=e[3*r],h=e[3*r+1];return[new Br(s,o),new Br(a,l),new Br(c,h)]},generateSideWallUV:function(t,e,n,i,r,s){const o=e[3*n],a=e[3*n+1],l=e[3*n+2],c=e[3*i],h=e[3*i+1],u=e[3*i+2],d=e[3*r],p=e[3*r+1],A=e[3*r+2],f=e[3*s],m=e[3*s+1],g=e[3*s+2];return Math.abs(a-h)<Math.abs(o-c)?[new Br(o,1-l),new Br(c,1-u),new Br(d,1-A),new Br(f,1-g)]:[new Br(a,1-l),new Br(h,1-u),new Br(p,1-A),new Br(m,1-g)]}};class zh extends sh{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new zh(t.radius,t.detail)}}class Hh extends sh{constructor(t=1,e=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Hh(t.radius,t.detail)}}class Vh extends sa{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const r=t/2,s=e/2,o=Math.floor(n),a=Math.floor(i),l=o+1,c=a+1,h=t/o,u=e/a,d=[],p=[],A=[],f=[];for(let t=0;t<c;t++){const e=t*u-s;for(let n=0;n<l;n++){const i=n*h-r;p.push(i,-e,0),A.push(0,0,1),f.push(n/o),f.push(1-t/a)}}for(let t=0;t<a;t++)for(let e=0;e<o;e++){const n=e+l*t,i=e+l*(t+1),r=e+1+l*(t+1),s=e+1+l*t;d.push(n,i,s),d.push(i,r,s)}this.setIndex(d),this.setAttribute("position",new Ko(p,3)),this.setAttribute("normal",new Ko(A,3)),this.setAttribute("uv",new Ko(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Vh(t.width,t.height,t.widthSegments,t.heightSegments)}}class jh extends sa{constructor(t=.5,e=1,n=32,i=1,r=0,s=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:s},n=Math.max(3,n);const o=[],a=[],l=[],c=[];let h=t;const u=(e-t)/(i=Math.max(1,i)),d=new os,p=new Br;for(let t=0;t<=i;t++){for(let t=0;t<=n;t++){const i=r+t/n*s;d.x=h*Math.cos(i),d.y=h*Math.sin(i),a.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/e+1)/2,p.y=(d.y/e+1)/2,c.push(p.x,p.y)}h+=u}for(let t=0;t<i;t++){const e=t*(n+1);for(let t=0;t<n;t++){const i=t+e,r=i,s=i+n+1,a=i+n+2,l=i+1;o.push(r,s,l),o.push(s,a,l)}}this.setIndex(o),this.setAttribute("position",new Ko(a,3)),this.setAttribute("normal",new Ko(l,3)),this.setAttribute("uv",new Ko(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new jh(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class Wh extends sa{constructor(t=new dh([new Br(0,.5),new Br(-.5,-.5),new Br(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],i=[],r=[],s=[];let o=0,a=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(o,a,e),o+=a,a=0;function l(t){const o=i.length/3,l=t.extractPoints(e);let c=l.shape;const h=l.holes;!1===Fh.isClockWise(c)&&(c=c.reverse());for(let t=0,e=h.length;t<e;t++){const e=h[t];!0===Fh.isClockWise(e)&&(h[t]=e.reverse())}const u=Fh.triangulateShape(c,h);for(let t=0,e=h.length;t<e;t++){const e=h[t];c=c.concat(e)}for(let t=0,e=c.length;t<e;t++){const e=c[t];i.push(e.x,e.y,0),r.push(0,0,1),s.push(e.x,e.y)}for(let t=0,e=u.length;t<e;t++){const e=u[t],i=e[0]+o,r=e[1]+o,s=e[2]+o;n.push(i,r,s),a+=3}}this.setIndex(n),this.setAttribute("position",new Ko(i,3)),this.setAttribute("normal",new Ko(r,3)),this.setAttribute("uv",new Ko(s,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,i=t.length;n<i;n++){const i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}return new Wh(n,t.curveSegments)}}class qh extends sa{constructor(t=1,e=32,n=16,i=0,r=2*Math.PI,s=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:s,thetaLength:o},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const a=Math.min(s+o,Math.PI);let l=0;const c=[],h=new os,u=new os,d=[],p=[],A=[],f=[];for(let d=0;d<=n;d++){const m=[],g=d/n;let v=0;0===d&&0===s?v=.5/e:d===n&&a===Math.PI&&(v=-.5/e);for(let n=0;n<=e;n++){const a=n/e;h.x=-t*Math.cos(i+a*r)*Math.sin(s+g*o),h.y=t*Math.cos(s+g*o),h.z=t*Math.sin(i+a*r)*Math.sin(s+g*o),p.push(h.x,h.y,h.z),u.copy(h).normalize(),A.push(u.x,u.y,u.z),f.push(a+v,1-g),m.push(l++)}c.push(m)}for(let t=0;t<n;t++)for(let i=0;i<e;i++){const e=c[t][i+1],r=c[t][i],o=c[t+1][i],l=c[t+1][i+1];(0!==t||s>0)&&d.push(e,r,l),(t!==n-1||a<Math.PI)&&d.push(r,o,l)}this.setIndex(d),this.setAttribute("position",new Ko(p,3)),this.setAttribute("normal",new Ko(A,3)),this.setAttribute("uv",new Ko(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new qh(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Xh extends sh{constructor(t=1,e=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Xh(t.radius,t.detail)}}class Yh extends sa{constructor(t=1,e=.4,n=12,i=48,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const s=[],o=[],a=[],l=[],c=new os,h=new os,u=new os;for(let s=0;s<=n;s++)for(let d=0;d<=i;d++){const p=d/i*r,A=s/n*Math.PI*2;h.x=(t+e*Math.cos(A))*Math.cos(p),h.y=(t+e*Math.cos(A))*Math.sin(p),h.z=e*Math.sin(A),o.push(h.x,h.y,h.z),c.x=t*Math.cos(p),c.y=t*Math.sin(p),u.subVectors(h,c).normalize(),a.push(u.x,u.y,u.z),l.push(d/i),l.push(s/n)}for(let t=1;t<=n;t++)for(let e=1;e<=i;e++){const n=(i+1)*t+e-1,r=(i+1)*(t-1)+e-1,o=(i+1)*(t-1)+e,a=(i+1)*t+e;s.push(n,r,a),s.push(r,o,a)}this.setIndex(s),this.setAttribute("position",new Ko(o,3)),this.setAttribute("normal",new Ko(a,3)),this.setAttribute("uv",new Ko(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Yh(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class Jh extends sa{constructor(t=1,e=.4,n=64,i=8,r=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:s},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],l=[],c=[],h=new os,u=new os,d=new os,p=new os,A=new os,f=new os,m=new os;for(let o=0;o<=n;++o){const v=o/n*r*Math.PI*2;g(v,r,s,t,d),g(v+.01,r,s,t,p),f.subVectors(p,d),m.addVectors(p,d),A.crossVectors(f,m),m.crossVectors(A,f),A.normalize(),m.normalize();for(let t=0;t<=i;++t){const r=t/i*Math.PI*2,s=-e*Math.cos(r),p=e*Math.sin(r);h.x=d.x+(s*m.x+p*A.x),h.y=d.y+(s*m.y+p*A.y),h.z=d.z+(s*m.z+p*A.z),a.push(h.x,h.y,h.z),u.subVectors(h,d).normalize(),l.push(u.x,u.y,u.z),c.push(o/n),c.push(t/i)}}for(let t=1;t<=n;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),s=(i+1)*t+e,a=(i+1)*(t-1)+e;o.push(n,r,a),o.push(r,s,a)}function g(t,e,n,i,r){const s=Math.cos(t),o=Math.sin(t),a=n/e*t,l=Math.cos(a);r.x=i*(2+l)*.5*s,r.y=i*(2+l)*o*.5,r.z=i*Math.sin(a)*.5}this.setIndex(o),this.setAttribute("position",new Ko(a,3)),this.setAttribute("normal",new Ko(l,3)),this.setAttribute("uv",new Ko(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Jh(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class Kh extends sa{constructor(t=new Yc(new os(-1,-1,0),new os(-1,1,0),new os(1,1,0)),e=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r};const s=t.computeFrenetFrames(e,r);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;const o=new os,a=new os,l=new Br;let c=new os;const h=[],u=[],d=[],p=[];function A(r){c=t.getPointAt(r/e,c);const l=s.normals[r],d=s.binormals[r];for(let t=0;t<=i;t++){const e=t/i*Math.PI*2,r=Math.sin(e),s=-Math.cos(e);a.x=s*l.x+r*d.x,a.y=s*l.y+r*d.y,a.z=s*l.z+r*d.z,a.normalize(),u.push(a.x,a.y,a.z),o.x=c.x+n*a.x,o.y=c.y+n*a.y,o.z=c.z+n*a.z,h.push(o.x,o.y,o.z)}}!function(){for(let t=0;t<e;t++)A(t);A(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let n=0;n<=i;n++)l.x=t/e,l.y=n/i,d.push(l.x,l.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),s=(i+1)*t+e,o=(i+1)*(t-1)+e;p.push(n,r,o),p.push(r,s,o)}}()}(),this.setIndex(p),this.setAttribute("position",new Ko(h,3)),this.setAttribute("normal",new Ko(u,3)),this.setAttribute("uv",new Ko(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Kh((new Kc[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class Zh extends sa{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},null!==t){const e=[],n=new Set,i=new os,r=new os;if(null!==t.index){const s=t.attributes.position,o=t.index;let a=t.groups;0===a.length&&(a=[{start:0,count:o.count,materialIndex:0}]);for(let t=0,l=a.length;t<l;++t){const l=a[t],c=l.start;for(let t=c,a=c+l.count;t<a;t+=3)for(let a=0;a<3;a++){const l=o.getX(t+a),c=o.getX(t+(a+1)%3);i.fromBufferAttribute(s,l),r.fromBufferAttribute(s,c),!0===$h(i,r,n)&&(e.push(i.x,i.y,i.z),e.push(r.x,r.y,r.z))}}}else{const s=t.attributes.position;for(let t=0,o=s.count/3;t<o;t++)for(let o=0;o<3;o++){const a=3*t+o,l=3*t+(o+1)%3;i.fromBufferAttribute(s,a),r.fromBufferAttribute(s,l),!0===$h(i,r,n)&&(e.push(i.x,i.y,i.z),e.push(r.x,r.y,r.z))}}this.setAttribute("position",new Ko(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}function $h(t,e,n){const i=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return!0!==n.has(i)&&!0!==n.has(r)&&(n.add(i),n.add(r),!0)}var tu=Object.freeze({__proto__:null,BoxGeometry:ya,CapsuleGeometry:eh,CircleGeometry:nh,ConeGeometry:rh,CylinderGeometry:ih,DodecahedronGeometry:oh,EdgesGeometry:uh,ExtrudeGeometry:Qh,IcosahedronGeometry:zh,LatheGeometry:th,OctahedronGeometry:Hh,PlaneGeometry:Vh,PolyhedronGeometry:sh,RingGeometry:jh,ShapeGeometry:Wh,SphereGeometry:qh,TetrahedronGeometry:Xh,TorusGeometry:Yh,TorusKnotGeometry:Jh,TubeGeometry:Kh,WireframeGeometry:Zh});class eu extends Lo{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Bo(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}}class nu extends wa{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class iu extends Lo{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Bo(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Bo(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ws,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ru extends iu{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Br(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Cr(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Bo(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Bo(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Bo(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class su extends Lo{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Bo(16777215),this.specular=new Bo(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Bo(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ws,this.combine=Me,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),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.flatShading=t.flatShading,this.fog=t.fog,this}}class ou extends Lo{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Bo(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Bo(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class au extends Lo{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class lu extends Lo{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Bo(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Bo(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ws,this.combine=Me,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(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.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),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.flatShading=t.flatShading,this.fog=t.fog,this}}class cu extends Lo{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=bi,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,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}}class hu extends Lo{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class uu extends Lo{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Bo(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class du extends ic{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function pu(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)}function Au(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function fu(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n}function mu(t,e,n){const i=t.length,r=new t.constructor(i);for(let s=0,o=0;o!==i;++s){const i=n[s]*e;for(let n=0;n!==e;++n)r[o++]=t[i+n]}return r}function gu(t,e,n,i){let r=1,s=t[0];for(;void 0!==s&&void 0===s[i];)s=t[r++];if(void 0===s)return;let o=s[i];if(void 0!==o)if(Array.isArray(o))do{o=s[i],void 0!==o&&(e.push(s.time),n.push.apply(n,o)),s=t[r++]}while(void 0!==s);else if(void 0!==o.toArray)do{o=s[i],void 0!==o&&(e.push(s.time),o.toArray(n,n.length)),s=t[r++]}while(void 0!==s);else do{o=s[i],void 0!==o&&(e.push(s.time),n.push(o)),s=t[r++]}while(void 0!==s)}const vu={convertArray:pu,isTypedArray:Au,getKeyframeOrder:fu,sortedArray:mu,flattenJSON:gu,subclip:function(t,e,n,i,r=30){const s=t.clone();s.name=e;const o=[];for(let t=0;t<s.tracks.length;++t){const e=s.tracks[t],a=e.getValueSize(),l=[],c=[];for(let t=0;t<e.times.length;++t){const s=e.times[t]*r;if(!(s<n||s>=i)){l.push(e.times[t]);for(let n=0;n<a;++n)c.push(e.values[t*a+n])}}0!==l.length&&(e.times=pu(l,e.times.constructor),e.values=pu(c,e.values.constructor),o.push(e))}s.tracks=o;let a=1/0;for(let t=0;t<s.tracks.length;++t)a>s.tracks[t].times[0]&&(a=s.tracks[t].times[0]);for(let t=0;t<s.tracks.length;++t)s.tracks[t].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(t,e=0,n=t,i=30){i<=0&&(i=30);const r=n.tracks.length,s=e/i;for(let e=0;e<r;++e){const i=n.tracks[e],r=i.ValueTypeName;if("bool"===r||"string"===r)continue;const o=t.tracks.find((function(t){return t.name===i.name&&t.ValueTypeName===r}));if(void 0===o)continue;let a=0;const l=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let c=0;const h=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=h/3);const u=i.times.length-1;let d;if(s<=i.times[0]){const t=a,e=l-a;d=i.values.slice(t,e)}else if(s>=i.times[u]){const t=u*l+a,e=t+l-a;d=i.values.slice(t,e)}else{const t=i.createInterpolant(),e=a,n=l-a;t.evaluate(s),d=t.resultBuffer.slice(e,n)}"quaternion"===r&&(new ss).fromArray(d).normalize().conjugate().toArray(d);const p=o.times.length;for(let t=0;t<p;++t){const e=t*h+c;if("quaternion"===r)ss.multiplyQuaternionsFlat(o.values,e,d,0,o.values,e);else{const t=h-2*c;for(let n=0;n<t;++n)o.values[e+n]-=d[n]}}}return t.blendMode=vi,t}};class yu{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let s;n:{i:if(!(t<i)){for(let s=n+2;;){if(void 0===i){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===s)break;if(r=i,i=e[++n],t<i)break e}s=e.length;break n}if(t>=r)break t;{const o=e[1];t<o&&(n=2,r=o);for(let s=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===s)break;if(i=r,r=e[--n-1],t>=r)break e}s=n,n=0}}for(;n<s;){const i=n+s>>>1;t<e[i]?s=i:n=i+1}if(i=e[n],r=e[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let t=0;t!==i;++t)e[t]=n[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Eu extends yu{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ai,endingEnd:Ai}}intervalChanged_(t,e,n){const i=this.parameterPositions;let r=t-2,s=t+1,o=i[r],a=i[s];if(void 0===o)switch(this.getSettings_().endingStart){case fi:r=t,o=2*e-n;break;case mi:r=i.length-2,o=e+i[r]-i[r+1];break;default:r=t,o=n}if(void 0===a)switch(this.getSettings_().endingEnd){case fi:s=t,a=2*n-e;break;case mi:s=1,a=n+i[1]-i[0];break;default:s=t-1,a=e}const l=.5*(n-e),c=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(a-n),this._offsetPrev=r*c,this._offsetNext=s*c}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),A=p*p,f=A*p,m=-u*f+2*u*A-u*p,g=(1+u)*f+(-1.5-2*u)*A+(-.5+u)*p+1,v=(-1-d)*f+(1.5+d)*A+.5*p,y=d*f-d*A;for(let t=0;t!==o;++t)r[t]=m*s[c+t]+g*s[l+t]+v*s[a+t]+y*s[h+t];return r}}class xu extends yu{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,c=(n-e)/(i-e),h=1-c;for(let t=0;t!==o;++t)r[t]=s[l+t]*h+s[a+t]*c;return r}}class bu extends yu{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class Cu{constructor(t,e,n,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=pu(e,this.TimeBufferType),this.values=pu(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:pu(t.times,Array),values:pu(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new bu(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new xu(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Eu(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case ui:e=this.InterpolantFactoryMethodDiscrete;break;case di:e=this.InterpolantFactoryMethodLinear;break;case pi:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ui;case this.InterpolantFactoryMethodLinear:return di;case this.InterpolantFactoryMethodSmooth:return pi}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){const n=this.times,i=n.length;let r=0,s=i-1;for(;r!==i&&n[r]<t;)++r;for(;-1!==s&&n[s]>e;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(r*t,s*t)}return this}validate(){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 s=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!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,s),t=!1;break}s=i}if(void 0!==i&&Au(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(){const t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===pi,r=t.length-1;let s=1;for(let o=1;o<r;++o){let r=!1;const a=t[o];if(a!==t[o+1]&&(1!==o||a!==t[0]))if(i)r=!0;else{const t=o*n,i=t-n,s=t+n;for(let o=0;o!==n;++o){const n=e[t+o];if(n!==e[i+o]||n!==e[s+o]){r=!0;break}}}if(r){if(o!==s){t[s]=t[o];const i=o*n,r=s*n;for(let t=0;t!==n;++t)e[r+t]=e[i+t]}++s}}if(r>0){t[s]=t[r];for(let t=r*n,i=s*n,o=0;o!==n;++o)e[i+o]=e[t+o];++s}return s!==t.length?(this.times=t.slice(0,s),this.values=e.slice(0,s*n)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}Cu.prototype.TimeBufferType=Float32Array,Cu.prototype.ValueBufferType=Float32Array,Cu.prototype.DefaultInterpolation=di;class wu extends Cu{constructor(t,e,n){super(t,e,n)}}wu.prototype.ValueTypeName="bool",wu.prototype.ValueBufferType=Array,wu.prototype.DefaultInterpolation=ui,wu.prototype.InterpolantFactoryMethodLinear=void 0,wu.prototype.InterpolantFactoryMethodSmooth=void 0;class _u extends Cu{}_u.prototype.ValueTypeName="color";class Mu extends Cu{}Mu.prototype.ValueTypeName="number";class Su extends yu{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-e)/(i-e);let l=t*o;for(let t=l+o;l!==t;l+=4)ss.slerpFlat(r,0,s,l-o,s,l,a);return r}}class Iu extends Cu{InterpolantFactoryMethodLinear(t){return new Su(this.times,this.values,this.getValueSize(),t)}}Iu.prototype.ValueTypeName="quaternion",Iu.prototype.InterpolantFactoryMethodSmooth=void 0;class Bu extends Cu{constructor(t,e,n){super(t,e,n)}}Bu.prototype.ValueTypeName="string",Bu.prototype.ValueBufferType=Array,Bu.prototype.DefaultInterpolation=ui,Bu.prototype.InterpolantFactoryMethodLinear=void 0,Bu.prototype.InterpolantFactoryMethodSmooth=void 0;class Tu extends Cu{}Tu.prototype.ValueTypeName="vector";class Ru{constructor(t="",e=-1,n=[],i=gi){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=br(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(Lu(n[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(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(Cu.toJSON(n[t]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,s=[];for(let t=0;t<r;t++){let o=[],a=[];o.push((t+r-1)%r,t,(t+1)%r),a.push(0,1,0);const l=fu(o);o=mu(o,1,l),a=mu(a,1,l),i||0!==o[0]||(o.push(r),a.push(a[0])),s.push(new Mu(".morphTargetInfluences["+e[t].name+"]",o,a).scale(1/n))}return new this(t,-1,s)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,n=t.length;e<n;e++){const n=t[e],s=n.name.match(r);if(s&&s.length>1){const t=s[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const s=[];for(const t in i)s.push(this.CreateFromMorphTargetSequence(t,i[t],e,n));return s}static parseAnimation(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 s=[],o=[];gu(n,s,o,i),0!==s.length&&r.push(new t(e,s,o))}},i=[],r=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let n=0;n<r[e].morphTargets.length;n++)t[r[e].morphTargets[n]]=-1;for(const n in t){const t=[],s=[];for(let i=0;i!==r[e].morphTargets.length;++i){const i=r[e];t.push(i.time),s.push(i.morphTarget===n?1:0)}i.push(new Mu(".morphTargetInfluence["+n+"]",t,s))}a=t.length*s}else{const s=".bones["+e[t].name+"]";n(Tu,s+".position",r,"pos",i),n(Iu,s+".quaternion",r,"rot",i),n(Tu,s+".scale",r,"scl",i)}}return 0===i.length?null:new this(r,a,i,o)}resetDuration(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Lu(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Mu;case"vector":case"vector2":case"vector3":case"vector4":return Tu;case"color":return _u;case"quaternion":return Iu;case"bool":case"boolean":return wu;case"string":return Bu}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],n=[];gu(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Du={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Pu{constructor(t,e,n){const i=this;let r,s=!1,o=0,a=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,!1===s&&void 0!==i.onStart&&i.onStart(t,o,a),s=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(s=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e<n;e+=2){const n=l[e],i=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return i}return null}}}const Uu=new Pu;class Ou{constructor(t){this.manager=void 0!==t?t:Uu,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(i,r){n.load(t,i,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}Ou.DEFAULT_MATERIAL_NAME="__DEFAULT";const Fu={};class ku extends Error{constructor(t,e){super(t),this.response=e}}class Nu extends Ou{constructor(t){super(t)}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=Du.get(t);if(void 0!==r)return this.manager.itemStart(t),setTimeout((()=>{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==Fu[t])return void Fu[t].push({onLoad:e,onProgress:n,onError:i});Fu[t]=[],Fu[t].push({onLoad:e,onProgress:n,onError:i});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(s).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=Fu[t],i=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),s=r?parseInt(r):0,o=0!==s;let a=0;const l=new ReadableStream({start(t){!function e(){i.read().then((({done:i,value:r})=>{if(i)t.close();else{a+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:s});for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onProgress&&e.onProgress(i)}t.enqueue(r),e()}}),(e=>{t.error(e)}))}()}});return new Response(l)}throw new ku(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)})).then((t=>{switch(a){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,o)));case"json":return t.json();default:if(void 0===o)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(o),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then((t=>i.decode(t)))}}})).then((e=>{Du.add(t,e);const n=Fu[t];delete Fu[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onLoad&&i.onLoad(e)}})).catch((e=>{const n=Fu[t];if(void 0===n)throw this.manager.itemError(t),e;delete Fu[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Qu extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Nu(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=[];for(let n=0;n<t.length;n++){const i=Ru.parse(t[n]);e.push(i)}return e}}class Gu extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=[],o=new Sc,a=new Nu(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(r.withCredentials);let l=0;function c(c){a.load(t[c],(function(t){const n=r.parse(t,!0);s[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(o.minFilter=$e),o.image=s,o.format=n.format,o.needsUpdate=!0,e&&e(o))}),n,i)}if(Array.isArray(t))for(let e=0,n=t.length;e<n;++e)c(e);else a.load(t,(function(t){const n=r.parse(t,!0);if(n.isCubemap){const t=n.mipmaps.length/n.mipmapCount;for(let e=0;e<t;e++){s[e]={mipmaps:[]};for(let t=0;t<n.mipmapCount;t++)s[e].mipmaps.push(n.mipmaps[e*n.mipmapCount+t]),s[e].format=n.format,s[e].width=n.width,s[e].height=n.height}o.image=s}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=$e),o.format=n.format,o.needsUpdate=!0,e&&e(o)}),n,i);return o}}class zu extends Ou{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Du.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const o=Ur("img");function a(){c(),Du.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){c(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){o.removeEventListener("load",a,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",a,!1),o.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(t),o.src=t,o}}class Hu extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=new La;r.colorSpace=Bi;const s=new zu(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let o=0;function a(n){s.load(t[n],(function(t){r.images[n]=t,o++,6===o&&(r.needsUpdate=!0,e&&e(r))}),void 0,i)}for(let e=0;e<t.length;++e)a(e);return r}}class Vu extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new yl,o=new Nu(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(t,(function(t){let n;try{n=r.parse(t)}catch(t){if(void 0===i)return void console.error(t);i(t)}void 0!==n.image?s.image=n.image:void 0!==n.data&&(s.image.width=n.width,s.image.height=n.height,s.image.data=n.data),s.wrapS=void 0!==n.wrapS?n.wrapS:We,s.wrapT=void 0!==n.wrapT?n.wrapT:We,s.magFilter=void 0!==n.magFilter?n.magFilter:$e,s.minFilter=void 0!==n.minFilter?n.minFilter:$e,s.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(s.colorSpace=n.colorSpace),void 0!==n.flipY&&(s.flipY=n.flipY),void 0!==n.format&&(s.format=n.format),void 0!==n.type&&(s.type=n.type),void 0!==n.mipmaps&&(s.mipmaps=n.mipmaps,s.minFilter=nn),1===n.mipmapCount&&(s.minFilter=$e),void 0!==n.generateMipmaps&&(s.generateMipmaps=n.generateMipmaps),s.needsUpdate=!0,e&&e(s,n)}),n,i),s}}class ju extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=new Kr,s=new zu(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}class Wu extends co{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Bo(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(e.object.target=this.target.uuid),e}}class qu extends Wu{constructor(t,e,n){super(t,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(co.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Bo(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}}const Xu=new Os,Yu=new os,Ju=new os;class Ku{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Br(512,512),this.map=null,this.mapPass=null,this.matrix=new Os,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new kl,this._frameExtents=new Br(1,1),this._viewportCount=1,this._viewports=[new Zr(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Yu.setFromMatrixPosition(t.matrixWorld),e.position.copy(Yu),Ju.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Ju),e.updateMatrixWorld(),Xu.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Xu),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Xu)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 1!==this.intensity&&(t.intensity=this.intensity),0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Zu extends Ku{constructor(){super(new Ba(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,n=2*xr*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class $u extends Wu{constructor(t,e,n=0,i=Math.PI/3,r=0,s=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(co.DEFAULT_UP),this.updateMatrix(),this.target=new co,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new Zu}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const td=new Os,ed=new os,nd=new os;class id extends Ku{constructor(){super(new Ba(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Br(4,2),this._viewportCount=6,this._viewports=[new Zr(2,1,1,1),new Zr(0,1,1,1),new Zr(3,1,1,1),new Zr(1,1,1,1),new Zr(3,0,1,1),new Zr(1,0,1,1)],this._cubeDirections=[new os(1,0,0),new os(-1,0,0),new os(0,0,1),new os(0,0,-1),new os(0,1,0),new os(0,-1,0)],this._cubeUps=[new os(0,1,0),new os(0,1,0),new os(0,1,0),new os(0,1,0),new os(0,0,1),new os(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),ed.setFromMatrixPosition(t.matrixWorld),n.position.copy(ed),nd.copy(n.position),nd.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(nd),n.updateMatrixWorld(),i.makeTranslation(-ed.x,-ed.y,-ed.z),td.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(td)}}class rd extends Wu{constructor(t,e,n=0,i=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new id}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class sd extends _a{constructor(t=-1,e=1,n=1,i=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,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=t,this.view.fullHeight=e,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 t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,s=n+t,o=i+e,a=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,o-=e*this.view.offsetY,a=o-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}class od extends Ku{constructor(){super(new sd(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ad extends Wu{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(co.DEFAULT_UP),this.updateMatrix(),this.target=new co,this.shadow=new od}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class ld extends Wu{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class cd extends Wu{constructor(t,e,n=10,i=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}class hd{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new os)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.282095),e.addScaledVector(s[1],.488603*i),e.addScaledVector(s[2],.488603*r),e.addScaledVector(s[3],.488603*n),e.addScaledVector(s[4],n*i*1.092548),e.addScaledVector(s[5],i*r*1.092548),e.addScaledVector(s[6],.315392*(3*r*r-1)),e.addScaledVector(s[7],n*r*1.092548),e.addScaledVector(s[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.886227),e.addScaledVector(s[1],1.023328*i),e.addScaledVector(s[2],1.023328*r),e.addScaledVector(s[3],1.023328*n),e.addScaledVector(s[4],.858086*n*i),e.addScaledVector(s[5],.858086*i*r),e.addScaledVector(s[6],.743125*r*r-.247708),e.addScaledVector(s[7],.858086*n*r),e.addScaledVector(s[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+3*i);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+3*i);return t}static getBasisAt(t,e){const n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)}}class ud extends Wu{constructor(t=new hd,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class dd extends Ou{constructor(t){super(t),this.textures={}}load(t,e,n,i){const r=this,s=new Nu(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const i=this.createMaterialFromType(t.type);if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&void 0!==i.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.sheen&&(i.sheen=t.sheen),void 0!==t.sheenColor&&(i.sheenColor=(new Bo).setHex(t.sheenColor)),void 0!==t.sheenRoughness&&(i.sheenRoughness=t.sheenRoughness),void 0!==t.emissive&&void 0!==i.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==i.specular&&i.specular.setHex(t.specular),void 0!==t.specularIntensity&&(i.specularIntensity=t.specularIntensity),void 0!==t.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(t.specularColor),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearcoat&&(i.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(i.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.dispersion&&(i.dispersion=t.dispersion),void 0!==t.iridescence&&(i.iridescence=t.iridescence),void 0!==t.iridescenceIOR&&(i.iridescenceIOR=t.iridescenceIOR),void 0!==t.iridescenceThicknessRange&&(i.iridescenceThicknessRange=t.iridescenceThicknessRange),void 0!==t.transmission&&(i.transmission=t.transmission),void 0!==t.thickness&&(i.thickness=t.thickness),void 0!==t.attenuationDistance&&(i.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(t.attenuationColor),void 0!==t.anisotropy&&(i.anisotropy=t.anisotropy),void 0!==t.anisotropyRotation&&(i.anisotropyRotation=t.anisotropyRotation),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.flatShading&&(i.flatShading=t.flatShading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.combine&&(i.combine=t.combine),void 0!==t.side&&(i.side=t.side),void 0!==t.shadowSide&&(i.shadowSide=t.shadowSide),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.alphaHash&&(i.alphaHash=t.alphaHash),void 0!==t.depthFunc&&(i.depthFunc=t.depthFunc),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.blendSrc&&(i.blendSrc=t.blendSrc),void 0!==t.blendDst&&(i.blendDst=t.blendDst),void 0!==t.blendEquation&&(i.blendEquation=t.blendEquation),void 0!==t.blendSrcAlpha&&(i.blendSrcAlpha=t.blendSrcAlpha),void 0!==t.blendDstAlpha&&(i.blendDstAlpha=t.blendDstAlpha),void 0!==t.blendEquationAlpha&&(i.blendEquationAlpha=t.blendEquationAlpha),void 0!==t.blendColor&&void 0!==i.blendColor&&i.blendColor.setHex(t.blendColor),void 0!==t.blendAlpha&&(i.blendAlpha=t.blendAlpha),void 0!==t.stencilWriteMask&&(i.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(i.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(i.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(i.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(i.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(i.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(i.stencilZPass=t.stencilZPass),void 0!==t.stencilWrite&&(i.stencilWrite=t.stencilWrite),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(i.rotation=t.rotation),void 0!==t.linewidth&&(i.linewidth=t.linewidth),void 0!==t.dashSize&&(i.dashSize=t.dashSize),void 0!==t.gapSize&&(i.gapSize=t.gapSize),void 0!==t.scale&&(i.scale=t.scale),void 0!==t.polygonOffset&&(i.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(i.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(i.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.dithering&&(i.dithering=t.dithering),void 0!==t.alphaToCoverage&&(i.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(i.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.forceSinglePass&&(i.forceSinglePass=t.forceSinglePass),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.toneMapped&&(i.toneMapped=t.toneMapped),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?i.vertexColors=t.vertexColors>0: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 Bo).setHex(r.value);break;case"v2":i.uniforms[e].value=(new Br).fromArray(r.value);break;case"v3":i.uniforms[e].value=(new os).fromArray(r.value);break;case"v4":i.uniforms[e].value=(new Zr).fromArray(r.value);break;case"m3":i.uniforms[e].value=(new Tr).fromArray(r.value);break;case"m4":i.uniforms[e].value=(new Os).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.glslVersion&&(i.glslVersion=t.glslVersion),void 0!==t.extensions)for(const e in t.extensions)i.extensions[e]=t.extensions[e];if(void 0!==t.lights&&(i.lights=t.lights),void 0!==t.clipping&&(i.clipping=t.clipping),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 Br).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.specularIntensityMap&&(i.specularIntensityMap=n(t.specularIntensityMap)),void 0!==t.specularColorMap&&(i.specularColorMap=n(t.specularColorMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapRotation&&i.envMapRotation.fromArray(t.envMapRotation),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 Br).fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(i.iridescenceMap=n(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(i.iridescenceThicknessMap=n(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),void 0!==t.thicknessMap&&(i.thicknessMap=n(t.thicknessMap)),void 0!==t.anisotropyMap&&(i.anisotropyMap=n(t.anisotropyMap)),void 0!==t.sheenColorMap&&(i.sheenColorMap=n(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return dd.createMaterialFromType(t)}static createMaterialFromType(t){return new{ShadowMaterial:eu,SpriteMaterial:Ha,RawShaderMaterial:nu,ShaderMaterial:wa,PointsMaterial:gc,MeshPhysicalMaterial:ru,MeshStandardMaterial:iu,MeshPhongMaterial:su,MeshToonMaterial:ou,MeshNormalMaterial:au,MeshLambertMaterial:lu,MeshDepthMaterial:cu,MeshDistanceMaterial:hu,MeshBasicMaterial:Do,MeshMatcapMaterial:uu,LineDashedMaterial:du,LineBasicMaterial:ic,Material:Lo}[t]}}class pd{static decodeText(t){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,i=t.length;n<i;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class Ad extends sa{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){const t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class fd extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Nu(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e={},n={};function i(t,i){if(void 0!==e[i])return e[i];const r=t.interleavedBuffers[i],s=function(t,e){if(void 0!==n[e])return n[e];const i=t.arrayBuffers[e],r=new Uint32Array(i).buffer;return n[e]=r,r}(t,r.buffer),o=Pr(r.type,s),a=new Qa(o,r.stride);return a.uuid=r.uuid,e[i]=a,a}const r=t.isInstancedBufferGeometry?new Ad:new sa,s=t.data.index;if(void 0!==s){const t=Pr(s.type,s.array);r.setIndex(new zo(t,1))}const o=t.data.attributes;for(const e in o){const n=o[e];let s;if(n.isInterleavedBufferAttribute){const e=i(t.data,n.data);s=new za(e,n.itemSize,n.offset,n.normalized)}else{const t=Pr(n.type,n.array);s=new(n.isInstancedBufferAttribute?Cl:zo)(t,n.itemSize,n.normalized)}void 0!==n.name&&(s.name=n.name),void 0!==n.usage&&s.setUsage(n.usage),r.setAttribute(e,s)}const a=t.data.morphAttributes;if(a)for(const e in a){const n=a[e],s=[];for(let e=0,r=n.length;e<r;e++){const r=n[e];let o;if(r.isInterleavedBufferAttribute){const e=i(t.data,r.data);o=new za(e,r.itemSize,r.offset,r.normalized)}else{const t=Pr(r.type,r.array);o=new zo(t,r.itemSize,r.normalized)}void 0!==r.name&&(o.name=r.name),s.push(o)}r.morphAttributes[e]=s}t.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);const l=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==l)for(let t=0,e=l.length;t!==e;++t){const e=l[t];r.addGroup(e.start,e.count,e.materialIndex)}const c=t.data.boundingSphere;if(void 0!==c){const t=new os;void 0!==c.center&&t.fromArray(c.center),r.boundingSphere=new Ss(t,c.radius)}return t.name&&(r.name=t.name),t.userData&&(r.userData=t.userData),r}}class md extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=""===this.path?pd.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||s;const o=new Nu(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){let s=null;try{s=JSON.parse(n)}catch(e){return void 0!==i&&i(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}const o=s.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())return void 0!==i&&i(new Error("THREE.ObjectLoader: Can't load "+t)),void console.error("THREE.ObjectLoader: Can't load "+t);r.parse(s,e)}),n,i)}async loadAsync(t,e){const n=""===this.path?pd.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||n;const i=new Nu(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);const r=await i.loadAsync(t,e),s=JSON.parse(r),o=s.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(s)}parse(t,e){const n=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,i),s=this.parseImages(t.images,(function(){void 0!==e&&e(l)})),o=this.parseTextures(t.textures,s),a=this.parseMaterials(t.materials,o),l=this.parseObject(t.object,r,a,o,n),c=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,c),this.bindLightTargets(l),void 0!==e){let t=!1;for(const e in s)if(s[e].data instanceof HTMLImageElement){t=!0;break}!1===t&&e(l)}return l}async parseAsync(t){const e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,n),r=await this.parseImagesAsync(t.images),s=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,s),a=this.parseObject(t.object,i,o,s,e),l=this.parseSkeletons(t.skeletons,a);return this.bindSkeletons(a,l),this.bindLightTargets(a),a}parseShapes(t){const e={};if(void 0!==t)for(let n=0,i=t.length;n<i;n++){const i=(new dh).fromJSON(t[n]);e[i.uuid]=i}return e}parseSkeletons(t,e){const n={},i={};if(e.traverse((function(t){t.isBone&&(i[t.uuid]=t)})),void 0!==t)for(let e=0,r=t.length;e<r;e++){const r=(new bl).fromJSON(t[e],i);n[r.uuid]=r}return n}parseGeometries(t,e){const n={};if(void 0!==t){const i=new fd;for(let r=0,s=t.length;r<s;r++){let s;const o=t[r];switch(o.type){case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(o);break;case"Geometry":"THREE"in window&&"LegacyJSONLoader"in THREE?s=(new THREE.LegacyJSONLoader).parse(o,this.resourcePath).geometry:console.error('THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".');break;default:o.type in tu?s=tu[o.type].fromJSON(o,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${o.type}"`)}s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.userData&&(s.userData=o.userData),n[o.uuid]=s}}return n}parseMaterials(t,e){const n={},i={};if(void 0!==t){const r=new dd;r.setTextures(e);for(let e=0,s=t.length;e<s;e++){const s=t[e];void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i}parseAnimations(t){const e={};if(void 0!==t)for(let n=0;n<t.length;n++){const i=t[n],r=Ru.parse(i);e[r.uuid]=r}return e}parseImages(t,e){const n=this,i={};let r;function s(t){if("string"==typeof t){const e=t;return function(t){return n.manager.itemStart(t),r.load(t,(function(){n.manager.itemEnd(t)}),void 0,(function(){n.manager.itemError(t),n.manager.itemEnd(t)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:n.resourcePath+e)}return t.data?{data:Pr(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const n=new Pu(e);r=new zu(n),r.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e<n;e++){const n=t[e],r=n.url;if(Array.isArray(r)){const t=[];for(let e=0,n=r.length;e<n;e++){const n=s(r[e]);null!==n&&(n instanceof HTMLImageElement?t.push(n):t.push(new yl(n.data,n.width,n.height)))}i[n.uuid]=new Xr(t)}else{const t=s(n.url);i[n.uuid]=new Xr(t)}}}return i}async parseImagesAsync(t){const e=this,n={};let i;async function r(t){if("string"==typeof t){const n=t,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:e.resourcePath+n;return await i.loadAsync(r)}return t.data?{data:Pr(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){i=new zu(this.manager),i.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.url;if(Array.isArray(s)){const t=[];for(let e=0,n=s.length;e<n;e++){const n=s[e],i=await r(n);null!==i&&(i instanceof HTMLImageElement?t.push(i):t.push(new yl(i.data,i.width,i.height)))}n[i.uuid]=new Xr(t)}else{const t=await r(i.url);n[i.uuid]=new Xr(t)}}}return n}parseTextures(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}const i={};if(void 0!==t)for(let r=0,s=t.length;r<s;r++){const s=t[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===e[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);const o=e[s.image],a=o.data;let l;Array.isArray(a)?(l=new La,6===a.length&&(l.needsUpdate=!0)):(l=a&&a.data?new yl:new Kr,a&&(l.needsUpdate=!0)),l.source=o,l.uuid=s.uuid,void 0!==s.name&&(l.name=s.name),void 0!==s.mapping&&(l.mapping=n(s.mapping,gd)),void 0!==s.channel&&(l.channel=s.channel),void 0!==s.offset&&l.offset.fromArray(s.offset),void 0!==s.repeat&&l.repeat.fromArray(s.repeat),void 0!==s.center&&l.center.fromArray(s.center),void 0!==s.rotation&&(l.rotation=s.rotation),void 0!==s.wrap&&(l.wrapS=n(s.wrap[0],vd),l.wrapT=n(s.wrap[1],vd)),void 0!==s.format&&(l.format=s.format),void 0!==s.internalFormat&&(l.internalFormat=s.internalFormat),void 0!==s.type&&(l.type=s.type),void 0!==s.colorSpace&&(l.colorSpace=s.colorSpace),void 0!==s.minFilter&&(l.minFilter=n(s.minFilter,yd)),void 0!==s.magFilter&&(l.magFilter=n(s.magFilter,yd)),void 0!==s.anisotropy&&(l.anisotropy=s.anisotropy),void 0!==s.flipY&&(l.flipY=s.flipY),void 0!==s.generateMipmaps&&(l.generateMipmaps=s.generateMipmaps),void 0!==s.premultiplyAlpha&&(l.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(l.unpackAlignment=s.unpackAlignment),void 0!==s.compareFunction&&(l.compareFunction=s.compareFunction),void 0!==s.userData&&(l.userData=s.userData),i[s.uuid]=l}return i}parseObject(t,e,n,i,r){let s,o,a;function l(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function c(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let i=0,r=t.length;i<r;i++){const r=t[i];void 0===n[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),e.push(n[r])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}function h(t){return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined texture",t),i[t]}switch(t.type){case"Scene":s=new Na,void 0!==t.background&&(Number.isInteger(t.background)?s.background=new Bo(t.background):s.background=h(t.background)),void 0!==t.environment&&(s.environment=h(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?s.fog=new ka(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(s.fog=new Fa(t.fog.color,t.fog.density)),""!==t.fog.name&&(s.fog.name=t.fog.name)),void 0!==t.backgroundBlurriness&&(s.backgroundBlurriness=t.backgroundBlurriness),void 0!==t.backgroundIntensity&&(s.backgroundIntensity=t.backgroundIntensity),void 0!==t.backgroundRotation&&s.backgroundRotation.fromArray(t.backgroundRotation),void 0!==t.environmentIntensity&&(s.environmentIntensity=t.environmentIntensity),void 0!==t.environmentRotation&&s.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":s=new Ba(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(s.focus=t.focus),void 0!==t.zoom&&(s.zoom=t.zoom),void 0!==t.filmGauge&&(s.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(s.filmOffset=t.filmOffset),void 0!==t.view&&(s.view=Object.assign({},t.view));break;case"OrthographicCamera":s=new sd(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(s.zoom=t.zoom),void 0!==t.view&&(s.view=Object.assign({},t.view));break;case"AmbientLight":s=new ld(t.color,t.intensity);break;case"DirectionalLight":s=new ad(t.color,t.intensity),s.target=t.target||"";break;case"PointLight":s=new rd(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":s=new cd(t.color,t.intensity,t.width,t.height);break;case"SpotLight":s=new $u(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay),s.target=t.target||"";break;case"HemisphereLight":s=new qu(t.color,t.groundColor,t.intensity);break;case"LightProbe":s=(new ud).fromJSON(t);break;case"SkinnedMesh":o=l(t.geometry),a=c(t.material),s=new gl(o,a),void 0!==t.bindMode&&(s.bindMode=t.bindMode),void 0!==t.bindMatrix&&s.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(s.skeleton=t.skeleton);break;case"Mesh":o=l(t.geometry),a=c(t.material),s=new ga(o,a);break;case"InstancedMesh":o=l(t.geometry),a=c(t.material);const e=t.count,n=t.instanceMatrix,i=t.instanceColor;s=new Rl(o,a,e),s.instanceMatrix=new Cl(new Float32Array(n.array),16),void 0!==i&&(s.instanceColor=new Cl(new Float32Array(i.array),i.itemSize));break;case"BatchedMesh":o=l(t.geometry),a=c(t.material),s=new nc(t.maxInstanceCount,t.maxVertexCount,t.maxIndexCount,a),s.geometry=o,s.perObjectFrustumCulled=t.perObjectFrustumCulled,s.sortObjects=t.sortObjects,s._drawRanges=t.drawRanges,s._reservedRanges=t.reservedRanges,s._visibility=t.visibility,s._active=t.active,s._bounds=t.bounds.map((t=>{const e=new cs;e.min.fromArray(t.boxMin),e.max.fromArray(t.boxMax);const n=new Ss;return n.radius=t.sphereRadius,n.center.fromArray(t.sphereCenter),{boxInitialized:t.boxInitialized,box:e,sphereInitialized:t.sphereInitialized,sphere:n}})),s._maxInstanceCount=t.maxInstanceCount,s._maxVertexCount=t.maxVertexCount,s._maxIndexCount=t.maxIndexCount,s._geometryInitialized=t.geometryInitialized,s._geometryCount=t.geometryCount,s._matricesTexture=h(t.matricesTexture.uuid),void 0!==t.colorsTexture&&(s._colorsTexture=h(t.colorsTexture.uuid));break;case"LOD":s=new al;break;case"Line":s=new uc(l(t.geometry),c(t.material));break;case"LineLoop":s=new mc(l(t.geometry),c(t.material));break;case"LineSegments":s=new fc(l(t.geometry),c(t.material));break;case"PointCloud":case"Points":s=new bc(l(t.geometry),c(t.material));break;case"Sprite":s=new il(c(t.material));break;case"Group":s=new Pa;break;case"Bone":s=new vl;break;default:s=new co}if(s.uuid=t.uuid,void 0!==t.name&&(s.name=t.name),void 0!==t.matrix?(s.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(s.matrixAutoUpdate=t.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(void 0!==t.position&&s.position.fromArray(t.position),void 0!==t.rotation&&s.rotation.fromArray(t.rotation),void 0!==t.quaternion&&s.quaternion.fromArray(t.quaternion),void 0!==t.scale&&s.scale.fromArray(t.scale)),void 0!==t.up&&s.up.fromArray(t.up),void 0!==t.castShadow&&(s.castShadow=t.castShadow),void 0!==t.receiveShadow&&(s.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(s.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(s.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(s.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(s.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&s.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(s.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(s.visible=t.visible),void 0!==t.frustumCulled&&(s.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(s.renderOrder=t.renderOrder),void 0!==t.userData&&(s.userData=t.userData),void 0!==t.layers&&(s.layers.mask=t.layers),void 0!==t.children){const o=t.children;for(let t=0;t<o.length;t++)s.add(this.parseObject(o[t],e,n,i,r))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const n=e[t];s.animations.push(r[n])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(s.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const n=e[t],i=s.getObjectByProperty("uuid",n.object);void 0!==i&&s.addLevel(i,n.distance,n.hysteresis)}}return s}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const n=e[t.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(n,t.bindMatrix)}}))}bindLightTargets(t){t.traverse((function(e){if(e.isDirectionalLight||e.isSpotLight){const n=e.target,i=t.getObjectByProperty("uuid",n);e.target=void 0!==i?i:new co}}))}}const gd={UVMapping:Ne,CubeReflectionMapping:Qe,CubeRefractionMapping:Ge,EquirectangularReflectionMapping:ze,EquirectangularRefractionMapping:He,CubeUVReflectionMapping:Ve},vd={RepeatWrapping:je,ClampToEdgeWrapping:We,MirroredRepeatWrapping:qe},yd={NearestFilter:Xe,NearestMipmapNearestFilter:Ye,NearestMipmapLinearFilter:Ke,LinearFilter:$e,LinearMipmapNearestFilter:tn,LinearMipmapLinearFilter:nn};class Ed extends Ou{constructor(t){super(t),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Du.get(t);if(void 0!==s)return r.manager.itemStart(t),s.then?void s.then((n=>{e&&e(n),r.manager.itemEnd(t)})).catch((t=>{i&&i(t)})):(setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s);const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader;const a=fetch(t,o).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){return Du.add(t,n),e&&e(n),r.manager.itemEnd(t),n})).catch((function(e){i&&i(e),Du.remove(t),r.manager.itemError(t),r.manager.itemEnd(t)}));Du.add(t,a),r.manager.itemStart(t)}}let xd;class bd{static getContext(){return void 0===xd&&(xd=new(window.AudioContext||window.webkitAudioContext)),xd}static setContext(t){xd=t}}class Cd extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Nu(this.manager);function o(e){i?i(e):console.error(e),r.manager.itemError(t)}s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(t){try{const n=t.slice(0);bd.getContext().decodeAudioData(n,(function(t){e(t)})).catch(o)}catch(t){o(t)}}),n,i)}}const wd=new Os,_d=new Os,Md=new Os;class Sd{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ba,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ba,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,Md.copy(t.projectionMatrix);const n=e.eyeSep/2,i=n*e.near/e.focus,r=e.near*Math.tan(Er*e.fov*.5)/e.zoom;let s,o;_d.elements[12]=-n,wd.elements[12]=n,s=-r*e.aspect+i,o=r*e.aspect+i,Md.elements[0]=2*e.near/(o-s),Md.elements[8]=(o+s)/(o-s),this.cameraL.projectionMatrix.copy(Md),s=-r*e.aspect-i,o=r*e.aspect-i,Md.elements[0]=2*e.near/(o-s),Md.elements[8]=(o+s)/(o-s),this.cameraR.projectionMatrix.copy(Md)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(_d),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(wd)}}class Id extends Ba{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t,this.index=0}}class Bd{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Td(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Td();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Td(){return performance.now()}const Rd=new os,Ld=new ss,Dd=new os,Pd=new os;class Ud extends co{constructor(){super(),this.type="AudioListener",this.context=bd.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Bd}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Rd,Ld,Dd),Pd.set(0,0,-1).applyQuaternion(Ld),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Rd.x,t),e.positionY.linearRampToValueAtTime(Rd.y,t),e.positionZ.linearRampToValueAtTime(Rd.z,t),e.forwardX.linearRampToValueAtTime(Pd.x,t),e.forwardY.linearRampToValueAtTime(Pd.y,t),e.forwardZ.linearRampToValueAtTime(Pd.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(Rd.x,Rd.y,Rd.z),e.setOrientation(Pd.x,Pd.y,Pd.z,n.x,n.y,n.z)}}class Od extends co{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(t=0){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){return this.detune=t,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}copy(t,e){return super.copy(t,e),"buffer"!==t.sourceType?(console.warn("THREE.Audio: Audio source type cannot be copied."),this):(this.autoplay=t.autoplay,this.buffer=t.buffer,this.detune=t.detune,this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this.offset=t.offset,this.duration=t.duration,this.playbackRate=t.playbackRate,this.hasPlaybackControl=t.hasPlaybackControl,this.sourceType=t.sourceType,this.filters=t.filters.slice(),this)}clone(t){return new this.constructor(this.listener).copy(this,t)}}const Fd=new os,kd=new ss,Nd=new os,Qd=new os;class Gd extends Od{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(Fd,kd,Nd),Qd.set(0,0,1).applyQuaternion(kd);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(Fd.x,t),e.positionY.linearRampToValueAtTime(Fd.y,t),e.positionZ.linearRampToValueAtTime(Fd.z,t),e.orientationX.linearRampToValueAtTime(Qd.x,t),e.orientationY.linearRampToValueAtTime(Qd.y,t),e.orientationZ.linearRampToValueAtTime(Qd.z,t)}else e.setPosition(Fd.x,Fd.y,Fd.z),e.setOrientation(Qd.x,Qd.y,Qd.z)}}class zd{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}}class Hd{constructor(t,e,n){let i,r,s;switch(this.binding=t,this.valueSize=n,e){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,i=this.valueSize,r=t*i+i;let s=this.cumulativeWeight;if(0===s){for(let t=0;t!==i;++t)n[r+t]=n[t];s=e}else{s+=e;const t=e/s;this._mixBufferRegion(n,r,0,t,i)}this.cumulativeWeight=s}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(n,i,t,1-r,e)}s>0&&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]){o.setValue(n,i);break}}saveOriginalState(){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(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)t[e+i]=t[n+i]}_slerp(t,e,n,i){ss.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const s=this._workIndex*r;ss.multiplyQuaternionsFlat(t,s,t,e,t,n),ss.slerpFlat(t,e,t,e,t,s,i)}_lerp(t,e,n,i,r){const s=1-i;for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]*s+t[n+o]*i}}_lerpAdditive(t,e,n,i,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[n+s]*i}}}const Vd="\\[\\]\\.:\\/",jd=new RegExp("["+Vd+"]","g"),Wd="[^"+Vd+"]",qd="[^"+Vd.replace("\\.","")+"]",Xd=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Wd)+/(WCOD+)?/.source.replace("WCOD",qd)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Wd)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Wd)+"$"),Yd=["material","materials","bones","map"];class Jd{constructor(t,e,n){this.path=e,this.parsedPath=n||Jd.parseTrackName(e),this.node=Jd.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Jd.Composite(t,e,n):new Jd(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(jd,"")}static parseTrackName(t){const e=Xd.exec(t);if(null===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!==Yd.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}static findNode(t,e){if(void 0===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<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const s=n(r.children);if(s)return s}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=Jd.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(n){let i=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==i){if(void 0===t[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[i]}}const s=t[i];if(void 0===s){const n=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",t)}let o=this.Versioning.None;this.targetObject=t,!0===t.isMaterial?o=this.Versioning.NeedsUpdate:!0===t.isObject3D&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(a=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Jd.Composite=class{constructor(t,e,n){const i=n||Jd.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},Jd.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Jd.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Jd.prototype.GetterByBindingType=[Jd.prototype._getValue_direct,Jd.prototype._getValue_array,Jd.prototype._getValue_arrayElement,Jd.prototype._getValue_toArray],Jd.prototype.SetterByBindingTypeAndVersioning=[[Jd.prototype._setValue_direct,Jd.prototype._setValue_direct_setNeedsUpdate,Jd.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Jd.prototype._setValue_array,Jd.prototype._setValue_array_setNeedsUpdate,Jd.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Jd.prototype._setValue_arrayElement,Jd.prototype._setValue_arrayElement_setNeedsUpdate,Jd.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Jd.prototype._setValue_fromArray,Jd.prototype._setValue_fromArray_setNeedsUpdate,Jd.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Kd{constructor(){this.isAnimationObjectGroup=!0,this.uuid=br(),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}}}add(){const t=this._objects,e=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,s=r.length;let o,a=t.length,l=this.nCachedObjects_;for(let c=0,h=arguments.length;c!==h;++c){const h=arguments[c],u=h.uuid;let d=e[u];if(void 0===d){d=a++,e[u]=d,t.push(h);for(let t=0,e=s;t!==e;++t)r[t].push(new Jd(h,n[t],i[t]))}else if(d<l){o=t[d];const a=--l,c=t[a];e[c.uuid]=d,t[d]=c,e[u]=a,t[a]=h;for(let t=0,e=s;t!==e;++t){const e=r[t],s=e[a];let o=e[d];e[d]=s,void 0===o&&(o=new Jd(h,n[t],i[t])),e[a]=o}}else t[d]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let s=0,o=arguments.length;s!==o;++s){const o=arguments[s],a=o.uuid,l=e[a];if(void 0!==l&&l>=r){const s=r++,c=t[s];e[c.uuid]=l,t[l]=c,e[a]=s,t[s]=o;for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[s],r=e[l];e[l]=i,e[s]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=t.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=e[a];if(void 0!==l)if(delete e[a],l<r){const o=--r,a=t[o],c=--s,h=t[c];e[a.uuid]=l,t[l]=a,e[h.uuid]=o,t[o]=h,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[o],r=e[c];e[l]=i,e[o]=r,e.pop()}}else{const r=--s,o=t[r];r>0&&(e[o.uuid]=l),t[l]=o,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_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[t]=i,s.push(t),o.push(e),r.push(h);for(let n=c,i=a.length;n!==i;++n){const i=a[n];h[n]=new Jd(i,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];e[t[o]]=n,s[n]=a,s.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}class Zd{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,s=r.length,o=new Array(s),a={endingStart:Ai,endingEnd:Ai};for(let t=0;t!==s;++t){const e=r[t].createInterpolant(null);o[t]=e,e.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ci,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,s=n/i;t.warp(1,r,e),this.warp(s,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,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,a[1]=r+n,l[0]=t/s,l[1]=e/s,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;i<0||0===n?e=0:(this._startTime=null,e=n*i)}e*=this._updateTimeScale(t);const s=this._updateTime(e),o=this._updateWeight(t);if(o>0){const t=this._interpolants,e=this._propertyBindings;if(this.blendMode===vi)for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulateAdditive(o);else for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulate(i,o)}}_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 s=n===hi;if(0===t)return-1===r||!s||1&~r?i:e-i;if(n===li){-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,s)):this._setEndings(0===this.repetitions,!0,s)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const o=this.repetitions-r;if(o<=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===o){const e=t<0;this._setEndings(e,!e,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&~r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=fi,i.endingEnd=fi):(i.endingStart=t?this.zeroSlopeAtStart?fi:Ai:mi,i.endingEnd=e?this.zeroSlopeAtEnd?fi:Ai:mi)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=e,o[1]=r+t,a[1]=n,this}}const $d=new Float32Array(1);class tp extends gr{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,s=t._propertyBindings,o=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)++h.referenceCount,s[t]=h;else{if(h=s[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(Jd.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),s[t]=h}o[t].resultBuffer=h.buffer}}_activateAction(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(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(){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(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const i=this._actions,r=this._actionsByClip;let s=r[e];if(void 0===s)s={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=s;else{const e=s.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=i.length,i.push(t),s.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,s=this._actionsByClip,o=s[r],a=o.knownActions,l=a[a.length-1],c=t._byClipCacheIndex;l._byClipCacheIndex=c,a[c]=l,a.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===a.length&&delete s[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_addInactiveBinding(t,e,n){const i=this._bindingsByRootAndName,r=this._bindings;let s=i[e];void 0===s&&(s={},i[e]=s),s[n]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,o=s[i],a=e[e.length-1],l=t._cacheIndex;a._cacheIndex=l,e[l]=a,e.pop(),delete o[r],0===Object.keys(o).length&&delete s[i]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&(n=new xu(new Float32Array(2),new Float32Array(2),1,$d),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r}clipAction(t,e,n){const i=e||this._root,r=i.uuid;let s="string"==typeof t?Ru.findByName(i,t):t;const o=null!==s?s.uuid:t,a=this._actionsByClip[o];let l=null;if(void 0===n&&(n=null!==s?s.blendMode:gi),void 0!==a){const t=a.actionByRoot[r];if(void 0!==t&&t.blendMode===n)return t;l=a.knownActions[0],null===s&&(s=l._clip)}if(null===s)return null;const c=new Zd(this,s,e,n);return this._bindAction(c,l),this._addInactiveAction(c,o,r),c}existingAction(t,e){const n=e||this._root,i=n.uuid,r="string"==typeof t?Ru.findByName(n,t):t,s=r?r.uuid:t,o=this._actionsByClip[s];return void 0!==o&&o.actionByRoot[i]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let o=0;o!==n;++o)e[o]._update(i,t,r,s);const o=this._bindings,a=this._nActiveBindings;for(let t=0;t!==a;++t)o[t].apply(s);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const t=r.knownActions;for(let n=0,i=t.length;n!==i;++n){const i=t[n];this._deactivateAction(i);const r=i._cacheIndex,s=e[e.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,s._cacheIndex=r,e[r]=s,e.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const t in n){const i=n[t].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}const i=this._bindingsByRootAndName[e];if(void 0!==i)for(const t in i){const e=i[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class ep extends $r{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new is(null,t,e,n),this.texture.isRenderTargetTexture=!0}}class np extends $r{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isRenderTargetArray=!0,this.depth=n,this.texture=new es(null,t,e,n),this.texture.isRenderTargetTexture=!0}}class ip{constructor(t){this.value=t}clone(){return new ip(void 0===this.value.clone?this.value:this.value.clone())}}let rp=0;class sp extends gr{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:rp++}),this.name="",this.usage=ir,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){const e=this.uniforms.indexOf(t);return-1!==e&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(t){this.name=t.name,this.usage=t.usage;const e=t.uniforms;this.uniforms.length=0;for(let t=0,n=e.length;t<n;t++){const n=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0;t<n.length;t++)this.uniforms.push(n[t].clone())}return this}clone(){return(new this.constructor).copy(this)}}class op extends Qa{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}class ap{constructor(t,e,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}const lp=new Os;class cp{constructor(t,e,n=0,i=1/0){this.ray=new Us(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new qs,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return lp.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(lp),this}intersectObject(t,e=!0,n=[]){return up(t,this,n,e),n.sort(hp),n}intersectObjects(t,e=!0,n=[]){for(let i=0,r=t.length;i<r;i++)up(t[i],this,n,e);return n.sort(hp),n}}function hp(t,e){return t.distance-e.distance}function up(t,e,n,i){let r=!0;if(t.layers.test(e.layers)&&!1===t.raycast(e,n)&&(r=!1),!0===r&&!0===i){const i=t.children;for(let t=0,r=i.length;t<r;t++)up(i[t],e,n,!0)}}class dp{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=Cr(this.phi,t,Math.PI-t),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(Cr(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class pp{constructor(t=1,e=0,n=0){return this.radius=t,this.theta=e,this.y=n,this}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return(new this.constructor).copy(this)}}class Ap{constructor(t,e,n,i){Ap.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==t&&this.set(t,e,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let n=0;n<4;n++)this.elements[n]=t[n+e];return this}set(t,e,n,i){const r=this.elements;return r[0]=t,r[2]=e,r[1]=n,r[3]=i,this}}const fp=new Br;class mp{constructor(t=new Br(1/0,1/0),e=new Br(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=fp.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.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 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.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,fp).distanceTo(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}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 gp=new os,vp=new os;class yp{constructor(t=new os,e=new os){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){gp.subVectors(t,this.start),vp.subVectors(this.end,this.start);const n=vp.dot(vp);let i=vp.dot(gp)/n;return e&&(i=Cr(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return 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)}clone(){return(new this.constructor).copy(this)}}const Ep=new os;class xp extends co{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const n=new sa,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<n;t++,e++){const r=t/n*Math.PI*2,s=e/n*Math.PI*2;i.push(Math.cos(r),Math.sin(r),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new Ko(i,3));const r=new ic({fog:!1,toneMapped:!1});this.cone=new fc(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),Ep.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Ep),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const bp=new os,Cp=new Os,wp=new Os;class _p extends fc{constructor(t){const e=Mp(t),n=new sa,i=[],r=[],s=new Bo(0,0,1),o=new Bo(0,1,0);for(let t=0;t<e.length;t++){const n=e[t];n.parent&&n.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(s.r,s.g,s.b),r.push(o.r,o.g,o.b))}n.setAttribute("position",new Ko(i,3)),n.setAttribute("color",new Ko(r,3)),super(n,new ic({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,i=n.getAttribute("position");wp.copy(this.root.matrixWorld).invert();for(let t=0,n=0;t<e.length;t++){const r=e[t];r.parent&&r.parent.isBone&&(Cp.multiplyMatrices(wp,r.matrixWorld),bp.setFromMatrixPosition(Cp),i.setXYZ(n,bp.x,bp.y,bp.z),Cp.multiplyMatrices(wp,r.parent.matrixWorld),bp.setFromMatrixPosition(Cp),i.setXYZ(n+1,bp.x,bp.y,bp.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Mp(t){const e=[];!0===t.isBone&&e.push(t);for(let n=0;n<t.children.length;n++)e.push.apply(e,Mp(t.children[n]));return e}class Sp extends ga{constructor(t,e,n){super(new qh(e,4,2),new Do({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Ip=new os,Bp=new Bo,Tp=new Bo;class Rp extends co{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Hh(e);i.rotateY(.5*Math.PI),this.material=new Do({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),s=new Float32Array(3*r.count);i.setAttribute("color",new zo(s,3)),this.add(new ga(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");Bp.copy(this.light.color),Tp.copy(this.light.groundColor);for(let t=0,n=e.count;t<n;t++){const i=t<n/2?Bp:Tp;e.setXYZ(t,i.r,i.g,i.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(Ip.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Lp extends fc{constructor(t=10,e=10,n=4473924,i=8947848){n=new Bo(n),i=new Bo(i);const r=e/2,s=t/e,o=t/2,a=[],l=[];for(let t=0,c=0,h=-o;t<=e;t++,h+=s){a.push(-o,0,h,o,0,h),a.push(h,0,-o,h,0,o);const e=t===r?n:i;e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3}const c=new sa;c.setAttribute("position",new Ko(a,3)),c.setAttribute("color",new Ko(l,3)),super(c,new ic({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class Dp extends fc{constructor(t=10,e=16,n=8,i=64,r=4473924,s=8947848){r=new Bo(r),s=new Bo(s);const o=[],a=[];if(e>1)for(let n=0;n<e;n++){const i=n/e*(2*Math.PI),l=Math.sin(i)*t,c=Math.cos(i)*t;o.push(0,0,0),o.push(l,0,c);const h=1&n?r:s;a.push(h.r,h.g,h.b),a.push(h.r,h.g,h.b)}for(let e=0;e<n;e++){const l=1&e?r:s,c=t-t/n*e;for(let t=0;t<i;t++){let e=t/i*(2*Math.PI),n=Math.sin(e)*c,r=Math.cos(e)*c;o.push(n,0,r),a.push(l.r,l.g,l.b),e=(t+1)/i*(2*Math.PI),n=Math.sin(e)*c,r=Math.cos(e)*c,o.push(n,0,r),a.push(l.r,l.g,l.b)}}const l=new sa;l.setAttribute("position",new Ko(o,3)),l.setAttribute("color",new Ko(a,3)),super(l,new ic({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Pp=new os,Up=new os,Op=new os;class Fp extends co{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",void 0===e&&(e=1);let i=new sa;i.setAttribute("position",new Ko([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new ic({fog:!1,toneMapped:!1});this.lightPlane=new uc(i,r),this.add(this.lightPlane),i=new sa,i.setAttribute("position",new Ko([0,0,0,0,0,1],3)),this.targetLine=new uc(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Pp.setFromMatrixPosition(this.light.matrixWorld),Up.setFromMatrixPosition(this.light.target.matrixWorld),Op.subVectors(Up,Pp),this.lightPlane.lookAt(Up),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Up),this.targetLine.scale.z=Op.length()}}const kp=new os,Np=new _a;class Qp extends fc{constructor(t){const e=new sa,n=new ic({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={};function o(t,e){a(t),a(e)}function a(t){i.push(0,0,0),r.push(0,0,0),void 0===s[t]&&(s[t]=[]),s[t].push(i.length/3-1)}o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4"),e.setAttribute("position",new Ko(i,3)),e.setAttribute("color",new Ko(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update();const l=new Bo(16755200),c=new Bo(16711680),h=new Bo(43775),u=new Bo(16777215),d=new Bo(3355443);this.setColors(l,c,h,u,d)}setColors(t,e,n,i,r){const s=this.geometry.getAttribute("color");s.setXYZ(0,t.r,t.g,t.b),s.setXYZ(1,t.r,t.g,t.b),s.setXYZ(2,t.r,t.g,t.b),s.setXYZ(3,t.r,t.g,t.b),s.setXYZ(4,t.r,t.g,t.b),s.setXYZ(5,t.r,t.g,t.b),s.setXYZ(6,t.r,t.g,t.b),s.setXYZ(7,t.r,t.g,t.b),s.setXYZ(8,t.r,t.g,t.b),s.setXYZ(9,t.r,t.g,t.b),s.setXYZ(10,t.r,t.g,t.b),s.setXYZ(11,t.r,t.g,t.b),s.setXYZ(12,t.r,t.g,t.b),s.setXYZ(13,t.r,t.g,t.b),s.setXYZ(14,t.r,t.g,t.b),s.setXYZ(15,t.r,t.g,t.b),s.setXYZ(16,t.r,t.g,t.b),s.setXYZ(17,t.r,t.g,t.b),s.setXYZ(18,t.r,t.g,t.b),s.setXYZ(19,t.r,t.g,t.b),s.setXYZ(20,t.r,t.g,t.b),s.setXYZ(21,t.r,t.g,t.b),s.setXYZ(22,t.r,t.g,t.b),s.setXYZ(23,t.r,t.g,t.b),s.setXYZ(24,e.r,e.g,e.b),s.setXYZ(25,e.r,e.g,e.b),s.setXYZ(26,e.r,e.g,e.b),s.setXYZ(27,e.r,e.g,e.b),s.setXYZ(28,e.r,e.g,e.b),s.setXYZ(29,e.r,e.g,e.b),s.setXYZ(30,e.r,e.g,e.b),s.setXYZ(31,e.r,e.g,e.b),s.setXYZ(32,n.r,n.g,n.b),s.setXYZ(33,n.r,n.g,n.b),s.setXYZ(34,n.r,n.g,n.b),s.setXYZ(35,n.r,n.g,n.b),s.setXYZ(36,n.r,n.g,n.b),s.setXYZ(37,n.r,n.g,n.b),s.setXYZ(38,i.r,i.g,i.b),s.setXYZ(39,i.r,i.g,i.b),s.setXYZ(40,r.r,r.g,r.b),s.setXYZ(41,r.r,r.g,r.b),s.setXYZ(42,r.r,r.g,r.b),s.setXYZ(43,r.r,r.g,r.b),s.setXYZ(44,r.r,r.g,r.b),s.setXYZ(45,r.r,r.g,r.b),s.setXYZ(46,r.r,r.g,r.b),s.setXYZ(47,r.r,r.g,r.b),s.setXYZ(48,r.r,r.g,r.b),s.setXYZ(49,r.r,r.g,r.b),s.needsUpdate=!0}update(){const t=this.geometry,e=this.pointMap;Np.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);const n=this.camera.coordinateSystem===Ar?-1:0;Gp("c",e,t,Np,0,0,n),Gp("t",e,t,Np,0,0,1),Gp("n1",e,t,Np,-1,-1,n),Gp("n2",e,t,Np,1,-1,n),Gp("n3",e,t,Np,-1,1,n),Gp("n4",e,t,Np,1,1,n),Gp("f1",e,t,Np,-1,-1,1),Gp("f2",e,t,Np,1,-1,1),Gp("f3",e,t,Np,-1,1,1),Gp("f4",e,t,Np,1,1,1),Gp("u1",e,t,Np,.7,1.1,n),Gp("u2",e,t,Np,-.7,1.1,n),Gp("u3",e,t,Np,0,2,n),Gp("cf1",e,t,Np,-1,0,1),Gp("cf2",e,t,Np,1,0,1),Gp("cf3",e,t,Np,0,-1,1),Gp("cf4",e,t,Np,0,1,1),Gp("cn1",e,t,Np,-1,0,n),Gp("cn2",e,t,Np,1,0,n),Gp("cn3",e,t,Np,0,-1,n),Gp("cn4",e,t,Np,0,1,n),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Gp(t,e,n,i,r,s,o){kp.set(r,s,o).unproject(i);const a=e[t];if(void 0!==a){const t=n.getAttribute("position");for(let e=0,n=a.length;e<n;e++)t.setXYZ(a[e],kp.x,kp.y,kp.z)}}const zp=new cs;class Hp extends fc{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new sa;r.setIndex(new zo(n,1)),r.setAttribute("position",new zo(i,3)),super(r,new ic({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&zp.setFromObject(this.object),zp.isEmpty())return;const e=zp.min,n=zp.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=e.x,r[4]=n.y,r[5]=n.z,r[6]=e.x,r[7]=e.y,r[8]=n.z,r[9]=n.x,r[10]=e.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=e.z,r[15]=e.x,r[16]=n.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=n.x,r[22]=e.y,r[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Vp extends fc{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new sa;i.setIndex(new zo(n,1)),i.setAttribute("position",new Ko([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new ic({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}}class jp extends uc{constructor(t,e=1,n=16776960){const i=n,r=new sa;r.setAttribute("position",new Ko([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),r.computeBoundingSphere(),super(r,new ic({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const s=new sa;s.setAttribute("position",new Ko([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),this.add(new ga(s,new Do({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Wp=new os;let qp,Xp;class Yp extends co{constructor(t=new os(0,0,1),e=new os(0,0,0),n=1,i=16776960,r=.2*n,s=.2*r){super(),this.type="ArrowHelper",void 0===qp&&(qp=new sa,qp.setAttribute("position",new Ko([0,0,0,0,1,0],3)),Xp=new ih(0,.5,1,5,1),Xp.translate(0,-.5,0)),this.position.copy(e),this.line=new uc(qp,new ic({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ga(Xp,new Do({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,s)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{Wp.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Wp,e)}}setLength(t,e=.2*t,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}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class Jp extends fc{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 sa;n.setAttribute("position",new Ko(e,3)),n.setAttribute("color",new Ko([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new ic({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,n){const i=new Bo,r=this.geometry.attributes.color.array;return i.set(t),i.toArray(r,0),i.toArray(r,3),i.set(e),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Kp{constructor(){this.type="ShapePath",this.color=new Bo,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new $c,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this}bezierCurveTo(t,e,n,i,r,s){return this.currentPath.bezierCurveTo(t,e,n,i,r,s),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const n=e.length;let i=!1;for(let r=n-1,s=0;s<n;r=s++){let n=e[r],o=e[s],a=o.x-n.x,l=o.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=e[s],a=-a,o=e[r],l=-l),t.y<n.y||t.y>o.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(o.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=o.x)return!0}}return i}const n=Fh.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,s,o;const a=[];if(1===i.length)return s=i[0],o=new dh,o.curves=s.curves,a.push(o),a;let l=!n(i[0].getPoints());l=t?!l:l;const c=[],h=[];let u,d,p=[],A=0;h[A]=void 0,p[A]=[];for(let e=0,o=i.length;e<o;e++)s=i[e],u=s.getPoints(),r=n(u),r=t?!r:r,r?(!l&&h[A]&&A++,h[A]={s:new dh,p:u},h[A].s.curves=s.curves,l&&A++,p[A]=[]):p[A].push({h:s,p:u[0]});if(!h[0])return function(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n],r=new dh;r.curves=i.curves,e.push(r)}return e}(i);if(h.length>1){let t=!1,n=0;for(let t=0,e=h.length;t<e;t++)c[t]=[];for(let i=0,r=h.length;i<r;i++){const r=p[i];for(let s=0;s<r.length;s++){const o=r[s];let a=!0;for(let r=0;r<h.length;r++)e(o.p,h[r].p)&&(i!==r&&n++,a?(a=!1,c[r].push(o)):t=!0);a&&c[i].push(o)}}n>0&&!1===t&&(p=c)}for(let t=0,e=h.length;t<e;t++){o=h[t].s,a.push(o),d=p[t];for(let t=0,e=d.length;t<e;t++)o.holes.push(d[t].h)}return a}}class Zp extends gr{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}function $p(t,e,n,i){const r=function(t){switch(t){case sn:case on:return{byteLength:1,components:1};case ln:case an:case dn:return{byteLength:2,components:1};case pn:case An:return{byteLength:2,components:4};case hn:case cn:case un:return{byteLength:4,components:1};case mn:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}(i);switch(n){case gn:case En:return t*e;case xn:return t*e*2;case wn:case _n:return t*e/r.components*r.byteLength;case Mn:case Sn:return t*e*2/r.components*r.byteLength;case vn:return t*e*3/r.components*r.byteLength;case yn:case Bn:return t*e*4/r.components*r.byteLength;case Tn:case Rn:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Ln:case Dn:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Un:case Fn:return Math.max(t,16)*Math.max(e,8)/4;case Pn:case On:return Math.max(t,8)*Math.max(e,8)/2;case kn:case Nn:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Qn:case Gn:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case zn:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case Hn:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case Vn:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case jn:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case Wn:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case qn:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case Xn:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case Yn:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case Jn:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case Kn:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case Zn:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case $n:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case ti:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case ei:case ni:case ii:return Math.ceil(t/4)*Math.ceil(e/4)*16;case ri:case si:return Math.ceil(t/4)*Math.ceil(e/4)*8;case oi:case ai:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}const tA={contain:function(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t},cover:function(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t},fill:function(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t},getByteLength:$p};function eA(){let t=null,e=!1,n=null,i=null;function r(e,s){n(e,s),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 nA(t){const e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=e.get(n);i&&(t.deleteBuffer(i.buffer),e.delete(n))},update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const t=e.get(n);return void((!t||t.version<n.version)&&e.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}const r=e.get(n);if(void 0===r)e.set(n,function(e,n){const i=e.array,r=e.usage,s=i.byteLength,o=t.createBuffer();let a;if(t.bindBuffer(n,o),t.bufferData(n,i,r),e.onUploadCallback(),i instanceof Float32Array)a=t.FLOAT;else if(i instanceof Uint16Array)a=e.isFloat16BufferAttribute?t.HALF_FLOAT:t.UNSIGNED_SHORT;else if(i instanceof Int16Array)a=t.SHORT;else if(i instanceof Uint32Array)a=t.UNSIGNED_INT;else if(i instanceof Int32Array)a=t.INT;else if(i instanceof Int8Array)a=t.BYTE;else if(i instanceof Uint8Array)a=t.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);a=t.UNSIGNED_BYTE}return{buffer:o,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version,size:s}}(n,i));else if(r.version<n.version){if(r.size!==n.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(e,n,i){const r=n.array,s=n.updateRanges;if(t.bindBuffer(i,e),0===s.length)t.bufferSubData(i,0,r);else{s.sort(((t,e)=>t.start-e.start));let e=0;for(let t=1;t<s.length;t++){const n=s[e],i=s[t];i.start<=n.start+n.count+1?n.count=Math.max(n.count,i.start+i.count-n.start):(++e,s[e]=i)}s.length=e+1;for(let e=0,n=s.length;e<n;e++){const n=s[e];t.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Lt}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Lt);const iA={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_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 ) || defined( USE_BATCHING_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\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( 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 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in 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( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\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 shadowIntensity;\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\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 shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, 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.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},rA={common:{diffuse:{value:new Bo(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Tr},alphaMap:{value:null},alphaMapTransform:{value:new Tr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Tr}},envmap:{envMap:{value:null},envMapRotation:{value:new Tr},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Tr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Tr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Tr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Tr},normalScale:{value:new Br(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Tr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Tr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Tr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Tr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Bo(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 Bo(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Tr},alphaTest:{value:0},uvTransform:{value:new Tr}},sprite:{diffuse:{value:new Bo(16777215)},opacity:{value:1},center:{value:new Br(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Tr},alphaMap:{value:null},alphaMapTransform:{value:new Tr},alphaTest:{value:0}}},sA={basic:{uniforms:xa([rA.common,rA.specularmap,rA.envmap,rA.aomap,rA.lightmap,rA.fog]),vertexShader:iA.meshbasic_vert,fragmentShader:iA.meshbasic_frag},lambert:{uniforms:xa([rA.common,rA.specularmap,rA.envmap,rA.aomap,rA.lightmap,rA.emissivemap,rA.bumpmap,rA.normalmap,rA.displacementmap,rA.fog,rA.lights,{emissive:{value:new Bo(0)}}]),vertexShader:iA.meshlambert_vert,fragmentShader:iA.meshlambert_frag},phong:{uniforms:xa([rA.common,rA.specularmap,rA.envmap,rA.aomap,rA.lightmap,rA.emissivemap,rA.bumpmap,rA.normalmap,rA.displacementmap,rA.fog,rA.lights,{emissive:{value:new Bo(0)},specular:{value:new Bo(1118481)},shininess:{value:30}}]),vertexShader:iA.meshphong_vert,fragmentShader:iA.meshphong_frag},standard:{uniforms:xa([rA.common,rA.envmap,rA.aomap,rA.lightmap,rA.emissivemap,rA.bumpmap,rA.normalmap,rA.displacementmap,rA.roughnessmap,rA.metalnessmap,rA.fog,rA.lights,{emissive:{value:new Bo(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:iA.meshphysical_vert,fragmentShader:iA.meshphysical_frag},toon:{uniforms:xa([rA.common,rA.aomap,rA.lightmap,rA.emissivemap,rA.bumpmap,rA.normalmap,rA.displacementmap,rA.gradientmap,rA.fog,rA.lights,{emissive:{value:new Bo(0)}}]),vertexShader:iA.meshtoon_vert,fragmentShader:iA.meshtoon_frag},matcap:{uniforms:xa([rA.common,rA.bumpmap,rA.normalmap,rA.displacementmap,rA.fog,{matcap:{value:null}}]),vertexShader:iA.meshmatcap_vert,fragmentShader:iA.meshmatcap_frag},points:{uniforms:xa([rA.points,rA.fog]),vertexShader:iA.points_vert,fragmentShader:iA.points_frag},dashed:{uniforms:xa([rA.common,rA.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:iA.linedashed_vert,fragmentShader:iA.linedashed_frag},depth:{uniforms:xa([rA.common,rA.displacementmap]),vertexShader:iA.depth_vert,fragmentShader:iA.depth_frag},normal:{uniforms:xa([rA.common,rA.bumpmap,rA.normalmap,rA.displacementmap,{opacity:{value:1}}]),vertexShader:iA.meshnormal_vert,fragmentShader:iA.meshnormal_frag},sprite:{uniforms:xa([rA.sprite,rA.fog]),vertexShader:iA.sprite_vert,fragmentShader:iA.sprite_frag},background:{uniforms:{uvTransform:{value:new Tr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:iA.background_vert,fragmentShader:iA.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Tr}},vertexShader:iA.backgroundCube_vert,fragmentShader:iA.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:iA.cube_vert,fragmentShader:iA.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:iA.equirect_vert,fragmentShader:iA.equirect_frag},distanceRGBA:{uniforms:xa([rA.common,rA.displacementmap,{referencePosition:{value:new os},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:iA.distanceRGBA_vert,fragmentShader:iA.distanceRGBA_frag},shadow:{uniforms:xa([rA.lights,rA.fog,{color:{value:new Bo(0)},opacity:{value:1}}]),vertexShader:iA.shadow_vert,fragmentShader:iA.shadow_frag}};sA.physical={uniforms:xa([sA.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Tr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Tr},clearcoatNormalScale:{value:new Br(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Tr},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Tr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Tr},sheen:{value:0},sheenColor:{value:new Bo(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Tr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Tr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Tr},transmissionSamplerSize:{value:new Br},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Tr},attenuationDistance:{value:0},attenuationColor:{value:new Bo(0)},specularColor:{value:new Bo(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Tr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Tr},anisotropyVector:{value:new Br},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Tr}}]),vertexShader:iA.meshphysical_vert,fragmentShader:iA.meshphysical_frag};const oA={r:0,b:0,g:0},aA=new Ws,lA=new Os;function cA(t,e,n,i,r,s,o){const a=new Bo(0);let l,c,h=!0===s?0:1,u=null,d=0,p=null;function A(t){let i=!0===t.isScene?t.background:null;return i&&i.isTexture&&(i=(t.backgroundBlurriness>0?n:e).get(i)),i}function f(e,n){e.getRGB(oA,ba(t)),i.buffers.color.setClear(oA.r,oA.g,oA.b,n,o)}return{getClearColor:function(){return a},setClearColor:function(t,e=1){a.set(t),h=e,f(a,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,f(a,h)},render:function(e){let n=!1;const r=A(e);null===r?f(a,h):r&&r.isColor&&(f(r,1),n=!0);const s=t.xr.getEnvironmentBlendMode();"additive"===s?i.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===s&&i.buffers.color.setClear(0,0,0,0,o),(t.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))},addToRenderList:function(e,n){const i=A(n);i&&(i.isCubeTexture||i.mapping===Ve)?(void 0===c&&(c=new ga(new ya(1e4,1e4,1e4),new wa({name:"BackgroundCubeMaterial",uniforms:Ea(sA.backgroundCube.uniforms),vertexShader:sA.backgroundCube.vertexShader,fragmentShader:sA.backgroundCube.fragmentShader,side:Vt,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),aA.copy(n.backgroundRotation),aA.x*=-1,aA.y*=-1,aA.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(aA.y*=-1,aA.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(lA.makeRotationFromEuler(aA)),c.material.toneMapped=zr.getTransfer(i.colorSpace)!==Li,u===i&&d===i.version&&p===t.toneMapping||(c.material.needsUpdate=!0,u=i,d=i.version,p=t.toneMapping),c.layers.enableAll(),e.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new ga(new Vh(2,2),new wa({name:"BackgroundMaterial",uniforms:Ea(sA.background.uniforms),vertexShader:sA.background.vertexShader,fragmentShader:sA.background.fragmentShader,side:Ht,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=zr.getTransfer(i.colorSpace)!==Li,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),u===i&&d===i.version&&p===t.toneMapping||(l.material.needsUpdate=!0,u=i,d=i.version,p=t.toneMapping),l.layers.enableAll(),e.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==c&&(c.geometry.dispose(),c.material.dispose(),c=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function hA(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=c(null);let s=r,o=!1;function a(e){return t.bindVertexArray(e)}function l(e){return t.deleteVertexArray(e)}function c(t){const e=[],i=[],r=[];for(let t=0;t<n;t++)e[t]=0,i[t]=0,r[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:r,object:t,attributes:{},index:null}}function h(){const t=s.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function u(t){d(t,0)}function d(e,n){const i=s.newAttributes,r=s.enabledAttributes,o=s.attributeDivisors;i[e]=1,0===r[e]&&(t.enableVertexAttribArray(e),r[e]=1),o[e]!==n&&(t.vertexAttribDivisor(e,n),o[e]=n)}function p(){const e=s.newAttributes,n=s.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function A(e,n,i,r,s,o,a){!0===a?t.vertexAttribIPointer(e,n,i,s,o):t.vertexAttribPointer(e,n,i,r,s,o)}function f(){m(),o=!0,s!==r&&(s=r,a(s.object))}function m(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,f,m){let g=!1;const v=function(e,n,r){const s=!0===r.wireframe;let o=i[e.id];void 0===o&&(o={},i[e.id]=o);let a=o[n.id];void 0===a&&(a={},o[n.id]=a);let l=a[s];return void 0===l&&(l=c(t.createVertexArray()),a[s]=l),l}(f,l,r);s!==v&&(s=v,a(s.object)),g=function(t,e,n,i){const r=s.attributes,o=e.attributes;let a=0;const l=n.getAttributes();for(const e in l)if(l[e].location>=0){const n=r[e];let i=o[e];if(void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;a++}return s.attributesNum!==a||s.index!==i}(n,f,l,m),g&&function(t,e,n,i){const r={},o=e.attributes;let a=0;const l=n.getAttributes();for(const e in l)if(l[e].location>=0){let n=o[e];void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[e]=i,a++}s.attributes=r,s.attributesNum=a,s.index=i}(n,f,l,m),null!==m&&e.update(m,t.ELEMENT_ARRAY_BUFFER),(g||o)&&(o=!1,function(n,i,r,s){h();const o=s.attributes,a=r.getAttributes(),l=i.defaultAttributeValues;for(const i in a){const r=a[i];if(r.location>=0){let a=o[i];if(void 0===a&&("instanceMatrix"===i&&n.instanceMatrix&&(a=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(a=n.instanceColor)),void 0!==a){const i=a.normalized,o=a.itemSize,l=e.get(a);if(void 0===l)continue;const c=l.buffer,h=l.type,p=l.bytesPerElement,f=h===t.INT||h===t.UNSIGNED_INT||a.gpuType===cn;if(a.isInterleavedBufferAttribute){const e=a.data,l=e.stride,m=a.offset;if(e.isInstancedInterleavedBuffer){for(let t=0;t<r.locationSize;t++)d(r.location+t,e.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=e.meshPerAttribute*e.count)}else for(let t=0;t<r.locationSize;t++)u(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<r.locationSize;t++)A(r.location+t,o/r.locationSize,h,i,l*p,(m+o/r.locationSize*t)*p,f)}else{if(a.isInstancedBufferAttribute){for(let t=0;t<r.locationSize;t++)d(r.location+t,a.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let t=0;t<r.locationSize;t++)u(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<r.locationSize;t++)A(r.location+t,o/r.locationSize,h,i,o*p,o/r.locationSize*t*p,f)}}else if(void 0!==l){const e=l[i];if(void 0!==e)switch(e.length){case 2:t.vertexAttrib2fv(r.location,e);break;case 3:t.vertexAttrib3fv(r.location,e);break;case 4:t.vertexAttrib4fv(r.location,e);break;default:t.vertexAttrib1fv(r.location,e)}}}}p()}(n,r,l,f),null!==m&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(m).buffer))},reset:f,resetDefaultState:m,dispose:function(){f();for(const t in i){const e=i[t];for(const t in e){const n=e[t];for(const t in n)l(n[t].object),delete n[t];delete e[t]}delete i[t]}},releaseStatesOfGeometry:function(t){if(void 0===i[t.id])return;const e=i[t.id];for(const t in e){const n=e[t];for(const t in n)l(n[t].object),delete n[t];delete e[t]}delete i[t.id]},releaseStatesOfProgram:function(t){for(const e in i){const n=i[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)l(r[t].object),delete r[t];delete n[t.id]}},initAttributes:h,enableAttribute:u,disableUnusedAttributes:p}}function uA(t,e,n){let i;function r(e,r,s){0!==s&&(t.drawArraysInstanced(i,e,r,s),n.update(r,i,s))}this.setMode=function(t){i=t},this.render=function(e,r){t.drawArrays(i,e,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(t,r,s){if(0===s)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,t,0,r,0,s);let o=0;for(let t=0;t<s;t++)o+=r[t];n.update(o,i,1)},this.renderMultiDrawInstances=function(t,s,o,a){if(0===o)return;const l=e.get("WEBGL_multi_draw");if(null===l)for(let e=0;e<t.length;e++)r(t[e],s[e],a[e]);else{l.multiDrawArraysInstancedWEBGL(i,t,0,s,0,a,0,o);let e=0;for(let t=0;t<o;t++)e+=s[t]*a[t];n.update(e,i,1)}}}function dA(t,e,n,i){let r;function s(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==n.precision?n.precision:"highp";const a=s(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=!0===n.logarithmicDepthBuffer,c=!0===n.reverseDepthBuffer&&e.has("EXT_clip_control"),h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:s,textureFormatReadable:function(e){return e===yn||i.convert(e)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===dn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(n!==sn&&i.convert(n)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==un&&!r)},precision:o,logarithmicDepthBuffer:l,reverseDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxCubemapSize:t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:t.getParameter(t.MAX_VERTEX_ATTRIBS),maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:t.getParameter(t.MAX_VARYING_VECTORS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:u>0,maxSamples:t.getParameter(t.MAX_SAMPLES)}}function pA(t){const e=this;let n=null,i=0,r=!1,s=!1;const o=new Ul,a=new Tr,l={value:null,needsUpdate:!1};function c(t,n,i,r){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const e=i+4*s,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,n=i;e!==s;++e,n+=4)o.copy(t[e]).applyMatrix4(r,a),o.normal.toArray(c,n),c[n+3]=o.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=s,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){const n=0!==t.length||e||0!==i||r;return r=e,i=t.length,n},this.beginShadows=function(){s=!0,c(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(t,e){n=c(t,e,0)},this.setState=function(o,a,h){const u=o.clippingPlanes,d=o.clipIntersection,p=o.clipShadows,A=t.get(o);if(!r||null===u||0===u.length||s&&!p)s?c(null):(l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0);else{const t=s?0:i,e=4*t;let r=A.clippingState||null;l.value=r,r=c(u,a,e,h);for(let t=0;t!==e;++t)r[t]=n[t];A.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function AA(t){let e=new WeakMap;function n(t,e){return e===ze?t.mapping=Qe:e===He&&(t.mapping=Ge),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping;if(s===ze||s===He){if(e.has(r))return n(e.get(r).texture,r.mapping);{const s=r.image;if(s&&s.height>0){const o=new Da(s.height);return o.fromEquirectangularTexture(t,r),e.set(r,o),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}const fA=[.125,.215,.35,.446,.526,.582],mA=new sd,gA=new Bo;let vA=null,yA=0,EA=0,xA=!1;const bA=(1+Math.sqrt(5))/2,CA=1/bA,wA=[new os(-bA,CA,0),new os(bA,CA,0),new os(-CA,0,bA),new os(CA,0,bA),new os(0,bA,-CA),new os(0,bA,CA),new os(-1,1,-1),new os(1,1,-1),new os(-1,1,1),new os(1,1,1)];class _A{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){vA=this._renderer.getRenderTarget(),yA=this._renderer.getActiveCubeFace(),EA=this._renderer.getActiveMipmapLevel(),xA=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=BA(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=IA(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(vA,yA,EA),this._renderer.xr.enabled=xA,t.scissorTest=!1,SA(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===Qe||t.mapping===Ge?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),vA=this._renderer.getRenderTarget(),yA=this._renderer.getActiveCubeFace(),EA=this._renderer.getActiveMipmapLevel(),xA=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:$e,minFilter:$e,generateMipmaps:!1,type:dn,format:yn,colorSpace:Ti,depthBuffer:!1},i=MA(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=MA(t,e,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],n=[],i=[];let r=t;const s=t-4+1+fA.length;for(let o=0;o<s;o++){const s=Math.pow(2,r);n.push(s);let a=1/s;o>t-4?a=fA[o-t+4-1]:0===o&&(a=0),i.push(a);const l=1/(s-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,A=3,f=2,m=1,g=new Float32Array(A*p*d),v=new Float32Array(f*p*d),y=new Float32Array(m*p*d);for(let t=0;t<d;t++){const e=t%3*2/3-1,n=t>2?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,A*p*t),v.set(u,f*p*t);const r=[t,t,t,t,t,t];y.set(r,m*p*t)}const E=new sa;E.setAttribute("position",new zo(g,A)),E.setAttribute("uv",new zo(v,f)),E.setAttribute("faceIndex",new zo(y,m)),e.push(E),r>4&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(t,e,n){const i=new Float32Array(20),r=new os(0,1,0);return new wa({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:Wt,depthTest:!1,depthWrite:!1})}(i,t,e)}return i}_compileMaterial(t){const e=new ga(this._lodPlanes[0],t);this._renderer.compile(e,mA)}_sceneToCubeUV(t,e,n,i){const r=new Ba(90,1,e,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,c=a.toneMapping;a.getClearColor(gA),a.toneMapping=Be,a.autoClear=!1;const h=new Do({name:"PMREM.Background",side:Vt,depthWrite:!1,depthTest:!1}),u=new ga(new ya,h);let d=!1;const p=t.background;p?p.isColor&&(h.color.copy(p),t.background=null,d=!0):(h.color.copy(gA),d=!0);for(let e=0;e<6;e++){const n=e%3;0===n?(r.up.set(0,s[e],0),r.lookAt(o[e],0,0)):1===n?(r.up.set(0,0,s[e]),r.lookAt(0,o[e],0)):(r.up.set(0,s[e],0),r.lookAt(0,0,o[e]));const l=this._cubeSize;SA(i,n*l,e>2?l:0,l,l),a.setRenderTarget(i),d&&a.render(u,r),a.render(t,r)}u.geometry.dispose(),u.material.dispose(),a.toneMapping=c,a.autoClear=l,t.background=p}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===Qe||t.mapping===Ge;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=BA()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=IA());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new ga(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const o=this._cubeSize;SA(e,0,0,3*o,2*o),n.setRenderTarget(e),n.render(s,mA)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const i=this._lodPlanes.length;for(let e=1;e<i;e++){const n=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),r=wA[(i-e-1)%wA.length];this._blur(t,e-1,e,n,r)}e.autoClear=n}_blur(t,e,n,i,r){const s=this._pingPongRenderTarget;this._halfBlur(t,s,e,n,i,"latitudinal",r),this._halfBlur(s,t,n,n,i,"longitudinal",r)}_halfBlur(t,e,n,i,r,s,o){const a=this._renderer,l=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new ga(this._lodPlanes[i],l),h=l.uniforms,u=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/d,A=isFinite(r)?1+Math.floor(3*p):20;A>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${A} samples when the maximum is set to 20`);const f=[];let m=0;for(let t=0;t<20;++t){const e=t/p,n=Math.exp(-e*e/2);f.push(n),0===t?m+=n:t<A&&(m+=2*n)}for(let t=0;t<f.length;t++)f[t]=f[t]/m;h.envMap.value=t.texture,h.samples.value=A,h.weights.value=f,h.latitudinal.value="latitudinal"===s,o&&(h.poleAxis.value=o);const{_lodMax:g}=this;h.dTheta.value=d,h.mipInt.value=g-n;const v=this._sizeLods[i];SA(e,3*v*(i>g-4?i-g+4:0),4*(this._cubeSize-v),3*v,2*v),a.setRenderTarget(e),a.render(c,mA)}}function MA(t,e,n){const i=new ts(t,e,n);return i.texture.mapping=Ve,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function SA(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function IA(){return new wa({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:Wt,depthTest:!1,depthWrite:!1})}function BA(){return new wa({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:Wt,depthTest:!1,depthWrite:!1})}function TA(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,o=s===ze||s===He,a=s===Qe||s===Ge;if(o||a){let s=e.get(r);const l=void 0!==s?s.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new _A(t)),s=o?n.fromEquirectangular(r,s):n.fromCubemap(r,s),s.texture.pmremVersion=r.pmremVersion,e.set(r,s),s.texture;if(void 0!==s)return s.texture;{const l=r.image;return o&&l&&l.height>0||a&&l&&function(t){let e=0;for(let n=0;n<6;n++)void 0!==t[n]&&e++;return 6===e}(l)?(null===n&&(n=new _A(t)),s=o?n.fromEquirectangular(r):n.fromCubemap(r),s.texture.pmremVersion=r.pmremVersion,e.set(r,s),r.addEventListener("dispose",i),s.texture):null}}}return r},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function RA(t){const e={};function n(n){if(void 0!==e[n])return 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,i}return{has:function(t){return null!==n(t)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(t){const e=n(t);return null===e&&kr("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function LA(t,e,n,i){const r={},s=new WeakMap;function o(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const t in a.attributes)e.remove(a.attributes[t]);a.removeEventListener("dispose",o),delete r[a.id];const l=s.get(a);l&&(e.remove(l),s.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],i=t.index,r=t.attributes.position;let o=0;if(null!==i){const t=i.array;o=i.version;for(let e=0,i=t.length;e<i;e+=3){const i=t[e+0],r=t[e+1],s=t[e+2];n.push(i,r,r,s,s,i)}}else{if(void 0===r)return;{const t=r.array;o=r.version;for(let e=0,i=t.length/3-1;e<i;e+=3){const t=e+0,i=e+1,r=e+2;n.push(t,i,i,r,r,t)}}}const a=new(Lr(n)?Yo:qo)(n,1);a.version=o;const l=s.get(t);l&&e.remove(l),s.set(t,a)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",o),r[e.id]=!0,n.memory.geometries++),e},update:function(n){const i=n.attributes;for(const n in i)e.update(i[n],t.ARRAY_BUFFER)},getWireframeAttribute:function(t){const e=s.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&a(t)}else a(t);return s.get(t)}}}function DA(t,e,n){let i,r,s;function o(e,o,a){0!==a&&(t.drawElementsInstanced(i,o,r,e*s,a),n.update(o,i,a))}this.setMode=function(t){i=t},this.setIndex=function(t){r=t.type,s=t.bytesPerElement},this.render=function(e,o){t.drawElements(i,o,r,e*s),n.update(o,i,1)},this.renderInstances=o,this.renderMultiDraw=function(t,s,o){if(0===o)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,s,0,r,t,0,o);let a=0;for(let t=0;t<o;t++)a+=s[t];n.update(a,i,1)},this.renderMultiDrawInstances=function(t,a,l,c){if(0===l)return;const h=e.get("WEBGL_multi_draw");if(null===h)for(let e=0;e<t.length;e++)o(t[e]/s,a[e],c[e]);else{h.multiDrawElementsInstancedWEBGL(i,a,0,r,t,0,c,0,l);let e=0;for(let t=0;t<l;t++)e+=a[t]*c[t];n.update(e,i,1)}}}function PA(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(n,i,r){switch(e.calls++,i){case t.TRIANGLES:e.triangles+=r*(n/3);break;case t.LINES:e.lines+=r*(n/2);break;case t.LINE_STRIP:e.lines+=r*(n-1);break;case t.LINE_LOOP:e.lines+=r*n;break;case t.POINTS:e.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function UA(t,e,n){const i=new WeakMap,r=new Zr;return{update:function(s,o,a){const l=s.morphTargetInfluences,c=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=void 0!==c?c.length:0;let u=i.get(o);if(void 0===u||u.count!==h){void 0!==u&&u.texture.dispose();const d=void 0!==o.morphAttributes.position,p=void 0!==o.morphAttributes.normal,A=void 0!==o.morphAttributes.color,f=o.morphAttributes.position||[],m=o.morphAttributes.normal||[],g=o.morphAttributes.color||[];let v=0;!0===d&&(v=1),!0===p&&(v=2),!0===A&&(v=3);let y=o.attributes.position.count*v,E=1;y>e.maxTextureSize&&(E=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const x=new Float32Array(y*E*4*h),b=new es(x,y,E,h);b.type=un,b.needsUpdate=!0;const C=4*v;for(let _=0;_<h;_++){const M=f[_],S=m[_],I=g[_],B=y*E*4*_;for(let T=0;T<M.count;T++){const R=T*C;!0===d&&(r.fromBufferAttribute(M,T),x[B+R+0]=r.x,x[B+R+1]=r.y,x[B+R+2]=r.z,x[B+R+3]=0),!0===p&&(r.fromBufferAttribute(S,T),x[B+R+4]=r.x,x[B+R+5]=r.y,x[B+R+6]=r.z,x[B+R+7]=0),!0===A&&(r.fromBufferAttribute(I,T),x[B+R+8]=r.x,x[B+R+9]=r.y,x[B+R+10]=r.z,x[B+R+11]=4===I.itemSize?r.w:1)}}function w(){b.dispose(),i.delete(o),o.removeEventListener("dispose",w)}u={count:h,texture:b,size:new Br(y,E)},i.set(o,u),o.addEventListener("dispose",w)}if(!0===s.isInstancedMesh&&null!==s.morphTexture)a.getUniforms().setValue(t,"morphTexture",s.morphTexture,n);else{let L=0;for(let P=0;P<l.length;P++)L+=l[P];const D=o.morphTargetsRelative?1:1-L;a.getUniforms().setValue(t,"morphTargetBaseInfluence",D),a.getUniforms().setValue(t,"morphTargetInfluences",l)}a.getUniforms().setValue(t,"morphTargetsTexture",u.texture,n),a.getUniforms().setValue(t,"morphTargetsTextureSize",u.size)}}}class OA{constructor(t,e,n){if(this.renderer=t,this.DEFAULT_NUMVIEWS=2,this.maxNumViews=0,this.gl=n,this.extensions=e,this.available=this.extensions.has("OCULUS_multiview"),this.available){const t=this.extensions.get("OCULUS_multiview");this.maxNumViews=this.gl.getParameter(t.MAX_VIEWS_OVR),this.mat4=[],this.mat3=[],this.cameraArray=[];for(var i=0;i<this.maxNumViews;i++)this.mat4[i]=new Os,this.mat3[i]=new Tr}}getCameraArray(t){return t.isArrayCamera?t.cameras:(this.cameraArray[0]=t,this.cameraArray)}updateCameraProjectionMatricesUniform(t,e){for(var n=this.getCameraArray(t),i=0;i<n.length;i++)this.mat4[i].copy(n[i].projectionMatrix);e.setValue(this.gl,"projectionMatrices",this.mat4)}updateCameraViewMatricesUniform(t,e){for(var n=this.getCameraArray(t),i=0;i<n.length;i++)this.mat4[i].copy(n[i].matrixWorldInverse);e.setValue(this.gl,"viewMatrices",this.mat4)}updateObjectMatricesUniforms(t,e,n){for(var i=this.getCameraArray(e),r=0;r<i.length;r++)this.mat4[r].multiplyMatrices(i[r].matrixWorldInverse,t.matrixWorld),this.mat3[r].getNormalMatrix(this.mat4[r]);n.setValue(this.gl,"modelViewMatrices",this.mat4),n.setValue(this.gl,"normalMatrices",this.mat3)}}function FA(t,e,n,i){let r=new WeakMap;function s(t){const e=t.target;e.removeEventListener("dispose",s),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(o){const a=i.render.frame,l=o.geometry,c=e.get(o,l);if(r.get(c)!==a&&(e.update(c),r.set(c,a)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",s)&&o.addEventListener("dispose",s),r.get(o)!==a&&(n.update(o.instanceMatrix,t.ARRAY_BUFFER),null!==o.instanceColor&&n.update(o.instanceColor,t.ARRAY_BUFFER),r.set(o,a))),o.isSkinnedMesh){const t=o.skeleton;r.get(t)!==a&&(t.update(),r.set(t,a))}return c},dispose:function(){r=new WeakMap}}}const kA=new Kr,NA=new Rc(1,1),QA=new es,GA=new is,zA=new La,HA=[],VA=[],jA=new Float32Array(16),WA=new Float32Array(9),qA=new Float32Array(4);function XA(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let s=HA[r];if(void 0===s&&(s=new Float32Array(r),HA[r]=s),0!==e){i.toArray(s,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(s,r)}return s}function YA(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function JA(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function KA(t,e){let n=VA[e];void 0===n&&(n=new Int32Array(e),VA[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function ZA(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function $A(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(YA(n,e))return;t.uniform2fv(this.addr,e),JA(n,e)}}function tf(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(YA(n,e))return;t.uniform3fv(this.addr,e),JA(n,e)}}function ef(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(YA(n,e))return;t.uniform4fv(this.addr,e),JA(n,e)}}function nf(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(YA(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),JA(n,e)}else{if(YA(n,i))return;qA.set(i),t.uniformMatrix2fv(this.addr,!1,qA),JA(n,i)}}function rf(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(YA(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),JA(n,e)}else{if(YA(n,i))return;WA.set(i),t.uniformMatrix3fv(this.addr,!1,WA),JA(n,i)}}function sf(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(YA(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),JA(n,e)}else{if(YA(n,i))return;jA.set(i),t.uniformMatrix4fv(this.addr,!1,jA),JA(n,i)}}function of(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function af(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(YA(n,e))return;t.uniform2iv(this.addr,e),JA(n,e)}}function lf(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(YA(n,e))return;t.uniform3iv(this.addr,e),JA(n,e)}}function cf(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(YA(n,e))return;t.uniform4iv(this.addr,e),JA(n,e)}}function hf(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function uf(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(YA(n,e))return;t.uniform2uiv(this.addr,e),JA(n,e)}}function df(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(YA(n,e))return;t.uniform3uiv(this.addr,e),JA(n,e)}}function pf(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(YA(n,e))return;t.uniform4uiv(this.addr,e),JA(n,e)}}function Af(t,e,n){const i=this.cache,r=n.allocateTextureUnit();let s;i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),this.type===t.SAMPLER_2D_SHADOW?(NA.compareFunction=Zi,s=NA):s=kA,n.setTexture2D(e||s,r)}function ff(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||GA,r)}function mf(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||zA,r)}function gf(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||QA,r)}function vf(t,e){t.uniform1fv(this.addr,e)}function yf(t,e){const n=XA(e,this.size,2);t.uniform2fv(this.addr,n)}function Ef(t,e){const n=XA(e,this.size,3);t.uniform3fv(this.addr,n)}function xf(t,e){const n=XA(e,this.size,4);t.uniform4fv(this.addr,n)}function bf(t,e){const n=XA(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Cf(t,e){const n=XA(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function wf(t,e){const n=XA(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function _f(t,e){t.uniform1iv(this.addr,e)}function Mf(t,e){t.uniform2iv(this.addr,e)}function Sf(t,e){t.uniform3iv(this.addr,e)}function If(t,e){t.uniform4iv(this.addr,e)}function Bf(t,e){t.uniform1uiv(this.addr,e)}function Tf(t,e){t.uniform2uiv(this.addr,e)}function Rf(t,e){t.uniform3uiv(this.addr,e)}function Lf(t,e){t.uniform4uiv(this.addr,e)}function Df(t,e,n){const i=this.cache,r=e.length,s=KA(n,r);YA(i,s)||(t.uniform1iv(this.addr,s),JA(i,s));for(let t=0;t!==r;++t)n.setTexture2D(e[t]||kA,s[t])}function Pf(t,e,n){const i=this.cache,r=e.length,s=KA(n,r);YA(i,s)||(t.uniform1iv(this.addr,s),JA(i,s));for(let t=0;t!==r;++t)n.setTexture3D(e[t]||GA,s[t])}function Uf(t,e,n){const i=this.cache,r=e.length,s=KA(n,r);YA(i,s)||(t.uniform1iv(this.addr,s),JA(i,s));for(let t=0;t!==r;++t)n.setTextureCube(e[t]||zA,s[t])}function Of(t,e,n){const i=this.cache,r=e.length,s=KA(n,r);YA(i,s)||(t.uniform1iv(this.addr,s),JA(i,s));for(let t=0;t!==r;++t)n.setTexture2DArray(e[t]||QA,s[t])}class Ff{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=function(t){switch(t){case 5126:return ZA;case 35664:return $A;case 35665:return tf;case 35666:return ef;case 35674:return nf;case 35675:return rf;case 35676:return sf;case 5124:case 35670:return of;case 35667:case 35671:return af;case 35668:case 35672:return lf;case 35669:case 35673:return cf;case 5125:return hf;case 36294:return uf;case 36295:return df;case 36296:return pf;case 35678:case 36198:case 36298:case 36306:case 35682:return Af;case 35679:case 36299:case 36307:return ff;case 35680:case 36300:case 36308:case 36293:return mf;case 36289:case 36303:case 36311:case 36292:return gf}}(e.type)}}class kf{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return vf;case 35664:return yf;case 35665:return Ef;case 35666:return xf;case 35674:return bf;case 35675:return Cf;case 35676:return wf;case 5124:case 35670:return _f;case 35667:case 35671:return Mf;case 35668:case 35672:return Sf;case 35669:case 35673:return If;case 5125:return Bf;case 36294:return Tf;case 36295:return Rf;case 36296:return Lf;case 35678:case 36198:case 36298:case 36306:case 35682:return Df;case 35679:case 36299:case 36307:return Pf;case 35680:case 36300:case 36308:case 36293:return Uf;case 36289:case 36303:case 36311:case 36292:return Of}}(e.type)}}class Nf{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){const i=this.seq;for(let r=0,s=i.length;r!==s;++r){const s=i[r];s.setValue(t,e[s.id],n)}}}const Qf=/(\w+)(\])?(\[|\.)?/g;function Gf(t,e){t.seq.push(e),t.map[e.id]=e}function zf(t,e,n){const i=t.name,r=i.length;for(Qf.lastIndex=0;;){const s=Qf.exec(i),o=Qf.lastIndex;let a=s[1];const l="]"===s[2],c=s[3];if(l&&(a|=0),void 0===c||"["===c&&o+2===r){Gf(n,void 0===c?new Ff(a,t,e):new kf(a,t,e));break}{let t=n.map[a];void 0===t&&(t=new Nf(a),Gf(n,t)),n=t}}}class Hf{constructor(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=t.getActiveUniform(e,i);zf(n,t.getUniformLocation(e,n.name),this)}}setValue(t,e,n,i){const r=this.map[e];void 0!==r&&r.setValue(t,n,i)}setOptional(t,e,n){const i=e[n];void 0!==i&&this.setValue(t,n,i)}static upload(t,e,n,i){for(let r=0,s=e.length;r!==s;++r){const s=e[r],o=n[s.id];!1!==o.needsUpdate&&s.setValue(t,o.value,i)}}static seqWithValue(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const r=t[i];r.id in e&&n.push(r)}return n}}function Vf(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}let jf=0;const Wf=new Tr;function qf(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();if(i&&""===r)return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const i=parseInt(s[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(t,e){const n=t.split("\n"),i=[],r=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let t=r;t<s;t++){const r=t+1;i.push(`${r===e?">":" "} ${r}: ${n[t]}`)}return i.join("\n")}(t.getShaderSource(e),i)}return r}function Xf(t,e){const n=function(t){zr._getMatrix(Wf,zr.workingColorSpace,t);const e=`mat3( ${Wf.elements.map((t=>t.toFixed(4)))} )`;switch(zr.getTransfer(t)){case Ri:return[e,"LinearTransferOETF"];case Li:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}(e);return[`vec4 ${t}( vec4 value ) {`,`\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join("\n")}function Yf(t,e){let n;switch(e){case Te:n="Linear";break;case Re:n="Reinhard";break;case Le:n="Cineon";break;case De:n="ACESFilmic";break;case Ue:n="AgX";break;case Oe:n="Neutral";break;case Pe:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const Jf=new os;function Kf(t){return""!==t}function Zf(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function $f(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const tm=/^[ \t]*#include +<([\w\d./]+)>/gm;function em(t){return t.replace(tm,im)}const nm=new Map;function im(t,e){let n=iA[e];if(void 0===n){const t=nm.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");n=iA[t],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,t)}return em(n)}const rm=/#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 sm(t){return t.replace(rm,om)}function om(t,e,n,i){let r="";for(let t=parseInt(e);t<parseInt(n);t++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function am(t){let e=`precision ${t.precision} float;\n\tprecision ${t.precision} int;\n\tprecision ${t.precision} sampler2D;\n\tprecision ${t.precision} samplerCube;\n\tprecision ${t.precision} sampler3D;\n\tprecision ${t.precision} sampler2DArray;\n\tprecision ${t.precision} sampler2DShadow;\n\tprecision ${t.precision} samplerCubeShadow;\n\tprecision ${t.precision} sampler2DArrayShadow;\n\tprecision ${t.precision} isampler2D;\n\tprecision ${t.precision} isampler3D;\n\tprecision ${t.precision} isamplerCube;\n\tprecision ${t.precision} isampler2DArray;\n\tprecision ${t.precision} usampler2D;\n\tprecision ${t.precision} usampler3D;\n\tprecision ${t.precision} usamplerCube;\n\tprecision ${t.precision} usampler2DArray;\n\t`;return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function lm(t,e,n,i){const r=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===Qt?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===Gt?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===zt&&(e="SHADOWMAP_TYPE_VSM"),e}(n),c=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Qe:case Ge:e="ENVMAP_TYPE_CUBE";break;case Ve:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),h=function(t){let e="ENVMAP_MODE_REFLECTION";return t.envMap&&t.envMapMode===Ge&&(e="ENVMAP_MODE_REFRACTION"),e}(n),u=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case Me:e="ENVMAP_BLENDING_MULTIPLY";break;case Se:e="ENVMAP_BLENDING_MIX";break;case Ie:e="ENVMAP_BLENDING_ADD"}return e}(n),d=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),p=function(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Kf).join("\n")}(n),A=function(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(s),f=r.createProgram();let m,g,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";const y=n.numMultiviewViews;n.isRawShaderMaterial?(m=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A].filter(Kf).join("\n"),m.length>0&&(m+="\n"),g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A].filter(Kf).join("\n"),g.length>0&&(g+="\n")):(m=[am(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",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.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Kf).join("\n"),g=[am(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",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 "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",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.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Be?"#define TONE_MAPPING":"",n.toneMapping!==Be?iA.tonemapping_pars_fragment:"",n.toneMapping!==Be?Yf("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",iA.colorspace_pars_fragment,Xf("linearToOutputTexel",n.outputColorSpace),(zr.getLuminanceCoefficients(Jf),["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${Jf.x.toFixed(4)}, ${Jf.y.toFixed(4)}, ${Jf.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Kf).join("\n")),o=em(o),o=Zf(o,n),o=$f(o,n),a=em(a),a=Zf(a,n),a=$f(a,n),o=sm(o),a=sm(a),!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,g=["#define varying in",n.glslVersion===pr?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===pr?"":"#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"+g,y>0&&(m=["#extension GL_OVR_multiview : require","layout(num_views = "+y+") in;","#define VIEW_ID gl_ViewID_OVR"].join("\n")+"\n"+m,m=m.replace(["uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;"].join("\n"),["uniform mat4 modelViewMatrices["+y+"];","uniform mat4 projectionMatrices["+y+"];","uniform mat4 viewMatrices["+y+"];","uniform mat3 normalMatrices["+y+"];","#define modelViewMatrix modelViewMatrices[VIEW_ID]","#define projectionMatrix projectionMatrices[VIEW_ID]","#define viewMatrix viewMatrices[VIEW_ID]","#define normalMatrix normalMatrices[VIEW_ID]"].join("\n")),g=["#extension GL_OVR_multiview : require","#define VIEW_ID gl_ViewID_OVR"].join("\n")+"\n"+g,g=g.replace("uniform mat4 viewMatrix;",["uniform mat4 viewMatrices["+y+"];","#define viewMatrix viewMatrices[VIEW_ID]"].join("\n"))));const E=v+m+o,x=v+g+a,b=Vf(r,r.VERTEX_SHADER,E),C=Vf(r,r.FRAGMENT_SHADER,x);function w(e){if(t.debug.checkShaderErrors){const n=r.getProgramInfoLog(f).trim(),i=r.getShaderInfoLog(b).trim(),s=r.getShaderInfoLog(C).trim();let o=!0,a=!0;if(!1===r.getProgramParameter(f,r.LINK_STATUS))if(o=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(r,f,b,C);else{const t=qf(r,b,"vertex"),i=qf(r,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(f,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+e.name+"\nMaterial Type: "+e.type+"\n\nProgram Info Log: "+n+"\n"+t+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==s||(a=!1);a&&(e.diagnostics={runnable:o,programLog:n,vertexShader:{log:i,prefix:m},fragmentShader:{log:s,prefix:g}})}r.deleteShader(b),r.deleteShader(C),_=new Hf(r,f),M=function(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=t.getActiveAttrib(e,r),s=i.name;let o=1;i.type===t.FLOAT_MAT2&&(o=2),i.type===t.FLOAT_MAT3&&(o=3),i.type===t.FLOAT_MAT4&&(o=4),n[s]={type:i.type,location:t.getAttribLocation(e,s),locationSize:o}}return n}(r,f)}let _,M;r.attachShader(f,b),r.attachShader(f,C),void 0!==n.index0AttributeName?r.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(f,0,"position"),r.linkProgram(f),this.getUniforms=function(){return void 0===_&&w(this),_},this.getAttributes=function(){return void 0===M&&w(this),M};let S=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===S&&(S=r.getProgramParameter(f,37297)),S},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(f),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=jf++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=b,this.fragmentShader=C,this.numMultiviewViews=y,this}let cm=0;class hm{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),s=this._getShaderCacheForMaterial(t);return!1===s.has(i)&&(s.add(i),i.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return void 0===n&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return void 0===n&&(n=new um(t),e.set(t,n)),n}}class um{constructor(t){this.id=cm++,this.code=t,this.usedTimes=0}}function dm(t,e,n,i,r,s,o){const a=new qs,l=new hm,c=new Set,h=[],u=r.logarithmicDepthBuffer,d=r.vertexTextures;let p=r.precision;const A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function f(t){return c.add(t),0===t?"uv":`uv${t}`}return{getParameters:function(s,a,h,m,g){const v=m.fog,y=g.geometry,E=s.isMeshStandardMaterial?m.environment:null,x=(s.isMeshStandardMaterial?n:e).get(s.envMap||E),b=x&&x.mapping===Ve?x.image.height:null,C=A[s.type];null!==s.precision&&(p=r.getMaxPrecision(s.precision),p!==s.precision&&console.warn("THREE.WebGLProgram.getParameters:",s.precision,"not supported, using",p,"instead."));const w=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,_=void 0!==w?w.length:0;let M,S,I,B,T=0;if(void 0!==y.morphAttributes.position&&(T=1),void 0!==y.morphAttributes.normal&&(T=2),void 0!==y.morphAttributes.color&&(T=3),C){const t=sA[C];M=t.vertexShader,S=t.fragmentShader}else M=s.vertexShader,S=s.fragmentShader,l.update(s),I=l.getVertexShaderID(s),B=l.getFragmentShaderID(s);const R=t.getRenderTarget(),L=t.state.buffers.depth.getReversed(),D=R&&R.isWebGLMultiviewRenderTarget?R.numViews:0,P=!0===g.isInstancedMesh,U=!0===g.isBatchedMesh,O=!!s.map,F=!!s.matcap,k=!!x,N=!!s.aoMap,Q=!!s.lightMap,G=!!s.bumpMap,z=!!s.normalMap,H=!!s.displacementMap,V=!!s.emissiveMap,j=!!s.metalnessMap,W=!!s.roughnessMap,q=s.anisotropy>0,X=s.clearcoat>0,Y=s.dispersion>0,J=s.iridescence>0,K=s.sheen>0,Z=s.transmission>0,$=q&&!!s.anisotropyMap,tt=X&&!!s.clearcoatMap,et=X&&!!s.clearcoatNormalMap,nt=X&&!!s.clearcoatRoughnessMap,it=J&&!!s.iridescenceMap,rt=J&&!!s.iridescenceThicknessMap,st=K&&!!s.sheenColorMap,ot=K&&!!s.sheenRoughnessMap,at=!!s.specularMap,lt=!!s.specularColorMap,ct=!!s.specularIntensityMap,ht=Z&&!!s.transmissionMap,ut=Z&&!!s.thicknessMap,dt=!!s.gradientMap,pt=!!s.alphaMap,At=s.alphaTest>0,ft=!!s.alphaHash,mt=!!s.extensions;let gt=Be;s.toneMapped&&(null!==R&&!0!==R.isXRRenderTarget||(gt=t.toneMapping));const vt={shaderID:C,shaderType:s.type,shaderName:s.name,vertexShader:M,fragmentShader:S,defines:s.defines,customVertexShaderID:I,customFragmentShaderID:B,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,batching:U,batchingColor:U&&null!==g._colorsTexture,instancing:P,instancingColor:P&&null!==g.instanceColor,instancingMorph:P&&null!==g.morphTexture,supportsVertexTextures:d,numMultiviewViews:D,outputColorSpace:null===R?t.outputColorSpace:!0===R.isXRRenderTarget?R.texture.colorSpace:Ti,alphaToCoverage:!!s.alphaToCoverage,map:O,matcap:F,envMap:k,envMapMode:k&&x.mapping,envMapCubeUVHeight:b,aoMap:N,lightMap:Q,bumpMap:G,normalMap:z,displacementMap:d&&H,emissiveMap:V,normalMapObjectSpace:z&&s.normalMapType===Si,normalMapTangentSpace:z&&s.normalMapType===Mi,metalnessMap:j,roughnessMap:W,anisotropy:q,anisotropyMap:$,clearcoat:X,clearcoatMap:tt,clearcoatNormalMap:et,clearcoatRoughnessMap:nt,dispersion:Y,iridescence:J,iridescenceMap:it,iridescenceThicknessMap:rt,sheen:K,sheenColorMap:st,sheenRoughnessMap:ot,specularMap:at,specularColorMap:lt,specularIntensityMap:ct,transmission:Z,transmissionMap:ht,thicknessMap:ut,gradientMap:dt,opaque:!1===s.transparent&&s.blending===qt&&!1===s.alphaToCoverage,alphaMap:pt,alphaTest:At,alphaHash:ft,combine:s.combine,mapUv:O&&f(s.map.channel),aoMapUv:N&&f(s.aoMap.channel),lightMapUv:Q&&f(s.lightMap.channel),bumpMapUv:G&&f(s.bumpMap.channel),normalMapUv:z&&f(s.normalMap.channel),displacementMapUv:H&&f(s.displacementMap.channel),emissiveMapUv:V&&f(s.emissiveMap.channel),metalnessMapUv:j&&f(s.metalnessMap.channel),roughnessMapUv:W&&f(s.roughnessMap.channel),anisotropyMapUv:$&&f(s.anisotropyMap.channel),clearcoatMapUv:tt&&f(s.clearcoatMap.channel),clearcoatNormalMapUv:et&&f(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:nt&&f(s.clearcoatRoughnessMap.channel),iridescenceMapUv:it&&f(s.iridescenceMap.channel),iridescenceThicknessMapUv:rt&&f(s.iridescenceThicknessMap.channel),sheenColorMapUv:st&&f(s.sheenColorMap.channel),sheenRoughnessMapUv:ot&&f(s.sheenRoughnessMap.channel),specularMapUv:at&&f(s.specularMap.channel),specularColorMapUv:lt&&f(s.specularColorMap.channel),specularIntensityMapUv:ct&&f(s.specularIntensityMap.channel),transmissionMapUv:ht&&f(s.transmissionMap.channel),thicknessMapUv:ut&&f(s.thicknessMap.channel),alphaMapUv:pt&&f(s.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(z||q),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,pointsUvs:!0===g.isPoints&&!!y.attributes.uv&&(O||pt),fog:!!v,useFog:!0===s.fog,fogExp2:!!v&&v.isFogExp2,flatShading:!0===s.flatShading,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:u,reverseDepthBuffer:L,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:_,morphTextureStride:T,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numSpotLightMaps:a.spotLightMap.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numSpotLightShadowsWithMaps:a.numSpotLightShadowsWithMaps,numLightProbes:a.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:gt,decodeVideoTexture:O&&!0===s.map.isVideoTexture&&zr.getTransfer(s.map.colorSpace)===Li,decodeVideoTextureEmissive:V&&!0===s.emissiveMap.isVideoTexture&&zr.getTransfer(s.emissiveMap.colorSpace)===Li,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===jt,flipSided:s.side===Vt,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionClipCullDistance:mt&&!0===s.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(mt&&!0===s.extensions.multiDraw||U)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:s.customProgramCacheKey()};return vt.vertexUv1s=c.has(1),vt.vertexUv2s=c.has(2),vt.vertexUv3s=c.has(3),c.clear(),vt},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(n,e),function(t,e){a.disableAll(),e.supportsVertexTextures&&a.enable(0),e.instancing&&a.enable(1),e.instancingColor&&a.enable(2),e.instancingMorph&&a.enable(3),e.matcap&&a.enable(4),e.envMap&&a.enable(5),e.normalMapObjectSpace&&a.enable(6),e.normalMapTangentSpace&&a.enable(7),e.clearcoat&&a.enable(8),e.iridescence&&a.enable(9),e.alphaTest&&a.enable(10),e.vertexColors&&a.enable(11),e.vertexAlphas&&a.enable(12),e.vertexUv1s&&a.enable(13),e.vertexUv2s&&a.enable(14),e.vertexUv3s&&a.enable(15),e.vertexTangents&&a.enable(16),e.anisotropy&&a.enable(17),e.alphaHash&&a.enable(18),e.batching&&a.enable(19),e.dispersion&&a.enable(20),e.batchingColor&&a.enable(21),t.push(a.mask),a.disableAll(),e.fog&&a.enable(0),e.useFog&&a.enable(1),e.flatShading&&a.enable(2),e.logarithmicDepthBuffer&&a.enable(3),e.reverseDepthBuffer&&a.enable(4),e.skinning&&a.enable(5),e.morphTargets&&a.enable(6),e.morphNormals&&a.enable(7),e.morphColors&&a.enable(8),e.premultipliedAlpha&&a.enable(9),e.shadowMapEnabled&&a.enable(10),e.doubleSided&&a.enable(11),e.flipSided&&a.enable(12),e.useDepthPacking&&a.enable(13),e.dithering&&a.enable(14),e.transmission&&a.enable(15),e.sheen&&a.enable(16),e.opaque&&a.enable(17),e.pointsUvs&&a.enable(18),e.decodeVideoTexture&&a.enable(19),e.decodeVideoTextureEmissive&&a.enable(20),e.alphaToCoverage&&a.enable(21),e.numMultiviewViews&&a.enable(21),t.push(a.mask)}(n,e),n.push(t.outputColorSpace)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=A[t.type];let n;if(e){const t=sA[e];n=Ca.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=h.length;t<e;t++){const e=h[t];if(e.cacheKey===n){i=e,++i.usedTimes;break}}return void 0===i&&(i=new lm(t,n,e,s),h.push(i)),i},releaseProgram:function(t){if(0==--t.usedTimes){const e=h.indexOf(t);h[e]=h[h.length-1],h.pop(),t.destroy()}},releaseShaderCache:function(t){l.remove(t)},programs:h,dispose:function(){l.dispose()}}}function pm(){let t=new WeakMap;return{has:function(e){return t.has(e)},get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function Am(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function fm(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function mm(){const t=[];let e=0;const n=[],i=[],r=[];function s(n,i,r,s,o,a){let l=t[e];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:s,renderOrder:n.renderOrder,z:o,group:a},t[e]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=s,l.renderOrder=n.renderOrder,l.z=o,l.group=a),e++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){e=0,n.length=0,i.length=0,r.length=0},push:function(t,e,o,a,l,c){const h=s(t,e,o,a,l,c);o.transmission>0?i.push(h):!0===o.transparent?r.push(h):n.push(h)},unshift:function(t,e,o,a,l,c){const h=s(t,e,o,a,l,c);o.transmission>0?i.unshift(h):!0===o.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=e,i=t.length;n<i;n++){const e=t[n];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){n.length>1&&n.sort(t||Am),i.length>1&&i.sort(e||fm),r.length>1&&r.sort(e||fm)}}}function gm(){let t=new WeakMap;return{get:function(e,n){const i=t.get(e);let r;return void 0===i?(r=new mm,t.set(e,[r])):n>=i.length?(r=new mm,i.push(r)):r=i[n],r},dispose:function(){t=new WeakMap}}}function vm(){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 os,color:new Bo};break;case"SpotLight":n={position:new os,direction:new os,color:new Bo,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new os,color:new Bo,distance:0,decay:0};break;case"HemisphereLight":n={direction:new os,skyColor:new Bo,groundColor:new Bo};break;case"RectAreaLight":n={color:new Bo,position:new os,halfWidth:new os,halfHeight:new os}}return t[e.id]=n,n}}}let ym=0;function Em(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function xm(t){const e=new vm,n=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={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Br};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Br,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)i.probe.push(new os);const r=new os,s=new Os,o=new Os;return{setup:function(r){let s=0,o=0,a=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let l=0,c=0,h=0,u=0,d=0,p=0,A=0,f=0,m=0,g=0,v=0;r.sort(Em);for(let t=0,y=r.length;t<y;t++){const y=r[t],E=y.color,x=y.intensity,b=y.distance,C=y.shadow&&y.shadow.map?y.shadow.map.texture:null;if(y.isAmbientLight)s+=E.r*x,o+=E.g*x,a+=E.b*x;else if(y.isLightProbe){for(let t=0;t<9;t++)i.probe[t].addScaledVector(y.sh.coefficients[t],x);v++}else if(y.isDirectionalLight){const t=e.get(y);if(t.color.copy(y.color).multiplyScalar(y.intensity),y.castShadow){const t=y.shadow,e=n.get(y);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,i.directionalShadow[l]=e,i.directionalShadowMap[l]=C,i.directionalShadowMatrix[l]=y.shadow.matrix,p++}i.directional[l]=t,l++}else if(y.isSpotLight){const t=e.get(y);t.position.setFromMatrixPosition(y.matrixWorld),t.color.copy(E).multiplyScalar(x),t.distance=b,t.coneCos=Math.cos(y.angle),t.penumbraCos=Math.cos(y.angle*(1-y.penumbra)),t.decay=y.decay,i.spot[h]=t;const r=y.shadow;if(y.map&&(i.spotLightMap[m]=y.map,m++,r.updateMatrices(y),y.castShadow&&g++),i.spotLightMatrix[h]=r.matrix,y.castShadow){const t=n.get(y);t.shadowIntensity=r.intensity,t.shadowBias=r.bias,t.shadowNormalBias=r.normalBias,t.shadowRadius=r.radius,t.shadowMapSize=r.mapSize,i.spotShadow[h]=t,i.spotShadowMap[h]=C,f++}h++}else if(y.isRectAreaLight){const t=e.get(y);t.color.copy(E).multiplyScalar(x),t.halfWidth.set(.5*y.width,0,0),t.halfHeight.set(0,.5*y.height,0),i.rectArea[u]=t,u++}else if(y.isPointLight){const t=e.get(y);if(t.color.copy(y.color).multiplyScalar(y.intensity),t.distance=y.distance,t.decay=y.decay,y.castShadow){const t=y.shadow,e=n.get(y);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,e.shadowCameraNear=t.camera.near,e.shadowCameraFar=t.camera.far,i.pointShadow[c]=e,i.pointShadowMap[c]=C,i.pointShadowMatrix[c]=y.shadow.matrix,A++}i.point[c]=t,c++}else if(y.isHemisphereLight){const t=e.get(y);t.skyColor.copy(y.color).multiplyScalar(x),t.groundColor.copy(y.groundColor).multiplyScalar(x),i.hemi[d]=t,d++}}u>0&&(!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=rA.LTC_FLOAT_1,i.rectAreaLTC2=rA.LTC_FLOAT_2):(i.rectAreaLTC1=rA.LTC_HALF_1,i.rectAreaLTC2=rA.LTC_HALF_2)),i.ambient[0]=s,i.ambient[1]=o,i.ambient[2]=a;const y=i.hash;y.directionalLength===l&&y.pointLength===c&&y.spotLength===h&&y.rectAreaLength===u&&y.hemiLength===d&&y.numDirectionalShadows===p&&y.numPointShadows===A&&y.numSpotShadows===f&&y.numSpotMaps===m&&y.numLightProbes===v||(i.directional.length=l,i.spot.length=h,i.rectArea.length=u,i.point.length=c,i.hemi.length=d,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=A,i.pointShadowMap.length=A,i.spotShadow.length=f,i.spotShadowMap.length=f,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=A,i.spotLightMatrix.length=f+m-g,i.spotLightMap.length=m,i.numSpotLightShadowsWithMaps=g,i.numLightProbes=v,y.directionalLength=l,y.pointLength=c,y.spotLength=h,y.rectAreaLength=u,y.hemiLength=d,y.numDirectionalShadows=p,y.numPointShadows=A,y.numSpotShadows=f,y.numSpotMaps=m,y.numLightProbes=v,i.version=ym++)},setupView:function(t,e){let n=0,a=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=i.directional[n];t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(u),n++}else if(d.isSpotLight){const t=i.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(u),l++}else if(d.isRectAreaLight){const t=i.rectArea[c];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),o.identity(),s.copy(d.matrixWorld),s.premultiply(u),o.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(o),t.halfHeight.applyMatrix4(o),c++}else if(d.isPointLight){const t=i.point[a];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),a++}else if(d.isHemisphereLight){const t=i.hemi[h];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(u),h++}}},state:i}}function bm(t){const e=new xm(t),n=[],i=[],r={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:function(t){r.camera=t,n.length=0,i.length=0},state:r,setupLights:function(){e.setup(n)},setupLightsView:function(t){e.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){i.push(t)}}}function Cm(t){let e=new WeakMap;return{get:function(n,i=0){const r=e.get(n);let s;return void 0===r?(s=new bm(t),e.set(n,[s])):i>=r.length?(s=new bm(t),r.push(s)):s=r[i],s},dispose:function(){e=new WeakMap}}}function wm(t,e,n){let i=new kl;const r=new Br,s=new Br,o=new Zr,a=new cu({depthPacking:Ci}),l=new hu,c={},h=n.maxTextureSize,u={[Ht]:Vt,[Vt]:Ht,[jt]:jt},d=new wa({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Br},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const A=new sa;A.setAttribute("position",new zo(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const f=new ga(A,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Qt;let g=this.type;function v(n,i){const s=e.update(f);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new ts(r.x,r.y)),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,s,d,f,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,s,p,f,null)}function y(e,n,i,r){let s=null;const o=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==o)s=o;else if(s=!0===i.isPointLight?l:a,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const t=s.uuid,e=n.uuid;let i=c[t];void 0===i&&(i={},c[t]=i);let r=i[e];void 0===r&&(r=s.clone(),i[e]=r,n.addEventListener("dispose",x)),s=r}return s.visible=n.visible,s.wireframe=n.wireframe,s.side=r===zt?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:u[n.side],s.alphaMap=n.alphaMap,s.alphaTest=n.alphaTest,s.map=n.map,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.displacementMap=n.displacementMap,s.displacementScale=n.displacementScale,s.displacementBias=n.displacementBias,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===i.isPointLight&&!0===s.isMeshDistanceMaterial&&(t.properties.get(s).light=i),s}function E(n,r,s,o,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===zt)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=e.update(n),l=n.material;if(Array.isArray(l)){const e=i.groups;for(let c=0,h=e.length;c<h;c++){const h=e[c],u=l[h.materialIndex];if(u&&u.visible){const e=y(n,u,o,a);n.onBeforeShadow(t,n,r,s,i,e,h),t.renderBufferDirect(s,null,i,e,n,h),n.onAfterShadow(t,n,r,s,i,e,h)}}}else if(l.visible){const e=y(n,l,o,a);n.onBeforeShadow(t,n,r,s,i,e,null),t.renderBufferDirect(s,null,i,e,n,null),n.onAfterShadow(t,n,r,s,i,e,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)E(l[t],r,s,o,a)}function x(t){t.target.removeEventListener("dispose",x);for(const e in c){const n=c[e],i=t.target.uuid;i in n&&(n[i].dispose(),delete n[i])}}this.render=function(e,n,a){if(!1===m.enabled)return;if(!1===m.autoUpdate&&!1===m.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),c=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),d=t.state;d.setBlending(Wt),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);const p=g!==zt&&this.type===zt,A=g===zt&&this.type!==zt;for(let l=0,c=e.length;l<c;l++){const c=e[l],u=c.shadow;if(void 0===u){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;r.copy(u.mapSize);const f=u.getFrameExtents();if(r.multiply(f),s.copy(u.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/f.x),r.x=s.x*f.x,u.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/f.y),r.y=s.y*f.y,u.mapSize.y=s.y)),null===u.map||!0===p||!0===A){const t=this.type!==zt?{minFilter:Xe,magFilter:Xe}:{};null!==u.map&&u.map.dispose(),u.map=new ts(r.x,r.y,t),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const m=u.getViewportCount();for(let t=0;t<m;t++){const e=u.getViewport(t);o.set(s.x*e.x,s.y*e.y,s.x*e.z,s.y*e.w),d.viewport(o),u.updateMatrices(c,t),i=u.getFrustum(),E(n,a,u.camera,c,this.type)}!0!==u.isPointLightShadow&&this.type===zt&&v(u,a),u.needsUpdate=!1}g=this.type,m.needsUpdate=!1,t.setRenderTarget(l,c,u)}}const _m={[ve]:ye,[Ee]:we,[be]:_e,[xe]:Ce,[ye]:ve,[we]:Ee,[_e]:be,[Ce]:xe};function Mm(t,e){const n=new function(){let e=!1;const n=new Zr;let i=null;const r=new Zr(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,s,o,a){!0===a&&(e*=o,i*=o,s*=o),n.set(e,i,s,o),!1===r.equals(n)&&(t.clearColor(e,i,s,o),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},i=new function(){let n=!1,i=!1,r=null,s=null,o=null;return{setReversed:function(t){if(i!==t){const t=e.get("EXT_clip_control");i?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT);const n=o;o=null,this.setClear(n)}i=t},getReversed:function(){return i},setTest:function(e){e?Q(t.DEPTH_TEST):G(t.DEPTH_TEST)},setMask:function(e){r===e||n||(t.depthMask(e),r=e)},setFunc:function(e){if(i&&(e=_m[e]),s!==e){switch(e){case ve:t.depthFunc(t.NEVER);break;case ye:t.depthFunc(t.ALWAYS);break;case Ee:t.depthFunc(t.LESS);break;case xe:t.depthFunc(t.LEQUAL);break;case be:t.depthFunc(t.EQUAL);break;case Ce:t.depthFunc(t.GEQUAL);break;case we:t.depthFunc(t.GREATER);break;case _e:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}s=e}},setLocked:function(t){n=t},setClear:function(e){o!==e&&(i&&(e=1-e),t.clearDepth(e),o=e)},reset:function(){n=!1,r=null,s=null,o=null,i=!1}}},r=new function(){let e=!1,n=null,i=null,r=null,s=null,o=null,a=null,l=null,c=null;return{setTest:function(n){e||(n?Q(t.STENCIL_TEST):G(t.STENCIL_TEST))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,o){i===e&&r===n&&s===o||(t.stencilFunc(e,n,o),i=e,r=n,s=o)},setOp:function(e,n,i){o===e&&a===n&&l===i||(t.stencilOp(e,n,i),o=e,a=n,l=i)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,i=null,r=null,s=null,o=null,a=null,l=null,c=null}}},s=new WeakMap,o=new WeakMap;let a={},l={},c=new WeakMap,h=[],u=null,d=!1,p=null,A=null,f=null,m=null,g=null,v=null,y=null,E=new Bo(0,0,0),x=0,b=!1,C=null,w=null,_=null,M=null,S=null;const I=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let B=!1,T=0;const R=t.getParameter(t.VERSION);-1!==R.indexOf("WebGL")?(T=parseFloat(/^WebGL (\d)/.exec(R)[1]),B=T>=1):-1!==R.indexOf("OpenGL ES")&&(T=parseFloat(/^OpenGL ES (\d)/.exec(R)[1]),B=T>=2);let L=null,D={};const P=t.getParameter(t.SCISSOR_BOX),U=t.getParameter(t.VIEWPORT),O=(new Zr).fromArray(P),F=(new Zr).fromArray(U);function k(e,n,i,r){const s=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let o=0;o<i;o++)e===t.TEXTURE_3D||e===t.TEXTURE_2D_ARRAY?t.texImage3D(n,0,t.RGBA,1,1,r,0,t.RGBA,t.UNSIGNED_BYTE,s):t.texImage2D(n+o,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,s);return o}const N={};function Q(e){!0!==a[e]&&(t.enable(e),a[e]=!0)}function G(e){!1!==a[e]&&(t.disable(e),a[e]=!1)}N[t.TEXTURE_2D]=k(t.TEXTURE_2D,t.TEXTURE_2D,1),N[t.TEXTURE_CUBE_MAP]=k(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),N[t.TEXTURE_2D_ARRAY]=k(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),N[t.TEXTURE_3D]=k(t.TEXTURE_3D,t.TEXTURE_3D,1,1),n.setClear(0,0,0,1),i.setClear(1),r.setClear(0),Q(t.DEPTH_TEST),i.setFunc(xe),j(!1),W(Ot),Q(t.CULL_FACE),V(Wt);const z={[Zt]:t.FUNC_ADD,[$t]:t.FUNC_SUBTRACT,[te]:t.FUNC_REVERSE_SUBTRACT};z[ee]=t.MIN,z[ne]=t.MAX;const H={[ie]:t.ZERO,[re]:t.ONE,[se]:t.SRC_COLOR,[ae]:t.SRC_ALPHA,[pe]:t.SRC_ALPHA_SATURATE,[ue]:t.DST_COLOR,[ce]:t.DST_ALPHA,[oe]:t.ONE_MINUS_SRC_COLOR,[le]:t.ONE_MINUS_SRC_ALPHA,[de]:t.ONE_MINUS_DST_COLOR,[he]:t.ONE_MINUS_DST_ALPHA,[Ae]:t.CONSTANT_COLOR,[fe]:t.ONE_MINUS_CONSTANT_COLOR,[me]:t.CONSTANT_ALPHA,[ge]:t.ONE_MINUS_CONSTANT_ALPHA};function V(e,n,i,r,s,o,a,l,c,h){if(e!==Wt){if(!1===d&&(Q(t.BLEND),d=!0),e===Kt)s=s||n,o=o||i,a=a||r,n===A&&s===g||(t.blendEquationSeparate(z[n],z[s]),A=n,g=s),i===f&&r===m&&o===v&&a===y||(t.blendFuncSeparate(H[i],H[r],H[o],H[a]),f=i,m=r,v=o,y=a),!1!==l.equals(E)&&c===x||(t.blendColor(l.r,l.g,l.b,c),E.copy(l),x=c),p=e,b=!1;else if(e!==p||h!==b){if(A===Zt&&g===Zt||(t.blendEquation(t.FUNC_ADD),A=Zt,g=Zt),h)switch(e){case qt:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Xt:t.blendFunc(t.ONE,t.ONE);break;case Yt:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Jt:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case qt:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Xt:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case Yt:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Jt:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}f=null,m=null,v=null,y=null,E.set(0,0,0),x=0,p=e,b=h}}else!0===d&&(G(t.BLEND),d=!1)}function j(e){C!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),C=e)}function W(e){e!==Ut?(Q(t.CULL_FACE),e!==w&&(e===Ot?t.cullFace(t.BACK):e===Ft?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):G(t.CULL_FACE),w=e}function q(e,n,i){e?(Q(t.POLYGON_OFFSET_FILL),M===n&&S===i||(t.polygonOffset(n,i),M=n,S=i)):G(t.POLYGON_OFFSET_FILL)}return{buffers:{color:n,depth:i,stencil:r},enable:Q,disable:G,bindFramebuffer:function(e,n){return l[e]!==n&&(t.bindFramebuffer(e,n),l[e]=n,e===t.DRAW_FRAMEBUFFER&&(l[t.FRAMEBUFFER]=n),e===t.FRAMEBUFFER&&(l[t.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(e,n){let i=h,r=!1;if(e){i=c.get(n),void 0===i&&(i=[],c.set(n,i));const s=e.textures;if(i.length!==s.length||i[0]!==t.COLOR_ATTACHMENT0){for(let e=0,n=s.length;e<n;e++)i[e]=t.COLOR_ATTACHMENT0+e;i.length=s.length,r=!0}}else i[0]!==t.BACK&&(i[0]=t.BACK,r=!0);r&&t.drawBuffers(i)},useProgram:function(e){return u!==e&&(t.useProgram(e),u=e,!0)},setBlending:V,setMaterial:function(e,s){e.side===jt?G(t.CULL_FACE):Q(t.CULL_FACE);let o=e.side===Vt;s&&(o=!o),j(o),e.blending===qt&&!1===e.transparent?V(Wt):V(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.blendColor,e.blendAlpha,e.premultipliedAlpha),i.setFunc(e.depthFunc),i.setTest(e.depthTest),i.setMask(e.depthWrite),n.setMask(e.colorWrite);const a=e.stencilWrite;r.setTest(a),a&&(r.setMask(e.stencilWriteMask),r.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),r.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),q(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?Q(t.SAMPLE_ALPHA_TO_COVERAGE):G(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:j,setCullFace:W,setLineWidth:function(e){e!==_&&(B&&t.lineWidth(e),_=e)},setPolygonOffset:q,setScissorTest:function(e){e?Q(t.SCISSOR_TEST):G(t.SCISSOR_TEST)},activeTexture:function(e){void 0===e&&(e=t.TEXTURE0+I-1),L!==e&&(t.activeTexture(e),L=e)},bindTexture:function(e,n,i){void 0===i&&(i=null===L?t.TEXTURE0+I-1:L);let r=D[i];void 0===r&&(r={type:void 0,texture:void 0},D[i]=r),r.type===e&&r.texture===n||(L!==i&&(t.activeTexture(i),L=i),t.bindTexture(e,n||N[e]),r.type=e,r.texture=n)},unbindTexture:function(){const e=D[L];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexImage3D:function(){try{t.compressedTexImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},updateUBOMapping:function(e,n){let i=o.get(n);void 0===i&&(i=new WeakMap,o.set(n,i));let r=i.get(e);void 0===r&&(r=t.getUniformBlockIndex(n,e.name),i.set(e,r))},uniformBlockBinding:function(e,n){const i=o.get(n).get(e);s.get(n)!==i&&(t.uniformBlockBinding(n,i,e.__bindingPointIndex),s.set(n,i))},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===O.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),O.copy(e))},viewport:function(e){!1===F.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),F.copy(e))},reset:function(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),i.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),a={},L=null,D={},l={},c=new WeakMap,h=[],u=null,d=!1,p=null,A=null,f=null,m=null,g=null,v=null,y=null,E=new Bo(0,0,0),x=0,b=!1,C=null,w=null,_=null,M=null,S=null,O.set(0,0,t.canvas.width,t.canvas.height),F.set(0,0,t.canvas.width,t.canvas.height),n.reset(),i.reset(),r.reset()}}}function Sm(t,e,n,i,r,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=e.has("OCULUS_multiview")?e.get("OCULUS_multiview"):null,h=new Br,u=new WeakMap;let d;const p=new WeakMap;let A=[],f=!1,m=!1;try{m="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function g(t,e){return m?new OffscreenCanvas(t,e):Ur("canvas")}function v(t,e,n){let i=1;const r=W(t);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&t instanceof VideoFrame){const n=Math.floor(i*r.width),s=Math.floor(i*r.height);void 0===d&&(d=g(n,s));const o=e?g(n,s):d;return o.width=n,o.height=s,o.getContext("2d").drawImage(t,0,0,n,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+s+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),t}return t}function y(t){return t.generateMipmaps}function E(e){t.generateMipmap(e)}function x(e){return e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:e.isWebGL3DRenderTarget?t.TEXTURE_3D:e.isWebGLArrayRenderTarget||e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function b(n,i,r,s,o=!1){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 a=i;if(i===t.RED&&(r===t.FLOAT&&(a=t.R32F),r===t.HALF_FLOAT&&(a=t.R16F),r===t.UNSIGNED_BYTE&&(a=t.R8)),i===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(a=t.R8UI),r===t.UNSIGNED_SHORT&&(a=t.R16UI),r===t.UNSIGNED_INT&&(a=t.R32UI),r===t.BYTE&&(a=t.R8I),r===t.SHORT&&(a=t.R16I),r===t.INT&&(a=t.R32I)),i===t.RG&&(r===t.FLOAT&&(a=t.RG32F),r===t.HALF_FLOAT&&(a=t.RG16F),r===t.UNSIGNED_BYTE&&(a=t.RG8)),i===t.RG_INTEGER&&(r===t.UNSIGNED_BYTE&&(a=t.RG8UI),r===t.UNSIGNED_SHORT&&(a=t.RG16UI),r===t.UNSIGNED_INT&&(a=t.RG32UI),r===t.BYTE&&(a=t.RG8I),r===t.SHORT&&(a=t.RG16I),r===t.INT&&(a=t.RG32I)),i===t.RGB_INTEGER&&(r===t.UNSIGNED_BYTE&&(a=t.RGB8UI),r===t.UNSIGNED_SHORT&&(a=t.RGB16UI),r===t.UNSIGNED_INT&&(a=t.RGB32UI),r===t.BYTE&&(a=t.RGB8I),r===t.SHORT&&(a=t.RGB16I),r===t.INT&&(a=t.RGB32I)),i===t.RGBA_INTEGER&&(r===t.UNSIGNED_BYTE&&(a=t.RGBA8UI),r===t.UNSIGNED_SHORT&&(a=t.RGBA16UI),r===t.UNSIGNED_INT&&(a=t.RGBA32UI),r===t.BYTE&&(a=t.RGBA8I),r===t.SHORT&&(a=t.RGBA16I),r===t.INT&&(a=t.RGBA32I)),i===t.RGB&&r===t.UNSIGNED_INT_5_9_9_9_REV&&(a=t.RGB9_E5),i===t.RGBA){const e=o?Ri:zr.getTransfer(s);r===t.FLOAT&&(a=t.RGBA32F),r===t.HALF_FLOAT&&(a=t.RGBA16F),r===t.UNSIGNED_BYTE&&(a=e===Li?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(a=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(a=t.RGB5_A1)}return a!==t.R16F&&a!==t.R32F&&a!==t.RG16F&&a!==t.RG32F&&a!==t.RGBA16F&&a!==t.RGBA32F||e.get("EXT_color_buffer_float"),a}function C(e,n){let i;return e?null===n||n===hn||n===fn?i=t.DEPTH24_STENCIL8:n===un?i=t.DEPTH32F_STENCIL8:n===ln&&(i=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===hn||n===fn?i=t.DEPTH_COMPONENT24:n===un?i=t.DEPTH_COMPONENT32F:n===ln&&(i=t.DEPTH_COMPONENT16),i}function w(t,e){return!0===y(t)||t.isFramebufferTexture&&t.minFilter!==Xe&&t.minFilter!==$e?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function _(t){const e=t.target;e.removeEventListener("dispose",_),function(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=p.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&S(t),0===Object.keys(r).length&&p.delete(n)}i.remove(t)}(e),e.isVideoTexture&&u.delete(e)}function M(e){const n=e.target;n.removeEventListener("dispose",M),function(e){const n=i.get(e);if(e.depthTexture&&(e.depthTexture.dispose(),i.remove(e.depthTexture)),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++){if(Array.isArray(n.__webglFramebuffer[e]))for(let i=0;i<n.__webglFramebuffer[e].length;i++)t.deleteFramebuffer(n.__webglFramebuffer[e][i]);else t.deleteFramebuffer(n.__webglFramebuffer[e]);n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[e])}else{if(Array.isArray(n.__webglFramebuffer))for(let e=0;e<n.__webglFramebuffer.length;e++)t.deleteFramebuffer(n.__webglFramebuffer[e]);else t.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&t.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let e=0;e<n.__webglColorRenderbuffer.length;e++)n.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(n.__webglColorRenderbuffer[e]);n.__webglDepthRenderbuffer&&t.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=e.textures;for(let e=0,n=r.length;e<n;e++){const n=i.get(r[e]);n.__webglTexture&&(t.deleteTexture(n.__webglTexture),o.memory.textures--),i.remove(r[e])}i.remove(e)}(n)}function S(e){const n=i.get(e);t.deleteTexture(n.__webglTexture);const r=e.source;delete p.get(r)[n.__cacheKey],o.memory.textures--}let I=0;function B(e,r){const s=i.get(e);if(e.isVideoTexture&&function(t){const e=o.render.frame;u.get(t)!==e&&(u.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&s.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===t.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else if(O(s,e,r))return}n.bindTexture(t.TEXTURE_2D,s.__webglTexture,t.TEXTURE0+r)}function T(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?O(s,e,r):n.bindTexture(t.TEXTURE_2D_ARRAY,s.__webglTexture,t.TEXTURE0+r)}const R={[je]:t.REPEAT,[We]:t.CLAMP_TO_EDGE,[qe]:t.MIRRORED_REPEAT},L={[Xe]:t.NEAREST,[Ye]:t.NEAREST_MIPMAP_NEAREST,[Ke]:t.NEAREST_MIPMAP_LINEAR,[$e]:t.LINEAR,[tn]:t.LINEAR_MIPMAP_NEAREST,[nn]:t.LINEAR_MIPMAP_LINEAR},D={[Yi]:t.NEVER,[nr]:t.ALWAYS,[Ji]:t.LESS,[Zi]:t.LEQUAL,[Ki]:t.EQUAL,[er]:t.GEQUAL,[$i]:t.GREATER,[tr]:t.NOTEQUAL};function P(n,s){if(s.type!==un||!1!==e.has("OES_texture_float_linear")||s.magFilter!==$e&&s.magFilter!==tn&&s.magFilter!==Ke&&s.magFilter!==nn&&s.minFilter!==$e&&s.minFilter!==tn&&s.minFilter!==Ke&&s.minFilter!==nn||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(n,t.TEXTURE_WRAP_S,R[s.wrapS]),t.texParameteri(n,t.TEXTURE_WRAP_T,R[s.wrapT]),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,R[s.wrapR]),t.texParameteri(n,t.TEXTURE_MAG_FILTER,L[s.magFilter]),t.texParameteri(n,t.TEXTURE_MIN_FILTER,L[s.minFilter]),s.compareFunction&&(t.texParameteri(n,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(n,t.TEXTURE_COMPARE_FUNC,D[s.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){if(s.magFilter===Xe)return;if(s.minFilter!==Ke&&s.minFilter!==nn)return;if(s.type===un&&!1===e.has("OES_texture_float_linear"))return;if(s.anisotropy>1||i.get(s).__currentAnisotropy){const o=e.get("EXT_texture_filter_anisotropic");t.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy}}}function U(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",_));const r=n.source;let s=p.get(r);void 0===s&&(s={},p.set(r,s));const a=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(n);if(a!==e.__cacheKey){void 0===s[a]&&(s[a]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,i=!0),s[a].usedTimes++;const r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&S(n)),e.__cacheKey=a,e.__webglTexture=s[a].texture}return i}function O(e,o,a){if(f)return o.isPendingDeferredUpload||(o.isPendingDeferredUpload=!0,A.push({textureProperties:e,texture:o,slot:a})),!1;let l=t.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),o.isData3DTexture&&(l=t.TEXTURE_3D);const c=U(e,o),h=o.source;n.bindTexture(l,e.__webglTexture,t.TEXTURE0+a);const u=i.get(h);if(h.version!==u.__version||!0===c){n.activeTexture(t.TEXTURE0+a);const e=zr.getPrimaries(zr.workingColorSpace),i=o.colorSpace===Ii?null:zr.getPrimaries(o.colorSpace),d=o.colorSpace===Ii||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,o.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,o.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=v(o.image,!1,r.maxTextureSize);p=j(o,p);const A=s.convert(o.format,o.colorSpace),f=s.convert(o.type);let m,g=b(o.internalFormat,A,f,o.colorSpace,o.isVideoTexture);P(l,o);const x=o.mipmaps,_=!0!==o.isVideoTexture,M=void 0===u.__version||!0===c,S=h.dataReady,I=w(o,p);if(o.isDepthTexture)g=C(o.format===Cn,o.type),M&&(_?n.texStorage2D(t.TEXTURE_2D,1,g,p.width,p.height):n.texImage2D(t.TEXTURE_2D,0,g,p.width,p.height,0,A,f,null));else if(o.isDataTexture)if(x.length>0){_&&M&&n.texStorage2D(t.TEXTURE_2D,I,g,x[0].width,x[0].height);for(let e=0,i=x.length;e<i;e++)m=x[e],_?S&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,m.width,m.height,A,f,m.data):n.texImage2D(t.TEXTURE_2D,e,g,m.width,m.height,0,A,f,m.data);o.generateMipmaps=!1}else _?(M&&n.texStorage2D(t.TEXTURE_2D,I,g,p.width,p.height),S&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,p.width,p.height,A,f,p.data)):n.texImage2D(t.TEXTURE_2D,0,g,p.width,p.height,0,A,f,p.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){_&&M&&n.texStorage3D(t.TEXTURE_2D_ARRAY,I,g,x[0].width,x[0].height,p.depth);for(let e=0,i=x.length;e<i;e++)if(m=x[e],o.format!==yn)if(null!==A)if(_){if(S)if(o.layerUpdates.size>0){const i=$p(m.width,m.height,o.format,o.type);for(const r of o.layerUpdates){const s=m.data.subarray(r*i/m.data.BYTES_PER_ELEMENT,(r+1)*i/m.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,r,m.width,m.height,1,A,s)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,m.width,m.height,p.depth,A,m.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,e,g,m.width,m.height,p.depth,0,m.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else _?S&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,m.width,m.height,p.depth,A,f,m.data):n.texImage3D(t.TEXTURE_2D_ARRAY,e,g,m.width,m.height,p.depth,0,A,f,m.data)}else{_&&M&&n.texStorage2D(t.TEXTURE_2D,I,g,x[0].width,x[0].height);for(let e=0,i=x.length;e<i;e++)m=x[e],o.format!==yn?null!==A?_?S&&n.compressedTexSubImage2D(t.TEXTURE_2D,e,0,0,m.width,m.height,A,m.data):n.compressedTexImage2D(t.TEXTURE_2D,e,g,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_?S&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,m.width,m.height,A,f,m.data):n.texImage2D(t.TEXTURE_2D,e,g,m.width,m.height,0,A,f,m.data)}else if(o.isDataArrayTexture)if(_){if(M&&n.texStorage3D(t.TEXTURE_2D_ARRAY,I,g,p.width,p.height,p.depth),S)if(o.layerUpdates.size>0){const e=$p(p.width,p.height,o.format,o.type);for(const i of o.layerUpdates){const r=p.data.subarray(i*e/p.data.BYTES_PER_ELEMENT,(i+1)*e/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,i,p.width,p.height,1,A,f,r)}o.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,A,f,p.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,g,p.width,p.height,p.depth,0,A,f,p.data);else if(o.isData3DTexture)_?(M&&n.texStorage3D(t.TEXTURE_3D,I,g,p.width,p.height,p.depth),S&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,A,f,p.data)):n.texImage3D(t.TEXTURE_3D,0,g,p.width,p.height,p.depth,0,A,f,p.data);else if(o.isFramebufferTexture){if(M)if(_)n.texStorage2D(t.TEXTURE_2D,I,g,p.width,p.height);else{let e=p.width,i=p.height;for(let r=0;r<I;r++)n.texImage2D(t.TEXTURE_2D,r,g,e,i,0,A,f,null),e>>=1,i>>=1}}else if(x.length>0){if(_&&M){const e=W(x[0]);n.texStorage2D(t.TEXTURE_2D,I,g,e.width,e.height)}for(let e=0,i=x.length;e<i;e++)m=x[e],_?S&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,A,f,m):n.texImage2D(t.TEXTURE_2D,e,g,A,f,m);o.generateMipmaps=!1}else if(_){if(M){const e=W(p);n.texStorage2D(t.TEXTURE_2D,I,g,e.width,e.height)}S&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,A,f,p)}else n.texImage2D(t.TEXTURE_2D,0,g,A,f,p);y(o)&&E(l),u.__version=h.version,o.onUpdate&&o.onUpdate(o)}return e.__version=o.version,!0}function F(e,r,o,l,h,u){const d=s.convert(o.format,o.colorSpace),p=s.convert(o.type),A=b(o.internalFormat,d,p,o.colorSpace),f=i.get(r),m=i.get(o);if(m.__renderTarget=r,!f.__hasExternalTextures){const e=Math.max(1,r.width>>u),i=Math.max(1,r.height>>u);!0===r.isWebGLMultiviewRenderTarget?n.texStorage3D(t.TEXTURE_2D_ARRAY,0,A,r.width,r.height,r.numViews):h===t.TEXTURE_3D||h===t.TEXTURE_2D_ARRAY?n.texImage3D(h,u,A,e,i,r.depth,0,d,p,null):n.texImage2D(h,u,A,e,i,0,d,p,null)}n.bindFramebuffer(t.FRAMEBUFFER,e);const g=V(r);!0===r.isWebGLMultiviewRenderTarget?g?c.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,m.__webglTexture,0,H(r),0,r.numViews):c.framebufferTextureMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,m.__webglTexture,0,0,r.numViews):(h===t.TEXTURE_2D||h>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&h<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&(g?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,l,h,m.__webglTexture,0,H(r)):t.framebufferTexture2D(t.FRAMEBUFFER,l,h,m.__webglTexture,u)),n.bindFramebuffer(t.FRAMEBUFFER,null)}function k(e,n,r){if(t.bindRenderbuffer(t.RENDERBUFFER,e),!0===n.isWebGLMultiviewRenderTarget){const e=V(n),r=n.numViews,s=n.depthTexture;let o=t.DEPTH_COMPONENT24,a=t.DEPTH_ATTACHMENT;s&&s.isDepthTexture&&(s.type===un?o=t.DEPTH_COMPONENT32F:s.type===fn&&(o=t.DEPTH24_STENCIL8,a=t.DEPTH_STENCIL_ATTACHMENT));let l=i.get(n.depthTexture).__webglTexture;void 0===l&&(l=t.createTexture(),t.bindTexture(t.TEXTURE_2D_ARRAY,l),t.texStorage3D(t.TEXTURE_2D_ARRAY,1,o,n.width,n.height,r)),e?c.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,a,l,0,H(n),0,r):c.framebufferTextureMultiviewOVR(t.FRAMEBUFFER,a,l,0,0,r)}else if(n.depthBuffer){const i=n.depthTexture,s=i&&i.isDepthTexture?i.type:null,o=C(n.stencilBuffer,s),l=n.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,c=H(n);V(n)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,c,o,n.width,n.height):r?t.renderbufferStorageMultisample(t.RENDERBUFFER,c,o,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,o,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,l,t.RENDERBUFFER,e)}else{const e=n.textures;for(let i=0;i<e.length;i++){const o=e[i],l=s.convert(o.format,o.colorSpace),c=s.convert(o.type),h=b(o.internalFormat,l,c,o.colorSpace),u=H(n);r&&!1===V(n)?t.renderbufferStorageMultisample(t.RENDERBUFFER,u,h,n.width,n.height):V(n)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,u,h,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,h,n.width,n.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function N(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const s=i.get(r.depthTexture);s.__renderTarget=r,s.__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),1!=r.depthTexture.image.depth?T(r.depthTexture,0):B(r.depthTexture,0);const o=s.__webglTexture,l=H(r);if(!0===r.isWebGLMultiviewRenderTarget){const e=V(r),n=r.numViews;if(r.depthTexture.format===bn)e?c.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,o,0,l,0,n):c.framebufferTextureMultiviewOVR(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,o,0,0,n);else{if(r.depthTexture.format!==Cn)throw new Error("Unknown depthTexture format");e?c.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,o,0,l,0,n):c.framebufferTextureMultiviewOVR(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,o,0,0,n)}}else if(r.depthTexture.format===bn)V(r)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,o,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,o,0);else{if(r.depthTexture.format!==Cn)throw new Error("Unknown depthTexture format");V(r)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,o,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,o,0)}}function Q(e){const r=i.get(e),s=!0===e.isWebGLCubeRenderTarget;if(r.__boundDepthTexture!==e.depthTexture){const t=e.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),t){const e=()=>{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,t.removeEventListener("dispose",e)};t.addEventListener("dispose",e),r.__depthDisposeCallback=e}r.__boundDepthTexture=t}if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(s)throw new Error("target.depthTexture not supported in Cube render targets");N(r.__webglFramebuffer,e)}else if(s){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[i]),void 0===r.__webglDepthbuffer[i])r.__webglDepthbuffer[i]=t.createRenderbuffer(),k(r.__webglDepthbuffer[i],e,!1);else{const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,s=r.__webglDepthbuffer[i];t.bindRenderbuffer(t.RENDERBUFFER,s),t.framebufferRenderbuffer(t.FRAMEBUFFER,n,t.RENDERBUFFER,s)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=t.createRenderbuffer(),k(r.__webglDepthbuffer,e,!1);else{const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,i=r.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,i),t.framebufferRenderbuffer(t.FRAMEBUFFER,n,t.RENDERBUFFER,i)}n.bindFramebuffer(t.FRAMEBUFFER,null)}const G=[],z=[];function H(t){return Math.min(r.maxSamples,t.samples)}function V(t){const n=i.get(t);return t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function j(t,e){const n=t.colorSpace,i=t.format,r=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||n!==Ti&&n!==Ii&&(zr.getTransfer(n)===Li?i===yn&&r===sn||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),e}function W(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?(h.width=t.naturalWidth||t.width,h.height=t.naturalHeight||t.height):"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?(h.width=t.displayWidth,h.height=t.displayHeight):(h.width=t.width,h.height=t.height),h}this.allocateTextureUnit=function(){const t=I;return t>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+r.maxTextures),I+=1,t},this.resetTextureUnits=function(){I=0},this.setTexture2D=B,this.setTexture2DArray=T,this.setTexture3D=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?O(s,e,r):n.bindTexture(t.TEXTURE_3D,s.__webglTexture,t.TEXTURE0+r)},this.setTextureCube=function(e,o){const a=i.get(e);e.version>0&&a.__version!==e.version?function(e,o,a){if(6!==o.image.length)return;const l=U(e,o),c=o.source;n.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+a);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(t.TEXTURE0+a);const e=zr.getPrimaries(zr.workingColorSpace),i=o.colorSpace===Ii?null:zr.getPrimaries(o.colorSpace),u=o.colorSpace===Ii||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,o.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,o.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);const d=o.isCompressedTexture||o.image[0].isCompressedTexture,p=o.image[0]&&o.image[0].isDataTexture,A=[];for(let t=0;t<6;t++)A[t]=d||p?p?o.image[t].image:o.image[t]:v(o.image[t],!0,r.maxCubemapSize),A[t]=j(o,A[t]);const f=A[0],m=s.convert(o.format,o.colorSpace),g=s.convert(o.type),x=b(o.internalFormat,m,g,o.colorSpace),C=!0!==o.isVideoTexture,_=void 0===h.__version||!0===l,M=c.dataReady;let S,I=w(o,f);if(P(t.TEXTURE_CUBE_MAP,o),d){C&&_&&n.texStorage2D(t.TEXTURE_CUBE_MAP,I,x,f.width,f.height);for(let e=0;e<6;e++){S=A[e].mipmaps;for(let i=0;i<S.length;i++){const r=S[i];o.format!==yn?null!==m?C?M&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,0,0,r.width,r.height,m,r.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,x,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):C?M&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,0,0,r.width,r.height,m,g,r.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,x,r.width,r.height,0,m,g,r.data)}}}else{if(S=o.mipmaps,C&&_){S.length>0&&I++;const e=W(A[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,I,x,e.width,e.height)}for(let e=0;e<6;e++)if(p){C?M&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,A[e].width,A[e].height,m,g,A[e].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,x,A[e].width,A[e].height,0,m,g,A[e].data);for(let i=0;i<S.length;i++){const r=S[i].image[e].image;C?M&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,0,0,r.width,r.height,m,g,r.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,x,r.width,r.height,0,m,g,r.data)}}else{C?M&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,m,g,A[e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,x,m,g,A[e]);for(let i=0;i<S.length;i++){const r=S[i];C?M&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,0,0,m,g,r.image[e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,x,m,g,r.image[e])}}}y(o)&&E(t.TEXTURE_CUBE_MAP),h.__version=c.version,o.onUpdate&&o.onUpdate(o)}e.__version=o.version}(a,e,o):n.bindTexture(t.TEXTURE_CUBE_MAP,a.__webglTexture,t.TEXTURE0+o)},this.rebindTextures=function(e,n,r){const s=i.get(e);void 0!==n&&F(s.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==r&&Q(e)},this.uploadTexture=O,this.setupRenderTarget=function(e){const r=e.texture,a=i.get(e),l=i.get(r);e.addEventListener("dispose",M);const c=e.textures,h=!0===e.isWebGLCubeRenderTarget,u=c.length>1;if(u||(void 0===l.__webglTexture&&(l.__webglTexture=t.createTexture()),l.__version=r.version,o.memory.textures++),h){a.__webglFramebuffer=[];for(let e=0;e<6;e++)if(r.mipmaps&&r.mipmaps.length>0){a.__webglFramebuffer[e]=[];for(let n=0;n<r.mipmaps.length;n++)a.__webglFramebuffer[e][n]=t.createFramebuffer()}else a.__webglFramebuffer[e]=t.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){a.__webglFramebuffer=[];for(let e=0;e<r.mipmaps.length;e++)a.__webglFramebuffer[e]=t.createFramebuffer()}else a.__webglFramebuffer=t.createFramebuffer();if(u)for(let e=0,n=c.length;e<n;e++){const n=i.get(c[e]);void 0===n.__webglTexture&&(n.__webglTexture=t.createTexture(),o.memory.textures++)}if(e.samples>0&&!1===V(e)){a.__webglMultisampledFramebuffer=t.createFramebuffer(),a.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,a.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const i=c[n];a.__webglColorRenderbuffer[n]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,a.__webglColorRenderbuffer[n]);const r=s.convert(i.format,i.colorSpace),o=s.convert(i.type),l=b(i.internalFormat,r,o,i.colorSpace,!0===e.isXRRenderTarget),h=H(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,h,l,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+n,t.RENDERBUFFER,a.__webglColorRenderbuffer[n])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(a.__webglDepthRenderbuffer=t.createRenderbuffer(),k(a.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(h){n.bindTexture(t.TEXTURE_CUBE_MAP,l.__webglTexture),P(t.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)F(a.__webglFramebuffer[n][i],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else F(a.__webglFramebuffer[n],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);y(r)&&E(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(u){for(let r=0,s=c.length;r<s;r++){const s=c[r],o=i.get(s);n.bindTexture(t.TEXTURE_2D,o.__webglTexture),P(t.TEXTURE_2D,s),F(a.__webglFramebuffer,e,s,t.COLOR_ATTACHMENT0+r,t.TEXTURE_2D,0),y(s)&&E(t.TEXTURE_2D)}n.unbindTexture()}else{let i=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(i=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),!0===e.isWebGLMultiviewRenderTarget&&(i=t.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),P(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)F(a.__webglFramebuffer[n],e,r,t.COLOR_ATTACHMENT0,i,n);else F(a.__webglFramebuffer,e,r,t.COLOR_ATTACHMENT0,i,0);y(r)&&E(i),n.unbindTexture()}(e.depthBuffer||!0===e.isWebGLMultiviewRenderTarget)&&this.setupDepthRenderbuffer(e)},this.updateRenderTargetMipmap=function(t){const e=t.textures;for(let r=0,s=e.length;r<s;r++){const s=e[r];if(y(s)){const e=x(t),r=i.get(s).__webglTexture;n.bindTexture(e,r),E(e),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.samples>0)if(!1===V(e)){const r=e.textures,s=e.width,o=e.height;let a=t.COLOR_BUFFER_BIT;const c=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,h=i.get(e),u=r.length>1;if(u)for(let e=0;e<r.length;e++)n.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let n=0;n<r.length;n++){if(e.resolveDepthBuffer&&(e.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&e.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT)),u){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,h.__webglColorRenderbuffer[n]);const e=i.get(r[n]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}t.blitFramebuffer(0,0,s,o,0,0,s,o,a,t.NEAREST),!0===l&&(G.length=0,z.length=0,G.push(t.COLOR_ATTACHMENT0+n),e.depthBuffer&&!1===e.resolveDepthBuffer&&(G.push(c),z.push(c),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,z)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,G))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),u)for(let e=0;e<r.length;e++){n.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,h.__webglColorRenderbuffer[e]);const s=i.get(r[e]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,s,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(e.depthBuffer&&!1===e.resolveDepthBuffer&&l){const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[n])}},this.setupDepthTexture=N,this.setupDepthRenderbuffer=Q,this.setupFrameBufferTexture=F,this.useMultisampledRTT=V,this.runDeferredUploads=function(){const t=f;f=!1;for(const t of A)O(t.textureProperties,t.texture,t.slot),t.texture.isPendingDeferredUpload=!1;A=[],f=t},this.setDeferTextureUploads=function(t){f=t}}function Im(t,e){return{convert:function(n,i=Ii){let r;const s=zr.getTransfer(i);if(n===sn)return t.UNSIGNED_BYTE;if(n===pn)return t.UNSIGNED_SHORT_4_4_4_4;if(n===An)return t.UNSIGNED_SHORT_5_5_5_1;if(n===mn)return t.UNSIGNED_INT_5_9_9_9_REV;if(n===on)return t.BYTE;if(n===an)return t.SHORT;if(n===ln)return t.UNSIGNED_SHORT;if(n===cn)return t.INT;if(n===hn)return t.UNSIGNED_INT;if(n===un)return t.FLOAT;if(n===dn)return t.HALF_FLOAT;if(n===gn)return t.ALPHA;if(n===vn)return t.RGB;if(n===yn)return t.RGBA;if(n===En)return t.LUMINANCE;if(n===xn)return t.LUMINANCE_ALPHA;if(n===bn)return t.DEPTH_COMPONENT;if(n===Cn)return t.DEPTH_STENCIL;if(n===wn)return t.RED;if(n===_n)return t.RED_INTEGER;if(n===Mn)return t.RG;if(n===Sn)return t.RG_INTEGER;if(n===Bn)return t.RGBA_INTEGER;if(n===Tn||n===Rn||n===Ln||n===Dn)if(s===Li){if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===Tn)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Rn)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ln)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Dn)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=e.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===Tn)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Rn)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ln)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Dn)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Pn||n===Un||n===On||n===Fn){if(r=e.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===Pn)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Un)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===On)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Fn)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===kn||n===Nn||n===Qn){if(r=e.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===kn||n===Nn)return s===Li?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Qn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===Gn||n===zn||n===Hn||n===Vn||n===jn||n===Wn||n===qn||n===Xn||n===Yn||n===Jn||n===Kn||n===Zn||n===$n||n===ti){if(r=e.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===Gn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===zn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Hn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Vn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===jn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Wn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===qn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Xn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Yn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Jn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Kn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Zn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===$n)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ti)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===ei||n===ni||n===ii){if(r=e.get("EXT_texture_compression_bptc"),null===r)return null;if(n===ei)return s===Li?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===ni)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ii)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===ri||n===si||n===oi||n===ai){if(r=e.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===ei)return r.COMPRESSED_RED_RGTC1_EXT;if(n===si)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===oi)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===ai)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===fn?t.UNSIGNED_INT_24_8:void 0!==t[n]?t[n]:null}}}class Bm extends ts{constructor(t,e,n,i={}){super(t,e,i),this.depthBuffer=!1,this.stencilBuffer=!1,this.numViews=n}copy(t){return super.copy(t),this.numViews=t.numViews,this}}Bm.prototype.isWebGLMultiviewRenderTarget=!0;class Tm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(null===this.texture){const i=new Kr;t.properties.get(i).__webglTexture=e.texture,e.depthNear===n.depthNear&&e.depthFar===n.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(t){if(null!==this.texture&&null===this.mesh){const e=t.cameras[0].viewport,n=new wa({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new ga(new Vh(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Rm extends gr{constructor(t,e,n,i){super();const r=this;let s=null,o=1;var a=null;let l=null,c="local-floor",h=1,u=null,d=null;var p=[];let A=null,f=null,m=null,g=null;const v=new Tm,y=e.getContextAttributes();let E=null,x=null;const b=[],C=[],w=new Br;let _=null;const M=new Ba;M.viewport=new Zr;const S=new Ba;S.viewport=new Zr;const I=[M,S],B=new Id;let T=null,R=null;function L(t){const e=C.indexOf(t.inputSource);if(-1===e)return;const n=b[e];void 0!==n&&(n.update(t.inputSource,t.frame,u||l),n.dispatchEvent({type:t.type,data:t.inputSource}))}function D(){s.removeEventListener("select",L),s.removeEventListener("selectstart",L),s.removeEventListener("selectend",L),s.removeEventListener("squeeze",L),s.removeEventListener("squeezestart",L),s.removeEventListener("squeezeend",L),s.removeEventListener("end",D),s.removeEventListener("inputsourceschange",P);for(let t=0;t<b.length;t++){const e=C[t];null!==e&&(C[t]=null,b[t].disconnect(e))}T=null,R=null,v.reset(),t.setRenderTarget(E),m=null,f=null,A=null,s=null,x=null,N.stop(),r.isPresenting=!1,t.setPixelRatio(_),t.setSize(w.width,w.height,!1),r.dispatchEvent({type:"sessionend"})}function P(t){for(let e=0;e<t.removed.length;e++){const n=t.removed[e],i=C.indexOf(n);i>=0&&(C[i]=null,b[i].disconnect(n))}for(let e=0;e<t.added.length;e++){const n=t.added[e];let i=C.indexOf(n);if(-1===i){for(let t=0;t<b.length;t++){if(t>=C.length){C.push(n),i=t;break}if(null===C[t]){C[t]=n,i=t;break}}if(-1===i)break}const r=b[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.layersEnabled=!1,this.enabled=!1,this.isPresenting=!1,this.isMultiview=!1,this.getCameraPose=function(){return d},this.getController=function(t){let e=b[t];return void 0===e&&(e=new Oa,b[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=b[t];return void 0===e&&(e=new Oa,b[t]=e),e.getGripSpace()},this.getHand=function(t){let e=b[t];return void 0===e&&(e=new Oa,b[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){o=t,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){c=t,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return u||l},this.setReferenceSpace=function(t){u=t},this.getBaseLayer=function(){return null!==f?f:m},this.getBinding=function(){return A},this.getRenderTarget=function(){return x},this.getFrame=function(){return g},this.getSession=function(){return s},this.setSession=async function(a){if(s=a,null!==s){if(E=t.getRenderTarget(),s.addEventListener("select",L),s.addEventListener("selectstart",L),s.addEventListener("selectend",L),s.addEventListener("squeeze",L),s.addEventListener("squeezestart",L),s.addEventListener("squeezeend",L),s.addEventListener("end",D),s.addEventListener("inputsourceschange",P),!0!==y.xrCompatible&&await e.makeXRCompatible(),_=t.getPixelRatio(),t.getSize(w),"undefined"!=typeof XRWebGLBinding&&"createProjectionLayer"in XRWebGLBinding.prototype){let a=null,l=null,c=null;y.depth&&(c=y.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,a=y.stencil?Cn:bn,l=y.stencil?fn:hn),r.isMultiview=i&&n.has("OCULUS_multiview");const h={colorFormat:e.RGBA8,depthFormat:c,scaleFactor:o};r.isMultiview&&(h.textureType="texture-array"),A=new XRWebGLBinding(s,e),f=A.createProjectionLayer(h),s.updateRenderState({layers:[f]}),t.setPixelRatio(1),t.setSize(f.textureWidth,f.textureHeight,!1);const u={format:yn,type:sn,depthTexture:new Rc(f.textureWidth,f.textureHeight,l,void 0,void 0,void 0,void 0,void 0,void 0,a),stencilBuffer:y.stencil,colorSpace:t.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:!1===f.ignoreDepthValues};if(r.isMultiview){const t=n.get("OCULUS_multiview");this.maxNumViews=e.getParameter(t.MAX_VIEWS_OVR),x=new Bm(f.textureWidth,f.textureHeight,2,u)}else x=new ts(f.textureWidth,f.textureHeight,u)}else{const n={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:o};m=new XRWebGLLayer(s,e,n),s.updateRenderState({baseLayer:m}),t.setPixelRatio(1),t.setSize(m.framebufferWidth,m.framebufferHeight,!1),x=new ts(m.framebufferWidth,m.framebufferHeight,{format:yn,type:sn,colorSpace:t.outputColorSpace,stencilBuffer:y.stencil})}x.isXRRenderTarget=!0,this.setFoveation(h),u=null,l=await s.requestReferenceSpace(c),N.setContext(s),N.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==s)return s.environmentBlendMode},this.addLayer=function(t){window.XRWebGLBinding&&this.layersEnabled&&s&&(p.push(t),this.updateLayers())},this.removeLayer=function(t){p.splice(p.indexOf(t),1),window.XRWebGLBinding&&this.layersEnabled&&s&&this.updateLayers()},this.updateLayers=function(){var t=p.map((function(t){return t}));t.unshift(s.renderState.layers[0]),s.updateRenderState({layers:t})},this.getDepthTexture=function(){return v.getDepthTexture()};const U=new os,O=new os;function F(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.setPoseTarget=function(t){void 0!==t&&(a=t)},this.updateCamera=function(t){if(null===s)return;let e=t.near,n=t.far;null!==v.texture&&(v.depthNear>0&&(e=v.depthNear),v.depthFar>0&&(n=v.depthFar)),B.near=S.near=M.near=e,B.far=S.far=M.far=n,T===B.near&&R===B.far||(s.updateRenderState({depthNear:B.near,depthFar:B.far}),T=B.near,R=B.far),M.layers.mask=2|t.layers.mask,S.layers.mask=4|t.layers.mask,B.layers.mask=M.layers.mask|S.layers.mask;const i=B.cameras;var r=a||t;const o=r.parent;F(B,o);for(let t=0;t<i.length;t++)F(i[t],o);2===i.length?function(t,e,n){U.setFromMatrixPosition(e.matrixWorld),O.setFromMatrixPosition(n.matrixWorld);const i=U.distanceTo(O),r=e.projectionMatrix.elements,s=n.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(s[8]+1)/s[0],d=o*h,p=o*u,A=i/(-h+u),f=A*-h;if(e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(f),t.translateZ(A),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert(),-1===r[10])t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{const e=o+A,n=a+A,r=d-f,s=p+(i-f),h=l*a/n*e,u=c*a/n*e;t.projectionMatrix.makePerspective(r,s,h,u,e,n),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}}(B,M,S):B.projectionMatrix.copy(M.projectionMatrix),function(t,e,n){e.matrixWorld.decompose(e.position,e.quaternion,e.scale),null===n.parent?n.matrix.copy(e.matrixWorld):(n.matrix.copy(n.parent.matrixWorld),n.matrix.invert(),n.matrix.multiply(e.matrixWorld)),n.matrix.decompose(n.position,n.quaternion,n.scale),n.updateMatrixWorld(!0),t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*xr*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,B,r)},this.getCamera=function(){return B},this.getFoveation=function(){if(null!==f||null!==m)return h},this.setFoveation=function(t){h=t,null!==f&&(f.fixedFoveation=t),null!==m&&void 0!==m.fixedFoveation&&(m.fixedFoveation=t)},this.hasDepthSensing=function(){return null!==v.texture},this.getDepthSensingMesh=function(){return v.getMesh(B)};let k=null;const N=new eA;N.setAnimationLoop((function(e,n){if(d=n.getViewerPose(u||l),g=n,null!==d){const e=d.views;null!==m&&(t.setRenderTargetFramebuffer(x,m.framebuffer),t.setRenderTarget(x));let n=!1;e.length!==B.cameras.length&&(B.cameras.length=0,n=!0);for(let i=0;i<e.length;i++){const r=e[i];let s=null;if(null!==m)s=m.getViewport(r);else{const e=A.getViewSubImage(f,r);s=e.viewport,0===i&&(t.setRenderTargetTextures(x,e.colorTexture,f.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(x))}let o=I[i];void 0===o&&(o=new Ba,o.layers.enable(i),o.viewport=new Zr,I[i]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(s.x,s.y,s.width,s.height),0===i&&(B.matrix.copy(o.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),!0===n&&B.cameras.push(o)}const i=s.enabledFeatures;if(i&&i.includes("depth-sensing")&&"gpu-optimized"==s.depthUsage&&A){const n=A.getDepthInformation(e[0]);n&&n.isValid&&n.texture&&v.init(t,n,s.renderState)}}for(let t=0;t<b.length;t++){const e=C[t],i=b[t];null!==e&&void 0!==i&&i.update(e,n,u||l)}k&&k(e,n),n.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:n}),g=null})),this.setAnimationLoop=function(t){k=t},this.dispose=function(){}}}const Lm=new Ws,Dm=new Os;function Pm(t,e){function n(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function i(t,i){t.opacity.value=i.opacity,i.color&&t.diffuse.value.copy(i.color),i.emissive&&t.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(t.map.value=i.map,n(i.map,t.mapTransform)),i.alphaMap&&(t.alphaMap.value=i.alphaMap,n(i.alphaMap,t.alphaMapTransform)),i.bumpMap&&(t.bumpMap.value=i.bumpMap,n(i.bumpMap,t.bumpMapTransform),t.bumpScale.value=i.bumpScale,i.side===Vt&&(t.bumpScale.value*=-1)),i.normalMap&&(t.normalMap.value=i.normalMap,n(i.normalMap,t.normalMapTransform),t.normalScale.value.copy(i.normalScale),i.side===Vt&&t.normalScale.value.negate()),i.displacementMap&&(t.displacementMap.value=i.displacementMap,n(i.displacementMap,t.displacementMapTransform),t.displacementScale.value=i.displacementScale,t.displacementBias.value=i.displacementBias),i.emissiveMap&&(t.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,t.emissiveMapTransform)),i.specularMap&&(t.specularMap.value=i.specularMap,n(i.specularMap,t.specularMapTransform)),i.alphaTest>0&&(t.alphaTest.value=i.alphaTest);const r=e.get(i),s=r.envMap,o=r.envMapRotation;s&&(t.envMap.value=s,Lm.copy(o),Lm.x*=-1,Lm.y*=-1,Lm.z*=-1,s.isCubeTexture&&!1===s.isRenderTargetTexture&&(Lm.y*=-1,Lm.z*=-1),t.envMapRotation.value.setFromMatrix4(Dm.makeRotationFromEuler(Lm)),t.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,t.reflectivity.value=i.reflectivity,t.ior.value=i.ior,t.refractionRatio.value=i.refractionRatio),i.lightMap&&(t.lightMap.value=i.lightMap,t.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,t.lightMapTransform)),i.aoMap&&(t.aoMap.value=i.aoMap,t.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,t.aoMapTransform))}return{refreshFogUniforms:function(e,n){n.color.getRGB(e.fogColor.value,ba(t)),n.isFog?(e.fogNear.value=n.near,e.fogFar.value=n.far):n.isFogExp2&&(e.fogDensity.value=n.density)},refreshMaterialUniforms:function(t,r,s,o,a){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(t,r):r.isMeshToonMaterial?(i(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(i(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(i(t,r),function(t,e){t.metalness.value=e.metalness,e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap,n(e.metalnessMap,t.metalnessMapTransform)),t.roughness.value=e.roughness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap,n(e.roughnessMap,t.roughnessMapTransform)),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,n(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,n(e.sheenRoughnessMap,t.sheenRoughnessMapTransform))),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,n(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,n(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,n(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),e.side===Vt&&t.clearcoatNormalScale.value.negate())),e.dispersion>0&&(t.dispersion.value=e.dispersion),e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,n(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,n(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform))),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,n(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,n(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,n(e.anisotropyMap,t.anisotropyMapTransform))),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,n(e.specularColorMap,t.specularColorMapTransform)),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,n(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r,a)):r.isMeshMatcapMaterial?(i(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?i(t,r):r.isMeshDistanceMaterial?(i(t,r),function(t,n){const i=e.get(n).light;t.referencePosition.value.setFromMatrixPosition(i.matrixWorld),t.nearDistance.value=i.shadow.camera.near,t.farDistance.value=i.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?i(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,i,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*r,e.map&&(t.map.value=e.map,n(e.map,t.uvTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,s,o):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Um(t,e,n,i){let r={},s={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(t,e,n,i){const r=t.value,s=e+"_"+n;if(void 0===i[s])return i[s]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const t=i[s];if("number"==typeof r||"boolean"==typeof r){if(t!==r)return i[s]=r,!0}else if(!1===t.equals(r))return t.copy(r),!0}return!1}function c(t){const e={boundary:0,storage:0};return"number"==typeof t||"boolean"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),e}function h(e){const n=e.target;n.removeEventListener("dispose",h);const i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),t.deleteBuffer(r[n.id]),delete r[n.id],delete s[n.id]}return{bind:function(t,e){const n=e.program;i.uniformBlockBinding(t,n)},update:function(n,u){let d=r[n.id];void 0===d&&(function(t){const e=t.uniforms;let n=0;for(let t=0,i=e.length;t<i;t++){const i=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0,e=i.length;t<e;t++){const e=i[t],r=Array.isArray(e.value)?e.value:[e.value];for(let t=0,i=r.length;t<i;t++){const i=c(r[t]),s=n%16,o=s%i.boundary,a=s+o;n+=o,0!==a&&16-a<i.storage&&(n+=16-a),e.__data=new Float32Array(i.storage/Float32Array.BYTES_PER_ELEMENT),e.__offset=n,n+=i.storage}}}const i=n%16;i>0&&(n+=16-i),t.__size=n,t.__cache={}}(n),d=function(e){const n=function(){for(let t=0;t<a;t++)if(-1===o.indexOf(t))return o.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=n;const i=t.createBuffer(),r=e.__size,s=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,i),t.bufferData(t.UNIFORM_BUFFER,r,s),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=d,n.addEventListener("dispose",h));const p=u.program;i.updateUBOMapping(n,p);const A=e.render.frame;s[n.id]!==A&&(function(e){const n=r[e.id],i=e.uniforms,s=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,n);for(let e=0,n=i.length;e<n;e++){const n=Array.isArray(i[e])?i[e]:[i[e]];for(let i=0,r=n.length;i<r;i++){const r=n[i];if(!0===l(r,e,i,s)){const e=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let s=0;s<n.length;s++){const o=n[s],a=c(o);"number"==typeof o||"boolean"==typeof o?(r.__data[0]=o,t.bufferSubData(t.UNIFORM_BUFFER,e+i,r.__data)):o.isMatrix3?(r.__data[0]=o.elements[0],r.__data[1]=o.elements[1],r.__data[2]=o.elements[2],r.__data[3]=0,r.__data[4]=o.elements[3],r.__data[5]=o.elements[4],r.__data[6]=o.elements[5],r.__data[7]=0,r.__data[8]=o.elements[6],r.__data[9]=o.elements[7],r.__data[10]=o.elements[8],r.__data[11]=0):(o.toArray(r.__data,i),i+=a.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,e,r.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(n),s[n.id]=A)},dispose:function(){for(const e in r)t.deleteBuffer(r[e]);o=[],r={},s={}}}}class Om{constructor(t={}){const{canvas:e=Or(),context:n=null,depth:i=!0,stencil:r=!1,alpha:s=!1,antialias:o=!1,premultipliedAlpha:a=!0,preserveDrawingBuffer:l=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:h=!1,reverseDepthBuffer:u=!1,multiviewStereo:d=!1}=t;let p;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=s;const A=new Uint32Array(4),f=new Int32Array(4);let m=null,g=null;const v=[],y=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Bi,this.toneMapping=Be,this.toneMappingExposure=1;const E=this;let x=!1,b=0,C=0,w=null,_=-1,M=null;const S=new Zr,I=new Zr;let B=null;const T=new Bo(0);let R=0,L=e.width,D=e.height,P=1,U=null,O=null;const F=new Zr(0,0,L,D),k=new Zr(0,0,L,D);let N=!1;const Q=new kl;let G=!1,z=!1;this.transmissionResolutionScale=1;const H=new Os,V=new Os,j=new os,W=new Zr,q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let X=!1;function Y(){return null===w?P:1}let J,K,Z,$,tt,et,nt,it,rt,st,ot,at,lt,ct,ht,ut,dt,pt,At,ft,mt,gt,vt,yt,Et,xt=n;function bt(t,n){return e.getContext(t,n)}try{const t={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Lt}`),e.addEventListener("webglcontextlost",_t,!1),e.addEventListener("webglcontextrestored",Mt,!1),e.addEventListener("webglcontextcreationerror",St,!1),null===xt){const e="webgl2";if(xt=bt(e,t),null===xt)throw bt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function Ct(){J=new RA(xt),J.init(),vt=new Im(xt,J),K=new dA(xt,J,t,vt),Z=new Mm(xt,J),K.reverseDepthBuffer&&u&&Z.buffers.depth.setReversed(!0),$=new PA(xt),tt=new pm,et=new Sm(xt,J,Z,tt,K,vt,$),nt=new AA(E),it=new TA(E),rt=new nA(xt),yt=new hA(xt,rt),st=new LA(xt,rt,$,yt),ot=new FA(xt,st,rt,$),ft=new UA(xt,K,et),ut=new pA(tt),at=new dm(E,nt,it,J,K,yt,ut),lt=new Pm(E,tt),ct=new gm,ht=new Cm(J),At=new cA(E,nt,it,Z,ot,p,a),pt=new OA(E,J,xt),dt=new wm(E,ot,K),Et=new Um(xt,$,K,Z),mt=new uA(xt,J,$),gt=new DA(xt,J,$),$.programs=at.programs,E.capabilities=K,E.extensions=J,E.properties=tt,E.renderLists=ct,E.shadowMap=dt,E.state=Z,E.info=$}Ct();const wt=new Rm(E,xt);function _t(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function Mt(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;const t=$.autoReset,e=dt.enabled,n=dt.autoUpdate,i=dt.needsUpdate,r=dt.type;Ct(),$.autoReset=t,dt.enabled=e,dt.autoUpdate=n,dt.needsUpdate=i,dt.type=r}function St(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function It(t){const e=t.target;e.removeEventListener("dispose",It),function(t){(function(t){const e=tt.get(t).programs;void 0!==e&&(e.forEach((function(t){at.releaseProgram(t)})),t.isShaderMaterial&&at.releaseShaderCache(t))})(t),tt.remove(t)}(e)}function Bt(t,e,n){!0===t.transparent&&t.side===jt&&!1===t.forceSinglePass?(t.side=Vt,t.needsUpdate=!0,Qt(t,e,n),t.side=Ht,t.needsUpdate=!0,Qt(t,e,n),t.side=jt):Qt(t,e,n)}this.xr=wt,this.getContext=function(){return xt},this.getContextAttributes=function(){return xt.getContextAttributes()},this.forceContextLoss=function(){const t=J.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=J.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(t){void 0!==t&&(P=t,this.setSize(L,D,!1))},this.getSize=function(t){return t.set(L,D)},this.setSize=function(t,n,i=!0){wt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(L=t,D=n,e.width=Math.floor(t*P),e.height=Math.floor(n*P),!0===i&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(L*P,D*P).floor()},this.setDrawingBufferSize=function(t,n,i){L=t,D=n,P=i,e.width=Math.floor(t*i),e.height=Math.floor(n*i),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(S)},this.getViewport=function(t){return t.copy(F)},this.setViewport=function(t,e,n,i){t.isVector4?F.set(t.x,t.y,t.z,t.w):F.set(t,e,n,i),Z.viewport(S.copy(F).multiplyScalar(P).round())},this.getScissor=function(t){return t.copy(k)},this.setScissor=function(t,e,n,i){t.isVector4?k.set(t.x,t.y,t.z,t.w):k.set(t,e,n,i),Z.scissor(I.copy(k).multiplyScalar(P).round())},this.getScissorTest=function(){return N},this.setScissorTest=function(t){Z.setScissorTest(N=t)},this.setOpaqueSort=function(t){U=t},this.setTransparentSort=function(t){O=t},this.getClearColor=function(t){return t.copy(At.getClearColor())},this.setClearColor=function(){At.setClearColor.apply(At,arguments)},this.getClearAlpha=function(){return At.getClearAlpha()},this.setClearAlpha=function(){At.setClearAlpha.apply(At,arguments)},this.clear=function(t=!0,e=!0,n=!0){let i=0;if(t){let t=!1;if(null!==w){const e=w.texture.format;t=e===Bn||e===Sn||e===_n}if(t){const t=w.texture.type,e=t===sn||t===hn||t===ln||t===fn||t===pn||t===An,n=At.getClearColor(),i=At.getClearAlpha(),r=n.r,s=n.g,o=n.b;e?(A[0]=r,A[1]=s,A[2]=o,A[3]=i,xt.clearBufferuiv(xt.COLOR,0,A)):(f[0]=r,f[1]=s,f[2]=o,f[3]=i,xt.clearBufferiv(xt.COLOR,0,f))}else i|=xt.COLOR_BUFFER_BIT}e&&(i|=xt.DEPTH_BUFFER_BIT),n&&(i|=xt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),xt.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",_t,!1),e.removeEventListener("webglcontextrestored",Mt,!1),e.removeEventListener("webglcontextcreationerror",St,!1),At.dispose(),ct.dispose(),ht.dispose(),tt.dispose(),nt.dispose(),it.dispose(),ot.dispose(),yt.dispose(),Et.dispose(),at.dispose(),wt.dispose(),wt.removeEventListener("sessionstart",Rt),wt.removeEventListener("sessionend",Dt),Pt.stop()},this.renderBufferDirect=function(t,e,n,i,r,s){null===e&&(e=q);const o=r.isMesh&&r.matrixWorld.determinant()<0,a=function(t,e,n,i,r){!0!==e.isScene&&(e=q),et.resetTextureUnits();const s=e.fog,o=i.isMeshStandardMaterial?e.environment:null,a=null===w?E.outputColorSpace:!0===w.isXRRenderTarget?w.texture.colorSpace:Ti,l=(i.isMeshStandardMaterial?it:nt).get(i.envMap||o),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),u=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let A=Be;i.toneMapped&&(null!==w&&!0!==w.isXRRenderTarget||(A=E.toneMapping));const f=w&&w.isWebGLMultiviewRenderTarget?w.numViews:0,m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==m?m.length:0,y=tt.get(i),x=g.state.lights;if(!0===G&&(!0===z||t!==M)){const e=t===M&&i.id===_;ut.setState(i,t,e)}let b=!1;i.version===y.__version?y.needsLights&&y.lightsStateVersion!==x.state.version||y.outputColorSpace!==a||r.isBatchedMesh&&!1===y.batching?b=!0:r.isBatchedMesh||!0!==y.batching?r.isBatchedMesh&&!0===y.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===y.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===y.instancing?b=!0:r.isInstancedMesh||!0!==y.instancing?r.isSkinnedMesh&&!1===y.skinning?b=!0:r.isSkinnedMesh||!0!==y.skinning?r.isInstancedMesh&&!0===y.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===y.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===y.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===y.instancingMorph&&null!==r.morphTexture||y.envMap!==l||!0===i.fog&&y.fog!==s?b=!0:void 0===y.numClippingPlanes||y.numClippingPlanes===ut.numPlanes&&y.numIntersection===ut.numIntersection?(y.vertexAlphas!==c||y.vertexTangents!==h||y.morphTargets!==u||y.morphNormals!==d||y.morphColors!==p||y.toneMapping!==A||y.morphTargetsCount!==v||y.numMultiviewViews!==f)&&(b=!0):b=!0:b=!0:b=!0:b=!0:(b=!0,y.__version=i.version);let C=y.currentProgram;!0===b&&(C=Qt(i,e,r));let S=!1,I=!1,B=!1;const T=C.getUniforms(),R=y.uniforms;if(Z.useProgram(C.program)&&(S=!0,I=!0,B=!0),i.id!==_&&(_=i.id,I=!0),S||M!==t){C.numMultiviewViews>0?(pt.updateCameraProjectionMatricesUniform(t,T),pt.updateCameraViewMatricesUniform(t,T)):(Z.buffers.depth.getReversed()?(H.copy(t.projectionMatrix),function(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}(H),function(t){const e=t.elements;-1===e[11]?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=1-e[14])}(H),T.setValue(xt,"projectionMatrix",H)):T.setValue(xt,"projectionMatrix",t.projectionMatrix),T.setValue(xt,"viewMatrix",t.matrixWorldInverse));const e=T.map.cameraPosition;void 0!==e&&e.setValue(xt,j.setFromMatrixPosition(t.matrixWorld)),K.logarithmicDepthBuffer&&T.setValue(xt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&T.setValue(xt,"isOrthographic",!0===t.isOrthographicCamera),M!==t&&(M=t,I=!0,B=!0)}if(r.isSkinnedMesh){T.setOptional(xt,r,"bindMatrix"),T.setOptional(xt,r,"bindMatrixInverse");const t=r.skeleton;t&&(null===t.boneTexture&&t.computeBoneTexture(),T.setValue(xt,"boneTexture",t.boneTexture,et))}r.isBatchedMesh&&(T.setOptional(xt,r,"batchingTexture"),T.setValue(xt,"batchingTexture",r._matricesTexture,et),T.setOptional(xt,r,"batchingIdTexture"),T.setValue(xt,"batchingIdTexture",r._indirectTexture,et),T.setOptional(xt,r,"batchingColorTexture"),null!==r._colorsTexture&&T.setValue(xt,"batchingColorTexture",r._colorsTexture,et));const L=n.morphAttributes;var U,O;if(void 0===L.position&&void 0===L.normal&&void 0===L.color||ft.update(r,n,C),(I||y.receiveShadow!==r.receiveShadow)&&(y.receiveShadow=r.receiveShadow,T.setValue(xt,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(R.envMap.value=l,R.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==e.environment&&(R.envMapIntensity.value=e.environmentIntensity),I&&(T.setValue(xt,"toneMappingExposure",E.toneMappingExposure),y.needsLights&&(O=B,(U=R).ambientLightColor.needsUpdate=O,U.lightProbe.needsUpdate=O,U.directionalLights.needsUpdate=O,U.directionalLightShadows.needsUpdate=O,U.pointLights.needsUpdate=O,U.pointLightShadows.needsUpdate=O,U.spotLights.needsUpdate=O,U.spotLightShadows.needsUpdate=O,U.rectAreaLights.needsUpdate=O,U.hemisphereLights.needsUpdate=O),s&&!0===i.fog&<.refreshFogUniforms(R,s),lt.refreshMaterialUniforms(R,i,P,D,g.state.transmissionRenderTarget[t.id]),Hf.upload(xt,Gt(y),R,et)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Hf.upload(xt,Gt(y),R,et),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&T.setValue(xt,"center",r.center),C.numMultiviewViews>0?pt.updateObjectMatricesUniforms(r,t,T):(T.setValue(xt,"modelViewMatrix",r.modelViewMatrix),T.setValue(xt,"normalMatrix",r.normalMatrix)),T.setValue(xt,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const t=i.uniformsGroups;for(let e=0,n=t.length;e<n;e++){const n=t[e];Et.update(n,C),Et.bind(n,C)}}return C}(t,e,n,i,r);Z.setMaterial(i,o);let l=n.index,c=1;if(!0===i.wireframe){if(l=st.getWireframeAttribute(n),void 0===l)return;c=2}const h=n.drawRange,u=n.attributes.position;let d=h.start*c,p=(h.start+h.count)*c;null!==s&&(d=Math.max(d,s.start*c),p=Math.min(p,(s.start+s.count)*c)),null!==l?(d=Math.max(d,0),p=Math.min(p,l.count)):null!=u&&(d=Math.max(d,0),p=Math.min(p,u.count));const A=p-d;if(A<0||A===1/0)return;let f;yt.setup(r,i,a,n,l);let m=mt;if(null!==l&&(f=rt.get(l),m=gt,m.setIndex(f)),r.isMesh)!0===i.wireframe?(Z.setLineWidth(i.wireframeLinewidth*Y()),m.setMode(xt.LINES)):m.setMode(xt.TRIANGLES);else if(r.isLine){let t=i.linewidth;void 0===t&&(t=1),Z.setLineWidth(t*Y()),r.isLineSegments?m.setMode(xt.LINES):r.isLineLoop?m.setMode(xt.LINE_LOOP):m.setMode(xt.LINE_STRIP)}else r.isPoints?m.setMode(xt.POINTS):r.isSprite&&m.setMode(xt.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)m.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(J.get("WEBGL_multi_draw"))m.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const t=r._multiDrawStarts,e=r._multiDrawCounts,n=r._multiDrawCount,s=l?rt.get(l).bytesPerElement:1,o=tt.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)o.setValue(xt,"_gl_DrawID",i),m.render(t[i]/s,e[i])}else if(r.isInstancedMesh)m.renderInstances(d,A,r.count);else if(n.isInstancedBufferGeometry){const t=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,e=Math.min(n.instanceCount,t);m.renderInstances(d,A,e)}else m.render(d,A)},this.compile=function(t,e,n=null){null===n&&(n=t),g=ht.get(n),g.init(e),y.push(g),n.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(g.pushLight(t),t.castShadow&&g.pushShadow(t))})),t!==n&&t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(g.pushLight(t),t.castShadow&&g.pushShadow(t))})),g.setupLights();const i=new Set;return t.traverse((function(t){if(!(t.isMesh||t.isPoints||t.isLine||t.isSprite))return;const e=t.material;if(e)if(Array.isArray(e))for(let r=0;r<e.length;r++){const s=e[r];Bt(s,n,t),i.add(s)}else Bt(e,n,t),i.add(e)})),y.pop(),g=null,i},this.compileAsync=function(t,e,n=null){const i=this.compile(t,e,n);return new Promise((e=>{function n(){i.forEach((function(t){tt.get(t).currentProgram.isReady()&&i.delete(t)})),0!==i.size?setTimeout(n,10):e(t)}null!==J.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};let Tt=null;function Rt(){Pt.stop()}function Dt(){Pt.start()}const Pt=new eA;function Ut(t,e,n,i){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)g.pushLight(t),t.castShadow&&g.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||Q.intersectsSprite(t)){i&&W.setFromMatrixPosition(t.matrixWorld).applyMatrix4(V);const e=ot.update(t),r=t.material;r.visible&&m.push(t,e,r,n,W.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||Q.intersectsObject(t))){const e=ot.update(t),r=t.material;if(i&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),W.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),W.copy(e.boundingSphere.center)),W.applyMatrix4(t.matrixWorld).applyMatrix4(V)),Array.isArray(r)){const i=e.groups;for(let s=0,o=i.length;s<o;s++){const o=i[s],a=r[o.materialIndex];a&&a.visible&&m.push(t,e,a,n,W.z,o)}}else r.visible&&m.push(t,e,r,n,W.z,null)}const r=t.children;for(let t=0,s=r.length;t<s;t++)Ut(r[t],e,n,i)}function Ot(t,e,n,i){const r=t.opaque,s=t.transmissive,o=t.transparent;g.setupLightsView(n),!0===G&&ut.setGlobalState(E.clippingPlanes,n),i&&Z.viewport(S.copy(i)),r.length>0&&kt(r,e,n),s.length>0&&kt(s,e,n),o.length>0&&kt(o,e,n),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Ft(t,e,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===g.state.transmissionRenderTarget[i.id]&&(g.state.transmissionRenderTarget[i.id]=new ts(1,1,{generateMipmaps:!0,type:J.has("EXT_color_buffer_half_float")||J.has("EXT_color_buffer_float")?dn:sn,minFilter:nn,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:zr.workingColorSpace}));const s=g.state.transmissionRenderTarget[i.id],o=i.viewport||S;s.setSize(o.z*E.transmissionResolutionScale,o.w*E.transmissionResolutionScale);const a=E.getRenderTarget();E.setRenderTarget(s),E.getClearColor(T),R=E.getClearAlpha(),R<1&&E.setClearColor(16777215,.5),E.clear(),X&&At.render(n);const l=E.toneMapping;E.toneMapping=Be;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),g.setupLightsView(i),!0===G&&ut.setGlobalState(E.clippingPlanes,i),kt(t,n,i),et.updateMultisampleRenderTarget(s),et.updateRenderTargetMipmap(s),!1===J.has("WEBGL_multisampled_render_to_texture")){let t=!1;for(let r=0,s=e.length;r<s;r++){const s=e[r],o=s.object,a=s.geometry,l=s.material,c=s.group;if(l.side===jt&&o.layers.test(i.layers)){const e=l.side;l.side=Vt,l.needsUpdate=!0,Nt(o,n,i,a,l,c),l.side=e,l.needsUpdate=!0,t=!0}}!0===t&&(et.updateMultisampleRenderTarget(s),et.updateRenderTargetMipmap(s))}E.setRenderTarget(a),E.setClearColor(T,R),void 0!==c&&(i.viewport=c),E.toneMapping=l}function kt(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r<s;r++){const s=t[r],o=s.object,a=s.geometry,l=null===i?s.material:i,c=s.group;o.layers.test(n.layers)&&Nt(o,e,n,a,l,c)}}function Nt(t,e,n,i,r,s){t.onBeforeRender(E,e,n,i,r,s),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(E,e,n,i,t,s),!0===r.transparent&&r.side===jt&&!1===r.forceSinglePass?(r.side=Vt,r.needsUpdate=!0,E.renderBufferDirect(n,e,i,r,t,s),r.side=Ht,r.needsUpdate=!0,E.renderBufferDirect(n,e,i,r,t,s),r.side=jt):E.renderBufferDirect(n,e,i,r,t,s),t.onAfterRender(E,e,n,i,r,s)}function Qt(t,e,n){!0!==e.isScene&&(e=q);const i=tt.get(t),r=g.state.lights,s=g.state.shadowsArray,o=r.state.version,a=at.getParameters(t,r.state,s,e,n),l=at.getProgramCacheKey(a);let c=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=(t.isMeshStandardMaterial?it:nt).get(t.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===t.envMap?e.environmentRotation:t.envMapRotation,void 0===c&&(t.addEventListener("dispose",It),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===o)return zt(t,a),h}else a.uniforms=at.getUniforms(t),t.onBeforeCompile(a,E),h=at.acquireProgram(a,l),c.set(l,h),i.uniforms=a.uniforms;const u=i.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(u.clippingPlanes=ut.uniform),zt(t,a),i.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),i.lightsStateVersion=o,i.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotLightMatrix.value=r.state.spotLightMatrix,u.spotLightMap.value=r.state.spotLightMap,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=h,i.uniformsList=null,h}function Gt(t){if(null===t.uniformsList){const e=t.currentProgram.getUniforms();t.uniformsList=Hf.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function zt(t,e){const n=tt.get(t);n.outputColorSpace=e.outputColorSpace,n.batching=e.batching,n.batchingColor=e.batchingColor,n.instancing=e.instancing,n.instancingColor=e.instancingColor,n.instancingMorph=e.instancingMorph,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphColors=e.morphColors,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents,n.toneMapping=e.toneMapping,n.numMultiviewViews=e.numMultiviewViews}var Wt;Pt.setAnimationLoop((function(t){Tt&&Tt(t)})),"undefined"!=typeof self&&Pt.setContext(self),this.setAnimationLoop=function(t){Tt=t,wt.setAnimationLoop(t),null===t?Pt.stop():Pt.start()},wt.addEventListener("sessionstart",Rt),wt.addEventListener("sessionend",Dt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===x)return;if(!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===wt.enabled&&!0===wt.isPresenting&&(!0===wt.cameraAutoUpdate&&wt.updateCamera(e),e=wt.getCamera()),!0===t.isScene&&t.onBeforeRender(E,t,e,w),g=ht.get(t,y.length),g.init(e),y.push(g),V.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Q.setFromProjectionMatrix(V),z=this.localClippingEnabled,G=ut.init(this.clippingPlanes,z),m=ct.get(t,v.length),m.init(),v.push(m),!0===wt.enabled&&!0===wt.isPresenting){const t=E.xr.getDepthSensingMesh();null!==t&&Ut(t,e,-1/0,E.sortObjects)}Ut(t,e,0,E.sortObjects),m.finish(),!0===E.sortObjects&&m.sort(U,O),X=!1===wt.enabled||!1===wt.isPresenting||!1===wt.hasDepthSensing(),X&&At.addToRenderList(m,t),this.info.render.frame++,!0===G&&ut.beginShadows();const n=g.state.shadowsArray;dt.render(n,t,e),!0===G&&ut.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=m.opaque,r=m.transmissive;if(g.setupLights(),e.isArrayCamera){const n=e.cameras;if(r.length>0)for(let e=0,s=n.length;e<s;e++)Ft(i,r,t,n[e]);if(X&&At.render(t),wt.enabled&&wt.isMultiview)et.setDeferTextureUploads(!0),Ot(m,t,e,e.cameras[0].viewport);else for(let e=0,i=n.length;e<i;e++){const i=n[e];Ot(m,t,i,i.viewport)}}else r.length>0&&Ft(i,r,t,e),X&&At.render(t),Ot(m,t,e);null!==w&&0===C&&(et.updateMultisampleRenderTarget(w),et.updateRenderTargetMipmap(w)),!0===t.isScene&&t.onAfterRender(E,t,e),yt.resetDefaultState(),_=-1,M=null,y.pop(),y.length>0?(g=y[y.length-1],!0===G&&ut.setGlobalState(E.clippingPlanes,g.state.camera)):g=null,v.pop(),m=v.length>0?v[v.length-1]:null},this.setTexture2D=(Wt=!1,function(t,e){t&&t.isWebGLRenderTarget&&(Wt||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),Wt=!0),t=t.texture),et.setTexture2D(t,e)}),this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(t,e,n){tt.get(t.texture).__webglTexture=e,tt.get(t.depthTexture).__webglTexture=n;const i=tt.get(t);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||w&&w.isWebGLMultiviewRenderTarget||!0===J.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(t,e){const n=tt.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e};const qt=xt.createFramebuffer();this.setRenderTarget=function(t,e=0,n=0){null===t&&this.xr.isPresenting&&(t=this.xr.getRenderTarget()),w=t,b=e,C=n;let i=!0,r=null,s=!1,o=!1;if(t){const a=tt.get(t);if(void 0!==a.__useDefaultFramebuffer)Z.bindFramebuffer(xt.FRAMEBUFFER,null),i=!1;else if(void 0===a.__webglFramebuffer)et.setupRenderTarget(t);else if(a.__hasExternalTextures)et.rebindTextures(t,tt.get(t.texture).__webglTexture,tt.get(t.depthTexture).__webglTexture);else if(t.depthBuffer){const e=t.depthTexture;if(a.__boundDepthTexture!==e){if(null!==e&&tt.has(e)&&(t.width!==e.image.width||t.height!==e.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");et.setupDepthRenderbuffer(t)}}const l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);const c=tt.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=Array.isArray(c[e])?c[e][n]:c[e],s=!0):r=t.samples>0&&!1===et.useMultisampledRTT(t)?tt.get(t).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,S.copy(t.viewport),I.copy(t.scissor),B=t.scissorTest}else S.copy(F).multiplyScalar(P).floor(),I.copy(k).multiplyScalar(P).floor(),B=N;if(0!==n&&(r=qt),Z.bindFramebuffer(xt.FRAMEBUFFER,r)&&i&&Z.drawBuffers(t,r),Z.viewport(S),Z.scissor(I),Z.setScissorTest(B),s){const i=tt.get(t.texture);xt.framebufferTexture2D(xt.FRAMEBUFFER,xt.COLOR_ATTACHMENT0,xt.TEXTURE_CUBE_MAP_POSITIVE_X+e,i.__webglTexture,n)}else if(o){const i=tt.get(t.texture),r=e;xt.framebufferTextureLayer(xt.FRAMEBUFFER,xt.COLOR_ATTACHMENT0,i.__webglTexture,n,r)}else if(null!==t&&0!==n){const e=tt.get(t.texture);xt.framebufferTexture2D(xt.FRAMEBUFFER,xt.COLOR_ATTACHMENT0,xt.TEXTURE_2D,e.__webglTexture,n)}_=-1},this.readRenderTargetPixels=function(t,e,n,i,r,s,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=tt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){Z.bindFramebuffer(xt.FRAMEBUFFER,a);try{const o=t.texture,a=o.format,l=o.type;if(!K.textureFormatReadable(a))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!K.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&xt.readPixels(e,n,i,r,vt.convert(a),vt.convert(l),s)}finally{const t=null!==w?tt.get(w).__webglFramebuffer:null;Z.bindFramebuffer(xt.FRAMEBUFFER,t)}}},this.readRenderTargetPixelsAsync=async function(t,e,n,i,r,s,o){if(!t||!t.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=tt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){const o=t.texture,l=o.format,c=o.type;if(!K.textureFormatReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!K.textureTypeReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r){Z.bindFramebuffer(xt.FRAMEBUFFER,a);const t=xt.createBuffer();xt.bindBuffer(xt.PIXEL_PACK_BUFFER,t),xt.bufferData(xt.PIXEL_PACK_BUFFER,s.byteLength,xt.STREAM_READ),xt.readPixels(e,n,i,r,vt.convert(l),vt.convert(c),0);const o=null!==w?tt.get(w).__webglFramebuffer:null;Z.bindFramebuffer(xt.FRAMEBUFFER,o);const h=xt.fenceSync(xt.SYNC_GPU_COMMANDS_COMPLETE,0);return xt.flush(),await function(t,e){return new Promise((function(n,i){setTimeout((function r(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:i();break;case t.TIMEOUT_EXPIRED:setTimeout(r,4);break;default:n()}}),4)}))}(xt,h),xt.bindBuffer(xt.PIXEL_PACK_BUFFER,t),xt.getBufferSubData(xt.PIXEL_PACK_BUFFER,0,s),xt.deleteBuffer(t),xt.deleteSync(h),s}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(t,e=null,n=0){!0!==t.isTexture&&(kr("WebGLRenderer: copyFramebufferToTexture function signature has changed."),e=arguments[0]||null,t=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),s=Math.floor(t.image.height*i),o=null!==e?e.x:0,a=null!==e?e.y:0;et.setTexture2D(t,0),xt.copyTexSubImage2D(xt.TEXTURE_2D,n,0,0,o,a,r,s),Z.unbindTexture()};const Xt=xt.createFramebuffer(),Yt=xt.createFramebuffer();this.copyTextureToTexture=function(t,e,n=null,i=null,r=0,s=null){let o,a,l,c,h,u,d,p,A;!0!==t.isTexture&&(kr("WebGLRenderer: copyTextureToTexture function signature has changed."),i=arguments[0]||null,t=arguments[1],e=arguments[2],s=arguments[3]||0,n=null),null===s&&(0!==r?(kr("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),s=r,r=0):s=0);const f=t.isCompressedTexture?t.mipmaps[s]:t.image;if(null!==n)o=n.max.x-n.min.x,a=n.max.y-n.min.y,l=n.isBox3?n.max.z-n.min.z:1,c=n.min.x,h=n.min.y,u=n.isBox3?n.min.z:0;else{const e=Math.pow(2,-r);o=Math.floor(f.width*e),a=Math.floor(f.height*e),l=t.isDataArrayTexture?f.depth:t.isData3DTexture?Math.floor(f.depth*e):1,c=0,h=0,u=0}null!==i?(d=i.x,p=i.y,A=i.z):(d=0,p=0,A=0);const m=vt.convert(e.format),g=vt.convert(e.type);let v;e.isData3DTexture?(et.setTexture3D(e,0),v=xt.TEXTURE_3D):e.isDataArrayTexture||e.isCompressedArrayTexture?(et.setTexture2DArray(e,0),v=xt.TEXTURE_2D_ARRAY):(et.setTexture2D(e,0),v=xt.TEXTURE_2D),xt.pixelStorei(xt.UNPACK_FLIP_Y_WEBGL,e.flipY),xt.pixelStorei(xt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),xt.pixelStorei(xt.UNPACK_ALIGNMENT,e.unpackAlignment);const y=xt.getParameter(xt.UNPACK_ROW_LENGTH),E=xt.getParameter(xt.UNPACK_IMAGE_HEIGHT),x=xt.getParameter(xt.UNPACK_SKIP_PIXELS),b=xt.getParameter(xt.UNPACK_SKIP_ROWS),C=xt.getParameter(xt.UNPACK_SKIP_IMAGES);xt.pixelStorei(xt.UNPACK_ROW_LENGTH,f.width),xt.pixelStorei(xt.UNPACK_IMAGE_HEIGHT,f.height),xt.pixelStorei(xt.UNPACK_SKIP_PIXELS,c),xt.pixelStorei(xt.UNPACK_SKIP_ROWS,h),xt.pixelStorei(xt.UNPACK_SKIP_IMAGES,u);const w=t.isDataArrayTexture||t.isData3DTexture,_=e.isDataArrayTexture||e.isData3DTexture;if(t.isDepthTexture){const n=tt.get(t),i=tt.get(e),f=tt.get(n.__renderTarget),m=tt.get(i.__renderTarget);Z.bindFramebuffer(xt.READ_FRAMEBUFFER,f.__webglFramebuffer),Z.bindFramebuffer(xt.DRAW_FRAMEBUFFER,m.__webglFramebuffer);for(let n=0;n<l;n++)w&&(xt.framebufferTextureLayer(xt.READ_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,tt.get(t).__webglTexture,r,u+n),xt.framebufferTextureLayer(xt.DRAW_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,tt.get(e).__webglTexture,s,A+n)),xt.blitFramebuffer(c,h,o,a,d,p,o,a,xt.DEPTH_BUFFER_BIT,xt.NEAREST);Z.bindFramebuffer(xt.READ_FRAMEBUFFER,null),Z.bindFramebuffer(xt.DRAW_FRAMEBUFFER,null)}else if(0!==r||t.isRenderTargetTexture||tt.has(t)){const n=tt.get(t),i=tt.get(e);Z.bindFramebuffer(xt.READ_FRAMEBUFFER,Xt),Z.bindFramebuffer(xt.DRAW_FRAMEBUFFER,Yt);for(let t=0;t<l;t++)w?xt.framebufferTextureLayer(xt.READ_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,n.__webglTexture,r,u+t):xt.framebufferTexture2D(xt.READ_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,xt.TEXTURE_2D,n.__webglTexture,r),_?xt.framebufferTextureLayer(xt.DRAW_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,i.__webglTexture,s,A+t):xt.framebufferTexture2D(xt.DRAW_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,xt.TEXTURE_2D,i.__webglTexture,s),0!==r?xt.blitFramebuffer(c,h,o,a,d,p,o,a,xt.COLOR_BUFFER_BIT,xt.NEAREST):_?xt.copyTexSubImage3D(v,s,d,p,A+t,c,h,o,a):xt.copyTexSubImage2D(v,s,d,p,c,h,o,a);Z.bindFramebuffer(xt.READ_FRAMEBUFFER,null),Z.bindFramebuffer(xt.DRAW_FRAMEBUFFER,null)}else _?t.isDataTexture||t.isData3DTexture?xt.texSubImage3D(v,s,d,p,A,o,a,l,m,g,f.data):e.isCompressedArrayTexture?xt.compressedTexSubImage3D(v,s,d,p,A,o,a,l,m,f.data):xt.texSubImage3D(v,s,d,p,A,o,a,l,m,g,f):t.isDataTexture?xt.texSubImage2D(xt.TEXTURE_2D,s,d,p,o,a,m,g,f.data):t.isCompressedTexture?xt.compressedTexSubImage2D(xt.TEXTURE_2D,s,d,p,f.width,f.height,m,f.data):xt.texSubImage2D(xt.TEXTURE_2D,s,d,p,o,a,m,g,f);xt.pixelStorei(xt.UNPACK_ROW_LENGTH,y),xt.pixelStorei(xt.UNPACK_IMAGE_HEIGHT,E),xt.pixelStorei(xt.UNPACK_SKIP_PIXELS,x),xt.pixelStorei(xt.UNPACK_SKIP_ROWS,b),xt.pixelStorei(xt.UNPACK_SKIP_IMAGES,C),0===s&&e.generateMipmaps&&xt.generateMipmap(v),Z.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n=null,i=null,r=0){return!0!==t.isTexture&&(kr("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,i=arguments[1]||null,t=arguments[2],e=arguments[3],r=arguments[4]||0),kr('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(t,e,n,i,r)},this.initRenderTarget=function(t){void 0===tt.get(t).__webglFramebuffer&&et.setupRenderTarget(t)},this.initTexture=function(t){t.isCubeTexture?et.setTextureCube(t,0):t.isData3DTexture?et.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?et.setTexture2DArray(t,0):et.setTexture2D(t,0),Z.unbindTexture()},this.resetState=function(){b=0,C=0,w=null,Z.reset(),yt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ar}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorspace=zr._getDrawingBufferColorSpace(t),e.unpackColorSpace=zr._getUnpackColorSpace()}}const Fm=new WeakMap;function km(){let t,e;function n(t,e,n,i,r,s){const o=s.num_components(),a=n.num_points()*o,l=a*r.BYTES_PER_ELEMENT,c=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32}}(t,r),h=t._malloc(l);e.GetAttributeDataArrayForAllPoints(n,s,c,l,h);const u=new r(t.HEAPF32.buffer,h,a).slice();return t._free(h),{name:i,array:u,itemSize:o}}onmessage=function(i){const r=i.data;switch(r.type){case"init":t=r.decoderConfig,e=new Promise((function(e){t.onModuleLoaded=function(t){e({draco:t})},DracoDecoderModule(t)}));break;case"decode":const i=r.buffer,s=r.taskConfig;e.then((t=>{const e=t.draco,o=new e.Decoder;try{const t=function(t,e,i,r){const s=r.attributeIDs,o=r.attributeTypes;let a,l;const c=e.GetEncodedGeometryType(i);if(c===t.TRIANGULAR_MESH)a=new t.Mesh,l=e.DecodeArrayToMesh(i,i.byteLength,a);else{if(c!==t.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new t.PointCloud,l=e.DecodeArrayToPointCloud(i,i.byteLength,a)}if(!l.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in s){const l=self[o[i]];let c,u;if(r.useUniqueIDs)u=s[i],c=e.GetAttributeByUniqueId(a,u);else{if(u=e.GetAttributeId(a,t[s[i]]),-1===u)continue;c=e.GetAttribute(a,u)}const d=n(t,e,a,i,l,c);"color"===i&&(d.vertexColorSpace=r.vertexColorSpace),h.attributes.push(d)}return c===t.TRIANGULAR_MESH&&(h.index=function(t,e,n){const i=3*n.num_faces(),r=4*i,s=t._malloc(r);e.GetTrianglesUInt32Array(n,r,s);const o=new Uint32Array(t.HEAPF32.buffer,s,i).slice();return t._free(s),{array:o,itemSize:1}}(t,e,a)),t.destroy(a),h}(e,o,new Int8Array(i),s),a=t.attributes.map((t=>t.array.buffer));t.index&&a.push(t.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:t},a)}catch(t){console.error(t),self.postMessage({type:"error",id:r.id,error:t.message})}finally{e.destroy(o)}}))}}}function Nm(t,e,n=!0){if(!e||!e.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!t.hasAttribute("position")||!t.hasAttribute("normal")||!t.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function i(t){if(t.normalized||t.isInterleavedBufferAttribute){const e=new Float32Array(t.count*t.itemSize);for(let n=0,i=0;n<t.count;n++)e[i++]=t.getX(n),e[i++]=t.getY(n),t.itemSize>2&&(e[i++]=t.getZ(n));return e}return t.array instanceof Float32Array?t.array:new Float32Array(t.array)}const r=t.index?t.toNonIndexed():t,s=e.generateTangents(i(r.attributes.position),i(r.attributes.normal),i(r.attributes.uv));if(n)for(let t=3;t<s.length;t+=4)s[t]*=-1;return r.setAttribute("tangent",new zo(s,4)),t!==r&&t.copy(r),t}function Qm(t,e=!1){const n=null!==t[0].index,i=new Set(Object.keys(t[0].attributes)),r=new Set(Object.keys(t[0].morphAttributes)),s={},o={},a=t[0].morphTargetsRelative,l=new sa;let c=0;for(let h=0;h<t.length;++h){const u=t[h];let d=0;if(n!==(null!==u.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const t in u.attributes){if(!i.has(t))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+t+'" attribute exists among all geometries, or in none of them.'),null;void 0===s[t]&&(s[t]=[]),s[t].push(u.attributes[t]),d++}if(d!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const t in u.morphAttributes){if(!r.has(t))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;void 0===o[t]&&(o[t]=[]),o[t].push(u.morphAttributes[t])}if(e){let t;if(n)t=u.index.count;else{if(void 0===u.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;t=u.attributes.position.count}l.addGroup(c,t,h),c+=t}}if(n){let e=0;const n=[];for(let i=0;i<t.length;++i){const r=t[i].index;for(let t=0;t<r.count;++t)n.push(r.getX(t)+e);e+=t[i].attributes.position.count}l.setIndex(n)}for(const t in s){const e=Gm(s[t]);if(!e)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+t+" attribute."),null;l.setAttribute(t,e)}for(const t in o){const e=o[t][0].length;if(0===e)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[t]=[];for(let n=0;n<e;++n){const e=[];for(let i=0;i<o[t].length;++i)e.push(o[t][i][n]);const i=Gm(e);if(!i)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+t+" morphAttribute."),null;l.morphAttributes[t].push(i)}}return l}function Gm(t){let e,n,i,r=-1,s=0;for(let o=0;o<t.length;++o){const a=t[o];if(void 0===e&&(e=a.array.constructor),e!==a.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===n&&(n=a.itemSize),n!==a.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===i&&(i=a.normalized),i!==a.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===r&&(r=a.gpuType),r!==a.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=a.count*n}const o=new e(s),a=new zo(o,n,i);let l=0;for(let e=0;e<t.length;++e){const i=t[e];if(i.isInterleavedBufferAttribute){const t=l/n;for(let e=0,r=i.count;e<r;e++)for(let r=0;r<n;r++){const n=i.getComponent(e,r);a.setComponent(e+t,r,n)}}else o.set(i.array,l);l+=i.count*n}return void 0!==r&&(a.gpuType=r),a}function zm(t){return t.isInstancedInterleavedBufferAttribute||t.isInterleavedBufferAttribute?Vm(t):t.isInstancedBufferAttribute?(new Cl).copy(t):(new zo).copy(t)}function Hm(t){let e,n=0,i=0;for(let r=0,s=t.length;r<s;++r){const s=t[r];if(void 0===e&&(e=s.array.constructor),e!==s.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;n+=s.array.length,i+=s.itemSize}const r=new Qa(new e(n),i);let s=0;const o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let e=0,n=t.length;e<n;e++){const n=t[e],i=n.itemSize,c=n.count,h=new za(r,i,s,n.normalized);o.push(h),s+=i;for(let t=0;t<c;t++)for(let e=0;e<i;e++)h[l[e]](t,n[a[e]](t))}return o}function Vm(t){const e=t.data.array.constructor,n=t.count,i=t.itemSize,r=t.normalized,s=new e(n*i);let o;o=t.isInstancedInterleavedBufferAttribute?new Cl(s,i,r,t.meshPerAttribute):new zo(s,i,r);for(let e=0;e<n;e++)o.setX(e,t.getX(e)),i>=2&&o.setY(e,t.getY(e)),i>=3&&o.setZ(e,t.getZ(e)),i>=4&&o.setW(e,t.getW(e));return o}function jm(t){const e=t.attributes,n=t.morphTargets,i=new Map;for(const t in e){const n=e[t];n.isInterleavedBufferAttribute&&(i.has(n)||i.set(n,Vm(n)),e[t]=i.get(n))}for(const t in n){const e=n[t];e.isInterleavedBufferAttribute&&(i.has(e)||i.set(e,Vm(e)),n[t]=i.get(e))}}function Wm(t){let e=0;for(const n in t.attributes){const i=t.getAttribute(n);e+=i.count*i.itemSize*i.array.BYTES_PER_ELEMENT}const n=t.getIndex();return e+=n?n.count*n.itemSize*n.array.BYTES_PER_ELEMENT:0,e}function qm(t,e=1e-4){e=Math.max(e,Number.EPSILON);const n={},i=t.getIndex(),r=t.getAttribute("position"),s=i?i.count:r.count;let o=0;const a=Object.keys(t.attributes),l={},c={},h=[],u=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"];for(let e=0,n=a.length;e<n;e++){const n=a[e],i=t.attributes[n];l[n]=new i.constructor(new i.array.constructor(i.count*i.itemSize),i.itemSize,i.normalized);const r=t.morphAttributes[n];r&&(c[n]||(c[n]=[]),r.forEach(((t,e)=>{const i=new t.array.constructor(t.count*t.itemSize);c[n][e]=new t.constructor(i,t.itemSize,t.normalized)})))}const p=.5*e,A=Math.log10(1/e),f=Math.pow(10,A),m=p*f;for(let e=0;e<s;e++){const r=i?i.getX(e):e;let s="";for(let e=0,n=a.length;e<n;e++){const n=a[e],i=t.getAttribute(n),o=i.itemSize;for(let t=0;t<o;t++)s+=~~(i[u[t]](r)*f+m)+","}if(s in n)h.push(n[s]);else{for(let e=0,n=a.length;e<n;e++){const n=a[e],i=t.getAttribute(n),s=t.morphAttributes[n],h=i.itemSize,p=l[n],A=c[n];for(let t=0;t<h;t++){const e=u[t],n=d[t];if(p[n](o,i[e](r)),s)for(let t=0,i=s.length;t<i;t++)A[t][n](o,s[t][e](r))}}n[s]=o,h.push(o),o++}}const g=t.clone();for(const e in t.attributes){const t=l[e];if(g.setAttribute(e,new t.constructor(t.array.slice(0,o*t.itemSize),t.itemSize,t.normalized)),e in c)for(let t=0;t<c[e].length;t++){const n=c[e][t];g.morphAttributes[e][t]=new n.constructor(n.array.slice(0,o*n.itemSize),n.itemSize,n.normalized)}}return g.setIndex(h),g}function Xm(t,e){if(e===yi)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===xi||e===Ei){let n=t.getIndex();if(null===n){const e=[],i=t.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(let t=0;t<i.count;t++)e.push(t);t.setIndex(e),n=t.getIndex()}const i=n.count-2,r=[];if(e===xi)for(let t=1;t<=i;t++)r.push(n.getX(0)),r.push(n.getX(t)),r.push(n.getX(t+1));else for(let t=0;t<i;t++)t%2==0?(r.push(n.getX(t)),r.push(n.getX(t+1)),r.push(n.getX(t+2))):(r.push(n.getX(t+2)),r.push(n.getX(t+1)),r.push(n.getX(t)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=t.clone();return s.setIndex(r),s.clearGroups(),s}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t}function Ym(t){const e=new os,n=new os,i=new os,r=new os,s=new os,o=new os,a=new os,l=new os,c=new os;function h(t,h,u,d,p,A,f,m){e.fromBufferAttribute(h,p),n.fromBufferAttribute(h,A),i.fromBufferAttribute(h,f);const g=t.morphTargetInfluences;if(u&&g){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let t=0,h=u.length;t<h;t++){const h=g[t],m=u[t];0!==h&&(r.fromBufferAttribute(m,p),s.fromBufferAttribute(m,A),o.fromBufferAttribute(m,f),d?(a.addScaledVector(r,h),l.addScaledVector(s,h),c.addScaledVector(o,h)):(a.addScaledVector(r.sub(e),h),l.addScaledVector(s.sub(n),h),c.addScaledVector(o.sub(i),h)))}e.add(a),n.add(l),i.add(c)}t.isSkinnedMesh&&(t.applyBoneTransform(p,e),t.applyBoneTransform(A,n),t.applyBoneTransform(f,i)),m[3*p+0]=e.x,m[3*p+1]=e.y,m[3*p+2]=e.z,m[3*A+0]=n.x,m[3*A+1]=n.y,m[3*A+2]=n.z,m[3*f+0]=i.x,m[3*f+1]=i.y,m[3*f+2]=i.z}const u=t.geometry,d=t.material;let p,A,f;const m=u.index,g=u.attributes.position,v=u.morphAttributes.position,y=u.morphTargetsRelative,E=u.attributes.normal,x=u.morphAttributes.position,b=u.groups,C=u.drawRange;let w,_,M,S,I,B,T;const R=new Float32Array(g.count*g.itemSize),L=new Float32Array(E.count*E.itemSize);if(null!==m)if(Array.isArray(d))for(w=0,M=b.length;w<M;w++)for(I=b[w],B=Math.max(I.start,C.start),T=Math.min(I.start+I.count,C.start+C.count),_=B,S=T;_<S;_+=3)p=m.getX(_),A=m.getX(_+1),f=m.getX(_+2),h(t,g,v,y,p,A,f,R),h(t,E,x,y,p,A,f,L);else for(B=Math.max(0,C.start),T=Math.min(m.count,C.start+C.count),w=B,M=T;w<M;w+=3)p=m.getX(w),A=m.getX(w+1),f=m.getX(w+2),h(t,g,v,y,p,A,f,R),h(t,E,x,y,p,A,f,L);else if(Array.isArray(d))for(w=0,M=b.length;w<M;w++)for(I=b[w],B=Math.max(I.start,C.start),T=Math.min(I.start+I.count,C.start+C.count),_=B,S=T;_<S;_+=3)p=_,A=_+1,f=_+2,h(t,g,v,y,p,A,f,R),h(t,E,x,y,p,A,f,L);else for(B=Math.max(0,C.start),T=Math.min(g.count,C.start+C.count),w=B,M=T;w<M;w+=3)p=w,A=w+1,f=w+2,h(t,g,v,y,p,A,f,R),h(t,E,x,y,p,A,f,L);return{positionAttribute:g,normalAttribute:E,morphedPositionAttribute:new Ko(R,3),morphedNormalAttribute:new Ko(L,3)}}function Jm(t){if(0===t.groups.length)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),t;let e=t.groups;if(e=e.sort(((t,e)=>t.materialIndex!==e.materialIndex?t.materialIndex-e.materialIndex:t.start-e.start)),null===t.getIndex()){const e=t.getAttribute("position"),n=[];for(let t=0;t<e.count;t+=3)n.push(t,t+1,t+2);t.setIndex(n)}const n=t.getIndex(),i=[];for(let t=0;t<e.length;t++){const r=e[t],s=r.start,o=s+r.count;for(let t=s;t<o;t++)i.push(n.getX(t))}t.dispose(),t.setIndex(i);let r=0;for(let t=0;t<e.length;t++){const n=e[t];n.start=r,r+=n.count}let s=e[0];t.groups=[s];for(let n=1;n<e.length;n++){const i=e[n];s.materialIndex===i.materialIndex?s.count+=i.count:(s=i,t.groups.push(s))}return t}function Km(t,e=Math.PI/3){const n=Math.cos(e),i=100*(1+1e-10),r=[new os,new os,new os],s=new os,o=new os,a=new os,l=new os;function c(t){return`${~~(t.x*i)},${~~(t.y*i)},${~~(t.z*i)}`}const h=t.index?t.toNonIndexed():t,u=h.attributes.position,d={};for(let t=0,e=u.count/3;t<e;t++){const e=3*t,n=r[0].fromBufferAttribute(u,e+0),i=r[1].fromBufferAttribute(u,e+1),a=r[2].fromBufferAttribute(u,e+2);s.subVectors(a,i),o.subVectors(n,i);const l=(new os).crossVectors(s,o).normalize();for(let t=0;t<3;t++){const e=c(r[t]);e in d||(d[e]=[]),d[e].push(l)}}const p=new Float32Array(3*u.count),A=new zo(p,3,!1);for(let t=0,e=u.count/3;t<e;t++){const e=3*t,i=r[0].fromBufferAttribute(u,e+0),h=r[1].fromBufferAttribute(u,e+1),p=r[2].fromBufferAttribute(u,e+2);s.subVectors(p,h),o.subVectors(i,h),a.crossVectors(s,o).normalize();for(let t=0;t<3;t++){const i=d[c(r[t])];l.set(0,0,0);for(let t=0,e=i.length;t<e;t++){const e=i[t];a.dot(e)>n&&l.add(e)}l.normalize(),A.setXYZ(e+t,l.x,l.y,l.z)}}return h.setAttribute("normal",A),h}function Zm(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const $m="KHR_binary_glTF",tg="KHR_draco_mesh_compression",eg="KHR_lights_punctual",ng="KHR_materials_clearcoat",ig="KHR_materials_dispersion",rg="KHR_materials_ior",sg="KHR_materials_sheen",og="KHR_materials_specular",ag="KHR_materials_transmission",lg="KHR_materials_iridescence",cg="KHR_materials_anisotropy",hg="KHR_materials_unlit",ug="KHR_materials_volume",dg="KHR_texture_basisu",pg="KHR_texture_transform",Ag="KHR_mesh_quantization",fg="KHR_materials_emissive_strength",mg="EXT_materials_bump",gg="EXT_texture_webp",vg="EXT_texture_avif",yg="EXT_meshopt_compression",Eg="EXT_mesh_gpu_instancing";class xg{constructor(t){this.parser=t,this.name=eg,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let n=0,i=e.length;n<i;n++){const i=e[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&t._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(t){const e=this.parser,n="light:"+t;let i=e.cache.get(n);if(i)return i;const r=e.json,s=((r.extensions&&r.extensions[this.name]||{}).lights||[])[t];let o;const a=new Bo(16777215);void 0!==s.color&&a.setRGB(s.color[0],s.color[1],s.color[2],Ti);const l=void 0!==s.range?s.range:0;switch(s.type){case"directional":o=new ad(a),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new rd(a),o.distance=l;break;case"spot":o=new $u(a),o.distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,o.angle=s.spot.outerConeAngle,o.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return o.position.set(0,0,0),iv(o,s),void 0!==s.intensity&&(o.intensity=s.intensity),o.name=e.createUniqueName(s.name||"light_"+t),i=Promise.resolve(o),e.cache.add(n,i),i}getDependency(t,e){if("light"===t)return this._loadLight(e)}createNodeAttachment(t){const e=this,n=this.parser,i=n.json.nodes[t],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(t){return n._getNodeRef(e.cache,r,t)}))}}class bg{constructor(){this.name=hg}getMaterialType(){return Do}extendParams(t,e,n){const i=[];t.color=new Bo(1,1,1),t.opacity=1;const r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;t.color.setRGB(e[0],e[1],e[2],Ti),t.opacity=e[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(t,"map",r.baseColorTexture,Bi))}return Promise.all(i)}}class Cg{constructor(t){this.parser=t,this.name=fg}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return void 0!==i&&(e.emissiveIntensity=i),Promise.resolve()}}class wg{constructor(t){this.parser=t,this.name=ng}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];if(void 0!==s.clearcoatFactor&&(e.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&r.push(n.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&r.push(n.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(r.push(n.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){const t=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new Br(t,t)}return Promise.all(r)}}class _g{constructor(t){this.parser=t,this.name=ig}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return e.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class Mg{constructor(t){this.parser=t,this.name=lg}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.iridescenceFactor&&(e.iridescence=s.iridescenceFactor),void 0!==s.iridescenceTexture&&r.push(n.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),void 0!==s.iridescenceIor&&(e.iridescenceIOR=s.iridescenceIor),void 0===e.iridescenceThicknessRange&&(e.iridescenceThicknessRange=[100,400]),void 0!==s.iridescenceThicknessMinimum&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),void 0!==s.iridescenceThicknessMaximum&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),void 0!==s.iridescenceThicknessTexture&&r.push(n.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class Sg{constructor(t){this.parser=t,this.name=sg}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];e.sheenColor=new Bo(0,0,0),e.sheenRoughness=0,e.sheen=1;const s=i.extensions[this.name];if(void 0!==s.sheenColorFactor){const t=s.sheenColorFactor;e.sheenColor.setRGB(t[0],t[1],t[2],Ti)}return void 0!==s.sheenRoughnessFactor&&(e.sheenRoughness=s.sheenRoughnessFactor),void 0!==s.sheenColorTexture&&r.push(n.assignTexture(e,"sheenColorMap",s.sheenColorTexture,Bi)),void 0!==s.sheenRoughnessTexture&&r.push(n.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(r)}}class Ig{constructor(t){this.parser=t,this.name=ag}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.transmissionFactor&&(e.transmission=s.transmissionFactor),void 0!==s.transmissionTexture&&r.push(n.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class Bg{constructor(t){this.parser=t,this.name=ug}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];e.thickness=void 0!==s.thicknessFactor?s.thicknessFactor:0,void 0!==s.thicknessTexture&&r.push(n.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const o=s.attenuationColor||[1,1,1];return e.attenuationColor=(new Bo).setRGB(o[0],o[1],o[2],Ti),Promise.all(r)}}class Tg{constructor(t){this.parser=t,this.name=rg}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return e.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class Rg{constructor(t){this.parser=t,this.name=og}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];e.specularIntensity=void 0!==s.specularFactor?s.specularFactor:1,void 0!==s.specularTexture&&r.push(n.assignTexture(e,"specularIntensityMap",s.specularTexture));const o=s.specularColorFactor||[1,1,1];return e.specularColor=(new Bo).setRGB(o[0],o[1],o[2],Ti),void 0!==s.specularColorTexture&&r.push(n.assignTexture(e,"specularColorMap",s.specularColorTexture,Bi)),Promise.all(r)}}class Lg{constructor(t){this.parser=t,this.name=mg}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return e.bumpScale=void 0!==s.bumpFactor?s.bumpFactor:1,void 0!==s.bumpTexture&&r.push(n.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(r)}}class Dg{constructor(t){this.parser=t,this.name=cg}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.anisotropyStrength&&(e.anisotropy=s.anisotropyStrength),void 0!==s.anisotropyRotation&&(e.anisotropyRotation=s.anisotropyRotation),void 0!==s.anisotropyTexture&&r.push(n.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class Pg{constructor(t){this.parser=t,this.name=dg}loadTexture(t){const e=this.parser,n=e.json,i=n.textures[t];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],s=e.options.ktx2Loader;if(!s){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,s)}}class Ug{constructor(t){this.parser=t,this.name=gg,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,i=n.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],o=i.images[s.source];let a=n.textureLoader;if(o.uri){const t=n.options.manager.getHandler(o.uri);null!==t&&(a=t)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(t,s.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class Og{constructor(t){this.parser=t,this.name=vg,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,i=n.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],o=i.images[s.source];let a=n.textureLoader;if(o.uri){const t=n.options.manager.getHandler(o.uri);null!==t&&(a=t)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(t,s.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class Fg{constructor(t){this.name=yg,this.parser=t}loadBufferView(t){const e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){const t=n.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(e){const n=t.byteOffset||0,i=t.byteLength||0,s=t.count,o=t.byteStride,a=new Uint8Array(e,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(s,o,a,t.mode,t.filter).then((function(t){return t.buffer})):r.ready.then((function(){const e=new ArrayBuffer(s*o);return r.decodeGltfBuffer(new Uint8Array(e),s,o,a,t.mode,t.filter),e}))}))}return null}}class kg{constructor(t){this.name=Eg,this.parser=t}createNodeMesh(t){const e=this.parser.json,n=e.nodes[t];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=e.meshes[n.mesh];for(const t of i.primitives)if(t.mode!==qg.TRIANGLES&&t.mode!==qg.TRIANGLE_STRIP&&t.mode!==qg.TRIANGLE_FAN&&void 0!==t.mode)return null;const r=n.extensions[this.name].attributes,s=[],o={};for(const t in r)s.push(this.parser.getDependency("accessor",r[t]).then((e=>(o[t]=e,o[t]))));return s.length<1?null:(s.push(this.parser.createNodeMesh(t)),Promise.all(s).then((t=>{const e=t.pop(),n=e.isGroup?e.children:[e],i=t[0].count,r=[];for(const t of n){const e=new Os,n=new os,s=new ss,a=new os(1,1,1),l=new Rl(t.geometry,t.material,i);for(let t=0;t<i;t++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,t),o.ROTATION&&s.fromBufferAttribute(o.ROTATION,t),o.SCALE&&a.fromBufferAttribute(o.SCALE,t),l.setMatrixAt(t,e.compose(n,s,a));for(const e in o)if("_COLOR_0"===e){const t=o[e];l.instanceColor=new Cl(t.array,t.itemSize,t.normalized)}else"TRANSLATION"!==e&&"ROTATION"!==e&&"SCALE"!==e&&t.geometry.setAttribute(e,o[e]);co.prototype.copy.call(l,t),this.parser.assignFinalMaterial(l),r.push(l)}return e.isGroup?(e.clear(),e.add(...r),e):r[0]})))}}const Ng="glTF";class Qg{constructor(t){this.name=$m,this.content=null,this.body=null;const e=new DataView(t,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Ng)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,r=new DataView(t,12);let s=0;for(;s<i;){const e=r.getUint32(s,!0);s+=4;const i=r.getUint32(s,!0);if(s+=4,1313821514===i){const i=new Uint8Array(t,12+s,e);this.content=n.decode(i)}else if(5130562===i){const n=12+s;this.body=t.slice(n,n+e)}s+=e}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Gg{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=tg,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const n=this.json,i=this.dracoLoader,r=t.extensions[this.name].bufferView,s=t.extensions[this.name].attributes,o={},a={},l={};for(const t in s){const e=Zg[t]||t.toLowerCase();o[e]=s[t]}for(const e in t.attributes){const i=Zg[e]||e.toLowerCase();if(void 0!==s[e]){const r=n.accessors[t.attributes[e]],s=Xg[r.componentType];l[i]=s.name,a[i]=!0===r.normalized}}return e.getDependency("bufferView",r).then((function(t){return new Promise((function(e,n){i.decodeDracoFile(t,(function(t){for(const e in t.attributes){const n=t.attributes[e],i=a[e];void 0!==i&&(n.normalized=i)}e(t)}),o,l,Ti,n)}))}))}}class zg{constructor(){this.name=pg}extendTexture(t,e){return void 0!==e.texCoord&&e.texCoord!==t.channel||void 0!==e.offset||void 0!==e.rotation||void 0!==e.scale?(t=t.clone(),void 0!==e.texCoord&&(t.channel=e.texCoord),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0,t):t}}class Hg{constructor(){this.name=Ag}}class Vg extends yu{constructor(t,e,n,i){super(t,e,n,i)}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i*3+i;for(let t=0;t!==i;t++)e[t]=n[r+t];return e}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=2*o,l=3*o,c=i-e,h=(n-e)/c,u=h*h,d=u*h,p=t*l,A=p-l,f=-2*d+3*u,m=d-u,g=1-f,v=m-u+h;for(let t=0;t!==o;t++){const e=s[A+t+o],n=s[A+t+a]*c,i=s[p+t+o],l=s[p+t]*c;r[t]=g*e+v*n+f*i+m*l}return r}}const jg=new ss;class Wg extends Vg{interpolate_(t,e,n,i){const r=super.interpolate_(t,e,n,i);return jg.fromArray(r).normalize().toArray(r),r}}const qg={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Xg={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Yg={9728:Xe,9729:$e,9984:Ye,9985:tn,9986:Ke,9987:nn},Jg={33071:We,33648:qe,10497:je},Kg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Zg={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},$g={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},tv={CUBICSPLINE:void 0,LINEAR:di,STEP:ui};function ev(t){return void 0===t.DefaultMaterial&&(t.DefaultMaterial=new iu({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Ht})),t.DefaultMaterial}function nv(t,e,n){for(const i in n.extensions)void 0===t[i]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=n.extensions[i])}function iv(t,e){void 0!==e.extras&&("object"==typeof e.extras?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function rv(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(let n=0,i=e.weights.length;n<i;n++)t.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){const n=e.extras.targetNames;if(t.morphTargetInfluences.length===n.length){t.morphTargetDictionary={};for(let e=0,i=n.length;e<i;e++)t.morphTargetDictionary[n[e]]=e}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function sv(t){let e;const n=t.extensions&&t.extensions[tg];if(e=n?"draco:"+n.bufferView+":"+n.indices+":"+ov(n.attributes):t.indices+":"+ov(t.attributes)+":"+t.mode,void 0!==t.targets)for(let n=0,i=t.targets.length;n<i;n++)e+=":"+ov(t.targets[n]);return e}function ov(t){let e="";const n=Object.keys(t).sort();for(let i=0,r=n.length;i<r;i++)e+=n[i]+":"+t[n[i]]+";";return e}function av(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const lv=new Os;class cv{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new Zm,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,s=-1;if("undefined"!=typeof navigator){const t=navigator.userAgent;n=!0===/^((?!chrome|android).)*safari/i.test(t);const e=t.match(/Version\/(\d+)/);i=n&&e?parseInt(e[1],10):-1,r=t.indexOf("Firefox")>-1,s=r?t.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||n&&i<17||r&&s<98?this.textureLoader=new ju(this.options.manager):this.textureLoader=new Ed(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Nu(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(e){const s={scene:e[0][i.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:i.asset,parser:n,userData:{}};return nv(r,s,i),iv(s,i),Promise.all(n._invokeAll((function(t){return t.afterRoot&&t.afterRoot(s)}))).then((function(){for(const t of s.scenes)t.updateMatrixWorld();t(s)}))})).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=e.length;n<i;n++){const i=e[n].joints;for(let e=0,n=i.length;e<n;e++)t[i[e]].isBone=!0}for(let e=0,i=t.length;e<i;e++){const i=t[e];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(n[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,n){if(t.refs[e]<=1)return n;const i=n.clone(),r=(t,e)=>{const n=this.associations.get(t);null!=n&&this.associations.set(e,n);for(const[n,i]of t.children.entries())r(i,e.children[n])};return r(n,i),i.name+="_instance_"+t.uses[e]++,i}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let n=0;n<e.length;n++){const i=t(e[n]);if(i)return i}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const n=[];for(let i=0;i<e.length;i++){const r=t(e[i]);r&&n.push(r)}return n}getDependency(t,e){const n=t+":"+e;let i=this.cache.get(n);if(!i){switch(t){case"scene":i=this.loadScene(e);break;case"node":i=this._invokeOne((function(t){return t.loadNode&&t.loadNode(e)}));break;case"mesh":i=this._invokeOne((function(t){return t.loadMesh&&t.loadMesh(e)}));break;case"accessor":i=this.loadAccessor(e);break;case"bufferView":i=this._invokeOne((function(t){return t.loadBufferView&&t.loadBufferView(e)}));break;case"buffer":i=this.loadBuffer(e);break;case"material":i=this._invokeOne((function(t){return t.loadMaterial&&t.loadMaterial(e)}));break;case"texture":i=this._invokeOne((function(t){return t.loadTexture&&t.loadTexture(e)}));break;case"skin":i=this.loadSkin(e);break;case"animation":i=this._invokeOne((function(t){return t.loadAnimation&&t.loadAnimation(e)}));break;case"camera":i=this.loadCamera(e);break;default:if(i=this._invokeOne((function(n){return n!=this&&n.getDependency&&n.getDependency(t,e)})),!i)throw new Error("Unknown type: "+t)}this.cache.add(n,i)}return i}getDependencies(t){let e=this.cache.get(t);if(!e){const n=this,i=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(i.map((function(e,i){return n.getDependency(t,i)}))),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],n=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[$m].body);const i=this.options;return new Promise((function(t,r){n.load(pd.resolveURL(e.uri,i.path),t,void 0,(function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))}))}))}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){const n=e.byteLength||0,i=e.byteOffset||0;return t.slice(i,i+n)}))}loadAccessor(t){const e=this,n=this.json,i=this.json.accessors[t];if(void 0===i.bufferView&&void 0===i.sparse){const t=Kg[i.type],e=Xg[i.componentType],n=!0===i.normalized,r=new e(i.count*t);return Promise.resolve(new zo(r,t,n))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then((function(t){const r=t[0],s=Kg[i.type],o=Xg[i.componentType],a=o.BYTES_PER_ELEMENT,l=a*s,c=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,u=!0===i.normalized;let d,p;if(h&&h!==l){const t=Math.floor(c/h),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+t+":"+i.count;let l=e.cache.get(n);l||(d=new o(r,t*h,i.count*h/a),l=new Qa(d,h/a),e.cache.add(n,l)),p=new za(l,s,c%h/a,u)}else d=null===r?new o(i.count*s):new o(r,c,i.count*s),p=new zo(d,s,u);if(void 0!==i.sparse){const e=Kg.SCALAR,n=Xg[i.sparse.indices.componentType],a=i.sparse.indices.byteOffset||0,l=i.sparse.values.byteOffset||0,c=new n(t[1],a,i.sparse.count*e),h=new o(t[2],l,i.sparse.count*s);null!==r&&(p=new zo(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let t=0,e=c.length;t<e;t++){const e=c[t];if(p.setX(e,h[t*s]),s>=2&&p.setY(e,h[t*s+1]),s>=3&&p.setZ(e,h[t*s+2]),s>=4&&p.setW(e,h[t*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}p.normalized=u}return p}))}loadTexture(t){const e=this.json,n=this.options,i=e.textures[t].source,r=e.images[i];let s=this.textureLoader;if(r.uri){const t=n.manager.getHandler(r.uri);null!==t&&(s=t)}return this.loadTextureImage(t,i,s)}loadTextureImage(t,e,n){const i=this,r=this.json,s=r.textures[t],o=r.images[e],a=(o.uri||o.bufferView)+":"+s.sampler;if(this.textureCache[a])return this.textureCache[a];const l=this.loadImageSource(e,n).then((function(e){e.flipY=!1,e.name=s.name||o.name||"",""===e.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(e.name=o.uri);const n=(r.samplers||{})[s.sampler]||{};return e.magFilter=Yg[n.magFilter]||$e,e.minFilter=Yg[n.minFilter]||nn,e.wrapS=Jg[n.wrapS]||je,e.wrapT=Jg[n.wrapT]||je,e.generateMipmaps=!e.isCompressedTexture&&e.minFilter!==Xe&&e.minFilter!==$e,i.associations.set(e,{textures:t}),e})).catch((function(){return null}));return this.textureCache[a]=l,l}loadImageSource(t,e){const n=this.json,i=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then((t=>t.clone()));const r=n.images[t],s=self.URL||self.webkitURL;let o=r.uri||"",a=!1;if(void 0!==r.bufferView)o=this.getDependency("bufferView",r.bufferView).then((function(t){a=!0;const e=new Blob([t],{type:r.mimeType});return o=s.createObjectURL(e),o}));else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const l=Promise.resolve(o).then((function(t){return new Promise((function(n,r){let s=n;!0===e.isImageBitmapLoader&&(s=function(t){const e=new Kr(t);e.needsUpdate=!0,n(e)}),e.load(pd.resolveURL(t,i.path),s,void 0,r)}))})).then((function(t){var e;return!0===a&&s.revokeObjectURL(o),iv(t,r),t.userData.mimeType=r.mimeType||((e=r.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":e.search(/\.ktx2($|\?)/i)>0||0===e.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),t})).catch((function(t){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),t}));return this.sourceCache[t]=l,l}assignTexture(t,e,n,i){const r=this;return this.getDependency("texture",n.index).then((function(s){if(!s)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((s=s.clone()).channel=n.texCoord),r.extensions[pg]){const t=void 0!==n.extensions?n.extensions[pg]:void 0;if(t){const e=r.associations.get(s);s=r.extensions[pg].extendTexture(s,t),r.associations.set(s,e)}}return void 0!==i&&(s.colorSpace=i),t[e]=s,s}))}assignFinalMaterial(t){const e=t.geometry;let n=t.material;const i=void 0===e.attributes.tangent,r=void 0!==e.attributes.color,s=void 0===e.attributes.normal;if(t.isPoints){const t="PointsMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new gc,Lo.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,e.sizeAttenuation=!1,this.cache.add(t,e)),n=e}else if(t.isLine){const t="LineBasicMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new ic,Lo.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,this.cache.add(t,e)),n=e}if(i||r||s){let t="ClonedMaterial:"+n.uuid+":";i&&(t+="derivative-tangents:"),r&&(t+="vertex-colors:"),s&&(t+="flat-shading:");let e=this.cache.get(t);e||(e=n.clone(),r&&(e.vertexColors=!0),s&&(e.flatShading=!0),i&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(n))),n=e}t.material=n}getMaterialType(){return iu}loadMaterial(t){const e=this,n=this.json,i=this.extensions,r=n.materials[t];let s;const o={},a=[];if((r.extensions||{})[hg]){const t=i[hg];s=t.getMaterialType(),a.push(t.extendParams(o,r,e))}else{const n=r.pbrMetallicRoughness||{};if(o.color=new Bo(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){const t=n.baseColorFactor;o.color.setRGB(t[0],t[1],t[2],Ti),o.opacity=t[3]}void 0!==n.baseColorTexture&&a.push(e.assignTexture(o,"map",n.baseColorTexture,Bi)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(a.push(e.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),a.push(e.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),s=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),a.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,o)}))))}!0===r.doubleSided&&(o.side=jt);const l=r.alphaMode||"OPAQUE";if("BLEND"===l?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,"MASK"===l&&(o.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&s!==Do&&(a.push(e.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new Br(1,1),void 0!==r.normalTexture.scale)){const t=r.normalTexture.scale;o.normalScale.set(t,t)}if(void 0!==r.occlusionTexture&&s!==Do&&(a.push(e.assignTexture(o,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(o.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&s!==Do){const t=r.emissiveFactor;o.emissive=(new Bo).setRGB(t[0],t[1],t[2],Ti)}return void 0!==r.emissiveTexture&&s!==Do&&a.push(e.assignTexture(o,"emissiveMap",r.emissiveTexture,Bi)),Promise.all(a).then((function(){const n=new s(o);return r.name&&(n.name=r.name),iv(n,r),e.associations.set(n,{materials:t}),r.extensions&&nv(i,n,r),n}))}createUniqueName(t){const e=Jd.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,n=this.extensions,i=this.primitiveCache;function r(t){return n[tg].decodePrimitive(t,e).then((function(n){return hv(n,t,e)}))}const s=[];for(let n=0,o=t.length;n<o;n++){const o=t[n],a=sv(o),l=i[a];if(l)s.push(l.promise);else{let t;t=o.extensions&&o.extensions[tg]?r(o):hv(new sa,o,e),i[a]={primitive:o,promise:t},s.push(t)}}return Promise.all(s)}loadMesh(t){const e=this,n=this.json,i=this.extensions,r=n.meshes[t],s=r.primitives,o=[];for(let t=0,e=s.length;t<e;t++){const e=void 0===s[t].material?ev(this.cache):this.getDependency("material",s[t].material);o.push(e)}return o.push(e.loadGeometries(s)),Promise.all(o).then((function(n){const o=n.slice(0,n.length-1),a=n[n.length-1],l=[];for(let n=0,c=a.length;n<c;n++){const c=a[n],h=s[n];let u;const d=o[n];if(h.mode===qg.TRIANGLES||h.mode===qg.TRIANGLE_STRIP||h.mode===qg.TRIANGLE_FAN||void 0===h.mode)u=!0===r.isSkinnedMesh?new gl(c,d):new ga(c,d),!0===u.isSkinnedMesh&&u.normalizeSkinWeights(),h.mode===qg.TRIANGLE_STRIP?u.geometry=Xm(u.geometry,Ei):h.mode===qg.TRIANGLE_FAN&&(u.geometry=Xm(u.geometry,xi));else if(h.mode===qg.LINES)u=new fc(c,d);else if(h.mode===qg.LINE_STRIP)u=new uc(c,d);else if(h.mode===qg.LINE_LOOP)u=new mc(c,d);else{if(h.mode!==qg.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);u=new bc(c,d)}Object.keys(u.geometry.morphAttributes).length>0&&rv(u,r),u.name=e.createUniqueName(r.name||"mesh_"+t),iv(u,r),h.extensions&&nv(i,u,h),e.assignFinalMaterial(u),l.push(u)}for(let n=0,i=l.length;n<i;n++)e.associations.set(l[n],{meshes:t,primitives:n});if(1===l.length)return r.extensions&&nv(i,l[0],r),l[0];const c=new Pa;r.extensions&&nv(i,c,r),e.associations.set(c,{meshes:t});for(let t=0,e=l.length;t<e;t++)c.add(l[t]);return c}))}loadCamera(t){let e;const n=this.json.cameras[t],i=n[n.type];if(i)return"perspective"===n.type?e=new Ba(Ir.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(e=new sd(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),iv(e,n),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(t){const e=this.json.skins[t],n=[];for(let t=0,i=e.joints.length;t<i;t++)n.push(this._loadNodeShallow(e.joints[t]));return void 0!==e.inverseBindMatrices?n.push(this.getDependency("accessor",e.inverseBindMatrices)):n.push(null),Promise.all(n).then((function(t){const n=t.pop(),i=t,r=[],s=[];for(let t=0,o=i.length;t<o;t++){const o=i[t];if(o){r.push(o);const e=new Os;null!==n&&e.fromArray(n.array,16*t),s.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[t])}return new bl(r,s)}))}loadAnimation(t){const e=this.json,n=this,i=e.animations[t],r=i.name?i.name:"animation_"+t,s=[],o=[],a=[],l=[],c=[];for(let t=0,e=i.channels.length;t<e;t++){const e=i.channels[t],n=i.samplers[e.sampler],r=e.target,h=r.node,u=void 0!==i.parameters?i.parameters[n.input]:n.input,d=void 0!==i.parameters?i.parameters[n.output]:n.output;void 0!==r.node&&(s.push(this.getDependency("node",h)),o.push(this.getDependency("accessor",u)),a.push(this.getDependency("accessor",d)),l.push(n),c.push(r))}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(a),Promise.all(l),Promise.all(c)]).then((function(t){const e=t[0],i=t[1],s=t[2],o=t[3],a=t[4],l=[];for(let t=0,r=e.length;t<r;t++){const r=e[t],c=i[t],h=s[t],u=o[t],d=a[t];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();const p=n._createAnimationTracks(r,c,h,u,d);if(p)for(let t=0;t<p.length;t++)l.push(p[t])}return new Ru(r,void 0,l)}))}createNodeMesh(t){const e=this.json,n=this,i=e.nodes[t];return void 0===i.mesh?null:n.getDependency("mesh",i.mesh).then((function(t){const e=n._getNodeRef(n.meshCache,i.mesh,t);return void 0!==i.weights&&e.traverse((function(t){if(t.isMesh)for(let e=0,n=i.weights.length;e<n;e++)t.morphTargetInfluences[e]=i.weights[e]})),e}))}loadNode(t){const e=this,n=this.json.nodes[t],i=e._loadNodeShallow(t),r=[],s=n.children||[];for(let t=0,n=s.length;t<n;t++)r.push(e.getDependency("node",s[t]));const o=void 0===n.skin?Promise.resolve(null):e.getDependency("skin",n.skin);return Promise.all([i,Promise.all(r),o]).then((function(t){const e=t[0],n=t[1],i=t[2];null!==i&&e.traverse((function(t){t.isSkinnedMesh&&t.bind(i,lv)}));for(let t=0,i=n.length;t<i;t++)e.add(n[t]);return e}))}_loadNodeShallow(t){const e=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[t])return this.nodeCache[t];const r=e.nodes[t],s=r.name?i.createUniqueName(r.name):"",o=[],a=i._invokeOne((function(e){return e.createNodeMesh&&e.createNodeMesh(t)}));return a&&o.push(a),void 0!==r.camera&&o.push(i.getDependency("camera",r.camera).then((function(t){return i._getNodeRef(i.cameraCache,r.camera,t)}))),i._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){o.push(t)})),this.nodeCache[t]=Promise.all(o).then((function(e){let o;if(o=!0===r.isBone?new vl:e.length>1?new Pa:1===e.length?e[0]:new co,o!==e[0])for(let t=0,n=e.length;t<n;t++)o.add(e[t]);if(r.name&&(o.userData.name=r.name,o.name=s),iv(o,r),r.extensions&&nv(n,o,r),void 0!==r.matrix){const t=new Os;t.fromArray(r.matrix),o.applyMatrix4(t)}else void 0!==r.translation&&o.position.fromArray(r.translation),void 0!==r.rotation&&o.quaternion.fromArray(r.rotation),void 0!==r.scale&&o.scale.fromArray(r.scale);return i.associations.has(o)||i.associations.set(o,{}),i.associations.get(o).nodes=t,o})),this.nodeCache[t]}loadScene(t){const e=this.extensions,n=this.json.scenes[t],i=this,r=new Pa;n.name&&(r.name=i.createUniqueName(n.name)),iv(r,n),n.extensions&&nv(e,r,n);const s=n.nodes||[],o=[];for(let t=0,e=s.length;t<e;t++)o.push(i.getDependency("node",s[t]));return Promise.all(o).then((function(t){for(let e=0,n=t.length;e<n;e++)r.add(t[e]);return i.associations=(t=>{const e=new Map;for(const[t,n]of i.associations)(t instanceof Lo||t instanceof Kr)&&e.set(t,n);return t.traverse((t=>{const n=i.associations.get(t);null!=n&&e.set(t,n)})),e})(r),r}))}_createAnimationTracks(t,e,n,i,r){const s=[],o=t.name?t.name:t.uuid,a=[];let l;switch($g[r.path]===$g.weights?t.traverse((function(t){t.morphTargetInfluences&&a.push(t.name?t.name:t.uuid)})):a.push(o),$g[r.path]){case $g.weights:l=Mu;break;case $g.rotation:l=Iu;break;case $g.position:case $g.scale:l=Tu;break;default:l=1===n.itemSize?Mu:Tu}const c=void 0!==i.interpolation?tv[i.interpolation]:di,h=this._getArrayFromAccessor(n);for(let t=0,n=a.length;t<n;t++){const n=new l(a[t]+"."+$g[r.path],e.array,h,c);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(n),s.push(n)}return s}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const t=av(e.constructor),n=new Float32Array(e.length);for(let i=0,r=e.length;i<r;i++)n[i]=e[i]*t;e=n}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(t){return new(this instanceof Iu?Wg:Vg)(this.times,this.values,this.getValueSize()/3,t)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function hv(t,e,n){const i=e.attributes,r=[];function s(e,i){return n.getDependency("accessor",e).then((function(e){t.setAttribute(i,e)}))}for(const e in i){const n=Zg[e]||e.toLowerCase();n in t.attributes||r.push(s(i[e],n))}if(void 0!==e.indices&&!t.index){const i=n.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));r.push(i)}return zr.workingColorSpace!==Ti&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${zr.workingColorSpace}" not supported.`),iv(t,e),function(t,e,n){const i=e.attributes,r=new cs;if(void 0===i.POSITION)return;{const t=n.json.accessors[i.POSITION],e=t.min,s=t.max;if(void 0===e||void 0===s)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new os(e[0],e[1],e[2]),new os(s[0],s[1],s[2])),t.normalized){const e=av(Xg[t.componentType]);r.min.multiplyScalar(e),r.max.multiplyScalar(e)}}const s=e.targets;if(void 0!==s){const t=new os,e=new os;for(let i=0,r=s.length;i<r;i++){const r=s[i];if(void 0!==r.POSITION){const i=n.json.accessors[r.POSITION],s=i.min,o=i.max;if(void 0!==s&&void 0!==o){if(e.setX(Math.max(Math.abs(s[0]),Math.abs(o[0]))),e.setY(Math.max(Math.abs(s[1]),Math.abs(o[1]))),e.setZ(Math.max(Math.abs(s[2]),Math.abs(o[2]))),i.normalized){const t=av(Xg[i.componentType]);e.multiplyScalar(t)}t.max(e)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(t)}t.boundingBox=r;const o=new Ss;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,t.boundingSphere=o}(t,e,n),Promise.all(r).then((function(){return void 0!==e.targets?function(t,e,n){let i=!1,r=!1,s=!1;for(let t=0,n=e.length;t<n;t++){const n=e[t];if(void 0!==n.POSITION&&(i=!0),void 0!==n.NORMAL&&(r=!0),void 0!==n.COLOR_0&&(s=!0),i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(t);const o=[],a=[],l=[];for(let c=0,h=e.length;c<h;c++){const h=e[c];if(i){const e=void 0!==h.POSITION?n.getDependency("accessor",h.POSITION):t.attributes.position;o.push(e)}if(r){const e=void 0!==h.NORMAL?n.getDependency("accessor",h.NORMAL):t.attributes.normal;a.push(e)}if(s){const e=void 0!==h.COLOR_0?n.getDependency("accessor",h.COLOR_0):t.attributes.color;l.push(e)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l)]).then((function(e){const n=e[0],o=e[1],a=e[2];return i&&(t.morphAttributes.position=n),r&&(t.morphAttributes.normal=o),s&&(t.morphAttributes.color=a),t.morphTargetsRelative=!0,t}))}(t,e.targets,n):t}))}class uv{constructor(t=4){this.pool=t,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(t){if(!this.workers[t]){const e=this.workerCreator();e.addEventListener("message",this._onMessage.bind(this,t)),this.workers[t]=e}}_getIdleWorker(){for(let t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1}_onMessage(t,e){const n=this.workersResolve[t];if(n&&n(e),this.queue.length){const{resolve:e,msg:n,transfer:i}=this.queue.shift();this.workersResolve[t]=e,this.workers[t].postMessage(n,i)}else this.workerStatus^=1<<t}setWorkerCreator(t){this.workerCreator=t}setWorkerLimit(t){this.pool=t}postMessage(t,e){return new Promise((n=>{const i=this._getIdleWorker();-1!==i?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=n,this.workers[i].postMessage(t,e)):this.queue.push({resolve:n,msg:t,transfer:e})}))}dispose(){this.workers.forEach((t=>t.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const dv=9,pv=15,Av=16,fv=22,mv=37,gv=43,vv=76,yv=83,Ev=97,xv=100,bv=103,Cv=109,wv=165,_v=166,Mv=1000066e3;class Sv{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Iv{constructor(t,e,n,i){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(t.buffer,t.byteOffset+e,n),this._littleEndian=i,this._offset=0}_nextUint8(){const t=this._dataView.getUint8(this._offset);return this._offset+=1,t}_nextUint16(){const t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}_nextUint32(){const t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint64(){const t=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,t}_nextInt32(){const t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint8Array(t){const e=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,t);return this._offset+=t,e}_skip(t){return this._offset+=t,this}_scan(t,e){void 0===e&&(e=0);const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==e&&i<t;)i++,this._offset++;return i<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}new Uint8Array([0]);const Bv=[171,75,84,88,32,50,48,187,13,10,26,10];function Tv(t){return(new TextDecoder).decode(t)}var Rv=n(9922).hp;let Lv,Dv,Pv;const Uv={env:{emscripten_notify_memory_growth:function(t){Pv=new Uint8Array(Dv.exports.memory.buffer)}}};class Ov{init(){return Lv||(Lv="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Fv).then((t=>t.arrayBuffer())).then((t=>WebAssembly.instantiate(t,Uv))).then(this._init):WebAssembly.instantiate(Rv.from(Fv,"base64"),Uv).then(this._init),Lv)}_init(t){Dv=t.instance,Uv.env.emscripten_notify_memory_growth(0)}decode(t,e=0){if(!Dv)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=t.byteLength,i=Dv.exports.malloc(n);Pv.set(t,i),e=e||Number(Dv.exports.ZSTD_findDecompressedSize(i,n));const r=Dv.exports.malloc(e),s=Dv.exports.ZSTD_decompress(r,e,i,n),o=Pv.slice(r,r+s);return Dv.exports.free(i),Dv.exports.free(r),o}}const Fv="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",kv=new WeakMap;let Nv,Qv=0;class Gv extends Ou{constructor(t){super(t),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new uv,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(t){return this.transcoderPath=t,this}setWorkerLimit(t){return this.workerPool.setWorkerLimit(t),this}async detectSupportAsync(t){return this.workerConfig={astcSupported:await t.hasFeatureAsync("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:await t.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await t.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await t.hasFeatureAsync("texture-compression-bc"),bptcSupported:await t.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await t.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(t){return!0===t.isWebGPURenderer?this.workerConfig={astcSupported:t.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:t.hasFeature("texture-compression-etc1"),etc2Supported:t.hasFeature("texture-compression-etc2"),dxtSupported:t.hasFeature("texture-compression-bc"),bptcSupported:t.hasFeature("texture-compression-bptc"),pvrtcSupported:t.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:t.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:t.extensions.has("WEBGL_compressed_texture_astc")&&t.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:t.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:t.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:t.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:t.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:t.extensions.has("WEBGL_compressed_texture_pvrtc")||t.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const t=new Nu(this.manager);t.setPath(this.transcoderPath),t.setWithCredentials(this.withCredentials);const e=t.loadAsync("basis_transcoder.js"),n=new Nu(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([e,i]).then((([t,e])=>{const n=Gv.BasisWorker.toString(),i=["/* constants */","let _EngineFormat = "+JSON.stringify(Gv.EngineFormat),"let _EngineType = "+JSON.stringify(Gv.EngineType),"let _TranscoderFormat = "+JSON.stringify(Gv.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Gv.BasisFormat),"/* basis_transcoder.js */",t,"/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i])),this.transcoderBinary=e,this.workerPool.setWorkerCreator((()=>{const t=new Worker(this.workerSourceURL),e=this.transcoderBinary.slice(0);return t.postMessage({type:"init",config:this.workerConfig,transcoderBinary:e},[e]),t}))})),Qv>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Qv++}return this.transcoderPending}load(t,e,n,i){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new Nu(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(t,(t=>{this.parse(t,e,i)}),n,i)}parse(t,e,n){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(kv.has(t))return kv.get(t).promise.then(e).catch(n);this._createTexture(t).then((t=>e?e(t):null)).catch(n)}_createTextureFrom(t,e){const{type:n,error:i,data:{faces:r,width:s,height:o,format:a,type:l,dfdFlags:c}}=t;if("error"===n)return Promise.reject(i);let h;if(6===e.faceCount)h=new Bc(r,a,l);else{const t=r[0].mipmaps;h=e.layerCount>1?new Ic(t,s,o,e.layerCount,a,l):new Sc(t,s,o,a,l)}return h.minFilter=1===r[0].mipmaps.length?$e:nn,h.magFilter=$e,h.generateMipmaps=!1,h.needsUpdate=!0,h.colorSpace=jv(e),h.premultiplyAlpha=!!(1&c),h}async _createTexture(t,e={}){const n=function(t){const e=new Uint8Array(t.buffer,t.byteOffset,Bv.length);if(e[0]!==Bv[0]||e[1]!==Bv[1]||e[2]!==Bv[2]||e[3]!==Bv[3]||e[4]!==Bv[4]||e[5]!==Bv[5]||e[6]!==Bv[6]||e[7]!==Bv[7]||e[8]!==Bv[8]||e[9]!==Bv[9]||e[10]!==Bv[10]||e[11]!==Bv[11])throw new Error("Missing KTX 2.0 identifier.");const n=new Sv,i=17*Uint32Array.BYTES_PER_ELEMENT,r=new Iv(t,Bv.length,i,!0);n.vkFormat=r._nextUint32(),n.typeSize=r._nextUint32(),n.pixelWidth=r._nextUint32(),n.pixelHeight=r._nextUint32(),n.pixelDepth=r._nextUint32(),n.layerCount=r._nextUint32(),n.faceCount=r._nextUint32();const s=r._nextUint32();n.supercompressionScheme=r._nextUint32();const o=r._nextUint32(),a=r._nextUint32(),l=r._nextUint32(),c=r._nextUint32(),h=r._nextUint64(),u=r._nextUint64(),d=new Iv(t,Bv.length+i,3*s*8,!0);for(let e=0;e<s;e++)n.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});const p=new Iv(t,o,a,!0),A={vendorId:p._skip(4)._nextUint16(),descriptorType:p._nextUint16(),versionNumber:p._nextUint16(),descriptorBlockSize:p._nextUint16(),colorModel:p._nextUint8(),colorPrimaries:p._nextUint8(),transferFunction:p._nextUint8(),flags:p._nextUint8(),texelBlockDimension:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],bytesPlane:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],samples:[]},f=(A.descriptorBlockSize/4-6)/4;for(let t=0;t<f;t++){const e={bitOffset:p._nextUint16(),bitLength:p._nextUint8(),channelType:p._nextUint8(),samplePosition:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&e.channelType?(e.sampleLower=p._nextInt32(),e.sampleUpper=p._nextInt32()):(e.sampleLower=p._nextUint32(),e.sampleUpper=p._nextUint32()),A.samples[t]=e}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(A);const m=new Iv(t,l,c,!0);for(;m._offset<c;){const t=m._nextUint32(),e=m._scan(t),i=Tv(e);if(n.keyValue[i]=m._nextUint8Array(t-e.byteLength-1),i.match(/^ktx/i)){const t=Tv(n.keyValue[i]);n.keyValue[i]=t.substring(0,t.lastIndexOf("\0"))}m._skip(t%4?4-t%4:0)}if(u<=0)return n;const g=new Iv(t,h,u,!0),v=g._nextUint16(),y=g._nextUint16(),E=g._nextUint32(),x=g._nextUint32(),b=g._nextUint32(),C=g._nextUint32(),w=[];for(let t=0;t<s;t++)w.push({imageFlags:g._nextUint32(),rgbSliceByteOffset:g._nextUint32(),rgbSliceByteLength:g._nextUint32(),alphaSliceByteOffset:g._nextUint32(),alphaSliceByteLength:g._nextUint32()});const _=h+g._offset,M=_+E,S=M+x,I=S+b,B=new Uint8Array(t.buffer,t.byteOffset+_,E),T=new Uint8Array(t.buffer,t.byteOffset+M,x),R=new Uint8Array(t.buffer,t.byteOffset+S,b),L=new Uint8Array(t.buffer,t.byteOffset+I,C);return n.globalData={endpointCount:v,selectorCount:y,imageDescs:w,endpointsData:B,selectorsData:T,tablesData:R,extendedData:L},n}(new Uint8Array(t)),i=n.vkFormat===Mv&&167===n.dataFormatDescriptor[0].colorModel;if(0!==n.vkFormat&&(!i||this.workerConfig.astcHDRSupported))return async function(t){const{vkFormat:e}=t;if(void 0===Hv[e])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let n;2===t.supercompressionScheme&&(Nv||(Nv=new Promise((async t=>{const e=new Ov;await e.init(),t(e)}))),n=await Nv);const i=[];for(let r=0;r<t.levels.length;r++){const s=Math.max(1,t.pixelWidth>>r),o=Math.max(1,t.pixelHeight>>r),a=t.pixelDepth?Math.max(1,t.pixelDepth>>r):0,l=t.levels[r];let c,h;if(0===t.supercompressionScheme)c=l.levelData;else{if(2!==t.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");c=n.decode(l.levelData,l.uncompressedByteLength)}h=Vv[e]===un?new Float32Array(c.buffer,c.byteOffset,c.byteLength/Float32Array.BYTES_PER_ELEMENT):Vv[e]===dn?new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT):c,i.push({data:h,width:s,height:o,depth:a})}let r;if(zv.has(Hv[e]))r=0===t.pixelDepth?new yl(i[0].data,t.pixelWidth,t.pixelHeight):new is(i[0].data,t.pixelWidth,t.pixelHeight,t.pixelDepth);else{if(t.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");r=new Sc(i,t.pixelWidth,t.pixelHeight),r.minFilter=1===i.length?$e:nn,r.magFilter=$e}return r.mipmaps=i,r.type=Vv[e],r.format=Hv[e],r.colorSpace=jv(t),r.needsUpdate=!0,Promise.resolve(r)}(n);const r=e,s=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:t,taskConfig:r},[t]))).then((t=>this._createTextureFrom(t.data,n)));return kv.set(t,{promise:s}),s}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Qv--,this}}Gv.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},Gv.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25},Gv.EngineFormat={RGBAFormat:yn,RGBA_ASTC_4x4_Format:Gn,RGB_BPTC_UNSIGNED_Format:ii,RGBA_BPTC_Format:ei,RGBA_ETC2_EAC_Format:Qn,RGBA_PVRTC_4BPPV1_Format:On,RGBA_S3TC_DXT5_Format:Dn,RGB_ETC1_Format:kn,RGB_ETC2_Format:Nn,RGB_PVRTC_4BPPV1_Format:Pn,RGBA_S3TC_DXT1_Format:Rn},Gv.EngineType={UnsignedByteType:sn,HalfFloatType:dn,FloatType:un},Gv.BasisWorker=function(){let t,e,n;const i=_EngineFormat,r=_EngineType,s=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",(function(i){const s=i.data;switch(s.type){case"init":t=s.config,a=s.transcoderBinary,e=new Promise((t=>{n={wasmBinary:a,onRuntimeInitialized:t},BASIS(n)})).then((()=>{n.initializeBasis(),void 0===n.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}));break;case"transcode":e.then((()=>{try{const{faces:e,buffers:i,width:a,height:u,hasAlpha:d,format:p,type:A,dfdFlags:f}=function(e){const i=new n.KTX2File(new Uint8Array(e));function s(){i.close(),i.delete()}if(!i.isValid())throw s(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");let a;if(i.isUASTC())a=o.UASTC;else if(i.isETC1S())a=o.ETC1S;else{if(!i.isHDR())throw new Error("THREE.KTX2Loader: Unknown Basis encoding");a=o.UASTC_HDR}const u=i.getWidth(),d=i.getHeight(),p=i.getLayers()||1,A=i.getLevels(),f=i.getFaces(),m=i.getHasAlpha(),g=i.getDFDFlags(),{transcoderFormat:v,engineFormat:y,engineType:E}=function(e,n,i,r){const s=l[e];for(let o=0;o<s.length;o++){const a=s[o];if((!a.if||t[a.if])&&(a.basisFormat.includes(e)&&!(r&&a.transcoderFormat.length<2)&&(!a.needsPowerOfTwo||c(n)&&c(i))))return{transcoderFormat:a.transcoderFormat[r?1:0],engineFormat:a.engineFormat[r?1:0],engineType:a.engineType[0]}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}(a,u,d,m);if(!u||!d||!A)throw s(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!i.startTranscoding())throw s(),new Error("THREE.KTX2Loader: .startTranscoding failed");const x=[],b=[];for(let t=0;t<f;t++){const e=[];for(let n=0;n<A;n++){const o=[];let a,l;for(let e=0;e<p;e++){const c=i.getImageLevelInfo(n,e,t);0!==t||0!==n||0!==e||c.origWidth%4==0&&c.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),A>1?(a=c.origWidth,l=c.origHeight):(a=c.width,l=c.height);let h=new Uint8Array(i.getImageTranscodedSizeInBytes(n,e,0,v));const u=i.transcodeImage(h,n,e,t,v,0,-1,-1);if(E===r.HalfFloatType&&(h=new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!u)throw s(),new Error("THREE.KTX2Loader: .transcodeImage failed.");o.push(h)}const c=h(o);e.push({data:c,width:a,height:l}),b.push(c.buffer)}x.push({mipmaps:e,width:u,height:d,format:y,type:E})}return s(),{faces:x,buffers:b,width:u,height:d,hasAlpha:m,dfdFlags:g,format:y,type:E}}(s.buffer);self.postMessage({type:"transcode",id:s.id,data:{faces:e,width:a,height:u,hasAlpha:d,format:p,type:A,dfdFlags:f}},i)}catch(t){console.error(t),self.postMessage({type:"error",id:s.id,error:t.message})}}))}var a}));const a=[{if:"astcSupported",basisFormat:[o.UASTC],transcoderFormat:[s.ASTC_4x4,s.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],engineType:[r.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC7_M5,s.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],engineType:[r.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC1,s.BC3],engineFormat:[i.RGBA_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],engineType:[r.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1,s.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],engineType:[r.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1],engineFormat:[i.RGB_ETC1_Format],engineType:[r.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.PVRTC1_4_RGB,s.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],engineType:[r.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[o.UASTC_HDR],transcoderFormat:[s.BC6H],engineFormat:[i.RGB_BPTC_UNSIGNED_Format],engineType:[r.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.RGBA32,s.RGBA32],engineFormat:[i.RGBAFormat,i.RGBAFormat],engineType:[r.UnsignedByteType,r.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[o.UASTC_HDR],transcoderFormat:[s.RGBA_HALF],engineFormat:[i.RGBAFormat],engineType:[r.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],l={[o.ETC1S]:a.filter((t=>t.basisFormat.includes(o.ETC1S))).sort(((t,e)=>t.priorityUASTC-e.priorityUASTC)),[o.UASTC]:a.filter((t=>t.basisFormat.includes(o.UASTC))).sort(((t,e)=>t.priorityUASTC-e.priorityUASTC)),[o.UASTC_HDR]:a.filter((t=>t.basisFormat.includes(o.UASTC_HDR))).sort(((t,e)=>t.priorityHDR-e.priorityHDR))};function c(t){return t<=2||!(t&t-1)&&0!==t}function h(t){if(1===t.length)return t[0];let e=0;for(let n=0;n<t.length;n++)e+=t[n].byteLength;const n=new Uint8Array(e);let i=0;for(let e=0;e<t.length;e++){const r=t[e];n.set(r,i),i+=r.byteLength}return n}};const zv=new Set([yn,Mn,wn]),Hv={[Cv]:yn,[Ev]:yn,[mv]:yn,[gv]:yn,[bv]:Mn,[yv]:Mn,[Av]:Mn,[fv]:Mn,[xv]:wn,[vv]:wn,[pv]:wn,[dv]:wn,[Mv]:Gn,[_v]:jn,[wv]:jn},Vv={[Cv]:un,[Ev]:dn,[mv]:sn,[gv]:sn,[bv]:un,[yv]:dn,[Av]:sn,[fv]:sn,[xv]:un,[vv]:dn,[pv]:sn,[dv]:sn,[Mv]:dn,[_v]:sn,[wv]:sn};function jv(t){const e=t.dataFormatDescriptor[0];return 1===e.colorPrimaries?2===e.transferFunction?Bi:Ti:10===e.colorPrimaries?2===e.transferFunction?"display-p3":"display-p3-linear":(0===e.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),Ii)}const Wv={c:null,u:[new os,new os,new os],e:[]},qv={c:null,u:[new os,new os,new os],e:[]},Xv=[[],[],[]],Yv=[[],[],[]],Jv=[],Kv=new os,Zv=new os,$v=new os,ty=new os,ey=new os,ny=new os,iy=new Tr,ry=new cs,sy=new Os,oy=new Os,ay=new Us;class ly{constructor(t=new os,e=new os,n=new Tr){this.center=t,this.halfSize=e,this.rotation=n}set(t,e,n){return this.center=t,this.halfSize=e,this.rotation=n,this}copy(t){return this.center.copy(t.center),this.halfSize.copy(t.halfSize),this.rotation.copy(t.rotation),this}clone(){return(new this.constructor).copy(this)}getSize(t){return t.copy(this.halfSize).multiplyScalar(2)}clampPoint(t,e){const n=this.halfSize;ty.subVectors(t,this.center),this.rotation.extractBasis(Kv,Zv,$v),e.copy(this.center);const i=Ir.clamp(ty.dot(Kv),-n.x,n.x);e.add(Kv.multiplyScalar(i));const r=Ir.clamp(ty.dot(Zv),-n.y,n.y);e.add(Zv.multiplyScalar(r));const s=Ir.clamp(ty.dot($v),-n.z,n.z);return e.add($v.multiplyScalar(s)),e}containsPoint(t){return ty.subVectors(t,this.center),this.rotation.extractBasis(Kv,Zv,$v),Math.abs(ty.dot(Kv))<=this.halfSize.x&&Math.abs(ty.dot(Zv))<=this.halfSize.y&&Math.abs(ty.dot($v))<=this.halfSize.z}intersectsBox3(t){return this.intersectsOBB(cy.fromBox3(t))}intersectsSphere(t){return this.clampPoint(t.center,ny),ny.distanceToSquared(t.center)<=t.radius*t.radius}intersectsOBB(t,e=Number.EPSILON){Wv.c=this.center,Wv.e[0]=this.halfSize.x,Wv.e[1]=this.halfSize.y,Wv.e[2]=this.halfSize.z,this.rotation.extractBasis(Wv.u[0],Wv.u[1],Wv.u[2]),qv.c=t.center,qv.e[0]=t.halfSize.x,qv.e[1]=t.halfSize.y,qv.e[2]=t.halfSize.z,t.rotation.extractBasis(qv.u[0],qv.u[1],qv.u[2]);for(let t=0;t<3;t++)for(let e=0;e<3;e++)Xv[t][e]=Wv.u[t].dot(qv.u[e]);ty.subVectors(qv.c,Wv.c),Jv[0]=ty.dot(Wv.u[0]),Jv[1]=ty.dot(Wv.u[1]),Jv[2]=ty.dot(Wv.u[2]);for(let t=0;t<3;t++)for(let n=0;n<3;n++)Yv[t][n]=Math.abs(Xv[t][n])+e;let n,i;for(let t=0;t<3;t++)if(n=Wv.e[t],i=qv.e[0]*Yv[t][0]+qv.e[1]*Yv[t][1]+qv.e[2]*Yv[t][2],Math.abs(Jv[t])>n+i)return!1;for(let t=0;t<3;t++)if(n=Wv.e[0]*Yv[0][t]+Wv.e[1]*Yv[1][t]+Wv.e[2]*Yv[2][t],i=qv.e[t],Math.abs(Jv[0]*Xv[0][t]+Jv[1]*Xv[1][t]+Jv[2]*Xv[2][t])>n+i)return!1;return n=Wv.e[1]*Yv[2][0]+Wv.e[2]*Yv[1][0],i=qv.e[1]*Yv[0][2]+qv.e[2]*Yv[0][1],!(Math.abs(Jv[2]*Xv[1][0]-Jv[1]*Xv[2][0])>n+i||(n=Wv.e[1]*Yv[2][1]+Wv.e[2]*Yv[1][1],i=qv.e[0]*Yv[0][2]+qv.e[2]*Yv[0][0],Math.abs(Jv[2]*Xv[1][1]-Jv[1]*Xv[2][1])>n+i||(n=Wv.e[1]*Yv[2][2]+Wv.e[2]*Yv[1][2],i=qv.e[0]*Yv[0][1]+qv.e[1]*Yv[0][0],Math.abs(Jv[2]*Xv[1][2]-Jv[1]*Xv[2][2])>n+i||(n=Wv.e[0]*Yv[2][0]+Wv.e[2]*Yv[0][0],i=qv.e[1]*Yv[1][2]+qv.e[2]*Yv[1][1],Math.abs(Jv[0]*Xv[2][0]-Jv[2]*Xv[0][0])>n+i||(n=Wv.e[0]*Yv[2][1]+Wv.e[2]*Yv[0][1],i=qv.e[0]*Yv[1][2]+qv.e[2]*Yv[1][0],Math.abs(Jv[0]*Xv[2][1]-Jv[2]*Xv[0][1])>n+i||(n=Wv.e[0]*Yv[2][2]+Wv.e[2]*Yv[0][2],i=qv.e[0]*Yv[1][1]+qv.e[1]*Yv[1][0],Math.abs(Jv[0]*Xv[2][2]-Jv[2]*Xv[0][2])>n+i||(n=Wv.e[0]*Yv[1][0]+Wv.e[1]*Yv[0][0],i=qv.e[1]*Yv[2][2]+qv.e[2]*Yv[2][1],Math.abs(Jv[1]*Xv[0][0]-Jv[0]*Xv[1][0])>n+i||(n=Wv.e[0]*Yv[1][1]+Wv.e[1]*Yv[0][1],i=qv.e[0]*Yv[2][2]+qv.e[2]*Yv[2][0],Math.abs(Jv[1]*Xv[0][1]-Jv[0]*Xv[1][1])>n+i||(n=Wv.e[0]*Yv[1][2]+Wv.e[1]*Yv[0][2],i=qv.e[0]*Yv[2][1]+qv.e[1]*Yv[2][0],Math.abs(Jv[1]*Xv[0][2]-Jv[0]*Xv[1][2])>n+i)))))))))}intersectsPlane(t){this.rotation.extractBasis(Kv,Zv,$v);const e=this.halfSize.x*Math.abs(t.normal.dot(Kv))+this.halfSize.y*Math.abs(t.normal.dot(Zv))+this.halfSize.z*Math.abs(t.normal.dot($v)),n=t.normal.dot(this.center)-t.constant;return Math.abs(n)<=e}intersectRay(t,e){return this.getSize(ey),ry.setFromCenterAndSize(ty.set(0,0,0),ey),sy.setFromMatrix3(this.rotation),sy.setPosition(this.center),oy.copy(sy).invert(),ay.copy(t).applyMatrix4(oy),ay.intersectBox(ry,e)?e.applyMatrix4(sy):null}intersectsRay(t){return null!==this.intersectRay(t,ty)}fromBox3(t){return t.getCenter(this.center),t.getSize(this.halfSize).multiplyScalar(.5),this.rotation.identity(),this}equals(t){return t.center.equals(this.center)&&t.halfSize.equals(this.halfSize)&&t.rotation.equals(this.rotation)}applyMatrix4(t){const e=t.elements;let n=ty.set(e[0],e[1],e[2]).length();const i=ty.set(e[4],e[5],e[6]).length(),r=ty.set(e[8],e[9],e[10]).length();t.determinant()<0&&(n=-n),iy.setFromMatrix4(t);const s=1/n,o=1/i,a=1/r;return iy.elements[0]*=s,iy.elements[1]*=s,iy.elements[2]*=s,iy.elements[3]*=o,iy.elements[4]*=o,iy.elements[5]*=o,iy.elements[6]*=a,iy.elements[7]*=a,iy.elements[8]*=a,this.rotation.multiply(iy),this.halfSize.x*=n,this.halfSize.y*=i,this.halfSize.z*=r,ty.setFromMatrixPosition(t),this.center.add(ty),this}}const cy=new ly,hy=/^[og]\s*(.+)?/,uy=/^mtllib /,dy=/^usemtl /,py=/^usemap /,Ay=/\s+/,fy=new os,my=new os,gy=new os,vy=new os,yy=new os,Ey=new Bo;function xy(){const t={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(t,e){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=t,void(this.object.fromDeclaration=!1!==e);const n=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:t||"",fromDeclaration:!1!==e,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(t,e){const n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);const i={index:this.materials.length,name:t||"",mtllib:Array.isArray(e)&&e.length>0?e[e.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(t){const e={index:"number"==typeof t?t:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return e.clone=this.clone.bind(e),e}};return this.materials.push(i),i},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(t){const e=this.currentMaterial();if(e&&-1===e.groupEnd&&(e.groupEnd=this.geometry.vertices.length/3,e.groupCount=e.groupEnd-e.groupStart,e.inherited=!1),t&&this.materials.length>1)for(let t=this.materials.length-1;t>=0;t--)this.materials[t].groupCount<=0&&this.materials.splice(t,1);return t&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),e}},n&&n.name&&"function"==typeof n.clone){const t=n.clone(0);t.inherited=!0,this.object.materials.push(t)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(t,e){const n=parseInt(t,10);return 3*(n>=0?n-1:n+e/3)},parseNormalIndex:function(t,e){const n=parseInt(t,10);return 3*(n>=0?n-1:n+e/3)},parseUVIndex:function(t,e){const n=parseInt(t,10);return 2*(n>=0?n-1:n+e/2)},addVertex:function(t,e,n){const i=this.vertices,r=this.object.geometry.vertices;r.push(i[t+0],i[t+1],i[t+2]),r.push(i[e+0],i[e+1],i[e+2]),r.push(i[n+0],i[n+1],i[n+2])},addVertexPoint:function(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addVertexLine:function(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addNormal:function(t,e,n){const i=this.normals,r=this.object.geometry.normals;r.push(i[t+0],i[t+1],i[t+2]),r.push(i[e+0],i[e+1],i[e+2]),r.push(i[n+0],i[n+1],i[n+2])},addFaceNormal:function(t,e,n){const i=this.vertices,r=this.object.geometry.normals;fy.fromArray(i,t),my.fromArray(i,e),gy.fromArray(i,n),yy.subVectors(gy,my),vy.subVectors(fy,my),yy.cross(vy),yy.normalize(),r.push(yy.x,yy.y,yy.z),r.push(yy.x,yy.y,yy.z),r.push(yy.x,yy.y,yy.z)},addColor:function(t,e,n){const i=this.colors,r=this.object.geometry.colors;void 0!==i[t]&&r.push(i[t+0],i[t+1],i[t+2]),void 0!==i[e]&&r.push(i[e+0],i[e+1],i[e+2]),void 0!==i[n]&&r.push(i[n+0],i[n+1],i[n+2])},addUV:function(t,e,n){const i=this.uvs,r=this.object.geometry.uvs;r.push(i[t+0],i[t+1]),r.push(i[e+0],i[e+1]),r.push(i[n+0],i[n+1])},addDefaultUV:function(){const t=this.object.geometry.uvs;t.push(0,0),t.push(0,0),t.push(0,0)},addUVLine:function(t){const e=this.uvs;this.object.geometry.uvs.push(e[t+0],e[t+1])},addFace:function(t,e,n,i,r,s,o,a,l){const c=this.vertices.length;let h=this.parseVertexIndex(t,c),u=this.parseVertexIndex(e,c),d=this.parseVertexIndex(n,c);if(this.addVertex(h,u,d),this.addColor(h,u,d),void 0!==o&&""!==o){const t=this.normals.length;h=this.parseNormalIndex(o,t),u=this.parseNormalIndex(a,t),d=this.parseNormalIndex(l,t),this.addNormal(h,u,d)}else this.addFaceNormal(h,u,d);if(void 0!==i&&""!==i){const t=this.uvs.length;h=this.parseUVIndex(i,t),u=this.parseUVIndex(r,t),d=this.parseUVIndex(s,t),this.addUV(h,u,d),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(t){this.object.geometry.type="Points";const e=this.vertices.length;for(let n=0,i=t.length;n<i;n++){const i=this.parseVertexIndex(t[n],e);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(t,e){this.object.geometry.type="Line";const n=this.vertices.length,i=this.uvs.length;for(let e=0,i=t.length;e<i;e++)this.addVertexLine(this.parseVertexIndex(t[e],n));for(let t=0,n=e.length;t<n;t++)this.addUVLine(this.parseUVIndex(e[t],i))}};return t.startObject("",!1),t}class by{constructor(t="",e={}){this.baseUrl=t,this.options=e,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=void 0!==this.options.side?this.options.side:Ht,this.wrap=void 0!==this.options.wrap?this.options.wrap:je}setCrossOrigin(t){return this.crossOrigin=t,this}setManager(t){this.manager=t}setMaterials(t){this.materialsInfo=this.convert(t),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(t){if(!this.options)return t;const e={};for(const n in t){const i=t[n],r={};e[n]=r;for(const t in i){let e=!0,n=i[t];const s=t.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]&&(e=!1)}e&&(r[s]=n)}}return e}preload(){for(const t in this.materialsInfo)this.create(t)}getIndex(t){return this.nameLookup[t]}getAsArray(){let t=0;for(const e in this.materialsInfo)this.materialsArray[t]=this.create(e),this.nameLookup[e]=t,t++;return this.materialsArray}create(t){return void 0===this.materials[t]&&this.createMaterial_(t),this.materials[t]}createMaterial_(t){const e=this,n=this.materialsInfo[t],i={name:t,side:this.side};function r(t,n){if(i[t])return;const r=e.getTextureParams(n,i),s=e.loadTexture((o=e.baseUrl,"string"!=typeof(a=r.url)||""===a?"":/^https?:\/\//i.test(a)?a:o+a));var o,a;s.repeat.copy(r.scale),s.offset.copy(r.offset),s.wrapS=e.wrap,s.wrapT=e.wrap,"map"!==t&&"emissiveMap"!==t||(s.colorSpace=Bi),i[t]=s}for(const t in n){const e=n[t];let s;if(""!==e)switch(t.toLowerCase()){case"kd":i.color=zr.toWorkingColorSpace((new Bo).fromArray(e),Bi);break;case"ks":i.specular=zr.toWorkingColorSpace((new Bo).fromArray(e),Bi);break;case"ke":i.emissive=zr.toWorkingColorSpace((new Bo).fromArray(e),Bi);break;case"map_kd":r("map",e);break;case"map_ks":r("specularMap",e);break;case"map_ke":r("emissiveMap",e);break;case"norm":r("normalMap",e);break;case"map_bump":case"bump":r("bumpMap",e);break;case"map_d":r("alphaMap",e),i.transparent=!0;break;case"ns":i.shininess=parseFloat(e);break;case"d":s=parseFloat(e),s<1&&(i.opacity=s,i.transparent=!0);break;case"tr":s=parseFloat(e),this.options&&this.options.invertTrProperty&&(s=1-s),s>0&&(i.opacity=1-s,i.transparent=!0)}}return this.materials[t]=new su(i),this.materials[t]}getTextureParams(t,e){const n={scale:new Br(1,1),offset:new Br(0,0)},i=t.split(/\s+/);let r;return r=i.indexOf("-bm"),r>=0&&(e.bumpScale=parseFloat(i[r+1]),i.splice(r,2)),r=i.indexOf("-s"),r>=0&&(n.scale.set(parseFloat(i[r+1]),parseFloat(i[r+2])),i.splice(r,4)),r=i.indexOf("-o"),r>=0&&(n.offset.set(parseFloat(i[r+1]),parseFloat(i[r+2])),i.splice(r,4)),n.url=i.join(" ").trim(),n}loadTexture(t,e,n,i,r){const s=void 0!==this.manager?this.manager:Uu;let o=s.getHandler(t);null===o&&(o=new ju(s)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin);const a=o.load(t,n,i,r);return void 0!==e&&(a.mapping=e),a}}function Cy(t,e){switch(e){case Bi:t.convertSRGBToLinear();break;case Ti:case Ii:break;default:console.warn("WARNING: LightProbeGenerator convertColorToLinear() encountered an unsupported color space.")}return t}var wy=globalThis.THREE={...t};wy.DRACOLoader=class extends Ou{constructor(t){super(t),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,n,i){const r=new Nu(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,(t=>{this.parse(t,e,i)}),n,i)}parse(t,e,n=()=>{}){this.decodeDracoFile(t,e,null,null,Bi,n).catch(n)}decodeDracoFile(t,e,n,i,r=Ti,s=()=>{}){const o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(t,o).then(e).catch(s)}decodeGeometry(t,e){const n=JSON.stringify(e);if(Fm.has(t)){const e=Fm.get(t);if(e.key===n)return e.promise;if(0===t.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,s=t.byteLength,o=this._getWorker(r,s).then((n=>(i=n,new Promise(((n,s)=>{i._callbacks[r]={resolve:n,reject:s},i.postMessage({type:"decode",id:r,taskConfig:e,buffer:t},[t])}))))).then((t=>this._createGeometry(t.geometry)));return o.catch((()=>!0)).then((()=>{i&&r&&this._releaseTask(i,r)})),Fm.set(t,{key:n,promise:o}),o}_createGeometry(t){const e=new sa;t.index&&e.setIndex(new zo(t.index.array,1));for(let n=0;n<t.attributes.length;n++){const i=t.attributes[n],r=i.name,s=i.array,o=i.itemSize,a=new zo(s,o);"color"===r&&(this._assignVertexColorSpace(a,i.vertexColorSpace),a.normalized=s instanceof Float32Array==0),e.setAttribute(r,a)}return e}_assignVertexColorSpace(t,e){if(e!==Bi)return;const n=new Bo;for(let e=0,i=t.count;e<i;e++)n.fromBufferAttribute(t,e),zr.toWorkingColorSpace(n,Bi),t.setXYZ(e,n.r,n.g,n.b)}_loadLibrary(t,e){const n=new Nu(this.manager);return n.setPath(this.decoderPath),n.setResponseType(e),n.setWithCredentials(this.withCredentials),new Promise(((e,i)=>{n.load(t,e,void 0,i)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const t="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,e=[];return t?e.push(this._loadLibrary("draco_decoder.js","text")):(e.push(this._loadLibrary("draco_wasm_wrapper.js","text")),e.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(e).then((e=>{const n=e[0];t||(this.decoderConfig.wasmBinary=e[1]);const i=km.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))})),this.decoderPending}_getWorker(t,e){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const t=new Worker(this.workerSourceURL);t._callbacks={},t._taskCosts={},t._taskLoad=0,t.postMessage({type:"init",decoderConfig:this.decoderConfig}),t.onmessage=function(e){const n=e.data;switch(n.type){case"decode":t._callbacks[n.id].resolve(n);break;case"error":t._callbacks[n.id].reject(n);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+n.type+'"')}},this.workerPool.push(t)}else this.workerPool.sort((function(t,e){return t._taskLoad>e._taskLoad?-1:1}));const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[t]=e,n._taskLoad+=e,n}))}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map((t=>t._taskLoad)))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}},wy.GLTFLoader=class extends Ou{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(t){return new wg(t)})),this.register((function(t){return new _g(t)})),this.register((function(t){return new Pg(t)})),this.register((function(t){return new Ug(t)})),this.register((function(t){return new Og(t)})),this.register((function(t){return new Sg(t)})),this.register((function(t){return new Ig(t)})),this.register((function(t){return new Bg(t)})),this.register((function(t){return new Tg(t)})),this.register((function(t){return new Cg(t)})),this.register((function(t){return new Rg(t)})),this.register((function(t){return new Mg(t)})),this.register((function(t){return new Dg(t)})),this.register((function(t){return new Lg(t)})),this.register((function(t){return new xg(t)})),this.register((function(t){return new Fg(t)})),this.register((function(t){return new kg(t)}))}load(t,e,n,i){const r=this;let s;if(""!==this.resourcePath)s=this.resourcePath;else if(""!==this.path){const e=pd.extractUrlBase(t);s=pd.resolveURL(e,this.path)}else s=pd.extractUrlBase(t);this.manager.itemStart(t);const o=function(e){i?i(e):console.error(e),r.manager.itemError(t),r.manager.itemEnd(t)},a=new Nu(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){try{r.parse(n,s,(function(n){e(n),r.manager.itemEnd(t)}),o)}catch(t){o(t)}}),n,o)}setDRACOLoader(t){return this.dracoLoader=t,this}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,n,i){let r;const s={},o={},a=new TextDecoder;if("string"==typeof t)r=JSON.parse(t);else if(t instanceof ArrayBuffer)if(a.decode(new Uint8Array(t,0,4))===Ng){try{s[$m]=new Qg(t)}catch(t){return void(i&&i(t))}r=JSON.parse(s[$m].content)}else r=JSON.parse(a.decode(t));else r=t;if(void 0===r.asset||r.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new cv(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let t=0;t<this.pluginCallbacks.length;t++){const e=this.pluginCallbacks[t](l);e.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[e.name]=e,s[e.name]=!0}if(r.extensionsUsed)for(let t=0;t<r.extensionsUsed.length;++t){const e=r.extensionsUsed[t],n=r.extensionsRequired||[];switch(e){case hg:s[e]=new bg;break;case tg:s[e]=new Gg(r,this.dracoLoader);break;case pg:s[e]=new zg;break;case Ag:s[e]=new Hg;break;default:n.indexOf(e)>=0&&void 0===o[e]&&console.warn('THREE.GLTFLoader: Unknown extension "'+e+'".')}}l.setExtensions(s),l.setPlugins(o),l.parse(n,i)}parseAsync(t,e){const n=this;return new Promise((function(i,r){n.parse(t,e,i,r)}))}},wy.KTX2Loader=Gv,wy.OBJLoader=class extends Ou{constructor(t){super(t),this.materials=null}load(t,e,n,i){const r=this,s=new Nu(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{e(r.parse(n))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}setMaterials(t){return this.materials=t,this}parse(t){const e=new xy;-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n")),-1!==t.indexOf("\\\n")&&(t=t.replace(/\\\n/g,""));const n=t.split("\n");let i=[];for(let t=0,r=n.length;t<r;t++){const r=n[t].trimStart();if(0===r.length)continue;const s=r.charAt(0);if("#"!==s)if("v"===s){const t=r.split(Ay);switch(t[0]){case"v":e.vertices.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])),t.length>=7?(Ey.setRGB(parseFloat(t[4]),parseFloat(t[5]),parseFloat(t[6]),Bi),e.colors.push(Ey.r,Ey.g,Ey.b)):e.colors.push(void 0,void 0,void 0);break;case"vn":e.normals.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3]));break;case"vt":e.uvs.push(parseFloat(t[1]),parseFloat(t[2]))}}else if("f"===s){const t=r.slice(1).trim().split(Ay),n=[];for(let e=0,i=t.length;e<i;e++){const i=t[e];if(i.length>0){const t=i.split("/");n.push(t)}}const i=n[0];for(let t=1,r=n.length-1;t<r;t++){const r=n[t],s=n[t+1];e.addFace(i[0],r[0],s[0],i[1],r[1],s[1],i[2],r[2],s[2])}}else if("l"===s){const t=r.substring(1).trim().split(" ");let n=[];const i=[];if(-1===r.indexOf("/"))n=t;else for(let e=0,r=t.length;e<r;e++){const r=t[e].split("/");""!==r[0]&&n.push(r[0]),""!==r[1]&&i.push(r[1])}e.addLineGeometry(n,i)}else if("p"===s){const t=r.slice(1).trim().split(" ");e.addPointGeometry(t)}else if(null!==(i=hy.exec(r))){const t=(" "+i[0].slice(1).trim()).slice(1);e.startObject(t)}else if(dy.test(r))e.object.startMaterial(r.substring(7).trim(),e.materialLibraries);else if(uy.test(r))e.materialLibraries.push(r.substring(7).trim());else if(py.test(r))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if("s"===s){if(i=r.split(" "),i.length>1){const t=i[1].trim().toLowerCase();e.object.smooth="0"!==t&&"off"!==t}else e.object.smooth=!0;const t=e.object.currentMaterial();t&&(t.smooth=e.object.smooth)}else{if("\0"===r)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+r+'"')}}e.finalize();const r=new Pa;if(r.materialLibraries=[].concat(e.materialLibraries),!0==!(1===e.objects.length&&0===e.objects[0].geometry.vertices.length))for(let t=0,n=e.objects.length;t<n;t++){const n=e.objects[t],i=n.geometry,s=n.materials,o="Line"===i.type,a="Points"===i.type;let l=!1;if(0===i.vertices.length)continue;const c=new sa;c.setAttribute("position",new Ko(i.vertices,3)),i.normals.length>0&&c.setAttribute("normal",new Ko(i.normals,3)),i.colors.length>0&&(l=!0,c.setAttribute("color",new Ko(i.colors,3))),!0===i.hasUVIndices&&c.setAttribute("uv",new Ko(i.uvs,2));const h=[];for(let t=0,n=s.length;t<n;t++){const n=s[t],i=n.name+"_"+n.smooth+"_"+l;let r=e.materials[i];if(null!==this.materials)if(r=this.materials.create(n.name),!o||!r||r instanceof ic){if(a&&r&&!(r instanceof gc)){const t=new gc({size:10,sizeAttenuation:!1});Lo.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,r=t}}else{const t=new ic;Lo.prototype.copy.call(t,r),t.color.copy(r.color),r=t}void 0===r&&(r=o?new ic:a?new gc({size:1,sizeAttenuation:!1}):new su,r.name=n.name,r.flatShading=!n.smooth,r.vertexColors=l,e.materials[i]=r),h.push(r)}let u;if(h.length>1){for(let t=0,e=s.length;t<e;t++){const e=s[t];c.addGroup(e.groupStart,e.groupCount,t)}u=o?new fc(c,h):a?new bc(c,h):new ga(c,h)}else u=o?new fc(c,h[0]):a?new bc(c,h[0]):new ga(c,h[0]);u.name=n.name,r.add(u)}else if(e.vertices.length>0){const t=new gc({size:1,sizeAttenuation:!1}),n=new sa;n.setAttribute("position",new Ko(e.vertices,3)),e.colors.length>0&&void 0!==e.colors[0]&&(n.setAttribute("color",new Ko(e.colors,3)),t.vertexColors=!0);const i=new bc(n,t);r.add(i)}return r}},wy.MTLLoader=class extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=""===this.path?pd.extractUrlBase(t):this.path,o=new Nu(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){try{e(r.parse(n,s))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}setMaterialOptions(t){return this.materialOptions=t,this}parse(t,e){const n=t.split("\n");let i={};const r=/\s+/,s={};for(let t=0;t<n.length;t++){let e=n[t];if(e=e.trim(),0===e.length||"#"===e.charAt(0))continue;const o=e.indexOf(" ");let a=o>=0?e.substring(0,o):e;a=a.toLowerCase();let l=o>=0?e.substring(o+1):"";if(l=l.trim(),"newmtl"===a)i={name:l},s[l]=i;else if("ka"===a||"kd"===a||"ks"===a||"ke"===a){const t=l.split(r,3);i[a]=[parseFloat(t[0]),parseFloat(t[1]),parseFloat(t[2])]}else i[a]=l}const o=new by(this.resourcePath||e,this.materialOptions);return o.setCrossOrigin(this.crossOrigin),o.setManager(this.manager),o.setMaterials(s),o}},wy.OBB=ly,wy.BufferGeometryUtils=e,wy.LightProbeGenerator=class{static fromCubeTexture(t){let e=0;const n=new os,i=new os,r=new Bo,s=[0,0,0,0,0,0,0,0,0],o=new hd,a=o.coefficients;for(let o=0;o<6;o++){const l=t.image[o],c=l.width,h=l.height,u=document.createElement("canvas");u.width=c,u.height=h;const d=u.getContext("2d");d.drawImage(l,0,0,c,h);const p=d.getImageData(0,0,c,h),A=p.data,f=p.width,m=2/f;for(let l=0,c=A.length;l<c;l+=4){r.setRGB(A[l]/255,A[l+1]/255,A[l+2]/255),Cy(r,t.colorSpace);const c=l/4,h=(c%f+.5)*m-1,u=1-(Math.floor(c/f)+.5)*m;switch(o){case 0:n.set(-1,u,-h);break;case 1:n.set(1,u,h);break;case 2:n.set(-h,1,-u);break;case 3:n.set(-h,-1,u);break;case 4:n.set(-h,u,1);break;case 5:n.set(h,u,-1)}const d=n.lengthSq(),p=4/(Math.sqrt(d)*d);e+=p,i.copy(n).normalize(),hd.getBasisAt(i,s);for(let t=0;t<9;t++)a[t].x+=s[t]*r.r*p,a[t].y+=s[t]*r.g*p,a[t].z+=s[t]*r.b*p}}const l=4*Math.PI/e;for(let t=0;t<9;t++)a[t].x*=l,a[t].y*=l,a[t].z*=l;return new ud(o)}static async fromCubeRenderTarget(t,e){const n=t.coordinateSystem===Ar?-1:1;let i=0;const r=new os,s=new os,o=new Bo,a=[0,0,0,0,0,0,0,0,0],l=new hd,c=l.coefficients,h=e.texture.type,u=e.width;let d;t.isWebGLRenderer&&(d=h===dn?new Uint16Array(u*u*4):new Uint8Array(u*u*4));for(let l=0;l<6;l++){t.isWebGLRenderer?await t.readRenderTargetPixelsAsync(e,0,0,u,u,d,l):d=await t.readRenderTargetPixelsAsync(e,0,0,u,u,0,l);const p=2/u;for(let t=0,A=d.length;t<A;t+=4){let A,f,m;h===dn?(A=ko.fromHalfFloat(d[t]),f=ko.fromHalfFloat(d[t+1]),m=ko.fromHalfFloat(d[t+2])):(A=d[t]/255,f=d[t+1]/255,m=d[t+2]/255),o.setRGB(A,f,m),Cy(o,e.texture.colorSpace);const g=t/4,v=(1-(g%u+.5)*p)*n,y=1-(Math.floor(g/u)+.5)*p;switch(l){case 0:r.set(-1*n,y,v*n);break;case 1:r.set(1*n,y,-v*n);break;case 2:r.set(v,1,-y);break;case 3:r.set(v,-1,y);break;case 4:r.set(v,y,1);break;case 5:r.set(-v,y,-1)}const E=r.lengthSq(),x=4/(Math.sqrt(E)*E);i+=x,s.copy(r).normalize(),hd.getBasisAt(s,a);for(let t=0;t<9;t++)c[t].x+=a[t]*o.r*x,c[t].y+=a[t]*o.g*x,c[t].z+=a[t]*o.b*x}}const p=4*Math.PI/i;for(let t=0;t<9;t++)c[t].x*=p,c[t].y*=p,c[t].z*=p;return new ud(l)}},wy.DeviceOrientationControls=function(t){var e=this;this.object=t,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0,this.alphaOffset=0;var n,i,r,s,o=function(t){e.deviceOrientation=t},a=function(){e.screenOrientation=window.orientation||0},l=(n=new THREE.Vector3(0,0,1),i=new THREE.Euler,r=new THREE.Quaternion,s=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),function(t,e,o,a,l){i.set(o,e,-a,"YXZ"),t.setFromEuler(i),t.multiply(s),t.multiply(r.setFromAxisAngle(n,-l))});this.connect=function(){a(),window.addEventListener("orientationchange",a,!1),window.addEventListener("deviceorientation",o,!1),e.enabled=!0},this.disconnect=function(){window.removeEventListener("orientationchange",a,!1),window.removeEventListener("deviceorientation",o,!1),e.enabled=!1},this.update=function(){if(!1!==e.enabled){var t=e.deviceOrientation;if(t){var n=t.alpha?THREE.MathUtils.degToRad(t.alpha)+e.alphaOffset:0,i=t.beta?THREE.MathUtils.degToRad(t.beta):0,r=t.gamma?THREE.MathUtils.degToRad(t.gamma):0,s=e.screenOrientation?THREE.MathUtils.degToRad(e.screenOrientation):0;l(e.object.quaternion,n,i,r,s)}}},this.dispose=function(){e.disconnect()},this.connect()},wy.Cache.enabled=!0;const _y=wy;var My=window.AFRAME_CDN_ROOT||"https://cdn.aframe.io/",Sy="aframe-injected",Iy=n(8878),By=n.n(Iy),Ty={colors:{debug:"gray",error:"red",info:"gray",warn:"orange"}};By().formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" "),this.useColors){var e;this.color=(e=function(t){var e=t.split(":");return e[e.length-1]}(this.namespace),Ty.colors&&Ty.colors[e]||null);var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var i=0,r=0;t[0].replace(/%[a-zA-Z%]/g,(function(t){"%%"!==t&&(i++,"%c"===t&&(r=i))})),t.splice(r,0,n)}};var Ry=function(){try{return window.localStorage}catch(t){}}();Ry&&(parseInt(Ry.logs,10)||"true"===Ry.logs)?By().enable("*"):By().enable("*:error,*:info,*:warn");const Ly=By();var Dy=n(1124),Py=n.n(Dy),Uy=Ly("device:error"),Oy=!1,Fy=!1,ky=void 0!==navigator.xr;if(ky){var Ny=function(){var t=document.querySelector("a-scene");t?t.hasLoaded?t.components["xr-mode-ui"].updateEnterInterfaces():t.addEventListener("loaded",Ny):window.addEventListener("DOMContentLoaded",Ny)},Qy=function(t){Uy("WebXR session support error: "+t.message)};navigator.xr.isSessionSupported?(navigator.xr.isSessionSupported("immersive-vr").then((function(t){Oy=t,Ny()})).catch(Qy),navigator.xr.isSessionSupported("immersive-ar").then((function(t){Fy=t,Ny()})).catch((function(){}))):navigator.xr.supportsSession?(navigator.xr.supportsSession("immersive-vr").then((function(){Oy=!0,Ny()})).catch(Qy),navigator.xr.supportsSession("immersive-ar").then((function(){Fy=!0,Ny()})).catch((function(){}))):Uy("WebXR has neither isSessionSupported or supportsSession?!")}function Gy(){return Oy||Fy}function zy(){return Fy}function Hy(){return Oy}var Vy,jy,Wy=(Vy=!1,jy=window.navigator.userAgent||window.navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(jy)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(jy.substr(0,4)))&&(Vy=!0),(Jy()||qy()||eE())&&(Vy=!0),tE()&&(Vy=!1),function(){return Vy});function qy(t){var e=t||window.navigator.userAgent;return/Nexus (7|9)|xoom|sch-i800|playbook|tablet|kindle/i.test(e)||Xy()}function Xy(t,e,n){var i=t||window.navigator.userAgent,r=e||window.navigator.platform,s=n||window.navigator.maxTouchPoints||0;return("iPad"===r||"MacIntel"===r)&&s>0&&/Macintosh|Intel|iPad|ipad/i.test(i)&&!window.MSStream}function Yy(){var t=navigator.userAgent.includes("Macintosh"),e=5===navigator.maxTouchPoints;return t&&e&&ky}function Jy(){return/iPad|iPhone|iPod/.test(window.navigator.platform)}function Ky(){return!Wy()&&!tE()&&void 0!==window.orientation}function Zy(){return/(OculusBrowser)/i.test(window.navigator.userAgent)}function $y(){return/(Mobile VR)/i.test(window.navigator.userAgent)}function tE(){return Zy()||$y()||Yy()}function eE(){return/R7 Build/.test(window.navigator.userAgent)}function nE(){var t=window.orientation;return eE()&&(t+=90),90===t||-90===t}var iE="undefined"==typeof process,rE=!iE,sE=Object.freeze(Object.create(null));function oE(){return{}}function aE(t){var e=[],n=null;function i(i){var r,s;if((i=void 0===i?e.length:i)>0&&null==n&&(n=0),i>0)for(r=e.length,e.length+=Number(i),s=r;s<e.length;s++)e[s]=t();return e.length}return t=t||oE,{grow:i,pool:e,recycle:function(t){t instanceof Object&&(null!==n&&-1!==n?e[--n]=t:e[e.length]=t)},size:function(){return e.length},use:function(){var t;return null!==n&&n!==e.length||i(e.length||5),t=e[n],e[n++]=sE,lE(t),t}}}function lE(t){var e;if(t&&t.constructor===Object)for(e in t)t[e]=void 0}function cE(t,e){var n;if(t&&t.constructor===Object)for(n in t)n in e||delete t[n]}var hE=Ly("utils:coordinates:warn"),uE=["x","y","z","w"],dE=/^\s*((-?\d*\.{0,1}\d+(e-?\d+)?)\s+){2,3}(-?\d*\.{0,1}\d+(e-?\d+)?)\s*$/,pE=/\s+/g;function AE(t,e,n){var i,r,s,o,a,l,c,h,u=n&&"object"==typeof n?n:{};if(t&&t instanceof Object)return a=void 0===t.x?e&&e.x:t.x,l=void 0===t.y?e&&e.y:t.y,c=void 0===t.z?e&&e.z:t.z,h=void 0===t.w?e&&e.w:t.w,null!=a&&(u.x=yE(a)),null!=l&&(u.y=yE(l)),null!=c&&(u.z=yE(c)),null!=h&&(u.w=yE(h)),u;if(null==t)return"object"==typeof e?Object.assign(u,e):e;for(i=t.trim().split(pE),o=0;o<uE.length;o++)if(s=uE[o],i[o])u[s]=parseFloat(i[o],10);else{if(void 0===(r=e&&e[s]))continue;u[s]=yE(r)}return u}function fE(t){var e;return"object"!=typeof t?t:(e=t.x+" "+t.y,null!=t.z&&(e+=" "+t.z),null!=t.w&&(e+=" "+t.w),e)}function mE(t,e){return"object"!=typeof t||"object"!=typeof e?t===e:t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w}function gE(t){return dE.test(t)}function vE(t){return hE("`AFRAME.utils.isCoordinate` has been renamed to `AFRAME.utils.isCoordinates`"),gE(t)}function yE(t){return null!=t&&t.constructor===String?parseFloat(t,10):t}function EE(t){return new THREE.Vector3(t.x,t.y,t.z)}var xE=function(){var t={};return function(e,n){return n in t||(t[n]={}),e in t[n]||(t[n][e]=e.split(n)),t[n][e]}}();function bE(t,e){var n=xE(t,e=e||".");return 1===n.length?n[0]:n}function CE(t,e,n){var i;return n=n||".",-1!==e.indexOf(n)?(i=bE(e,n)).constructor===String?t.getAttribute(i):t.getAttribute(i[0])[i[1]]:t.getAttribute(e)}function wE(t,e,n,i){var r;i=i||".",-1===e.indexOf(i)?t.setAttribute(e,n):(r=bE(e,i)).constructor===String?t.setAttribute(r,n):t.setAttribute(r[0],r[1],n)}function _E(t){var e=t.style.width,n=t.style.height;t.style.width=parseInt(e,10)+1+"px",t.style.height=parseInt(n,10)+1+"px",setTimeout((function(){t.style.width=e,t.style.height=n}),200)}var ME=Ly("utils:src-loader:warn");function SE(t,e,n){!function(t,e){var n;t.tagName?e("IMG"===t.tagName):((n=new XMLHttpRequest).open("HEAD",t),n.addEventListener("load",(function(i){var r;n.status>=200&&n.status<300?null==(r=n.getResponseHeader("Content-Type"))?RE(t,e):r.startsWith("image")?e(!0):e(!1):RE(t,e),n.abort()})),n.send())}(t,(function(i){i?e(t):n(t)}))}function IE(t,e,n){var i,r,s,o="",a=[];if("string"==typeof t){for(r=0;r<5;r++)o+="(url\\((?:[^\\)]+)\\),\\s*)";function l(t){a.push(t),6===a.length&&e(a)}if(o+="(url\\((?:[^\\)]+)\\)\\s*)",s=t.match(new RegExp(o))){for(r=1;r<7;r++)SE(TE(s[r]),l);return}if(!t.startsWith("#"))return void SE(TE(t)||t,n)}if(i=t.tagName?t:function(t){try{var e=document.querySelector(t);return e||ME('No element was found matching the selector: "%s"',t),e}catch(e){return void ME('"%s" is not a valid selector',t)}}(t))return"A-CUBEMAP"===i.tagName&&i.srcs?e(i.srcs):"IMG"===i.tagName?n(i):void ME('Selector "%s" does not point to <a-cubemap> or <img>',t)}function BE(t,e){return IE(t,e,(function(){ME("Expected cubemap but got image")}))}function TE(t){var e=t.match(/url\((.+)\)/);if(e)return e[1]}function RE(t,e){var n=new Image;n.addEventListener("load",(function(){e(!0)})),n.addEventListener("error",(function(){e(!1)})),n.src=t}var LE=Ly("utils:material:warn"),DE=new Set(["emissiveMap","envMap","map","specularMap"]);function PE(t,e){var n=e.offset||{x:0,y:0},i=e.repeat||{x:1,y:1},r=e.npot||!1,s=e.anisotropy||_y.Texture.DEFAULT_ANISOTROPY,o=t.wrapS,a=t.wrapT,l=t.magFilter,c=t.minFilter;r&&(o=_y.ClampToEdgeWrapping,a=_y.ClampToEdgeWrapping,l=_y.LinearFilter,c=_y.LinearFilter),1===i.x&&1===i.y||(o=_y.RepeatWrapping,a=_y.RepeatWrapping),t.offset.set(n.x,n.y),t.repeat.set(i.x,i.y),t.wrapS===o&&t.wrapT===a&&t.magFilter===l&&t.minFilter===c&&t.anisotropy===s||(t.wrapS=o,t.wrapT=a,t.magFilter=l,t.minFilter=c,t.anisotropy=s,t.needsUpdate=!0)}function UE(t,e,n,i){var r=n.el,s=n.material,o=r.sceneEl.systems.renderer,a=i[e];if(n.materialSrcs||(n.materialSrcs={}),!a)return delete n.materialSrcs[t],void l(null);function l(e){s[t]!==e&&(s[t]&&s[t].dispose(),s[t]=e,s.needsUpdate=!0,QE(r,e))}a===n.materialSrcs[t]&&s[t]?PE(s[t],i):(n.materialSrcs[t]=a,a instanceof _y.Texture?l(a):r.sceneEl.systems.material.loadTextureSource(a,(function(e){if(n.materialSrcs[t]===a){var r=s[t];!r||null!==e&&GE(r,e)||(r=null),!r&&e&&(r=zE(e)),r&&(r.source!==e&&(r.source=e,r.needsUpdate=!0),DE.has(t)&&o.applyColorCorrection(r),PE(r,i)),l(r)}})))}function OE(t,e){return UE("map","src",t,e)}function FE(t,e,n){var i=t;"ambientOcclusion"===t&&(i="ao");var r={};return r.src=n[t+"Map"],r.offset=n[t+"TextureOffset"],r.repeat=n[t+"TextureRepeat"],r.wrap=n[t+"TextureWrap"],UE(i+"Map","src",e,r)}var kE={};function NE(t,e){var n=t.material,i=t.el,r="envMap",s=e.envMap,o=e.sphericalEnvMap,a=e.refract;if(o&&(s=o,LE("`sphericalEnvMap` property is deprecated, using spherical map as equirectangular map instead. Use `envMap` property with a CubeMap or Equirectangular image instead.")),t.materialSrcs||(t.materialSrcs={}),!s)return delete t.materialSrcs[r],n.envMap=null,void(n.needsUpdate=!0);function l(e){t.materialSrcs[r]===s&&(n.envMap=e,n.needsUpdate=!0,QE(i,e))}t.materialSrcs[r]=s,kE[s]?kE[s].then(l):kE[s]=new Promise((function(t){IE(s,(function(e){i.sceneEl.systems.material.loadCubeMapTexture(e,(function(e){e.mapping=a?_y.CubeRefractionMapping:_y.CubeReflectionMapping,l(e),t(e)}))}),(function(e){i.sceneEl.systems.material.loadTexture(e,{src:e},(function(e){e.mapping=a?_y.EquirectangularRefractionMapping:_y.EquirectangularReflectionMapping,l(e),t(e)}))}))}))}function QE(t,e){function n(){t.emit("materialvideoloadeddata",{src:e.image,texture:e})}function i(){t.emit("materialvideoended",{src:e.image,texture:e})}e&&(t.emit("materialtextureloaded",{src:e.image,texture:e}),e.image&&"VIDEO"===e.image.tagName&&(e.image.addEventListener("loadeddata",n),e.image.addEventListener("ended",i),e.addEventListener("dispose",(function(){e.image.removeEventListener("loadeddata",n),e.image.removeEventListener("ended",i)}))))}function GE(t,e){return t.source===e&&(e.data instanceof HTMLCanvasElement?t.isCanvasTexture:e.data instanceof HTMLVideoElement?t.isVideoTexture:t.isTexture&&!t.isCanvasTexture&&!t.isVideoTexture)}function zE(t){var e;return(e=t.data instanceof HTMLCanvasElement?new _y.CanvasTexture:t.data instanceof HTMLVideoElement?new _y.VideoTexture(t.data):new _y.Texture).source=t,e.needsUpdate=!0,e}var HE=/-([a-z])/g;function VE(t,e){var n;return"string"!=typeof t?t:(n=function(t,e){var n,i,r,s,o,a;for(e=e||{},n=YE(t),i=0;i<n.length;i++)(r=n[i])&&(s=r.indexOf(":"),o=r.substr(0,s).trim(),a=r.substr(s+1).trim(),e[WE(o)]=a);return e}(t,e),n[""]?t:n)}function jE(t){return"string"==typeof t?t:function(t){var e,n=0,i=0,r="";for(e in t)n++;for(e in t)r+=e+": "+t[e],i<n-1&&(r+="; "),i++;return r}(t)}function WE(t){return t.replace(HE,JE)}var qE,XE,YE=(qE=[],XE=/url\([^)]+$/,function(t){var e,n="",i=0;for(qE.length=0;i<t.length;)-1===(e=t.indexOf(";",i))&&(e=t.length),n+=t.substring(i,e),XE.test(n)?(n+=";",i=e+1):(qE.push(n.trim()),n="",i=e+1);return qE});function JE(t){return t[1].toUpperCase()}var KE=["x","y","z","w"];function ZE(t,e,n){var i,r,s=t.el;if((r=!!(i=$E(t,e,n)))===t.controllerPresent)return r;t.controllerPresent=r,r?(t.addEventListeners(),t.injectTrackedControls(i),s.emit("controllerconnected",{name:t.name,component:t})):(t.removeEventListeners(),s.emit("controllerdisconnected",{name:t.name,component:t}))}function $E(t,e,n){var i,r=t.el.sceneEl,s=r&&r.systems["tracked-controls"];return!!s&&!(!(i=s.controllers)||!i.length)&&tx(i,e,n.hand,n.index,n.iterateControllerProfiles,n.handTracking)}function tx(t,e,n,i,r,s){var o,a,l,c,h=!1;for(o=0;o<t.length;o++){if(c=(l=t[o]).profiles,s)h=l.hand;else if(r)for(a=0;a<c.length&&!(h=c[a].startsWith(e));a++);else h=c.length>0&&c[0].startsWith(e);if(h)if("right"===l.handedness||"left"===l.handedness){if(l.handedness===n)return t[o]}else if(o===i)return t[o]}}function ex(t,e,n){var i,r,s,o,a;for(r in e){for(i=e[r],s=!1,a=0;a<i.length;a++)n.detail.changed[i[a]]&&(s=!0);if(s){for(o={},a=0;a<i.length;a++)o[KE[a]]=n.detail.axis[i[a]];t.el.emit(r+"moved",o)}}}function nx(t,e,n,i){var r=(i?n.mapping[i]:n.mapping).buttons[t];n.el.emit(r+e),n.updateModel&&n.updateModel(r,e)}var ix=Ly("utils:warn");function rx(t){return t.bind.apply(t,Array.prototype.slice.call(arguments,1))}function sx(){return ix("`utils.checkHeadsetConnected` has moved to `utils.device.checkHeadsetConnected`"),Gy()}function ox(){return ix("`utils.isIOS` has moved to `utils.device.isIOS`"),Jy()}function ax(){return ix("`utils.isMobile has moved to `utils.device.isMobile`"),Wy(arguments)}function lx(t,e,n){var i;return n&&(t=t.bind(n)),function(){var n=Date.now();(void 0===i||(void 0===i?e:n-i)>=e)&&(i=n,t.apply(null,arguments))}}function cx(t,e,n){var i,r,s;n&&(t=t.bind(n));var o=function(){i=Date.now(),t.apply(this,s),r=void 0};return function(){var n=Date.now(),a=void 0===i?e:n-i;a>=e?(clearTimeout(r),r=void 0,i=n,t.apply(null,arguments)):(r=r||setTimeout(o,e-a),s=arguments)}}function hx(t,e,n){var i;return n&&(t=t.bind(n)),function(n,r){var s=void 0===i?r:n-i;(void 0===i||s>=e)&&(i=n,t(n,s))}}function ux(t,e,n){var i;return function(){var r=this,s=arguments,o=n&&!i;clearTimeout(i),i=setTimeout((function(){i=null,n||t.apply(r,s)}),e),o&&t.apply(r,s)}}var dx=Object.assign,px=Py();function Ax(t){return JSON.parse(JSON.stringify(t))}var fx,mx,gx=(fx=aE((function(){return[]})),function(t,e){var n,i,r,s,o,a;if(void 0===t||void 0===e||null===t||null===e||!(t&&e&&t.constructor===Object&&e.constructor===Object||t.constructor===Array&&e.constructor===Array))return t===e;for(n in i=fx.use(),r=fx.use(),i.length=0,r.length=0,t)i.push(n);for(n in e)r.push(n);if(i.length!==r.length)return fx.recycle(i),fx.recycle(r),!1;for(s=0;s<i.length;++s)if(o=t[i[s]],a=e[i[s]],"object"==typeof o||"object"==typeof a||Array.isArray(o)&&Array.isArray(a)){if(o===a)continue;if(!gx(o,a))return fx.recycle(i),fx.recycle(r),!1}else if(o!==a)return fx.recycle(i),fx.recycle(r),!1;return fx.recycle(i),fx.recycle(r),!0}),vx=(mx=[],function(t,e,n){var i,r,s,o,a,l,c;for(a in o=n||{},mx.length=0,t)mx.push(a);if(!e)return o;for(s in e)-1===mx.indexOf(s)&&mx.push(s);for(l=0;l<mx.length;l++)i=t[a=mx[l]],r=e[a],((c=i&&r&&i.constructor===Object&&r.constructor===Object)&&!gx(i,r)||!c&&i!==r)&&(o[a]=r);return o});function yx(t){return!t.metaKey&&document.activeElement===document.body}function Ex(t,e){void 0===e&&(e=" ");var n=new RegExp(e,"g");return(t=(t||"").replace(n,e)).split(e)}function xx(t,e){e=e||{};var n={};return Object.keys(e).forEach((function(e){t.hasAttribute(e)&&(n[e]=t.getAttribute(e))})),n}function bx(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))}function Cx(){return window.top!==window.self}function wx(t){for(var e=[],n=t.getElementsByTagName("*"),i=0,r=n.length;i<r;i++)n[i].isScene&&e.push(n[i]);return e}var _x,Mx=[Ix({name:"viewport",content:"width=device-width,initial-scale=1,maximum-scale=1,shrink-to-fit=no,user-scalable=no,minimal-ui,viewport-fit=cover"}),Ix({name:"mobile-web-app-capable",content:"yes"}),Ix({name:"theme-color",content:"black"})],Sx=[Ix({name:"apple-mobile-web-app-capable",content:"yes"}),Ix({name:"apple-mobile-web-app-status-bar-style",content:"black"}),(_x={rel:"apple-touch-icon",href:"https://aframe.io/images/aframe-logo-152.png"},{tagName:"link",attributes:_x,exists:function(){return document.querySelector('link[rel="'+_x.rel+'"]')}})];function Ix(t){return{tagName:"meta",attributes:t,exists:function(){return document.querySelector('meta[name="'+t.name+'"]')}}}var Bx,Tx,Rx,Lx=n(5928),Dx=n.n(Lx),Px=h,Ux="loading-screen";function Ox(t){var e=Bx.hasAttribute("embedded"),n=Rx(Bx.canvas,e,Bx.maxCanvasSize,Bx.is("vr-mode"));t.aspect=n.width/n.height,t.updateProjectionMatrix(),Bx.renderer.setSize(n.width,n.height,!1)}const Fx=[];var kx=By()("core:propertyTypes:warn"),Nx={},Qx=/[,> .[\]:]/,Gx=/url\((.+)\)/;function zx(t,e,n,i,r,s){if(t in Nx)throw new Error("Property type "+t+" is already registered.");Nx[t]={default:e,parse:n||Wx,stringify:i||qx,equals:r||Xx,isCacheable:!1!==s}}function Hx(t,e){if(!Array.isArray(t)||!Array.isArray(e))return t===e;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function Vx(t){var e,n;return"string"!=typeof t?t:(n=t.match(Gx))?n[1]:"#"===t.charAt(0)?(e=document.getElementById(t.substring(1)))?"CANVAS"===e.tagName||"VIDEO"===e.tagName||"IMG"===e.tagName?e:e.getAttribute("src"):void kx('"'+t+'" asset not found.'):t}function jx(t){return t.getAttribute?t.getAttribute("id")?"#"+t.getAttribute("id"):t.getAttribute("src"):qx(t)}function Wx(t){return t}function qx(t){return null===t?"null":t.toString()}function Xx(t,e){return t===e}function Yx(t){return parseInt(t,10)}function Jx(t,e,n){return AE(t,e,n)}function Kx(t,e){if(null===t)return!0;if("object"!=typeof t)return!1;if(Object.keys(t).length!==e)return!1;var n=t.x,i=t.y,r=t.z,s=t.w;return!("number"!=typeof n||"number"!=typeof i||e>2&&"number"!=typeof r||e>3&&"number"!=typeof s)}zx("audio","",Vx,jx),zx("array",[],(function(t){return Array.isArray(t)?t:t&&"string"==typeof t?t.split(",").map((function(t){return t.trim()})):[]}),(function(t){return t.join(", ")}),Hx),zx("asset","",Vx,jx),zx("boolean",!1,(function(t){return"false"!==t&&!1!==t})),zx("color","#FFF"),zx("int",0,Yx),zx("number",0,(function(t){return parseFloat(t,10)})),zx("map","",Vx,jx),zx("model","",Vx,jx),zx("selector",null,(function(t){return t?"string"!=typeof t?t:"#"!==t[0]||Qx.test(t)?document.querySelector(t):document.getElementById(t.substring(1)):null}),(function(t){return t.getAttribute?"#"+t.getAttribute("id"):qx(t)}),Xx,!1),zx("selectorAll",null,(function(t){return t?"string"!=typeof t?t:Array.prototype.slice.call(document.querySelectorAll(t),0):null}),(function(t){return t instanceof Array?t.map((function(t){return"#"+t.getAttribute("id")})).join(", "):qx(t)}),Hx,!1),zx("src","",(function(t){return kx("`src` property type is deprecated. Use `asset` instead."),Vx(t)}),jx),zx("string",""),zx("time",0,Yx),zx("vec2",{x:0,y:0},Jx,fE,mE),zx("vec3",{x:0,y:0,z:0},Jx,fE,mE),zx("vec4",{x:0,y:0,z:0,w:1},Jx,fE,mE);var Zx=function(t,e){return("audio"!==t||"string"==typeof e)&&!("array"===t&&!Array.isArray(e))&&("asset"!==t||"string"==typeof e)&&("boolean"!==t||"boolean"==typeof e)&&("color"!==t||"string"==typeof e)&&("int"!==t||"number"==typeof e)&&("number"!==t||"number"==typeof e)&&("map"!==t||"string"==typeof e)&&("model"!==t||"string"==typeof e)&&("selector"!==t||"string"==typeof e||null===e)&&("selectorAll"!==t||"string"==typeof e||null===e)&&("src"!==t||"string"==typeof e)&&("string"!==t||"string"==typeof e)&&("time"!==t||"number"==typeof e)&&("vec2"===t?Kx(e,2):"vec3"===t?Kx(e,3):"vec4"!==t||Kx(e,4))},$x=Nx,tb=Ly("core:schema:warn");function eb(t){return"type"in t?"string"==typeof t.type:"default"in t}function nb(t,e){var n;if(eb(t))return ib(t,e);for(n in t)t[n]=ib(t[n],e);return t}function ib(t,e){var n,i,r=t.default,s=t.type;return t.type?"bool"===t.type?s="boolean":"float"===t.type&&(s="number"):s=void 0===r||"boolean"!=typeof r&&"number"!=typeof r?Array.isArray(r)?"array":"string":typeof r,(i=$x[s])||tb("Unknown property type for component `"+e+"`: "+s),n=!!t.parse,t.parse=t.parse||i.parse,t.stringify=t.stringify||i.stringify,t.equals=t.equals||i.equals,t.isCacheable=!0===t.isCacheable||i.isCacheable,t.type=s,"default"in t?n||Zx(s,r)||tb("Default value `"+r+"` does not match type `"+s+"` in component `"+e+"`"):t.default=i.default,t}var rb,sb=(rb=[],function(t,e,n,i,r){var s,o,a,l;for(o in rb.length=0,n?t:e)n&&void 0===t[o]||rb.push(o);if(null===t||"object"!=typeof t)return t;for(o in t)void 0===t[o]||e[o]||r||tb("Unknown property `"+o+"` for component/system `"+i+"`.");for(s=0;s<rb.length;s++){if(a=e[o=rb[s]],l=t[o],!e[o])return;t[o]=ob(l,a)}return t});function ob(t,e,n){return null!=t&&""!==t||(t=e.default,Array.isArray(t)&&(t=t.slice())),e.parse(t,e.default,n)}function ab(t,e){var n,i,r,s,o={};for(n in t)i=e[n],"object"==typeof(s=r=t[n])&&(s=lb(r,i),i||tb("Unknown component property: "+n)),void 0!==s&&(o[n]=s);return o}function lb(t,e){return"object"!=typeof t?t:e&&null!==t?e.stringify(t):JSON.stringify(t)}var cb={},hb=ob,ub=nb,db=eb,pb=ab,Ab=lb,fb=h,mb=Ly("core:component:warn"),gb=document.currentScript,vb=new RegExp("[A-Z]+"),yb={},Eb=Object.freeze({}),xb=[],bb={get:function(t,e){return t.getComputedPropertyValue(e)},set:function(t,e,n){return e in t.schema?t.recomputeProperty(e,n):void 0!==n&&t.handleUnknownProperty(e,n),!0}},Cb=function(t,e,n){var i=this;if(this.sceneOnly&&!t.isScene)throw new Error("Component `"+this.name+"` can only be applied to <a-scene>");if(n&&!this.multiple)throw new Error("Trying to initialize multiple components of type `"+this.name+"`. There can only be one component of this type per entity.");this.el=t,this.id=n,this.attrName=this.name+(n?"__"+n:""),this.evtDetail={id:this.id,name:this.name},this.initialized=!1,this.el.components[this.attrName]=this,this.objectPool=yb[this.name];var r=this.events;this.events={},function(t,e){var n;for(n in e)t.events[n]=e[n].bind(t)}(this,r),this.attrValue=void 0,this.isObjectBased?(this.data=this.objectPool.use(),cE(this.data,this.schema),this.oldData=this.objectPool.use(),cE(this.oldData,this.schema),this.attrValueProxy=new Proxy(this,bb)):(this.data=void 0,this.oldData=void 0,this.attrValueProxy=void 0),this.deferUnknownPropertyWarnings=!!this.updateSchema,this.throttledEmitComponentChanged=cx((function(){t.emit("componentchanged",i.evtDetail,!1)}),200),this.updateProperties(e,!0)};Cb.prototype={schema:{},init:function(){},events:{},update:function(t){},updateSchema:void 0,tick:void 0,tock:void 0,play:function(){},pause:function(){},remove:function(){},stringify:function(t){var e=this.schema;return"string"==typeof t?t:this.isSingleProperty?Ab(t,e):(t=pb(t,e),fb.stringify(t))},flushToDOM:function(t){var e=t?this.data:this.attrValue;null!=e&&window.HTMLElement.prototype.setAttribute.call(this.el,this.attrName,this.stringify(e))},updateProperties:function(t,e){var n=this.el;this.updateData(t,e),(n.hasLoaded||n.isLoading)&&(this.initialized?this.callUpdateHandler():this.initComponent())},initComponent:function(){var t,e=this.el;e.initializingComponents[this.name]||(e.initializingComponents[this.name]=!0,this.init(),this.initialized=!0,delete e.initializingComponents[this.name],t=this.isObjectBased?Eb:void 0,this.dataChanged=!1,this.storeOldData(),this.update(t),e.isPlaying&&this.play(),e.emit("componentinitialized",this.evtDetail,!1))},updateData:function(t,e){this.isSingleProperty?this.recomputeProperty(void 0,t):(e?(lE(this.attrValue),this.recomputeData(t),this.schemaChangeRequired=!!this.updateSchema):"string"==typeof t?fb.parse(t,this.attrValueProxy):dx(this.attrValueProxy,t),this.updateSchemaIfNeeded(t))},updateSchemaIfNeeded:function(t){if(this.schemaChangeRequired&&this.updateSchema)for(var e in xb.length=0,this.updateSchema(this.data),cE(this.data,this.schema),this.recomputeData(t),this.schemaChangeRequired=!1,this.attrValue)void 0!==this.attrValue[e]&&-1===xb.indexOf(e)&&(e in this.schema||mb("Unknown property `"+e+"` for component `"+this.name+"`."));for(var n=0;n<xb.length;n++)mb("Unknown property `"+xb[n]+"` for component `"+this.name+"`.");xb.length=0},callUpdateHandler:function(){if(this.isPositionRotationScale||this.dataChanged){this.dataChanged=!1;var t=this.oldData;this.oldDataInUse=!0,this.update(t),t!==this.oldData&&this.objectPool.recycle(t),this.oldDataInUse=!1,this.storeOldData(),this.throttledEmitComponentChanged()}},handleMixinUpdate:function(){this.recomputeData(),this.updateSchemaIfNeeded(),this.callUpdateHandler()},resetProperty:function(t){(this.isSingleProperty||t in this.schema)&&(t?this.attrValue[t]=void 0:(this.isObjectBased&&this.objectPool.recycle(this.attrValue),this.attrValue=void 0),this.recomputeProperty(t,void 0),this.updateSchemaIfNeeded(),this.callUpdateHandler())},extendSchema:function(t){var e;e=dx({},cb[this.name].schema),dx(e,t),this.schema=ub(e),this.el.emit("schemachanged",this.evtDetail)},getComputedPropertyValue:function(t){var e=this.el.mixinEls,n=this.attrValue&&t?this.attrValue[t]:this.attrValue;if(void 0!==n)return n;for(var i=e.length-1;i>=0;i--){var r=e[i].getAttribute(this.attrName);if(null!==r&&(!t||t in r))return t?r[t]:r}return t?this.schema[t].default:this.schema.default},recomputeProperty:function(t,e){var n=t?this.schema[t]:this.schema;if(null!=e){void 0===this.attrValue&&this.isObjectBased&&(this.attrValue=this.objectPool.use());var i=t?this.attrValue[t]:this.attrValue;"string"==typeof(i=n.isCacheable?hb(e,n,i):e)&&(i=""===e?void 0:e),t?this.attrValue[t]=i:this.attrValue=i}this.oldDataInUse&&(this.oldData=this.objectPool.use(),cE(this.oldData,this.schema),this.storeOldData(),this.oldDataInUse=!1);var r=t?this.oldData[t]:this.oldData,s=t?this.data[t]:this.data,o=hb(this.getComputedPropertyValue(t),n,s);return"array"!==n.type||t||(o=Ax(o)),n.equals(o,r)||(this.dataChanged=!0,n.schemaChange&&(this.schemaChangeRequired=!0)),t?this.data[t]=o:this.data=o,o},handleUnknownProperty:function(t,e){void 0===this.attrValue&&(this.attrValue=this.objectPool.use()),this.attrValue[t]=e,this.deferUnknownPropertyWarnings?xb.push(t):this.silenceUnknownPropertyWarnings||mb("Unknown property `"+t+"` for component `"+this.name+"`.")},storeOldData:function(){var t;if(this.isObjectBased)if(this.isSingleProperty)this.oldData=hb(this.data,this.schema,this.oldData);else for(t in this.schema)void 0!==this.data[t]&&(this.data[t]&&"object"==typeof this.data[t]?this.oldData[t]=hb(this.data[t],this.schema[t],this.oldData[t]):this.oldData[t]=this.data[t]);else this.oldData=this.data},recomputeData:function(t){var e;if(this.isSingleProperty)this.recomputeProperty(void 0,t);else{for(e in this.schema)this.attrValueProxy[e]=void 0;t&&"object"==typeof t?dx(this.attrValueProxy,t):"string"==typeof t&&fb.parse(t,this.attrValueProxy)}},eventsAttach:function(){var t;for(t in this.eventsDetach(),this.events)this.el.addEventListener(t,this.events[t])},eventsDetach:function(){var t;for(t in this.events)this.el.removeEventListener(t,this.events[t])},destroy:function(){this.objectPool.recycle(this.attrValue),this.objectPool.recycle(this.data),this.objectPool.recycle(this.oldData),this.attrValue=this.data=this.oldData=this.attrValueProxy=void 0}};var wb={};function _b(t,e){var n,i,r,s,o,a={};if(document.currentScript&&document.currentScript!==gb&&Fx.forEach((function(e){e.hasLoaded||document.currentScript.compareDocumentPosition(e)!==Node.DOCUMENT_POSITION_FOLLOWING&&(mb("The component `"+t+"` was registered in a <script> tag after the scene. Component <script> tags in an HTML file should be declared *before* the scene such that the component is available to entities during scene initialization."),window.debug&&(wb[t]=!0))})),!0===vb.test(t)&&mb("The component name `"+t+"` contains uppercase characters, but HTML will ignore the capitalization of attribute names. Change the name to be lowercase: `"+t.toLowerCase()+"`"),-1!==t.indexOf("__"))throw new Error("The component name `"+t+"` is not allowed. The sequence __ (double underscore) is reserved to specify an id for multiple components of the same type");if(Object.keys(e).forEach((function(t){a[t]={value:e[t],writable:!0}})),cb[t])throw new Error("The component `"+t+"` has been already registered. Check that you are not loading two versions of the same component or two different components of the same name.");((n=function(t,e,n){Cb.call(this,t,e,n)}).prototype=Object.create(Cb.prototype,a)).name=t,n.prototype.isPositionRotationScale="position"===t||"rotation"===t||"scale"===t,n.prototype.constructor=n,n.prototype.system=f&&Rb[t],n.prototype.play=(s=n.prototype.play,function(){var t=this.el.sceneEl,e=this.el.isPlaying&&!this.isPlaying;this.initialized&&e&&(s.call(this),this.isPlaying=!0,this.eventsAttach(),Mb(this)&&t.addBehavior(this))}),n.prototype.pause=(o=n.prototype.pause,function(){var t=this.el.sceneEl;this.isPlaying&&(o.call(this),this.isPlaying=!1,this.eventsDetach(),Mb(this)&&t.removeBehavior(this))}),i=dx(ub(n.prototype.schema,n.prototype.name)),n.prototype.isSingleProperty=r=db(n.prototype.schema),n.prototype.isObjectBased=!r||r&&(Sb(i.default)||Sb(hb(void 0,i))),yb[t]=aE(),cb[t]={Component:n,dependencies:n.prototype.dependencies,before:n.prototype.before,after:n.prototype.after,isSingleProperty:n.prototype.isSingleProperty,isObjectBased:n.prototype.isObjectBased,multiple:n.prototype.multiple,sceneOnly:n.prototype.sceneOnly,name:t,schema:i,stringify:n.prototype.stringify};for(var l=0;l<Fx.length;l++)Fx[l].emit("componentregistered",{name:t},!1);return n}function Mb(t){return t.tick||t.tock}function Sb(t){return t&&t.constructor===Object&&!(t instanceof window.HTMLElement)}var Ib=!1;function Bb(){Ib||(Ib=!0,setTimeout((function(){document.dispatchEvent(new CustomEvent("aframeready"))})))}var Tb=h,Rb={},Lb=function(t){var e=A&&cb[this.name];this.el=t,this.sceneEl=t,e&&(e.Component.prototype.system=this),this.buildData(),this.init(),this.update({})};function Db(t,e){var n,i,r={},s=wx(document);if(Object.keys(e).forEach((function(t){r[t]={value:e[t],writable:!0}})),Rb[t])throw new Error("The system `"+t+"` has been already registered. Check that you are not loading two versions of the same system or two different systems of the same name.");if(i=function(t){Lb.call(this,t)},(i.prototype=Object.create(Lb.prototype,r)).name=t,i.prototype.constructor=i,i.prototype.schema=dx(nb(i.prototype.schema)),Rb[t]=i,Ib)for(n=0;n<s.length;n++)s[n].initSystem(t)}Lb.prototype={schema:{},init:function(){},update:function(t){},updateProperties:function(t){var e=this.data;0!==Object.keys(this.schema).length&&(this.buildData(t),this.update(e))},buildData:function(t){var e=this.schema;0!==Object.keys(e).length&&(t=t||window.HTMLElement.prototype.getAttribute.call(this.sceneEl,this.name),eb(e)?this.data=ob(t,e):this.data=sb(Tb.parse(t)||{},e,!1,this.name))},tick:void 0,tock:void 0,play:function(){},pause:function(){}};var Pb=Ly("core:a-node:warn"),Ub={"a-scene":!0,"a-assets":!0,"a-assets-items":!0,"a-cubemap":!0,"a-mixin":!0,"a-node":!0,"a-entity":!0};function Ob(t){return t.tagName.toLowerCase()in Ub||t.isNode}class Fb extends HTMLElement{constructor(){super(),this.computedMixinStr="",this.hasLoaded=!1,this.isNode=!0,this.mixinEls=[]}connectedCallback(){Ib?this.doConnectedCallback():document.addEventListener("aframeready",this.connectedCallback.bind(this))}doConnectedCallback(){var t;this.sceneEl=this.closestScene(),this.sceneEl||Pb("You are attempting to attach <"+this.tagName+"> outside of an A-Frame scene. Append this element to `<a-scene>` instead."),this.hasLoaded=!1,this.emit("nodeready",void 0,!1),this.isMixin||(t=this.getAttribute("mixin"))&&this.updateMixins(t)}attributeChangedCallback(t,e,n){n!==this.computedMixinStr&&("mixin"!==t||this.isMixin||this.updateMixins(n,e))}closestScene(){for(var t=this;t&&!t.isScene;)t=t.parentElement;return t}closest(t){for(var e=this.matches||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector,n=this;n&&!e.call(n,t);)n=n.parentElement;return n}disconnectedCallback(){this.hasLoaded=!1}load(t,e){var n,i=this;this.hasLoaded||(e=e||Ob,n=this.getChildren().filter(e).map((function(t){return new Promise((function(e,n){if(t.hasLoaded)return e();t.addEventListener("loaded",e),t.addEventListener("error",n)}))})),Promise.allSettled(n).then((function(e){e.forEach((function(t){"rejected"===t.status&&Pb("Rendering scene with errors on node: ",t.reason.target)})),i.isLoading=!0,i.setupMutationObserver(),t&&t(),i.isLoading=!1,i.hasLoaded=!0,i.emit("loaded-private",void 0,!1),i.emit("loaded",void 0,!1)})))}setupMutationObserver(){var t=this;new MutationObserver((function(e){var n;for(n=0;n<e.length;n++)if("attributes"===e[n].type){var i=e[n].attributeName,r=window.HTMLElement.prototype.getAttribute.call(t,i),s=e[n].oldValue;t.attributeChangedCallback(i,s,r)}})).observe(this,{attributes:!0,attributeOldValue:!0})}getChildren(){return Array.prototype.slice.call(this.children,0)}updateMixins(t,e){var n,i,r,s=Fb.newMixinIdArray,o=Fb.oldMixinIdArray,a=Fb.mixinIds;for(s.length=0,o.length=0,i=t?xE(t.trim(),/\s+/):s,r=e?xE(e.trim(),/\s+/):o,a.newMixinIds=i,a.oldMixinIds=r,n=0;n<r.length;n++)-1===i.indexOf(r[n])&&this.unregisterMixin(r[n]);for(this.computedMixinStr="",this.mixinEls.length=0,n=0;n<i.length;n++)this.registerMixin(i[n]);return this.computedMixinStr&&(this.computedMixinStr=this.computedMixinStr.trim(),window.HTMLElement.prototype.setAttribute.call(this,"mixin",this.computedMixinStr)),0===i.length&&window.HTMLElement.prototype.removeAttribute.call(this,"mixin"),a}registerMixin(t){var e,n,i,r=document.getElementById(t);if(r){if(i=r.getAttribute("mixin"))for(e=xE(i.trim(),/\s+/),n=0;n<e.length;n++)this.registerMixin(e[n]);this.computedMixinStr=this.computedMixinStr+" "+r.id,this.mixinEls.push(r)}else Pb("No mixin was found with id `%s`",t)}setAttribute(t,e){"mixin"===t&&this.updateMixins(e),window.HTMLElement.prototype.setAttribute.call(this,t,e)}unregisterMixin(t){var e,n=this.mixinEls;for(e=0;e<n.length;++e)if(t===n[e].id){n.splice(e,1);break}}emit(t,e,n,i){var r=Fb.evtData;void 0===n&&(n=!0),r.bubbles=!!n,r.detail=e,i&&(r=dx({},i,r)),this.dispatchEvent(new CustomEvent(t,r))}}Fb.evtData={},Fb.newMixinIdArray=[],Fb.oldMixinIdArray=[],Fb.mixinIds={},customElements.define("a-node",Fb);var kb=Ly("core:a-entity:debug"),Nb=Ly("core:a-entity:warn"),Qb="__",Gb=["position","rotation","scale","visible"],zb={once:!0};class Hb extends Fb{constructor(){super(),this.components={},this.initializingComponents={},this.componentsToUpdate={},this.isEntity=!0,this.isPlaying=!1,this.object3D=new _y.Group,this.object3D.rotation.order="YXZ",this.object3D.el=this,this.object3DMap={},this.parentEl=null,this.rotationObj={},this.states=[]}attributeChangedCallback(t,e,n){var i=this.components[t];super.attributeChangedCallback(),i&&i.justInitialized&&""===n?delete i.justInitialized:(i||null!==n)&&this.setEntityAttribute(t,e,n)}doConnectedCallback(){var t,e,n=this;super.doConnectedCallback(),e=this.sceneEl,this.addToParent(),this.isScene||(e?!(t=e.querySelector("a-assets"))||t.hasLoaded?this.load():t.addEventListener("loaded",(function(){n.load()})):this.load())}disconnectedCallback(){var t;if(this.parentEl){for(t in this.components)this.removeComponent(t,!1);this.isScene||(this.removeFromParent(),super.disconnectedCallback(),this.object3D.el=null)}}getObject3D(t){return this.object3DMap[t]}setObject3D(t,e){var n,i=this;if(!(e instanceof _y.Object3D))throw new Error("`Entity.setObject3D` was called with an object that was not an instance of THREE.Object3D.");(n=this.getObject3D(t))&&this.object3D.remove(n),e.el=this,e.children.length&&e.traverse((function(t){t.el=i})),this.object3D.add(e),this.object3DMap[t]=e,this.emit("object3dset",{object:e,type:t})}removeObject3D(t){var e=this.getObject3D(t);e?(this.object3D.remove(e),delete this.object3DMap[t],this.emit("object3dremove",{type:t})):Nb("Tried to remove `Object3D` of type:",t,"which was not defined.")}getOrCreateObject3D(t,e){var n=this.getObject3D(t);return!n&&e&&(n=new e,this.setObject3D(t,n)),Nb("`getOrCreateObject3D` has been deprecated. Use `setObject3D()` and `object3dset` event instead."),n}add(t){if(!t.object3D)throw new Error("Trying to add an element that doesn't have an `object3D`");this.object3D.add(t.object3D),this.emit("child-attached",{el:t})}addToParent(){var t=this.parentEl=this.parentNode;t&&t.add&&!this.attachedToParent&&(t.add(this),this.attachedToParent=!0)}removeFromParent(){var t=this.parentEl;this.parentEl.remove(this),this.attachedToParent=!1,this.parentEl=null,t.emit("child-detached",{el:this})}load(){var t=this;!this.hasLoaded&&this.parentEl&&super.load.call(this,(function(){t.parentEl&&(t.updateComponents(),(t.isScene||t.parentEl.isPlaying)&&t.play())}))}remove(t){t?this.object3D.remove(t.object3D):this.parentNode.removeChild(this)}getChildEntities(){for(var t=this.children,e=[],n=0;n<t.length;n++){var i=t[n];i instanceof Hb&&e.push(i)}return e}initComponent(t,e,n){var i,r,s,o;o=(s=xE(t,Qb))[0],r=s.length>2?s.slice(1).join("__"):s[1],cb[o]&&(Vb(this,t)||void 0!==e||n)&&(t in this.components||(this.initComponentDependencies(o),i=new cb[o].Component(this,e,r),this.isPlaying&&i.play(),this.hasAttribute(t)||(i.justInitialized=!0,window.HTMLElement.prototype.setAttribute.call(this,t,"")),kb("Component initialized: %s",t)))}initComponentDependencies(t){var e,n;if(cb[t]&&(e=cb[t].dependencies))for(n=0;n<e.length;n++)this.initComponent(e[n],window.HTMLElement.prototype.getAttribute.call(this,e[n])||void 0,!0)}removeComponent(t,e){var n;(n=this.components[t])&&(n.initialized?(n.pause(),n.remove(),e&&(n.destroy(),delete this.components[t],this.hasAttribute(t)&&window.HTMLElement.prototype.removeAttribute.call(this,t)),this.emit("componentremoved",n.evtDetail,!1)):this.addEventListener("componentinitialized",(function n(i){i.detail.name===t&&(this.removeComponent(t,e),this.removeEventListener("componentinitialized",n))})))}updateComponents(){var t,e,n,i,r,s,o=this.componentsToUpdate;if(this.hasLoaded||this.isLoading){for(n=0;n<this.mixinEls.length;n++)for(i in this.mixinEls[n].componentCache)jb(i)&&(o[i]=!0);if(this.getExtraComponents)for(i in e=this.getExtraComponents())jb(i)&&(o[i]=!0);for(n=0;n<this.attributes.length;++n)i=this.attributes[n].name,-1===Gb.indexOf(i)&&jb(i)&&(o[i]=!0);for(n=0;n<Gb.length;n++)i=Gb[n],this.hasAttribute(i)&&this.updateComponent(i,this.getDOMAttribute(i));for(i in o)r=this.getDOMAttribute(i),t=(s=e&&e[i])?s.constructor===Object?dx(s,VE(r||{})):r||s:r,this.updateComponent(i,t),delete o[i]}}updateComponent(t,e,n){var i=this.components[t];if(i)return null!==e||Vb(this,t)?void i.updateProperties(e,n):void this.removeComponent(t,!0);this.initComponent(t,e,!1)}removeAttribute(t,e){var n=this.components[t];n&&void 0===e&&this.removeComponent(t,!0),n&&void 0!==e?n.resetProperty(e):("mixin"===t&&this.mixinUpdate(""),window.HTMLElement.prototype.removeAttribute.call(this,t))}play(){var t,e,n;if(!this.isPlaying&&(this.hasLoaded||this.isLoading)){for(n in this.isPlaying=!0,this.components)this.components[n].play();for(t=this.getChildEntities(),e=0;e<t.length;e++)t[e].play();this.emit("play")}}pause(){var t,e,n;if(this.isPlaying){for(n in this.isPlaying=!1,this.components)this.components[n].pause();for(t=this.getChildEntities(),e=0;e<t.length;e++)t[e].pause();this.emit("pause")}}setEntityAttribute(t,e,n){if(cb[t]||this.components[t])this.updateComponent(t,n);else if("mixin"===t){if(n===this.computedMixinStr)return;this.mixinUpdate(n,e)}}mixinUpdate(t,e,n){var i,r,s,o,a=Hb.componentsUpdated,l=this;if(n||(e=e||this.getAttribute("mixin")),this.hasLoaded){for(s=this.updateMixins(t,e),a.length=0,o=0;o<this.mixinEls.length;o++)for(i in this.mixinEls[o].componentCache)-1===a.indexOf(i)&&(this.components[i]?this.components[i].handleMixinUpdate():this.initComponent(i,null),a.push(i));for(o=0;o<s.oldMixinIds.length;o++)if(r=document.getElementById(s.oldMixinIds[o]))for(i in r.componentCache)-1===a.indexOf(i)&&this.components[i]&&(this.getDOMAttribute(i)?this.components[i].handleMixinUpdate():this.removeComponent(i,!0))}else this.addEventListener("loaded-private",(function(){l.mixinUpdate(t,e,!0)}),zb)}setAttribute(t,e,n){var i,r,s,o,a,l=Hb.singlePropUpdate;if(s=(o=t.indexOf(Qb))>0?t.substring(0,o):t,!cb[s])return"mixin"===t&&this.mixinUpdate(e),void super.setAttribute.call(this,t,e);if(!this.components[t]&&this.hasAttribute(t)&&this.updateComponent(t,window.HTMLElement.prototype.getAttribute.call(this,t)),void 0!==n&&"string"==typeof e&&e.length>0&&"string"==typeof VE(e)){for(a in l)delete l[a];(i=l)[e]=n,r=!1}else i=e,r=!0===n;this.updateComponent(t,i,r),this.sceneEl&&this.sceneEl.getAttribute("debug")&&this.components[t].flushToDOM()}flushToDOM(t){var e,n,i,r=this.components,s=this.children;for(i in r)r[i].flushToDOM();if(t)for(n=0;n<s.length;++n)(e=s[n]).flushToDOM&&e.flushToDOM(t)}getAttribute(t){var e,n,i,r,s;return"position"===t?this.object3D.position:"rotation"===t?(n=this,i=_y.MathUtils.radToDeg,r=n.object3D.rotation,(s=n.rotationObj).x=i(r.x),s.y=i(r.y),s.z=i(r.z),s):"scale"===t?this.object3D.scale:"visible"===t?this.object3D.visible:(e=this.components[t])?e.data:window.HTMLElement.prototype.getAttribute.call(this,t)}getDOMAttribute(t){var e=this.components[t];return e?e.attrValue:window.HTMLElement.prototype.getAttribute.call(this,t)}addState(t){this.is(t)||(this.states.push(t),this.emit("stateadded",t))}removeState(t){var e=this.states.indexOf(t);-1!==e&&(this.states.splice(e,1),this.emit("stateremoved",t))}is(t){return-1!==this.states.indexOf(t)}inspect(){this.sceneEl.components.inspector.openInspector(this)}destroy(){var t;if(this.parentNode)Nb("Entity can only be destroyed if detached from scenegraph.");else for(t in this.components)this.components[t].destroy()}}function Vb(t,e){return!(!t.components[e]||!t.components[e].attrValue)||function(t,e){var n,i=!1;for(n=0;n<e.length&&!(i=e[n].hasAttribute(t));++n);return i}(e,t.mixinEls)}function jb(t){return-1!==t.indexOf(Qb)&&(t=xE(t,Qb)[0]),!!cb[t]}function Wb(t){if(t.data&&"vr"===t.data.type)switch(t.data.data){case"enter":this.enterVR();break;case"exit":this.exitVR()}}Hb.componentsUpdated=[],Hb.singlePropUpdate={},customElements.define("a-entity",Hb),Jy()&&window.addEventListener("orientationchange",(function(){document.documentElement.style.height="initial",setTimeout((function(){document.documentElement.style.height="100%",setTimeout((function(){window.scrollTo(0,1)}),500)}),500)}));var qb=Ly("core:a-scene:warn"),Xb=Jy(),Yb=Wy(),Jb=ky;class Kb extends Hb{constructor(){var t;super(),(t=this).clock=new _y.Clock,t.isIOS=Xb,t.isMobile=Yb,t.hasWebXR=Jb,t.isAR=!1,t.isScene=!0,t.object3D=new _y.Scene,t.object3D.onAfterRender=function(e,n,i){t.isPlaying&&t.tock(t.time,t.delta,i)},t.resize=t.resize.bind(t),t.render=t.render.bind(t),t.systems={},t.systemNames=[],t.time=t.delta=0,t.usedOfferSession=!1,t.componentOrder=[],t.behaviors={},t.hasLoaded=!1,t.isPlaying=!1,t.originalHTML=t.innerHTML}addFullScreenStyles(){document.documentElement.classList.add("a-fullscreen")}removeFullScreenStyles(){document.documentElement.classList.remove("a-fullscreen")}doConnectedCallback(){var t=this,e=this.hasAttribute("embedded");this.setAttribute("inspector",""),this.setAttribute("keyboard-shortcuts",""),this.setAttribute("screenshot",""),this.setAttribute("xr-mode-ui",""),this.setAttribute("device-orientation-permission-ui",""),super.doConnectedCallback(),function(t){var e;function n(){document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||t.exitVR(),document.activeElement.blur(),document.body.focus()}(e=document.createElement("canvas")).classList.add("a-canvas"),e.dataset.aframeCanvas=!0,t.appendChild(e),document.addEventListener("fullscreenchange",n),document.addEventListener("mozfullscreenchange",n),document.addEventListener("webkitfullscreenchange",n),document.addEventListener("MSFullscreenChange",n),e.addEventListener("touchmove",(function(t){t.preventDefault()}),{passive:!1}),t.canvas=e,t.emit("render-target-loaded",{target:e}),setTimeout(t.resize.bind(t),0)}(this),this.setupRenderer(),function(t,e){Rx=e;var n,i,r,s,o,a,l,c,h,u,d=(Bx=t).hasAttribute(Ux)?Px.parse(Bx.getAttribute(Ux)):void 0,p=d&&d.dotsColor||"white",A=d&&d.backgroundColor||"#24CAFF";(void 0===d||"true"===d.enabled||void 0===d.enabled)&&(n=new THREE.Scene,i=new THREE.SphereGeometry(.2,36,18,0,2*Math.PI,0,Math.PI),r=new THREE.MeshBasicMaterial({color:p}),s=new THREE.Mesh(i,r),o=s.clone(),a=s.clone(),l=new THREE.PerspectiveCamera(80,window.innerWidth/window.innerHeight,5e-4,1e4),c=new THREE.Clock,h=0,u=function(){Bx.renderer.render(n,l),h=c.getElapsedTime()%4,s.visible=h>=1,o.visible=h>=2,a.visible=h>=3},n.background=new THREE.Color(A),n.add(l),s.position.set(-1,0,-15),o.position.set(0,0,-15),a.position.set(1,0,-15),l.add(s),l.add(o),l.add(a),(Tx=document.createElement("div")).className="a-loader-title",Tx.innerHTML=document.title,Tx.style.display="none",Tx.setAttribute(Sy,""),Bx.appendChild(Tx),setTimeout((function(){Bx.hasLoaded||(Ox(l),Tx.style.display="block",window.addEventListener("resize",(function(){Ox(l)})),Bx.renderer.setAnimationLoop(u))}),200))}(this,tC),this.resize(),e||this.addFullScreenStyles(),Cx()&&window.addEventListener("message",Wb.bind(this)),function(t){var e,n=document.head,i=n.querySelector("script"),r=[];return Mx.forEach(s),t.isIOS&&Sx.forEach(s),r;function s(t){t&&!t.exists()&&(e=function(t){if(t&&t.tagName){var e=document.createElement(t.tagName);return e.setAttribute(Sy,""),dx(e,t.attributes)}}(t),e&&(i?i.parentNode.insertBefore(e,i):n.appendChild(e),r.push(e)))}}(this),function(t){if(t.isMobile){var e=t.wakelock=new(Dx());t.addEventListener("enter-vr",(function(){e.request()})),t.addEventListener("exit-vr",(function(){e.release()}))}}(this),this.enterVRBound=function(){t.enterVR()},this.exitVRBound=function(){t.exitVR()},window.addEventListener("sessionend",this.resize),this.addEventListener("cameraready",(function(){t.attachedCallbackPostCamera()})),this.initSystems(),this.componentOrder=Zb(cb,this.componentOrder),this.addEventListener("componentregistered",(function(){t.componentOrder=Zb(cb,t.componentOrder)})),this.hasWebXR&&navigator.xr&&navigator.xr.addEventListener&&navigator.xr.addEventListener("sessiongranted",(function(){t.enterVR()}))}attachedCallbackPostCamera(){var t=this;window.addEventListener("load",void 0),window.addEventListener("resize",(function(){t.isIOS?setTimeout(t.resize,100):t.resize()})),this.play(),Fx.push(this)}initSystems(){var t;for(t in this.initSystem("camera"),Rb)"camera"!==t&&this.initSystem(t)}initSystem(t){this.systems[t]||(this.systems[t]=new Rb[t](this),this.systemNames.push(t))}disconnectedCallback(){var t=Fx.indexOf(this);super.disconnectedCallback(),Fx.splice(t,1),window.removeEventListener("sessionend",this.resize),this.removeFullScreenStyles(),this.renderer.dispose()}addBehavior(t){var e,n,i=this.behaviors[t.name];for(n in i||(i=this.behaviors[t.name]={tick:{inUse:!1,array:[],markedForRemoval:[]},tock:{inUse:!1,array:[],markedForRemoval:[]}}),i)if(t[n]){if((e=i[n]).inUse){var r=e.markedForRemoval.indexOf(t);-1!==r&&e.markedForRemoval.splice(r,1)}-1===e.array.indexOf(t)&&e.array.push(t)}}getPointerLockElement(){return document.pointerLockElement}checkHeadsetConnected(){return Gy()}enterAR(){var t;if(!this.hasWebXR)throw t="Failed to enter AR mode, WebXR not supported.",new Error(t);if(!zy())throw t="Failed to enter AR, WebXR immersive-ar mode not supported in your browser or device.",new Error(t);return this.enterVR(!0)}enterVR(t,e){var n,i=this,r=i.renderer.xr;if(e&&(!navigator.xr||!navigator.xr.offerSession))return Promise.resolve("OfferSession is not supported.");if(i.usedOfferSession&&e)return Promise.resolve("OfferSession was already called.");if(this.is("vr-mode"))return Promise.resolve("Already in VR.");if(this.checkHeadsetConnected()||this.isMobile){var s=i.getAttribute("renderer");if(r.enabled=!0,this.hasWebXR){this.xrSession&&this.xrSession.removeEventListener("end",this.exitVRBound);var o=this.sceneEl.systems.webxr.sessionReferenceSpaceType;r.setReferenceSpaceType(o);var a=t?"immersive-ar":"immersive-vr";return n=this.sceneEl.systems.webxr.sessionConfiguration,new Promise((function(t,o){var c=e?navigator.xr.offerSession.bind(navigator.xr):navigator.xr.requestSession.bind(navigator.xr);i.usedOfferSession|=e,c(a,n).then((function(o){e&&(i.usedOfferSession=!1),r.layersEnabled=-1!==n.requiredFeatures.indexOf("layers"),r.setSession(o).then((function(){r.setFoveation(s.foveationLevel),i.xrSession=o,i.systems.renderer.setWebXRFrameRate(o),o.addEventListener("end",i.exitVRBound),l(t)}))}),(function(t){o(new Error("Failed to enter "+("immersive-ar"===a?"AR":"VR")+" mode (`requestSession`)",{cause:t}))}))}))}throw new Error("Failed to enter "+(t?"AR":"VR")+" no WebXR")}return l(),Promise.resolve();function l(e){var n;t?i.addState("ar-mode"):i.addState("vr-mode"),i.emit("enter-vr",{target:i}),!i.hasWebXR&&i.isMobile&&screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape"),i.addFullScreenStyles(),i.isMobile||i.checkHeadsetConnected()||((n=i.canvas).requestFullscreen||n.webkitRequestFullscreen||n.mozRequestFullScreen||n.msRequestFullscreen).apply(n,[{navigationUI:"hide"}]),i.resize(),e&&e()}}exitVR(){var t=this,e=this.renderer.xr;if(!this.is("vr-mode")&&!this.is("ar-mode"))return Promise.resolve("Not in immersive mode.");if(this.checkHeadsetConnected()||this.isMobile){if(e.enabled=!1,!this.hasWebXR)throw Error("Failed to exit VR - no WebXR");this.xrSession.removeEventListener("end",this.exitVRBound),this.xrSession.end().then((function(){}),(function(){})),this.xrSession=void 0}else(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen());return t.removeState("vr-mode"),t.removeState("ar-mode"),t.isMobile&&screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),t.hasAttribute("embedded")&&t.removeFullScreenStyles(),t.resize(),t.isIOS&&_E(t.canvas),t.renderer.setPixelRatio(window.devicePixelRatio),t.emit("exit-vr",{target:t}),Promise.resolve()}getAttribute(t){var e=this.systems[t];return e?e.data:Hb.prototype.getAttribute.call(this,t)}getDOMAttribute(t){var e=this.systems[t];return e?e.data:Hb.prototype.getDOMAttribute.call(this,t)}setAttribute(t,e,n){if(Rb[t]){Fb.prototype.setAttribute.call(this,t,e);var i=this.systems[t];i&&i.updateProperties(e)}else Hb.prototype.setAttribute.call(this,t,e,n)}removeBehavior(t){var e,n,i,r=this.behaviors[t.name];for(n in r)t[n]&&-1!==(i=(e=r[n]).array.indexOf(t))&&(e.inUse?-1===e.markedForRemoval.indexOf(t)&&e.markedForRemoval.push(t):(e.array[i]=e.array[e.array.length-1],e.array.pop()))}resize(){var t,e,n=this.camera,i=this.canvas,r=this.renderer.xr.isPresenting;t=this.renderer.xr.enabled&&r,!n||!i||this.is("vr-mode")&&(this.isMobile||t)||(e=tC(i,this.getAttribute("embedded")&&!this.is("vr-mode"),this.maxCanvasSize,this.is("vr-mode")),n.aspect=e.width/e.height,n.updateProjectionMatrix(),this.renderer.setSize(e.width,e.height,!1),this.emit("rendererresize",null,!1))}setupRenderer(){var t,e,n,i=this;n={alpha:!0,antialias:!Yb,canvas:this.canvas,logarithmicDepthBuffer:!1,powerPreference:"high-performance"},this.maxCanvasSize={height:-1,width:-1},this.hasAttribute("renderer")&&((e=VE(this.getAttribute("renderer"))).precision&&(n.precision=e.precision+"p"),e.antialias&&"auto"!==e.antialias&&(n.antialias="true"===e.antialias),e.logarithmicDepthBuffer&&"auto"!==e.logarithmicDepthBuffer&&(n.logarithmicDepthBuffer="true"===e.logarithmicDepthBuffer),e.alpha&&(n.alpha="true"===e.alpha),e.stencil&&(n.stencil="true"===e.stencil),e.multiviewStereo&&(n.multiviewStereo="true"===e.multiviewStereo),this.maxCanvasSize={width:e.maxCanvasWidth?parseInt(e.maxCanvasWidth):this.maxCanvasSize.width,height:e.maxCanvasHeight?parseInt(e.maxCanvasHeight):this.maxCanvasSize.height}),(t=this.renderer=new _y.WebGLRenderer(n)).setPixelRatio(window.devicePixelRatio),this.camera&&t.xr.setPoseTarget(this.camera.el.object3D),this.addEventListener("camera-set-active",(function(){t.xr.setPoseTarget(i.camera.el.object3D)}))}play(){var t=this,e=this;this.renderStarted?Hb.prototype.play.call(this):(this.addEventListener("loaded",(function(){var t=this.renderer;Hb.prototype.play.call(this),e.renderStarted||(e.resize(),e.renderer&&(window.performance&&window.performance.mark("render-started"),window.removeEventListener("resize",Ox),Tx&&(Tx.style.display="none"),t.setAnimationLoop(this.render),e.renderStarted=!0,e.emit("renderstart")))})),setTimeout((function(){Hb.prototype.load.call(t)})))}updateComponent(t){t in Rb||Hb.prototype.updateComponent.apply(this,arguments)}tick(t,e){var n,i=this.systems;for(this.callComponentBehaviors("tick",t,e),n=0;n<this.systemNames.length;n++)i[this.systemNames[n]].tick&&i[this.systemNames[n]].tick(t,e)}tock(t,e,n){var i,r=this.systems;for(this.callComponentBehaviors("tock",t,e),i=0;i<this.systemNames.length;i++)r[this.systemNames[i]].tock&&r[this.systemNames[i]].tock(t,e,n)}render(t,e){var n=this.renderer;this.frame=e,this.delta=1e3*this.clock.getDelta(),this.time=1e3*this.clock.elapsedTime,this.isPlaying&&this.tick(this.time,this.delta);var i=null;this.is("ar-mode")&&(i=this.object3D.background,this.object3D.background=null),n.render(this.object3D,this.camera),i&&(this.object3D.background=i)}callComponentBehaviors(t,e,n){for(var i,r=0;r<this.componentOrder.length;r++){var s=this.behaviors[this.componentOrder[r]];if(s){var o=s[t];for(o.inUse=!0,i=0;i<o.array.length;i++)o.array[i].isPlaying&&o.array[i][t](e,n);for(o.inUse=!1,i=0;i<o.markedForRemoval.length;i++)this.removeBehavior(o.markedForRemoval[i]);o.markedForRemoval.length=0}}}}function Zb(t,e){var n,i,r={},s=e||[];for(i in s.length=0,t){var o=t[i];if(void 0!==o){var a=o.before?o.before.slice(0):[],l=o.after?o.after.slice(0):[];r[i]={before:a,after:l,visited:!1,done:!1}}}for(i in r)for(n=0;n<r[i].before.length;n++){var c=r[i].before[n];c in r?r[c].after.push(i):qb("Invalid ordering constraint, no component named `"+c+"` referenced by `"+i+"`")}function h(t){if(t in r&&!r[t].done)if(r[t].visited)qb("Cycle detected, ignoring one or more before/after constraints. The resulting order might be incorrect");else{r[t].visited=!0;for(var e=0;e<r[t].after.length;e++){var n=r[t].after[e];n in r||qb("Invalid before/after constraint, no component named `"+n+"` referenced in `"+t+"`"),h(n)}r[t].done=!0,s.push(t)}}for(i in r)r[i].done||h(i);return s}function $b(t,e){var n,i=window.devicePixelRatio;return!e||-1===e.width&&-1===e.height||t.width*i<e.width&&t.height*i<e.height||(n=t.width/t.height,t.width*i>e.width&&-1!==e.width&&(t.width=Math.round(e.width/i),t.height=Math.round(e.width/n/i)),t.height*i>e.height&&-1!==e.height&&(t.height=Math.round(e.height/i),t.width=Math.round(e.height*n/i))),t}function tC(t,e,n,i){return t.parentElement?e?$b({height:t.parentElement.offsetHeight,width:t.parentElement.offsetWidth},n):function(t,e){var n;return n={height:document.body.offsetHeight,width:document.body.offsetWidth},e?n:$b(n,t)}(n,i):{height:0,width:0}}customElements.define("a-scene",Kb);var eC=nb,nC={},iC=[],rC=function(){};function sC(t,e){var n,i={};if(Object.keys(e).forEach((function(t){i[t]={value:e[t],writable:!0}})),nC[t])throw new Error("The geometry `"+t+"` has been already registered");return((n=function(){rC.call(this)}).prototype=Object.create(rC.prototype,i)).name=t,n.prototype.constructor=n,nC[t]={Geometry:n,schema:eC(n.prototype.schema)},iC.push(t),n}rC.prototype={schema:{},init:function(t){return this.geometry=new _y.BufferGeometry,this.geometry},update:function(t){}};var oC=Ly,aC=wE,lC=oC("extras:primitives:debug"),cC=oC("extras:primitives:warn"),hC=oC("extras:primitives:error"),uC={};function dC(t,e){if(t=t.toLowerCase(),!Ub[t]){Ub[t]=!0,lC("Registering <%s>",t),e.defaultAttributes&&cC("The 'defaultAttributes' object is deprecated. Use 'defaultComponents' instead.");var n=e.mappings||{},i=class extends Hb{constructor(){super(),this.defaultComponentsFromPrimitive=e.defaultComponents||e.defaultAttributes||{},this.deprecated=e.deprecated||null,this.deprecatedMappings=e.deprecatedMappings||{},this.mappings=n,e.deprecated&&console.warn(e.deprecated),this.resolveMappingCollisions()}resolveMappingCollisions(){var t=this.mappings,e=this;Object.keys(t).forEach((function(n){var i;n!==n.toLowerCase()&&cC("Mapping keys should be specified in lower case. The mapping key "+n+" may not be recognized"),cb[n]&&(i=t[n].replace(".","-"),t[i]=t[n],delete t[n],console.warn("The primitive "+e.tagName.toLowerCase()+" has a mapping collision. The attribute "+n+" has the same name as a registered component and has been renamed to "+i))}))}getExtraComponents(){var t,e,n,i,r,s=this;for(e=Ax(this.defaultComponentsFromPrimitive),(r=this.getAttribute("mixin"))&&(r=xE(r.trim(),/\s+/)).forEach((function(t){var n,r,c=document.getElementById(t);if(c){var h=c.rawAttributeCache,u=c.componentCache;for(var d in h){if(i=s.mappings[d])return void pC(i,h[d],e);d in u&&(e[d]=(n=e[d],r=u[d],o(n)?a(r):o(r)?a(n):l(n)&&l(r)?px(n,r):a(r)))}}})),n=0;n<this.attributes.length;n++)t=this.attributes[n],(i=this.mappings[t.name])&&pC(i,t.value,e);return e;function o(t){return void 0===t}function a(t){return l(t)?px({},t):t}function l(t){return null!==t&&t.constructor===Object}}attributeChangedCallback(t,e,n){var i=this.mappings[t];t in this.deprecatedMappings&&console.warn(this.deprecatedMappings[t]),t&&i?aC(this,i,n):super.attributeChangedCallback(t,e,n)}};return customElements.define(t,i),i.mappings=n,uC[t]=i,i}hC("Trying to register primitive "+t+" that has been already previously registered")}function pC(t,e,n){var i=bE(t);i.constructor===Array?(n[i[0]]=n[i[0]]||{},n[i[0]][i[1]]=e.trim()):n[i]=e.trim()}var AC={},fC=[],mC={array:"v3",color:"v3",int:"i",number:"f",map:"t",time:"f",vec2:"v2",vec3:"v3",vec4:"v4"},gC=function(){};function vC(t,e){var n,i={};if(Object.keys(e).forEach((function(t){i[t]={value:e[t],writable:!0}})),AC[t])throw new Error("The shader "+t+" has already been registered");return((n=function(){gC.call(this)}).prototype=Object.create(gC.prototype,i)).name=t,n.prototype.constructor=n,AC[t]={Shader:n,schema:nb(n.prototype.schema)},fC.push(t),n}gC.prototype={schema:{},vertexShader:"void main() {gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);}",fragmentShader:"void main() {gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);}",init:function(t){return this.uniforms=this.initUniforms(),this.material=new(this.raw?_y.RawShaderMaterial:_y.ShaderMaterial)({uniforms:this.uniforms,glslVersion:this.raw||this.glsl3?_y.GLSL3:null,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader}),this.material},initUniforms:function(){var t,e,n=this.schema,i={};for(t in n)"uniform"===n[t].is&&(e=mC[n[t].type],i[t]={type:e,value:void 0});return i},update:function(t){var e,n,i=this.schema,r=this.uniforms;for(e in t)if(i[e]&&"uniform"===i[e].is)if("map"!==i[e].type)r[e].value=this.parseValue(i[e].type,t[e]),r[e].needsUpdate=!0;else{if(!r[e]||r[e].value===t[e])continue;n="_texture_"+e,this.setMapOnTextureLoad(r,e,n),UE(n,e,this,t)}},parseValue:function(t,e){var n;switch(t){case"vec2":return new _y.Vector2(e.x,e.y);case"vec3":return new _y.Vector3(e.x,e.y,e.z);case"vec4":return new _y.Vector4(e.x,e.y,e.z,e.w);case"color":return n=new _y.Color(e),new _y.Vector3(n.r,n.g,n.b);default:return e}},setMapOnTextureLoad:function(t,e,n){var i=this;this.el.addEventListener("materialtextureloaded",(function(){t[e].value=i.material[n],t[e].needsUpdate=!0}))}};var yC=new _y.FileLoader,EC=Ly("core:a-assets:warn");function xC(t){if(t.hasAttribute("autoplay")||"auto"===t.getAttribute("preload"))return new Promise((function(e,n){if(4===t.readyState)return e();if(t.error)return n();function i(){for(var n=0,i=0;i<t.buffered.length;i++)n+=t.buffered.end(i)-t.buffered.start(i);n>=t.duration&&("VIDEO"===t.tagName&&_y.Cache.add(t.getAttribute("src"),t),e())}t.addEventListener("loadeddata",i,!1),t.addEventListener("progress",i,!1),t.addEventListener("error",n,!1)}))}function bC(t){var e=function(t){var e,n,i;if(t.hasAttribute("crossorigin"))return t;if(null!==(e=t.getAttribute("src"))){if(-1===e.indexOf("://"))return t;if((i=(n=e).indexOf("://")>-1?n.split("/")[2]:n.split("/")[0]).substring(0,i.indexOf(":"))===window.location.host)return t}return EC('Cross-origin element (e.g., <img>) was requested without `crossorigin` set. A-Frame will re-request the asset with `crossorigin` attribute set. Please set `crossorigin` on the element (e.g., <img crossorigin="anonymous">)',e),t.crossOrigin="anonymous",t.cloneNode(!0)}(t);return e.tagName&&"video"===e.tagName.toLowerCase()&&(e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline","")),e!==t&&(t.parentNode.appendChild(e),t.parentNode.removeChild(t)),e}customElements.define("a-assets",class extends Fb{constructor(){super(),this.isAssets=!0,this.fileLoader=yC,this.timeout=null}doConnectedCallback(){var t,e,n,i,r,s,o=this,a=[];if(super.doConnectedCallback(),!this.parentNode.isScene)throw new Error("<a-assets> must be a child of a <a-scene>.");for(r=this.querySelectorAll("img"),t=0;t<r.length;t++)i=bC(r[t]),a.push(new Promise((function(e,n){_y.Cache.add(r[t].getAttribute("src"),i),i.complete?e():(i.onload=e,i.onerror=n)})));for(n=this.querySelectorAll("audio, video"),t=0;t<n.length;t++)(e=bC(n[t])).src||e.srcObject||EC("Audio/video asset has neither `src` nor `srcObject` attributes."),a.push(xC(e));this.getChildren().forEach((function(t){t.isAssetItem&&t.hasAttribute("src")&&a.push(new Promise((function(e,n){if(t.hasLoaded)return e();t.addEventListener("loaded",e),t.addEventListener("error",n)})))})),Promise.allSettled(a).then((function(){null!==o.timeout&&o.load()})),s=parseInt(this.getAttribute("timeout"),10)||3e3,this.timeout=setTimeout((function(){o.hasLoaded||(EC("Asset loading timed out in",s,"ms"),o.timeout=null,o.emit("timeout"),o.load())}),s)}disconnectedCallback(){super.disconnectedCallback(),this.timeout&&clearTimeout(this.timeout)}load(){super.load.call(this,null,(function(){return!1}))}}),customElements.define("a-asset-item",class extends Fb{constructor(){super(),this.data=null,this.isAssetItem=!0}connectedCallback(){var t=this,e=this.getAttribute("src");yC.setResponseType(this.getAttribute("response-type")||function(t){var e=function(t){var e=document.createElement("a");e.href=t;var n=e.search.replace(/^\?/,""),i=t.replace(n,"").replace("?","");return i.substring(i.lastIndexOf("/")+1)}(t),n=e.lastIndexOf(".");return n>=0&&".glb"===e.slice(n,t.search(/\?|#|$/))?"arraybuffer":"text"}(e)),yC.load(e,(function(e){t.data=e,Fb.prototype.load.call(t)}),(function(e){t.emit("progress",{loadedBytes:e.loaded,totalBytes:e.total,xhr:e})}),(function(e){t.emit("error",{xhr:e},!1)}))}});var CC=Ly("core:cubemap:warn");class wC extends HTMLElement{constructor(t){return super(t)}onReadyStateChange(){"complete"===document.readyState&&this.doConnectedCallback()}connectedCallback(){"complete"===document.readyState?wC.prototype.doConnectedCallback.call(this):document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){this.srcs=this.validate()}validate(){var t,e=this.querySelectorAll("[src]"),n=[];if(6===e.length){for(t=0;t<e.length;t++)"IMG"===e[t].tagName?n.push(e[t]):n.push(e[t].getAttribute("src"));return n}CC("<a-cubemap> did not contain exactly six elements each with a `src` attribute.")}}customElements.define("a-cubemap",wC),customElements.define("a-mixin",class extends Fb{constructor(){super(),this.componentCache={},this.rawAttributeCache={},this.isMixin=!0}doConnectedCallback(){super.doConnectedCallback(),this.sceneEl=this.closestScene(),this.id=this.getAttribute("id"),this.cacheAttributes(),this.updateEntities(),this.load()}attributeChangedCallback(t,e,n){super.attributeChangedCallback(),this.cacheAttribute(t,n),this.updateEntities()}setAttribute(t,e){window.HTMLElement.prototype.setAttribute.call(this,t,e),this.cacheAttribute(t,e)}cacheAttribute(t,e){var n,i;i=xE(t,"__")[0],n=cb[i],void 0===e&&(e=window.HTMLElement.prototype.getAttribute.call(this,t)),this.rawAttributeCache[t]=e,n&&(this.componentCache[t]=this.parseComponentAttrValue(n,e))}parseComponentAttrValue(t,e){var n;return"string"!=typeof e?e:(t.isSingleProperty?"string"==typeof(n=t.schema.parse(e))&&(n=e):n=VE(e),n)}getAttribute(t){return this.componentCache[t]||window.HTMLElement.prototype.getAttribute.call(this,t)}cacheAttributes(){var t,e,n=this.attributes;for(e=0;e<n.length;e++)t=n[e].name,this.cacheAttribute(t)}updateEntities(){var t,e,n;if(this.sceneEl)for(e=this.sceneEl.querySelectorAll("[mixin~="+this.id+"]"),n=0;n<e.length;n++)(t=e[n]).hasLoaded&&!t.isMixin&&t.mixinUpdate(this.id)}});const _C="1.6.0";var MC=new _y.Color,SC=new _y.Color,IC=CE,BC=wE,TC={},RC="color",LC="rotation",DC="components";function PC(t){t.x=_y.MathUtils.degToRad(t.x),t.y=_y.MathUtils.degToRad(t.y),t.z=_y.MathUtils.degToRad(t.z)}function UC(t,e,n){var i;for(i=0;i<e.length;i++)t.addEventListener(e[i],n)}function OC(t,e,n){var i;for(i=0;i<e.length;i++)t.removeEventListener(e[i],n)}function FC(t,e){var n,i,r;for(i=NC(e),r=t,n=0;n<i.length;n++)r=r[i[n]];if(void 0===r)throw console.log(t),new Error("[animation] property ("+e+") could not be found");return r}function kC(t,e,n,i){var r,s,o,a;for(e.startsWith("object3D.rotation")&&(n=_y.MathUtils.degToRad(n)),s=NC(e),a=t,r=0;r<s.length-1;r++)a=a[s[r]];o=s[s.length-1],i!==RC?a[o]=n:"r"in a[o]?(a[o].r=n.r,a[o].g=n.g,a[o].b=n.b):(a[o].x=n.r,a[o].y=n.g,a[o].z=n.b)}function NC(t){return t in TC||(TC[t]=t.split(".")),TC[t]}function QC(t){return t.isRawProperty||t.property.startsWith(DC)||t.property.startsWith("object3D")}_b("animation",{schema:{autoplay:{default:!0},delay:{default:0},dir:{default:""},dur:{default:1e3},easing:{default:"easeInQuad"},elasticity:{default:400},enabled:{default:!0},from:{default:""},loop:{default:0,parse:function(t){return!0===t||"true"===t||!1!==t&&"false"!==t&&parseInt(t,10)}},property:{default:""},startEvents:{type:"array"},pauseEvents:{type:"array"},resumeEvents:{type:"array"},round:{default:!1},to:{default:""},type:{default:""},isRawProperty:{default:!1}},multiple:!0,init:function(){var t=this;this.eventDetail={name:this.attrName},this.time=0,this.animation=null,this.animationIsPlaying=!1,this.onStartEvent=this.onStartEvent.bind(this),this.beginAnimation=this.beginAnimation.bind(this),this.pauseAnimation=this.pauseAnimation.bind(this),this.resumeAnimation=this.resumeAnimation.bind(this),this.fromColor={},this.toColor={},this.targets={},this.targetsArray=[],this.updateConfigForDefault=this.updateConfigForDefault.bind(this),this.updateConfigForRawColor=this.updateConfigForRawColor.bind(this),this.config={complete:function(){t.animationIsPlaying=!1,t.el.emit("animationcomplete",t.eventDetail,!1),t.id&&t.el.emit("animationcomplete__"+t.id,t.eventDetail,!1)}}},update:function(t){var e=this.config,n=this.data;this.animationIsPlaying=!1,this.data.enabled&&n.property&&(e.autoplay=!1,e.direction=n.dir,e.duration=n.dur,e.easing=n.easing,e.elasticity=n.elasticity,e.loop=n.loop,e.round=n.round,this.createAndStartAnimation())},tick:function(t,e){this.animationIsPlaying&&(this.time+=e,this.animation.tick(this.time))},remove:function(){this.pauseAnimation(),this.removeEventListeners()},pause:function(){this.paused=!0,this.pausedWasPlaying=this.animationIsPlaying,this.pauseAnimation(),this.removeEventListeners()},play:function(){this.paused&&(this.paused=!1,this.addEventListeners(),this.pausedWasPlaying&&(this.resumeAnimation(),this.pausedWasPlaying=!1))},createAndStartAnimation:function(){var t=this.data;this.updateConfig(),this.animationIsPlaying=!1,this.animation=Rt(this.config),this.animation.began=!0,this.removeEventListeners(),this.addEventListeners(),!t.autoplay||t.startEvents&&t.startEvents.length||(t.delay?setTimeout(this.beginAnimation,t.delay):this.beginAnimation())},beginAnimation:function(){this.updateConfig(),this.animation.began=!0,this.time=0,this.animationIsPlaying=!0,this.stopRelatedAnimations(),this.el.emit("animationbegin",this.eventDetail,!1)},pauseAnimation:function(){this.animationIsPlaying=!1},resumeAnimation:function(){this.animationIsPlaying=!0},onStartEvent:function(){this.data.enabled&&(this.updateConfig(),this.animation&&this.animation.pause(),this.animation=Rt(this.config),this.data.delay?setTimeout(this.beginAnimation,this.data.delay):this.beginAnimation())},updateConfigForRawColor:function(){var t,e,n,i=this.config,r=this.data,s=this.el;if(!this.waitComponentInitRawProperty(this.updateConfigForRawColor)){for(e in t=""===r.from?FC(s,r.property):r.from,n=r.to,this.setColorConfig(t,n),t=this.fromColor,n=this.toColor,this.targetsArray.length=0,this.targetsArray.push(t),i.targets=this.targetsArray,n)i[e]=n[e];var o;i.update=(o={},function(t){var e;(e=t.animatables[0].target).r===o.r&&e.g===o.g&&e.b===o.b||kC(s,r.property,e,r.type)})}},updateConfigForDefault:function(){var t,e,n,i,r=this.config,s=this.data,o=this.el;this.waitComponentInitRawProperty(this.updateConfigForDefault)||(t=""===s.from?QC(s)?FC(o,s.property):IC(o,s.property):s.from,n=s.to,isNaN(t||n)?(t=t?t.toString():t,n=n?n.toString():n):(t=parseFloat(t),n=parseFloat(n)),(e="true"===s.to||"false"===s.to||!0===s.to||!1===s.to)&&(t="true"===s.from||!0===s.from?1:0,n="true"===s.to||!0===s.to?1:0),this.targets.aframeProperty=t,r.targets=this.targets,r.aframeProperty=n,r.update=function(t){var n;(n=t.animatables[0].target.aframeProperty)!==i&&(i=n,e&&(n=n>=1),QC(s)?kC(o,s.property,n,s.type):BC(o,s.property,n))})},updateConfigForVector:function(){var t,e,n,i,r=this.config,s=this.data,o=this.el,a=NC(s.property),l="object3D"===a[0]?a[1]:a[0];for(t in e=""!==s.from?AE(s.from):IC(o,l),n=AE(s.to),l===LC&&(PC(e),PC(n)),this.targetsArray.length=0,this.targetsArray.push(e),r.targets=this.targetsArray,n)r[t]=n[t];r.update="position"!==l&&l!==LC&&"scale"!==l?function(){var t={};return function(e){var n=e.animatables[0].target;n.x===t.x&&n.y===t.y&&n.z===t.z||(t.x=n.x,t.y=n.y,t.z=n.z,BC(o,s.property,n))}}():(i={},function(t){var e=t.animatables[0].target;e.x===i.x&&e.y===i.y&&e.z===i.z||(i.x=e.x,i.y=e.y,i.z=e.z,o.object3D[l].set(e.x,e.y,e.z))})},updateConfig:function(){var t;t=function(t,e){var n,i,r,s;return"object3D"!==(r=e.split("."))[0]||r[2]||"position"!==r[1]&&"rotation"!==r[1]&&"scale"!==r[1]?(i=r[0],s=r[1],(n=t.components[i]||cb[i])?s&&!n.schema[s]?null:s?n.schema[s].type:n.schema.type:null):"vec3"}(this.el,this.data.property),QC(this.data)&&this.data.type===RC?this.updateConfigForRawColor():"vec2"===t||"vec3"===t||"vec4"===t?this.updateConfigForVector():this.updateConfigForDefault()},waitComponentInitRawProperty:function(t){var e,n=this.data,i=this.el,r=this;return""===n.from&&!!n.property.startsWith(DC)&&(e=NC(n.property)[1],!i.components[e]&&(i.addEventListener("componentinitialized",(function n(s){s.detail.name===e&&(t(),r.animation=Rt(r.config),i.removeEventListener("componentinitialized",n))})),!0))},stopRelatedAnimations:function(){var t,e;for(e in this.el.components)t=this.el.components[e],e!==this.attrName&&"animation"===t.name&&t.animationIsPlaying&&t.data.property===this.data.property&&(t.animationIsPlaying=!1)},addEventListeners:function(){var t=this.data,e=this.el;UC(e,t.startEvents,this.onStartEvent),UC(e,t.pauseEvents,this.pauseAnimation),UC(e,t.resumeEvents,this.resumeAnimation)},removeEventListeners:function(){var t=this.data,e=this.el;OC(e,t.startEvents,this.onStartEvent),OC(e,t.pauseEvents,this.pauseAnimation),OC(e,t.resumeEvents,this.resumeAnimation)},setColorConfig:function(t,e){MC.set(t),SC.set(e),t=this.fromColor,e=this.toColor,t.r=MC.r,t.g=MC.g,t.b=MC.b,e.r=SC.r,e.g=SC.g,e.b=SC.b}});var GC=Ly("components:anchored:warn");_b("anchored",{schema:{persistent:{default:!1}},init:function(){var t=this.el.sceneEl.getAttribute("webxr"),e=t.optionalFeatures;-1===e.indexOf("anchors")&&(e.push("anchors"),this.el.sceneEl.setAttribute("webxr",t)),this.auxQuaternion=new THREE.Quaternion,this.onEnterVR=this.onEnterVR.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR)},onEnterVR:function(){this.anchor=void 0,this.requestPersistentAnchorPending=this.data.persistent,this.requestAnchorPending=!this.data.persistent},tick:function(){var t,e,n,i=this.el.sceneEl,r=i.renderer.xr,s=this.el.object3D;(i.is("ar-mode")||i.is("vr-mode"))&&(!this.anchor&&this.requestPersistentAnchorPending&&this.restorePersistentAnchor(),!this.anchor&&this.requestAnchorPending&&this.createAnchor(),this.anchor&&(t=i.frame,e=r.getReferenceSpace(),n=t.getPose(this.anchor.anchorSpace,e),s.position.copy(n.transform.position),s.quaternion.copy(n.transform.orientation)))},createAnchor:async function(t,e){var n,i,r,s,o=this.el.sceneEl,a=o.renderer.xr,l=this.el.object3D;t=t||l.position,e=e||this.auxQuaternion.setFromEuler(l.rotation),function(t){var e=t.renderer.xr.getSession();return e&&e.restorePersistentAnchor}(o)?(this.anchor&&this.deleteAnchor(),n=o.frame,i=a.getReferenceSpace(),r=new XRRigidTransform({x:t.x,y:t.y,z:t.z},{x:e.x,y:e.y,z:e.z,w:e.w}),this.requestAnchorPending=!1,s=await n.createAnchor(r,i),this.data.persistent&&(this.el.id?(this.persistentHandle=await s.requestPersistentHandle(),localStorage.setItem(this.el.id,this.persistentHandle)):GC("The anchor won't be persisted because the entity has no assigned id.")),o.object3D.attach(this.el.object3D),this.anchor=s):GC("This browser doesn't support the WebXR anchors module")},restorePersistentAnchor:async function(){var t,e=this.el.sceneEl.renderer.xr.getSession(),n=e.persistentAnchors;if(this.requestPersistentAnchorPending=!1,!this.el.id)return GC("The entity associated to the persistent anchor cannot be retrieved because it doesn't have an assigned id."),void(this.requestAnchorPending=!0);if(n){t=localStorage.getItem(this.el.id);for(var i=0;i<n.length;++i)if(t===n[i]){this.anchor=await e.restorePersistentAnchor(n[i]),this.anchor&&(this.persistentHandle=n[i]);break}this.anchor||(this.requestAnchorPending=!0)}else this.requestPersistentAnchorPending=!0},deleteAnchor:function(){var t,e=this.anchor;e&&(t=this.el.sceneEl.renderer.xr.getSession(),e.delete(),this.el.sceneEl.object3D.add(this.el.object3D),this.persistentHandle&&t.deletePersistentAnchor(this.persistentHandle),this.anchor=void 0)}}),_b("camera",{schema:{active:{default:!0},far:{default:1e4},fov:{default:80,min:0},near:{default:.005,min:0},spectator:{default:!1},zoom:{default:1,min:0}},init:function(){var t,e=this.el;t=this.camera=new _y.PerspectiveCamera,e.setObject3D("camera",t)},update:function(t){var e=this.data,n=this.camera;n.aspect=e.aspect||window.innerWidth/window.innerHeight,n.far=e.far,n.fov=e.fov,n.near=e.near,n.zoom=e.zoom,n.updateProjectionMatrix(),this.updateActiveCamera(t),this.updateSpectatorCamera(t)},updateActiveCamera:function(t){var e=this.data,n=this.el,i=this.system;t&&t.active===e.active||e.spectator||(e.active&&i.activeCameraEl!==n?i.setActiveCamera(n):e.active||i.activeCameraEl!==n||i.disableActiveCamera())},updateSpectatorCamera:function(t){var e=this.data,n=this.el,i=this.system;t&&t.spectator===e.spectator||(e.spectator&&i.spectatorCameraEl!==n?i.setSpectatorCamera(n):e.spectator||i.spectatorCameraEl!==n||i.disableSpectatorCamera())},remove:function(){this.el.removeObject3D("camera")}});var zC,HC,VC,jC,WC="click",qC="mouseup",XC="cursor-fusing",YC="cursor-hovering",JC="cursor-hovered",KC={DOWN:["mousedown","touchstart"],UP:["mouseup","touchend"]},ZC={DOWN:["selectstart"],UP:["selectend"]},$C="a-mouse-cursor-hover",tw=(_b("cursor",{dependencies:["raycaster"],schema:{downEvents:{default:[]},fuse:{default:Wy()},fuseTimeout:{default:1500,min:0},mouseCursorStylesEnabled:{default:!0},upEvents:{default:[]},rayOrigin:{default:"entity",oneOf:["mouse","entity","xrselect"]}},after:["tracked-controls"],multiple:!0,init:function(){var t=this;this.fuseTimeout=void 0,this.cursorDownEl=null,this.intersectedEl=null,this.canvasBounds=document.body.getBoundingClientRect(),this.isCursorDown=!1,this.activeXRInput=null,this.updateCanvasBounds=ux((function(){t.canvasBounds=t.el.sceneEl.canvas.getBoundingClientRect()}),500),this.eventDetail={},this.intersectedEventDetail={cursorEl:this.el},this.onCursorDown=this.onCursorDown.bind(this),this.onCursorUp=this.onCursorUp.bind(this),this.onIntersection=this.onIntersection.bind(this),this.onIntersectionCleared=this.onIntersectionCleared.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onEnterVR=this.onEnterVR.bind(this)},update:function(t){var e=this.data.rayOrigin;e!==t.rayOrigin&&("entity"===e&&this.resetRaycaster(),this.updateMouseEventListeners(),"xrselect"!==e&&"entity"!==e||this.addWebXREventListeners(),"xrselect"!==t.rayOrigin&&"entity"!==t.rayOrigin||this.removeWebXREventListeners())},tick:function(){var t=this.el.sceneEl.frame,e=this.activeXRInput;"xrselect"===this.data.rayOrigin&&t&&e&&this.onMouseMove({frame:t,inputSource:e,type:"fakeselectevent"})},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){var t=this.el;t.removeState(YC),t.removeState(XC),clearTimeout(this.fuseTimeout),this.intersectedEl&&this.intersectedEl.removeState(JC),this.removeEventListeners()},addEventListeners:function(){var t,e=this.data,n=this.el,i=this;function r(){t=n.sceneEl.canvas,e.downEvents.length||e.upEvents.length||(KC.DOWN.forEach((function(e){t.addEventListener(e,i.onCursorDown,{passive:!1})})),KC.UP.forEach((function(e){t.addEventListener(e,i.onCursorUp,{passive:!1})})))}(t=n.sceneEl.canvas)?r():n.sceneEl.addEventListener("render-target-loaded",r),e.downEvents.forEach((function(t){n.addEventListener(t,i.onCursorDown)})),e.upEvents.forEach((function(t){n.addEventListener(t,i.onCursorUp)})),n.addEventListener("raycaster-intersection",this.onIntersection),n.addEventListener("raycaster-closest-entity-changed",this.onIntersection),n.addEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),n.sceneEl.addEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.addEventListener("enter-vr",this.onEnterVR),window.addEventListener("resize",this.updateCanvasBounds),window.addEventListener("scroll",this.updateCanvasBounds),this.updateMouseEventListeners()},removeEventListeners:function(){var t,e=this.data,n=this.el,i=this;!(t=n.sceneEl.canvas)||e.downEvents.length||e.upEvents.length||(KC.DOWN.forEach((function(e){t.removeEventListener(e,i.onCursorDown)})),KC.UP.forEach((function(e){t.removeEventListener(e,i.onCursorUp)}))),e.downEvents.forEach((function(t){n.removeEventListener(t,i.onCursorDown)})),e.upEvents.forEach((function(t){n.removeEventListener(t,i.onCursorUp)})),n.removeEventListener("raycaster-intersection",this.onIntersection),n.removeEventListener("raycaster-closest-entity-changed",this.onIntersection),n.removeEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),t.removeEventListener("mousemove",this.onMouseMove),t.removeEventListener("touchstart",this.onMouseMove),t.removeEventListener("touchmove",this.onMouseMove),n.sceneEl.removeEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.removeEventListener("enter-vr",this.onEnterVR),window.removeEventListener("resize",this.updateCanvasBounds),window.removeEventListener("scroll",this.updateCanvasBounds),this.removeWebXREventListeners()},updateMouseEventListeners:function(){var t,e=this.el;(t=e.sceneEl.canvas).removeEventListener("mousemove",this.onMouseMove),t.removeEventListener("touchmove",this.onMouseMove),e.setAttribute("raycaster","useWorldCoordinates",!1),"mouse"===this.data.rayOrigin&&(t.addEventListener("mousemove",this.onMouseMove),t.addEventListener("touchmove",this.onMouseMove,{passive:!1}),e.setAttribute("raycaster","useWorldCoordinates",!0),this.updateCanvasBounds())},resetRaycaster:function(){this.el.setAttribute("raycaster",{direction:(new THREE.Vector3).set(0,0,-1),origin:new THREE.Vector3})},addWebXREventListeners:function(){var t=this,e=this.el.sceneEl.xrSession;e&&(ZC.DOWN.forEach((function(n){e.addEventListener(n,t.onCursorDown)})),ZC.UP.forEach((function(n){e.addEventListener(n,t.onCursorUp)})))},removeWebXREventListeners:function(){var t=this,e=this.el.sceneEl.xrSession;e&&(ZC.DOWN.forEach((function(n){e.removeEventListener(n,t.onCursorDown)})),ZC.UP.forEach((function(n){e.removeEventListener(n,t.onCursorUp)})))},onMouseMove:(zC=new THREE.Vector3,HC=new THREE.Vector2,VC=new THREE.Vector3,jC={origin:VC,direction:zC},function(t){var e,n,i,r,s,o,a,l,c,h=this.canvasBounds,u=this.el.sceneEl.camera;u.parent.updateMatrixWorld(),n=(i="touchmove"===t.type||"touchstart"===t.type?t.touches.item(0):t).clientX-h.left,r=i.clientY-h.top,HC.x=n/h.width*2-1,HC.y=-r/h.height*2+1,"xrselect"!==this.data.rayOrigin||"selectstart"!==t.type&&"fakeselectevent"!==t.type?"fakeselectout"===t.type?(zC.set(0,1,0),VC.set(0,9999,0)):u&&u.isPerspectiveCamera?(VC.setFromMatrixPosition(u.matrixWorld),zC.set(HC.x,HC.y,.5).unproject(u).sub(VC).normalize()):u&&u.isOrthographicCamera?(VC.set(HC.x,HC.y,(u.near+u.far)/(u.near-u.far)).unproject(u),zC.set(0,0,-1).transformDirection(u.matrixWorld)):console.error("AFRAME.Raycaster: Unsupported camera type: "+u.type):(s=t.frame,o=t.inputSource,a=this.el.sceneEl.renderer.xr.getReferenceSpace(),(l=s.getPose(o.targetRaySpace,a))&&(c=l.transform,zC.set(0,0,-1),zC.applyQuaternion(c.orientation),VC.copy(c.position),(e=u.el.object3D.parent).localToWorld(VC),zC.transformDirection(e.matrixWorld))),this.el.setAttribute("raycaster",jC),"touchmove"===t.type&&t.preventDefault()}),onCursorDown:function(t){this.isCursorDown=!0,"mouse"===this.data.rayOrigin&&"touchstart"===t.type&&(this.onMouseMove(t),this.el.components.raycaster.checkIntersections(),t.preventDefault()),"xrselect"===this.data.rayOrigin&&"selectstart"===t.type&&(this.activeXRInput=t.inputSource,this.onMouseMove(t),this.el.components.raycaster.checkIntersections(),this.el.components.raycaster.intersectedEls.length&&void 0!==this.el.sceneEl.components["ar-hit-test"]&&this.el.sceneEl.getAttribute("ar-hit-test").enabled&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!1),this.reenableARHitTest=!0)),this.twoWayEmit("mousedown",t),this.cursorDownEl=this.intersectedEl},onCursorUp:function(t){if(this.isCursorDown&&("xrselect"!==this.data.rayOrigin||this.activeXRInput===t.inputSource)){this.isCursorDown=!1;var e=this.data;this.twoWayEmit(qC,t),!0===this.reenableARHitTest&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!0),this.reenableARHitTest=void 0),this.cursorDownEl&&this.cursorDownEl!==this.intersectedEl&&(this.intersectedEventDetail.intersection=null,this.cursorDownEl.emit(qC,this.intersectedEventDetail)),e.fuse&&"mouse"!==e.rayOrigin&&"xrselect"!==e.rayOrigin||!this.intersectedEl||this.cursorDownEl!==this.intersectedEl||this.twoWayEmit(WC,t),"xrselect"===e.rayOrigin&&this.onMouseMove({type:"fakeselectout"}),this.activeXRInput=null,this.cursorDownEl=null,"touchend"===t.type&&t.preventDefault()}},onIntersection:function(t){var e,n,i,r,s=this.el;n=t.detail.els[0]===s?1:0,r=t.detail.intersections[n],(i=t.detail.els[n])&&this.intersectedEl!==i&&(this.intersectedEl&&(e=this.el.components.raycaster.getIntersection(this.intersectedEl))&&e.distance<=r.distance||(this.clearCurrentIntersection(!0),this.setIntersection(i,r)))},onIntersectionCleared:function(t){-1!==t.detail.clearedEls.indexOf(this.intersectedEl)&&this.clearCurrentIntersection()},onEnterVR:function(){var t=this.data.rayOrigin;this.clearCurrentIntersection(!0),"xrselect"!==t&&"entity"!==t||this.addWebXREventListeners()},setIntersection:function(t,e){var n=this.el,i=this.data,r=this;this.intersectedEl!==t&&(this.intersectedEl=t,n.addState(YC),t.addState(JC),this.twoWayEmit("mouseenter"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.add($C),0!==i.fuseTimeout&&i.fuse&&"xrselect"!==i.rayOrigin&&"mouse"!==i.rayOrigin&&(n.addState(XC),this.twoWayEmit("fusing"),this.fuseTimeout=setTimeout((function(){n.removeState(XC),r.twoWayEmit(WC)}),i.fuseTimeout)))},clearCurrentIntersection:function(t){var e,n,i=this.el;this.intersectedEl&&(this.intersectedEl.removeState(JC),i.removeState(YC),i.removeState(XC),this.twoWayEmit("mouseleave"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.remove($C),this.intersectedEl=null,clearTimeout(this.fuseTimeout),!0!==t&&0!==(n=this.el.components.raycaster.intersections).length&&(e=n[n[0].object.el===i?1:0])&&this.setIntersection(e.object.el,e))},twoWayEmit:function(t,e){var n,i=this.el,r=this.intersectedEl;function s(t,n){e instanceof MouseEvent?t.mouseEvent=e:"undefined"!=typeof TouchEvent&&e instanceof TouchEvent&&(t.touchEvent=e)}n=this.el.components.raycaster.getIntersection(r),this.eventDetail.intersectedEl=r,this.eventDetail.intersection=n,s(this.eventDetail),i.emit(t,this.eventDetail),r&&(this.intersectedEventDetail.intersection=n,s(this.intersectedEventDetail),r.emit(t,this.intersectedEventDetail))}}),new _y.BufferGeometry),ew=(_b("geometry",{schema:{buffer:{default:!0},primitive:{default:"box",oneOf:iC,schemaChange:!0},skipCache:{default:!1}},init:function(){this.geometry=null},update:function(t){var e,n=this.data,i=this.el,r=this.system;this.geometry&&(r.unuseGeometry(t),this.geometry=null),this.geometry=r.getOrCreateGeometry(n),(e=i.getObject3D("mesh"))?e.geometry=this.geometry:((e=new _y.Mesh).geometry=this.geometry,this.el.getAttribute("material")||(e.material=new _y.MeshStandardMaterial({color:16777215*Math.random(),metalness:0,roughness:.5})),i.setObject3D("mesh",e))},remove:function(){this.system.unuseGeometry(this.data),this.el.getObject3D("mesh").geometry=tw,this.geometry=null},updateSchema:function(t){var e=this.oldData&&this.oldData.primitive,n=t.primitive,i=nC[n]&&nC[n].schema;if(!i)throw new Error("Unknown geometry schema `"+n+"`");e&&e===n||this.extendSchema(i)}}),"generic"),nw=(_b("generic-tracked-controller-controls",{schema:{hand:{default:""},defaultModel:{default:!0},defaultModelColor:{default:"gray"},disabled:{default:!1}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick"]},bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.wasControllerConnected=!1,this.bindMethods(),this.el.addEventListener("controllerconnected",(function(e){e.detail.name!==t.name&&(t.wasControllerConnected=!0,t.removeEventListeners(),t.removeControllersUpdateListener())}))},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data,e=t.hand?t.hand:void 0;ZE(this,ew,{hand:e,iterateControllerProfiles:!0})},play:function(){this.wasControllerConnected||(this.checkIfControllerPresent(),this.addControllersUpdateListener())},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;this.el.components["tracked-controls"]?this.removeEventListeners():(t.setAttribute("tracked-controls",{hand:e.hand,idPrefix:ew,iterateControllerProfiles:!0}),this.data.defaultModel&&this.initDefaultModel())},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.wasControllerConnected&&this.checkIfControllerPresent()},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},initDefaultModel:function(){var t=this.modelEl=document.createElement("a-entity");t.setAttribute("geometry",{primitive:"sphere",radius:.03}),t.setAttribute("material",{color:this.data.color}),this.el.appendChild(t),this.el.emit("controllermodelready",{name:"generic-tracked-controller-controls",model:this.modelEl,rayOrigin:{origin:{x:0,y:0,z:-.01},direction:{x:0,y:0,z:-1}}})}}),Ly("components:gltf-model:warn"));_b("gltf-model",{schema:{type:"model"},init:function(){var t=this,e=this.system.getDRACOLoader(),n=this.system.getMeshoptDecoder(),i=this.system.getKTX2Loader();this.model=null,this.loader=new _y.GLTFLoader,e&&this.loader.setDRACOLoader(e),this.ready=n?n.then((function(e){t.loader.setMeshoptDecoder(e)})):Promise.resolve(),i&&this.loader.setKTX2Loader(i)},update:function(){var t=this,e=this.el,n=this.data;n&&(this.remove(),this.ready.then((function(){t.loader.load(n,(function(n){t.model=n.scene||n.scenes[0],t.model.animations=n.animations,e.setObject3D("mesh",t.model),e.emit("model-loaded",{format:"gltf",model:t.model})}),void 0,(function(t){var i=t&&t.message?t.message:"Failed to load glTF model";nw(i),e.emit("model-error",{format:"gltf",src:n})}))})))},remove:function(){this.model&&this.el.removeObject3D("mesh")}}),_b("grabbable",{init:function(){this.el.setAttribute("obb-collider","centerModel: true")}});var iw,rw=My+"controllers/oculus-hands/v4/left.glb",sw=My+"controllers/oculus-hands/v4/right.glb",ow=["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"];_b("hand-tracking-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},modelStyle:{default:"mesh",oneOf:["dots","mesh"]},modelColor:{default:"white"},modelOpacity:{default:1}},after:["tracked-controls"],bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this)},addEventListeners:function(){this.el.addEventListener("model-loaded",this.onModelLoaded);for(var t=0;t<this.jointEls.length;++t)this.jointEls[t].object3D.visible=!0},removeEventListeners:function(){this.el.removeEventListener("model-loaded",this.onModelLoaded);for(var t=0;t<this.jointEls.length;++t)this.jointEls[t].object3D.visible=!1},init:function(){var t=this.el.sceneEl,e=t.getAttribute("webxr"),n=e.optionalFeatures;-1===n.indexOf("hand-tracking")&&(n.push("hand-tracking"),t.setAttribute("webxr",e)),this.wristObject3D=new THREE.Object3D,this.el.sceneEl.object3D.add(this.wristObject3D),this.onModelLoaded=this.onModelLoaded.bind(this),this.onChildAttached=this.onChildAttached.bind(this),this.jointEls=[],this.controllerPresent=!1,this.isPinched=!1,this.pinchEventDetail={position:new THREE.Vector3,wristRotation:new THREE.Quaternion},this.indexTipPosition=new THREE.Vector3,this.hasPoses=!1,this.jointPoses=new Float32Array(16*ow.length),this.jointRadii=new Float32Array(ow.length),this.bindMethods(),this.updateReferenceSpace=this.updateReferenceSpace.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.updateReferenceSpace),this.el.sceneEl.addEventListener("exit-vr",this.updateReferenceSpace),this.el.addEventListener("child-attached",this.onChildAttached),this.wristObject3D.visible=!1},onChildAttached:function(t){this.addChildEntity(t.detail.el)},update:function(){this.updateModelMaterial()},updateModelMaterial:function(){var t=this.jointEls,e=this.skinnedMesh,n=!(1===this.data.modelOpacity);e&&(this.skinnedMesh.material.color.set(this.data.modelColor),this.skinnedMesh.material.transparent=n,this.skinnedMesh.material.opacity=this.data.modelOpacity);for(var i=0;i<t.length;i++)t[i].setAttribute("material",{color:this.data.modelColor,transparent:n,opacity:this.data.modelOpacity})},updateReferenceSpace:function(){var t=this,e=this.el.sceneEl.xrSession;if(this.referenceSpace=void 0,e){var n=t.el.sceneEl.systems.webxr.sessionReferenceSpaceType;e.requestReferenceSpace(n).then((function(e){t.referenceSpace=e})).catch((function(e){throw t.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(n,"tracked-controls-webxr uses reference space "+n),e}))}},checkIfControllerPresent:function(){var t=this.data;ZE(this,"",{hand:t.hand?t.hand:void 0,iterateControllerProfiles:!0,handTracking:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},tick:function(){var t=this.el.sceneEl,e=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller,n=t.frame,i=this.el.components["tracked-controls"],r=this.referenceSpace;e&&n&&r&&i&&(this.hasPoses=!1,e.hand&&(this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),this.hasPoses=n.fillPoses(e.hand.values(),r,this.jointPoses)&&n.fillJointRadii(e.hand.values(),this.jointRadii),this.updateHandModel(),this.detectGesture(),this.updateWristObject()))},updateWristObject:(iw=new THREE.Matrix4,function(){var t=this.wristObject3D;t&&this.hasPoses&&(iw.fromArray(this.jointPoses,0),t.position.setFromMatrixPosition(iw),t.quaternion.setFromRotationMatrix(iw))}),updateHandModel:function(){this.wristObject3D.visible=!0,this.el.object3D.visible=!0,"dots"===this.data.modelStyle&&this.updateHandDotsModel(),"mesh"===this.data.modelStyle&&this.updateHandMeshModel()},getBone:function(t){for(var e=this.bones,n=0;n<e.length;n++)if(e[n].name===t)return e[n];return null},updateHandMeshModel:function(){var t=new THREE.Matrix4;return function(){var e=0,n=this.jointPoses,i=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller;if(i&&this.mesh&&(this.mesh.visible=!1,this.hasPoses))for(var r of i.hand.values()){var s=this.getBone(r.jointName);null!=s&&(this.mesh.visible=!0,t.fromArray(n,16*e),s.position.setFromMatrixPosition(t),s.quaternion.setFromRotationMatrix(t)),e++}}}(),updateHandDotsModel:function(){for(var t,e,n=this.jointPoses,i=this.jointRadii,r=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller,s=0;s<r.hand.size;s++)e=(t=this.jointEls[s]).object3D,t.object3D.visible=this.hasPoses,this.hasPoses&&(e.matrix.fromArray(n,16*s),e.matrix.decompose(e.position,e.rotation,e.scale),t.setAttribute("scale",{x:i[s],y:i[s],z:i[s]}))},detectGesture:function(){this.detectPinch()},detectPinch:function(){var t=new THREE.Vector3,e=new THREE.Matrix4;return function(){var n=this.indexTipPosition,i=this.pinchEventDetail;if(this.hasPoses){t.setFromMatrixPosition(e.fromArray(this.jointPoses,64)),n.setFromMatrixPosition(e.fromArray(this.jointPoses,144)),i.wristRotation.setFromRotationMatrix(e.fromArray(this.jointPoses,0));var r=n.distanceTo(t);r<.015&&!1===this.isPinched&&(this.isPinched=!0,i.position.copy(n).add(t).multiplyScalar(.5),this.el.emit("pinchstarted",i)),r>.02&&!0===this.isPinched&&(this.isPinched=!1,i.position.copy(n).add(t).multiplyScalar(.5),this.el.emit("pinchended",i)),this.isPinched&&(i.position.copy(n).add(t).multiplyScalar(.5),this.el.emit("pinchmoved",i))}}}(),pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{id:"",hand:e.hand,iterateControllerProfiles:!0,handTrackingEnabled:!0}),this.mesh?this.mesh!==t.getObject3D("mesh")&&t.setObject3D("mesh",this.mesh):this.initDefaultModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){var t,e=this.el;this.checkIfControllerPresent(),t=e.components["tracked-controls"]&&e.components["tracked-controls"].controller,this.mesh&&t&&t.hand&&t.hand instanceof XRHand&&e.setObject3D("mesh",this.mesh)},initDefaultModel:function(){var t=this.data;"dots"===t.modelStyle&&this.initDotsModel(),"mesh"===t.modelStyle&&this.initMeshHandModel(),this.el.object3D.visible=!0,this.wristObject3D.visible=!0},initDotsModel:function(){if(0===this.jointEls.length){for(var t=0;t<ow.length;++t){var e=this.jointEl=document.createElement("a-entity");e.setAttribute("geometry",{primitive:"sphere",radius:1}),e.object3D.visible=!1,this.el.appendChild(e),this.jointEls.push(e)}this.updateModelMaterial()}},initMeshHandModel:function(){var t="left"===this.data.hand?rw:sw;this.el.setAttribute("gltf-model",t)},onModelLoaded:function(){var t=this.mesh=this.el.getObject3D("mesh").children[0],e=this.skinnedMesh=t.getObjectByProperty("type","SkinnedMesh");this.skinnedMesh&&(this.bones=e.skeleton.bones,this.el.removeObject3D("mesh"),t.position.set(0,0,0),t.rotation.set(0,0,0),e.frustumCulled=!1,e.material=new THREE.MeshStandardMaterial,this.updateModelMaterial(),this.setupChildrenEntities(),this.el.setObject3D("mesh",t))},setupChildrenEntities:function(){for(var t=this.el.children,e=0;e<t.length;++e)t[e]instanceof Hb&&this.addChildEntity(t[e])},addChildEntity:function(t){t instanceof Hb&&this.wristObject3D.add(t.object3D)}}),_b("hand-tracking-grab-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},color:{type:"color",default:"white"},hoverColor:{type:"color",default:"#538df1"},hoverEnabled:{default:!1}},init:function(){var t,e=this.el,n=this.data;t="right"===n.hand?"components.hand-tracking-controls.bones.3":"components.hand-tracking-controls.bones.21",e.setAttribute("hand-tracking-controls",{hand:n.hand}),e.setAttribute("obb-collider",{trackedObject3D:t,size:.04}),this.auxMatrix=new _y.Matrix4,this.onCollisionStarted=this.onCollisionStarted.bind(this),this.el.addEventListener("obbcollisionstarted",this.onCollisionStarted),this.onCollisionEnded=this.onCollisionEnded.bind(this),this.el.addEventListener("obbcollisionended",this.onCollisionEnded),this.onPinchStarted=this.onPinchStarted.bind(this),this.el.addEventListener("pinchstarted",this.onPinchStarted),this.onPinchEnded=this.onPinchEnded.bind(this),this.el.addEventListener("pinchended",this.onPinchEnded)},transferEntityOwnership:function(){for(var t,e=this.el.sceneEl.querySelectorAll("[hand-tracking-grab-controls]"),n=0;n<e.length;++n)(t=e[n].components["hand-tracking-grab-controls"])!==this&&this.grabbedEl&&this.grabbedEl===t.grabbedEl&&t.releaseGrabbedEntity();return!1},onCollisionStarted:function(t){var e=t.detail.withEl;this.collidedEl||e.getAttribute("grabbable")&&(this.collidedEl=e,this.grabbingObject3D=t.detail.trackedObject3D,this.data.hoverEnabled&&this.el.setAttribute("hand-tracking-controls","modelColor",this.data.hoverColor))},onCollisionEnded:function(){this.collidedEl=void 0,this.grabbedEl||(this.grabbingObject3D=void 0,this.data.hoverEnabled&&this.el.setAttribute("hand-tracking-controls","modelColor",this.data.color))},onPinchStarted:function(t){this.collidedEl&&(this.grabbedEl=this.collidedEl,this.transferEntityOwnership(),this.grab())},onPinchEnded:function(){this.releaseGrabbedEntity()},releaseGrabbedEntity:function(){var t=this.grabbedEl;if(t){var e=t.object3D,n=e.parent,i=this.originalParent;e.applyMatrix4(n.matrixWorld),e.applyMatrix4(this.auxMatrix.copy(i.matrixWorld).invert()),n.remove(e),i.add(e),this.el.emit("grabended",{grabbedEl:t}),this.grabbedEl=void 0,this.originalParent=void 0}},grab:function(){var t=this.grabbedEl,e=t.object3D,n=e.parent;this.originalParent=n;var i=this.el.components["hand-tracking-controls"].wristObject3D;e.applyMatrix4(n.matrixWorld),e.applyMatrix4(this.auxMatrix.copy(i.matrixWorld).invert()),n.remove(e),i.add(e),this.el.emit("grabstarted",{grabbedEl:t})}});var aw={toonLeft:My+"controllers/hands/leftHand.glb",toonRight:My+"controllers/hands/rightHand.glb",lowPolyLeft:My+"controllers/hands/leftHandLow.glb",lowPolyRight:My+"controllers/hands/rightHandLow.glb",highPolyLeft:My+"controllers/hands/leftHandHigh.glb",highPolyRight:My+"controllers/hands/rightHandHigh.glb"},lw="Point",cw="Fist",hw="Thumb Up",uw={};function dw(t,e){var n;if(t)return"grip"===(n=uw[t])?n+(e?"close":"open"):"point"===n?n+(e?"up":"down"):"pointing"===n||"pistol"===n?n+(e?"start":"end"):void 0}uw[cw]="grip",uw[hw]="pistol",uw[lw]="pointing",_b("hand-controls",{schema:{color:{default:"white",type:"color"},hand:{default:"left"},handModelStyle:{default:"lowPoly",oneOf:["lowPoly","highPoly","toon"]}},after:["tracked-controls"],init:function(){var t=this,e=this.el;this.pressedButtons={},this.touchedButtons={},this.loader=new THREE.GLTFLoader,this.loader.setCrossOrigin("anonymous"),this.onGripDown=function(){t.handleButton("grip","down")},this.onGripUp=function(){t.handleButton("grip","up")},this.onTrackpadDown=function(){t.handleButton("trackpad","down")},this.onTrackpadUp=function(){t.handleButton("trackpad","up")},this.onTrackpadTouchStart=function(){t.handleButton("trackpad","touchstart")},this.onTrackpadTouchEnd=function(){t.handleButton("trackpad","touchend")},this.onTriggerDown=function(){t.handleButton("trigger","down")},this.onTriggerUp=function(){t.handleButton("trigger","up")},this.onTriggerTouchStart=function(){t.handleButton("trigger","touchstart")},this.onTriggerTouchEnd=function(){t.handleButton("trigger","touchend")},this.onGripTouchStart=function(){t.handleButton("grip","touchstart")},this.onGripTouchEnd=function(){t.handleButton("grip","touchend")},this.onThumbstickDown=function(){t.handleButton("thumbstick","down")},this.onThumbstickUp=function(){t.handleButton("thumbstick","up")},this.onAorXTouchStart=function(){t.handleButton("AorX","touchstart")},this.onAorXTouchEnd=function(){t.handleButton("AorX","touchend")},this.onBorYTouchStart=function(){t.handleButton("BorY","touchstart")},this.onBorYTouchEnd=function(){t.handleButton("BorY","touchend")},this.onSurfaceTouchStart=function(){t.handleButton("surface","touchstart")},this.onSurfaceTouchEnd=function(){t.handleButton("surface","touchend")},this.onControllerConnected=this.onControllerConnected.bind(this),this.onControllerDisconnected=this.onControllerDisconnected.bind(this),e.addEventListener("controllerconnected",this.onControllerConnected),e.addEventListener("controllerdisconnected",this.onControllerDisconnected),e.object3D.visible=!1},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},tick:function(t,e){var n=this.el.getObject3D("mesh");n&&n.mixer&&n.mixer.update(e/1e3)},onControllerConnected:function(t){var e=this.el,n=this.data.hand,i=this.el.getObject3D("mesh");e.object3D.visible=!0;var r="left"===n?Math.PI/2:-Math.PI/2,s=e.sceneEl.hasWebXR?-Math.PI/2:0;"pico-controls"===t.detail.name&&(s+=Math.PI/4),i.position.set(0,0,0),i.rotation.set(s,0,r)},onControllerDisconnected:function(){this.el.object3D.visible=!1},addEventListeners:function(){var t=this.el;t.addEventListener("gripdown",this.onGripDown),t.addEventListener("gripup",this.onGripUp),t.addEventListener("trackpaddown",this.onTrackpadDown),t.addEventListener("trackpadup",this.onTrackpadUp),t.addEventListener("trackpadtouchstart",this.onTrackpadTouchStart),t.addEventListener("trackpadtouchend",this.onTrackpadTouchEnd),t.addEventListener("triggerdown",this.onTriggerDown),t.addEventListener("triggerup",this.onTriggerUp),t.addEventListener("triggertouchstart",this.onTriggerTouchStart),t.addEventListener("triggertouchend",this.onTriggerTouchEnd),t.addEventListener("griptouchstart",this.onGripTouchStart),t.addEventListener("griptouchend",this.onGripTouchEnd),t.addEventListener("thumbstickdown",this.onThumbstickDown),t.addEventListener("thumbstickup",this.onThumbstickUp),t.addEventListener("abuttontouchstart",this.onAorXTouchStart),t.addEventListener("abuttontouchend",this.onAorXTouchEnd),t.addEventListener("bbuttontouchstart",this.onBorYTouchStart),t.addEventListener("bbuttontouchend",this.onBorYTouchEnd),t.addEventListener("xbuttontouchstart",this.onAorXTouchStart),t.addEventListener("xbuttontouchend",this.onAorXTouchEnd),t.addEventListener("ybuttontouchstart",this.onBorYTouchStart),t.addEventListener("ybuttontouchend",this.onBorYTouchEnd),t.addEventListener("surfacetouchstart",this.onSurfaceTouchStart),t.addEventListener("surfacetouchend",this.onSurfaceTouchEnd)},removeEventListeners:function(){var t=this.el;t.removeEventListener("gripdown",this.onGripDown),t.removeEventListener("gripup",this.onGripUp),t.removeEventListener("trackpaddown",this.onTrackpadDown),t.removeEventListener("trackpadup",this.onTrackpadUp),t.removeEventListener("trackpadtouchstart",this.onTrackpadTouchStart),t.removeEventListener("trackpadtouchend",this.onTrackpadTouchEnd),t.removeEventListener("triggerdown",this.onTriggerDown),t.removeEventListener("triggerup",this.onTriggerUp),t.removeEventListener("triggertouchstart",this.onTriggerTouchStart),t.removeEventListener("triggertouchend",this.onTriggerTouchEnd),t.removeEventListener("griptouchstart",this.onGripTouchStart),t.removeEventListener("griptouchend",this.onGripTouchEnd),t.removeEventListener("thumbstickdown",this.onThumbstickDown),t.removeEventListener("thumbstickup",this.onThumbstickUp),t.removeEventListener("abuttontouchstart",this.onAorXTouchStart),t.removeEventListener("abuttontouchend",this.onAorXTouchEnd),t.removeEventListener("bbuttontouchstart",this.onBorYTouchStart),t.removeEventListener("bbuttontouchend",this.onBorYTouchEnd),t.removeEventListener("xbuttontouchstart",this.onAorXTouchStart),t.removeEventListener("xbuttontouchend",this.onAorXTouchEnd),t.removeEventListener("ybuttontouchstart",this.onBorYTouchStart),t.removeEventListener("ybuttontouchend",this.onBorYTouchEnd),t.removeEventListener("surfacetouchstart",this.onSurfaceTouchStart),t.removeEventListener("surfacetouchend",this.onSurfaceTouchEnd)},update:function(t){var e,n=this.el,i=this.data.hand,r=this.data.handModelStyle,s=this.data.color,o=this;if(e={hand:i,model:!1},i!==t){var a=aw[r+i.charAt(0).toUpperCase()+i.slice(1)];this.loader.load(a,(function(t){var i=t.scene.children[0];i.mixer=new THREE.AnimationMixer(i),o.clips=t.animations,n.setObject3D("mesh",i),i.traverse((function(t){t.isMesh&&(t.material.color=new THREE.Color(s))})),n.setAttribute("magicleap-controls",e),n.setAttribute("vive-controls",e),n.setAttribute("meta-touch-controls",e),n.setAttribute("pico-controls",e),n.setAttribute("windows-motion-controls",e),n.setAttribute("hp-mixed-reality-controls",e)}))}},remove:function(){this.el.removeObject3D("mesh")},handleButton:function(t,e){var n,i="down"===e,r="touchstart"===e;if(0===e.indexOf("touch")){if(r===this.touchedButtons[t])return;this.touchedButtons[t]=r}else{if(i===this.pressedButtons[t])return;this.pressedButtons[t]=i}n=this.gesture,this.gesture=this.determineGesture(),this.gesture!==n&&(this.animateGesture(this.gesture,n),this.emitGestureEvents(this.gesture,n))},determineGesture:function(){var t,e,n,i=this.pressedButtons.grip,r=this.pressedButtons.surface||this.touchedButtons.surface,s=this.pressedButtons.trackpad||this.touchedButtons.trackpad,o=this.pressedButtons.trigger||this.touchedButtons.trigger,a=this.touchedButtons.AorX||this.touchedButtons.BorY;return e=this.el.components["tracked-controls"],(n=e&&e.controller)&&(n.id&&0===n.id.indexOf("OpenVR ")||n.profiles&&n.profiles[0]&&"htc-vive"===n.profiles[0])?i||o?t=cw:s&&(t=lw):i?t=r||a||s?o?cw:lw:o?hw:"Point + Thumb":o&&(t="Hold"),t},getClip:function(t){var e,n;for(n=0;n<this.clips.length;n++)if((e=this.clips[n]).name===t)return e},animateGesture:function(t,e){t?this.playAnimation(t||"Open",e,!1):this.playAnimation(e,e,!0)},emitGestureEvents:function(t,e){var n,i=this.el;e!==t&&((n=dw(e,!1))&&i.emit(n),(n=dw(t,!0))&&i.emit(n))},playAnimation:function(t,e,n){var i,r,s=this.el.getObject3D("mesh");if(s){if(i=this.getClip(t),r=s.mixer.clipAction(i),n)return r.paused=!1,void(r.timeScale=-1);if(r.clampWhenFinished=!0,r.loop=THREE.LoopOnce,r.repetitions=0,r.timeScale=1,r.time=0,r.weight=1,!e)return s.mixer.stopAllAction(),void r.play();i=this.getClip(e),r.reset(),r.play(),s.mixer.clipAction(i).crossFadeTo(r,.15,!0)}}}),_b("hide-on-enter-ar",{init:function(){var t=this;this.el.sceneEl.addEventListener("enter-vr",(function(){t.el.sceneEl.is("ar-mode")&&(t.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){t.el.object3D.visible=!0}))}}),_b("hide-on-enter-vr",{init:function(){var t=this;this.el.sceneEl.addEventListener("enter-vr",(function(){t.el.sceneEl.is("vr-mode")&&(t.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){t.el.object3D.visible=!0}))}});var pw="hp-mixed-reality",Aw=My+"controllers/hp/mixed-reality/",fw={x:0,y:0,z:.06},mw={_x:Math.PI/4,_y:0,_z:0,_order:"XYZ"},gw=(_b("hp-mixed-reality-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{left:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var t=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){nx(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t,t.data.hand)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t,t.data.hand)},this.previousButtonValues={},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;ZE(this,pw,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:pw,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",Aw+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping[this.data.hand].buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){var e=t.detail.model;this.data.model&&(e.position.copy(fw),e.rotation.copy(mw),this.el.emit("controllermodelready",{name:"hp-mixed-reality-controls",model:this.data.model,rayOrigin:new _y.Vector3(0,0,0)}))},onAxisMoved:function(t){ex(this,this.mapping.axes,t)}}),Ly("components:layer:warn"));function vw(t,e,n){return(e.dot(t)-e.dot(n))/e.length()}_b("layer",{schema:{type:{default:"quad",oneOf:["quad","monocubemap","stereocubemap"]},src:{type:"map"},rotateCubemap:{default:!1},width:{default:0},height:{default:0}},init:function(){var t=this.el.sceneEl.renderer.getContext();this.quaternion=new THREE.Quaternion,this.position=new THREE.Vector3,this.bindMethods(),this.needsRedraw=!1,this.frameBuffer=t.createFramebuffer();var e=this.el.sceneEl.getAttribute("webxr"),n=e.requiredFeatures;-1===n.indexOf("layers")&&(n.push("layers"),this.el.sceneEl.setAttribute("webxr",e)),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR),this.el.sceneEl.addEventListener("exit-vr",this.onExitVR)},bindMethods:function(){this.onRequestedReferenceSpace=this.onRequestedReferenceSpace.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this)},update:function(t){this.data.src!==t.src&&this.updateSrc()},updateSrc:function(){var t=this.data.type;this.texture=void 0,"quad"!==t?"monocubemap"!==t&&"stereocubemap"!==t||this.loadCubeMapImages():this.loadQuadImage()},loadCubeMapImages:function(){var t,e=this.xrGLFactory,n=this.el.sceneEl.frame,i=this.data.src,r=this.data.type;this.visibilityChanged=!1,this.layer&&("monocubemap"!==r&&"stereocubemap"!==r||(i.complete?this.pendingCubeMapUpdate=!1:this.pendingCubeMapUpdate=!0,this.loadingScreen?this.loadingScreen=!1:this.loadingScreen=!0,"monocubemap"===r?(t=e.getSubImage(this.layer,n),this.loadCubeMapImage(t.colorTexture,i,0)):(t=e.getSubImage(this.layer,n,"left"),this.loadCubeMapImage(t.colorTexture,i,0),t=e.getSubImage(this.layer,n,"right"),this.loadCubeMapImage(t.colorTexture,i,6))))},loadQuadImage:function(){var t=this.data.src,e=this;this.el.sceneEl.systems.material.loadTexture(t,{src:t},(function(n){e.el.sceneEl.renderer.initTexture(n),e.texture=n,"VIDEO"===t.tagName&&setTimeout((function(){e.textureIsVideo=!0}),1e3),e.layer&&(e.layer.height=e.data.height/2||e.texture.image.height/1e3,e.layer.width=e.data.width/2||e.texture.image.width/1e3,e.needsRedraw=!0),e.updateQuadPanel()}))},preGenerateCubeMapTextures:function(t,e){"monocubemap"===this.data.type?this.generateCubeMapTextures(t,0,e):(this.generateCubeMapTextures(t,0,e),this.generateCubeMapTextures(t,6,e))},generateCubeMapTextures:function(t,e,n){for(var i,r,s=this.data,o=this.cubeFaceSize,a=Math.min(t.width,t.height),l=[],c=0;c<6;c++){var h=document.createElement("CANVAS");h.width=h.height=o;var u=h.getContext("2d");s.rotateCubemap&&(2!==c&&3!==c||(u.save(),u.translate(o,o),u.rotate(Math.PI))),u.drawImage(t,(c+e)*a,0,a,a,0,0,o,o),u.restore(),n&&n(),l.push(h)}return s.rotateCubemap&&(i=l[0],r=l[1],l[0]=r,l[1]=i,i=l[4],r=l[5],l[4]=r,l[5]=i),n&&n(),l},loadCubeMapImage:function(t,e,n){var i,r=this.el.sceneEl.renderer.getContext();r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.bindTexture(r.TEXTURE_CUBE_MAP,t),i=!e.complete||this.loadingScreen?this.loadingScreenImages:this.generateCubeMapTextures(e,n);var s=0;i.forEach((function(t,e){r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,r.RGBA,r.UNSIGNED_BYTE,t),s=r.getError()})),0!==s&&console.log("renderingError, WebGL Error Code: "+s),r.bindTexture(r.TEXTURE_CUBE_MAP,null)},tick:function(){this.el.sceneEl.xrSession&&this.referenceSpace&&(this.layer||!this.el.sceneEl.is("vr-mode")&&!this.el.sceneEl.is("ar-mode")||this.initLayer(),this.updateTransform(),this.data.src.complete&&(this.pendingCubeMapUpdate||this.loadingScreen||this.visibilityChanged)&&this.loadCubeMapImages(),(this.needsRedraw||this.layer.needsRedraw||this.textureIsVideo)&&("quad"===this.data.type&&this.draw(),this.needsRedraw=!1))},initLayer:function(){var t=this,e=this.data.type;this.el.sceneEl.xrSession.onvisibilitychange=function(e){t.visibilityChanged="hidden"!==e.session.visibilityState},"quad"!==e?"monocubemap"!==e&&"stereocubemap"!==e||this.initCubeMapLayer():this.initQuadLayer()},initQuadLayer:function(){var t=this.el.sceneEl,e=t.renderer.getContext(),n=this.xrGLFactory=new XRWebGLBinding(t.xrSession,e);this.texture&&(this.layer=n.createQuadLayer({space:this.referenceSpace,viewPixelHeight:2048,viewPixelWidth:2048,height:this.data.height/2||this.texture.image.height/1e3,width:this.data.width/2||this.texture.image.width/1e3}),this.initLoadingScreenImages(),t.renderer.xr.addLayer(this.layer))},initCubeMapLayer:function(){var t=this.data.src,e=this.el.sceneEl,n=e.renderer.getContext(),i=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),r=this.cubeFaceSize=Math.min(i,Math.min(t.width,t.height)),s=this.xrGLFactory=new XRWebGLBinding(e.xrSession,n);this.layer=s.createCubeLayer({space:this.referenceSpace,viewPixelWidth:r,viewPixelHeight:r,layout:"monocubemap"===this.data.type?"mono":"stereo",isStatic:!1}),this.initLoadingScreenImages(),this.loadCubeMapImages(),e.renderer.xr.addLayer(this.layer)},initLoadingScreenImages:function(){for(var t=this.cubeFaceSize,e=this.loadingScreenImages=[],n=0;n<6;n++){var i=document.createElement("CANVAS");i.width=i.height=t;var r=i.getContext("2d");i.width=i.height=t,r.fillStyle="black",r.fillRect(0,0,t,t),2!==n&&3!==n&&(r.translate(t,0),r.scale(-1,1),r.fillStyle="white",r.font="30px Arial",r.fillText("Loading",t/2,t/2)),e.push(i)}},destroyLayer:function(){this.layer&&(this.el.sceneEl.renderer.xr.removeLayer(this.layer),this.layer.destroy(),this.layer=void 0)},toggleCompositorLayer:function(){this.enableCompositorLayer(!this.layerEnabled)},enableCompositorLayer:function(t){this.layerEnabled=t,this.quadPanelEl.object3D.visible=!this.layerEnabled},updateQuadPanel:function(){var t=this.quadPanelEl;this.quadPanelEl||(t=this.quadPanelEl=document.createElement("a-entity"),this.el.appendChild(t)),t.setAttribute("material",{shader:"flat",src:this.data.src,transparent:!0}),t.setAttribute("geometry",{primitive:"plane",height:this.data.height||this.texture.image.height/1e3,width:this.data.width||this.texture.image.height/1e3})},draw:function(){var t=this.el.sceneEl,e=this.el.sceneEl.renderer.getContext(),n=this.xrGLFactory.getSubImage(this.layer,t.frame),i=t.renderer.properties.get(this.texture).__webglTexture,r=e.getParameter(e.FRAMEBUFFER_BINDING);e.viewport(n.viewport.x,n.viewport.y,n.viewport.width,n.viewport.height),e.bindFramebuffer(e.FRAMEBUFFER,this.frameBuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.colorTexture,0),function(t,e,n,i){var r=t.createFramebuffer(),s=n.viewport.x,o=n.viewport.y,a=n.viewport.x+n.viewport.width,l=n.viewport.y+n.viewport.height;"VIDEO"===i.tagName&&(t.bindTexture(t.TEXTURE_2D,e),t.texSubImage2D(t.TEXTURE_2D,0,0,0,i.width,i.height,t.RGB,t.UNSIGNED_BYTE,i)),t.bindFramebuffer(t.READ_FRAMEBUFFER,r),t.framebufferTexture2D(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),t.readBuffer(t.COLOR_ATTACHMENT0),t.blitFramebuffer(0,0,i.width,i.height,s,o,a,l,t.COLOR_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.deleteFramebuffer(r)}(e,i,n,this.data.src),e.bindFramebuffer(e.FRAMEBUFFER,r)},updateTransform:function(){var t=this.el,e=this.position,n=this.quaternion;t.object3D.updateMatrixWorld(),e.setFromMatrixPosition(t.object3D.matrixWorld),n.setFromRotationMatrix(t.object3D.matrixWorld),this.layerEnabled||e.set(0,0,1e8),this.layer.transform=new XRRigidTransform(e,n)},onEnterVR:function(){var t=this.el.sceneEl,e=t.xrSession;t.hasWebXR&&XRWebGLBinding&&e?(e.requestReferenceSpace("local-floor").then(this.onRequestedReferenceSpace),this.layerEnabled=!0,this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!1),this.data.src.play&&this.data.src.play()):gw("The layer component requires WebXR and the layers API enabled")},onExitVR:function(){this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!0),this.destroyLayer()},onRequestedReferenceSpace:function(t){this.referenceSpace=t}}),_b("laser-controls",{schema:{hand:{default:"right"},model:{default:!0},defaultModelColor:{type:"color",default:"grey"}},init:function(){var t=this.config,e=this.data,n=this.el,i=this,r={hand:e.hand,model:e.model};function s(e){var r=t[e.detail.name];if(r){var s=dx({showLine:!0},r.raycaster||{});e.detail.rayOrigin&&(s.origin=e.detail.rayOrigin.origin,s.direction=e.detail.rayOrigin.direction,s.showLine=!0),e.detail.rayOrigin||!i.modelReady?n.setAttribute("raycaster",s):n.setAttribute("raycaster","showLine",!0),n.setAttribute("cursor",dx({fuse:!1},r.cursor))}}n.setAttribute("hp-mixed-reality-controls",r),n.setAttribute("magicleap-controls",r),n.setAttribute("oculus-go-controls",r),n.setAttribute("meta-touch-controls",r),n.setAttribute("pico-controls",r),n.setAttribute("valve-index-controls",r),n.setAttribute("vive-controls",r),n.setAttribute("vive-focus-controls",r),n.setAttribute("windows-motion-controls",r),n.setAttribute("generic-tracked-controller-controls",{hand:r.hand}),n.addEventListener("controllerconnected",s),n.addEventListener("controllerdisconnected",(function(e){t[e.detail.name]&&n.setAttribute("raycaster","showLine",!1)})),n.addEventListener("controllermodelready",(function(t){s(t),i.modelReady=!0}))},config:{"generic-tracked-controller-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"hp-mixed-reality-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"magicleap-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"oculus-go-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:5e-4,z:0}}},"meta-touch-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"pico-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"valve-index-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-focus-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"windows-motion-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{showLine:!1}}}});var yw,Ew,xw,bw,Cw,ww,_w,Mw,Sw,Iw,Bw=_y.MathUtils.degToRad,Tw=Ly("components:light:warn"),Rw=new _y.CubeTextureLoader,Lw={};function Dw(t,e){return!(!t||!e)&&t.x===e.x&&t.y===e.y&&t.z===e.z}_b("light",{schema:{angle:{default:60,if:{type:["spot"]}},color:{type:"color",if:{type:["ambient","directional","hemisphere","point","spot"]}},envMap:{default:"",if:{type:["probe"]}},groundColor:{type:"color",if:{type:["hemisphere"]}},decay:{default:1,if:{type:["point","spot"]}},distance:{default:0,min:0,if:{type:["point","spot"]}},intensity:{default:3.14,min:0,if:{type:["ambient","directional","hemisphere","point","spot","probe"]}},penumbra:{default:0,min:0,max:1,if:{type:["spot"]}},type:{default:"directional",oneOf:["ambient","directional","hemisphere","point","spot","probe"],schemaChange:!0},target:{type:"selector",if:{type:["spot","directional"]}},castShadow:{default:!1,if:{type:["point","spot","directional"]}},shadowBias:{default:0,if:{castShadow:!0}},shadowCameraFar:{default:500,if:{castShadow:!0}},shadowCameraFov:{default:90,if:{castShadow:!0}},shadowCameraNear:{default:.5,if:{castShadow:!0}},shadowCameraTop:{default:5,if:{castShadow:!0}},shadowCameraRight:{default:5,if:{castShadow:!0}},shadowCameraBottom:{default:-5,if:{castShadow:!0}},shadowCameraLeft:{default:-5,if:{castShadow:!0}},shadowCameraVisible:{default:!1,if:{castShadow:!0}},shadowCameraAutomatic:{default:"",if:{type:["directional"]}},shadowMapHeight:{default:512,if:{castShadow:!0}},shadowMapWidth:{default:512,if:{castShadow:!0}},shadowRadius:{default:1,if:{castShadow:!0}}},init:function(){var t=this.el;this.light=null,this.defaultTarget=null,this.system.registerLight(t)},update:function(t){var e=this.data,n=vx(e,t),i=this.light,r=this;if(!i||"type"in n)this.setLight(this.data),this.updateShadow();else{var s=!1;Object.keys(n).forEach((function(t){var n=e[t];switch(t){case"color":i.color.set(n);break;case"groundColor":i.groundColor.set(n);break;case"angle":i.angle=Bw(n);break;case"target":null===n?"spot"!==e.type&&"directional"!==e.type||(i.target=r.defaultTarget):n.hasLoaded?r.onSetTarget(n,i):n.addEventListener("loaded",r.onSetTarget.bind(r,n,i));break;case"envMap":r.updateProbeMap(e,i);break;case"castShadow":case"shadowBias":case"shadowCameraFar":case"shadowCameraFov":case"shadowCameraNear":case"shadowCameraTop":case"shadowCameraRight":case"shadowCameraBottom":case"shadowCameraLeft":case"shadowCameraVisible":case"shadowMapHeight":case"shadowMapWidth":case"shadowRadius":s||(r.updateShadow(),s=!0);break;case"shadowCameraAutomatic":e.shadowCameraAutomatic?r.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(e.shadowCameraAutomatic)):r.shadowCameraAutomaticEls=[];break;default:i[t]=n}}))}},tick:(yw=new _y.Box3,Ew=new _y.Vector3,xw=new _y.Vector3,bw=new _y.Matrix4,Cw=new _y.Sphere,ww=new _y.Vector3,function(){if("directional"===this.data.type&&this.light.shadow&&this.light.shadow.camera instanceof _y.OrthographicCamera&&this.shadowCameraAutomaticEls.length){var t=this.light.shadow.camera;t.getWorldDirection(Ew),t.getWorldPosition(xw),bw.copy(t.matrixWorld),bw.invert(),t.near=1,t.left=1e5,t.right=-1e5,t.top=-1e5,t.bottom=1e5,this.shadowCameraAutomaticEls.forEach((function(e){yw.setFromObject(e.object3D),yw.getBoundingSphere(Cw);var n,i,r,s,o,a=vw(xw,Ew,Cw.center),l=(n=xw,i=Ew,r=Cw.center,s=ww,o=vw(n,i,r),s.copy(i),s.multiplyScalar(o),s.add(r),s).applyMatrix4(bw);t.near=Math.min(-a-Cw.radius-1,t.near),t.left=Math.min(-Cw.radius+l.x,t.left),t.right=Math.max(Cw.radius+l.x,t.right),t.top=Math.max(Cw.radius+l.y,t.top),t.bottom=Math.min(-Cw.radius+l.y,t.bottom)})),t.updateProjectionMatrix()}}),setLight:function(t){var e=this.el,n=this.getLight(t);n&&(this.light&&e.removeObject3D("light"),this.light=n,this.light.el=e,e.setObject3D("light",this.light),"spot"!==t.type&&"directional"!==t.type&&"hemisphere"!==t.type||e.getObject3D("light").translateY(-1),"spot"===t.type&&(e.setObject3D("light-target",this.defaultTarget),e.getObject3D("light-target").position.set(0,0,-1)),t.shadowCameraAutomatic?this.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(t.shadowCameraAutomatic)):this.shadowCameraAutomaticEls=[])},updateShadow:function(){var t=this.el,e=this.data,n=this.light;n.castShadow=e.castShadow;var i=t.getObject3D("cameraHelper");if(e.shadowCameraVisible&&!i?(i=new _y.CameraHelper(n.shadow.camera),t.setObject3D("cameraHelper",i)):!e.shadowCameraVisible&&i&&t.removeObject3D("cameraHelper"),!e.castShadow)return n;n.shadow.bias=e.shadowBias,n.shadow.radius=e.shadowRadius,n.shadow.mapSize.height=e.shadowMapHeight,n.shadow.mapSize.width=e.shadowMapWidth,n.shadow.camera.near=e.shadowCameraNear,n.shadow.camera.far=e.shadowCameraFar,n.shadow.camera instanceof _y.OrthographicCamera?(n.shadow.camera.top=e.shadowCameraTop,n.shadow.camera.right=e.shadowCameraRight,n.shadow.camera.bottom=e.shadowCameraBottom,n.shadow.camera.left=e.shadowCameraLeft):n.shadow.camera.fov=e.shadowCameraFov,n.shadow.camera.updateProjectionMatrix(),i&&i.update()},getLight:function(t){var e=t.angle,n=new _y.Color(t.color);n=n.getHex();var i=t.decay,r=t.distance,s=new _y.Color(t.groundColor);s=s.getHex();var o=t.intensity,a=t.type,l=t.target,c=null;switch(a.toLowerCase()){case"ambient":return new _y.AmbientLight(n,o);case"directional":return c=new _y.DirectionalLight(n,o),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"hemisphere":return new _y.HemisphereLight(n,s,o);case"point":return new _y.PointLight(n,o,r,i);case"spot":return c=new _y.SpotLight(n,o,r,Bw(e),t.penumbra,i),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"probe":return c=new _y.LightProbe,this.updateProbeMap(t,c),c;default:Tw("%s is not a valid light type. Choose from ambient, directional, hemisphere, point, spot.",a)}},updateProbeMap:function(t,e){t.envMap?(void 0===Lw[t.envMap]&&(Lw[t.envMap]=new window.Promise((function(e){BE(t.envMap,(function(n){Rw.load(n,(function(n){var i=_y.LightProbeGenerator.fromCubeTexture(n);Lw[t.envMap]=i,e(i)}))}))}))),Lw[t.envMap]instanceof window.Promise?Lw[t.envMap].then((function(t){e.copy(t)})):Lw[t.envMap]instanceof _y.LightProbe&&e.copy(Lw[t.envMap])):e.copy(new _y.LightProbe)},onSetTarget:function(t,e){e.target=t.object3D},remove:function(){var t=this.el;t.removeObject3D("light"),t.getObject3D("cameraHelper")&&t.removeObject3D("cameraHelper")}}),_b("line",{schema:{start:{type:"vec3",default:{x:0,y:0,z:0}},end:{type:"vec3",default:{x:0,y:0,z:0}},color:{type:"color",default:"#74BEC1"},opacity:{type:"number",default:1},visible:{default:!0}},multiple:!0,init:function(){var t,e,n=this.data;e=this.material=new THREE.LineBasicMaterial({color:n.color,opacity:n.opacity,transparent:n.opacity<1,visible:n.visible}),(t=this.geometry=new THREE.BufferGeometry).setAttribute("position",new THREE.BufferAttribute(new Float32Array(6),3)),this.line=new THREE.Line(t,e),this.el.setObject3D(this.attrName,this.line)},update:function(t){var e=this.data,n=this.geometry,i=!1,r=this.material,s=n.attributes.position.array;Dw(e.start,t.start)||(s[0]=e.start.x,s[1]=e.start.y,s[2]=e.start.z,i=!0),Dw(e.end,t.end)||(s[3]=e.end.x,s[4]=e.end.y,s[5]=e.end.z,i=!0),i&&(n.attributes.position.needsUpdate=!0,n.computeBoundingSphere()),r.color.setStyle(e.color),r.opacity=e.opacity,r.transparent=e.opacity<1,r.visible=e.visible},remove:function(){this.el.removeObject3D(this.attrName,this.line)}}),_b("link",{schema:{backgroundColor:{default:"red",type:"color"},borderColor:{default:"white",type:"color"},highlighted:{default:!1},highlightedColor:{default:"#24CAFF",type:"color"},href:{default:""},image:{type:"asset"},on:{default:"click"},peekMode:{default:!1},title:{default:""},titleColor:{default:"white",type:"color"},visualAspectEnabled:{default:!1}},init:function(){this.navigate=this.navigate.bind(this),this.previousQuaternion=void 0,this.quaternionClone=new _y.Quaternion,this.hiddenEls=[]},update:function(t){var e,n,i=this.data,r=this.el;if(i.visualAspectEnabled){var s=this.el.getAttribute("scale");this.previewDistance=15*(s.x+s.y)/2,this.initVisualAspect(),e=i.highlighted?i.highlightedColor:i.backgroundColor,n=i.highlighted?i.highlightedColor:i.borderColor,r.setAttribute("material","backgroundColor",e),r.setAttribute("material","strokeColor",n),i.on!==t.on&&this.updateEventListener(),void 0!==t.peekMode&&i.peekMode!==t.peekMode&&this.updatePeekMode(),i.image&&t.image!==i.image&&r.setAttribute("material","pano","string"==typeof i.image?i.image:i.image.src)}},updatePeekMode:function(){var t=this.el,e=this.sphereEl;this.data.peekMode?(this.hideAll(),t.getObject3D("mesh").visible=!1,e.setAttribute("visible",!0)):(this.showAll(),t.getObject3D("mesh").visible=!0,e.setAttribute("visible",!1))},play:function(){this.updateEventListener()},pause:function(){this.removeEventListener()},updateEventListener:function(){var t=this.el;t.isPlaying&&(this.removeEventListener(),t.addEventListener(this.data.on,this.navigate))},removeEventListener:function(){var t=this.data.on;t&&this.el.removeEventListener(t,this.navigate)},initVisualAspect:function(){var t,e,n,i=this.el;this.data.visualAspectEnabled&&!this.visualAspectInitialized&&(n=this.textEl=this.textEl||document.createElement("a-entity"),e=this.sphereEl=this.sphereEl||document.createElement("a-entity"),t=this.semiSphereEl=this.semiSphereEl||document.createElement("a-entity"),i.setAttribute("geometry",{primitive:"circle",radius:1,segments:64}),i.setAttribute("material",{shader:"portal",pano:this.data.image,side:"double",previewDistance:this.previewDistance}),n.setAttribute("text",{color:this.data.titleColor,align:"center",font:"kelsonsans",value:this.data.title||this.data.href,width:4}),n.setAttribute("position","0 1.5 0"),i.appendChild(n),t.setAttribute("geometry",{primitive:"sphere",radius:1,phiStart:0,segmentsWidth:64,segmentsHeight:64,phiLength:180,thetaStart:0,thetaLength:360}),t.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back",previewDistance:this.previewDistance}),t.setAttribute("rotation","0 180 0"),t.setAttribute("position","0 0 0"),t.setAttribute("visible",!1),i.appendChild(t),e.setAttribute("geometry",{primitive:"sphere",radius:10,segmentsWidth:64,segmentsHeight:64}),e.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back",previewDistance:this.previewDistance}),e.setAttribute("visible",!1),i.appendChild(e),this.visualAspectInitialized=!0)},navigate:function(){window.location=this.data.href},tick:function(){var t=new _y.Vector3,e=new _y.Vector3,n=new _y.Quaternion,i=new _y.Vector3;return function(){var r,s,o=this.el,a=o.object3D,l=o.sceneEl.camera,c=this.textEl;if(this.data.visualAspectEnabled)if(a.updateMatrixWorld(),l.parent.updateMatrixWorld(),l.updateMatrixWorld(),a.matrix.decompose(e,n,i),e.setFromMatrixPosition(a.matrixWorld),t.setFromMatrixPosition(l.matrixWorld),(s=e.distanceTo(t))>1.33333*this.previewDistance)this.previousQuaternion||(this.quaternionClone.copy(n),this.previousQuaternion=this.quaternionClone),a.lookAt(t);else{if(r=this.calculateCameraPortalOrientation(),s<.5){if(!0===this.semiSphereEl.getAttribute("visible"))return;c.setAttribute("text","width",1.5),r<=0?(c.setAttribute("position","0 0 0.75"),c.setAttribute("rotation","0 180 0"),this.semiSphereEl.setAttribute("rotation","0 0 0")):(c.setAttribute("position","0 0 -0.75"),c.setAttribute("rotation","0 0 0"),this.semiSphereEl.setAttribute("rotation","0 180 0")),o.getObject3D("mesh").visible=!1,this.semiSphereEl.setAttribute("visible",!0),this.peekCameraPortalOrientation=r}else r<=0?c.setAttribute("rotation","0 180 0"):c.setAttribute("rotation","0 0 0"),c.setAttribute("text","width",5),c.setAttribute("position","0 1.5 0"),o.getObject3D("mesh").visible=!0,this.semiSphereEl.setAttribute("visible",!1),this.peekCameraPortalOrientation=void 0;this.previousQuaternion&&(a.quaternion.copy(this.previousQuaternion),this.previousQuaternion=void 0)}}}(),hideAll:function(){var t=this.el,e=this.hiddenEls,n=this;e.length>0||t.sceneEl.object3D.traverse((function(i){i&&i.el&&i.el.hasAttribute("link-controls")||i.el&&i!==t.sceneEl.object3D&&i.el!==t&&i.el!==n.sphereEl&&i.el!==t.sceneEl.cameraEl&&!1!==i.el.getAttribute("visible")&&i.el!==n.textEl&&i.el!==n.semiSphereEl&&(i.el.setAttribute("visible",!1),e.push(i.el))}))},showAll:function(){this.hiddenEls.forEach((function(t){t.setAttribute("visible",!0)})),this.hiddenEls=[]},calculateCameraPortalOrientation:(_w=new _y.Matrix4,Mw=new _y.Vector3,Sw=new _y.Vector3(0,0,1),Iw=new _y.Vector3(0,0,0),function(){var t=this.el,e=t.sceneEl.camera;return Mw.set(0,0,0),Sw.set(0,0,1),Iw.set(0,0,0),t.object3D.matrixWorld.extractRotation(_w),Sw.applyMatrix4(_w),t.object3D.updateMatrixWorld(),t.object3D.localToWorld(Iw),e.parent.parent.updateMatrixWorld(),e.parent.updateMatrixWorld(),e.updateMatrixWorld(),e.localToWorld(Mw),Mw.sub(Iw).normalize(),Sw.normalize(),Math.sign(Sw.dot(Mw))}),remove:function(){this.removeEventListener()}}),vC("portal",{schema:{borderEnabled:{default:1,type:"int",is:"uniform"},backgroundColor:{default:"red",type:"color",is:"uniform"},pano:{type:"map",is:"uniform"},strokeColor:{default:"white",type:"color",is:"uniform"},previewDistance:{default:15,type:"float",is:"uniform"}},vertexShader:["vec3 portalPosition;","varying vec3 vWorldPosition;","varying float vDistanceToCenter;","varying float vDistance;","void main() {","vDistanceToCenter = clamp(length(position - vec3(0.0, 0.0, 0.0)), 0.0, 1.0);","portalPosition = (modelMatrix * vec4(0.0, 0.0, 0.0, 1.0)).xyz;","vDistance = length(portalPosition - cameraPosition);","vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI2 0.15915494","uniform sampler2D pano;","uniform vec3 strokeColor;","uniform vec3 backgroundColor;","uniform float borderEnabled;","uniform float previewDistance;","varying float vDistanceToCenter;","varying float vDistance;","varying vec3 vWorldPosition;","void main() {","vec3 direction = normalize(vWorldPosition - cameraPosition);","vec2 sampleUV;","float borderThickness = clamp(exp(-vDistance / 50.0), 0.6, 0.95);","sampleUV.y = clamp(direction.y * 0.5 + 0.5, 0.0, 1.0);","sampleUV.x = atan(direction.z, -direction.x) * -RECIPROCAL_PI2 + 0.5;","if (vDistanceToCenter > borderThickness && borderEnabled == 1.0) {","gl_FragColor = vec4(strokeColor, 1.0);","} else {","gl_FragColor = mix(texture2D(pano, sampleUV), vec4(backgroundColor, 1.0), clamp(pow((vDistance / previewDistance), 2.0), 0.0, 1.0));","}","}"].join("\n")});var Pw="logitech-mx-ink",Uw=My+"controllers/logitech/",Ow=(_b("logitech-mx-ink-controls",{schema:{hand:{default:"left"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{left:{buttons:["front","back","none","none","none","tip"]},right:{buttons:["front","back","none","none","none","tip"]}},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){nx(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t,t.data.hand)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t,t.data.hand)},this.bindMethods()},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),t.sceneEl.removeEventListener("enter-vr",this.onEnterVR),t.sceneEl.removeEventListener("exit-vr",this.onExitVR),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.controllerObject3D;t&&(t.visible=!1),ZE(this,Pw,{hand:this.data.hand,iterateControllerProfiles:!0})},injectTrackedControls:function(){var t=this.el,e=this.data,n=Pw;t.setAttribute("tracked-controls",{id:n,hand:e.hand,handTrackingEnabled:!1,iterateControllerProfiles:!0,orientationOffset:e.orientationOffset}),this.loadModel()},loadModel:function(){var t=this.controllerObject3D;if(this.data.model)return t?(t.visible=this.el.sceneEl.is("vr-mode"),void this.el.setObject3D("mesh",t)):void this.el.setAttribute("gltf-model",Uw+"logitech-mx-ink.glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping[this.data.hand].buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){t.target===this.el&&this.data.model&&(this.el.emit("controllermodelready",{name:"logitech-mx-ink-controls",model:this.data.model,rayOrigin:new _y.Vector3(0,0,0)}),this.controllerObject3D=this.el.getObject3D("mesh"),this.controllerObject3D.visible=this.el.sceneEl.is("vr-mode"))},onAxisMoved:function(t){ex(this,this.mapping.axes,t)}}),Math.PI/2),Fw=(_b("look-controls",{dependencies:["position","rotation"],schema:{enabled:{default:!0},magicWindowTrackingEnabled:{default:!0},pointerLockEnabled:{default:!1},reverseMouseDrag:{default:!1},reverseTouchDrag:{default:!1},touchEnabled:{default:!0},mouseEnabled:{default:!0}},init:function(){this.deltaYaw=0,this.previousHMDPosition=new _y.Vector3,this.hmdQuaternion=new _y.Quaternion,this.magicWindowAbsoluteEuler=new _y.Euler,this.magicWindowDeltaEuler=new _y.Euler,this.position=new _y.Vector3,this.magicWindowObject=new _y.Object3D,this.rotation={},this.deltaRotation={},this.savedPose=null,this.pointerLocked=!1,this.setupMouseControls(),this.bindMethods(),this.previousMouseEvent={},this.setupMagicWindowControls(),this.savedPose={position:new _y.Vector3,rotation:new _y.Euler},(this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode"))&&this.onEnterVR()},setupMagicWindowControls:function(){var t,e=this.data;(Wy()||Ky())&&(t=this.magicWindowControls=new _y.DeviceOrientationControls(this.magicWindowObject),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission&&(t.enabled=!1,this.el.sceneEl.components["device-orientation-permission-ui"].permissionGranted?t.enabled=e.magicWindowTrackingEnabled:this.el.sceneEl.addEventListener("deviceorientationpermissiongranted",(function(){t.enabled=e.magicWindowTrackingEnabled}))))},update:function(t){var e=this.data;e.enabled!==t.enabled&&this.updateGrabCursor(e.enabled),t&&!e.magicWindowTrackingEnabled&&t.magicWindowTrackingEnabled&&(this.magicWindowAbsoluteEuler.set(0,0,0),this.magicWindowDeltaEuler.set(0,0,0)),this.magicWindowControls&&(this.magicWindowControls.enabled=e.magicWindowTrackingEnabled),t&&!e.pointerLockEnabled!==t.pointerLockEnabled&&(this.removeEventListeners(),this.addEventListeners(),this.pointerLocked&&this.exitPointerLock())},tick:function(t){this.data.enabled&&this.updateOrientation()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},remove:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},bindMethods:function(){this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this),this.onPointerLockChange=this.onPointerLockChange.bind(this),this.onPointerLockError=this.onPointerLockError.bind(this)},setupMouseControls:function(){this.mouseDown=!1,this.pitchObject=new _y.Object3D,this.yawObject=new _y.Object3D,this.yawObject.position.y=10,this.yawObject.add(this.pitchObject)},addEventListeners:function(){var t=this.el.sceneEl,e=t.canvas;e?(e.addEventListener("mousedown",this.onMouseDown,!1),window.addEventListener("mousemove",this.onMouseMove,!1),window.addEventListener("mouseup",this.onMouseUp,!1),e.addEventListener("touchstart",this.onTouchStart,{passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{passive:!0}),t.addEventListener("enter-vr",this.onEnterVR),t.addEventListener("exit-vr",this.onExitVR),this.data.pointerLockEnabled&&(document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.addEventListener("pointerlockerror",this.onPointerLockError,!1))):t.addEventListener("render-target-loaded",this.addEventListeners.bind(this))},removeEventListeners:function(){var t=this.el.sceneEl,e=t&&t.canvas;e&&(e.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),t.removeEventListener("enter-vr",this.onEnterVR),t.removeEventListener("exit-vr",this.onExitVR),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("pointerlockerror",this.onPointerLockError,!1))},updateOrientation:function(){var t=this.el.object3D,e=this.pitchObject,n=this.yawObject,i=this.el.sceneEl;(i.is("vr-mode")||i.is("ar-mode"))&&i.checkHeadsetConnected()||(this.updateMagicWindowOrientation(),t.rotation.x=this.magicWindowDeltaEuler.x+e.rotation.x,t.rotation.y=this.magicWindowDeltaEuler.y+n.rotation.y,t.rotation.z=this.magicWindowDeltaEuler.z)},updateMagicWindowOrientation:function(){var t=this.magicWindowAbsoluteEuler,e=this.magicWindowDeltaEuler;this.magicWindowControls&&this.magicWindowControls.enabled&&(this.magicWindowControls.update(),t.setFromQuaternion(this.magicWindowObject.quaternion,"YXZ"),this.previousMagicWindowYaw||0===t.y||(this.previousMagicWindowYaw=t.y),this.previousMagicWindowYaw&&(e.x=t.x,e.y+=t.y-this.previousMagicWindowYaw,e.z=t.z,this.previousMagicWindowYaw=t.y))},onMouseMove:function(t){var e,n,i,r=this.pitchObject,s=this.previousMouseEvent,o=this.yawObject;this.data.enabled&&(this.mouseDown||this.pointerLocked)&&(this.pointerLocked?(n=t.movementX||t.mozMovementX||0,i=t.movementY||t.mozMovementY||0):(n=t.screenX-s.screenX,i=t.screenY-s.screenY),this.previousMouseEvent.screenX=t.screenX,this.previousMouseEvent.screenY=t.screenY,e=this.data.reverseMouseDrag?1:-1,o.rotation.y+=.002*n*e,r.rotation.x+=.002*i*e,r.rotation.x=Math.max(-Ow,Math.min(Ow,r.rotation.x)))},onMouseDown:function(t){var e=this.el.sceneEl;if(this.data.enabled&&this.data.mouseEnabled&&(!e.is("vr-mode")&&!e.is("ar-mode")||!e.checkHeadsetConnected())&&0===t.button){var n=e&&e.canvas;this.mouseDown=!0,this.previousMouseEvent.screenX=t.screenX,this.previousMouseEvent.screenY=t.screenY,this.showGrabbingCursor(),this.data.pointerLockEnabled&&!this.pointerLocked&&(n.requestPointerLock?n.requestPointerLock():n.mozRequestPointerLock&&n.mozRequestPointerLock())}},showGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor="grabbing"},hideGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor=""},onMouseUp:function(){this.mouseDown=!1,this.hideGrabbingCursor()},onTouchStart:function(t){1!==t.touches.length||!this.data.touchEnabled||this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode")||(this.touchStart={x:t.touches[0].pageX,y:t.touches[0].pageY},this.touchStarted=!0)},onTouchMove:function(t){var e,n,i=this.el.sceneEl.canvas,r=this.yawObject;this.touchStarted&&this.data.touchEnabled&&(n=2*Math.PI*(t.touches[0].pageX-this.touchStart.x)/i.clientWidth,e=this.data.reverseTouchDrag?1:-1,r.rotation.y-=.5*n*e,this.touchStart={x:t.touches[0].pageX,y:t.touches[0].pageY})},onTouchEnd:function(){this.touchStarted=!1},onEnterVR:function(){var t=this.el.sceneEl;t.checkHeadsetConnected()&&(this.saveCameraPose(),this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),t.hasWebXR&&(this.el.object3D.matrixAutoUpdate=!1,this.el.object3D.updateMatrix()))},onExitVR:function(){this.el.sceneEl.checkHeadsetConnected()&&(this.restoreCameraPose(),this.previousHMDPosition.set(0,0,0),this.el.object3D.matrixAutoUpdate=!0)},onPointerLockChange:function(){this.pointerLocked=!(!document.pointerLockElement&&!document.mozPointerLockElement)},onPointerLockError:function(){this.pointerLocked=!1},exitPointerLock:function(){document.exitPointerLock(),this.pointerLocked=!1},updateGrabCursor:function(t){var e=this.el.sceneEl;function n(){e.canvas.classList.add("a-grab-cursor")}function i(){e.canvas.classList.remove("a-grab-cursor")}e.canvas?t?n():i():t?e.addEventListener("render-target-loaded",n):e.addEventListener("render-target-loaded",i)},saveCameraPose:function(){var t=this.el;this.savedPose.position.copy(t.object3D.position),this.savedPose.rotation.copy(t.object3D.rotation),this.hasSavedPose=!0},restoreCameraPose:function(){var t=this.el,e=this.savedPose;this.hasSavedPose&&(t.object3D.position.copy(e.position),t.object3D.rotation.copy(e.rotation),this.hasSavedPose=!1)}}),"magicleap-one"),kw=My+"controllers/magicleap/magicleap-one-controller.glb",Nw=(_b("magicleap-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","menu"]},init:function(){var t=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.previousButtonValues={},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;ZE(this,Fw,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:Fw,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",kw)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping.buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){t.detail.model.scale.set(.01,.01,.01)},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},updateModel:function(t,e){},setButtonColor:function(t,e){}}),Ly("components:material:error"));function Qw(t,e){t.dispose(),e.unregisterMaterial(t),Object.keys(t).filter((function(e){return t[e]&&t[e].isTexture})).forEach((function(e){t[e].dispose()}))}_b("material",{schema:{alphaTest:{default:0,min:0,max:1},depthTest:{default:!0},depthWrite:{default:!0},flatShading:{default:!1},npot:{default:!1},offset:{type:"vec2",default:{x:0,y:0}},opacity:{default:1,min:0,max:1},repeat:{type:"vec2",default:{x:1,y:1}},shader:{default:"standard",oneOf:fC,schemaChange:!0},side:{default:"front",oneOf:["front","back","double"]},transparent:{default:!1},vertexColorsEnabled:{default:!1},visible:{default:!0},blending:{default:"normal",oneOf:["none","normal","additive","subtractive","multiply"]},dithering:{default:!0},anisotropy:{default:0,min:0}},init:function(){this.material=null},update:function(t){var e=this.data;this.shader&&e.shader===t.shader||this.updateShader(e.shader),this.shader.update(this.data),this.updateMaterial(t)},updateSchema:function(t){var e,n,i,r;n=t&&t.shader,e=this.oldData&&this.oldData.shader,(i=AC[r=n||e]&&AC[r].schema)||Nw("Unknown shader schema "+r),e&&n===e||(this.extendSchema(i),this.updateBehavior())},updateBehavior:function(){var t,e,n=this.el.sceneEl,i=this.schema,r=this;function s(t,n){var i;for(i in e)e[i]=t;r.shader.update(e)}for(t in this.tick=void 0,e={},i)"time"===i[t].type&&(this.tick=s,e[t]=!0);n&&(this.tick?n.addBehavior(this):n.removeBehavior(this))},updateShader:function(t){var e,n=this.data,i=AC[t]&&AC[t].Shader;if(!i)throw new Error("Unknown shader "+t);(e=this.shader=new i).el=this.el,e.init(n),this.setMaterial(e.material),this.updateSchema(n)},updateMaterial:function(t){var e,n=this.data,i=this.material;for(e in i.alphaTest=n.alphaTest,i.depthTest=!1!==n.depthTest,i.depthWrite=!1!==n.depthWrite,i.opacity=n.opacity,i.flatShading=n.flatShading,i.side=function(t){switch(t){case"back":return _y.BackSide;case"double":return _y.DoubleSide;default:return _y.FrontSide}}(n.side),i.transparent=!1!==n.transparent||n.opacity<1,i.vertexColors=n.vertexColorsEnabled,i.visible=n.visible,i.blending=function(t){switch(t){case"none":return _y.NoBlending;case"additive":return _y.AdditiveBlending;case"subtractive":return _y.SubtractiveBlending;case"multiply":return _y.MultiplyBlending;default:return _y.NormalBlending}}(n.blending),i.dithering=n.dithering,t)break;!e||t.alphaTest===n.alphaTest&&t.side===n.side&&t.vertexColorsEnabled===n.vertexColorsEnabled||(i.needsUpdate=!0)},remove:function(){var t=new _y.MeshBasicMaterial,e=this.material,n=this.el.getObject3D("mesh");n&&(n.material=t),Qw(e,this.system)},setMaterial:function(t){var e,n=this.el,i=this.system;this.material&&Qw(this.material,i),this.material=t,i.registerMaterial(t),(e=n.getObject3D("mesh"))?e.material=t:n.addEventListener("object3dset",(function e(i){"mesh"===i.detail.type&&i.target===n&&(n.getObject3D("mesh").material=t,n.removeEventListener("object3dset",e))}))}});var Gw,zw,Hw,Vw,jw,Ww="oculus-touch",qw=My+"controllers/oculus/oculus-touch-controller-",Xw=My+"controllers/meta/",Yw={left:{modelUrl:qw+"left.gltf",rayOrigin:{origin:{x:.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new _y.Vector3(-.005,.036,-.037),modelPivotRotation:new _y.Euler(Math.PI/4.5,0,0)},right:{modelUrl:qw+"right.gltf",rayOrigin:{origin:{x:-.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new _y.Vector3(.005,.036,-.037),modelPivotRotation:new _y.Euler(Math.PI/4.5,0,0)}},Jw="oculus-touch",Kw={"oculus-touch":Yw,"oculus-touch-v2":{left:{modelUrl:qw+"gen2-left.gltf",rayOrigin:{origin:{x:-.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new _y.Vector3(0,-.007,-.021),modelPivotRotation:new _y.Euler(-Math.PI/4,0,0)},right:{modelUrl:qw+"gen2-right.gltf",rayOrigin:{origin:{x:.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new _y.Vector3(0,-.007,-.021),modelPivotRotation:new _y.Euler(-Math.PI/4,0,0)}},"oculus-touch-v3":{left:{modelUrl:qw+"v3-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)},right:{modelUrl:qw+"v3-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)}},"meta-quest-touch-pro":{left:{modelUrl:Xw+"quest-touch-pro-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)},right:{modelUrl:Xw+"quest-touch-pro-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)}},"meta-quest-touch-plus":{left:{modelUrl:Xw+"quest-touch-plus-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)},right:{modelUrl:Xw+"quest-touch-plus-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)}}},Zw={schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#999"},buttonTouchColor:{type:"color",default:"#8AB"},buttonHighlightColor:{type:"color",default:"#2DF"},model:{default:!0},controllerType:{default:"auto",oneOf:["auto","oculus-touch","oculus-touch-v2","oculus-touch-v3"]}},after:["tracked-controls"],mapping:{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton","surface"]}},bindMethods:function(){this.onButtonChanged=this.onButtonChanged.bind(this),this.onThumbstickMoved=this.onThumbstickMoved.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonDown=function(e){nx(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){nx(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t,t.data.hand)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t,t.data.hand)},this.controllerPresent=!1,this.previousButtonValues={},this.bindMethods(),this.triggerEuler=new _y.Euler},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.controllerObject3D;t&&(t.visible=!1),ZE(this,Ww,{hand:this.data.hand,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},loadModel:function(t){var e,n=this.data;if(n.model){if(this.controllerObject3D)return this.controllerObject3D.visible=!0,void this.el.setObject3D("mesh",this.controllerObject3D);if(this.displayModel=Kw[n.controllerType]||Kw[Jw],"auto"===n.controllerType){e=Jw;for(var i=Object.keys(Kw),r=0;r<t.profiles.length;r++)if(-1!==i.indexOf(t.profiles[r])){e=t.profiles[r];break}this.displayModel=Kw[e]}var s=this.displayModel[n.hand].modelUrl;this.isTouchV3orPROorPlus=this.displayModel===Kw["oculus-touch-v3"]||this.displayModel===Kw["meta-quest-touch-pro"]||this.displayModel===Kw["meta-quest-touch-plus"],this.el.setAttribute("gltf-model",s)}},injectTrackedControls:function(t){var e=this.data,n=Ww;this.el.setAttribute("tracked-controls",{id:n,hand:e.hand,handTrackingEnabled:!1,iterateControllerProfiles:!0}),this.loadModel(t)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e=this.mapping[this.data.hand].buttons[t.detail.id];if(e){if(this.isTouchV3orPROorPlus)this.onButtonChangedV3orPROorPlus(t);else{var n,i=this.buttonMeshes;"trigger"!==e&&"grip"!==e||(n=t.detail.state.value),i&&("trigger"===e&&i.trigger&&(i.trigger.rotation.x=this.originalXRotationTrigger-n*(Math.PI/26)),"grip"===e&&i.grip&&(n*="left"===this.data.hand?-1:1,i.grip.position.x=this.originalXPositionGrip+.004*n))}this.el.emit(e+"changed",t.detail.state)}},onButtonChangedV3orPROorPlus:function(t){var e,n=this.mapping[this.data.hand].buttons[t.detail.id],i=this.buttonObjects;i&&i[n]&&(e=t.detail.state.value,i[n].quaternion.slerpQuaternions(this.buttonRanges[n].min.quaternion,this.buttonRanges[n].max.quaternion,e),i[n].position.lerpVectors(this.buttonRanges[n].min.position,this.buttonRanges[n].max.position,e))},onModelLoaded:function(t){if(t.target===this.el&&this.data.model){if(this.isTouchV3orPROorPlus)this.onTouchV3orPROorPlusModelLoaded(t);else{var e,n=this.controllerObject3D=t.detail.model;(e=this.buttonMeshes={}).grip=n.getObjectByName("buttonHand"),this.originalXPositionGrip=e.grip&&e.grip.position.x,e.trigger=n.getObjectByName("buttonTrigger"),this.originalXRotationTrigger=e.trigger&&e.trigger.rotation.x,e.thumbstick=n.getObjectByName("stick"),e.xbutton=n.getObjectByName("buttonX"),e.abutton=n.getObjectByName("buttonA"),e.ybutton=n.getObjectByName("buttonY"),e.bbutton=n.getObjectByName("buttonB")}for(var i in this.buttonMeshes)this.buttonMeshes[i]&&$w(this.buttonMeshes[i]);this.applyOffset(t.detail.model),this.el.emit("controllermodelready",{name:"meta-touch-controls",model:this.data.model,rayOrigin:this.displayModel[this.data.hand].rayOrigin})}},applyOffset:function(t){t.position.copy(this.displayModel[this.data.hand].modelPivotOffset),t.rotation.copy(this.displayModel[this.data.hand].modelPivotRotation)},onTouchV3orPROorPlusModelLoaded:function(t){var e=this.controllerObject3D=t.detail.model,n=this.buttonObjects={},i=this.buttonMeshes={},r=this.buttonRanges={};i.grip=e.getObjectByName("squeeze"),n.grip=e.getObjectByName("xr_standard_squeeze_pressed_value"),r.grip={min:e.getObjectByName("xr_standard_squeeze_pressed_min"),max:e.getObjectByName("xr_standard_squeeze_pressed_max")},n.grip.minX=n.grip.position.x,i.thumbstick=e.getObjectByName("thumbstick"),n.thumbstick=e.getObjectByName("xr_standard_thumbstick_pressed_value"),r.thumbstick={min:e.getObjectByName("xr_standard_thumbstick_pressed_min"),max:e.getObjectByName("xr_standard_thumbstick_pressed_max")},n.thumbstickXAxis=e.getObjectByName("xr_standard_thumbstick_xaxis_pressed_value"),r.thumbstickXAxis={min:e.getObjectByName("xr_standard_thumbstick_xaxis_pressed_min"),max:e.getObjectByName("xr_standard_thumbstick_xaxis_pressed_max")},n.thumbstickYAxis=e.getObjectByName("xr_standard_thumbstick_yaxis_pressed_value"),r.thumbstickYAxis={min:e.getObjectByName("xr_standard_thumbstick_yaxis_pressed_min"),max:e.getObjectByName("xr_standard_thumbstick_yaxis_pressed_max")},i.trigger=e.getObjectByName("trigger"),n.trigger=e.getObjectByName("xr_standard_trigger_pressed_value"),r.trigger={min:e.getObjectByName("xr_standard_trigger_pressed_min"),max:e.getObjectByName("xr_standard_trigger_pressed_max")},r.trigger.diff={x:Math.abs(r.trigger.max.rotation.x)-Math.abs(r.trigger.min.rotation.x),y:Math.abs(r.trigger.max.rotation.y)-Math.abs(r.trigger.min.rotation.y),z:Math.abs(r.trigger.max.rotation.z)-Math.abs(r.trigger.min.rotation.z)};var s="left"===this.data.hand?"x":"a",o="left"===this.data.hand?"y":"b",a=s+"button",l=o+"button";i[a]=e.getObjectByName(s+"_button"),n[a]=e.getObjectByName(s+"_button_pressed_value"),r[a]={min:e.getObjectByName(s+"_button_pressed_min"),max:e.getObjectByName(s+"_button_pressed_max")},i[l]=e.getObjectByName(o+"_button"),n[l]=e.getObjectByName(o+"_button_pressed_value"),r[l]={min:e.getObjectByName(o+"_button_pressed_min"),max:e.getObjectByName(o+"_button_pressed_max")}},onAxisMoved:function(t){ex(this,this.mapping[this.data.hand].axes,t)},onThumbstickMoved:function(t){if(this.buttonMeshes&&this.buttonMeshes.thumbstick)if(this.isTouchV3orPROorPlus)this.updateThumbstickTouchV3orPROorPlus(t);else for(var e in t.detail)this.buttonObjects.thumbstick.rotation[this.axisMap[e]]=this.buttonRanges.thumbstick.originalRotation[this.axisMap[e]]-Math.PI/8*t.detail[e]*("y"===e||"right"===this.data.hand?-1:1)},axisMap:{y:"x",x:"z"},updateThumbstickTouchV3orPROorPlus:function(t){var e=(t.detail.x+1)/2;this.buttonObjects.thumbstickXAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickXAxis.min.quaternion,this.buttonRanges.thumbstickXAxis.max.quaternion,e);var n=(t.detail.y+1)/2;this.buttonObjects.thumbstickYAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickYAxis.min.quaternion,this.buttonRanges.thumbstickYAxis.max.quaternion,n)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var n,i=this.buttonMeshes;i&&i[t]&&(n="up"===e||"touchend"===e?i[t].originalColor||this.data.buttonColor:"touchstart"===e?this.data.buttonTouchColor:this.data.buttonHighlightColor,i[t].material.color.set(n))}};function $w(t){t.traverse((function(e){var n;"Mesh"===e.type&&(n=e.material.clone(),t.originalColor=e.material.color,e.material.dispose(),e.material=n)}))}_b("oculus-touch-controls",Zw),_b("meta-touch-controls",Zw),_b("obb-collider",{schema:{size:{default:0},trackedObject3D:{default:""},minimumColliderDimension:{default:.02},centerModel:{default:!1}},init:function(){this.previousScale=(new _y.Vector3).copy(this.el.object3D.scale),this.auxEuler=new _y.Euler,this.boundingBox=new _y.Box3,this.boundingBoxSize=new _y.Vector3,this.updateCollider=this.updateCollider.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.updateBoundingBox=this.updateBoundingBox.bind(this),this.el.addEventListener("model-loaded",this.onModelLoaded),this.updateCollider(),this.system.addCollider(this.el)},remove:function(){this.system.removeCollider(this.el)},update:function(){this.data.trackedObject3D&&(this.trackedObject3DPath=this.data.trackedObject3D.split("."))},onModelLoaded:function(){this.data.centerModel&&this.centerModel(),this.updateCollider()},centerModel:function(){var t,e=this.el,n=e.components["gltf-model"]&&e.components["gltf-model"].model;n&&(this.el.removeObject3D("mesh"),t=(new _y.Box3).setFromObject(n).getCenter(new _y.Vector3),n.position.x+=n.position.x-t.x,n.position.y+=n.position.y-t.y,n.position.z+=n.position.z-t.z,this.el.setObject3D("mesh",n))},updateCollider:function(){var t=this.el,e=this.boundingBoxSize,n=this.aabb=this.aabb||new _y.OBB;this.obb=this.obb||new _y.OBB,t.hasLoaded?(this.updateBoundingBox(),n.halfSize.copy(e).multiplyScalar(.5),this.el.sceneEl.systems["obb-collider"].data.showColliders&&this.showCollider()):t.addEventListener("loaded",this.updateCollider)},showCollider:function(){this.updateColliderMesh(),this.renderColliderMesh.visible=!0},updateColliderMesh:function(){var t=this.renderColliderMesh,e=this.boundingBoxSize;t?(t.geometry.dispose(),t.geometry=new _y.BoxGeometry(e.x,e.y,e.z)):this.initColliderMesh()},hideCollider:function(){this.renderColliderMesh&&(this.renderColliderMesh.visible=!1)},initColliderMesh:function(){var t,e,n;t=this.boundingBoxSize,e=this.renderColliderGeometry=new _y.BoxGeometry(t.x,t.y,t.z),(n=this.renderColliderMesh=new _y.Mesh(e,new _y.MeshLambertMaterial({color:65280,side:_y.DoubleSide}))).matrixAutoUpdate=!1,n.matrixWorldAutoUpdate=!1,n.updateMatrixWorld=function(){},this.el.sceneEl.object3D.add(n)},updateBoundingBox:(Gw=new _y.Vector3,zw=new _y.Vector3,Hw=new _y.Quaternion,Vw=new _y.Quaternion,jw=new _y.Matrix4,function(){var t=this.auxEuler,e=this.boundingBox,n=this.data.size,i=this.trackedObject3D||this.el.object3D,r=this.boundingBoxSize,s=this.data.minimumColliderDimension;if(n)return this.boundingBoxSize.x=n,this.boundingBoxSize.y=n,void(this.boundingBoxSize.z=n);t.copy(i.rotation),i.rotation.set(0,0,0),i.parent.matrixWorld.decompose(Gw,Hw,zw),jw.compose(Gw,Vw,zw),i.parent.matrixWorld.copy(jw),e.setFromObject(i,!0),e.getSize(r),r.x=r.x<s?s:r.x,r.y=r.y<s?s:r.y,r.z=r.z<s?s:r.z,i.parent.matrixWorld.compose(Gw,Hw,zw),this.el.object3D.rotation.copy(t)}),checkTrackedObject:function(){var t,e=this.trackedObject3DPath;if(e&&e.length&&!this.trackedObject3D){t=this.el;for(var n=0;n<e.length&&(t=t[e[n]]);n++);t&&(this.trackedObject3D=t,this.updateCollider())}return this.trackedObject3D},tick:function(){var t=new _y.Vector3,e=new _y.Vector3,n=new _y.Quaternion,i=new _y.Matrix4;return function(){var r=this.obb,s=this.renderColliderMesh,o=this.checkTrackedObject()||this.el.object3D;o&&(o.updateMatrix(),o.updateMatrixWorld(!0),o.matrixWorld.decompose(t,n,e),(Math.abs(e.x-this.previousScale.x)>1e-4||Math.abs(e.y-this.previousScale.y)>1e-4||Math.abs(e.z-this.previousScale.z)>1e-4)&&this.updateCollider(),this.previousScale.copy(e),e.set(1,1,1),i.compose(t,n,e),s&&s.matrixWorld.copy(i),r.copy(this.aabb),r.applyMatrix4(i))}}()});var t_=Ly("components:obj-model:warn"),e_=(_b("obj-model",{schema:{mtl:{type:"model"},obj:{type:"model"}},init:function(){var t=this;this.model=null,this.objLoader=new _y.OBJLoader,this.mtlLoader=new _y.MTLLoader(this.objLoader.manager),this.mtlLoader.crossOrigin="",this.el.addEventListener("componentinitialized",(function(e){t.model&&"material"===e.detail.name&&t.applyMaterial()}))},update:function(){var t=this.data;t.obj&&(this.resetMesh(),this.loadObj(t.obj,t.mtl))},remove:function(){this.resetMesh()},resetMesh:function(){this.model&&this.el.removeObject3D("mesh")},loadObj:function(t,e){var n=this,i=this.el,r=this.mtlLoader,s=this.objLoader,o=this.el.sceneEl.systems.renderer,a=e.substr(0,e.lastIndexOf("/")+1);if(e)return i.hasAttribute("material")&&t_("Material component properties are ignored when a .MTL is provided"),r.setResourcePath(a),void r.load(e,(function(e){e.preload(),s.setMaterials(e),s.load(t,(function(t){n.model=t,n.model.traverse((function(t){if(t.isMesh){var e=t.material;e.map&&o.applyColorCorrection(e.map),e.emissiveMap&&o.applyColorCorrection(e.emissiveMap)}})),i.setObject3D("mesh",t),i.emit("model-loaded",{format:"obj",model:t})}))}));s.load(t,(function(t){n.model=t,n.applyMaterial(),i.setObject3D("mesh",t),i.emit("model-loaded",{format:"obj",model:t})}))},applyMaterial:function(){var t=this.el.components.material;t&&this.model.traverse((function(e){e instanceof _y.Mesh&&(e.material=t.material)}))}}),My+"controllers/oculus/go/oculus-go-controller.gltf"),n_="oculus-go",i_=(_b("oculus-go-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#FFFFFF"},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad"]},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.bindMethods()},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){ZE(this,n_,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{hand:e.hand,idPrefix:n_}),this.data.model&&this.el.setAttribute("gltf-model",e_)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(t){var e,n=t.detail.model;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).trigger=n.getObjectByName("oculus_go_button_trigger"),e.trackpad=n.getObjectByName("oculus_go_touchpad"),e.touchpad=n.getObjectByName("oculus_go_touchpad"))},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var n=this.buttonMeshes;if(n&&n[t]){var i;switch(e){case"down":i=this.data.buttonHighlightColor;break;case"touchstart":i=this.data.buttonTouchedColor;break;default:i=this.data.buttonColor}n[t].material.color.set(i)}}}),"pico-4"),r_=My+"controllers/pico/pico4/",s_=(_b("pico-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){nx(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t,t.data.hand)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t,t.data.hand)},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;ZE(this,i_,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:i_,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",r_+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping[this.data.hand].buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){t.target===this.el&&this.data.model&&this.el.emit("controllermodelready",{name:"pico-controls",model:this.data.model,rayOrigin:new _y.Vector3(0,0,0)})},onAxisMoved:function(t){ex(this,this.mapping[this.data.hand].axes,t)}}),_b("position",{schema:{type:"vec3"},update:function(){var t=this.el.object3D,e=this.data;t.position.set(e.x,e.y,e.z)},remove:function(){this.el.object3D.position.set(0,0,0)}}),Ly("components:raycaster:warn")),o_=/^[\w\s-.,[\]#]*$/,a_={childList:!0,attributes:!0,subtree:!0},l_="raycaster-intersected-cleared",c_="raycaster-intersection-cleared";function h_(t,e){var n;for(t.length=e.length,n=0;n<e.length;n++)t[n]=e[n]}_b("raycaster",{schema:{autoRefresh:{default:!0},direction:{type:"vec3",default:{x:0,y:0,z:-1}},enabled:{default:!0},far:{default:1e3},interval:{default:0},near:{default:0},objects:{default:""},origin:{type:"vec3"},showLine:{default:!1},lineColor:{default:"white"},lineOpacity:{default:1},useWorldCoordinates:{default:!1}},multiple:!0,init:function(){this.clearedIntersectedEls=[],this.unitLineEndVec3=new _y.Vector3,this.intersectedEls=[],this.intersections=[],this.newIntersectedEls=[],this.newIntersections=[],this.objects=[],this.prevCheckTime=void 0,this.prevIntersectedEls=[],this.rawIntersections=[],this.raycaster=new _y.Raycaster,this.updateOriginDirection(),this.setDirty=this.setDirty.bind(this),this.updateLine=this.updateLine.bind(this),this.observer=new MutationObserver(this.setDirty),this.dirty=!0,this.lineEndVec3=new _y.Vector3,this.otherLineEndVec3=new _y.Vector3,this.lineData={end:this.lineEndVec3},this.getIntersection=this.getIntersection.bind(this),this.intersectedDetail={el:this.el,getIntersection:this.getIntersection},this.intersectedClearedDetail={el:this.el},this.intersectionClearedDetail={clearedEls:this.clearedIntersectedEls},this.intersectionDetail={}},update:function(t){var e=this.data,n=this.el,i=this.raycaster;i.far=e.far,i.near=e.near,!e.showLine||e.far===t.far&&e.origin===t.origin&&e.direction===t.direction&&t.showLine||(this.unitLineEndVec3.copy(e.direction).normalize(),this.drawLine()),!e.showLine&&t.showLine&&n.removeAttribute("line"),e.objects===t.objects||o_.test(e.objects)||s_('[raycaster] Selector "'+e.objects+'" may not update automatically with DOM changes.'),e.objects||s_('[raycaster] For performance, please define raycaster.objects when using raycaster or cursor components to whitelist which entities to intersect with. e.g., raycaster="objects: [data-raycastable]".'),e.autoRefresh!==t.autoRefresh&&n.isPlaying&&(e.autoRefresh?this.addEventListeners():this.removeEventListeners()),t.enabled&&!e.enabled&&this.clearAllIntersections(),e.objects!==t.objects&&this.setDirty()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){this.data.showLine&&this.el.removeAttribute("line"),this.clearAllIntersections()},addEventListeners:function(){this.data.autoRefresh&&(this.observer.observe(this.el.sceneEl,a_),this.el.sceneEl.addEventListener("object3dset",this.setDirty),this.el.sceneEl.addEventListener("object3dremove",this.setDirty))},removeEventListeners:function(){this.observer.disconnect(),this.el.sceneEl.removeEventListener("object3dset",this.setDirty),this.el.sceneEl.removeEventListener("object3dremove",this.setDirty)},setDirty:function(){this.dirty=!0},refreshObjects:function(){var t,e=this.data;t=e.objects?this.el.sceneEl.querySelectorAll(e.objects):this.el.sceneEl.querySelectorAll("*"),this.objects=this.flattenObject3DMaps(t),this.dirty=!1},tock:function(t){var e=this.data,n=this.prevCheckTime;e.enabled&&(n&&t-n<e.interval||(this.prevCheckTime=t,this.checkIntersections()))},checkIntersections:function(){var t,e,n=this.clearedIntersectedEls,i=this.el,r=this.data,s=this.intersectedEls,o=this.intersections,a=this.newIntersectedEls,l=this.newIntersections,c=this.prevIntersectedEls,h=this.rawIntersections;for(this.dirty&&this.refreshObjects(),h_(this.prevIntersectedEls,this.intersectedEls),this.updateOriginDirection(),h.length=0,this.raycaster.intersectObjects(this.objects,!0,h),o.length=0,s.length=0,t=0;t<h.length;t++)e=h[t],r.showLine&&e.object===i.getObject3D("line")||e.object.el&&(o.push(e),s.push(e.object.el));for(l.length=0,a.length=0,t=0;t<o.length;t++)-1===c.indexOf(o[t].object.el)&&(l.push(o[t]),a.push(o[t].object.el));for(n.length=0,t=0;t<c.length;t++)-1===s.indexOf(c[t])&&(c[t].emit(l_,this.intersectedClearedDetail),n.push(c[t]));for(n.length&&i.emit(c_,this.intersectionClearedDetail),t=0;t<a.length;t++)a[t].emit("raycaster-intersected",this.intersectedDetail);l.length&&(this.intersectionDetail.els=a,this.intersectionDetail.intersections=l,i.emit("raycaster-intersection",this.intersectionDetail)),(0===c.length&&o.length>0||c.length>0&&0===o.length||c.length&&o.length&&c[0]!==o[0].object.el)&&(this.intersectionDetail.els=this.intersectedEls,this.intersectionDetail.intersections=o,i.emit("raycaster-closest-entity-changed",this.intersectionDetail)),r.showLine&&setTimeout(this.updateLine)},updateLine:function(){var t,e=this.el,n=this.intersections;n.length&&(t=n[0].object.el===e&&n[1]?n[1].distance:n[0].distance),this.drawLine(t)},getIntersection:function(t){var e,n;for(e=0;e<this.intersections.length;e++)if((n=this.intersections[e]).object.el===t)return n;return null},updateOriginDirection:function(){var t=new _y.Vector3,e=new _y.Vector3;return function(){var n=this.el,i=this.data;i.useWorldCoordinates?this.raycaster.set(i.origin,i.direction):(n.object3D.updateMatrixWorld(),e.setFromMatrixPosition(n.object3D.matrixWorld),0===i.origin.x&&0===i.origin.y&&0===i.origin.z||(e=n.object3D.localToWorld(e.copy(i.origin))),t.copy(i.direction).transformDirection(n.object3D.matrixWorld).normalize(),this.raycaster.set(e,t))}}(),drawLine:function(t){var e,n=this.data,i=this.el;e=this.lineData.end===this.lineEndVec3?this.otherLineEndVec3:this.lineEndVec3,void 0===t&&(t=n.far===1/0?1e3:n.far),this.lineData.start=n.origin,this.lineData.end=e.copy(this.unitLineEndVec3).multiplyScalar(t).add(n.origin),this.lineData.color=n.lineColor,this.lineData.opacity=n.lineOpacity,i.setAttribute("line",this.lineData)},flattenObject3DMaps:function(t){var e,n,i=this.objects,r=this.el.sceneEl.object3D;function s(t){return t.parent?s(t.parent):t===r}for(i.length=0,n=0;n<t.length;n++){var o=t[n];if(o.isEntity&&o.object3D&&s(o.object3D))for(e in o.object3DMap)i.push(o.getObject3D(e))}return i},clearAllIntersections:function(){var t;for(t=0;t<this.intersectedEls.length;t++)this.intersectedEls[t].emit(l_,this.intersectedClearedDetail);h_(this.clearedIntersectedEls,this.intersectedEls),this.intersectedEls.length=0,this.intersections.length=0,this.el.emit(c_,this.intersectionClearedDetail)}});var u_,d_,p_,A_,f_=_y.MathUtils.degToRad,m_=(_b("rotation",{schema:{type:"vec3"},update:function(){var t=this.data;this.el.object3D.rotation.set(f_(t.x),f_(t.y),f_(t.z),"YXZ")},remove:function(){this.el.object3D.rotation.set(0,0,0)}}),_b("scale",{schema:{type:"vec3",default:{x:1,y:1,z:1}},update:function(){var t=this.data;this.el.object3D.scale.set(t.x,t.y,t.z)},remove:function(){this.el.object3D.scale.set(1,1,1)}}),_b("shadow",{schema:{cast:{default:!0},receive:{default:!0}},init:function(){this.onMeshChanged=this.update.bind(this),this.el.addEventListener("object3dset",this.onMeshChanged),this.system.setShadowMapEnabled(!0)},update:function(){var t=this.data;this.updateDescendants(t.cast,t.receive)},remove:function(){this.el.removeEventListener("object3dset",this.onMeshChanged),this.updateDescendants(!1,!1)},updateDescendants:function(t,e){var n=this.el.sceneEl;this.el.object3D.traverse((function(i){if(i instanceof _y.Mesh&&(i.castShadow=t,i.receiveShadow=e,n.hasLoaded&&i.material))for(var r=Array.isArray(i.material)?i.material:[i.material],s=0;s<r.length;s++)r[s].needsUpdate=!0}))}}),Ly("components:sound:warn")),g_=(_b("sound",{schema:{autoplay:{default:!1},distanceModel:{default:"inverse",oneOf:["linear","inverse","exponential"]},loop:{default:!1},loopStart:{default:0},loopEnd:{default:0},maxDistance:{default:1e4},on:{default:""},poolSize:{default:1},positional:{default:!0},refDistance:{default:1},rolloffFactor:{default:1},src:{type:"audio"},volume:{default:1}},multiple:!0,init:function(){var t=this;this.listener=null,this.audioLoader=new _y.AudioLoader,this.pool=new _y.Group,this.loaded=!1,this.mustPlay=!1,this.playSoundBound=function(){t.playSound()}},update:function(t){var e,n,i=this.data,r=i.src!==t.src;if(r){if(!i.src)return;this.setupSound()}for(e=0;e<this.pool.children.length;e++)n=this.pool.children[e],i.positional&&(n.setDistanceModel(i.distanceModel),n.setMaxDistance(i.maxDistance),n.setRefDistance(i.refDistance),n.setRolloffFactor(i.rolloffFactor)),n.setLoop(i.loop),n.setLoopStart(i.loopStart),0!==i.loopStart&&0===i.loopEnd?n.setLoopEnd(n.buffer.duration):n.setLoopEnd(i.loopEnd),n.setVolume(i.volume),n.isPaused=!1;if(i.on!==t.on&&this.updateEventListener(t.on),r){var s=this;this.loaded=!1,this.audioLoader.load(i.src,(function(t){for(e=0;e<s.pool.children.length;e++)(n=s.pool.children[e]).setBuffer(t);s.loaded=!0,_y.Cache.remove(i.src),(s.data.autoplay||s.mustPlay)&&s.playSound(s.processSound),s.el.emit("sound-loaded",s.evtDetail,!1)}))}},pause:function(){this.stopSound(),this.removeEventListener()},play:function(){this.data.autoplay&&this.playSound(),this.updateEventListener()},remove:function(){var t;this.removeEventListener(),this.el.getObject3D(this.attrName)&&this.el.removeObject3D(this.attrName);try{for(t=0;t<this.pool.children.length;t++)this.pool.children[t].disconnect()}catch(t){m_("Audio source not properly disconnected")}},updateEventListener:function(t){var e=this.el;t&&e.removeEventListener(t,this.playSoundBound),e.addEventListener(this.data.on,this.playSoundBound)},removeEventListener:function(){this.el.removeEventListener(this.data.on,this.playSoundBound)},setupSound:function(){var t,e,n=this.el,i=n.sceneEl,r=this;this.pool.children.length>0&&(this.stopSound(),n.removeObject3D("sound"));var s=this.listener=i.audioListener||new _y.AudioListener;for(i.audioListener=s,i.camera&&i.camera.add(s),i.addEventListener("camera-set-active",(function(t){t.detail.cameraEl.getObject3D("camera").add(s)})),this.pool=new _y.Group,t=0;t<this.data.poolSize;t++)e=this.data.positional?new _y.PositionalAudio(s):new _y.Audio(s),this.pool.add(e);for(n.setObject3D(this.attrName,this.pool),t=0;t<this.pool.children.length;t++)(e=this.pool.children[t]).onEnded=function(){this.isPlaying=!1,r.el.emit("sound-ended",r.evtDetail,!1)}},pauseSound:function(){var t,e;for(this.isPlaying=!1,t=0;t<this.pool.children.length;t++)(e=this.pool.children[t]).source&&e.source.buffer&&e.isPlaying&&!e.isPaused&&(e.isPaused=!0,e.pause())},playSound:function(t){var e,n,i;if(!this.loaded)return m_("Sound not loaded yet. It will be played once it finished loading"),this.mustPlay=!0,void(this.processSound=t);for(e=!1,this.isPlaying=!0,n=0;n<this.pool.children.length;n++)(i=this.pool.children[n]).isPlaying||!i.buffer||e||(t&&t(i),i.play(),i.isPaused=!1,e=!0);e?(this.mustPlay=!1,this.processSound=void 0):m_("All the sounds are playing. If you need to play more sounds simultaneously consider increasing the size of pool with the `poolSize` attribute.",this.el)},stopSound:function(){var t,e;for(this.isPlaying=!1,t=0;t<this.pool.children.length;t++){if(!(e=this.pool.children[t]).source||!e.source.buffer)return;e.stop()}}}),n(4433)),v_=n.n(g_),y_=n(5751),E_=n.n(y_),x_=Ly("components:text:error"),b_=Ly("components:text:warn"),C_=My+"fonts/",w_={aileronsemibold:C_+"Aileron-Semibold.fnt",dejavu:C_+"DejaVu-sdf.fnt",exo2bold:C_+"Exo2Bold.fnt",exo2semibold:C_+"Exo2SemiBold.fnt",kelsonsans:C_+"KelsonSans.fnt",monoid:C_+"Monoid.fnt",mozillavr:C_+"mozillavr.fnt",roboto:C_+"Roboto-msdf.json",sourcecodepro:C_+"SourceCodePro.fnt"},__=["roboto"],M_="roboto",S_=new function(){var t=this.cache={};this.get=function(e,n){return e in t||(t[e]=n()),t[e]}},I_={},B_={},T_=/^\w+:/;function R_(t,e,n){return t||(.5+e)*n}_b("text",{multiple:!0,schema:{align:{type:"string",default:"left",oneOf:["left","right","center"]},alphaTest:{default:.5},anchor:{default:"center",oneOf:["left","right","center","align"]},baseline:{default:"center",oneOf:["top","center","bottom"]},color:{type:"color",default:"#FFF"},font:{type:"string",default:M_},fontImage:{type:"string"},height:{type:"number"},letterSpacing:{type:"number",default:0},lineHeight:{type:"number"},negate:{type:"boolean",default:!0},opacity:{type:"number",default:1},shader:{default:"sdf",oneOf:AC},side:{default:"front",oneOf:["front","back","double"]},tabSize:{default:4},transparent:{default:!0},value:{type:"string"},whiteSpace:{default:"normal",oneOf:["normal","pre","nowrap"]},width:{type:"number"},wrapCount:{type:"number",default:40},wrapPixels:{type:"number"},xOffset:{type:"number",default:0},yOffset:{type:"number",default:0},zOffset:{type:"number",default:.001}},init:function(){this.shaderData={},this.geometry=v_()(),this.createOrUpdateMaterial(),this.explicitGeoDimensionsChecked=!1},update:function(t){var e=this.data,n=this.currentFont;B_[e.font]?this.texture=B_[e.font]:(this.texture=B_[e.font]=new _y.Texture,this.texture.anisotropy=16),this.createOrUpdateMaterial(),t.font===e.font?n&&(this.updateGeometry(this.geometry,n),this.updateLayout()):this.updateFont()},remove:function(){this.geometry.dispose(),this.geometry=null,this.el.removeObject3D(this.attrName),this.material.dispose(),this.material=null,this.texture.dispose(),this.texture=null,this.shaderObject&&delete this.shaderObject},createOrUpdateMaterial:function(){var t,e,n,i=this.data,r=this.material,s=this.shaderData;if(n=i.shader,-1!==__.indexOf(i.font)||i.font.indexOf("-msdf.")>=0?n="msdf":i.font in w_&&-1===__.indexOf(i.font)&&(n="sdf"),t=(this.shaderObject&&this.shaderObject.name)!==n,s.alphaTest=i.alphaTest,s.color=i.color,s.map=this.texture,s.opacity=i.opacity,s.side=function(t){switch(t){case"back":return _y.FrontSide;case"double":return _y.DoubleSide;default:return _y.BackSide}}(i.side),s.transparent=i.transparent,s.negate=i.negate,!t)return this.shaderObject.update(s),r.transparent=s.transparent,void(r.side=s.side);e=function(t,e,n){var i,r;return(r=new AC[e].Shader).el=t,r.init(n),r.update(n),(i=r.material).transparent=n.transparent,{material:i,shader:r}}(this.el,n,s),this.material=e.material,this.shaderObject=e.shader,this.material.side=s.side,this.mesh&&(this.mesh.material=this.material)},updateFont:function(){var t,e=this.data,n=this.el,i=this.geometry,r=this;e.font||b_("No font specified. Using the default font."),this.mesh&&(this.mesh.visible=!1),t=this.lookupFont(e.font||M_)||e.font,S_.get(t,(function(){return function(t,e){return new Promise((function(n,i){E_()(t,(function(r,s){if(r)return x_("Error loading font",t),void i(r);t.indexOf("/Roboto-msdf.json")>=0&&(e=30),e&&s.chars.forEach((function(t){t.yoffset+=e})),n(s)}))}))}(t,e.yOffset)})).then((function(s){var o;if(1!==s.pages.length)throw new Error("Currently only single-page bitmap fonts are supported.");I_[t]||(s.widthFactor=I_[s]=function(t){var e=0,n=0,i=0;return t.chars.forEach((function(t){e+=t.xadvance,t.id>=48&&t.id<=57&&(i++,n+=t.xadvance)})),i?n/i:e/t.chars.length}(s)),r.currentFont=s,o=r.getFontImageSrc(),S_.get(o,(function(){return function(t){return new Promise((function(e,n){(new _y.ImageLoader).load(t,(function(t){e(t)}),void 0,(function(){x_("Error loading font image",t),n(null)}))}))}(o)})).then((function(t){var o=r.texture;o&&(o.image=t,o.needsUpdate=!0,B_[e.font]=o,r.texture=o,r.initMesh(),r.currentFont=s,r.updateGeometry(i,s),r.updateLayout(),r.mesh.visible=!0,n.emit("textfontset",{font:e.font,fontObj:s}))})).catch((function(t){x_(t.message),x_(t.stack)}))})).catch((function(t){x_(t.message),x_(t.stack)}))},initMesh:function(){this.mesh||(this.mesh=new _y.Mesh(this.geometry,this.material),this.el.setObject3D(this.attrName,this.mesh))},getFontImageSrc:function(){if(this.data.fontImage)return this.data.fontImage;var t=this.lookupFont(this.data.font||M_)||this.data.font,e=this.currentFont.pages[0];return e.match(T_)&&0!==e.indexOf("http")?t.replace(/(\.fnt)|(\.json)/,".png"):_y.LoaderUtils.extractUrlBase(t)+e},updateLayout:function(){var t,e,n,i,r,s,o,a,l,c=this.el,h=this.data,u=this.geometry,d=this.mesh;if(d&&u.layout){if(n=c.getAttribute("geometry"),i=(s=(o=h.width||n&&n.width||1)/R_(h.wrapPixels,h.wrapCount,this.currentFont.widthFactor))*((r=u.layout).height+r.descender),n&&"plane"===n.primitive&&(this.explicitGeoDimensionsChecked||(this.explicitGeoDimensionsChecked=!0,this.hasExplicitGeoWidth=!!n.width,this.hasExplicitGeoHeight=!!n.height),this.hasExplicitGeoWidth||c.setAttribute("geometry","width",o),this.hasExplicitGeoHeight||c.setAttribute("geometry","height",i)),"left"===(t="align"===h.anchor?h.align:h.anchor))a=0;else if("right"===t)a=-1*r.width;else{if("center"!==t)throw new TypeError("Invalid text.anchor property value",t);a=-1*r.width/2}if("bottom"===(e=h.baseline))l=0;else if("top"===e)l=-1*r.height+r.ascender;else{if("center"!==e)throw new TypeError("Invalid text.baseline property value",e);l=-1*r.height/2}d.position.x=a*s+h.xOffset,d.position.y=l*s,d.position.z=h.zOffset,d.scale.set(s,-1*s,s)}},lookupFont:function(t){return w_[t]},updateGeometry:(u_={},d_={},p_=/\\n/g,A_=/\\t/g,function(t,e){var n=this.data;d_.font=e,d_.lineHeight=n.lineHeight&&isFinite(n.lineHeight)?n.lineHeight:e.common.lineHeight,d_.text=n.value.toString().replace(p_,"\n").replace(A_,"\t"),d_.width=R_(n.wrapPixels,n.wrapCount,e.widthFactor),t.update(dx(u_,n,d_))})});var L_,D_,P_=(_b("tracked-controls",{schema:{id:{type:"string",default:""},controller:{default:-1},autoHide:{default:!0},hand:{type:"string",default:""},handTrackingEnabled:{default:!1},iterateControllerProfiles:{default:!1}},init:function(){this.buttonEventDetails={},this.buttonStates=this.el.components["tracked-controls"].buttonStates={},this.axis=this.el.components["tracked-controls"].axis=[0,0,0],this.changedAxes=[],this.axisMoveEventDetail={axis:this.axis,changed:this.changedAxes},this.updateController=this.updateController.bind(this)},update:function(){this.updateController()},play:function(){var t=this.el.sceneEl;this.updateController(),t.addEventListener("controllersupdated",this.updateController)},pause:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.updateController)},isControllerPresent:function(t){return!(!this.controller||this.controller.gamepad||"none"!==t.inputSource.handedness&&t.inputSource.handedness!==this.data.hand)},updateController:function(){this.controller=tx(this.system.controllers,this.data.id,this.data.hand,this.data.controller,this.data.iterateControllerProfiles,this.data.handTrackingEnabled),this.el.components["tracked-controls"].controller=this.controller},tick:function(){var t=this.el.sceneEl,e=this.controller,n=t.frame;this.data.autoHide&&(this.el.object3D.visible=!!e),e&&t.frame&&this.system.referenceSpace&&(e.hand||(this.pose=n.getPose(e.gripSpace,this.system.referenceSpace),this.updatePose(),this.updateButtons()))},updatePose:function(){var t=this.el.object3D,e=this.pose;e&&(t.matrix.elements=e.transform.matrix,t.matrix.decompose(t.position,t.rotation,t.scale))},updateButtons:function(){var t,e,n,i=this.controller;if(i&&i.gamepad){for(n=i.gamepad,e=0;e<n.buttons.length;++e)this.buttonStates[e]||(this.buttonStates[e]={pressed:!1,touched:!1,value:0}),this.buttonEventDetails[e]||(this.buttonEventDetails[e]={id:e,state:this.buttonStates[e]}),t=n.buttons[e],this.handleButton(e,t);this.handleAxes()}},handleButton:function(t,e){return!!(this.handlePress(t,e)|this.handleTouch(t,e)|this.handleValue(t,e))&&(this.el.emit("buttonchanged",this.buttonEventDetails[t],!1),!0)},handleAxes:function(){var t,e=!1,n=this.controller.gamepad.axes,i=this.axis,r=this.changedAxes;for(this.changedAxes.splice(0,this.changedAxes.length),t=0;t<n.length;++t)r.push(i[t]!==n[t]),r[t]&&(e=!0);if(!e)return!1;for(this.axis.splice(0,this.axis.length),t=0;t<n.length;t++)this.axis.push(n[t]);return this.el.emit("axismove",this.axisMoveEventDetail,!1),!0},handlePress:function(t,e){var n,i=this.buttonStates[t];return e.pressed!==i.pressed&&(n=e.pressed?"buttondown":"buttonup",this.el.emit(n,this.buttonEventDetails[t],!1),i.pressed=e.pressed,!0)},handleTouch:function(t,e){var n,i=this.buttonStates[t];return e.touched!==i.touched&&(n=e.touched?"touchstart":"touchend",this.el.emit(n,this.buttonEventDetails[t],!1),i.touched=e.touched,!0)},handleValue:function(t,e){var n=this.buttonStates[t];return e.value!==n.value&&(n.value=e.value,!0)}}),_b("visible",{schema:{default:!0},update:function(){this.el.object3D.visible=this.data}}),My+"controllers/valve/index/valve-index-"),U_={left:P_+"left.glb",right:P_+"right.glb"},O_="valve",F_={left:{x:0,y:-.05,z:.06},right:{x:0,y:-.05,z:.06}},k_={left:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"},right:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"}},N_=(_b("valve-index-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{trackpad:[0,1],thumbstick:[2,3]},buttons:["trigger","grip","trackpad","thumbstick","abutton"]},init:function(){var t=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.previousButtonValues={},this.bindMethods()},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data,e="right"===t.hand?0:"left"===t.hand?1:2;ZE(this,O_,{index:e,iterateControllerProfiles:!0,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:O_,controller:"right"===e.hand?1:"left"===e.hand?0:2,hand:e.hand}),this.loadModel()},loadModel:function(){var t=this.data;t.model&&this.el.setAttribute("gltf-model",""+U_[t.hand])},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping.buttons[t.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(e=t.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=this.triggerOriginalRotationX-e*(Math.PI/40))),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){var e,n=t.detail.model,i=this;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},e.menu=n.getObjectByName("menubutton"),e.system=n.getObjectByName("systembutton"),e.trackpad=n.getObjectByName("touchpad"),e.trigger=n.getObjectByName("trigger"),this.triggerOriginalRotationX=e.trigger.rotation.x,Object.keys(e).forEach((function(t){i.setButtonColor(t,i.data.buttonColor)})),n.position.copy(k_[this.data.hand]),n.rotation.copy(F_[this.data.hand]),this.el.emit("controllermodelready",{name:"valve-index-controls",model:this.data.model,rayOrigin:new _y.Vector3(0,0,0)}))},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},updateModel:function(t,e){var n;this.data.model&&(-1!==e.indexOf("touch")||(n="up"===e?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(t,n)))},setButtonColor:function(t,e){}}),My+"controllers/vive/vr_controller_vive.obj"),Q_=My+"controllers/vive/vr_controller_vive.mtl",G_="htc-vive",z_=(_b("vive-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","none"]},init:function(){var t=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.previousButtonValues={},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;ZE(this,G_,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:G_,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("obj-model",{obj:N_,mtl:Q_})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping.buttons[t.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(e=t.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=-e*(Math.PI/12))),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){var e,n=t.detail.model,i=this;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},e.menu=n.getObjectByName("menubutton"),e.system=n.getObjectByName("systembutton"),e.trackpad=n.getObjectByName("touchpad"),e.touchpad=n.getObjectByName("touchpad"),e.trigger=n.getObjectByName("trigger"),Object.keys(e).forEach((function(t){i.setButtonColor(t,i.data.buttonColor)})),n.position.set(0,-.015,.04))},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},updateModel:function(t,e){var n;this.data.model&&(-1!==e.indexOf("touch")||(n="up"===e?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(t,n)))},setButtonColor:function(t,e){var n=this.buttonMeshes;if(n)return"grip"===t?(n.grip.left.material.color.set(e),void n.grip.right.material.color.set(e)):void n[t].material.color.set(e)}}),My+"controllers/vive/focus-controller/focus-controller.gltf"),H_="htc-vive-focus",V_=(_b("vive-focus-controls",{schema:{hand:{default:""},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad","none","menu"]},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.bindMethods()},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0,this.addControllersUpdateListener()},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1,this.removeControllersUpdateListener()},checkIfControllerPresent:function(){ZE(this,H_,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){this.el.setAttribute("tracked-controls",{idPrefix:H_}),this.data.model&&this.el.setAttribute("gltf-model",z_)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(t){var e,n=t.detail.model;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).trigger=n.getObjectByName("BumperKey"),e.triggerPressed=n.getObjectByName("BumperKey_Press"),e.triggerPressed&&(e.triggerPressed.visible=!1),e.touchpad=n.getObjectByName("TouchPad"),e.touchpadPressed=n.getObjectByName("TouchPad_Press"),e.trackpad=n.getObjectByName("TouchPad"),e.trackpadPressed=n.getObjectByName("TouchPad_Press"),e.trackpadPressed&&(e.trackpadPressed.visible=!1))},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var n=this.buttonMeshes,i=t+"Pressed";if(n&&n[t]&&n[i]){var r;switch(e){case"down":r=this.data.buttonHighlightColor;break;case"touchstart":r=this.data.buttonTouchedColor}r&&n[i].material.color.set(r),n[i].visible=!!r,n[t].visible=!r}}}),{38:"ArrowUp",37:"ArrowLeft",40:"ArrowDown",39:"ArrowRight",87:"KeyW",65:"KeyA",83:"KeyS",68:"KeyD"}),j_=yx,W_=1e-5,q_=["KeyW","KeyA","KeyS","KeyD","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"];_b("wasd-controls",{schema:{acceleration:{default:65},adAxis:{default:"x",oneOf:["x","y","z"]},adEnabled:{default:!0},adInverted:{default:!1},enabled:{default:!0},fly:{default:!1},wsAxis:{default:"z",oneOf:["x","y","z"]},wsEnabled:{default:!0},wsInverted:{default:!1}},after:["look-controls"],init:function(){this.keys={},this.easing=1.1,this.velocity=new _y.Vector3,this.onBlur=this.onBlur.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.onFocus=this.onFocus.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.attachVisibilityEventListeners()},tick:function(t,e){var n=this.data,i=this.el,r=this.velocity;(r[n.adAxis]||r[n.wsAxis]||!function(t){var e;for(e in t)return!1;return!0}(this.keys))&&(e/=1e3,this.updateVelocity(e),(r[n.adAxis]||r[n.wsAxis])&&i.object3D.position.add(this.getMovementVector(e)))},update:function(t){t.adAxis!==this.data.adAxis&&(this.velocity[t.adAxis]=0),t.wsAxis!==this.data.wsAxis&&(this.velocity[t.wsAxis]=0)},remove:function(){this.removeKeyEventListeners(),this.removeVisibilityEventListeners()},play:function(){this.attachKeyEventListeners()},pause:function(){this.keys={},this.removeKeyEventListeners()},updateVelocity:function(t){var e,n,i,r,s,o=this.data,a=this.keys,l=this.velocity;if(n=o.adAxis,r=o.wsAxis,t>.2)return l[n]=0,void(l[r]=0);var c=Math.pow(1/this.easing,60*t);0!==l[n]&&(l[n]=l[n]*c),0!==l[r]&&(l[r]=l[r]*c),Math.abs(l[n])<W_&&(l[n]=0),Math.abs(l[r])<W_&&(l[r]=0),o.enabled&&(e=o.acceleration,o.adEnabled&&(i=o.adInverted?-1:1,(a.KeyA||a.ArrowLeft)&&(l[n]-=i*e*t),(a.KeyD||a.ArrowRight)&&(l[n]+=i*e*t)),o.wsEnabled&&(s=o.wsInverted?-1:1,(a.KeyW||a.ArrowUp)&&(l[r]-=s*e*t),(a.KeyS||a.ArrowDown)&&(l[r]+=s*e*t)))},getMovementVector:(L_=new _y.Vector3(0,0,0),D_=new _y.Euler(0,0,0,"YXZ"),function(t){var e,n=this.el.getAttribute("rotation"),i=this.velocity;return L_.copy(i),L_.multiplyScalar(t),n?(e=this.data.fly?n.x:0,D_.set(_y.MathUtils.degToRad(e),_y.MathUtils.degToRad(n.y),0),L_.applyEuler(D_),L_):L_}),attachVisibilityEventListeners:function(){window.oncontextmenu=this.onContextMenu,window.addEventListener("blur",this.onBlur),window.addEventListener("focus",this.onFocus),document.addEventListener("visibilitychange",this.onVisibilityChange)},removeVisibilityEventListeners:function(){window.removeEventListener("blur",this.onBlur),window.removeEventListener("focus",this.onFocus),document.removeEventListener("visibilitychange",this.onVisibilityChange)},attachKeyEventListeners:function(){window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp)},removeKeyEventListeners:function(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp)},onContextMenu:function(){for(var t=Object.keys(this.keys),e=0;e<t.length;e++)delete this.keys[t[e]]},onBlur:function(){this.pause()},onFocus:function(){this.play()},onVisibilityChange:function(){document.hidden?this.onBlur():this.onFocus()},onKeyDown:function(t){var e;j_(t)&&(e=t.code||V_[t.keyCode],-1!==q_.indexOf(e)&&(this.keys[e]=!0))},onKeyUp:function(t){var e;e=t.code||V_[t.keyCode],delete this.keys[e]}});var X_,Y_,J_,K_=Ly("components:windows-motion-controls:debug"),Z_=Ly("components:windows-motion-controls:warn"),$_=My+"controllers/microsoft/",tM={left:"left.glb",right:"right.glb",default:"universal.glb"},eM="windows-mixed-reality",nM=(_b("windows-motion-controls",{schema:{hand:{default:"right"},pair:{default:0},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick","menu"],axisMeshNames:["TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_X","THUMBSTICK_X","THUMBSTICK_Y"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",squeeze:"GRASP",thumbstick:"THUMBSTICK_PRESS",touchpad:"TOUCHPAD_PRESS"},pointingPoseMeshName:"POINTING_POSE"},bindMethods:function(){this.onModelError=this.onModelError.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this,e=this.el;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.onControllerConnected=function(){t.setModelVisibility(!0)},this.onControllerDisconnected=function(){t.setModelVisibility(!1)},this.controllerPresent=!1,this.previousButtonValues={},this.bindMethods(),this.loadedMeshInfo={buttonMeshes:null,axisMeshes:null},this.rayOrigin={origin:new THREE.Vector3,direction:new THREE.Vector3(0,0,-1),createdFromMesh:!1},e.addEventListener("controllerconnected",this.onControllerConnected),e.addEventListener("controllerdisconnected",this.onControllerDisconnected)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-error",this.onModelError),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-error",this.onModelError),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){ZE(this,eM,{hand:this.data.hand,index:this.data.pair,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},updateControllerModel:function(){if(this.data.model&&!this.rayOrigin.createdFromMesh){var t=this.createControllerModelUrl();this.loadModel(t)}else this.modelReady()},createControllerModelUrl:function(t){var e=this.data.hand;return $_+"default/"+(tM[e]||tM.default)},injectTrackedControls:function(){var t=this.data;this.el.setAttribute("tracked-controls",{idPrefix:eM,controller:t.pair,hand:t.hand}),this.updateControllerModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelError:function(t){var e=this.createControllerModelUrl(!0);t.detail.src!==e?(Z_("Failed to load controller model for device, attempting to load default."),this.loadModel(e)):Z_("Failed to load default controller model.")},loadModel:function(t){this.el.setAttribute("gltf-model","url("+t+")")},onModelLoaded:function(t){var e,n,i,r,s=this.controllerModel=t.detail.model,o=this.loadedMeshInfo;if(t.target===this.el){if(K_("Processing model"),o.buttonMeshes={},o.axisMeshes={},s){for(e=0;e<this.mapping.buttons.length;e++)(n=this.mapping.buttonMeshNames[this.mapping.buttons[e]])?(i=s.getObjectByName(n))?(r={index:e,value:a(i,"VALUE"),pressed:a(i,"PRESSED"),unpressed:a(i,"UNPRESSED")}).value&&r.pressed&&r.unpressed?o.buttonMeshes[this.mapping.buttons[e]]=r:Z_("Missing button submesh under mesh with name: "+n+"(VALUE: "+!!r.value+", PRESSED: "+!!r.pressed+", UNPRESSED:"+!!r.unpressed+")"):Z_("Missing button mesh with name: "+n):K_("Skipping unknown button at index: "+e+" with mapped name: "+this.mapping.buttons[e]);for(e=0;e<this.mapping.axisMeshNames.length;e++)(n=this.mapping.axisMeshNames[e])?(i=s.getObjectByName(n))?(r={index:e,value:a(i,"VALUE"),min:a(i,"MIN"),max:a(i,"MAX")}).value&&r.min&&r.max?o.axisMeshes[e]=r:Z_("Missing axis submesh under mesh with name: "+n+"(VALUE: "+!!r.value+", MIN: "+!!r.min+", MAX:"+!!r.max+")"):Z_("Missing axis mesh with name: "+n):K_("Skipping unknown axis at index: "+e);this.calculateRayOriginFromMesh(s),this.setModelVisibility()}K_("Model load complete.")}function a(t,e){for(var n=0,i=t.children.length;n<i;n++){var r=t.children[n];if(r&&r.name===e)return r}}},calculateRayOriginFromMesh:function(){var t=new THREE.Quaternion;return function(e){var n;if(this.rayOrigin.origin.set(0,0,0),this.rayOrigin.direction.set(0,0,-1),this.rayOrigin.createdFromMesh=!0,n=e.getObjectByName(this.mapping.pointingPoseMeshName)){var i=e.parent;i&&(e.parent=null,e.updateMatrixWorld(!0),e.parent=i),n.getWorldPosition(this.rayOrigin.origin),n.getWorldQuaternion(t),this.rayOrigin.direction.applyQuaternion(t),i&&e.updateMatrixWorld(!0)}else K_("Mesh does not contain pointing origin data, defaulting to none.");this.modelReady()}}(),lerpAxisTransform:function(){var t=new THREE.Quaternion;return function(e,n){var i=this.loadedMeshInfo.axisMeshes[e];if(i){var r=i.min,s=i.max,o=i.value,a=.5*n+.5;o.setRotationFromQuaternion(t.copy(r.quaternion).slerp(s.quaternion,a)),o.position.lerpVectors(r.position,s.position,a)}}}(),lerpButtonTransform:function(){var t=new THREE.Quaternion;return function(e,n){var i=this.loadedMeshInfo.buttonMeshes[e];if(i){var r=i.unpressed,s=i.pressed,o=i.value;o.setRotationFromQuaternion(t.copy(r.quaternion).slerp(s.quaternion,n)),o.position.lerpVectors(r.position,s.position,n)}}}(),modelReady:function(){this.el.emit("controllermodelready",{name:"windows-motion-controls",model:this.data.model,rayOrigin:this.rayOrigin})},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&(this.loadedMeshInfo&&this.loadedMeshInfo.buttonMeshes&&this.lerpButtonTransform(e,t.detail.state.value),this.el.emit(e+"changed",t.detail.state))},onAxisMoved:function(t){var e=this.mapping.axisMeshNames.length;if(this.loadedMeshInfo&&this.loadedMeshInfo.axisMeshes)for(var n=0;n<e;n++)this.lerpAxisTransform(n,t.detail.axis[n]||0);ex(this,this.mapping.axes,t)},setModelVisibility:function(t){var e=this.el.getObject3D("mesh");this.controllerPresent&&(t=void 0!==t?t:this.modelVisible,this.modelVisible=t,e&&(e.visible=t))}}),X_=new _y.Quaternion,Y_=new _y.Vector3,function(t,e,n){e.position.copy(t.transform.position),e.quaternion.copy(t.transform.orientation),Y_.copy(n),X_.copy(t.transform.orientation),Y_.applyQuaternion(X_),e.position.sub(Y_)});function iM(t,e){this.renderer=t,this.xrHitTestSource=null,t.xr.addEventListener("sessionend",function(){this.xrHitTestSource=null}.bind(this)),t.xr.addEventListener("sessionstart",function(){this.sessionStart(e)}.bind(this)),this.renderer.xr.isPresenting&&this.sessionStart(e)}function rM(t){console.warn(t.message),console.warn('Cannot requestHitTestSource Are you missing: webxr="optionalFeatures: hit-test;" from <a-scene>?')}nM.tempFakePose={transform:{orientation:new _y.Quaternion,position:new _y.Vector3}},iM.prototype.previousFrameAnchors=new Set,iM.prototype.anchorToObject3D=new Map,iM.prototype.sessionStart=function(t){this.session=this.renderer.xr.getSession(),"requestHitTestSource"in this.session?t.space?this.session.requestHitTestSource(t).then(function(t){this.xrHitTestSource=t}.bind(this)).catch(rM):t.profile&&this.session.requestHitTestSourceForTransientInput(t).then(function(t){this.xrHitTestSource=t,this.transient=!0}.bind(this)).catch(rM):rM({message:"No requestHitTestSource on the session."})},iM.prototype.anchorFromLastHitTestResult=function(t,e){var n=this.lastHitTest;if(n){var i={object3D:t,offset:e};Array.from(this.anchorToObject3D.entries()).forEach(function(e){var n=e[1].object3D,i=e[0];n===t&&(this.anchorToObject3D.delete(i),i.delete())}.bind(this)),n.createAnchor&&n.createAnchor().then(function(t){this.anchorToObject3D.set(t,i)}.bind(this)).catch((function(t){console.warn(t.message),console.warn('Cannot create anchor, are you missing: webxr="optionalFeatures: anchors;" from <a-scene>?')}))}},iM.prototype.doHit=function(t){if(this.renderer.xr.isPresenting){var e,n,i=this.renderer.xr.getReferenceSpace(),r=t.getViewerPose(i);return this.xrHitTestSource&&r?this.transient?(e=t.getHitTestResultsForTransientInput(this.xrHitTestSource)).length>0&&(n=e[0].results).length>0&&(this.lastHitTest=n[0],n[0].getPose(i)):(e=t.getHitTestResults(this.xrHitTestSource)).length>0&&(this.lastHitTest=e[0],e[0].getPose(i)):void 0}},iM.updateAnchorPoses=function(t,e){var n=t.trackedAnchors||iM.prototype.previousFrameAnchors;iM.prototype.previousFrameAnchors.forEach((function(t){n.has(t)||iM.prototype.anchorToObject3D.delete(t)})),n.forEach((function(n){var i,r,s,o;try{if(i=t.getPose(n.anchorSpace,e)){if(!(r=iM.prototype.anchorToObject3D.get(n)))return;s=r.offset,o=r.object3D,nM(i,o,s)}}catch(t){console.error("while updating anchor poses:",t)}})),iM.prototype.previousFrameAnchors=n},_b("ar-hit-test",{schema:{target:{type:"selector"},enabled:{default:!0},src:{default:"data:image/webp;base64,UklGRkQHAABXRUJQVlA4WAoAAAAQAAAA/wEA/wEAQUxQSL0DAAARDzD/ERGCjrY9sYYFfgo6aa1kJ7K0w9Lo3AadLSVeFxevQwj5kuM8RfR/Atw/C0+ozB/oUBrloFZs6ElSW88j1KA4yExNWQaqRZquIDF0JYmlq0hAuUDTFu66tng3teW7pa3cQf1V1edvur54M/Slm6Wv3Gx9zw0MXlQLntcsBN6wkHjTQuYtC4W3LTw8mGRVG57TbAROtxHfZNhInGkjc5aNwtk2Hg6Mvki14k+NkZzCwQgCxalcAv3kddRTPI1DcUrXId1FLf1uHpzaQz4tquhZVLlKesbVpqKeTj0n0F5PpXDlFN9UqmhalL/ImuZFo6KmToWLoKlddMprqlS8cKovBvHo2kTiFV2LN4msaxKZl3QNiair8xYRdDWivIvXVXmbcMqJ51UebZuFXxZt6xd4laxtciqRtA3Cv0nU1t+kEUFbI8JvCa+tvkm3FDlO/W+OR99+kWEp/YYo+tYfTVnf/K8cE/F///3vv//993eeL+a+uvjawLcX3xjYvJotBFY3kVjTRGFtE+BU2AiMbiQyhpHMWEYeBozAH5qNBYRDB5KBCaTDBKKBAZTDBoKBDjwHAN5ABeCJBsAZcAAC0YHHxAYSMYBiYgGZWEA2MYFCbCCZGAAIANFEB+AnYgMQTDQAYSJ2AN5EBZAm4gDgTDgAeSIu4DGygTIRN1CMLOCZiACykQlg4jsAycgA8AO+BxCNdJyDkcbwRirDGXGnx8w+FDPrkM3MQ9JQZMYhiiwV/RDMtIM3U1/DmXHUo+IR2kSR2ToWkQ1NIn2qf2J8LCqJKiDUiSADHY3whirhdHgZ94HKaR97PhE+twEUJUFoAcgyTct8hfSxSkShASDKdMJ/ritKHwgyQ0sD4D/miCxU5SbhOOUDTnZpccCjYP/i0bZ/8bAgtVGEoGapWIQXyzKVKLwgNJFk2rtMIgoNRJlOZF7SNSSyUEeQmbxBFKEmtYjEe8S8zOZ1AkJVCmS88FJOtF40Ksg4oUaFiygk3C8qlTVNyl8UTevCUdAE2t14PfVqU1FPp57TopKeQZWromddTQp6QOfTOEQt/ZDuipZ11w/wOiqO8dRORcc6BQEkDQMClaHcn5wV9yLbxsNZNgpn2sicYSNxuo34Js1G4FQbnuNsOPa28PCWhcKbFjJvWEi8ZiHwqgXPcxbc5db33Cx95WboSzddX7yp+vyN0+eul7ZyN7Xlu64t3jVt4c5pc4JLV5EYupJE0xUknC4nOjVlmaYpyLit53HCQ0+ScnqceNcS5dzUkd0/CwMAVlA4IGADAAAQXwCdASoAAgACP8ne6Wy/tjCpqJ/IA/A5CWlu4XYBG/Pz8AfwD8APz//f3v8E1fuHZnxKYACtfuHZnxKYACrYTb5mOslhxu843ecbvON3nG7zjd3a0VCn7G1MABVxwH/Xd25gAK1+4dmfEpe2+PHhQaj75++riG6FuYACtfuHZnxKYACRrK3q9xO8Ss3uWKnMhs/rDF1hi6wxdYYusMXWGI5QRcCFDZog5OgqNlse1NDuz/UoFa/cOzPiUwAEsAOK4/nu5eZHK2tlXxJfNYlMABWv3Dsz4bvNJ5YA/LtxJ38SmAArX7h2Z8Sk5vdZUYv7mZPiUwAFa/cOzPh21s5OgZxf1mfEpemRyFr/rM+JS9noA/LtxJ38SmAAlUJIotzAASn6TjdhK+D3Dsz4dyvB7h2Z8O2tnJ0DOL+sz4lL2nKLT4lL/+iSLOocxq639w7M34MNZdm55uJ8v8ra2cpVZnxKTq2F3PN/cNksAfl24k7+JTAASqrD37h2Z7b1W+VtbOUqsz4lJ1bC7nm/uGyWAPy7cSd/EpgAJVVh79w7M9t6rfK2tnKVWZ8Sk6thdzzf3DZLAH5duJO/iUwAEqqw9+4dme29VvlbWzlKrM+JSdWwu55v7hslgD8u3EnfxKYACVVYe/cOzPbeq3ytrZylVme0kYJ8557FLerqFrzIbPrrf3DZLAH5duJO/iUvaVMS9BoaF4p7pSDFTP1XMyfElelrM0DOL+sz4eBJ13nV1OppBGPuKb4YzXQgq9uH19uS/0+JS9t9fr6ZUlQBelDG6GMgq97otb5QMPJwtKyBTbFp8Sl7b6/X0ykkawEOsgdiE6Fi0vb/Eve6xkwsmug0Z4nGNHQO8839bpTsjpz7SWIJxKagvd1QWMa6FYT1KEw3j4XDT6vJ9Xk+nyfT5Pq8n1eEmk5dinMM/9Fcfz4Z3Dsz3KD2dw7LxBRxKrqUUGQPH/7zxr1KIfNpLEJ0MZB2ITM/0Z2EFoh12NlXnEcpYcbvON3nG7zjd5xu84vfcNIAAP7+y8ceyzbVxkakPYY4lcr72fqOnDwipv+yxC71wAADBrjKnAAAAAAAAAAAAAAw7oNGHttqWONcoFN/2WIDc2pa6WVFtFYROlsaMaTXdcOjXHz93+YxAglKa4AAAAA=",type:"map"},type:{default:"footprint",oneOf:["footprint","map"]},footprintDepth:{default:.1},mapSize:{type:"vec2",default:{x:.5,y:.5}}},sceneOnly:!0,init:function(){this.hitTest=null,this.imageDataArray=new Uint8ClampedArray(1048576),this.imageData=new ImageData(this.imageDataArray,512,512),this.textureCache=new Map,this.orthoCam=new _y.OrthographicCamera,this.orthoCam.layers.set(21),this.textureTarget=new _y.WebGLRenderTarget(512,512,{}),this.basicMaterial=new _y.MeshBasicMaterial({color:0,side:_y.DoubleSide}),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.context.imageSmoothingEnabled=!1,this.canvas.width=512,this.canvas.height=512,this.canvasTexture=new _y.CanvasTexture(this.canvas,{alpha:!0}),this.canvasTexture.flipY=!1;var t=this.el.getAttribute("webxr"),e=t.optionalFeatures;e.includes("hit-test")&&e.includes("anchors")||(e.push("hit-test"),e.push("anchors"),this.el.setAttribute("webxr",t)),this.el.sceneEl.renderer.xr.addEventListener("sessionend",function(){this.hitTest=null}.bind(this)),this.el.sceneEl.renderer.xr.addEventListener("sessionstart",function(){if(this.el.is("ar-mode")){var t=this.el.sceneEl.renderer,e=this.session=t.xr.getSession();this.hasPosedOnce=!1,this.bboxMesh.visible=!1,J_||(J_=new Map),e.requestReferenceSpace("viewer").then(function(e){this.viewerHitTest=this.hitTest=new iM(t,{space:e}),this.el.emit("ar-hit-test-start")}.bind(this));var n=this;this.el.sceneEl.addEventListener("controllersupdated",(function(){var e=this.xrSession&&this.xrSession.inputSources;if(e)for(var i=0;i<e.length;++i)if("tracked-pointer"===e[i].targetRayMode){n.hitTest=new iM(t,{space:e[i].targetRaySpace}),J_.set(e[i],n.hitTest),n.viewerHitTest&&"function"==typeof n.viewerHitTest.cancel&&(n.viewerHitTest.cancel(),n.viewerHitTest=null);break}}));var i="generic-touchscreen",r=new iM(t,{profile:i});e.addEventListener("selectstart",function(e){if(!0===this.data.enabled){var n=e.inputSource;this.bboxMesh.visible=!0,!0===this.hasPosedOnce&&(this.el.emit("ar-hit-test-select-start",{inputSource:n,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),n.profiles[0]===i?this.hitTest=r:(this.hitTest=J_.get(n)||new iM(t,{space:n.targetRaySpace}),J_.set(n,this.hitTest)))}}.bind(this)),e.addEventListener("selectend",function(t){if(this.hitTest&&!0===this.data.enabled){var e,n=t.inputSource;!0===this.hasPosedOnce&&(this.bboxMesh.visible=!1,this.data.target&&(e=this.data.target.object3D)&&(nM.tempFakePose.transform.position.copy(this.bboxMesh.position),nM.tempFakePose.transform.orientation.copy(this.bboxMesh.quaternion),nM(nM.tempFakePose,e,this.bboxOffset),e.visible=!0,this.hitTest.anchorFromLastHitTestResult(e,this.bboxOffset)),this.el.emit("ar-hit-test-select",{inputSource:n,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),this.hitTest=null)}else this.hitTest=null}.bind(this))}}.bind(this)),this.bboxOffset=new _y.Vector3,this.update=this.update.bind(this),this.makeBBox()},update:function(){!1===this.data.enabled&&(this.hitTest=null,this.bboxMesh.visible=!1),this.data.target&&(this.data.target.object3D?(this.data.target.addEventListener("model-loaded",this.update),this.data.target.object3D.layers.enable(21),this.data.target.object3D.traverse((function(t){t.layers.enable(21)}))):this.data.target.addEventListener("loaded",this.update,{once:!0})),this.bboxNeedsUpdate=!0},makeBBox:function(){var t=new _y.PlaneGeometry(1,1),e=new _y.MeshBasicMaterial({transparent:!0,color:16777215});t.rotateX(-Math.PI/2),t.rotateY(-Math.PI/2),this.bbox=new _y.Box3,this.bboxMesh=new _y.Mesh(t,e),this.el.setObject3D("ar-hit-test",this.bboxMesh),this.bboxMesh.visible=!1},updateFootprint:function(){var t,e,n,i=this.el.sceneEl.renderer,r=i.xr.enabled;this.bboxMesh.material.map=this.canvasTexture,this.bboxMesh.material.needsUpdate=!0,this.orthoCam.rotation.set(-Math.PI/2,0,-Math.PI/2),this.orthoCam.position.copy(this.bboxMesh.position),this.orthoCam.position.y-=this.bboxMesh.scale.y/2,this.orthoCam.near=.1,this.orthoCam.far=this.orthoCam.near+this.data.footprintDepth*this.bboxMesh.scale.y,this.orthoCam.position.y+=this.orthoCam.far,this.orthoCam.right=this.bboxMesh.scale.z/2,this.orthoCam.left=-this.bboxMesh.scale.z/2,this.orthoCam.top=this.bboxMesh.scale.x/2,this.orthoCam.bottom=-this.bboxMesh.scale.x/2,this.orthoCam.updateProjectionMatrix(),e=i.getRenderTarget(),i.setRenderTarget(this.textureTarget),i.xr.enabled=!1,n=this.el.object3D.background,this.el.object3D.overrideMaterial=this.basicMaterial,this.el.object3D.background=null,i.render(this.el.object3D,this.orthoCam),this.el.object3D.background=n,this.el.object3D.overrideMaterial=null,i.xr.enabled=r,i.setRenderTarget(e),i.readRenderTargetPixels(this.textureTarget,0,0,512,512,this.imageDataArray),this.context.putImageData(this.imageData,0,0),this.context.shadowColor="white",this.context.shadowBlur=10,this.context.drawImage(this.canvas,0,0),t=this.context.getImageData(0,0,512,512);for(var s=0;s<262144;s++)0!==t.data[4*s+3]&&255!==t.data[4*s+3]&&(t.data[4*s+3]=128);this.context.putImageData(t,0,0),this.canvasTexture.needsUpdate=!0},tick:function(){var t,e,n=this.el.sceneEl.frame,i=this.el.sceneEl.renderer;(n&&iM.updateAnchorPoses(n,i.xr.getReferenceSpace()),this.bboxNeedsUpdate)&&(this.bboxNeedsUpdate=!1,this.data.target&&"map"!==this.data.type||(this.textureCache.has(this.data.src)?e=this.textureCache.get(this.data.src):(e=(new _y.TextureLoader).load(this.data.src),this.textureCache.set(this.data.src,e)),this.bboxMesh.material.map=e,this.bboxMesh.material.needsUpdate=!0),this.data.target&&this.data.target.object3D?(this.bbox.setFromObject(this.data.target.object3D),this.bbox.getCenter(this.bboxMesh.position),this.bbox.getSize(this.bboxMesh.scale),"footprint"===this.data.type&&(this.bboxMesh.scale.x*=1.04,this.bboxMesh.scale.z*=1.04,this.updateFootprint()),this.bboxMesh.position.y-=this.bboxMesh.scale.y/2,this.bboxOffset.copy(this.bboxMesh.position),this.bboxOffset.sub(this.data.target.object3D.position)):this.bboxMesh.scale.set(this.data.mapSize.x,1,this.data.mapSize.y));this.hitTest&&(t=this.hitTest.doHit(n))&&(!0!==this.hasPosedOnce&&(this.hasPosedOnce=!0,this.el.emit("ar-hit-test-achieved")),this.bboxMesh.visible=!0,this.bboxMesh.position.copy(t.transform.position),this.bboxMesh.quaternion.copy(t.transform.orientation))}}),_b("background",{schema:{color:{type:"color",default:"black"},transparent:{default:!1}},sceneOnly:!0,update:function(){var t=this.data,e=this.el.object3D;t.transparent?e.background=null:e.background=new THREE.Color(t.color)},remove:function(){this.el.object3D.background=null}}),_b("debug",{schema:{default:!0},sceneOnly:!0});var sM="a-dialog-buttons-container",oM="a-dialog-button";function aM(t,e){var n,i,r,s;return(n=document.createElement("div")).classList.add("a-modal"),n.setAttribute(Sy,""),(i=document.createElement("div")).className="a-dialog",i.setAttribute(Sy,""),n.appendChild(i),(r=document.createElement("div")).classList.add("a-dialog-text-container"),i.appendChild(r),(s=document.createElement("div")).classList.add("a-dialog-text"),s.innerHTML=t,r.appendChild(s),i.appendChild(e),n}_b("device-orientation-permission-ui",{schema:{enabled:{default:!0},deviceMotionMessage:{default:"This immersive website requires access to your device motion sensors."},httpsMessage:{default:"Access this site over HTTPS to enter VR mode and grant access to the device sensors."},denyButtonText:{default:"Deny"},allowButtonText:{default:"Allow"},cancelButtonText:{default:"Cancel"}},sceneOnly:!0,init:function(){var t=this;this.data.enabled&&(window.isSecureContext||this.showHTTPAlert(),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission?(this.onDeviceMotionDialogAllowClicked=this.onDeviceMotionDialogAllowClicked.bind(this),this.onDeviceMotionDialogDenyClicked=this.onDeviceMotionDialogDenyClicked.bind(this),DeviceOrientationEvent.requestPermission().then((function(){t.el.emit("deviceorientationpermissiongranted"),t.permissionGranted=!0})).catch((function(){var e,n,i,r,s,o,a,l;t.devicePermissionDialogEl=(e=t.data.denyButtonText,n=t.data.allowButtonText,i=t.data.deviceMotionMessage,r=t.onDeviceMotionDialogAllowClicked,s=t.onDeviceMotionDialogDenyClicked,(o=document.createElement("div")).classList.add(sM),(a=document.createElement("button")).classList.add(oM,"a-dialog-deny-button"),a.setAttribute(Sy,""),a.innerHTML=e,o.appendChild(a),(l=document.createElement("button")).classList.add(oM,"a-dialog-allow-button"),l.setAttribute(Sy,""),l.innerHTML=n,o.appendChild(l),l.addEventListener("click",(function(t){t.stopPropagation(),r()})),a.addEventListener("click",(function(t){t.stopPropagation(),s()})),aM(i,o)),t.el.appendChild(t.devicePermissionDialogEl)}))):this.permissionGranted=!0)},remove:function(){this.devicePermissionDialogEl&&this.el.removeChild(this.devicePermissionDialogEl)},onDeviceMotionDialogDenyClicked:function(){this.remove()},showHTTPAlert:function(){var t,e,n,i,r,s=this,o=(t=s.data.cancelButtonText,e=s.data.httpsMessage,n=function(){s.el.removeChild(o)},(i=document.createElement("div")).classList.add(sM),(r=document.createElement("button")).classList.add(oM,"a-dialog-ok-button"),r.setAttribute(Sy,""),r.innerHTML=t,i.appendChild(r),r.addEventListener("click",(function(t){t.stopPropagation(),n()})),aM(e,i));this.el.appendChild(o)},onDeviceMotionDialogAllowClicked:function(){var t=this;this.el.emit("deviceorientationpermissionrequested"),DeviceOrientationEvent.requestPermission().then((function(e){"granted"===e?(t.el.emit("deviceorientationpermissiongranted"),t.permissionGranted=!0):t.el.emit("deviceorientationpermissionrejected"),t.remove()})).catch(console.error)}}),_b("embedded",{dependencies:["xr-mode-ui"],schema:{default:!0},sceneOnly:!0,update:function(){var t=this.el,e=t.querySelector(".a-enter-vr");!0===this.data?(e&&e.classList.add("embedded"),t.removeFullScreenStyles()):(e&&e.classList.remove("embedded"),t.addFullScreenStyles())}});var lM="https://unpkg.com/aframe-inspector@"+function(t){var e=t.split(".");return e[2]="x",e.join(".")}(_C)+"/dist/aframe-inspector.min.js";_b("inspector",{schema:{url:{default:lM}},sceneOnly:!0,init:function(){this.firstPlay=!0,this.onKeydown=this.onKeydown.bind(this),this.onMessage=this.onMessage.bind(this),this.initOverlay(),window.addEventListener("keydown",this.onKeydown),window.addEventListener("message",this.onMessage)},play:function(){var t;this.firstPlay&&"false"!==(t=bx("inspector"))&&t&&(this.openInspector(),this.firstPlay=!1)},initOverlay:function(){this.loadingMessageEl=document.createElement("div"),this.loadingMessageEl.classList.add("a-inspector-loader"),this.loadingMessageEl.innerHTML='Loading Inspector<span class="dots"><span>.</span><span>.</span><span>.</span></span>'},remove:function(){this.removeEventListeners()},onKeydown:function(t){73===t.keyCode&&(t.ctrlKey&&t.altKey||t.getModifierState("AltGraph"))&&this.openInspector()},showLoader:function(){document.body.appendChild(this.loadingMessageEl)},hideLoader:function(){document.body.removeChild(this.loadingMessageEl)},onMessage:function(t){"INJECT_AFRAME_INSPECTOR"===t.data&&this.openInspector()},openInspector:function(t){var e,n=this;AFRAME.INSPECTOR||AFRAME.inspectorInjected?AFRAME.INSPECTOR.open(t):(this.showLoader(),(e=document.createElement("script")).src=this.data.url,e.setAttribute("data-name","aframe-inspector"),e.setAttribute(Sy,""),e.onload=function(){AFRAME.INSPECTOR.open(t),n.hideLoader(),n.removeEventListeners()},e.onerror=function(){n.loadingMessageEl.innerHTML="Error loading Inspector"},document.head.appendChild(e),AFRAME.inspectorInjected=!0)},removeEventListeners:function(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("message",this.onMessage)}}),_b("fog",{schema:{color:{type:"color",default:"#000"},density:{default:25e-5},far:{default:1e3,min:0},near:{default:1,min:0},type:{default:"linear",oneOf:["linear","exponential"]}},sceneOnly:!0,update:function(){var t=this.data,e=this.el,n=this.el.object3D.fog;n&&t.type===n.name?Object.keys(this.schema).forEach((function(e){var i=t[e];"color"===e&&(i=new _y.Color(i)),n[e]=i})):e.object3D.fog=function(t){var e;return(e="exponential"===t.type?new _y.FogExp2(t.color,t.density):new _y.Fog(t.color,t.near,t.far)).name=t.type,e}(t)},remove:function(){var t=this.el;this.el.object3D.fog&&(t.object3D.fog=null)}}),_b("keyboard-shortcuts",{schema:{enterVR:{default:!0},exitVR:{default:!0}},sceneOnly:!0,init:function(){this.onKeyup=this.onKeyup.bind(this)},play:function(){window.addEventListener("keyup",this.onKeyup,!1)},pause:function(){window.removeEventListener("keyup",this.onKeyup)},onKeyup:function(t){var e=this.el;yx(t)&&(this.data.enterVR&&70===t.keyCode&&e.enterVR(),this.data.exitVR&&27===t.keyCode&&e.exitVR())}});var cM=Ly("components:pool:warn");_b("pool",{schema:{container:{default:""},mixin:{default:""},size:{default:0},dynamic:{default:!1}},sceneOnly:!0,multiple:!0,initPool:function(){var t;for(this.availableEls=[],this.usedEls=[],this.data.mixin||cM("No mixin provided for pool component."),this.data.container&&(this.container=document.querySelector(this.data.container),this.container||cM("Container "+this.data.container+" not found.")),this.container=this.container||this.el,t=0;t<this.data.size;++t)this.createEntity()},update:function(t){var e=this.data;t.mixin===e.mixin&&t.size===e.size||this.initPool()},createEntity:function(){var t;(t=document.createElement("a-entity")).play=this.wrapPlay(t.play),t.setAttribute("mixin",this.data.mixin),t.object3D.visible=!1,t.pause(),this.container.appendChild(t),this.availableEls.push(t);var e=this.usedEls;t.addEventListener("loaded",(function(){-1===e.indexOf(t)&&(t.object3DParent=t.object3D.parent,t.object3D.parent.remove(t.object3D))}))},wrapPlay:function(t){var e=this.usedEls;return function(){-1!==e.indexOf(this)&&t.call(this)}},requestEntity:function(){var t;if(0===this.availableEls.length){if(!1===this.data.dynamic)return void cM("Requested entity from empty pool: "+this.attrName);cM("Requested entity from empty pool. This pool is dynamic and will resize automatically. You might want to increase its initial size: "+this.attrName),this.createEntity()}return t=this.availableEls.shift(),this.usedEls.push(t),t.object3DParent&&(t.object3DParent.add(t.object3D),this.updateRaycasters()),t.object3D.visible=!0,t},returnEntity:function(t){var e=this.usedEls.indexOf(t);if(-1!==e)return this.usedEls.splice(e,1),this.availableEls.push(t),t.object3DParent=t.object3D.parent,t.object3D.parent.remove(t.object3D),this.updateRaycasters(),t.object3D.visible=!1,t.pause(),t;cM("The returned entity was not previously pooled from "+this.attrName)},updateRaycasters:function(){document.querySelectorAll("[raycaster]").forEach((function(t){t.components.raycaster.setDirty()}))}}),_b("real-world-meshing",{schema:{filterLabels:{type:"array"},meshesEnabled:{default:!0},meshMixin:{default:!0},planesEnabled:{default:!0},planeMixin:{default:""}},sceneOnly:!0,init:function(){var t=this.el.getAttribute("webxr"),e=t.requiredFeatures;-1===e.indexOf("mesh-detection")&&(e.push("mesh-detection"),this.el.setAttribute("webxr",t)),-1===e.indexOf("plane-detection")&&(e.push("plane-detection"),this.el.setAttribute("webxr",t)),this.meshEntities=[],this.initWorldMeshEntity=this.initWorldMeshEntity.bind(this)},tick:function(){this.el.is("ar-mode")&&(this.detectMeshes(),this.updateMeshes())},detectMeshes:function(){var t,e,n,i=this.data,r=this.el,s=this.meshEntities,o=!1,a=[],l=this.data.filterLabels;t=(n=r.frame).detectedMeshes,e=n.detectedPlanes;for(var c=0;c<s.length;c++)s[c].present=!1;if(i.meshesEnabled)for(var h of t.values())if(!l.length||-1!==l.indexOf(h.semanticLabel)){for(c=0;c<s.length;c++)if(h===s[c].mesh){o=!0,s[c].present=!0,s[c].lastChangedTime<h.lastChangedTime&&this.updateMeshGeometry(s[c].el,h),s[c].lastChangedTime=h.lastChangedTime;break}o||a.push(h),o=!1}if(i.planesEnabled)for(h of e.values())if(!l.length||-1!==l.indexOf(h.semanticLabel)){for(c=0;c<s.length;c++)if(h===s[c].mesh){o=!0,s[c].present=!0,s[c].lastChangedTime<h.lastChangedTime&&this.updateMeshGeometry(s[c].el,h),s[c].lastChangedTime=h.lastChangedTime;break}o||a.push(h),o=!1}this.deleteMeshes(),this.createNewMeshes(a)},updateMeshes:function(){var t=new _y.Matrix4;return function(){for(var e,n,i,r=this.el,s=r.frame,o=this.meshEntities,a=r.renderer.xr.getReferenceSpace(),l=0;l<o.length;l++)i=o[l].mesh.meshSpace||o[l].mesh.planeSpace,e=s.getPose(i,a),(n=o[l].el).hasLoaded&&(t.fromArray(e.transform.matrix),t.decompose(n.object3D.position,n.object3D.quaternion,n.object3D.scale))}}(),deleteMeshes:function(){for(var t=this.meshEntities,e=[],n=0;n<t.length;n++)t[n].present?e.push(t[n]):this.el.removeChild(t[n]);this.meshEntities=e},createNewMeshes:function(t){for(var e,n=0;n<t.length;n++)e=document.createElement("a-entity"),this.meshEntities.push({mesh:t[n],el:e}),e.addEventListener("loaded",this.initWorldMeshEntity),this.el.appendChild(e)},initMeshGeometry:function(t){var e,n,i;if(t instanceof XRPlane){n=new _y.Shape,i=t.polygon;for(var r=0;r<i.length;++r)0===r?n.moveTo(i[r].x,i[r].z):n.lineTo(i[r].x,i[r].z);return(e=new _y.ShapeGeometry(n)).rotateX(Math.PI/2),e}return(e=new _y.BufferGeometry).setAttribute("position",new _y.BufferAttribute(t.vertices,3)),e.setIndex(new _y.BufferAttribute(t.indices,1)),e},initWorldMeshEntity:function(t){for(var e,n,i,r=t.target,s=this.meshEntities,o=0;o<s.length;o++)if(s[o].el===r){i=s[o];break}e=this.initMeshGeometry(i.mesh),n=new _y.Mesh(e,new _y.MeshBasicMaterial({color:16777215*Math.random(),side:_y.DoubleSide})),r.setObject3D("mesh",n),i.mesh instanceof XRPlane&&this.data.planeMixin?r.setAttribute("mixin",this.data.planeMixin):this.data.meshMixin&&r.setAttribute("mixin",this.data.meshMixin),r.setAttribute("data-world-mesh",i.mesh.semanticLabel)},updateMeshGeometry:function(t,e){var n=t.getObject3D("mesh");n.geometry.dispose(),n.geometry=this.initMeshGeometry(e)}}),_b("reflection",{schema:{directionalLight:{type:"selector"}},sceneOnly:!0,init:function(){var t=this;this.cubeRenderTarget=new THREE.WebGLCubeRenderTarget(16),this.cubeCamera=new THREE.CubeCamera(.1,1e3,this.cubeRenderTarget),this.lightingEstimationTexture=new THREE.WebGLCubeRenderTarget(16).texture,this.needsVREnvironmentUpdate=!0;var e=this.el.getAttribute("webxr"),n=e.optionalFeatures;n.includes("light-estimation")||(n.push("light-estimation"),this.el.setAttribute("webxr",e)),this.el.addEventListener("enter-vr",(function(){t.el.is("ar-mode")&&t.el.renderer.xr.getSession().requestLightProbe&&t.startLightProbe()})),this.el.addEventListener("exit-vr",(function(){t.xrLightProbe&&t.stopLightProbe()})),this.el.object3D.environment=this.cubeRenderTarget.texture},stopLightProbe:function(){this.xrLightProbe=null,this.probeLight&&(this.probeLight.components.light.light.intensity=0),this.needsVREnvironmentUpdate=!0,this.el.object3D.environment=this.cubeRenderTarget.texture},startLightProbe:function(){this.needsLightProbeUpdate=!0},setupLightProbe:function(){var t=this.el.renderer,e=t.xr.getSession(),n=this,i=t.getContext();if(!this.probeLight){var r=document.createElement("a-light");r.setAttribute("type","probe"),r.setAttribute("intensity",0),this.el.appendChild(r),this.probeLight=r}switch(e.preferredReflectionFormat){case"srgba8":i.getExtension("EXT_sRGB");break;case"rgba16f":i.getExtension("OES_texture_half_float")}this.glBinding=new XRWebGLBinding(e,i),i.getExtension("EXT_sRGB"),i.getExtension("OES_texture_half_float"),e.requestLightProbe().then((function(t){n.xrLightProbe=t,t.addEventListener("reflectionchange",n.updateXRCubeMap.bind(n))})).catch((function(t){console.warn("Lighting estimation not supported: "+t.message),console.warn('Are you missing: webxr="optionalFeatures: light-estimation;" from <a-scene>?')}))},updateXRCubeMap:function(){var t=this.el.renderer,e=this.glBinding.getReflectionCubeMap(this.xrLightProbe);e&&(t.properties.get(this.lightingEstimationTexture).__webglTexture=e,this.lightingEstimationTexture.needsPMREMUpdate=!0,this.el.object3D.environment=this.lightingEstimationTexture)},tick:function(){var t=this.el.object3D,e=this.el.renderer,n=this.el.frame;if(n&&this.xrLightProbe){var i=n.getLightEstimate(this.xrLightProbe);i&&function(t,e,n,i){var r=Math.max(t.primaryLightIntensity.x,Math.max(t.primaryLightIntensity.y,t.primaryLightIntensity.z));e.sh.fromArray(t.sphericalHarmonicsCoefficients),e.intensity=3.14,n&&(n.color.setRGB(t.primaryLightIntensity.x/r,t.primaryLightIntensity.y/r,t.primaryLightIntensity.z/r),n.intensity=r,i.copy(t.primaryLightDirection))}(i,this.probeLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.object3D.position)}this.needsVREnvironmentUpdate&&(t.environment=null,this.needsVREnvironmentUpdate=!1,this.cubeCamera.position.set(0,1.6,0),this.cubeCamera.update(e,t),t.environment=this.cubeRenderTarget.texture),this.needsLightProbeUpdate&&n&&(this.setupLightProbe(),this.needsLightProbeUpdate=!1)},remove:function(){this.el.object3D.environment=null,this.probeLight&&this.el.removeChild(this.probeLight)}});var hM=["attribute vec3 position;","attribute vec2 uv;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","varying vec2 vUv;","void main() {"," vUv = vec2( 1.- uv.x, uv.y );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),uM=["precision mediump float;","uniform samplerCube map;","varying vec2 vUv;","#define M_PI 3.141592653589793238462643383279","void main() {"," vec2 uv = vUv;"," float longitude = uv.x * 2. * M_PI - M_PI + M_PI / 2.;"," float latitude = uv.y * M_PI;"," vec3 dir = vec3("," - sin( longitude ) * sin( latitude ),"," cos( latitude ),"," - cos( longitude ) * sin( latitude )"," );"," normalize( dir );"," gl_FragColor = vec4( textureCube( map, dir ).rgb, 1.0 );","}"].join("\n"),dM=(_b("screenshot",{schema:{width:{default:4096},height:{default:2048},camera:{type:"selector"}},sceneOnly:!0,setup:function(){var t=this.el;if(!this.canvas){var e=t.renderer.getContext();e&&(this.cubeMapSize=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),this.material=new _y.RawShaderMaterial({uniforms:{map:{type:"t",value:null}},vertexShader:hM,fragmentShader:uM,side:_y.DoubleSide}),this.quad=new _y.Mesh(new _y.PlaneGeometry(1,1),this.material),this.quad.visible=!1,this.camera=new _y.OrthographicCamera(-.5,.5,.5,-.5,-1e4,1e4),this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),t.object3D.add(this.quad),this.onKeyDown=this.onKeyDown.bind(this))}},getRenderTarget:function(t,e){return new _y.WebGLRenderTarget(t,e,{colorSpace:this.el.sceneEl.renderer.outputColorSpace,minFilter:_y.LinearFilter,magFilter:_y.LinearFilter,wrapS:_y.ClampToEdgeWrapping,wrapT:_y.ClampToEdgeWrapping,format:_y.RGBAFormat,type:_y.UnsignedByteType})},resize:function(t,e){this.quad.scale.set(t,e,1),this.camera.left=-1*t/2,this.camera.right=t/2,this.camera.top=e/2,this.camera.bottom=-1*e/2,this.camera.updateProjectionMatrix(),this.canvas.width=t,this.canvas.height=e},play:function(){window.addEventListener("keydown",this.onKeyDown)},onKeyDown:function(t){var e=83===t.keyCode&&t.ctrlKey&&t.altKey;if(this.data&&e){var n=t.shiftKey?"equirectangular":"perspective";this.capture(n)}},setCapture:function(t){var e,n,i,r,s=this.el;return"perspective"===t?(this.quad.visible=!1,n=this.data.camera&&this.data.camera.components.camera.camera||s.camera,e={width:this.data.width,height:this.data.height}):(n=this.camera,r=new _y.WebGLCubeRenderTarget(Math.min(this.cubeMapSize,2048),{format:_y.RGBFormat,generateMipmaps:!0,minFilter:_y.LinearMipmapLinearFilter,colorSpace:_y.SRGBColorSpace}),i=new _y.CubeCamera(s.camera.near,s.camera.far,r),s.camera.getWorldPosition(i.position),s.camera.getWorldQuaternion(i.quaternion),i.update(s.renderer,s.object3D),this.quad.material.uniforms.map.value=i.renderTarget.texture,e={width:this.data.width,height:this.data.height},this.quad.visible=!0),{camera:n,size:e,projection:t}},capture:function(t){var e,n=this.el.renderer.xr.enabled,i=this.el.renderer;this.setup(),i.xr.enabled=!1,e=this.setCapture(t),this.renderCapture(e.camera,e.size,e.projection),this.saveCapture(),i.xr.enabled=n},getCanvas:function(t){var e=this.el.renderer.xr.enabled,n=this.el.renderer;this.setup();var i=this.setCapture(t);return n.xr.enabled=!1,this.renderCapture(i.camera,i.size,i.projection),n.xr.enabled=e,this.canvas},renderCapture:function(t,e,n){var i,r,s,o=this.el.renderer.autoClear,a=this.el,l=a.renderer;r=this.getRenderTarget(e.width,e.height),s=new Uint8Array(4*e.width*e.height),this.resize(e.width,e.height),l.autoClear=!0,l.clear(),l.setRenderTarget(r),l.render(a.object3D,t),l.autoClear=o,l.readRenderTargetPixels(r,0,0,e.width,e.height,s),l.setRenderTarget(null),"perspective"===n&&(s=this.flipPixelsVertically(s,e.width,e.height)),i=new ImageData(new Uint8ClampedArray(s),e.width,e.height),this.quad.visible=!1,this.ctx.putImageData(i,0,0)},flipPixelsVertically:function(t,e,n){for(var i=t.slice(0),r=0;r<e;++r)for(var s=0;s<n;++s)i[4*r+s*e*4]=t[4*r+(n-s)*e*4],i[4*r+1+s*e*4]=t[4*r+1+(n-s)*e*4],i[4*r+2+s*e*4]=t[4*r+2+(n-s)*e*4],i[4*r+3+s*e*4]=t[4*r+3+(n-s)*e*4];return i},saveCapture:function(){this.canvas.toBlob((function(t){var e="screenshot-"+document.title.toLowerCase()+"-"+Date.now()+".png",n=document.createElement("a"),i=URL.createObjectURL(t);n.href=i,n.setAttribute("download",e),n.innerHTML="downloading...",n.style.display="none",document.body.appendChild(n),setTimeout((function(){n.click(),document.body.removeChild(n)}),1)}),"image/png")}}),n(282)),pM=n.n(dM),AM=(n(3729),n(8132),window.aframeStats),fM="a-hidden",mM=window.threeStats;_b("stats",{schema:{default:!0},sceneOnly:!0,init:function(){var t=this.el;"false"!==bx("stats")&&(this.stats=function(t){var e=new mM(t.renderer),n=new AM(t),i=t.isMobile?[]:[e,n];return new(pM())({css:[],values:{fps:{caption:"fps",below:30}},groups:[{caption:"Framerate",values:["fps","raf"]}],plugins:i})}(t),this.statsEl=document.querySelector(".rs-base"),this.hideBound=this.hide.bind(this),this.showBound=this.show.bind(this),t.addEventListener("enter-vr",this.hideBound),t.addEventListener("exit-vr",this.showBound))},update:function(){if(this.stats)return this.data?this.show():this.hide()},remove:function(){this.el.removeEventListener("enter-vr",this.hideBound),this.el.removeEventListener("exit-vr",this.showBound),this.statsEl&&this.statsEl.parentNode.removeChild(this.statsEl)},tick:function(){var t=this.stats;t&&(t("rAF").tick(),t("FPS").frame(),t().update())},hide:function(){this.statsEl.classList.add(fM)},show:function(){this.statsEl.classList.remove(fM)}});var gM="a-hidden";function vM(t){t.addEventListener("touchstart",(function(){t.classList.remove("resethover")}),{passive:!0}),t.addEventListener("touchend",(function(){t.classList.add("resethover")}),{passive:!0})}_b("xr-mode-ui",{dependencies:["canvas"],schema:{enabled:{default:!0},enterVRButton:{default:""},enterVREnabled:{default:!0},enterARButton:{default:""},enterAREnabled:{default:!0},XRMode:{default:"vr",oneOf:["vr","ar","xr"]}},sceneOnly:!0,init:function(){var t=this,e=this.el;"false"!==bx("ui")&&(this.insideLoader=!1,this.enterVREl=null,this.enterAREl=null,this.orientationModalEl=null,this.bindMethods(),e.addEventListener("enter-vr",this.updateEnterInterfaces),e.addEventListener("exit-vr",this.updateEnterInterfaces),e.addEventListener("update-vr-devices",this.updateEnterInterfaces),window.addEventListener("message",(function(e){"loaderReady"===e.data.type&&(t.insideLoader=!0,t.remove())})),window.addEventListener("orientationchange",this.toggleOrientationModalIfNeeded))},bindMethods:function(){this.onEnterVRButtonClick=this.onEnterVRButtonClick.bind(this),this.onEnterARButtonClick=this.onEnterARButtonClick.bind(this),this.onModalClick=this.onModalClick.bind(this),this.toggleOrientationModalIfNeeded=this.toggleOrientationModalIfNeeded.bind(this),this.updateEnterInterfaces=this.updateEnterInterfaces.bind(this)},onModalClick:function(){this.el.exitVR()},onEnterVRButtonClick:function(){this.el.enterVR()},onEnterARButtonClick:function(){this.el.enterAR()},update:function(){var t,e,n,i=this.data,r=this.el;if(!i.enabled||this.insideLoader||"false"===bx("ui"))return this.remove();this.enterVREl||this.enterAREl||this.orientationModalEl||(this.enterVREl||!i.enterVREnabled||"xr"!==i.XRMode&&"vr"!==i.XRMode||(i.enterVRButton?(this.enterVREl=document.querySelector(i.enterVRButton),this.enterVREl.addEventListener("click",this.onEnterVRButtonClick)):(this.enterVREl=(t=this.onEnterVRButtonClick,(n=document.createElement("div")).classList.add("a-enter-vr"),n.setAttribute(Sy,""),(e=document.createElement("button")).className="a-enter-vr-button",e.setAttribute("title","Enter VR mode with a headset or fullscreen without"),e.setAttribute(Sy,""),Wy()&&vM(e),n.appendChild(e),e.addEventListener("click",(function(e){t(),e.stopPropagation()})),n),r.appendChild(this.enterVREl))),this.enterAREl||!i.enterAREnabled||"xr"!==i.XRMode&&"ar"!==i.XRMode||(i.enterARButton?(this.enterAREl=document.querySelector(i.enterARButton),this.enterAREl.addEventListener("click",this.onEnterARButtonClick)):(this.enterAREl=function(t,e){var n,i;return(i=document.createElement("div")).classList.add("a-enter-ar"),e&&i.classList.add("xr"),i.setAttribute(Sy,""),(n=document.createElement("button")).className="a-enter-ar-button",n.setAttribute("title","Enter AR mode with a headset or handheld device."),n.setAttribute(Sy,""),Wy()&&vM(n),i.appendChild(n),n.addEventListener("click",(function(e){t(),e.stopPropagation()})),i}(this.onEnterARButtonClick,"xr"===i.XRMode),r.appendChild(this.enterAREl))),this.orientationModalEl=function(t){var e=document.createElement("div");e.className="a-orientation-modal",e.classList.add(gM),e.setAttribute(Sy,"");var n=document.createElement("button");return n.setAttribute(Sy,""),n.innerHTML="Exit VR",n.addEventListener("click",t),e.appendChild(n),e}(this.onModalClick),r.appendChild(this.orientationModalEl),this.updateEnterInterfaces())},remove:function(){[this.enterVREl,this.enterAREl,this.orientationModalEl].forEach((function(t){t&&t.parentNode&&t.parentNode.removeChild(t)})),this.enterVREl=void 0,this.enterAREl=void 0,this.orientationModalEl=void 0},updateEnterInterfaces:function(){this.toggleEnterVRButtonIfNeeded(),this.toggleEnterARButtonIfNeeded(),this.toggleOrientationModalIfNeeded()},toggleEnterVRButtonIfNeeded:function(){var t=this.el;this.enterVREl&&(t.is("vr-mode")||(t.isMobile||Ky())&&!Hy()?this.enterVREl.classList.add(gM):(Hy()||this.enterVREl.classList.add("fullscreen"),this.enterVREl.classList.remove(gM),t.enterVR(!1,!0)))},toggleEnterARButtonIfNeeded:function(){var t=this.el;this.enterAREl&&(t.is("vr-mode")||!zy()?this.enterAREl.classList.add(gM):(this.enterAREl.classList.remove(gM),t.enterVR(!0,!0)))},toggleOrientationModalIfNeeded:function(){var t=this.el,e=this.orientationModalEl;e&&t.isMobile&&(!nE()&&t.is("vr-mode")?e.classList.remove(gM):e.classList.add(gM))}}),sC("box",{schema:{depth:{default:1,min:0},height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"},segmentsDepth:{default:1,min:1,max:20,type:"int"}},init:function(t){this.geometry=new _y.BoxGeometry(t.width,t.height,t.depth,t.segmentsWidth,t.segmentsHeight,t.segmentsDepth)}});var yM=_y.MathUtils.degToRad;sC("circle",{schema:{radius:{default:1,min:0},segments:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(t){this.geometry=new _y.CircleGeometry(t.radius,t.segments,yM(t.thetaStart),yM(t.thetaLength))}});var EM=_y.MathUtils.degToRad;sC("cone",{schema:{height:{default:1,min:0},openEnded:{default:!1},radiusBottom:{default:1,min:0},radiusTop:{default:.01,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(t){this.geometry=new _y.CylinderGeometry(t.radiusTop,t.radiusBottom,t.height,t.segmentsRadial,t.segmentsHeight,t.openEnded,EM(t.thetaStart),EM(t.thetaLength))}});var xM=_y.MathUtils.degToRad;sC("cylinder",{schema:{height:{default:1,min:0},openEnded:{default:!1},radius:{default:1,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(t){this.geometry=new _y.CylinderGeometry(t.radius,t.radius,t.height,t.segmentsRadial,t.segmentsHeight,t.openEnded,xM(t.thetaStart),xM(t.thetaLength))}}),sC("dodecahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(t){this.geometry=new _y.DodecahedronGeometry(t.radius,t.detail)}}),sC("icosahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(t){this.geometry=new _y.IcosahedronGeometry(t.radius,t.detail)}}),sC("octahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(t){this.geometry=new _y.OctahedronGeometry(t.radius,t.detail)}}),sC("plane",{schema:{height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"}},init:function(t){this.geometry=new _y.PlaneGeometry(t.width,t.height,t.segmentsWidth,t.segmentsHeight)}});var bM=_y.MathUtils.degToRad;sC("ring",{schema:{radiusInner:{default:.8,min:0},radiusOuter:{default:1.2,min:0},segmentsPhi:{default:10,min:1,type:"int"},segmentsTheta:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(t){this.geometry=new _y.RingGeometry(t.radiusInner,t.radiusOuter,t.segmentsTheta,t.segmentsPhi,bM(t.thetaStart),bM(t.thetaLength))}});var CM=_y.MathUtils.degToRad;sC("sphere",{schema:{radius:{default:1,min:0},phiLength:{default:360},phiStart:{default:0,min:0},thetaLength:{default:180,min:0},thetaStart:{default:0},segmentsHeight:{default:18,min:2,type:"int"},segmentsWidth:{default:36,min:3,type:"int"}},init:function(t){this.geometry=new _y.SphereGeometry(t.radius,t.segmentsWidth,t.segmentsHeight,CM(t.phiStart),CM(t.phiLength),CM(t.thetaStart),CM(t.thetaLength))}}),sC("tetrahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(t){this.geometry=new _y.TetrahedronGeometry(t.radius,t.detail)}});var wM=_y.MathUtils.degToRad;sC("torus",{schema:{arc:{default:360},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:36,min:2,type:"int"},segmentsTubular:{default:32,min:3,type:"int"}},init:function(t){this.geometry=new _y.TorusGeometry(t.radius,2*t.radiusTubular,t.segmentsRadial,t.segmentsTubular,wM(t.arc))}}),sC("torusKnot",{schema:{p:{default:2,min:1},q:{default:3,min:1},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:8,min:3,type:"int"},segmentsTubular:{default:100,min:3,type:"int"}},init:function(t){this.geometry=new _y.TorusKnotGeometry(t.radius,2*t.radiusTubular,t.segmentsTubular,t.segmentsRadial,t.p,t.q)}});var _M=new _y.Quaternion,MM=new _y.Vector3(0,0,1),SM=new _y.Vector2,IM=new _y.Vector2,BM=new _y.Vector2;function TM(t,e){return e.color.set(t.color),e.fog=t.fog,e.wireframe=t.wireframe,e.toneMapped=t.toneMapped,e.wireframeLinewidth=t.wireframeLinewidth,e}function RM(t,e){return e.color.set(t.color),e.emissive.set(t.emissive),e.emissiveIntensity=t.emissiveIntensity,e.fog=t.fog,e.metalness=t.metalness,e.roughness=t.roughness,e.wireframe=t.wireframe,e.wireframeLinewidth=t.wireframeLinewidth,t.normalMap&&(e.normalScale=t.normalScale),t.ambientOcclusionMap&&(e.aoMapIntensity=t.ambientOcclusionMapIntensity),t.displacementMap&&(e.displacementScale=t.displacementScale,e.displacementBias=t.displacementBias),e}function LM(t,e){switch(e.color.set(t.color),e.specular.set(t.specular),e.emissive.set(t.emissive),e.emissiveIntensity=t.emissiveIntensity,e.fog=t.fog,e.transparent=t.transparent,e.wireframe=t.wireframe,e.wireframeLinewidth=t.wireframeLinewidth,e.shininess=t.shininess,e.flatShading=t.flatShading,e.wireframe=t.wireframe,e.wireframeLinewidth=t.wireframeLinewidth,e.reflectivity=t.reflectivity,e.refractionRatio=t.refractionRatio,t.combine){case"mix":e.combine=_y.MixOperation;break;case"multiply":e.combine=_y.MultiplyOperation;break;case"add":e.combine=_y.AddOperation}return t.normalMap&&(e.normalScale=t.normalScale),t.ambientOcclusionMap&&(e.aoMapIntensity=t.ambientOcclusionMapIntensity),t.bumpMap&&(e.bumpScale=t.bumpMapScale),t.displacementMap&&(e.displacementScale=t.displacementScale,e.displacementBias=t.displacementBias),e}sC("triangle",{schema:{vertexA:{type:"vec3",default:{x:0,y:.5,z:0}},vertexB:{type:"vec3",default:{x:-.5,y:-.5,z:0}},vertexC:{type:"vec3",default:{x:.5,y:-.5,z:0}}},init:function(t){var e,n,i,r,s,o,a,l,c;(i=new _y.Triangle).a.set(t.vertexA.x,t.vertexA.y,t.vertexA.z),i.b.set(t.vertexB.x,t.vertexB.y,t.vertexB.z),i.c.set(t.vertexC.x,t.vertexC.y,t.vertexC.z),n=i.getNormal(new _y.Vector3),_M.setFromUnitVectors(n,MM),r=i.a.clone().applyQuaternion(_M),s=i.b.clone().applyQuaternion(_M),o=i.c.clone().applyQuaternion(_M),SM.set(Math.min(r.x,s.x,o.x),Math.min(r.y,s.y,o.y)),IM.set(Math.max(r.x,s.x,o.x),Math.max(r.y,s.y,o.y)),BM.set(0,0).subVectors(IM,SM),r=(new _y.Vector2).subVectors(r,SM).divide(BM),s=(new _y.Vector2).subVectors(s,SM).divide(BM),o=(new _y.Vector2).subVectors(o,SM).divide(BM),e=this.geometry=new _y.BufferGeometry,a=[i.a.x,i.a.y,i.a.z,i.b.x,i.b.y,i.b.z,i.c.x,i.c.y,i.c.z],l=[n.x,n.y,n.z,n.x,n.y,n.z,n.x,n.y,n.z],c=[r.x,r.y,s.x,s.y,o.x,o.y],e.setAttribute("position",new _y.Float32BufferAttribute(a,3)),e.setAttribute("normal",new _y.Float32BufferAttribute(l,3)),e.setAttribute("uv",new _y.Float32BufferAttribute(c,2))}}),vC("flat",{schema:{color:{type:"color"},fog:{default:!0},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},src:{type:"map"},wireframe:{default:!1},wireframeLinewidth:{default:2},toneMapped:{default:!0}},init:function(t){this.materialData={color:new _y.Color},TM(t,this.materialData),this.material=new _y.MeshBasicMaterial(this.materialData)},update:function(t){this.updateMaterial(t),OE(this,t)},updateMaterial:function(t){var e;for(e in TM(t,this.materialData),this.materialData)this.material[e]=this.materialData[e]}}),vC("standard",{schema:{ambientOcclusionMap:{type:"map"},ambientOcclusionMapIntensity:{default:1},ambientOcclusionTextureOffset:{type:"vec2"},ambientOcclusionTextureRepeat:{type:"vec2",default:{x:1,y:1}},color:{type:"color"},displacementMap:{type:"map"},displacementScale:{default:1},displacementBias:{default:.5},displacementTextureOffset:{type:"vec2"},displacementTextureRepeat:{type:"vec2",default:{x:1,y:1}},emissive:{type:"color",default:"#000"},emissiveIntensity:{default:1},envMap:{default:""},fog:{default:!0},metalness:{default:0,min:0,max:1},metalnessMap:{type:"map"},metalnessTextureOffset:{type:"vec2"},metalnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},normalMap:{type:"map"},normalScale:{type:"vec2",default:{x:1,y:1}},normalTextureOffset:{type:"vec2"},normalTextureRepeat:{type:"vec2",default:{x:1,y:1}},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},roughness:{default:.5,min:0,max:1},roughnessMap:{type:"map"},roughnessTextureOffset:{type:"vec2"},roughnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},sphericalEnvMap:{type:"map"},src:{type:"map"},wireframe:{default:!1},wireframeLinewidth:{default:2}},init:function(t){this.materialData={color:new _y.Color,emissive:new _y.Color},RM(t,this.materialData),this.material=new _y.MeshStandardMaterial(this.materialData)},update:function(t){this.updateMaterial(t),OE(this,t),FE("normal",this,t),FE("displacement",this,t),FE("ambientOcclusion",this,t),FE("metalness",this,t),FE("roughness",this,t),NE(this,t)},updateMaterial:function(t){var e,n=this.material;for(e in RM(t,this.materialData),this.materialData)n[e]=this.materialData[e]}}),vC("phong",{schema:{color:{type:"color"},emissive:{type:"color",default:"black"},emissiveIntensity:{default:1},specular:{type:"color",default:"#111111"},transparent:{default:!1},fog:{default:!0},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},src:{type:"map"},envMap:{default:""},sphericalEnvMap:{type:"map"},shininess:{default:30},flatShading:{default:!1},wireframe:{default:!1},wireframeLinewidth:{default:2},combine:{oneOF:["multiply","mix","add"],default:"mix"},reflectivity:{default:.9},refractionRatio:{default:.98},refract:{default:!1},normalMap:{type:"map"},normalScale:{type:"vec2",default:{x:1,y:1}},normalTextureOffset:{type:"vec2"},normalTextureRepeat:{type:"vec2",default:{x:1,y:1}},ambientOcclusionMap:{type:"map"},ambientOcclusionMapIntensity:{default:1},displacementMap:{type:"map"},displacementScale:{default:1},displacementBias:{default:.5},displacementTextureOffset:{type:"vec2"},displacementTextureRepeat:{type:"vec2",default:{x:1,y:1}},bumpMap:{type:"map"},bumpMapScale:{default:1},bumpTextureOffset:{type:"vec2"},bumpTextureRepeat:{type:"vec2",default:{x:1,y:1}}},init:function(t){this.materialData={color:new _y.Color,specular:new _y.Color,emissive:new _y.Color},LM(t,this.materialData),this.material=new _y.MeshPhongMaterial(this.materialData);var e=this.el.sceneEl;Object.defineProperty(this.material,"envMap",{get:function(){return this._envMap||e.object3D.environment},set:function(t){this._envMap=t}})},update:function(t){this.updateMaterial(t),OE(this,t),FE("normal",this,t),FE("displacement",this,t),FE("ambientOcclusion",this,t),FE("bump",this,t),NE(this,t)},updateMaterial:function(t){var e;for(e in LM(t,this.materialData),this.materialData)this.material[e]=this.materialData[e]}}),vC("sdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},opacity:{type:"number",is:"uniform",default:1}},vertexShader:["#include <common>","#include <fog_pars_vertex>","#include <logdepthbuf_pars_vertex>","out vec2 vUV;","void main(void) {"," vUV = uv;"," #include <begin_vertex>"," #include <project_vertex>"," #include <logdepthbuf_vertex>"," #include <fog_vertex>","}"].join("\n"),fragmentShader:["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","float contour(float width, float value) {"," return smoothstep(0.5 - value, 0.5 + value, width);","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec2 uv = vUV;"," vec4 texColor = texture(map, uv);"," float dist = texColor.a;"," float width = fwidth(dist);"," float alpha = contour(dist, width);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(uv) + dFdy(uv));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * dist;"," }"," if (isBigEnough <= BIG_ENOUGH) {"," vec4 box = vec4 (uv - duv, uv + duv);"," alpha = (alpha + 0.5 * ("," contour(texture(map, box.xy).a, width)"," + contour(texture(map, box.zw).a, width)"," + contour(texture(map, box.xw).a, width)"," + contour(texture(map, box.zy).a, width)"," )) / 3.0;"," }"," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," gl_FragColor = vec4(color, opacity * alpha);"," #include <logdepthbuf_fragment>"," #include <tonemapping_fragment>"," #include <colorspace_fragment>"," #include <fog_fragment>","}"].join("\n"),init:function(){return this.uniforms=_y.UniformsUtils.merge([_y.UniformsLib.fog,this.initUniforms()]),this.material=new _y.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,fog:!0}),this.material}}),vC("msdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},negate:{type:"boolean",is:"uniform",default:!0},opacity:{type:"number",is:"uniform",default:1}},vertexShader:["#include <common>","#include <fog_pars_vertex>","#include <logdepthbuf_pars_vertex>","out vec2 vUV;","void main(void) {"," vUV = uv;"," #include <begin_vertex>"," #include <project_vertex>"," #include <logdepthbuf_vertex>"," #include <fog_vertex>","}"].join("\n"),fragmentShader:["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","uniform bool negate;","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","float median(float r, float g, float b) {"," return max(min(r, g), min(max(r, g), b));","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec3 sampleColor = texture(map, vUV).rgb;"," if (negate) { sampleColor = 1.0 - sampleColor; }"," float sigDist = median(sampleColor.r, sampleColor.g, sampleColor.b) - 0.5;"," float alpha = clamp(sigDist / fwidth(sigDist) + 0.5, 0.0, 1.0);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(vUV) + dFdy(vUV));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," // Do modified alpha test."," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * (sigDist + 0.5);"," }"," // Do modified alpha test."," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," gl_FragColor = vec4(color.xyz, alpha * opacity);"," #include <logdepthbuf_fragment>"," #include <tonemapping_fragment>"," #include <colorspace_fragment>"," #include <fog_fragment>","}"].join("\n"),init:function(){return this.uniforms=_y.UniformsUtils.merge([_y.UniformsLib.fog,this.initUniforms()]),this.material=new _y.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,fog:!0}),this.material}}),vC("shadow",{schema:{opacity:{default:.5},transparent:{default:!0},alphaToCoverage:{default:!0}},init:function(t){this.material=new _y.ShadowMaterial},update:function(t){this.material.opacity=t.opacity,this.material.alphaToCoverage=t.alphaToCoverage,this.material.transparent=t.transparent}});var DM="data-aframe-default-camera";function PM(t){var e=t.primitive,n=nC[e]&&nC[e].Geometry,i=new n;if(!n)throw new Error("Unknown geometry `"+e+"`");return i.init(t),i.geometry}Db("camera",{init:function(){this.activeCameraEl=null,this.render=this.render.bind(this),this.unwrapRender=this.unwrapRender.bind(this),this.wrapRender=this.wrapRender.bind(this),this.initialCameraFound=!1,this.numUserCameras=0,this.numUserCamerasChecked=0,this.setupInitialCamera()},setupInitialCamera:function(){var t,e,n=this.sceneEl,i=this;if(!n.camera||n.camera.el.getAttribute("camera").spectator)if((t=n.querySelectorAll("a-camera, :not(a-mixin)[camera]")).length)for(this.numUserCameras=t.length,e=0;e<t.length;e++)t[e].addEventListener("object3dset",(function(t){"camera"===t.detail.type&&i.checkUserCamera(this)})),t[e].isNode?t[e].load():t[e].addEventListener("nodeready",(function(){this.load()}));else this.createDefaultCamera();else n.emit("cameraready",{cameraEl:n.camera.el})},checkUserCamera:function(t){var e,n=this.el.sceneEl;this.numUserCamerasChecked++,this.initialCameraFound||((e=t.getAttribute("camera")).active&&!e.spectator?(this.initialCameraFound=!0,n.camera=t.getObject3D("camera"),n.emit("cameraready",{cameraEl:t})):this.numUserCamerasChecked===this.numUserCameras&&this.createDefaultCamera())},createDefaultCamera:function(){var t,e=this.sceneEl;(t=document.createElement("a-entity")).setAttribute("camera",{active:!0}),t.setAttribute("position",{x:0,y:1.6,z:0}),t.setAttribute("wasd-controls",""),t.setAttribute("look-controls",""),t.setAttribute(Sy,""),t.addEventListener("object3dset",(function(n){"camera"===n.detail.type&&(e.camera=n.detail.object,e.emit("cameraready",{cameraEl:t}))})),e.appendChild(t)},disableActiveCamera:function(){var t;(t=this.sceneEl.querySelectorAll(":not(a-mixin)[camera]"))[t.length-1].setAttribute("camera","active",!0)},setActiveCamera:function(t){var e,n,i,r,s=this.activeCameraEl,o=this.sceneEl;if((r=t.getObject3D("camera"))&&t!==this.activeCameraEl){var a=o.querySelector("["+DM+"]");for(t!==(a&&a.querySelector(":not(a-mixin)[camera]"))&&function(t){var e;t.camera&&(e=t.querySelector("["+DM+"]"))&&t.removeChild(e)}(o),this.activeCameraEl=t,this.activeCameraEl.play(),o.camera=r,s&&s.setAttribute("camera","active",!1),n=o.querySelectorAll(":not(a-mixin)[camera]"),i=0;i<n.length;i++)(e=n[i]).isEntity&&t!==e&&(e.setAttribute("camera","active",!1),e.pause());o.emit("camera-set-active",{cameraEl:t})}},setSpectatorCamera:function(t){var e,n=this.spectatorCameraEl,i=this.sceneEl;t.getObject3D("camera")&&t!==this.spectatorCameraEl&&(n&&n.setAttribute("camera","spectator",!1),e=this.spectatorCameraEl=t,i.addEventListener("enter-vr",this.wrapRender),i.addEventListener("exit-vr",this.unwrapRender),e.setAttribute("camera","active",!1),e.play(),i.emit("camera-set-spectator",{cameraEl:t}))},disableSpectatorCamera:function(){this.spectatorCameraEl=void 0},wrapRender:function(){this.spectatorCameraEl&&!this.originalRender&&(this.originalRender=this.sceneEl.renderer.render,this.sceneEl.renderer.render=this.render)},unwrapRender:function(){this.originalRender&&(this.sceneEl.renderer.render=this.originalRender,this.originalRender=void 0)},render:function(t,e){var n,i,r=this.sceneEl;n=r.renderer.xr.enabled,this.originalRender.call(r.renderer,t,e),this.spectatorCameraEl&&!r.isMobile&&n&&(i=this.spectatorCameraEl.components.camera.camera,r.renderer.xr.enabled=!1,this.originalRender.call(r.renderer,t,i),r.renderer.xr.enabled=n)}}),Db("geometry",{init:function(){this.cache={},this.cacheCount={}},clearCache:function(){this.cache={},this.cacheCount={}},getOrCreateGeometry:function(t){var e,n,i=this.cache;return t.skipCache?PM(t):(e=i[n=this.hash(t)],function(t,e){t[e]=void 0===t[e]?1:t[e]+1}(this.cacheCount,n),e||(e=PM(t),i[n]=e,e))},unuseGeometry:function(t){var e,n=this.cache,i=this.cacheCount;t.skipCache||n[e=this.hash(t)]&&(function(t,e){t[e]--}(i,e),i[e]>0||(n[e].dispose(),delete n[e],delete i[e]))},hash:function(t){return JSON.stringify(t)}}),Db("gltf-model",{schema:{dracoDecoderPath:{default:"https://www.gstatic.com/draco/versioned/decoders/1.5.7/"},basisTranscoderPath:{default:""},meshoptDecoderPath:{default:""}},init:function(){this.update()},update:function(){var t=this.data.dracoDecoderPath,e=this.data.basisTranscoderPath,n=this.data.meshoptDecoderPath;!this.dracoLoader&&t&&(this.dracoLoader=new _y.DRACOLoader,this.dracoLoader.setDecoderPath(t)),!this.ktx2Loader&&e&&(this.ktx2Loader=new _y.KTX2Loader,this.ktx2Loader.setTranscoderPath(e).detectSupport(this.el.renderer)),!this.meshoptDecoder&&n&&(this.meshoptDecoder=function(t){return new Promise((function(e,n){var i=document.createElement("script");document.body.appendChild(i),i.onload=e,i.onerror=n,i.async=!0,i.src=t}))}(n).then((function(){return window.MeshoptDecoder.ready})).then((function(){return window.MeshoptDecoder})))},getDRACOLoader:function(){return this.dracoLoader},getKTX2Loader:function(){return this.ktx2Loader},getMeshoptDecoder:function(){return this.meshoptDecoder}});var UM="data-aframe-default-light",OM=(Db("light",{schema:{defaultLightsEnabled:{default:!0}},init:function(){this.defaultLights=!1,this.userDefinedLights=!1,this.sceneEl.addEventListener("loaded",this.setupDefaultLights.bind(this))},registerLight:function(t){t.hasAttribute(UM)||(this.removeDefaultLights(),this.userDefinedLights=!0)},removeDefaultLights:function(){var t,e=this.sceneEl;if(this.defaultLights){t=document.querySelectorAll("["+UM+"]");for(var n=0;n<t.length;n++)e.removeChild(t[n]);this.defaultLights=!1}},setupDefaultLights:function(){var t,e,n=this.sceneEl;this.userDefinedLights||this.defaultLights||!this.data.defaultLightsEnabled||((t=document.createElement("a-entity")).setAttribute("light",{color:"#BBB",type:"ambient"}),t.setAttribute(UM,""),t.setAttribute(Sy,""),n.appendChild(t),(e=document.createElement("a-entity")).setAttribute("light",{color:"#FFF",intensity:1.884,castShadow:!0}),e.setAttribute("position",{x:-.5,y:1,z:1}),e.setAttribute(UM,""),e.setAttribute(Sy,""),n.appendChild(e),this.defaultLights=!0)}}),Ly),FM=OM("components:texture:error"),kM=OM("components:texture:warn"),NM=new _y.ImageLoader;Db("material",{init:function(){this.materials={},this.sourceCache={}},clearTextureSourceCache:function(){this.sourceCache={}},loadTexture:function(t,e,n){this.loadTextureSource(t,(function(t){var i=zE(t);PE(i,e),n(i)}))},loadTextureSource:function(t,e){var n=this,i=this.sourceCache,r=this.hash(t);function s(t){i[r]=Promise.resolve(t),i[r].then(e)}i[r]?i[r].then(e):"CANVAS"!==t.tagName?s(new Promise((function(e,i){SE(t,(function(t){n.loadImage(t,e)}),(function(t){n.loadVideo(t,e)}))}))):s(new _y.Source(t))},loadCubeMapTexture:function(t,e){var n=this,i=0,r=new _y.CubeTexture;function s(s){n.loadTextureSource(t[s],(function(t){r.images[s]=t.data,6==++i&&(r.needsUpdate=!0,e(r))}))}if(r.colorSpace=_y.SRGBColorSpace,6===t.length)for(var o=0;o<t.length;o++)s(o);else kM("Cube map texture requires exactly 6 sources, got only %s sources",t.length)},loadImage:function(t,e){e("string"==typeof t?function(t){return new Promise((function(e,n){NM.load(t,(function(t){e(new _y.Source(t))}),(function(){}),(function(t){FM("`$s` could not be fetched (Error code: %s; Response: %s)",t.status,t.statusText)}))}))}(t):new _y.Source(t))},loadVideo:function(t,e){var n;"string"!=typeof t&&function(t){t.autoplay=t.hasAttribute("autoplay")&&"false"!==t.getAttribute("autoplay"),t.controls=t.hasAttribute("controls")&&"false"!==t.getAttribute("controls"),"false"===t.getAttribute("loop")&&t.removeAttribute("loop"),"false"===t.getAttribute("preload")&&(t.preload="none"),t.crossOrigin=t.crossOrigin||"anonymous",t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline","")}(n=t),n=n||function(t){var e=document.createElement("video");return e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline",""),e.autoplay=!0,e.loop=!0,e.crossOrigin="anonymous",e.addEventListener("error",(function(){kM("`%s` is not a valid video",t)}),!0),e.src=t,e}(t),e(new _y.Source(n))},hash:function(t){return t.tagName&&(t.id||t.src)||t},registerMaterial:function(t){this.materials[t.uuid]=t},unregisterMaterial:function(t){delete this.materials[t.uuid]}}),Db("obb-collider",{schema:{showColliders:{default:!1}},init:function(){this.collisions=[],this.colliderEls=[]},addCollider:function(t){this.colliderEls.push(t),this.data.showColliders?t.components["obb-collider"].showCollider():t.components["obb-collider"].hideCollider(),this.tick=this.detectCollisions},removeCollider:function(t){var e=this.colliderEls,n=e.indexOf(t);t.components["obb-collider"].hideCollider(),n>-1&&e.splice(n,1),0===e.length&&(this.tick=void 0)},registerCollision:function(t,e){var n=this.collisions,i=!1,r=t.obb,s=e.obb,o=t.renderColliderMesh,a=e.renderColliderMesh;o&&o.material.color.set(16711680),a&&a.material.color.set(16711680);for(var l=0;l<n.length;l++)if(n[l].componentA.obb===r&&n[l].componentB.obb===s||n[l].componentA.obb===s&&n[l].componentB.obb===r){i=!0,n[l].detected=!0;break}i||(n.push({componentA:t,componentB:e,detected:!0}),t.el.emit("obbcollisionstarted",{trackedObject3D:t.trackedObject3D,withEl:e.el}),e.el.emit("obbcollisionstarted",{trackedObject3D:e.trackedObject3D,withEl:t.el}))},resetCollisions:function(){for(var t=this.collisions,e=0;e<t.length;e++)t[e].detected=!1},clearCollisions:function(){for(var t,e,n,i,r=this.collisions,s=[],o=0;o<r.length;o++)r[o].detected?s.push(r[o]):(t=r[o].componentA,e=r[o].componentB,n=t.renderColliderMesh,i=e.renderColliderMesh,n&&n.material.color.set(65280),t.el.emit("obbcollisionended",{trackedObject3D:this.trackedObject3D,withEl:e.el}),i&&i.material.color.set(65280),e.el.emit("obbcollisionended",{trackedObject3D:this.trackedObject3D,withEl:t.el}));this.collisions=s},detectCollisions:function(){var t,e,n,i,r=this.colliderEls;if(!(r.length<2)){this.resetCollisions();for(var s=0;s<r.length;s++)if(n=r[s].components["obb-collider"],0!==(t=r[s].components["obb-collider"].obb).halfSize.x&&0!==t.halfSize.y&&0!==t.halfSize.z)for(var o=s+1;o<r.length;o++)0!==(e=(i=r[o].components["obb-collider"]).obb).halfSize.x&&0!==e.halfSize.y&&0!==e.halfSize.z&&t.intersectsOBB(e)&&this.registerCollision(n,i);this.clearCollisions()}}});var QM=Ly("components:renderer:warn");function GM(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z-e.z}function zM(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder-e.renderOrder}function HM(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:e.z-t.z}Db("renderer",{schema:{antialias:{default:"auto",oneOf:["true","false","auto"]},highRefreshRate:{default:Zy()},logarithmicDepthBuffer:{default:"auto",oneOf:["true","false","auto"]},maxCanvasWidth:{default:-1},maxCanvasHeight:{default:-1},multiviewStereo:{default:!1},exposure:{default:1,if:{toneMapping:["ACESFilmic","linear","reinhard","cineon","AgX","neutral"]}},toneMapping:{default:"no",oneOf:["no","ACESFilmic","linear","reinhard","cineon","AgX","neutral"]},precision:{default:"high",oneOf:["high","medium","low"]},anisotropy:{default:1},sortTransparentObjects:{default:!1},colorManagement:{default:!0},alpha:{default:!0},stencil:{default:!1},foveationLevel:{default:1}},init:function(){var t=this.data,e=this.el,n=this.data.toneMapping.charAt(0).toUpperCase()+this.data.toneMapping.slice(1),i=e.renderer;i.toneMapping=_y[n+"ToneMapping"],_y.Texture.DEFAULT_ANISOTROPY=t.anisotropy,_y.ColorManagement.enabled=t.colorManagement,i.outputColorSpace=t.colorManagement?_y.SRGBColorSpace:_y.LinearSRGBColorSpace,e.hasAttribute("antialias")&&QM('Component `antialias` is deprecated. Use `renderer="antialias: true"` instead.'),e.hasAttribute("logarithmicDepthBuffer")&&QM('Component `logarithmicDepthBuffer` is deprecated. Use `renderer="logarithmicDepthBuffer: true"` instead.'),i.sortObjects=!0,i.setOpaqueSort(GM)},update:function(){var t=this.data,e=this.el.renderer,n=this.data.toneMapping.charAt(0).toUpperCase()+this.data.toneMapping.slice(1);e.toneMapping=_y[n+"ToneMapping"],e.toneMappingExposure=t.exposure,e.xr.setFoveation(t.foveationLevel),t.sortObjects&&QM('`sortObjects` property is deprecated. Use `renderer="sortTransparentObjects: true"` instead.'),t.sortTransparentObjects?e.setTransparentSort(HM):e.setTransparentSort(zM)},applyColorCorrection:function(t){this.data.colorManagement&&t&&t.isTexture&&t.colorSpace!==_y.SRGBColorSpace&&(t.colorSpace=_y.SRGBColorSpace,t.needsUpdate=!0)},setWebXRFrameRate:function(t){var e,n=this.data,i=t.supportedFrameRates;i&&t.updateTargetFrameRate&&(e=i.includes(90)?n.highRefreshRate?90:72:n.highRefreshRate?72:60,t.updateTargetFrameRate(e).catch((function(t){console.warn("failed to set target frame rate of "+e+". Error info: "+t)})))}});var VM={basic:_y.BasicShadowMap,pcf:_y.PCFShadowMap,pcfsoft:_y.PCFSoftShadowMap};Db("shadow",{schema:{enabled:{default:!0},autoUpdate:{default:!0},type:{default:"pcf",oneOf:["basic","pcf","pcfsoft"]}},init:function(){var t=this.sceneEl,e=this.data;this.shadowMapEnabled=!1,t.renderer.shadowMap.type=VM[e.type],t.renderer.shadowMap.autoUpdate=e.autoUpdate},update:function(t){t.enabled!==this.data.enabled&&this.setShadowMapEnabled(this.shadowMapEnabled)},setShadowMapEnabled:function(t){var e=this.sceneEl,n=this.sceneEl.renderer;this.shadowMapEnabled=t;var i=this.data.enabled&&this.shadowMapEnabled;n&&i!==n.shadowMap.enabled&&(n.shadowMap.enabled=i,function(t){t.hasLoaded&&t.object3D.traverse((function(t){if(t.material)for(var e=Array.isArray(t.material)?t.material:[t.material],n=0;n<e.length;n++)e[n].needsUpdate=!0}))}(e))}}),Db("tracked-controls",{init:function(){this.controllers=[],this.onInputSourcesChange=this.onInputSourcesChange.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.el.addEventListener("enter-vr",this.onEnterVR),this.onExitVR=this.onExitVR.bind(this),this.el.addEventListener("exit-vr",this.onExitVR)},onEnterVR:function(){this.el.xrSession&&this.el.xrSession.addEventListener("inputsourceschange",this.onInputSourcesChange)},onExitVR:function(){this.referenceSpace=void 0,this.controllers=[],this.el.emit("controllersupdated",void 0,!1)},onInputSourcesChange:function(){var t=this,e=this.el.xrSession,n=this.el.sceneEl.systems.webxr.sessionReferenceSpaceType;e.requestReferenceSpace(n).then((function(e){t.referenceSpace=e})).catch((function(e){throw t.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(n,'tracked-controls uses reference space "'+n+'".'),e})),this.controllers=e.inputSources,this.el.emit("controllersupdated",void 0,!1)}});var jM=Ly("systems:webxr:warn"),WM=(Db("webxr",{schema:{referenceSpaceType:{type:"string",default:"local-floor"},requiredFeatures:{type:"array",default:["local-floor"]},optionalFeatures:{type:"array",default:["bounded-floor"]},overlayElement:{type:"selector"}},update:function(){var t=this.data;this.sessionConfiguration={requiredFeatures:t.requiredFeatures,optionalFeatures:t.optionalFeatures},this.sessionReferenceSpaceType=t.referenceSpaceType,t.overlayElement&&(t.overlayElement.classList.remove("a-dom-overlay"),t.optionalFeatures.includes("dom-overlay")||(t.optionalFeatures.push("dom-overlay"),this.el.setAttribute("webxr",t)),this.warnIfFeatureNotRequested("dom-overlay"),this.sessionConfiguration.domOverlay={root:t.overlayElement},t.overlayElement.classList.add("a-dom-overlay"))},wasFeatureRequested:function(t){return"viewer"===t||"local"===t||!(!this.sessionConfiguration.requiredFeatures.includes(t)&&!this.sessionConfiguration.optionalFeatures.includes(t))},warnIfFeatureNotRequested:function(t,e){this.wasFeatureRequested(t)||jM((e?e+" ":"")+'Please add the feature "'+t+"\" to a-scene's webxr system options in requiredFeatures/optionalFeatures.")}}),{});function qM(t){var e=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();"fog"===t&&(e="material-fog"),"visible"===t&&(e="material-visible"),WM[e]="material."+t}function XM(){return{defaultComponents:{material:{}},mappings:dx({},WM)}}Object.keys(cb.material.schema).forEach(qM),Object.keys(AC.standard.schema).forEach(qM);var YM=new _y.Vector3,JM=new _y.Vector3;_b("pivot",{dependencies:["position"],schema:{type:"vec3"},init:function(){var t=this.data,e=this.el,n=e.object3D.parent,i=e.object3D,r=new _y.Group;YM.copy(i.position),JM.copy(i.rotation),n.remove(i),r.add(i),n.add(r),e.object3D=r,i.position.set(-1*t.x,-1*t.y,-1*t.z),r.position.set(t.x+YM.x,t.y+YM.y,t.z+YM.z),r.rotation.copy(i.rotation),i.rotation.set(0,0,0)}}),dC("a-camera",{defaultComponents:{camera:{},"look-controls":{},"wasd-controls":{},position:{x:0,y:1.6,z:0}},mappings:{active:"camera.active",far:"camera.far",fov:"camera.fov","look-controls-enabled":"look-controls.enabled",near:"camera.near","pointer-lock-enabled":"look-controls.pointerLockEnabled","wasd-controls-enabled":"wasd-controls.enabled","reverse-mouse-drag":"look-controls.reverseMouseDrag",zoom:"camera.zoom"}}),dC("a-cursor",px({},XM(),{defaultComponents:{cursor:{},geometry:{primitive:"ring",radiusOuter:.016,radiusInner:.01,segmentsTheta:32},material:{color:"#000",shader:"flat",opacity:.8},position:{x:0,y:0,z:-1}},mappings:{far:"raycaster.far",fuse:"cursor.fuse","fuse-timeout":"cursor.fuseTimeout",interval:"raycaster.interval",objects:"raycaster.objects"}})),dC("a-curvedimage",px({},XM(),{defaultComponents:{geometry:{height:1,primitive:"cylinder",radius:2,segmentsRadial:48,thetaLength:270,openEnded:!0,thetaStart:0},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0,repeat:"-1 1"}},mappings:{height:"geometry.height","open-ended":"geometry.openEnded",radius:"geometry.radius",segments:"geometry.segmentsRadial",start:"geometry.thetaStart","theta-length":"geometry.thetaLength","theta-start":"geometry.thetaStart",width:"geometry.thetaLength"}})),dC("a-gltf-model",{mappings:{src:"gltf-model"}}),dC("a-image",px({},XM(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}})),dC("a-light",{defaultComponents:{light:{}},mappings:{angle:"light.angle",color:"light.color","ground-color":"light.groundColor",decay:"light.decay",distance:"light.distance",intensity:"light.intensity",penumbra:"light.penumbra",type:"light.type",target:"light.target",envmap:"light.envMap","shadow-camera-automatic":"light.shadowCameraAutomatic"}}),dC("a-link",{defaultComponents:{link:{visualAspectEnabled:!0}},mappings:{href:"link.href",image:"link.image",title:"link.title"}}),dC("a-obj-model",px({},XM(),{defaultComponents:{"obj-model":{}},mappings:{src:"obj-model.obj",mtl:"obj-model.mtl"}}));const KM={},ZM=KM;function $M(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var tS,eS;iC.forEach((function(t){var e=nC[t],n=$M(t),i={};Object.keys(e.schema).forEach((function(t){i[$M(t)]="geometry."+t}));var r="a-"+n,s=dC(r,px({},XM(),{defaultComponents:{geometry:{primitive:t}},mappings:i}));KM[r]=s})),dC("a-sky",px({},XM(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",side:"back",shader:"flat",npot:!0},scale:"-1 1 1"},mappings:px({},ZM["a-sphere"].mappings)})),dC("a-sound",{defaultComponents:{sound:{}},mappings:{src:"sound.src",on:"sound.on",autoplay:"sound.autoplay",loop:"sound.loop",volume:"sound.volume"}}),tS={text:{anchor:"align",width:5}},eS=eS||{},Object.keys(tS).forEach((function(t){!function(t,e){var n=cb[t].schema;Object.keys(n).forEach((function(n){var i=n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();void 0!==e[i]&&(i=t+"-"+n),e[i]=t+"."+n}))}(t,eS)})),dC("a-text",px({},null,{defaultComponents:tS,mappings:eS})),dC("a-video",px({},XM(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}})),dC("a-videosphere",px({},XM(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",shader:"flat",side:"back",npot:!0},scale:"-1 1 1"},mappings:{radius:"geometry.radius","segments-height":"geometry.segmentsHeight","segments-width":"geometry.segmentsWidth"}}));var nS=Ly,iS=nS("A-Frame:error"),rS=nS("A-Frame:warn");window.document.currentScript&&window.document.currentScript.parentNode!==window.document.head&&!window.debug&&rS("Put the A-Frame <script> tag in the <head> of the HTML *before* the scene to ensure everything for A-Frame is properly registered before they are used from HTML."),window.cordova||"file:"!==window.location.protocol||iS("This HTML file is currently being served via the file:// protocol. Assets, textures, and models WILL NOT WORK due to cross-origin policy! Please use a local or hosted server: https://aframe.io/docs/1.4.0/introduction/installation.html#use-a-local-server."),iE&&(window.logs=nS,n(7180),n(9379)),console.log("A-Frame Version: 1.6.0 (Date 2025-02-09, Commit #b9e4838)"),console.log("THREE Version (https://github.com/supermedium/three.js):",_y.REVISION),window.AFRAME_ASYNC||("complete"!==document.readyState?document.addEventListener("readystatechange",(function t(){"complete"===document.readyState&&(document.removeEventListener("readystatechange",t),Bb())})):Bb());const sS=globalThis.AFRAME={AComponent:Cb,AEntity:Hb,ANode:Fb,ANIME:Rt,AScene:Kb,components:cb,coreComponents:Object.keys(cb),geometries:nC,registerComponent:_b,registerGeometry:sC,registerPrimitive:dC,registerShader:vC,registerSystem:Db,primitives:{getMeshMixin:XM,primitives:uC},scenes:Fx,schema:p,shaders:AC,systems:Rb,emitReady:Bb,THREE:_y,utils:d,version:_C}})(),i.default})())); +//# sourceMappingURL=aframe-master.min.js.map(()=>{if(AFRAME.registerGeometry("prism",{schema:{depth:{default:1,min:0},height:{default:1,min:0},width:{default:1,min:0}},init:function(t){const i=new THREE.Shape;i.moveTo(t.width/2,0),i.lineTo(0,t.height),i.lineTo(-t.width/2,0),i.lineTo(t.width/2,0);const e={steps:2,depth:t.depth,bevelEnabled:!1};this.geometry=new THREE.ExtrudeGeometry(i,e)}}),"undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("blink-controls",{schema:{button:{default:"",oneOf:["trackpad","trigger","grip","menu","thumbstick"]},startEvents:{type:"array",default:[]},endEvents:{type:"array",default:[]},cancelEvents:{type:"array",default:[]},collisionEntities:{default:""},hitEntity:{type:"selector"},cameraRig:{type:"selector",default:"#player"},teleportOrigin:{type:"selector",default:"#camera"},hitCylinderColor:{type:"color",default:"#4d93fd"},hitCylinderRadius:{default:.25,min:0},hitCylinderHeight:{default:.3,min:0},interval:{default:0},curveNumberPoints:{default:60,min:2},curveLineWidth:{default:.025},curveHitColor:{type:"color",default:"#4d93fd"},curveMissColor:{type:"color",default:"#ff0000"},curveShootingSpeed:{default:10,min:0},defaultPlaneSize:{default:100},landingNormal:{type:"vec3",default:{x:0,y:1,z:0}},landingMaxAngle:{default:"45",min:0,max:360},drawIncrementally:{default:!0},incrementalDrawMs:{default:300},missOpacity:{default:.8},hitOpacity:{default:.8},snapTurn:{default:!0},rotateOnTeleport:{default:!0}},init:function(){const t=this.data,i=this.el;let e;this.active=!1,this.obj=i.object3D,this.controllerPosition=new THREE.Vector3,this.hitEntityQuaternion=new THREE.Quaternion,this.teleportOriginQuaternion=new THREE.Quaternion,this.hitPoint=new THREE.Vector3,this.collisionObjectNormalMatrix=new THREE.Matrix3,this.collisionWorldNormal=new THREE.Vector3,this.rigWorldPosition=new THREE.Vector3,this.newRigWorldPosition=new THREE.Vector3,this.teleportEventDetail={oldPosition:this.rigWorldPosition,newPosition:this.newRigWorldPosition,hitPoint:this.hitPoint,rotationQuaternion:this.hitEntityQuaternion},this.hit=!1,this.prevCheckTime=void 0,this.referenceNormal=new THREE.Vector3,this.curveMissColor=new THREE.Color,this.curveHitColor=new THREE.Color,this.raycaster=new THREE.Raycaster,this.defaultPlane=this.createDefaultPlane(this.data.defaultPlaneSize),this.defaultCollisionMeshes=[this.defaultPlane];const n=this.teleportEntity=document.createElement("a-entity");if(n.classList.add("teleportRay"),n.setAttribute("visible",!1),i.sceneEl.appendChild(this.teleportEntity),this.onButtonDown=this.onButtonDown.bind(this),this.onButtonUp=this.onButtonUp.bind(this),this.cancel=this.cancel.bind(this),this.handleThumbstickAxis=this.handleThumbstickAxis.bind(this),this.teleportOrigin=this.data.teleportOrigin,this.cameraRig=this.data.cameraRig,this.snapturnRotation=THREE.MathUtils.degToRad(45),this.canSnapturn=!0,this.addedEvents=[],this.data.startEvents.length&&this.data.endEvents.length){for(e=0;e<this.data.startEvents.length;e++)this.addedEvents.push([this.data.startEvents[e],this.onButtonDown]),i.addEventListener(this.data.startEvents[e],this.onButtonDown);for(e=0;e<this.data.endEvents.length;e++)this.addedEvents.push([this.data.endEvents[e],this.onButtonUp]),i.addEventListener(this.data.endEvents[e],this.onButtonUp)}else t.button?(this.addedEvents.push([t.button+"down",this.onButtonDown]),this.addedEvents.push([t.button+"up",this.onButtonUp]),i.addEventListener(t.button+"down",this.onButtonDown),i.addEventListener(t.button+"up",this.onButtonUp)):this.thumbstickAxisActivation=!0;for(e=0;e<this.data.cancelEvents.length;e++)this.addedEvents.push([this.data.cancelEvents[e],this.cancel]),i.addEventListener(this.data.cancelEvents[e],this.cancel);this.addedEvents.push(["thumbstickmoved",this.handleThumbstickAxis]),i.addEventListener("thumbstickmoved",this.handleThumbstickAxis),this.queryCollisionEntities()},handleSnapturn:function(t,i){i<.5&&(this.canSnapturn=!0),this.canSnapturn&&i>.95&&(Math.abs(t-Math.PI/2)<.6?(this.cameraRig.object3D.rotateY(+this.snapturnRotation),this.canSnapturn=!1):Math.abs(t-1.5*Math.PI)<.6&&(this.cameraRig.object3D.rotateY(-this.snapturnRotation),this.canSnapturn=!1))},handleThumbstickAxis:function(t){if(void 0!==t.detail.x&&void 0!==t.detail.y){const i=Math.atan2(t.detail.x,t.detail.y)+Math.PI,e=Math.sqrt(t.detail.x**2+t.detail.y**2);this.active?(e>.95&&(this.obj.getWorldPosition(this.controllerPosition),this.controllerPosition.setComponent(1,this.hitEntity.object3D.position.y),this.hitEntity.object3D.visible=!1,this.hitEntity.object3D.lookAt(this.controllerPosition),this.hitEntity.object3D.rotateY(i),this.hitEntity.object3D.visible=!0,this.hitEntity.object3D.getWorldQuaternion(this.hitEntityQuaternion)),0===Math.abs(t.detail.x)&&0===Math.abs(t.detail.y)&&this.onButtonUp()):this.thumbstickAxisActivation&&e>.95&&(i<.5||i>5.78)?this.onButtonDown():this.data.snapTurn&&this.handleSnapturn(i,e)}},update:function(t){const i=this.data,e=AFRAME.utils.diff(i,t);this.referenceNormal.copy(i.landingNormal),this.curveMissColor.set(i.curveMissColor),this.curveHitColor.set(i.curveHitColor),(!this.line||"curveLineWidth"in e||"curveNumberPoints"in e||"type"in e)&&(this.line=this.createLine(i),this.line.material.opacity=this.data.hitOpacity,this.line.material.transparent=this.data.hitOpacity<1,this.numActivePoints=i.curveNumberPoints,this.teleportEntity.setObject3D("mesh",this.line.mesh)),i.hitEntity?this.hitEntity=i.hitEntity:(!this.hitEntity||"hitCylinderColor"in e||"hitCylinderHeight"in e||"hitCylinderRadius"in e)&&(this.hitEntity&&this.hitEntity.parentNode.removeChild(this.hitEntity),this.hitEntity=this.createHitEntity(i),this.el.sceneEl.appendChild(this.hitEntity)),this.hitEntity.setAttribute("visible",!1),i.hitEntity||this.hitEntity.lastElementChild.setAttribute("visible",i.rotateOnTeleport),"collisionEntities"in e&&this.queryCollisionEntities()},remove:function(){const t=this.el,i=this.hitEntity,e=this.teleportEntity;i&&i.parentNode.removeChild(i),e&&e.parentNode.removeChild(e),t.sceneEl.removeEventListener("child-attached",this.childAttachHandler),t.sceneEl.removeEventListener("child-detached",this.childDetachHandler);for(const[i,e]of this.addedEvents)t.removeEventListener(i,e)},tick:function(){const t=new THREE.Vector3,i=new THREE.Vector3,e=new THREE.Vector3(0,-9.8,0),n=new THREE.Vector3,s=new THREE.Vector3,o=new THREE.Quaternion,r=new THREE.Vector3,a=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,c=new THREE.Vector3;let d=0;return function(u,E){if(!this.active)return;if(this.data.drawIncrementally&&this.redrawLine&&(this.redrawLine=!1,d=0),d+=E,this.numActivePoints=this.data.curveNumberPoints*d/this.data.incrementalDrawMs,this.numActivePoints>this.data.curveNumberPoints&&(this.numActivePoints=this.data.curveNumberPoints),this.prevCheckTime&&u-this.prevCheckTime<this.data.interval)return;this.prevCheckTime=u;this.obj.matrixWorld.decompose(r,o,a);const p=h.set(0,0,-1).applyQuaternion(o).normalize();this.line.setDirection(c.copy(p)),this.obj.getWorldPosition(t),s.copy(t),this.teleportEntity.setAttribute("visible",!0),d<this.data.incrementalDrawMs?this.line.material.color.set(this.curveHitColor):this.line.material.color.set(this.curveMissColor),this.line.material.opacity=this.data.missOpacity,this.line.material.transparent=this.data.missOpacity<1,this.hitEntity.setAttribute("visible",!1),this.hit=!1,i.copy(p).multiplyScalar(this.data.curveShootingSpeed),this.lastDrawnIndex=0;const A=this.data.drawIncrementally?this.numActivePoints:this.line.numPoints;for(let o=0;o<A+1;o++){let r;r=o===Math.floor(A+1)?A/(this.line.numPoints-1):o/(this.line.numPoints-1);const a=this.parabolicCurveMaxRoot(t,i,e);r*=Math.max(1,1.5*a),this.parabolicCurve(t,i,e,r,n);const h=l.copy(n).sub(s).normalize();if(this.raycaster.far=h.length(),this.raycaster.set(s,h),this.lastDrawnPoint=n,this.lastDrawnIndex=o,this.checkMeshCollisions(o,s,n))break;s.copy(n)}for(let t=this.lastDrawnIndex+1;t<this.line.numPoints;t++)this.line.setPoint(t,this.lastDrawnPoint,this.lastDrawnPoint)}}(),queryCollisionEntities:function(){const t=this.data,i=this.el;if(!t.collisionEntities)return void(this.collisionEntities=[]);const e=[].slice.call(i.sceneEl.querySelectorAll(t.collisionEntities));this.collisionEntities=e,this.childAttachHandler=function(i){i.detail.el.matches(t.collisionEntities)&&e.push(i.detail.el)},i.sceneEl.addEventListener("child-attached",this.childAttachHandler),this.childDetachHandler=function(i){if(!i.detail.el.matches(t.collisionEntities))return;const n=e.indexOf(i.detail.el);-1!==n&&e.splice(n,1)},i.sceneEl.addEventListener("child-detached",this.childDetachHandler)},onButtonDown:function(){this.active=!0,this.redrawLine=!0},onButtonUp:function(){const t=new THREE.Vector3,i=[new THREE.Vector3,new THREE.Vector3],e=new THREE.Vector3;return function(n){if(!this.active)return;if(this.active=!1,this.hitEntity.setAttribute("visible",!1),this.teleportEntity.setAttribute("visible",!1),!this.hit)return;const s=this.data.cameraRig||this.el.sceneEl.camera.el;if(s.object3D.getWorldPosition(this.rigWorldPosition),this.newRigWorldPosition.copy(this.hitPoint),t.copy(this.newRigWorldPosition),s.object3D.parent&&s.object3D.parent.worldToLocal(t),s.setAttribute("position",t),this.data.rotateOnTeleport&&(this.teleportOriginQuaternion.setFromEuler(new THREE.Euler(0,this.teleportOrigin.object3D.rotation.y,0)),this.teleportOriginQuaternion.invert(),this.teleportOriginQuaternion.multiply(this.hitEntityQuaternion),this.cameraRig.object3D.setRotationFromQuaternion(this.teleportOriginQuaternion)),!this.data.cameraRig){const t=document.querySelectorAll("a-entity[tracked-controls]");for(let n=0;n<t.length;n++)t[n].object3D.getWorldPosition(e),i[n].copy(this.newRigWorldPosition).sub(this.rigWorldPosition).add(e),t[n].setAttribute("position",i[n])}this.el.emit("teleported",this.teleportEventDetail)}}(),cancel:function(){this.active=!1,this.hitEntity.setAttribute("visible",!1),this.teleportEntity.setAttribute("visible",!1)},checkMeshCollisions:function(t,i,e){let n;this.data.collisionEntities?(n=this.collisionEntities.map((function(t){return t.getObject3D("mesh")})).filter((function(t){return t})),n=n.length?n:this.defaultCollisionMeshes):n=this.defaultCollisionMeshes;const s=this.raycaster.intersectObjects(n,!0);if(s.length>0&&!this.hit&&this.isValidNormalsAngle(s[0].face.normal,s[0].object)){const e=s[0].point;this.line.material.color.set(this.curveHitColor),this.line.material.opacity=this.data.hitOpacity,this.line.material.transparent=this.data.hitOpacity<1,this.hitEntity.setAttribute("position",e),this.hitEntity.setAttribute("visible",!0),this.hit=!0,this.hitPoint.copy(s[0].point);for(let e=t;e<this.line.numPoints;e++)this.line.setPoint(e,i,this.hitPoint);return!0}return this.line.setPoint(t,i,e),!1},isValidNormalsAngle:function(t,i){this.collisionObjectNormalMatrix.getNormalMatrix(i.matrixWorld),this.collisionWorldNormal.copy(t).applyMatrix3(this.collisionObjectNormalMatrix).normalize();const e=this.referenceNormal.angleTo(this.collisionWorldNormal);return THREE.MathUtils.RAD2DEG*e<=this.data.landingMaxAngle},parabolicCurveScalar:function(t,i,e,n){return t+i*n+.5*e*n*n},parabolicCurve:function(t,i,e,n,s){return s.x=this.parabolicCurveScalar(t.x,i.x,e.x,n),s.y=this.parabolicCurveScalar(t.y,i.y,e.y,n),s.z=this.parabolicCurveScalar(t.z,i.z,e.z,n),s},parabolicCurveMaxRoot:function(t,i,e){return(-i.y-Math.sqrt(i.y**2-.5*e.y*4*t.y))/(1*e.y)},createLine:function(t){const i="line"===t.type?2:t.curveNumberPoints;return new AFRAME.utils.RayCurve(i,t.curveLineWidth)},createHitEntity:function(t){const i=document.createElement("a-entity");i.className="hitEntity";const e=document.createElement("a-entity");e.setAttribute("geometry",{primitive:"torus",radius:t.hitCylinderRadius,radiusTubular:.01}),e.setAttribute("rotation",{x:90,y:0,z:0}),e.setAttribute("material",{shader:"flat",color:t.hitCylinderColor,side:"double",depthTest:!1}),i.appendChild(e);const n=document.createElement("a-entity");n.setAttribute("position",{x:0,y:t.hitCylinderHeight/2,z:0}),n.setAttribute("geometry",{primitive:"cylinder",segmentsHeight:1,radius:t.hitCylinderRadius,height:t.hitCylinderHeight,openEnded:!0}),n.setAttribute("material",{shader:"flat",color:t.hitCylinderColor,opacity:.5,side:"double",src:this.cylinderTexture,transparent:!0,depthTest:!1}),i.appendChild(n);const s=document.createElement("a-entity");return s.setAttribute("position",{x:0,y:.05,z:-1.5*t.hitCylinderRadius}),s.setAttribute("rotation",{x:90,y:180,z:0}),s.setAttribute("geometry",{primitive:"prism",height:.2,width:.2,depth:.05}),s.setAttribute("material",{shader:"flat",color:t.hitCylinderColor,side:"double",transparent:!0,opacity:.6,depthTest:!1}),i.appendChild(s),i},createDefaultPlane:function(t){const i=new THREE.PlaneGeometry(100,100);i.rotateX(-Math.PI/2);const e=new THREE.MeshBasicMaterial({color:16776960});return new THREE.Mesh(i,e)},cylinderTexture:"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAQCAYAAADXnxW3AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAADJJREFUeNpEx7ENgDAAAzArK0JA6f8X9oewlcWStU1wBGdwB08wgjeYm79jc2nbYH0DAC/+CORJxO5fAAAAAElFTkSuQmCC)"}),AFRAME.utils.RayCurve=function(t,i){this.geometry=new THREE.BufferGeometry,this.vertices=new Float32Array(3*t*6),this.uvs=new Float32Array(2*t*6),this.width=i,this.geometry.setAttribute("position",new THREE.BufferAttribute(this.vertices,3).setUsage(THREE.DynamicDrawUsage)),this.material=new THREE.MeshBasicMaterial({side:THREE.DoubleSide,color:16711680}),this.mesh=new THREE.Mesh(this.geometry,this.material),this.mesh.frustumCulled=!1,this.mesh.vertices=this.vertices,this.direction=new THREE.Vector3,this.numPoints=t},AFRAME.utils.RayCurve.prototype={setDirection:function(t){const i=new THREE.Vector3(0,1,0);this.direction.copy(t).cross(i).normalize().multiplyScalar(this.width/2)},setWidth:function(t){this.width=t},setPoint:function(){const t=new THREE.Vector3,i=new THREE.Vector3,e=new THREE.Vector3,n=new THREE.Vector3;return function(s,o,r){t.copy(o).add(this.direction),i.copy(o).sub(this.direction),e.copy(r).add(this.direction),n.copy(r).sub(this.direction);let a=18*s;this.vertices[a++]=t.x,this.vertices[a++]=t.y,this.vertices[a++]=t.z,this.vertices[a++]=i.x,this.vertices[a++]=i.y,this.vertices[a++]=i.z,this.vertices[a++]=e.x,this.vertices[a++]=e.y,this.vertices[a++]=e.z,this.vertices[a++]=e.x,this.vertices[a++]=e.y,this.vertices[a++]=e.z,this.vertices[a++]=i.x,this.vertices[a++]=i.y,this.vertices[a++]=i.z,this.vertices[a++]=n.x,this.vertices[a++]=n.y,this.vertices[a++]=n.z,this.geometry.attributes.position.needsUpdate=!0}}()}})(); +//# sourceMappingURL=aframe-blink-controls.min.js.map/* * v0.5.1 generated at Wed Jan 15 10:52:05 AM CET 2025 * https://xrfragment.org * SPDX-License-Identifier: AGPL-3.0-or-later */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AFRAME=t():e.AFRAME=t()}(self,(()=>(()=>{var e={8167:e=>{var t=Object.prototype.toString;e.exports=function(e){return e.BYTES_PER_ELEMENT&&"[object ArrayBuffer]"===t.call(e.buffer)||Array.isArray(e)}},5734:e=>{e.exports=function(e,t){return"number"==typeof e?e:"number"==typeof t?t:0}},7961:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),n=t[0],i=t[1];return 3*(n+i)/4-i},t.toByteArray=function(e){var t,n,s=a(e),o=s[0],l=s[1],c=new r(function(e,t,n){return 3*(t+n)/4-n}(0,o,l)),h=0,d=l>0?o-4:o;for(n=0;n<d;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],c[h++]=t>>16&255,c[h++]=t>>8&255,c[h++]=255&t;return 2===l&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,c[h++]=255&t),1===l&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,c[h++]=t>>8&255,c[h++]=255&t),c},t.fromByteArray=function(e){for(var t,i=e.length,r=i%3,s=[],o=16383,a=0,c=i-r;a<c;a+=o)s.push(l(e,a,a+o>c?c:a+o));return 1===r?(t=e[i-1],s.push(n[t>>2]+n[t<<4&63]+"==")):2===r&&(t=(e[i-2]<<8)+e[i-1],s.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),s.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)n[o]=s[o],i[s.charCodeAt(o)]=o;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,i){for(var r,s,o=[],a=t;a<i;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(n[(s=r)>>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},911:(e,t,n)=>{var i=n(9922).hp;e.exports=function(e,t){if(i.isBuffer(e)&&i.isBuffer(t)){if("function"==typeof e.equals)return e.equals(t);if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}}},9922:(e,t,n)=>{"use strict";const i=n(7961),r=n(1024),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=l,t.IS=50;const o=2147483647;function a(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return c(e,t,n)}function c(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|f(e,t);let i=a(n);const r=i.write(e,t);return r!==n&&(i=i.slice(0,r)),i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return u(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return p(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return p(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return l.from(i,t,n);const r=function(e){if(l.isBuffer(e)){const t=0|A(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||J(e.length)?a(0):u(e):"Buffer"===e.type&&Array.isArray(e.data)?u(e.data):void 0}(e);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function h(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return h(e),a(e<0?0:0|A(e))}function u(e){const t=e.length<0?0:0|A(e.length),n=a(t);for(let i=0;i<t;i+=1)n[i]=255&e[i];return n}function p(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(i,l.prototype),i}function A(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function f(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;let r=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(e).length;default:if(r)return i?-1:W(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,n);case"utf8":case"utf-8":return M(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return B(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function g(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function v(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=l.from(t,i)),l.isBuffer(t))return 0===t.length?-1:y(e,t,n,i,r);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,i,r){let s,o=1,a=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,n/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(r){let i=-1;for(s=n;s<a;s++)if(c(e,s)===c(t,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===l)return i*o}else-1!==i&&(s-=s-i),i=-1}else for(n+l>a&&(n=a-l),s=n;s>=0;s--){let n=!0;for(let i=0;i<l;i++)if(c(e,s+i)!==c(t,i)){n=!1;break}if(n)return s}return-1}function E(e,t,n,i){n=Number(n)||0;const r=e.length-n;i?(i=Number(i))>r&&(i=r):i=r;const s=t.length;let o;for(i>s/2&&(i=s/2),o=0;o<i;++o){const i=parseInt(t.substr(2*o,2),16);if(J(i))return o;e[n+o]=i}return o}function x(e,t,n,i){return X(W(t,e.length-n),e,n,i)}function b(e,t,n,i){return X(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,i)}function C(e,t,n,i){return X(q(t),e,n,i)}function w(e,t,n,i){return X(function(e,t){let n,i,r;const s=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),i=n>>8,r=n%256,s.push(r),s.push(i);return s}(t,e.length-n),e,n,i)}function _(e,t,n){return 0===t&&n===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,n))}function M(e,t,n){n=Math.min(e.length,n);const i=[];let r=t;for(;r<n;){const t=e[r];let s=null,o=t>239?4:t>223?3:t>191?2:1;if(r+o<=n){let n,i,a,l;switch(o){case 1:t<128&&(s=t);break;case 2:n=e[r+1],128==(192&n)&&(l=(31&t)<<6|63&n,l>127&&(s=l));break;case 3:n=e[r+1],i=e[r+2],128==(192&n)&&128==(192&i)&&(l=(15&t)<<12|(63&n)<<6|63&i,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:n=e[r+1],i=e[r+2],a=e[r+3],128==(192&n)&&128==(192&i)&&128==(192&a)&&(l=(15&t)<<18|(63&n)<<12|(63&i)<<6|63&a,l>65535&&l<1114112&&(s=l))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),r+=o}return function(e){const t=e.length;if(t<=S)return String.fromCharCode.apply(String,e);let n="",i=0;for(;i<t;)n+=String.fromCharCode.apply(String,e.slice(i,i+=S));return n}(i)}l.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,n){return function(e,t,n){return h(e),e<=0?a(e):void 0!==t?"string"==typeof n?a(e).fill(t,n):a(e).fill(t):a(e)}(e,t,n)},l.allocUnsafe=function(e){return d(e)},l.allocUnsafeSlow=function(e){return d(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(Y(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,i=t.length;for(let r=0,s=Math.min(n,i);r<s;++r)if(e[r]!==t[r]){n=e[r],i=t[r];break}return n<i?-1:i<n?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const i=l.allocUnsafe(t);let r=0;for(n=0;n<e.length;++n){let t=e[n];if(Y(t,Uint8Array))r+t.length>i.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(i,r)):Uint8Array.prototype.set.call(i,t,r);else{if(!l.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,r)}r+=t.length}return i},l.byteLength=f,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)g(this,t,t+1);return this},l.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},l.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},l.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?M(this,0,e):m.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){let e="";const n=t.IS;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},s&&(l.prototype[s]=l.prototype.inspect),l.prototype.compare=function(e,t,n,i,r){if(Y(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;let s=(r>>>=0)-(i>>>=0),o=(n>>>=0)-(t>>>=0);const a=Math.min(s,o),c=this.slice(i,r),h=e.slice(t,n);for(let e=0;e<a;++e)if(c[e]!==h[e]){s=c[e],o=h[e];break}return s<o?-1:o<s?1:0},l.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},l.prototype.indexOf=function(e,t,n){return v(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return v(this,e,t,n,!1)},l.prototype.write=function(e,t,n,i){if(void 0===t)i="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)i=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}const r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":case"latin1":case"binary":return b(this,e,t,n);case"base64":return C(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const S=4096;function I(e,t,n){let i="";n=Math.min(e.length,n);for(let r=t;r<n;++r)i+=String.fromCharCode(127&e[r]);return i}function B(e,t,n){let i="";n=Math.min(e.length,n);for(let r=t;r<n;++r)i+=String.fromCharCode(e[r]);return i}function T(e,t,n){const i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);let r="";for(let i=t;i<n;++i)r+=K[e[i]];return r}function R(e,t,n){const i=e.slice(t,n);let r="";for(let e=0;e<i.length-1;e+=2)r+=String.fromCharCode(i[e]+256*i[e+1]);return r}function L(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,n,i,r,s){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<s)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}function P(e,t,n,i,r){z(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function U(e,t,n,i,r){z(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n+7]=s,s>>=8,e[n+6]=s,s>>=8,e[n+5]=s,s>>=8,e[n+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function O(e,t,n,i,r,s){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(e,t,n,i,s){return t=+t,n>>>=0,s||O(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function k(e,t,n,i,s){return t=+t,n>>>=0,s||O(e,0,n,8),r.write(e,t,n,i,52,8),n+8}l.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const i=this.subarray(e,t);return Object.setPrototypeOf(i,l.prototype),i},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let i=this[e],r=1,s=0;for(;++s<t&&(r*=256);)i+=this[e+s]*r;return i},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let i=this[e+--t],r=1;for(;t>0&&(r*=256);)i+=this[e+--t]*r;return i},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=Z((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,r=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(i)+(BigInt(r)<<BigInt(32))})),l.prototype.readBigUInt64BE=Z((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=t*2**24+65536*this[++e]+256*this[++e]+this[++e],r=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(i)<<BigInt(32))+BigInt(r)})),l.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let i=this[e],r=1,s=0;for(;++s<t&&(r*=256);)i+=this[e+s]*r;return r*=128,i>=r&&(i-=Math.pow(2,8*t)),i},l.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let i=t,r=1,s=this[e+--i];for(;i>0&&(r*=256);)s+=this[e+--i]*r;return r*=128,s>=r&&(s-=Math.pow(2,8*t)),s},l.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=Z((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),l.prototype.readBigInt64BE=Z((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),r.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),r.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),r.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),r.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,i){e=+e,t>>>=0,n>>>=0,i||D(this,e,t,n,Math.pow(2,8*n)-1,0);let r=1,s=0;for(this[t]=255&e;++s<n&&(r*=256);)this[t+s]=e/r&255;return t+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,n,i){e=+e,t>>>=0,n>>>=0,i||D(this,e,t,n,Math.pow(2,8*n)-1,0);let r=n-1,s=1;for(this[t+r]=255&e;--r>=0&&(s*=256);)this[t+r]=e/s&255;return t+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=Z((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=Z((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);D(this,e,t,n,i-1,-i)}let r=0,s=1,o=0;for(this[t]=255&e;++r<n&&(s*=256);)e<0&&0===o&&0!==this[t+r-1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+n},l.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);D(this,e,t,n,i-1,-i)}let r=n-1,s=1,o=0;for(this[t+r]=255&e;--r>=0&&(s*=256);)e<0&&0===o&&0!==this[t+r+1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=Z((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=Z((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(e,t,n){return F(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return F(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return k(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return k(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,i){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);const r=i-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),t),r},l.prototype.fill=function(e,t,n,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){const t=e.charCodeAt(0);("utf8"===i&&t<128||"latin1"===i)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let r;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(r=t;r<n;++r)this[r]=e;else{const s=l.isBuffer(e)?e:l.from(e,i),o=s.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(r=0;r<n-t;++r)this[r+t]=s[r%o]}return this};const N={};function Q(e,t,n){N[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function G(e){let t="",n=e.length;const i="-"===e[0]?1:0;for(;n>=i+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function z(e,t,n,i,r,s){if(e>n||e<t){const i="bigint"==typeof t?"n":"";let r;throw r=s>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${t}${i} and <= ${n}${i}`,new N.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,n){H(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||V(t,e.length-(n+1))}(i,r,s)}function H(e,t){if("number"!=typeof e)throw new N.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,n){if(Math.floor(e)!==e)throw H(e,n),new N.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new N.ERR_BUFFER_OUT_OF_BOUNDS;throw new N.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}Q("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),Q("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),Q("ERR_OUT_OF_RANGE",(function(e,t,n){let i=`The value of "${e}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=G(String(n)):"bigint"==typeof n&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=G(r)),r+="n"),i+=` It must be ${t}. Received ${r}`,i}),RangeError);const j=/[^+/0-9A-Za-z-_]/g;function W(e,t){let n;t=t||1/0;const i=e.length;let r=null;const s=[];for(let o=0;o<i;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function q(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(j,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,n,i){let r;for(r=0;r<i&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const K=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const i=16*n;for(let r=0;r<16;++r)t[i+r]=e[n]+e[r]}return t}();function Z(e){return"undefined"==typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},9089:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,i,r,s){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(o[l]=!0)}for(var c=0;c<e.length;c++){var h=[].concat(e[c]);i&&o[h[0]]||(void 0!==s&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=s),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),t.push(h))}},t}},6492:e=>{"use strict";e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},963:e=>{"use strict";e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),s="/*# ".concat(r," */");return[t].concat([s]).join("\n")}return[t].join("\n")}},8878:(e,t,n)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let i=0,r=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(i++,"%c"===e&&(r=i))})),t.splice(r,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(8945)(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},8945:(e,t,n)=>{e.exports=function(e){function t(e){let n,r,s,o=null;function a(...e){if(!a.enabled)return;const i=a,r=Number(new Date),s=r-(n||r);i.diff=s,i.prev=n,i.curr=r,n=r,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,r)=>{if("%%"===n)return"%";o++;const s=t.formatters[r];if("function"==typeof s){const t=e[o];n=s.call(i,t),e.splice(o,1),o--}return n})),t.formatArgs.call(i,e),(i.log||t.log).apply(i,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=i,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(r!==t.namespaces&&(r=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function i(e,n){const i=t(this.namespace+(void 0===n?":":n)+e);return i.log=this.log,i}function r(e,t){let n=0,i=0,r=-1,s=0;for(;n<e.length;)if(i<t.length&&(t[i]===e[n]||"*"===t[i]))"*"===t[i]?(r=i,s=n,i++):(n++,i++);else{if(-1===r)return!1;i=r+1,s++,n=s}for(;i<t.length&&"*"===t[i];)i++;return i===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names,...t.skips.map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").trim().replace(" ",",").split(",").filter(Boolean);for(const e of n)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const n of t.skips)if(r(e,n))return!1;for(const n of t.names)if(r(e,n))return!0;return!1},t.humanize=n(9192),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},1124:(e,t,n)=>{"use strict";var i=n(6240),r=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function o(e,t,n){var s=t[n];if(null!=s){if(r.call(e,n)&&(void 0===e[n]||null===e[n]))throw new TypeError("Cannot convert undefined or null to object ("+n+")");r.call(e,n)&&i(s)?e[n]=a(Object(e[n]),t[n]):e[n]=s}}function a(e,t){if(e===t)return e;for(var n in t=Object(t))r.call(t,n)&&o(e,t,n);if(Object.getOwnPropertySymbols)for(var i=Object.getOwnPropertySymbols(t),a=0;a<i.length;a++)s.call(t,i[a])&&o(e,t,i[a]);return e}e.exports=function(e){e=function(e){if(null==e)throw new TypeError("Sources cannot be null or undefined");return Object(e)}(e);for(var t=1;t<arguments.length;t++)a(e,arguments[t]);return e}},8480:e=>{e.exports=function(e){switch(e){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},919:(e,t,n)=>{var i;i="undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},e.exports=i},1024:(e,t)=>{t.read=function(e,t,n,i,r){var s,o,a=8*r-i-1,l=(1<<a)-1,c=l>>1,h=-7,d=n?r-1:0,u=n?-1:1,p=e[t+d];for(d+=u,s=p&(1<<-h)-1,p>>=-h,h+=a;h>0;s=256*s+e[t+d],d+=u,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=i;h>0;o=256*o+e[t+d],d+=u,h-=8);if(0===s)s=1-c;else{if(s===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),s-=c}return(p?-1:1)*o*Math.pow(2,s-i)},t.write=function(e,t,n,i,r,s){var o,a,l,c=8*s-r-1,h=(1<<c)-1,d=h>>1,u=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,A=i?1:-1,f=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+d>=1?u/l:u*Math.pow(2,1-d))*l>=2&&(o++,l/=2),o+d>=h?(a=0,o=h):o+d>=1?(a=(t*l-1)*Math.pow(2,r),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,r),o=0));r>=8;e[n+p]=255&a,p+=A,a/=256,r-=8);for(o=o<<r|a,c+=r;c>0;e[n+p]=255&o,p+=A,o/=256,c-=8);e[n+p-A]|=128*f}},2225:e=>{function t(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(t(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},8847:e=>{e.exports=function(e){if(!e)return!1;var n=t.call(e);return"[object Function]"===n||"function"==typeof e&&"[object RegExp]"!==n||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var t=Object.prototype.toString},6240:e=>{"use strict";e.exports=function(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}},5651:(e,t,n)=>{var i=n(5406),r=n(4597),s=n(5734),o=["x","e","a","o","n","s","r","c","u","m","v","w","z"],a=["m","w"],l=["H","I","N","E","F","K","L","T","U","V","W","X","Y","Z"],c="\t".charCodeAt(0),h=" ".charCodeAt(0);function d(e){this.glyphs=[],this._measure=this.computeMetrics.bind(this),this.update(e)}function u(e){return new Function(["return function "+e+"() {"," return this._"+e,"}"].join("\n"))()}function p(e,t){if(!e.chars||0===e.chars.length)return null;var n=f(e.chars,t);return n>=0?e.chars[n]:null}function A(e,t,n){if(!e.kernings||0===e.kernings.length)return 0;for(var i=e.kernings,r=0;r<i.length;r++){var s=i[r];if(s.first===t&&s.second===n)return s.amount}return 0}function f(e,t,n){for(var i=n=n||0;i<e.length;i++)if(e[i].id===t)return i;return-1}e.exports=function(e){return new d(e)},d.prototype.update=function(e){if(e=r({measure:this._measure},e),this._opt=e,this._opt.tabSize=s(this._opt.tabSize,4),!e.font)throw new Error("must provide a valid bitmap font");var t=this.glyphs,n=e.text||"",a=e.font;this._setupSpaceGlyphs(a);var c=i.lines(n,e),h=e.width||0;t.length=0;var d=c.reduce((function(e,t){return Math.max(e,t.width,h)}),0),u=0,p=0,m=s(e.lineHeight,a.common.lineHeight),g=a.common.base,v=m-g,y=e.letterSpacing||0,E=m*c.length-v,x=function(e){return"center"===e?1:"right"===e?2:0}(this._opt.align);p-=E,this._width=d,this._height=E,this._descender=m-g,this._baseline=g,this._xHeight=function(e){for(var t=0;t<o.length;t++){var n=o[t].charCodeAt(0),i=f(e.chars,n);if(i>=0)return e.chars[i].height}return 0}(a),this._capHeight=function(e){for(var t=0;t<l.length;t++){var n=l[t].charCodeAt(0),i=f(e.chars,n);if(i>=0)return e.chars[i].height}return 0}(a),this._lineHeight=m,this._ascender=m-v-this._xHeight;var b=this;c.forEach((function(e,i){for(var r,s=e.start,o=e.end,l=e.width,c=s;c<o;c++){var h=n.charCodeAt(c),f=b.getGlyph(a,h);if(f){r&&(u+=A(a,r.id,f.id));var g=u;1===x?g+=(d-l)/2:2===x&&(g+=d-l),t.push({position:[g,p],data:f,index:c,line:i}),u+=f.xadvance+y,r=f}}p+=m,u=0})),this._linesTotal=c.length},d.prototype._setupSpaceGlyphs=function(e){if(this._fallbackSpaceGlyph=null,this._fallbackTabGlyph=null,e.chars&&0!==e.chars.length){var t=p(e,h)||function(e){for(var t=0;t<a.length;t++){var n=a[t].charCodeAt(0),i=f(e.chars,n);if(i>=0)return e.chars[i]}return 0}(e)||e.chars[0],n=this._opt.tabSize*t.xadvance;this._fallbackSpaceGlyph=t,this._fallbackTabGlyph=r(t,{x:0,y:0,xadvance:n,id:c,xoffset:0,yoffset:0,width:0,height:0})}},d.prototype.getGlyph=function(e,t){return p(e,t)||(t===c?this._fallbackTabGlyph:t===h?this._fallbackSpaceGlyph:null)},d.prototype.computeMetrics=function(e,t,n,i){var r,s=this._opt.letterSpacing||0,o=this._opt.font,a=0,l=0,c=0;if(!o.chars||0===o.chars.length)return{start:t,end:t,width:0};n=Math.min(e.length,n);for(var h=t;h<n;h++){var d,u=e.charCodeAt(h);if(d=this.getGlyph(o,u)){d.xoffset;var p=(a+=r?A(o,r.id,d.id):0)+d.xadvance+s,f=a+d.width;if(f>=i||p>=i)break;a=p,l=f,r=d}c++}return r&&(l+=r.xoffset),{start:t,end:t+c,width:l}},["width","height","descender","ascender","xHeight","baseline","capHeight","lineHeight"].forEach((function(e){Object.defineProperty(d.prototype,e,{get:u(e),configurable:!0})}))},5751:(e,t,n)=>{var i=n(9922).hp,r=n(3558),s=function(){},o=n(1476),a=n(7034),l=n(7480),c=n(573),h=n(4597),d=self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;e.exports=function(e,t){t="function"==typeof t?t:s,"string"==typeof e?e={uri:e}:e||(e={}),e.binary&&(e=function(e){if(d)return h(e,{responseType:"arraybuffer"});if(void 0===self.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var t=new self.XMLHttpRequest;return t.overrideMimeType("text/plain; charset=x-user-defined"),h({xhr:t},e)}(e)),r(e,(function(n,r,h){if(n)return t(n);if(!/^2/.test(r.statusCode))return t(new Error("http status code: "+r.statusCode));if(!h)return t(new Error("no body result"));var d,u,p=!1;if(d=h,"[object ArrayBuffer]"===Object.prototype.toString.call(d)){var A=new Uint8Array(h);h=i.from(A,"binary")}c(h)&&(p=!0,"string"==typeof h&&(h=i.from(h,"binary"))),p||(i.isBuffer(h)&&(h=h.toString(e.encoding)),h=h.trim());try{var f=r.headers["content-type"];u=p?l(h):/json/.test(f)||"{"===h.charAt(0)?JSON.parse(h):/xml/.test(f)||"<"===h.charAt(0)?a(h):o(h)}catch(e){t(new Error("error parsing font "+e.message)),t=s}t(null,u)}))}},573:(e,t,n)=>{var i=n(9922).hp,r=n(911),s=i.from([66,77,70,3]);e.exports=function(e){return"string"==typeof e?"BMF"===e.substring(0,3):e.length>4&&r(e.slice(0,4),s)}},9192:e=>{var t=1e3,n=60*t,i=60*n,r=24*i,s=7*r;function o(e,t,n,i){var r=t>=1.5*n;return Math.round(e/n)+" "+i+(r?"s":"")}e.exports=function(e,a){a=a||{};var l,c,h=typeof e;if("string"===h&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(o){var a=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return a*s;case"days":case"day":case"d":return a*r;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(e);if("number"===h&&isFinite(e))return a.long?(l=e,(c=Math.abs(l))>=r?o(l,c,r,"day"):c>=i?o(l,c,i,"hour"):c>=n?o(l,c,n,"minute"):c>=t?o(l,c,t,"second"):l+" ms"):function(e){var s=Math.abs(e);return s>=r?Math.round(e/r)+"d":s>=i?Math.round(e/i)+"h":s>=n?Math.round(e/n)+"m":s>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},1476:e=>{function t(e,t){if(!(e=e.replace(/\t+/g," ").trim()))return null;var i=e.indexOf(" ");if(-1===i)throw new Error("no named row at line "+t);var r=e.substring(0,i);e=(e=(e=(e=e.substring(i+1)).replace(/letter=[\'\"]\S+[\'\"]/gi,"")).split("=")).map((function(e){return e.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)}));for(var s=[],o=0;o<e.length;o++){var a=e[o];0===o?s.push({key:a[0],data:""}):o===e.length-1?s[s.length-1].data=n(a[0]):(s[s.length-1].data=n(a[0]),s.push({key:a[1],data:""}))}var l={key:r,data:{}};return s.forEach((function(e){l.data[e.key]=e.data})),l}function n(e){return e&&0!==e.length?0===e.indexOf('"')||0===e.indexOf("'")?e.substring(1,e.length-1):-1!==e.indexOf(",")?function(e){return e.split(",").map((function(e){return parseInt(e,10)}))}(e):parseInt(e,10):""}e.exports=function(e){if(!e)throw new Error("no data provided");var n={pages:[],chars:[],kernings:[]},i=(e=e.toString().trim()).split(/\r\n?|\n/g);if(0===i.length)throw new Error("no data in BMFont file");for(var r=0;r<i.length;r++){var s=t(i[r],r);if(s)if("page"===s.key){if("number"!=typeof s.data.id)throw new Error("malformed file at line "+r+" -- needs page id=N");if("string"!=typeof s.data.file)throw new Error("malformed file at line "+r+' -- needs page file="path"');n.pages[s.data.id]=s.data.file}else"chars"===s.key||"kernings"===s.key||("char"===s.key?n.chars.push(s.data):"kerning"===s.key?n.kernings.push(s.data):n[s.key]=s.data)}return n}},7480:e=>{var t=[66,77,70];function n(e,t,n){if(n>t.length-1)return 0;var r=t.readUInt8(n++),s=t.readInt32LE(n);switch(n+=4,r){case 1:e.info=function(e,t){var n={};n.size=e.readInt16LE(t);var r=e.readUInt8(t+2);return n.smooth=r>>7&1,n.unicode=r>>6&1,n.italic=r>>5&1,n.bold=r>>4&1,r>>3&1&&(n.fixedHeight=1),n.charset=e.readUInt8(t+3)||"",n.stretchH=e.readUInt16LE(t+4),n.aa=e.readUInt8(t+6),n.padding=[e.readInt8(t+7),e.readInt8(t+8),e.readInt8(t+9),e.readInt8(t+10)],n.spacing=[e.readInt8(t+11),e.readInt8(t+12)],n.outline=e.readUInt8(t+13),n.face=function(e,t){return i(e,t).toString("utf8")}(e,t+14),n}(t,n);break;case 2:e.common=function(e,t){var n={};return n.lineHeight=e.readUInt16LE(t),n.base=e.readUInt16LE(t+2),n.scaleW=e.readUInt16LE(t+4),n.scaleH=e.readUInt16LE(t+6),n.pages=e.readUInt16LE(t+8),e.readUInt8(t+10),n.packed=0,n.alphaChnl=e.readUInt8(t+11),n.redChnl=e.readUInt8(t+12),n.greenChnl=e.readUInt8(t+13),n.blueChnl=e.readUInt8(t+14),n}(t,n);break;case 3:e.pages=function(e,t,n){for(var r=[],s=i(e,t),o=s.length+1,a=n/o,l=0;l<a;l++)r[l]=e.slice(t,t+s.length).toString("utf8"),t+=o;return r}(t,n,s);break;case 4:e.chars=function(e,t,n){for(var i=[],r=n/20,s=0;s<r;s++){var o={},a=20*s;o.id=e.readUInt32LE(t+0+a),o.x=e.readUInt16LE(t+4+a),o.y=e.readUInt16LE(t+6+a),o.width=e.readUInt16LE(t+8+a),o.height=e.readUInt16LE(t+10+a),o.xoffset=e.readInt16LE(t+12+a),o.yoffset=e.readInt16LE(t+14+a),o.xadvance=e.readInt16LE(t+16+a),o.page=e.readUInt8(t+18+a),o.chnl=e.readUInt8(t+19+a),i[s]=o}return i}(t,n,s);break;case 5:e.kernings=function(e,t,n){for(var i=[],r=n/10,s=0;s<r;s++){var o={},a=10*s;o.first=e.readUInt32LE(t+0+a),o.second=e.readUInt32LE(t+4+a),o.amount=e.readInt16LE(t+8+a),i[s]=o}return i}(t,n,s)}return 5+s}function i(e,t){for(var n=t;n<e.length&&0!==e[n];n++);return e.slice(t,n)}e.exports=function(e){if(e.length<6)throw new Error("invalid buffer length for BMFont");var i=t.every((function(t,n){return e.readUInt8(n)===t}));if(!i)throw new Error("BMFont missing BMF byte header");var r=3;if(e.readUInt8(r++)>3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var s={kernings:[],chars:[]},o=0;o<5;o++)r+=n(s,e,r);return s}},7034:(e,t,n)=>{var i=n(7829),r=n(1896),s={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"};function o(e){var t=function(e){for(var t=[],n=0;n<e.attributes.length;n++)t.push(e.attributes[n]);return t}(e);return t.reduce((function(e,t){var n;return e[(n=t.nodeName,s[n.toLowerCase()]||n)]=t.nodeValue,e}),{})}e.exports=function(e){e=e.toString();var t=r(e),n={pages:[],chars:[],kernings:[]};["info","common"].forEach((function(e){var r=t.getElementsByTagName(e)[0];r&&(n[e]=i(o(r)))}));var s=t.getElementsByTagName("pages")[0];if(!s)throw new Error("malformed file -- no <pages> element");for(var a=s.getElementsByTagName("page"),l=0;l<a.length;l++){var c=a[l],h=parseInt(c.getAttribute("id"),10),d=c.getAttribute("file");if(isNaN(h))throw new Error('malformed file -- page "id" attribute is NaN');if(!d)throw new Error('malformed file -- needs page "file" attribute');n.pages[parseInt(h,10)]=d}return["chars","kernings"].forEach((function(e){var r=t.getElementsByTagName(e)[0];if(r)for(var s=e.substring(0,e.length-1),a=r.getElementsByTagName(s),l=0;l<a.length;l++){var c=a[l];n[e].push(i(o(c)))}})),n}},7829:e=>{var t="chasrset";e.exports=function(e){for(var n in e=Object.assign({},e),t in e&&(e.charset=e[t],delete e[t]),e)"face"!==n&&"charset"!==n&&(e[n]="padding"===n||"spacing"===n?e[n].split(",").map((function(e){return parseInt(e,10)})):parseInt(e[n],10));return e}},3216:e=>{var t=function(e){return e.replace(/^\s+|\s+$/g,"")};e.exports=function(e){if(!e)return{};for(var n,i={},r=t(e).split("\n"),s=0;s<r.length;s++){var o=r[s],a=o.indexOf(":"),l=t(o.slice(0,a)).toLowerCase(),c=t(o.slice(a+1));void 0===i[l]?i[l]=c:(n=i[l],"[object Array]"===Object.prototype.toString.call(n)?i[l].push(c):i[l]=[i[l],c])}return i}},9035:(e,t,n)=>{var i=n(8480),r=n(8167),s=n(2225),o=[0,2,3],a=[2,1,3];e.exports=function(e,t){e&&(r(e)||s(e))||(t=e||{},e=null);for(var n="string"==typeof(t="number"==typeof t?{count:t}:t||{}).type?t.type:"uint16",l="number"==typeof t.count?t.count:1,c=t.start||0,h=!1!==t.clockwise?o:a,d=h[0],u=h[1],p=h[2],A=6*l,f=e||new(i(n))(A),m=0,g=0;m<A;m+=6,g+=4){var v=m+c;f[v+0]=g+0,f[v+1]=g+1,f[v+2]=g+2,f[v+3]=g+d,f[v+4]=g+u,f[v+5]=g+p}return f}},4635:(e,t,n)=>{"use strict";n.d(t,{A:()=>ve});var i={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},r={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},s=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective"],o={CSS:{},springs:{}};function a(e,t,n){return Math.min(Math.max(e,t),n)}function l(e,t){return e.indexOf(t)>-1}function c(e,t){return e.apply(null,t)}var h=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,d=/^rgb/,u=/^hsl/,p={arr:function(e){return Array.isArray(e)},obj:function(e){return l(Object.prototype.toString.call(e),"Object")},pth:function(e){return p.obj(e)&&e.hasOwnProperty("totalLength")},svg:function(e){return e instanceof SVGElement},inp:function(e){return e instanceof HTMLInputElement},dom:function(e){return e.nodeType||p.svg(e)},str:function(e){return"string"==typeof e},fnc:function(e){return"function"==typeof e},und:function(e){return void 0===e},hex:function(e){return h.test(e)},rgb:function(e){return d.test(e)},hsl:function(e){return u.test(e)},col:function(e){return p.hex(e)||p.rgb(e)||p.hsl(e)},key:function(e){return!i.hasOwnProperty(e)&&!r.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}},A=/\(([^)]+)\)/;function f(e){var t=A.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function m(e,t){var n=f(e),i=a(p.und(n[0])?1:n[0],.1,100),r=a(p.und(n[1])?100:n[1],.1,100),s=a(p.und(n[2])?10:n[2],.1,100),l=a(p.und(n[3])?0:n[3],.1,100),c=Math.sqrt(r/i),h=s/(2*Math.sqrt(r*i)),d=h<1?c*Math.sqrt(1-h*h):0,u=h<1?(h*c-l)/d:-l+c;function A(e){var n=t?t*e/1e3:e;return n=h<1?Math.exp(-n*h*c)*(1*Math.cos(d*n)+u*Math.sin(d*n)):(1+u*n)*Math.exp(-n*c),0===e||1===e?e:1-n}return t?A:function(){var t=o.springs[e];if(t)return t;for(var n=1/6,i=0,r=0;;)if(1===A(i+=n)){if(++r>=16)break}else r=0;var s=i*n*1e3;return o.springs[e]=s,s}}function g(e,t){void 0===e&&(e=1),void 0===t&&(t=.5);var n=a(e,1,10),i=a(t,.1,2);return function(e){return 0===e||1===e?e:-n*Math.pow(2,10*(e-1))*Math.sin((e-1-i/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/i)}}function v(e){return void 0===e&&(e=10),function(t){return Math.round(t*e)*(1/e)}}var y=function(){var e=.1;function t(e,t){return 1-3*t+3*e}function n(e,t){return 3*t-6*e}function i(e){return 3*e}function r(e,r,s){return((t(r,s)*e+n(r,s))*e+i(r))*e}function s(e,r,s){return 3*t(r,s)*e*e+2*n(r,s)*e+i(r)}return function(t,n,i,o){if(0<=t&&t<=1&&0<=i&&i<=1){var a=new Float32Array(11);if(t!==n||i!==o)for(var l=0;l<11;++l)a[l]=r(l*e,t,i);return function(l){return t===n&&i===o||0===l||1===l?l:r(function(n){for(var o=0,l=1;10!==l&&a[l]<=n;++l)o+=e;--l;var c=o+(n-a[l])/(a[l+1]-a[l])*e,h=s(c,t,i);return h>=.001?function(e,t,n,i){for(var o=0;o<4;++o){var a=s(t,n,i);if(0===a)return t;t-=(r(t,n,i)-e)/a}return t}(n,c,t,i):0===h?c:function(e,t,n,i,s){var o,a,l=0;do{(o=r(a=t+(n-t)/2,i,s)-e)>0?n=a:t=a}while(Math.abs(o)>1e-7&&++l<10);return a}(n,o,o+e,t,i)}(l),n,o)}}}}(),E=function(){var e=["Quad","Cubic","Quart","Quint","Sine","Expo","Circ","Back","Elastic"],t={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],g],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(e,t){return function(n){return 1-g(e,t)(1-n)}}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(e,t){return function(n){return n<.5?g(e,t)(2*n)/2:1-g(e,t)(-2*n+2)/2}}]},n={linear:[.25,.25,.75,.75]};for(var i in t)for(var r=0,s=t[i].length;r<s;r++)n["ease"+i+e[r]]=t[i][r];return n}();function x(e,t){if(p.fnc(e))return e;var n=e.split("(")[0],i=E[n],r=f(e);switch(n){case"spring":return m(e,t);case"cubicBezier":return c(y,r);case"steps":return c(v,r);default:return p.fnc(i)?c(i,r):c(y,i)}}function b(e){try{return document.querySelectorAll(e)}catch(e){return}}var C=[];function w(e,t){for(var n=C,i=e.length,r=arguments.length>=2?arguments[1]:void 0,s=0;s<i;s++)if(s in e){var o=e[s];t.call(r,o,s,e)&&n.push(o)}return(C=e).length=0,n}function _(e,t){t||(t=[]);for(var n=0,i=e.length;n<i;n++){var r=e[n];Array.isArray(r)?_(r,t):t.push(r)}return t}function M(e){return p.arr(e)?e:(p.str(e)&&(e=b(e)||e),e instanceof NodeList||e instanceof HTMLCollection?[].slice.call(e):[e])}function S(e,t){return e.some((function(e){return e===t}))}function I(e){var t={};for(var n in e)t[n]=e[n];return t}function B(e,t){var n=I(e);for(var i in e)n[i]=t.hasOwnProperty(i)?t[i]:e[i];return n}function T(e,t){var n=I(e);for(var i in t)n[i]=p.und(e[i])?t[i]:e[i];return n}var R=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g,L=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,D=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,P=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g,U=/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g;var O=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/;function F(e){var t=O.exec(e);if(t)return t[2]}function k(e,t){return p.fnc(e)?e(t.target,t.id,t.total):e}function N(e,t){return e.getAttribute(t)}function Q(e,t,n){if(S([n,"deg","rad","turn"],F(t)))return t;var i=o.CSS[t+n];if(!p.und(i))return i;var r=document.createElement(e.tagName),s=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;s.appendChild(r),r.style.position="absolute",r.style.width=100+n;var a=100/r.offsetWidth;s.removeChild(r);var l=a*parseFloat(t);return o.CSS[t+n]=l,l}function G(e,t,n){if(t in e.style){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=e.style[t]||getComputedStyle(e).getPropertyValue(i)||"0";return n?Q(e,r,n):r}}function z(e,t){return p.dom(e)&&!p.inp(e)&&(N(e,t)||p.svg(e)&&e[t])?"attribute":p.dom(e)&&S(s,t)?"transform":p.dom(e)&&"transform"!==t&&G(e,t)?"css":null!=e[t]?"object":void 0}var H=/(\w+)\(([^)]*)\)/g;function V(e){if(p.dom(e)){for(var t,n=e.style.transform||"",i=new Map;t=H.exec(n);)i.set(t[1],t[2]);return i}}function j(e,t,n,i){switch(z(e,t)){case"transform":return function(e,t,n,i){var r=l(t,"scale")?1:0+function(e){return l(e,"translate")||"perspective"===e?"px":l(e,"rotate")||l(e,"skew")?"deg":void 0}(t),s=V(e).get(t)||r;return n&&(n.transforms.list.set(t,s),n.transforms.last=t),i?Q(e,s,i):s}(e,t,i,n);case"css":return G(e,t,n);case"attribute":return N(e,t);default:return e[t]||0}}var W=/^(\*=|\+=|-=)/;function q(e,t){var n=W.exec(e);if(!n)return e;var i=F(e)||0,r=parseFloat(t),s=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return r+s+i;case"-":return r-s+i;case"*":return r*s+i}}var X=/\s/g;function Y(e,t){if(p.col(e))return function(e){return p.rgb(e)?(t=e,(n=R.exec(t))?"rgba("+n[1]+",1)":t):p.hex(e)?function(e){var t=e.replace(L,(function(e,t,n,i){return t+t+n+n+i+i})),n=D.exec(t);return"rgba("+parseInt(n[1],16)+","+parseInt(n[2],16)+","+parseInt(n[3],16)+",1)"}(e):p.hsl(e)?function(e){var t,n,i,r=P.exec(e)||U.exec(e),s=parseInt(r[1],10)/360,o=parseInt(r[2],10)/100,a=parseInt(r[3],10)/100,l=r[4]||1;function c(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+(t-e)*(2/3-n)*6:e}if(0==o)t=n=i=a;else{var h=a<.5?a*(1+o):a+o-a*o,d=2*a-h;t=c(d,h,s+1/3),n=c(d,h,s),i=c(d,h,s-1/3)}return"rgba("+255*t+","+255*n+","+255*i+","+l+")"}(e):void 0;var t,n}(e);var n=F(e),i=n?e.substr(0,e.length-n.length):e;return t&&!X.test(e)?i+t:i}function J(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function K(e){for(var t,n=e.points,i=0,r=0;r<n.numberOfItems;r++){var s=n.getItem(r);r>0&&(i+=J(t,s)),t=s}return i}function Z(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*N(e,"r")}(e);case"rect":return function(e){return 2*N(e,"width")+2*N(e,"height")}(e);case"line":return function(e){return J({x:N(e,"x1"),y:N(e,"y1")},{x:N(e,"x2"),y:N(e,"y2")})}(e);case"polyline":return K(e);case"polygon":return function(e){var t=e.points;return K(e)+J(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function $(e,t){var n=t||{},i=n.el||function(e){for(var t=e.parentNode;p.svg(t)&&(t=t.parentNode,p.svg(t.parentNode)););return t}(e),r=i.getBoundingClientRect(),s=N(i,"viewBox"),o=r.width,a=r.height,l=n.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:i,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function ee(e,t){function n(n){void 0===n&&(n=0);var i=t+n>=1?t+n:0;return e.el.getPointAtLength(i)}var i=$(e.el,e.svg),r=n(),s=n(-1),o=n(1);switch(e.property){case"x":return(r.x-i.x)*i.w;case"y":return(r.y-i.y)*i.h;case"angle":return 180*Math.atan2(o.y-s.y,o.x-s.x)/Math.PI}}var te=/-?\d*\.?\d+/g;function ne(e,t){var n=Y(p.pth(e)?e.totalLength:e,t)+"";return{original:n,numbers:n.match(te)?n.match(te).map(Number):[0],strings:p.str(e)||t?n.split(te):[]}}function ie(e){return w(e?_(p.arr(e)?e.map(M):M(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function re(e){var t=ie(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:V(e)}}}))}var se=/^spring/;function oe(e,t){var n=I(t);if(se.test(n.easing)&&(n.duration=m(n.easing)),p.arr(e)){var i=e.length;2!==i||p.obj(e[0])?p.fnc(t.duration)||(n.duration=t.duration/i):e={value:e}}var r=p.arr(e)?e:[e];return r.map((function(e,n){var i=p.obj(e)&&!p.pth(e)?e:{value:e};return p.und(i.delay)&&(i.delay=n?0:t.delay),p.und(i.endDelay)&&(i.endDelay=n===r.length-1?t.endDelay:0),i})).map((function(e){return T(e,n)}))}var ae={css:function(e,t,n){return e.style[t]=n},attribute:function(e,t,n){return e.setAttribute(t,n)},object:function(e,t,n){return e[t]=n},transform:function(e,t,n,i,r){if(i.list.set(t,n),t===i.last||r){var s="";i.list.forEach((function(e,t){s+=t+"("+e+") "})),e.style.transform=s}}};function le(e,t){for(var n=re(e),i=0,r=n.length;i<r;i++){var s=n[i];for(var o in t){var a=k(t[o],s),l=s.target,c=F(a),h=j(l,o,c,s),d=q(Y(a,c||F(h)),h),u=z(l,o);ae[u](l,o,d,s.transforms,!0)}}}function ce(e,t){return w(_(e.map((function(e){return t.map((function(t){return function(e,t){var n=z(e.target,t.name);if(n){var i=function(e,t){var n;return e.tweens.map((function(i){var r=function(e,t){var n={};for(var i in e){var r=k(e[i],t);p.arr(r)&&1===(r=r.map((function(e){return k(e,t)}))).length&&(r=r[0]),n[i]=r}return n.duration=parseFloat(n.duration),n.delay=parseFloat(n.delay),n}(i,t),s=r.value,o=p.arr(s)?s[1]:s,a=F(o),l=j(t.target,e.name,a,t),c=n?n.to.original:l,h=p.arr(s)?s[0]:c,d=F(h)||F(l),u=a||d;return p.und(o)&&(o=c),r.from=ne(h,u),r.to=ne(q(o,h),u),r.start=n?n.end:0,r.end=r.start+r.delay+r.duration+r.endDelay,r.easing=x(r.easing,r.duration),r.isPath=p.pth(s),r.isColor=p.col(r.from.original),r.isColor&&(r.round=1),n=r,r}))}(t,e),r=i[i.length-1];return{type:n,property:t.name,animatable:e,tweens:i,duration:r.end,delay:i[0].delay,endDelay:r.endDelay}}}(e,t)}))}))),(function(e){return!p.und(e)}))}function he(e,t){var n=e.length,i=function(e){return e.timelineOffset?e.timelineOffset:0},r={};return r.duration=n?Math.max.apply(Math,e.map((function(e){return i(e)+e.duration}))):t.duration,r.delay=n?Math.min.apply(Math,e.map((function(e){return i(e)+e.delay}))):t.delay,r.endDelay=n?r.duration-Math.max.apply(Math,e.map((function(e){return i(e)+e.duration-e.endDelay}))):t.endDelay,r}var de,ue=0,pe=[],Ae=[],fe=function(){function e(){de=requestAnimationFrame(t)}function t(t){var n=pe.length;if(n){for(var i=0;i<n;){var r=pe[i];if(r.paused){var s=pe.indexOf(r);s>-1&&(pe.splice(s,1),n=pe.length)}else r.tick(t);i++}e()}else de=cancelAnimationFrame(de)}return e}();function me(e){void 0===e&&(e={});var t,n=0,s=0,o=0,l=0,c=null;function h(){return window.Promise&&new Promise((function(e){return c=e}))}var d=h(),u=function(e){var t=B(i,e),n=B(r,e),s=function(e,t){var n=[],i=t.keyframes;for(var r in i&&(t=T(function(e){for(var t=w(_(e.map((function(e){return Object.keys(e)}))),(function(e){return p.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},i=function(i){var r=t[i];n[r]=e.map((function(e){var t={};for(var n in e)p.key(n)?n==r&&(t.value=e[n]):t[n]=e[n];return t}))},r=0;r<t.length;r++)i(r);return n}(i),t)),t)p.key(r)&&n.push({name:r,tweens:oe(t[r],e)});return n}(n,e),o=re(e.targets),a=ce(o,s),l=he(a,n),c=ue;return ue++,T(t,{id:c,children:[],animatables:o,animations:a,duration:l.duration,delay:l.delay,endDelay:l.endDelay})}(e);function A(){u.reversed=!u.reversed;for(var e=0,n=t.length;e<n;e++)t[e].reversed=u.reversed}function f(e){return u.reversed?u.duration-e:e}function m(){n=0,s=f(u.currentTime)*(1/me.speed)}function g(e,t){t&&t.seek(e-t.timelineOffset)}function v(e){for(var t=0,n=u.animations,i=n.length;t<i;){var r=n[t],s=r.animatable,o=r.tweens,l=o.length-1,c=o[l];l&&(c=w(o,(function(t){return e<t.end}))[0]||c);for(var h=a(e-c.start-c.delay,0,c.duration)/c.duration,d=isNaN(h)?1:c.easing(h),p=c.to.strings,A=c.round,f=[],m=c.to.numbers.length,g=void 0,v=0;v<m;v++){var y=void 0,E=c.to.numbers[v],x=c.from.numbers[v]||0;y=c.isPath?ee(c.value,d*E):x+d*(E-x),A&&(c.isColor&&v>2||(y=Math.round(y*A)/A)),f.push(y)}var b=p.length;if(b){g=p[0];for(var C=0;C<b;C++){p[C];var _=p[C+1],M=f[C];isNaN(M)||(g+=_?M+_:M+" ")}}else g=f[0];ae[r.type](s.target,r.property,g,s.transforms),r.currentValue=g,t++}}function y(e){u[e]&&!u.passThrough&&u[e](u)}function E(e){var i=u.duration,r=u.delay,p=i-u.endDelay,m=f(e);u.progress=a(m/i*100,0,100),u.reversePlayback=m<u.currentTime,t&&function(e){if(u.reversePlayback)for(var n=l;n--;)g(e,t[n]);else for(var i=0;i<l;i++)g(e,t[i])}(m),!u.began&&u.currentTime>0&&(u.began=!0,y("begin"),y("loopBegin")),m<=r&&0!==u.currentTime&&v(0),(m>=p&&u.currentTime!==i||!i)&&v(i),m>r&&m<p?(u.changeBegan||(u.changeBegan=!0,u.changeCompleted=!1,y("changeBegin")),y("change"),v(m)):u.changeBegan&&(u.changeCompleted=!0,u.changeBegan=!1,y("changeComplete")),u.currentTime=a(m,0,i),u.began&&y("update"),e>=i&&(s=0,u.remaining&&!0!==u.remaining&&u.remaining--,u.remaining?(n=o,y("loopComplete"),y("loopBegin"),"alternate"===u.direction&&A()):(u.paused=!0,u.completed||(u.completed=!0,y("loopComplete"),y("complete"),"Promise"in window&&(c(),d=h()))))}return u.reset=function(){var e=u.direction;u.passThrough=!1,u.currentTime=0,u.progress=0,u.paused=!0,u.began=!1,u.changeBegan=!1,u.completed=!1,u.changeCompleted=!1,u.reversePlayback=!1,u.reversed="reverse"===e,u.remaining=u.loop,t=u.children;for(var n=l=t.length;n--;)u.children[n].reset();(u.reversed&&!0!==u.loop||"alternate"===e&&1===u.loop)&&u.remaining++,v(0)},u.set=function(e,t){return le(e,t),u},u.tick=function(e){o=e,n||(n=o),E((o+(s-n))*me.speed)},u.seek=function(e){E(f(e))},u.pause=function(){u.paused=!0,m()},u.play=function(){u.paused&&(u.paused=!1,pe.push(u),m(),de||fe())},u.reverse=function(){A(),m()},u.restart=function(){u.reset(),u.play()},u.finished=d,u.reset(),u.autoplay&&u.play(),u}function ge(e,t){for(var n=t.length;n--;)S(e,t[n].animatable.target)&&t.splice(n,1)}document.addEventListener("visibilitychange",(function(){if(document.hidden){for(var e=0,t=pe.length;e<t;e++)activeInstance[e].pause();Ae=pe.slice(0),pe=[]}else for(var n=0,i=Ae.length;n<i;n++)Ae[n].play()})),me.version="3.0.0",me.speed=1,me.running=pe,me.remove=function(e){for(var t=ie(e),n=pe.length;n--;){var i=pe[n],r=i.animations,s=i.children;ge(t,r);for(var o=s.length;o--;){var a=s[o],l=a.animations;ge(t,l),l.length||a.children.length||s.splice(o,1)}r.length||s.length||i.pause()}},me.get=j,me.set=le,me.convertPx=Q,me.path=function(e,t){var n=p.str(e)?b(e)[0]:e,i=t||100;return function(e){return{property:e,el:n,svg:$(n),totalLength:Z(n)*(i/100)}}},me.setDashoffset=function(e){var t=Z(e);return e.setAttribute("stroke-dasharray",t),t},me.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",i=t.easing?x(t.easing):null,r=t.grid,s=t.axis,o=t.from||0,a="first"===o,l="center"===o,c="last"===o,h=p.arr(e),d=h?parseFloat(e[0]):parseFloat(e),u=h?parseFloat(e[1]):0,A=F(h?e[1]:e)||0,f=t.start||0+(h?d:0),m=[],g=0;return function(e,t,p){if(a&&(o=0),l&&(o=(p-1)/2),c&&(o=p-1),!m.length){for(var v=0;v<p;v++){if(r){var y=l?(r[0]-1)/2:o%r[0],E=l?(r[1]-1)/2:Math.floor(o/r[0]),x=y-v%r[0],b=E-Math.floor(v/r[0]),C=Math.sqrt(x*x+b*b);"x"===s&&(C=-x),"y"===s&&(C=-b),m.push(C)}else m.push(Math.abs(o-v));g=Math.max.apply(Math,m)}i&&(m=m.map((function(e){return i(e/g)*g}))),"reverse"===n&&(m=m.map((function(e){return s?e<0?-1*e:-e:Math.abs(g-e)})))}return f+(h?(u-d)/g:d)*(Math.round(100*m[t])/100)+A}},me.timeline=function(e){void 0===e&&(e={});var t=me(e);return t.duration=0,t.add=function(n,i){var s=pe.indexOf(t),o=t.children;function a(e){e.passThrough=!0}s>-1&&pe.splice(s,1);for(var l=0;l<o.length;l++)a(o[l]);var c=T(n,B(r,e));c.targets=c.targets||e.targets;var h=t.duration;c.autoplay=!1,c.direction=t.direction,c.timelineOffset=p.und(i)?h:q(i,h),a(t),t.seek(c.timelineOffset);var d=me(c);a(d),o.push(d);var u=he(o,e);return t.delay=u.delay,t.endDelay=u.endDelay,t.duration=u.duration,t.seek(0),t.reset(),t.autoplay&&t.play(),t},t},me.easing=x,me.penner=E,me.random=function(e,t){return Math.floor(Math.random()*(t-e+1))+e};const ve=me},4433:(e,t,n)=>{var i=n(5651),r=n(9035),s=n(7106),o=n(1684);e.exports=function(e){return new a(e)};class a extends THREE.BufferGeometry{constructor(e){super(),"string"==typeof e&&(e={text:e}),this._opt=Object.assign({},e),e&&this.update(e)}update(e){if("string"==typeof e&&(e={text:e}),!(e=Object.assign({},this._opt,e)).font)throw new TypeError("must specify a { font } in options");this.layout=i(e);var t=!1!==e.flipY,n=e.font,o=n.common.scaleW,a=n.common.scaleH,l=this.layout.glyphs.filter((function(e){var t=e.data;return t.width*t.height>0}));this.visibleGlyphs=l;var c=s.positions(l),h=s.uvs(l,o,a,t),d=r([],{clockwise:!0,type:"uint16",count:l.length});if(this.setIndex(d),this.setAttribute("position",new THREE.BufferAttribute(c,2)),this.setAttribute("uv",new THREE.BufferAttribute(h,2)),!e.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(e.multipage){var u=s.pages(l);this.setAttribute("page",new THREE.BufferAttribute(u,1))}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var e=this.attributes.position.array,t=this.attributes.position.itemSize;if(!e||!t||e.length<2)return this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0);o.computeSphere(e,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var e=this.boundingBox,t=this.attributes.position.array,n=this.attributes.position.itemSize;!t||!n||t.length<2?e.makeEmpty():o.computeBox(t,e)}}},1684:e=>{var t={min:[0,0],max:[0,0]};function n(e){var n=e.length/2;t.min[0]=e[0],t.min[1]=e[1],t.max[0]=e[0],t.max[1]=e[1];for(var i=0;i<n;i++){var r=e[2*i+0],s=e[2*i+1];t.min[0]=Math.min(r,t.min[0]),t.min[1]=Math.min(s,t.min[1]),t.max[0]=Math.max(r,t.max[0]),t.max[1]=Math.max(s,t.max[1])}}e.exports.computeBox=function(e,i){n(e),i.min.set(t.min[0],t.min[1],0),i.max.set(t.max[0],t.max[1],0)},e.exports.computeSphere=function(e,i){n(e);var r=t.min[0],s=t.min[1],o=t.max[0]-r,a=t.max[1]-s,l=Math.sqrt(o*o+a*a);i.center.set(r+o/2,s+a/2,0),i.radius=l/2}},7106:e=>{e.exports.pages=function(e){var t=new Float32Array(4*e.length*1),n=0;return e.forEach((function(e){var i=e.data.page||0;t[n++]=i,t[n++]=i,t[n++]=i,t[n++]=i})),t},e.exports.uvs=function(e,t,n,i){var r=new Float32Array(4*e.length*2),s=0;return e.forEach((function(e){var o=e.data,a=o.x+o.width,l=o.y+o.height,c=o.x/t,h=o.y/n,d=a/t,u=l/n;i&&(h=(n-o.y)/n,u=(n-l)/n),r[s++]=c,r[s++]=h,r[s++]=c,r[s++]=u,r[s++]=d,r[s++]=u,r[s++]=d,r[s++]=h})),r},e.exports.positions=function(e){var t=new Float32Array(4*e.length*2),n=0;return e.forEach((function(e){var i=e.data,r=e.position[0]+i.xoffset,s=e.position[1]+i.yoffset,o=i.width,a=i.height;t[n++]=r,t[n++]=s,t[n++]=r,t[n++]=s+a,t[n++]=r+o,t[n++]=s+a,t[n++]=r+o,t[n++]=s})),t}},5406:e=>{var t=/\n/,n=/\s/;function i(e,t,n,i){var r=e.indexOf(t,n);return-1===r||r>i?i:r}function r(e){return n.test(e)}function s(e,t,n,i){return{start:t,end:t+Math.min(i,n-t)}}e.exports=function(t,n){return e.exports.lines(t,n).map((function(e){return t.substring(e.start,e.end)})).join("\n")},e.exports.lines=function(e,n){if(0===(n=n||{}).width&&"nowrap"!==n.mode)return[];e=e||"";var o="number"==typeof n.width?n.width:Number.MAX_VALUE,a=Math.max(0,n.start||0),l="number"==typeof n.end?n.end:e.length,c=n.mode,h=n.measure||s;return"pre"===c?function(e,n,i,r,s){for(var o=[],a=i,l=i;l<r&&l<n.length;l++){var c=n.charAt(l),h=t.test(c);if(h||l===r-1){var d=e(n,a,h?l:l+1,s);o.push(d),a=l+1}}return o}(h,e,a,l,o):function(e,t,n,s,o,a){var l=[],c=o;for("nowrap"===a&&(c=Number.MAX_VALUE);n<s&&n<t.length;){for(var h=i(t,"\n",n,s);n<h&&r(t.charAt(n));)n++;var d=e(t,n,h,c),u=n+(d.end-d.start),p=u+1;if(u<h){for(;u>n&&!r(t.charAt(u));)u--;if(u===n)p>n+1&&p--,u=p;else for(p=u;u>n&&r(t.charAt(u-1));)u--}if(u>=n){var A=e(t,n,u,c);l.push(A)}n=p}return l}(h,e,a,l,o,c)}},3558:(e,t,n)=>{"use strict";var i=n(919),r=n(8847),s=n(3216),o=n(4597);function a(e,t,n){var i=e;return r(t)?(n=t,"string"==typeof e&&(i={uri:e})):i=o(t,{uri:e}),i.callback=n,i}function l(e,t,n){return c(t=a(e,t,n))}function c(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,n=function(n,i,r){t||(t=!0,e.callback(n,i,r))};function i(){var e=void 0;if(e=h.response?h.response:h.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(h),g)try{e=JSON.parse(e)}catch(e){}return e}function r(e){return clearTimeout(d),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,n(e,v)}function o(){if(!c){var t;clearTimeout(d),t=e.useXDR&&void 0===h.status?200:1223===h.status?204:h.status;var r=v,o=null;return 0!==t?(r={body:i(),statusCode:t,method:p,headers:{},url:u,rawRequest:h},h.getAllResponseHeaders&&(r.headers=s(h.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var a,c,h=e.xhr||null;h||(h=e.cors||e.useXDR?new l.XDomainRequest:new l.XMLHttpRequest);var d,u=h.url=e.uri||e.url,p=h.method=e.method||"GET",A=e.body||e.data,f=h.headers=e.headers||{},m=!!e.sync,g=!1,v={body:void 0,headers:{},statusCode:0,method:p,url:u,rawRequest:h};if("json"in e&&!1!==e.json&&(g=!0,f.accept||f.Accept||(f.Accept="application/json"),"GET"!==p&&"HEAD"!==p&&(f["content-type"]||f["Content-Type"]||(f["Content-Type"]="application/json"),A=JSON.stringify(!0===e.json?A:e.json))),h.onreadystatechange=function(){4===h.readyState&&setTimeout(o,0)},h.onload=o,h.onerror=r,h.onprogress=function(){},h.onabort=function(){c=!0},h.ontimeout=r,h.open(p,u,!m,e.username,e.password),m||(h.withCredentials=!!e.withCredentials),!m&&e.timeout>0&&(d=setTimeout((function(){if(!c){c=!0,h.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}}),e.timeout)),h.setRequestHeader)for(a in f)f.hasOwnProperty(a)&&h.setRequestHeader(a,f[a]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(h.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(h),h.send(A||null),h}e.exports=l,e.exports.default=l,l.XMLHttpRequest=i.XMLHttpRequest||function(){},l.XDomainRequest="withCredentials"in new l.XMLHttpRequest?l.XMLHttpRequest:i.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],(function(e){l["delete"===e?"del":e]=function(t,n,i){return(n=a(t,n,i)).method=e.toUpperCase(),c(n)}}))},1896:e=>{e.exports=void 0!==self.DOMParser?function(e){return(new self.DOMParser).parseFromString(e,"application/xml")}:void 0!==self.ActiveXObject&&new self.ActiveXObject("Microsoft.XMLDOM")?function(e){var t=new self.ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(e),t}:function(e){var t=document.createElement("div");return t.innerHTML=e,t}},4597:e=>{e.exports=function(){for(var e={},n=0;n<arguments.length;n++){var i=arguments[n];for(var r in i)t.call(i,r)&&(e[r]=i[r])}return e};var t=Object.prototype.hasOwnProperty},2784:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7427).debug("components:anchored:warn");e.exports.Component=i("anchored",{schema:{persistent:{default:!1}},init:function(){var e=this.el.sceneEl.getAttribute("webxr"),t=e.optionalFeatures;-1===t.indexOf("anchors")&&(t.push("anchors"),this.el.sceneEl.setAttribute("webxr",e)),this.auxQuaternion=new THREE.Quaternion,this.onEnterVR=this.onEnterVR.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR)},onEnterVR:function(){this.anchor=void 0,this.requestPersistentAnchorPending=this.data.persistent,this.requestAnchorPending=!this.data.persistent},tick:function(){var e,t,n,i=this.el.sceneEl,r=i.renderer.xr,s=this.el.object3D;(i.is("ar-mode")||i.is("vr-mode"))&&(!this.anchor&&this.requestPersistentAnchorPending&&this.restorePersistentAnchor(),!this.anchor&&this.requestAnchorPending&&this.createAnchor(),this.anchor&&(e=i.frame,t=r.getReferenceSpace(),n=e.getPose(this.anchor.anchorSpace,t),s.matrix.elements=n.transform.matrix,s.matrix.decompose(s.position,s.rotation,s.scale)))},createAnchor:async function(e,t){var n,i,s,o,a=this.el.sceneEl,l=a.renderer.xr,c=this.el.object3D;e=e||c.position,t=t||this.auxQuaternion.setFromEuler(c.rotation),function(e){var t=e.renderer.xr.getSession();return t&&t.restorePersistentAnchor}(a)?(this.anchor&&this.deleteAnchor(),n=a.frame,i=l.getReferenceSpace(),s=new XRRigidTransform({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z,w:t.w}),this.requestAnchorPending=!1,o=await n.createAnchor(s,i),this.data.persistent&&(this.el.id?(this.persistentHandle=await o.requestPersistentHandle(),localStorage.setItem(this.el.id,this.persistentHandle)):r("The anchor won't be persisted because the entity has no assigned id.")),a.object3D.attach(this.el.object3D),this.anchor=o):r("This browser doesn't support the WebXR anchors module")},restorePersistentAnchor:async function(){var e,t=this.el.sceneEl.renderer.xr.getSession(),n=t.persistentAnchors;if(this.requestPersistentAnchorPending=!1,!this.el.id)return r("The entity associated to the persistent anchor cannot be retrieved because it doesn't have an assigned id."),void(this.requestAnchorPending=!0);if(n){e=localStorage.getItem(this.el.id);for(var i=0;i<n.length;++i)if(e===n[i]){this.anchor=await t.restorePersistentAnchor(n[i]),this.anchor&&(this.persistentHandle=n[i]);break}this.anchor||(this.requestAnchorPending=!0)}else this.requestPersistentAnchorPending=!0},deleteAnchor:function(){var e,t=this.anchor;t&&(e=this.el.sceneEl.renderer.xr.getSession(),t.delete(),this.el.sceneEl.object3D.add(this.el.object3D),this.persistentHandle&&e.deletePersistentAnchor(this.persistentHandle),this.anchor=void 0)}})},6896:(e,t,n)=>{var i=n(4635).A,r=n(8190).components,s=n(8190).registerComponent,o=n(9437),a=n(7427),l=new o.Color,c=new o.Color,h=a.entity.getComponentProperty,d=a.entity.setComponentProperty,u={},p="color",A="rotation",f="components";function m(e){e.x=o.MathUtils.degToRad(e.x),e.y=o.MathUtils.degToRad(e.y),e.z=o.MathUtils.degToRad(e.z)}function g(e,t,n){var i;for(i=0;i<t.length;i++)e.addEventListener(t[i],n)}function v(e,t,n){var i;for(i=0;i<t.length;i++)e.removeEventListener(t[i],n)}function y(e,t){var n,i,r;for(i=x(t),r=e,n=0;n<i.length;n++)r=r[i[n]];if(void 0===r)throw console.log(e),new Error("[animation] property ("+t+") could not be found");return r}function E(e,t,n,i){var r,s,a,l;for(t.startsWith("object3D.rotation")&&(n=o.MathUtils.degToRad(n)),s=x(t),l=e,r=0;r<s.length-1;r++)l=l[s[r]];a=s[s.length-1],i!==p?l[a]=n:"r"in l[a]?(l[a].r=n.r,l[a].g=n.g,l[a].b=n.b):(l[a].x=n.r,l[a].y=n.g,l[a].z=n.b)}function x(e){return e in u||(u[e]=e.split(".")),u[e]}function b(e){return e.isRawProperty||e.property.startsWith(f)||e.property.startsWith("object3D")}e.exports.Component=s("animation",{schema:{autoplay:{default:!0},delay:{default:0},dir:{default:""},dur:{default:1e3},easing:{default:"easeInQuad"},elasticity:{default:400},enabled:{default:!0},from:{default:""},loop:{default:0,parse:function(e){return!0===e||"true"===e||!1!==e&&"false"!==e&&parseInt(e,10)}},property:{default:""},startEvents:{type:"array"},pauseEvents:{type:"array"},resumeEvents:{type:"array"},round:{default:!1},to:{default:""},type:{default:""},isRawProperty:{default:!1}},multiple:!0,init:function(){var e=this;this.eventDetail={name:this.attrName},this.time=0,this.animation=null,this.animationIsPlaying=!1,this.onStartEvent=this.onStartEvent.bind(this),this.beginAnimation=this.beginAnimation.bind(this),this.pauseAnimation=this.pauseAnimation.bind(this),this.resumeAnimation=this.resumeAnimation.bind(this),this.fromColor={},this.toColor={},this.targets={},this.targetsArray=[],this.updateConfigForDefault=this.updateConfigForDefault.bind(this),this.updateConfigForRawColor=this.updateConfigForRawColor.bind(this),this.config={complete:function(){e.animationIsPlaying=!1,e.el.emit("animationcomplete",e.eventDetail,!1),e.id&&e.el.emit("animationcomplete__"+e.id,e.eventDetail,!1)}}},update:function(e){var t=this.config,n=this.data;this.animationIsPlaying=!1,this.data.enabled&&n.property&&(t.autoplay=!1,t.direction=n.dir,t.duration=n.dur,t.easing=n.easing,t.elasticity=n.elasticity,t.loop=n.loop,t.round=n.round,this.createAndStartAnimation())},tick:function(e,t){this.animationIsPlaying&&(this.time+=t,this.animation.tick(this.time))},remove:function(){this.pauseAnimation(),this.removeEventListeners()},pause:function(){this.paused=!0,this.pausedWasPlaying=this.animationIsPlaying,this.pauseAnimation(),this.removeEventListeners()},play:function(){this.paused&&(this.paused=!1,this.addEventListeners(),this.pausedWasPlaying&&(this.resumeAnimation(),this.pausedWasPlaying=!1))},createAndStartAnimation:function(){var e=this.data;this.updateConfig(),this.animationIsPlaying=!1,this.animation=i(this.config),this.animation.began=!0,this.removeEventListeners(),this.addEventListeners(),!e.autoplay||e.startEvents&&e.startEvents.length||(e.delay?setTimeout(this.beginAnimation,e.delay):this.beginAnimation())},beginAnimation:function(){this.updateConfig(),this.animation.began=!0,this.time=0,this.animationIsPlaying=!0,this.stopRelatedAnimations(),this.el.emit("animationbegin",this.eventDetail,!1)},pauseAnimation:function(){this.animationIsPlaying=!1},resumeAnimation:function(){this.animationIsPlaying=!0},onStartEvent:function(){this.data.enabled&&(this.updateConfig(),this.animation&&this.animation.pause(),this.animation=i(this.config),this.data.delay?setTimeout(this.beginAnimation,this.data.delay):this.beginAnimation())},updateConfigForRawColor:function(){var e,t,n,i=this.config,r=this.data,s=this.el;if(!this.waitComponentInitRawProperty(this.updateConfigForRawColor)){for(t in e=""===r.from?y(s,r.property):r.from,n=r.to,this.setColorConfig(e,n),e=this.fromColor,n=this.toColor,this.targetsArray.length=0,this.targetsArray.push(e),i.targets=this.targetsArray,n)i[t]=n[t];var o;i.update=(o={},function(e){var t;(t=e.animatables[0].target).r===o.r&&t.g===o.g&&t.b===o.b||E(s,r.property,t,r.type)})}},updateConfigForDefault:function(){var e,t,n,i,r=this.config,s=this.data,o=this.el;this.waitComponentInitRawProperty(this.updateConfigForDefault)||(e=""===s.from?b(s)?y(o,s.property):h(o,s.property):s.from,n=s.to,isNaN(e||n)?(e=e?e.toString():e,n=n?n.toString():n):(e=parseFloat(e),n=parseFloat(n)),(t="true"===s.to||"false"===s.to||!0===s.to||!1===s.to)&&(e="true"===s.from||!0===s.from?1:0,n="true"===s.to||!0===s.to?1:0),this.targets.aframeProperty=e,r.targets=this.targets,r.aframeProperty=n,r.update=function(e){var n;(n=e.animatables[0].target.aframeProperty)!==i&&(i=n,t&&(n=n>=1),b(s)?E(o,s.property,n,s.type):d(o,s.property,n))})},updateConfigForVector:function(){var e,t,n,i,r=this.config,s=this.data,o=this.el,l=x(s.property),c="object3D"===l[0]?l[1]:l[0];for(e in t=""!==s.from?a.coordinates.parse(s.from):h(o,c),n=a.coordinates.parse(s.to),c===A&&(m(t),m(n)),this.targetsArray.length=0,this.targetsArray.push(t),r.targets=this.targetsArray,n)r[e]=n[e];r.update="position"!==c&&c!==A&&"scale"!==c?function(){var e={};return function(t){var n=t.animatables[0].target;n.x===e.x&&n.y===e.y&&n.z===e.z||(e.x=n.x,e.y=n.y,e.z=n.z,d(o,s.property,n))}}():(i={},function(e){var t=e.animatables[0].target;t.x===i.x&&t.y===i.y&&t.z===i.z||(i.x=t.x,i.y=t.y,i.z=t.z,o.object3D[c].set(t.x,t.y,t.z))})},updateConfig:function(){var e,t,n,i,s,o,a;t=this.el,n=this.data.property,e="object3D"!==(o=n.split("."))[0]||o[2]||"position"!==o[1]&&"rotation"!==o[1]&&"scale"!==o[1]?(s=o[0],a=o[1],(i=t.components[s]||r[s])?a&&!i.schema[a]?null:a?i.schema[a].type:i.schema.type:null):"vec3",b(this.data)&&this.data.type===p?this.updateConfigForRawColor():"vec2"===e||"vec3"===e||"vec4"===e?this.updateConfigForVector():this.updateConfigForDefault()},waitComponentInitRawProperty:function(e){var t,n=this.data,r=this.el,s=this;return""===n.from&&!!n.property.startsWith(f)&&(t=x(n.property)[1],!r.components[t]&&(r.addEventListener("componentinitialized",(function n(o){o.detail.name===t&&(e(),s.animation=i(s.config),r.removeEventListener("componentinitialized",n))})),!0))},stopRelatedAnimations:function(){var e,t;for(t in this.el.components)e=this.el.components[t],t!==this.attrName&&"animation"===e.name&&e.animationIsPlaying&&e.data.property===this.data.property&&(e.animationIsPlaying=!1)},addEventListeners:function(){var e=this.data,t=this.el;g(t,e.startEvents,this.onStartEvent),g(t,e.pauseEvents,this.pauseAnimation),g(t,e.resumeEvents,this.resumeAnimation)},removeEventListeners:function(){var e=this.data,t=this.el;v(t,e.startEvents,this.onStartEvent),v(t,e.pauseEvents,this.pauseAnimation),v(t,e.resumeEvents,this.resumeAnimation)},setColorConfig:function(e,t){l.set(e),c.set(t),e=this.fromColor,t=this.toColor,e.r=l.r,e.g=l.g,e.b=l.b,t.r=c.r,t.g=c.g,t.b=c.b}})},4395:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437);e.exports.Component=i("camera",{schema:{active:{default:!0},far:{default:1e4},fov:{default:80,min:0},near:{default:.005,min:0},spectator:{default:!1},zoom:{default:1,min:0}},init:function(){var e,t=this.el;e=this.camera=new r.PerspectiveCamera,t.setObject3D("camera",e)},update:function(e){var t=this.data,n=this.camera;n.aspect=t.aspect||window.innerWidth/window.innerHeight,n.far=t.far,n.fov=t.fov,n.near=t.near,n.zoom=t.zoom,n.updateProjectionMatrix(),this.updateActiveCamera(e),this.updateSpectatorCamera(e)},updateActiveCamera:function(e){var t=this.data,n=this.el,i=this.system;e&&e.active===t.active||t.spectator||(t.active&&i.activeCameraEl!==n?i.setActiveCamera(n):t.active||i.activeCameraEl!==n||i.disableActiveCamera())},updateSpectatorCamera:function(e){var t=this.data,n=this.el,i=this.system;e&&e.spectator===t.spectator||(t.spectator&&i.spectatorCameraEl!==n?i.setSpectatorCamera(n):t.spectator||i.spectatorCameraEl!==n||i.disableSpectatorCamera())},remove:function(){this.el.removeObject3D("camera")}})},3674:(e,t,n)=>{var i,r,s,o,a=n(8190).registerComponent,l=n(7427),c="click",h="mouseup",d="cursor-fusing",u="cursor-hovering",p="cursor-hovered",A={DOWN:["mousedown","touchstart"],UP:["mouseup","touchend"]},f={DOWN:["selectstart"],UP:["selectend"]},m="a-mouse-cursor-hover";e.exports.Component=a("cursor",{dependencies:["raycaster"],schema:{downEvents:{default:[]},fuse:{default:l.device.isMobile()},fuseTimeout:{default:1500,min:0},mouseCursorStylesEnabled:{default:!0},upEvents:{default:[]},rayOrigin:{default:"entity",oneOf:["mouse","entity","xrselect"]}},after:["tracked-controls"],multiple:!0,init:function(){var e=this;this.fuseTimeout=void 0,this.cursorDownEl=null,this.intersectedEl=null,this.canvasBounds=document.body.getBoundingClientRect(),this.isCursorDown=!1,this.activeXRInput=null,this.updateCanvasBounds=l.debounce((function(){e.canvasBounds=e.el.sceneEl.canvas.getBoundingClientRect()}),500),this.eventDetail={},this.intersectedEventDetail={cursorEl:this.el},this.onCursorDown=this.onCursorDown.bind(this),this.onCursorUp=this.onCursorUp.bind(this),this.onIntersection=this.onIntersection.bind(this),this.onIntersectionCleared=this.onIntersectionCleared.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onEnterVR=this.onEnterVR.bind(this)},update:function(e){this.data.rayOrigin!==e.rayOrigin&&("entity"===this.data.rayOrigin&&this.resetRaycaster(),this.updateMouseEventListeners(),"xrselect"===this.data.rayOrigin&&this.addWebXREventListeners(),"xrselect"===e.rayOrigin&&this.removeWebXREventListeners())},tick:function(){var e=this.el.sceneEl.frame,t=this.activeXRInput;"xrselect"===this.data.rayOrigin&&e&&t&&this.onMouseMove({frame:e,inputSource:t,type:"fakeselectevent"})},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){var e=this.el;e.removeState(u),e.removeState(d),clearTimeout(this.fuseTimeout),this.intersectedEl&&this.intersectedEl.removeState(p),this.removeEventListeners()},addEventListeners:function(){var e,t=this.data,n=this.el,i=this;function r(){e=n.sceneEl.canvas,t.downEvents.length||t.upEvents.length||(A.DOWN.forEach((function(t){e.addEventListener(t,i.onCursorDown,{passive:!1})})),A.UP.forEach((function(t){e.addEventListener(t,i.onCursorUp,{passive:!1})})))}(e=n.sceneEl.canvas)?r():n.sceneEl.addEventListener("render-target-loaded",r),t.downEvents.forEach((function(e){n.addEventListener(e,i.onCursorDown)})),t.upEvents.forEach((function(e){n.addEventListener(e,i.onCursorUp)})),n.addEventListener("raycaster-intersection",this.onIntersection),n.addEventListener("raycaster-closest-entity-changed",this.onIntersection),n.addEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),n.sceneEl.addEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.addEventListener("enter-vr",this.onEnterVR),window.addEventListener("resize",this.updateCanvasBounds),window.addEventListener("scroll",this.updateCanvasBounds),this.updateMouseEventListeners()},removeEventListeners:function(){var e,t=this.data,n=this.el,i=this;!(e=n.sceneEl.canvas)||t.downEvents.length||t.upEvents.length||(A.DOWN.forEach((function(t){e.removeEventListener(t,i.onCursorDown)})),A.UP.forEach((function(t){e.removeEventListener(t,i.onCursorUp)}))),t.downEvents.forEach((function(e){n.removeEventListener(e,i.onCursorDown)})),t.upEvents.forEach((function(e){n.removeEventListener(e,i.onCursorUp)})),n.removeEventListener("raycaster-intersection",this.onIntersection),n.removeEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),e.removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchstart",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),n.sceneEl.removeEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.removeEventListener("enter-vr",this.onEnterVR),window.removeEventListener("resize",this.updateCanvasBounds),window.removeEventListener("scroll",this.updateCanvasBounds),this.removeWebXREventListeners()},updateMouseEventListeners:function(){var e,t=this.el;(e=t.sceneEl.canvas).removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),t.setAttribute("raycaster","useWorldCoordinates",!1),"mouse"===this.data.rayOrigin&&(e.addEventListener("mousemove",this.onMouseMove),e.addEventListener("touchmove",this.onMouseMove,{passive:!1}),t.setAttribute("raycaster","useWorldCoordinates",!0),this.updateCanvasBounds())},resetRaycaster:function(){this.el.setAttribute("raycaster",{direction:(new THREE.Vector3).set(0,0,-1),origin:new THREE.Vector3})},addWebXREventListeners:function(){var e=this,t=this.el.sceneEl.xrSession;t&&(f.DOWN.forEach((function(n){t.addEventListener(n,e.onCursorDown)})),f.UP.forEach((function(n){t.addEventListener(n,e.onCursorUp)})))},removeWebXREventListeners:function(){var e=this,t=this.el.sceneEl.xrSession;t&&(f.DOWN.forEach((function(n){t.removeEventListener(n,e.onCursorDown)})),f.UP.forEach((function(n){t.removeEventListener(n,e.onCursorUp)})))},onMouseMove:(i=new THREE.Vector3,r=new THREE.Vector2,s=new THREE.Vector3,o={origin:s,direction:i},function(e){var t,n,a,l,c,h,d,u,p,A=this.canvasBounds,f=this.el.sceneEl.camera;f.parent.updateMatrixWorld(),n=(a="touchmove"===e.type||"touchstart"===e.type?e.touches.item(0):e).clientX-A.left,l=a.clientY-A.top,r.x=n/A.width*2-1,r.y=-l/A.height*2+1,"xrselect"!==this.data.rayOrigin||"selectstart"!==e.type&&"fakeselectevent"!==e.type?"fakeselectout"===e.type?(i.set(0,1,0),s.set(0,9999,0)):f&&f.isPerspectiveCamera?(s.setFromMatrixPosition(f.matrixWorld),i.set(r.x,r.y,.5).unproject(f).sub(s).normalize()):f&&f.isOrthographicCamera?(s.set(r.x,r.y,(f.near+f.far)/(f.near-f.far)).unproject(f),i.set(0,0,-1).transformDirection(f.matrixWorld)):console.error("AFRAME.Raycaster: Unsupported camera type: "+f.type):(c=e.frame,h=e.inputSource,d=this.el.sceneEl.renderer.xr.getReferenceSpace(),(u=c.getPose(h.targetRaySpace,d))&&(p=u.transform,i.set(0,0,-1),i.applyQuaternion(p.orientation),s.copy(p.position),(t=f.el.object3D.parent).localToWorld(s),i.transformDirection(t.matrixWorld))),this.el.setAttribute("raycaster",o),"touchmove"===e.type&&e.preventDefault()}),onCursorDown:function(e){this.isCursorDown=!0,"mouse"===this.data.rayOrigin&&"touchstart"===e.type&&(this.onMouseMove(e),this.el.components.raycaster.checkIntersections(),e.preventDefault()),"xrselect"===this.data.rayOrigin&&"selectstart"===e.type&&(this.activeXRInput=e.inputSource,this.onMouseMove(e),this.el.components.raycaster.checkIntersections(),this.el.components.raycaster.intersectedEls.length&&void 0!==this.el.sceneEl.components["ar-hit-test"]&&this.el.sceneEl.getAttribute("ar-hit-test").enabled&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!1),this.reenableARHitTest=!0)),this.twoWayEmit("mousedown",e),this.cursorDownEl=this.intersectedEl},onCursorUp:function(e){if(this.isCursorDown&&("xrselect"!==this.data.rayOrigin||this.activeXRInput===e.inputSource)){this.isCursorDown=!1;var t=this.data;this.twoWayEmit(h,e),!0===this.reenableARHitTest&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!0),this.reenableARHitTest=void 0),this.cursorDownEl&&this.cursorDownEl!==this.intersectedEl&&(this.intersectedEventDetail.intersection=null,this.cursorDownEl.emit(h,this.intersectedEventDetail)),t.fuse&&"mouse"!==t.rayOrigin&&"xrselect"!==t.rayOrigin||!this.intersectedEl||this.cursorDownEl!==this.intersectedEl||this.twoWayEmit(c,e),"xrselect"===t.rayOrigin&&this.onMouseMove({type:"fakeselectout"}),this.activeXRInput=null,this.cursorDownEl=null,"touchend"===e.type&&e.preventDefault()}},onIntersection:function(e){var t,n,i,r,s=this.el;n=e.detail.els[0]===s?1:0,r=e.detail.intersections[n],(i=e.detail.els[n])&&this.intersectedEl!==i&&(this.intersectedEl&&(t=this.el.components.raycaster.getIntersection(this.intersectedEl))&&t.distance<=r.distance||(this.clearCurrentIntersection(!0),this.setIntersection(i,r)))},onIntersectionCleared:function(e){-1!==e.detail.clearedEls.indexOf(this.intersectedEl)&&this.clearCurrentIntersection()},onEnterVR:function(){this.clearCurrentIntersection(!0),"xrselect"===this.data.rayOrigin&&this.addWebXREventListeners()},setIntersection:function(e,t){var n=this.el,i=this.data,r=this;this.intersectedEl!==e&&(this.intersectedEl=e,n.addState(u),e.addState(p),this.twoWayEmit("mouseenter"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.add(m),0!==i.fuseTimeout&&i.fuse&&"xrselect"!==i.rayOrigin&&"mouse"!==i.rayOrigin&&(n.addState(d),this.twoWayEmit("fusing"),this.fuseTimeout=setTimeout((function(){n.removeState(d),r.twoWayEmit(c)}),i.fuseTimeout)))},clearCurrentIntersection:function(e){var t,n,i=this.el;this.intersectedEl&&(this.intersectedEl.removeState(p),i.removeState(u),i.removeState(d),this.twoWayEmit("mouseleave"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.remove(m),this.intersectedEl=null,clearTimeout(this.fuseTimeout),!0!==e&&0!==(n=this.el.components.raycaster.intersections).length&&(t=n[n[0].object.el===i?1:0])&&this.setIntersection(t.object.el,t))},twoWayEmit:function(e,t){var n,i=this.el,r=this.intersectedEl;function s(e,n){t instanceof MouseEvent?e.mouseEvent=t:"undefined"!=typeof TouchEvent&&t instanceof TouchEvent&&(e.touchEvent=t)}n=this.el.components.raycaster.getIntersection(r),this.eventDetail.intersectedEl=r,this.eventDetail.intersection=n,s(this.eventDetail),i.emit(e,this.eventDetail),r&&(this.intersectedEventDetail.intersection=n,s(this.intersectedEventDetail),r.emit(e,this.intersectedEventDetail))}})},8388:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l="generic";e.exports.Component=i("generic-tracked-controller-controls",{schema:{hand:{default:""},defaultModel:{default:!0},defaultModelColor:{default:"gray"},disabled:{default:!1}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick"]},bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.wasControllerConnected=!1,this.bindMethods(),this.el.addEventListener("controllerconnected",(function(t){t.detail.name!==e.name&&(e.wasControllerConnected=!0,e.removeEventListeners(),e.removeControllersUpdateListener())}))},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data,t=e.hand?e.hand:void 0;s(this,l,{hand:t,iterateControllerProfiles:!0})},play:function(){this.wasControllerConnected||(this.checkIfControllerPresent(),this.addControllersUpdateListener())},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;this.el.components["tracked-controls"]?this.removeEventListeners():(e.setAttribute("tracked-controls",{hand:t.hand,idPrefix:l,iterateControllerProfiles:!0}),this.data.defaultModel&&this.initDefaultModel())},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.wasControllerConnected&&this.checkIfControllerPresent()},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},initDefaultModel:function(){var e=this.modelEl=document.createElement("a-entity");e.setAttribute("geometry",{primitive:"sphere",radius:.03}),e.setAttribute("material",{color:this.data.color}),this.el.appendChild(e),this.el.emit("controllermodelready",{name:"generic-tracked-controller-controls",model:this.modelEl,rayOrigin:{origin:{x:0,y:0,z:-.01},direction:{x:0,y:0,z:-1}}})}})},9840:(e,t,n)=>{var i=n(7045).to,r=n(7045).Ls,s=n(8190).registerComponent,o=n(9437),a=new o.BufferGeometry;e.exports.Component=s("geometry",{schema:{buffer:{default:!0},primitive:{default:"box",oneOf:r,schemaChange:!0},skipCache:{default:!1}},init:function(){this.geometry=null},update:function(e){var t,n=this.data,i=this.el,r=this.system;this.geometry&&(r.unuseGeometry(e),this.geometry=null),this.geometry=r.getOrCreateGeometry(n),(t=i.getObject3D("mesh"))?t.geometry=this.geometry:((t=new o.Mesh).geometry=this.geometry,this.el.getAttribute("material")||(t.material=new o.MeshStandardMaterial({color:16777215*Math.random(),metalness:0,roughness:.5})),i.setObject3D("mesh",t))},remove:function(){this.system.unuseGeometry(this.data),this.el.getObject3D("mesh").geometry=a,this.geometry=null},updateSchema:function(e){var t=this.oldData&&this.oldData.primitive,n=e.primitive,r=i[n]&&i[n].schema;if(!r)throw new Error("Unknown geometry schema `"+n+"`");t&&t===n||this.extendSchema(r)}})},297:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7427).debug("components:gltf-model:warn");e.exports.Component=i("gltf-model",{schema:{type:"model"},init:function(){var e=this,t=this.system.getDRACOLoader(),n=this.system.getMeshoptDecoder(),i=this.system.getKTX2Loader();this.model=null,this.loader=new r.GLTFLoader,t&&this.loader.setDRACOLoader(t),this.ready=n?n.then((function(t){e.loader.setMeshoptDecoder(t)})):Promise.resolve(),i&&this.loader.setKTX2Loader(i)},update:function(){var e=this,t=this.el,n=this.data;n&&(this.remove(),this.ready.then((function(){e.loader.load(n,(function(n){e.model=n.scene||n.scenes[0],e.model.animations=n.animations,t.setObject3D("mesh",e.model),t.emit("model-loaded",{format:"gltf",model:e.model})}),void 0,(function(e){var i=e&&e.message?e.message:"Failed to load glTF model";s(i),t.emit("model-error",{format:"gltf",src:n})}))})))},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},9194:(e,t,n)=>{(0,n(8190).registerComponent)("grabbable",{init:function(){this.el.setAttribute("obb-collider","centerModel: true")}})},332:(e,t,n)=>{var i=n(8190).registerComponent,r=n(1343).AFRAME_CDN_ROOT,s={toonLeft:r+"controllers/hands/leftHand.glb",toonRight:r+"controllers/hands/rightHand.glb",lowPolyLeft:r+"controllers/hands/leftHandLow.glb",lowPolyRight:r+"controllers/hands/rightHandLow.glb",highPolyLeft:r+"controllers/hands/leftHandHigh.glb",highPolyRight:r+"controllers/hands/rightHandHigh.glb"},o="Point",a="Fist",l="Thumb Up",c={};function h(e,t){var n;if(e)return"grip"===(n=c[e])?n+(t?"close":"open"):"point"===n?n+(t?"up":"down"):"pointing"===n||"pistol"===n?n+(t?"start":"end"):void 0}c[a]="grip",c[l]="pistol",c[o]="pointing",e.exports.Component=i("hand-controls",{schema:{color:{default:"white",type:"color"},hand:{default:"left"},handModelStyle:{default:"lowPoly",oneOf:["lowPoly","highPoly","toon"]}},after:["tracked-controls"],init:function(){var e=this,t=this.el;this.pressedButtons={},this.touchedButtons={},this.loader=new THREE.GLTFLoader,this.loader.setCrossOrigin("anonymous"),this.onGripDown=function(){e.handleButton("grip","down")},this.onGripUp=function(){e.handleButton("grip","up")},this.onTrackpadDown=function(){e.handleButton("trackpad","down")},this.onTrackpadUp=function(){e.handleButton("trackpad","up")},this.onTrackpadTouchStart=function(){e.handleButton("trackpad","touchstart")},this.onTrackpadTouchEnd=function(){e.handleButton("trackpad","touchend")},this.onTriggerDown=function(){e.handleButton("trigger","down")},this.onTriggerUp=function(){e.handleButton("trigger","up")},this.onTriggerTouchStart=function(){e.handleButton("trigger","touchstart")},this.onTriggerTouchEnd=function(){e.handleButton("trigger","touchend")},this.onGripTouchStart=function(){e.handleButton("grip","touchstart")},this.onGripTouchEnd=function(){e.handleButton("grip","touchend")},this.onThumbstickDown=function(){e.handleButton("thumbstick","down")},this.onThumbstickUp=function(){e.handleButton("thumbstick","up")},this.onAorXTouchStart=function(){e.handleButton("AorX","touchstart")},this.onAorXTouchEnd=function(){e.handleButton("AorX","touchend")},this.onBorYTouchStart=function(){e.handleButton("BorY","touchstart")},this.onBorYTouchEnd=function(){e.handleButton("BorY","touchend")},this.onSurfaceTouchStart=function(){e.handleButton("surface","touchstart")},this.onSurfaceTouchEnd=function(){e.handleButton("surface","touchend")},this.onControllerConnected=this.onControllerConnected.bind(this),this.onControllerDisconnected=this.onControllerDisconnected.bind(this),t.addEventListener("controllerconnected",this.onControllerConnected),t.addEventListener("controllerdisconnected",this.onControllerDisconnected),t.object3D.visible=!1},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},tick:function(e,t){var n=this.el.getObject3D("mesh");n&&n.mixer&&n.mixer.update(t/1e3)},onControllerConnected:function(e){var t=this.el,n=this.data.hand,i=this.el.getObject3D("mesh");t.object3D.visible=!0;var r="left"===n?Math.PI/2:-Math.PI/2,s=t.sceneEl.hasWebXR?-Math.PI/2:0;"pico-controls"===e.detail.name&&(s+=Math.PI/4),i.position.set(0,0,0),i.rotation.set(s,0,r)},onControllerDisconnected:function(){this.el.object3D.visible=!1},addEventListeners:function(){var e=this.el;e.addEventListener("gripdown",this.onGripDown),e.addEventListener("gripup",this.onGripUp),e.addEventListener("trackpaddown",this.onTrackpadDown),e.addEventListener("trackpadup",this.onTrackpadUp),e.addEventListener("trackpadtouchstart",this.onTrackpadTouchStart),e.addEventListener("trackpadtouchend",this.onTrackpadTouchEnd),e.addEventListener("triggerdown",this.onTriggerDown),e.addEventListener("triggerup",this.onTriggerUp),e.addEventListener("triggertouchstart",this.onTriggerTouchStart),e.addEventListener("triggertouchend",this.onTriggerTouchEnd),e.addEventListener("griptouchstart",this.onGripTouchStart),e.addEventListener("griptouchend",this.onGripTouchEnd),e.addEventListener("thumbstickdown",this.onThumbstickDown),e.addEventListener("thumbstickup",this.onThumbstickUp),e.addEventListener("abuttontouchstart",this.onAorXTouchStart),e.addEventListener("abuttontouchend",this.onAorXTouchEnd),e.addEventListener("bbuttontouchstart",this.onBorYTouchStart),e.addEventListener("bbuttontouchend",this.onBorYTouchEnd),e.addEventListener("xbuttontouchstart",this.onAorXTouchStart),e.addEventListener("xbuttontouchend",this.onAorXTouchEnd),e.addEventListener("ybuttontouchstart",this.onBorYTouchStart),e.addEventListener("ybuttontouchend",this.onBorYTouchEnd),e.addEventListener("surfacetouchstart",this.onSurfaceTouchStart),e.addEventListener("surfacetouchend",this.onSurfaceTouchEnd)},removeEventListeners:function(){var e=this.el;e.removeEventListener("gripdown",this.onGripDown),e.removeEventListener("gripup",this.onGripUp),e.removeEventListener("trackpaddown",this.onTrackpadDown),e.removeEventListener("trackpadup",this.onTrackpadUp),e.removeEventListener("trackpadtouchstart",this.onTrackpadTouchStart),e.removeEventListener("trackpadtouchend",this.onTrackpadTouchEnd),e.removeEventListener("triggerdown",this.onTriggerDown),e.removeEventListener("triggerup",this.onTriggerUp),e.removeEventListener("triggertouchstart",this.onTriggerTouchStart),e.removeEventListener("triggertouchend",this.onTriggerTouchEnd),e.removeEventListener("griptouchstart",this.onGripTouchStart),e.removeEventListener("griptouchend",this.onGripTouchEnd),e.removeEventListener("thumbstickdown",this.onThumbstickDown),e.removeEventListener("thumbstickup",this.onThumbstickUp),e.removeEventListener("abuttontouchstart",this.onAorXTouchStart),e.removeEventListener("abuttontouchend",this.onAorXTouchEnd),e.removeEventListener("bbuttontouchstart",this.onBorYTouchStart),e.removeEventListener("bbuttontouchend",this.onBorYTouchEnd),e.removeEventListener("xbuttontouchstart",this.onAorXTouchStart),e.removeEventListener("xbuttontouchend",this.onAorXTouchEnd),e.removeEventListener("ybuttontouchstart",this.onBorYTouchStart),e.removeEventListener("ybuttontouchend",this.onBorYTouchEnd),e.removeEventListener("surfacetouchstart",this.onSurfaceTouchStart),e.removeEventListener("surfacetouchend",this.onSurfaceTouchEnd)},update:function(e){var t,n=this.el,i=this.data.hand,r=this.data.handModelStyle,o=this.data.color,a=this;if(t={hand:i,model:!1},i!==e){var l=s[r+i.charAt(0).toUpperCase()+i.slice(1)];this.loader.load(l,(function(e){var i=e.scene.children[0];i.mixer=new THREE.AnimationMixer(i),a.clips=e.animations,n.setObject3D("mesh",i),i.traverse((function(e){e.isMesh&&(e.material.color=new THREE.Color(o))})),n.setAttribute("magicleap-controls",t),n.setAttribute("vive-controls",t),n.setAttribute("meta-touch-controls",t),n.setAttribute("pico-controls",t),n.setAttribute("windows-motion-controls",t),n.setAttribute("hp-mixed-reality-controls",t)}))}},remove:function(){this.el.removeObject3D("mesh")},handleButton:function(e,t){var n,i="down"===t,r="touchstart"===t;if(0===t.indexOf("touch")){if(r===this.touchedButtons[e])return;this.touchedButtons[e]=r}else{if(i===this.pressedButtons[e])return;this.pressedButtons[e]=i}n=this.gesture,this.gesture=this.determineGesture(),this.gesture!==n&&(this.animateGesture(this.gesture,n),this.emitGestureEvents(this.gesture,n))},determineGesture:function(){var e,t,n,i=this.pressedButtons.grip,r=this.pressedButtons.surface||this.touchedButtons.surface,s=this.pressedButtons.trackpad||this.touchedButtons.trackpad,c=this.pressedButtons.trigger||this.touchedButtons.trigger,h=this.touchedButtons.AorX||this.touchedButtons.BorY;return t=this.el.components["tracked-controls"],(n=t&&t.controller)&&(n.id&&0===n.id.indexOf("OpenVR ")||n.profiles&&n.profiles[0]&&"htc-vive"===n.profiles[0])?i||c?e=a:s&&(e=o):i?e=r||h||s?c?a:o:c?l:"Point + Thumb":c&&(e="Hold"),e},getClip:function(e){var t,n;for(n=0;n<this.clips.length;n++)if((t=this.clips[n]).name===e)return t},animateGesture:function(e,t){e?this.playAnimation(e||"Open",t,!1):this.playAnimation(t,t,!0)},emitGestureEvents:function(e,t){var n,i=this.el;t!==e&&((n=h(t,!1))&&i.emit(n),(n=h(e,!0))&&i.emit(n))},playAnimation:function(e,t,n){var i,r,s=this.el.getObject3D("mesh");if(s){if(i=this.getClip(e),r=s.mixer.clipAction(i),n)return r.paused=!1,void(r.timeScale=-1);if(r.clampWhenFinished=!0,r.loop=THREE.LoopOnce,r.repetitions=0,r.timeScale=1,r.time=0,r.weight=1,!t)return s.mixer.stopAllAction(),void r.play();i=this.getClip(t),r.reset(),r.play(),s.mixer.clipAction(i).crossFadeTo(r,.15,!0)}}})},9686:(e,t,n)=>{var i,r=n(8190).registerComponent,s=n(4056).P,o=n(7960).checkControllerPresentAndSetup,a=n(1343).AFRAME_CDN_ROOT,l=a+"controllers/oculus-hands/v4/left.glb",c=a+"controllers/oculus-hands/v4/right.glb",h=["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"];e.exports.Component=r("hand-tracking-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},modelStyle:{default:"mesh",oneOf:["dots","mesh"]},modelColor:{default:"white"},modelOpacity:{default:1}},after:["tracked-controls"],bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this)},addEventListeners:function(){this.el.addEventListener("model-loaded",this.onModelLoaded);for(var e=0;e<this.jointEls.length;++e)this.jointEls[e].object3D.visible=!0},removeEventListeners:function(){this.el.removeEventListener("model-loaded",this.onModelLoaded);for(var e=0;e<this.jointEls.length;++e)this.jointEls[e].object3D.visible=!1},init:function(){var e=this.el.sceneEl,t=e.getAttribute("webxr"),n=t.optionalFeatures;-1===n.indexOf("hand-tracking")&&(n.push("hand-tracking"),e.setAttribute("webxr",t)),this.wristObject3D=new THREE.Object3D,this.el.sceneEl.object3D.add(this.wristObject3D),this.onModelLoaded=this.onModelLoaded.bind(this),this.onChildAttached=this.onChildAttached.bind(this),this.jointEls=[],this.controllerPresent=!1,this.isPinched=!1,this.pinchEventDetail={position:new THREE.Vector3,wristRotation:new THREE.Quaternion},this.indexTipPosition=new THREE.Vector3,this.hasPoses=!1,this.jointPoses=new Float32Array(16*h.length),this.jointRadii=new Float32Array(h.length),this.bindMethods(),this.updateReferenceSpace=this.updateReferenceSpace.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.updateReferenceSpace),this.el.sceneEl.addEventListener("exit-vr",this.updateReferenceSpace),this.el.addEventListener("child-attached",this.onChildAttached),this.wristObject3D.visible=!1},onChildAttached:function(e){this.addChildEntity(e.detail.el)},update:function(){this.updateModelMaterial()},updateModelMaterial:function(){var e=this.jointEls,t=this.skinnedMesh,n=!(1===this.data.modelOpacity);t&&(this.skinnedMesh.material.color.set(this.data.modelColor),this.skinnedMesh.material.transparent=n,this.skinnedMesh.material.opacity=this.data.modelOpacity);for(var i=0;i<e.length;i++)e[i].setAttribute("material",{color:this.data.modelColor,transparent:n,opacity:this.data.modelOpacity})},updateReferenceSpace:function(){var e=this,t=this.el.sceneEl.xrSession;if(this.referenceSpace=void 0,t){var n=e.el.sceneEl.systems.webxr.sessionReferenceSpaceType;t.requestReferenceSpace(n).then((function(t){e.referenceSpace=t})).catch((function(t){throw e.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(n,"tracked-controls-webxr uses reference space "+n),t}))}},checkIfControllerPresent:function(){var e=this.data,t=e.hand?e.hand:void 0;o(this,"",{hand:t,iterateControllerProfiles:!0,handTracking:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},tick:function(){var e=this.el.sceneEl,t=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller,n=e.frame,i=this.el.components["tracked-controls"],r=this.referenceSpace;t&&n&&r&&i&&(this.hasPoses=!1,t.hand&&(this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),this.hasPoses=n.fillPoses(t.hand.values(),r,this.jointPoses)&&n.fillJointRadii(t.hand.values(),this.jointRadii),this.updateHandModel(),this.detectGesture(),this.updateWristObject()))},updateWristObject:(i=new THREE.Matrix4,function(){var e=this.wristObject3D;e&&this.hasPoses&&(i.fromArray(this.jointPoses,0),e.position.setFromMatrixPosition(i),e.quaternion.setFromRotationMatrix(i))}),updateHandModel:function(){this.wristObject3D.visible=!0,this.el.object3D.visible=!0,"dots"===this.data.modelStyle&&this.updateHandDotsModel(),"mesh"===this.data.modelStyle&&this.updateHandMeshModel()},getBone:function(e){for(var t=this.bones,n=0;n<t.length;n++)if(t[n].name===e)return t[n];return null},updateHandMeshModel:function(){var e=new THREE.Matrix4;return function(){var t=0,n=this.jointPoses,i=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller;if(i&&this.mesh&&(this.mesh.visible=!1,this.hasPoses))for(var r of i.hand.values()){var s=this.getBone(r.jointName);null!=s&&(this.mesh.visible=!0,e.fromArray(n,16*t),s.position.setFromMatrixPosition(e),s.quaternion.setFromRotationMatrix(e)),t++}}}(),updateHandDotsModel:function(){for(var e,t,n=this.jointPoses,i=this.jointRadii,r=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller,s=0;s<r.hand.size;s++)t=(e=this.jointEls[s]).object3D,e.object3D.visible=this.hasPoses,this.hasPoses&&(t.matrix.fromArray(n,16*s),t.matrix.decompose(t.position,t.rotation,t.scale),e.setAttribute("scale",{x:i[s],y:i[s],z:i[s]}))},detectGesture:function(){this.detectPinch()},detectPinch:function(){var e=new THREE.Vector3,t=new THREE.Matrix4;return function(){var n=this.indexTipPosition,i=this.pinchEventDetail;if(this.hasPoses){e.setFromMatrixPosition(t.fromArray(this.jointPoses,64)),n.setFromMatrixPosition(t.fromArray(this.jointPoses,144)),i.wristRotation.setFromRotationMatrix(t.fromArray(this.jointPoses,0));var r=n.distanceTo(e);r<.015&&!1===this.isPinched&&(this.isPinched=!0,i.position.copy(n).add(e).multiplyScalar(.5),this.el.emit("pinchstarted",i)),r>.02&&!0===this.isPinched&&(this.isPinched=!1,i.position.copy(n).add(e).multiplyScalar(.5),this.el.emit("pinchended",i)),this.isPinched&&(i.position.copy(n).add(e).multiplyScalar(.5),this.el.emit("pinchmoved",i))}}}(),pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{id:"",hand:t.hand,iterateControllerProfiles:!0,handTrackingEnabled:!0}),this.mesh?this.mesh!==e.getObject3D("mesh")&&e.setObject3D("mesh",this.mesh):this.initDefaultModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){var e,t=this.el;this.checkIfControllerPresent(),e=t.components["tracked-controls"]&&t.components["tracked-controls"].controller,this.mesh&&e&&e.hand&&e.hand instanceof XRHand&&t.setObject3D("mesh",this.mesh)},initDefaultModel:function(){var e=this.data;"dots"===e.modelStyle&&this.initDotsModel(),"mesh"===e.modelStyle&&this.initMeshHandModel(),this.el.object3D.visible=!0,this.wristObject3D.visible=!0},initDotsModel:function(){if(0===this.jointEls.length){for(var e=0;e<h.length;++e){var t=this.jointEl=document.createElement("a-entity");t.setAttribute("geometry",{primitive:"sphere",radius:1}),t.object3D.visible=!1,this.el.appendChild(t),this.jointEls.push(t)}this.updateModelMaterial()}},initMeshHandModel:function(){var e="left"===this.data.hand?l:c;this.el.setAttribute("gltf-model",e)},onModelLoaded:function(){var e=this.mesh=this.el.getObject3D("mesh").children[0],t=this.skinnedMesh=e.getObjectByProperty("type","SkinnedMesh");this.skinnedMesh&&(this.bones=t.skeleton.bones,this.el.removeObject3D("mesh"),e.position.set(0,0,0),e.rotation.set(0,0,0),t.frustumCulled=!1,t.material=new THREE.MeshStandardMaterial,this.updateModelMaterial(),this.setupChildrenEntities(),this.el.setObject3D("mesh",e))},setupChildrenEntities:function(){for(var e=this.el.children,t=0;t<e.length;++t)e[t]instanceof s&&this.addChildEntity(e[t])},addChildEntity:function(e){e instanceof s&&this.wristObject3D.add(e.object3D)}})},5593:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437);i("hand-tracking-grab-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},color:{type:"color",default:"white"},hoverColor:{type:"color",default:"#538df1"},hoverEnabled:{default:!1}},init:function(){var e,t=this.el,n=this.data;e="right"===n.hand?"components.hand-tracking-controls.bones.3":"components.hand-tracking-controls.bones.21",t.setAttribute("hand-tracking-controls",{hand:n.hand}),t.setAttribute("obb-collider",{trackedObject3D:e,size:.04}),this.auxMatrix=new r.Matrix4,this.onCollisionStarted=this.onCollisionStarted.bind(this),this.el.addEventListener("obbcollisionstarted",this.onCollisionStarted),this.onCollisionEnded=this.onCollisionEnded.bind(this),this.el.addEventListener("obbcollisionended",this.onCollisionEnded),this.onPinchStarted=this.onPinchStarted.bind(this),this.el.addEventListener("pinchstarted",this.onPinchStarted),this.onPinchEnded=this.onPinchEnded.bind(this),this.el.addEventListener("pinchended",this.onPinchEnded)},transferEntityOwnership:function(){for(var e,t=this.el.sceneEl.querySelectorAll("[hand-tracking-grab-controls]"),n=0;n<t.length;++n)(e=t[n].components["hand-tracking-grab-controls"])!==this&&this.grabbedEl&&this.grabbedEl===e.grabbedEl&&e.releaseGrabbedEntity();return!1},onCollisionStarted:function(e){var t=e.detail.withEl;this.collidedEl||t.getAttribute("grabbable")&&(this.collidedEl=t,this.grabbingObject3D=e.detail.trackedObject3D,this.data.hoverEnabled&&this.el.setAttribute("hand-tracking-controls","modelColor",this.data.hoverColor))},onCollisionEnded:function(){this.collidedEl=void 0,this.grabbedEl||(this.grabbingObject3D=void 0,this.data.hoverEnabled&&this.el.setAttribute("hand-tracking-controls","modelColor",this.data.color))},onPinchStarted:function(e){this.collidedEl&&(this.grabbedEl=this.collidedEl,this.transferEntityOwnership(),this.grab())},onPinchEnded:function(){this.releaseGrabbedEntity()},releaseGrabbedEntity:function(){var e=this.grabbedEl;if(e){var t=e.object3D,n=t.parent,i=this.originalParent;t.applyMatrix4(n.matrixWorld),t.applyMatrix4(this.auxMatrix.copy(i.matrixWorld).invert()),n.remove(t),i.add(t),this.el.emit("grabended",{grabbedEl:e}),this.grabbedEl=void 0,this.originalParent=void 0}},grab:function(){var e=this.grabbedEl,t=e.object3D,n=t.parent;this.originalParent=n;var i=this.el.components["hand-tracking-controls"].wristObject3D;t.applyMatrix4(n.matrixWorld),t.applyMatrix4(this.auxMatrix.copy(i.matrixWorld).invert()),n.remove(t),i.add(t),this.el.emit("grabstarted",{grabbedEl:e})}})},5387:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("hide-on-enter-ar",{init:function(){var e=this;this.el.sceneEl.addEventListener("enter-vr",(function(){e.el.sceneEl.is("ar-mode")&&(e.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){e.el.object3D.visible=!0}))}})},1620:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("hide-on-enter-vr",{init:function(){var e=this;this.el.sceneEl.addEventListener("enter-vr",(function(){e.el.sceneEl.is("vr-mode")&&(e.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){e.el.object3D.visible=!0}))}})},7538:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="hp-mixed-reality",h=n(1343).AFRAME_CDN_ROOT+"controllers/hp/mixed-reality/",d={x:0,y:0,z:.06},u={_x:Math.PI/4,_y:0,_z:0,_order:"XYZ"};e.exports.Component=i("hp-mixed-reality-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{left:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var e=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){l(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e,e.data.hand)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e,e.data.hand)},this.previousButtonValues={},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;o(this,c,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:c,hand:t.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",h+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t=e.detail.model;this.data.model&&(t.position.copy(d),t.rotation.copy(u),this.el.emit("controllermodelready",{name:"hp-mixed-reality-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)}))},onAxisMoved:function(e){a(this,this.mapping.axes,e)}})},8850:(e,t,n)=>{n(6896),n(2784),n(4395),n(3674),n(9840),n(8388),n(297),n(9194),n(9686),n(5593),n(332),n(5387),n(1620),n(7538),n(6219),n(9248),n(8798),n(6298),n(7796),n(7701),n(7850),n(298),n(3069),n(3176),n(8771),n(6077),n(3942),n(2588),n(7519),n(7394),n(2310),n(4760),n(1072),n(477),n(1603),n(6547),n(5300),n(7360),n(1507),n(4592),n(6458),n(221),n(3575),n(4005),n(3494),n(6273),n(3239),n(2288),n(6149),n(2130),n(3791),n(2662),n(952),n(1217),n(8346),n(6469)},9248:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7427);i("laser-controls",{schema:{hand:{default:"right"},model:{default:!0},defaultModelColor:{type:"color",default:"grey"}},init:function(){var e=this.config,t=this.data,n=this.el,i=this,s={hand:t.hand,model:t.model};function o(t){var s=e[t.detail.name];if(s){var o=r.extend({showLine:!0},s.raycaster||{});t.detail.rayOrigin&&(o.origin=t.detail.rayOrigin.origin,o.direction=t.detail.rayOrigin.direction,o.showLine=!0),t.detail.rayOrigin||!i.modelReady?n.setAttribute("raycaster",o):n.setAttribute("raycaster","showLine",!0),n.setAttribute("cursor",r.extend({fuse:!1},s.cursor))}}n.setAttribute("hp-mixed-reality-controls",s),n.setAttribute("magicleap-controls",s),n.setAttribute("oculus-go-controls",s),n.setAttribute("meta-touch-controls",s),n.setAttribute("pico-controls",s),n.setAttribute("valve-index-controls",s),n.setAttribute("vive-controls",s),n.setAttribute("vive-focus-controls",s),n.setAttribute("windows-motion-controls",s),n.setAttribute("generic-tracked-controller-controls",{hand:s.hand}),n.addEventListener("controllerconnected",o),n.addEventListener("controllerdisconnected",(function(t){e[t.detail.name]&&n.setAttribute("raycaster","showLine",!1)})),n.addEventListener("controllermodelready",(function(e){o(e),i.modelReady=!0}))},config:{"generic-tracked-controller-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"hp-mixed-reality-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"magicleap-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"oculus-go-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:5e-4,z:0}}},"meta-touch-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"pico-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"valve-index-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-focus-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"windows-motion-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{showLine:!1}}}})},6219:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7427).debug("components:layer:warn");e.exports.Component=i("layer",{schema:{type:{default:"quad",oneOf:["quad","monocubemap","stereocubemap"]},src:{type:"map"},rotateCubemap:{default:!1},width:{default:0},height:{default:0}},init:function(){var e=this.el.sceneEl.renderer.getContext();this.quaternion=new THREE.Quaternion,this.position=new THREE.Vector3,this.bindMethods(),this.needsRedraw=!1,this.frameBuffer=e.createFramebuffer();var t=this.el.sceneEl.getAttribute("webxr"),n=t.requiredFeatures;-1===n.indexOf("layers")&&(n.push("layers"),this.el.sceneEl.setAttribute("webxr",t)),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR),this.el.sceneEl.addEventListener("exit-vr",this.onExitVR)},bindMethods:function(){this.onRequestedReferenceSpace=this.onRequestedReferenceSpace.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this)},update:function(e){this.data.src!==e.src&&this.updateSrc()},updateSrc:function(){var e=this.data.type;this.texture=void 0,"quad"!==e?"monocubemap"!==e&&"stereocubemap"!==e||this.loadCubeMapImages():this.loadQuadImage()},loadCubeMapImages:function(){var e,t=this.xrGLFactory,n=this.el.sceneEl.frame,i=this.data.src,r=this.data.type;this.visibilityChanged=!1,this.layer&&("monocubemap"!==r&&"stereocubemap"!==r||(i.complete?this.pendingCubeMapUpdate=!1:this.pendingCubeMapUpdate=!0,this.loadingScreen?this.loadingScreen=!1:this.loadingScreen=!0,"monocubemap"===r?(e=t.getSubImage(this.layer,n),this.loadCubeMapImage(e.colorTexture,i,0)):(e=t.getSubImage(this.layer,n,"left"),this.loadCubeMapImage(e.colorTexture,i,0),e=t.getSubImage(this.layer,n,"right"),this.loadCubeMapImage(e.colorTexture,i,6))))},loadQuadImage:function(){var e=this.data.src,t=this;this.el.sceneEl.systems.material.loadTexture(e,{src:e},(function(n){t.el.sceneEl.renderer.initTexture(n),t.texture=n,"VIDEO"===e.tagName&&setTimeout((function(){t.textureIsVideo=!0}),1e3),t.layer&&(t.layer.height=t.data.height/2||t.texture.image.height/1e3,t.layer.width=t.data.width/2||t.texture.image.width/1e3,t.needsRedraw=!0),t.updateQuadPanel()}))},preGenerateCubeMapTextures:function(e,t){"monocubemap"===this.data.type?this.generateCubeMapTextures(e,0,t):(this.generateCubeMapTextures(e,0,t),this.generateCubeMapTextures(e,6,t))},generateCubeMapTextures:function(e,t,n){for(var i,r,s=this.data,o=this.cubeFaceSize,a=Math.min(e.width,e.height),l=[],c=0;c<6;c++){var h=document.createElement("CANVAS");h.width=h.height=o;var d=h.getContext("2d");s.rotateCubemap&&(2!==c&&3!==c||(d.save(),d.translate(o,o),d.rotate(Math.PI))),d.drawImage(e,(c+t)*a,0,a,a,0,0,o,o),d.restore(),n&&n(),l.push(h)}return s.rotateCubemap&&(i=l[0],r=l[1],l[0]=r,l[1]=i,i=l[4],r=l[5],l[4]=r,l[5]=i),n&&n(),l},loadCubeMapImage:function(e,t,n){var i,r=this.el.sceneEl.renderer.getContext();r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.bindTexture(r.TEXTURE_CUBE_MAP,e),i=!t.complete||this.loadingScreen?this.loadingScreenImages:this.generateCubeMapTextures(t,n);var s=0;i.forEach((function(e,t){r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,r.RGBA,r.UNSIGNED_BYTE,e),s=r.getError()})),0!==s&&console.log("renderingError, WebGL Error Code: "+s),r.bindTexture(r.TEXTURE_CUBE_MAP,null)},tick:function(){this.el.sceneEl.xrSession&&(this.layer||!this.el.sceneEl.is("vr-mode")&&!this.el.sceneEl.is("ar-mode")||this.initLayer(),this.updateTransform(),this.data.src.complete&&(this.pendingCubeMapUpdate||this.loadingScreen||this.visibilityChanged)&&this.loadCubeMapImages(),(this.needsRedraw||this.layer.needsRedraw||this.textureIsVideo)&&("quad"===this.data.type&&this.draw(),this.needsRedraw=!1))},initLayer:function(){var e=this,t=this.data.type;this.el.sceneEl.xrSession.onvisibilitychange=function(t){e.visibilityChanged="hidden"!==t.session.visibilityState},"quad"!==t?"monocubemap"!==t&&"stereocubemap"!==t||this.initCubeMapLayer():this.initQuadLayer()},initQuadLayer:function(){var e=this.el.sceneEl,t=e.renderer.getContext(),n=this.xrGLFactory=new XRWebGLBinding(e.xrSession,t);this.texture&&(this.layer=n.createQuadLayer({space:this.referenceSpace,viewPixelHeight:2048,viewPixelWidth:2048,height:this.data.height/2||this.texture.image.height/1e3,width:this.data.width/2||this.texture.image.width/1e3}),this.initLoadingScreenImages(),e.renderer.xr.addLayer(this.layer))},initCubeMapLayer:function(){var e=this.data.src,t=this.el.sceneEl,n=t.renderer.getContext(),i=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),r=this.cubeFaceSize=Math.min(i,Math.min(e.width,e.height)),s=this.xrGLFactory=new XRWebGLBinding(t.xrSession,n);this.layer=s.createCubeLayer({space:this.referenceSpace,viewPixelWidth:r,viewPixelHeight:r,layout:"monocubemap"===this.data.type?"mono":"stereo",isStatic:!1}),this.initLoadingScreenImages(),this.loadCubeMapImages(),t.renderer.xr.addLayer(this.layer)},initLoadingScreenImages:function(){for(var e=this.cubeFaceSize,t=this.loadingScreenImages=[],n=0;n<6;n++){var i=document.createElement("CANVAS");i.width=i.height=e;var r=i.getContext("2d");i.width=i.height=e,r.fillStyle="black",r.fillRect(0,0,e,e),2!==n&&3!==n&&(r.translate(e,0),r.scale(-1,1),r.fillStyle="white",r.font="30px Arial",r.fillText("Loading",e/2,e/2)),t.push(i)}},destroyLayer:function(){this.layer&&(this.el.sceneEl.renderer.xr.removeLayer(this.layer),this.layer.destroy(),this.layer=void 0)},toggleCompositorLayer:function(){this.enableCompositorLayer(!this.layerEnabled)},enableCompositorLayer:function(e){this.layerEnabled=e,this.quadPanelEl.object3D.visible=!this.layerEnabled},updateQuadPanel:function(){var e=this.quadPanelEl;this.quadPanelEl||(e=this.quadPanelEl=document.createElement("a-entity"),this.el.appendChild(e)),e.setAttribute("material",{shader:"flat",src:this.data.src,transparent:!0}),e.setAttribute("geometry",{primitive:"plane",height:this.data.height||this.texture.image.height/1e3,width:this.data.width||this.texture.image.height/1e3})},draw:function(){var e=this.el.sceneEl,t=this.el.sceneEl.renderer.getContext(),n=this.xrGLFactory.getSubImage(this.layer,e.frame),i=e.renderer.properties.get(this.texture).__webglTexture,r=t.getParameter(t.FRAMEBUFFER_BINDING);t.viewport(n.viewport.x,n.viewport.y,n.viewport.width,n.viewport.height),t.bindFramebuffer(t.FRAMEBUFFER,this.frameBuffer),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n.colorTexture,0),function(e,t,n,i){var r=e.createFramebuffer(),s=n.viewport.x,o=n.viewport.y,a=n.viewport.x+n.viewport.width,l=n.viewport.y+n.viewport.height;"VIDEO"===i.tagName&&(e.bindTexture(e.TEXTURE_2D,t),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,e.RGB,e.UNSIGNED_BYTE,i)),e.bindFramebuffer(e.READ_FRAMEBUFFER,r),e.framebufferTexture2D(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),e.readBuffer(e.COLOR_ATTACHMENT0),e.blitFramebuffer(0,0,i.width,i.height,s,o,a,l,e.COLOR_BUFFER_BIT,e.NEAREST),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.deleteFramebuffer(r)}(t,i,n,this.data.src),t.bindFramebuffer(t.FRAMEBUFFER,r)},updateTransform:function(){var e=this.el,t=this.position,n=this.quaternion;e.object3D.updateMatrixWorld(),t.setFromMatrixPosition(e.object3D.matrixWorld),n.setFromRotationMatrix(e.object3D.matrixWorld),this.layerEnabled||t.set(0,0,1e8),this.layer.transform=new XRRigidTransform(t,n)},onEnterVR:function(){var e=this.el.sceneEl,t=e.xrSession;e.hasWebXR&&XRWebGLBinding&&t?(t.requestReferenceSpace("local-floor").then(this.onRequestedReferenceSpace),this.layerEnabled=!0,this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!1),this.data.src.play&&this.data.src.play()):r("The layer component requires WebXR and the layers API enabled")},onExitVR:function(){this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!0),this.destroyLayer()},onRequestedReferenceSpace:function(e){this.referenceSpace=e}})},8798:(e,t,n)=>{var i,r,s,o,a,l,c=n(7427),h=c.diff,d=n(8940),u=n(8190).registerComponent,p=n(9437),A=n(3657),f=p.MathUtils.degToRad,m=d("components:light:warn"),g=new p.CubeTextureLoader,v={};e.exports.Component=u("light",{schema:{angle:{default:60,if:{type:["spot"]}},color:{type:"color",if:{type:["ambient","directional","hemisphere","point","spot"]}},envMap:{default:"",if:{type:["probe"]}},groundColor:{type:"color",if:{type:["hemisphere"]}},decay:{default:1,if:{type:["point","spot"]}},distance:{default:0,min:0,if:{type:["point","spot"]}},intensity:{default:3.14,min:0,if:{type:["ambient","directional","hemisphere","point","spot","probe"]}},penumbra:{default:0,min:0,max:1,if:{type:["spot"]}},type:{default:"directional",oneOf:["ambient","directional","hemisphere","point","spot","probe"],schemaChange:!0},target:{type:"selector",if:{type:["spot","directional"]}},castShadow:{default:!1,if:{type:["point","spot","directional"]}},shadowBias:{default:0,if:{castShadow:!0}},shadowCameraFar:{default:500,if:{castShadow:!0}},shadowCameraFov:{default:90,if:{castShadow:!0}},shadowCameraNear:{default:.5,if:{castShadow:!0}},shadowCameraTop:{default:5,if:{castShadow:!0}},shadowCameraRight:{default:5,if:{castShadow:!0}},shadowCameraBottom:{default:-5,if:{castShadow:!0}},shadowCameraLeft:{default:-5,if:{castShadow:!0}},shadowCameraVisible:{default:!1,if:{castShadow:!0}},shadowCameraAutomatic:{default:"",if:{type:["directional"]}},shadowMapHeight:{default:512,if:{castShadow:!0}},shadowMapWidth:{default:512,if:{castShadow:!0}},shadowRadius:{default:1,if:{castShadow:!0}}},init:function(){var e=this.el;this.light=null,this.defaultTarget=null,this.system.registerLight(e)},update:function(e){var t=this.data,n=h(t,e),i=this.light,r=this;if(!i||"type"in n)this.setLight(this.data),this.updateShadow();else{var s=!1;Object.keys(n).forEach((function(e){var n=t[e];switch(e){case"color":i.color.set(n);break;case"groundColor":i.groundColor.set(n);break;case"angle":i.angle=f(n);break;case"target":null===n?"spot"!==t.type&&"directional"!==t.type||(i.target=r.defaultTarget):n.hasLoaded?r.onSetTarget(n,i):n.addEventListener("loaded",r.onSetTarget.bind(r,n,i));break;case"envMap":r.updateProbeMap(t,i);break;case"castShadow":case"shadowBias":case"shadowCameraFar":case"shadowCameraFov":case"shadowCameraNear":case"shadowCameraTop":case"shadowCameraRight":case"shadowCameraBottom":case"shadowCameraLeft":case"shadowCameraVisible":case"shadowMapHeight":case"shadowMapWidth":case"shadowRadius":s||(r.updateShadow(),s=!0);break;case"shadowCameraAutomatic":t.shadowCameraAutomatic?r.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(t.shadowCameraAutomatic)):r.shadowCameraAutomaticEls=[];break;default:i[e]=n}}))}},tick:(i=new p.Box3,r=new p.Vector3,s=new p.Vector3,o=new p.Matrix4,a=new p.Sphere,l=new p.Vector3,function(){if("directional"===this.data.type&&this.light.shadow&&this.light.shadow.camera instanceof p.OrthographicCamera&&this.shadowCameraAutomaticEls.length){var e=this.light.shadow.camera;e.getWorldDirection(r),e.getWorldPosition(s),o.copy(e.matrixWorld),o.invert(),e.near=1,e.left=1e5,e.right=-1e5,e.top=-1e5,e.bottom=1e5,this.shadowCameraAutomaticEls.forEach((function(t){i.setFromObject(t.object3D),i.getBoundingSphere(a);var n=A.distanceOfPointFromPlane(s,r,a.center),c=A.nearestPointInPlane(s,r,a.center,l).applyMatrix4(o);e.near=Math.min(-n-a.radius-1,e.near),e.left=Math.min(-a.radius+c.x,e.left),e.right=Math.max(a.radius+c.x,e.right),e.top=Math.max(a.radius+c.y,e.top),e.bottom=Math.min(-a.radius+c.y,e.bottom)})),e.updateProjectionMatrix()}}),setLight:function(e){var t=this.el,n=this.getLight(e);n&&(this.light&&t.removeObject3D("light"),this.light=n,this.light.el=t,t.setObject3D("light",this.light),"spot"!==e.type&&"directional"!==e.type&&"hemisphere"!==e.type||t.getObject3D("light").translateY(-1),"spot"===e.type&&(t.setObject3D("light-target",this.defaultTarget),t.getObject3D("light-target").position.set(0,0,-1)),e.shadowCameraAutomatic?this.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(e.shadowCameraAutomatic)):this.shadowCameraAutomaticEls=[])},updateShadow:function(){var e=this.el,t=this.data,n=this.light;n.castShadow=t.castShadow;var i=e.getObject3D("cameraHelper");if(t.shadowCameraVisible&&!i?(i=new p.CameraHelper(n.shadow.camera),e.setObject3D("cameraHelper",i)):!t.shadowCameraVisible&&i&&e.removeObject3D("cameraHelper"),!t.castShadow)return n;n.shadow.bias=t.shadowBias,n.shadow.radius=t.shadowRadius,n.shadow.mapSize.height=t.shadowMapHeight,n.shadow.mapSize.width=t.shadowMapWidth,n.shadow.camera.near=t.shadowCameraNear,n.shadow.camera.far=t.shadowCameraFar,n.shadow.camera instanceof p.OrthographicCamera?(n.shadow.camera.top=t.shadowCameraTop,n.shadow.camera.right=t.shadowCameraRight,n.shadow.camera.bottom=t.shadowCameraBottom,n.shadow.camera.left=t.shadowCameraLeft):n.shadow.camera.fov=t.shadowCameraFov,n.shadow.camera.updateProjectionMatrix(),i&&i.update()},getLight:function(e){var t=e.angle,n=new p.Color(e.color);n=n.getHex();var i=e.decay,r=e.distance,s=new p.Color(e.groundColor);s=s.getHex();var o=e.intensity,a=e.type,l=e.target,c=null;switch(a.toLowerCase()){case"ambient":return new p.AmbientLight(n,o);case"directional":return c=new p.DirectionalLight(n,o),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"hemisphere":return new p.HemisphereLight(n,s,o);case"point":return new p.PointLight(n,o,r,i);case"spot":return c=new p.SpotLight(n,o,r,f(t),e.penumbra,i),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"probe":return c=new p.LightProbe,this.updateProbeMap(e,c),c;default:m("%s is not a valid light type. Choose from ambient, directional, hemisphere, point, spot.",a)}},updateProbeMap:function(e,t){e.envMap?(void 0===v[e.envMap]&&(v[e.envMap]=new window.Promise((function(t){c.srcLoader.validateCubemapSrc(e.envMap,(function(n){g.load(n,(function(n){var i=p.LightProbeGenerator.fromCubeTexture(n);v[e.envMap]=i,t(i)}))}))}))),v[e.envMap]instanceof window.Promise?v[e.envMap].then((function(e){t.copy(e)})):v[e.envMap]instanceof p.LightProbe&&t.copy(v[e.envMap])):t.copy(new p.LightProbe)},onSetTarget:function(e,t){t.target=e.object3D},remove:function(){var e=this.el;e.removeObject3D("light"),e.getObject3D("cameraHelper")&&e.removeObject3D("cameraHelper")}})},6298:(e,t,n)=>{var i=n(8190).registerComponent;function r(e,t){return!(!e||!t)&&e.x===t.x&&e.y===t.y&&e.z===t.z}e.exports.Component=i("line",{schema:{start:{type:"vec3",default:{x:0,y:0,z:0}},end:{type:"vec3",default:{x:0,y:0,z:0}},color:{type:"color",default:"#74BEC1"},opacity:{type:"number",default:1},visible:{default:!0}},multiple:!0,init:function(){var e,t,n=this.data;t=this.material=new THREE.LineBasicMaterial({color:n.color,opacity:n.opacity,transparent:n.opacity<1,visible:n.visible}),(e=this.geometry=new THREE.BufferGeometry).setAttribute("position",new THREE.BufferAttribute(new Float32Array(6),3)),this.line=new THREE.Line(e,t),this.el.setObject3D(this.attrName,this.line)},update:function(e){var t=this.data,n=this.geometry,i=!1,s=this.material,o=n.attributes.position.array;r(t.start,e.start)||(o[0]=t.start.x,o[1]=t.start.y,o[2]=t.start.z,i=!0),r(t.end,e.end)||(o[3]=t.end.x,o[4]=t.end.y,o[5]=t.end.z,i=!0),i&&(n.attributes.position.needsUpdate=!0,n.computeBoundingSphere()),s.color.setStyle(t.color),s.opacity=t.opacity,s.transparent=t.opacity<1,s.visible=t.visible},remove:function(){this.el.removeObject3D(this.attrName,this.line)}})},7796:(e,t,n)=>{var i,r,s,o,a,l,c,h,d=n(8190).registerComponent,u=n(5892).registerShader,p=n(9437);e.exports.Component=d("link",{schema:{backgroundColor:{default:"red",type:"color"},borderColor:{default:"white",type:"color"},highlighted:{default:!1},highlightedColor:{default:"#24CAFF",type:"color"},href:{default:""},image:{type:"asset"},on:{default:"click"},peekMode:{default:!1},title:{default:""},titleColor:{default:"white",type:"color"},visualAspectEnabled:{default:!1}},init:function(){this.navigate=this.navigate.bind(this),this.previousQuaternion=void 0,this.quaternionClone=new p.Quaternion,this.hiddenEls=[]},update:function(e){var t,n,i=this.data,r=this.el;if(i.visualAspectEnabled){var s=this.el.getAttribute("scale");this.previewDistance=15*(s.x+s.y)/2,this.initVisualAspect(),t=i.highlighted?i.highlightedColor:i.backgroundColor,n=i.highlighted?i.highlightedColor:i.borderColor,r.setAttribute("material","backgroundColor",t),r.setAttribute("material","strokeColor",n),i.on!==e.on&&this.updateEventListener(),void 0!==e.peekMode&&i.peekMode!==e.peekMode&&this.updatePeekMode(),i.image&&e.image!==i.image&&r.setAttribute("material","pano","string"==typeof i.image?i.image:i.image.src)}},updatePeekMode:function(){var e=this.el,t=this.sphereEl;this.data.peekMode?(this.hideAll(),e.getObject3D("mesh").visible=!1,t.setAttribute("visible",!0)):(this.showAll(),e.getObject3D("mesh").visible=!0,t.setAttribute("visible",!1))},play:function(){this.updateEventListener()},pause:function(){this.removeEventListener()},updateEventListener:function(){var e=this.el;e.isPlaying&&(this.removeEventListener(),e.addEventListener(this.data.on,this.navigate))},removeEventListener:function(){var e=this.data.on;e&&this.el.removeEventListener(e,this.navigate)},initVisualAspect:function(){var e,t,n,i=this.el;this.data.visualAspectEnabled&&!this.visualAspectInitialized&&(n=this.textEl=this.textEl||document.createElement("a-entity"),t=this.sphereEl=this.sphereEl||document.createElement("a-entity"),e=this.semiSphereEl=this.semiSphereEl||document.createElement("a-entity"),i.setAttribute("geometry",{primitive:"circle",radius:1,segments:64}),i.setAttribute("material",{shader:"portal",pano:this.data.image,side:"double",previewDistance:this.previewDistance}),n.setAttribute("text",{color:this.data.titleColor,align:"center",font:"kelsonsans",value:this.data.title||this.data.href,width:4}),n.setAttribute("position","0 1.5 0"),i.appendChild(n),e.setAttribute("geometry",{primitive:"sphere",radius:1,phiStart:0,segmentsWidth:64,segmentsHeight:64,phiLength:180,thetaStart:0,thetaLength:360}),e.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back",previewDistance:this.previewDistance}),e.setAttribute("rotation","0 180 0"),e.setAttribute("position","0 0 0"),e.setAttribute("visible",!1),i.appendChild(e),t.setAttribute("geometry",{primitive:"sphere",radius:10,segmentsWidth:64,segmentsHeight:64}),t.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back",previewDistance:this.previewDistance}),t.setAttribute("visible",!1),i.appendChild(t),this.visualAspectInitialized=!0)},navigate:function(){window.location=this.data.href},tick:(a=new p.Vector3,l=new p.Vector3,c=new p.Quaternion,h=new p.Vector3,function(){var e,t,n=this.el,i=n.object3D,r=n.sceneEl.camera,s=this.textEl;if(this.data.visualAspectEnabled)if(i.updateMatrixWorld(),r.parent.updateMatrixWorld(),r.updateMatrixWorld(),i.matrix.decompose(l,c,h),l.setFromMatrixPosition(i.matrixWorld),a.setFromMatrixPosition(r.matrixWorld),(t=l.distanceTo(a))>1.33333*this.previewDistance)this.previousQuaternion||(this.quaternionClone.copy(c),this.previousQuaternion=this.quaternionClone),i.lookAt(a);else{if(e=this.calculateCameraPortalOrientation(),t<.5){if(!0===this.semiSphereEl.getAttribute("visible"))return;s.setAttribute("text","width",1.5),e<=0?(s.setAttribute("position","0 0 0.75"),s.setAttribute("rotation","0 180 0"),this.semiSphereEl.setAttribute("rotation","0 0 0")):(s.setAttribute("position","0 0 -0.75"),s.setAttribute("rotation","0 0 0"),this.semiSphereEl.setAttribute("rotation","0 180 0")),n.getObject3D("mesh").visible=!1,this.semiSphereEl.setAttribute("visible",!0),this.peekCameraPortalOrientation=e}else e<=0?s.setAttribute("rotation","0 180 0"):s.setAttribute("rotation","0 0 0"),s.setAttribute("text","width",5),s.setAttribute("position","0 1.5 0"),n.getObject3D("mesh").visible=!0,this.semiSphereEl.setAttribute("visible",!1),this.peekCameraPortalOrientation=void 0;this.previousQuaternion&&(i.quaternion.copy(this.previousQuaternion),this.previousQuaternion=void 0)}}),hideAll:function(){var e=this.el,t=this.hiddenEls,n=this;t.length>0||e.sceneEl.object3D.traverse((function(i){i&&i.el&&i.el.hasAttribute("link-controls")||i.el&&i!==e.sceneEl.object3D&&i.el!==e&&i.el!==n.sphereEl&&i.el!==e.sceneEl.cameraEl&&!1!==i.el.getAttribute("visible")&&i.el!==n.textEl&&i.el!==n.semiSphereEl&&(i.el.setAttribute("visible",!1),t.push(i.el))}))},showAll:function(){this.hiddenEls.forEach((function(e){e.setAttribute("visible",!0)})),this.hiddenEls=[]},calculateCameraPortalOrientation:(i=new p.Matrix4,r=new p.Vector3,s=new p.Vector3(0,0,1),o=new p.Vector3(0,0,0),function(){var e=this.el,t=e.sceneEl.camera;return r.set(0,0,0),s.set(0,0,1),o.set(0,0,0),e.object3D.matrixWorld.extractRotation(i),s.applyMatrix4(i),e.object3D.updateMatrixWorld(),e.object3D.localToWorld(o),t.parent.parent.updateMatrixWorld(),t.parent.updateMatrixWorld(),t.updateMatrixWorld(),t.localToWorld(r),r.sub(o).normalize(),s.normalize(),Math.sign(s.dot(r))}),remove:function(){this.removeEventListener()}}),u("portal",{schema:{borderEnabled:{default:1,type:"int",is:"uniform"},backgroundColor:{default:"red",type:"color",is:"uniform"},pano:{type:"map",is:"uniform"},strokeColor:{default:"white",type:"color",is:"uniform"},previewDistance:{default:15,type:"float",is:"uniform"}},vertexShader:["vec3 portalPosition;","varying vec3 vWorldPosition;","varying float vDistanceToCenter;","varying float vDistance;","void main() {","vDistanceToCenter = clamp(length(position - vec3(0.0, 0.0, 0.0)), 0.0, 1.0);","portalPosition = (modelMatrix * vec4(0.0, 0.0, 0.0, 1.0)).xyz;","vDistance = length(portalPosition - cameraPosition);","vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI2 0.15915494","uniform sampler2D pano;","uniform vec3 strokeColor;","uniform vec3 backgroundColor;","uniform float borderEnabled;","uniform float previewDistance;","varying float vDistanceToCenter;","varying float vDistance;","varying vec3 vWorldPosition;","void main() {","vec3 direction = normalize(vWorldPosition - cameraPosition);","vec2 sampleUV;","float borderThickness = clamp(exp(-vDistance / 50.0), 0.6, 0.95);","sampleUV.y = clamp(direction.y * 0.5 + 0.5, 0.0, 1.0);","sampleUV.x = atan(direction.z, -direction.x) * -RECIPROCAL_PI2 + 0.5;","if (vDistanceToCenter > borderThickness && borderEnabled == 1.0) {","gl_FragColor = vec4(strokeColor, 1.0);","} else {","gl_FragColor = mix(texture2D(pano, sampleUV), vec4(backgroundColor, 1.0), clamp(pow((vDistance / previewDistance), 2.0), 0.0, 1.0));","}","}"].join("\n")})},7701:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="logitech-mx-ink",h=n(1343).AFRAME_CDN_ROOT+"controllers/logitech/";e.exports.Component=i("logitech-mx-ink-controls",{schema:{hand:{default:"left"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{left:{buttons:["front","back","none","none","none","tip"]},right:{buttons:["front","back","none","none","none","tip"]}},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){l(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e,e.data.hand)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e,e.data.hand)},this.bindMethods()},update:function(){this.data},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),e.sceneEl.removeEventListener("enter-vr",this.onEnterVR),e.sceneEl.removeEventListener("exit-vr",this.onExitVR),this.controllerEventsActive=!1},checkIfControllerPresent:function(){this.data;var e=this.controllerObject3D;e&&(e.visible=!1),o(this,c,{hand:this.data.hand,iterateControllerProfiles:!0})},injectTrackedControls:function(){var e=this.el,t=this.data,n=c;e.setAttribute("tracked-controls",{id:n,hand:t.hand,handTrackingEnabled:!1,iterateControllerProfiles:!0,orientationOffset:t.orientationOffset}),this.loadModel()},loadModel:function(){var e=this.controllerObject3D;if(this.data.model)return e?(e.visible=this.el.sceneEl.is("vr-mode"),void this.el.setObject3D("mesh",e)):void this.el.setAttribute("gltf-model",h+"logitech-mx-ink.glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){e.target===this.el&&this.data.model&&(this.el.emit("controllermodelready",{name:"logitech-mx-ink-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)}),this.controllerObject3D=this.el.getObject3D("mesh"),this.controllerObject3D.visible=this.el.sceneEl.is("vr-mode"))},onAxisMoved:function(e){a(this,this.mapping.axes,e)}})},7850:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7427),o=Math.PI/2;e.exports.Component=i("look-controls",{dependencies:["position","rotation"],schema:{enabled:{default:!0},magicWindowTrackingEnabled:{default:!0},pointerLockEnabled:{default:!1},reverseMouseDrag:{default:!1},reverseTouchDrag:{default:!1},touchEnabled:{default:!0},mouseEnabled:{default:!0}},init:function(){this.deltaYaw=0,this.previousHMDPosition=new r.Vector3,this.hmdQuaternion=new r.Quaternion,this.magicWindowAbsoluteEuler=new r.Euler,this.magicWindowDeltaEuler=new r.Euler,this.position=new r.Vector3,this.magicWindowObject=new r.Object3D,this.rotation={},this.deltaRotation={},this.savedPose=null,this.pointerLocked=!1,this.setupMouseControls(),this.bindMethods(),this.previousMouseEvent={},this.setupMagicWindowControls(),this.savedPose={position:new r.Vector3,rotation:new r.Euler},(this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode"))&&this.onEnterVR()},setupMagicWindowControls:function(){var e,t=this.data;(s.device.isMobile()||s.device.isMobileDeviceRequestingDesktopSite())&&(e=this.magicWindowControls=new r.DeviceOrientationControls(this.magicWindowObject),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission&&(e.enabled=!1,this.el.sceneEl.components["device-orientation-permission-ui"].permissionGranted?e.enabled=t.magicWindowTrackingEnabled:this.el.sceneEl.addEventListener("deviceorientationpermissiongranted",(function(){e.enabled=t.magicWindowTrackingEnabled}))))},update:function(e){var t=this.data;t.enabled!==e.enabled&&this.updateGrabCursor(t.enabled),e&&!t.magicWindowTrackingEnabled&&e.magicWindowTrackingEnabled&&(this.magicWindowAbsoluteEuler.set(0,0,0),this.magicWindowDeltaEuler.set(0,0,0)),this.magicWindowControls&&(this.magicWindowControls.enabled=t.magicWindowTrackingEnabled),e&&!t.pointerLockEnabled!==e.pointerLockEnabled&&(this.removeEventListeners(),this.addEventListeners(),this.pointerLocked&&this.exitPointerLock())},tick:function(e){this.data.enabled&&this.updateOrientation()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},remove:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},bindMethods:function(){this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this),this.onPointerLockChange=this.onPointerLockChange.bind(this),this.onPointerLockError=this.onPointerLockError.bind(this)},setupMouseControls:function(){this.mouseDown=!1,this.pitchObject=new r.Object3D,this.yawObject=new r.Object3D,this.yawObject.position.y=10,this.yawObject.add(this.pitchObject)},addEventListeners:function(){var e=this.el.sceneEl,t=e.canvas;t?(t.addEventListener("mousedown",this.onMouseDown,!1),window.addEventListener("mousemove",this.onMouseMove,!1),window.addEventListener("mouseup",this.onMouseUp,!1),t.addEventListener("touchstart",this.onTouchStart,{passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{passive:!0}),e.addEventListener("enter-vr",this.onEnterVR),e.addEventListener("exit-vr",this.onExitVR),this.data.pointerLockEnabled&&(document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.addEventListener("pointerlockerror",this.onPointerLockError,!1))):e.addEventListener("render-target-loaded",this.addEventListeners.bind(this))},removeEventListeners:function(){var e=this.el.sceneEl,t=e&&e.canvas;t&&(t.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),t.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),e.removeEventListener("enter-vr",this.onEnterVR),e.removeEventListener("exit-vr",this.onExitVR),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("pointerlockerror",this.onPointerLockError,!1))},updateOrientation:function(){var e=this.el.object3D,t=this.pitchObject,n=this.yawObject,i=this.el.sceneEl;(i.is("vr-mode")||i.is("ar-mode"))&&i.checkHeadsetConnected()||(this.updateMagicWindowOrientation(),e.rotation.x=this.magicWindowDeltaEuler.x+t.rotation.x,e.rotation.y=this.magicWindowDeltaEuler.y+n.rotation.y,e.rotation.z=this.magicWindowDeltaEuler.z)},updateMagicWindowOrientation:function(){var e=this.magicWindowAbsoluteEuler,t=this.magicWindowDeltaEuler;this.magicWindowControls&&this.magicWindowControls.enabled&&(this.magicWindowControls.update(),e.setFromQuaternion(this.magicWindowObject.quaternion,"YXZ"),this.previousMagicWindowYaw||0===e.y||(this.previousMagicWindowYaw=e.y),this.previousMagicWindowYaw&&(t.x=e.x,t.y+=e.y-this.previousMagicWindowYaw,t.z=e.z,this.previousMagicWindowYaw=e.y))},onMouseMove:function(e){var t,n,i,r=this.pitchObject,s=this.previousMouseEvent,a=this.yawObject;this.data.enabled&&(this.mouseDown||this.pointerLocked)&&(this.pointerLocked?(n=e.movementX||e.mozMovementX||0,i=e.movementY||e.mozMovementY||0):(n=e.screenX-s.screenX,i=e.screenY-s.screenY),this.previousMouseEvent.screenX=e.screenX,this.previousMouseEvent.screenY=e.screenY,t=this.data.reverseMouseDrag?1:-1,a.rotation.y+=.002*n*t,r.rotation.x+=.002*i*t,r.rotation.x=Math.max(-o,Math.min(o,r.rotation.x)))},onMouseDown:function(e){var t=this.el.sceneEl;if(this.data.enabled&&this.data.mouseEnabled&&(!t.is("vr-mode")&&!t.is("ar-mode")||!t.checkHeadsetConnected())&&0===e.button){var n=t&&t.canvas;this.mouseDown=!0,this.previousMouseEvent.screenX=e.screenX,this.previousMouseEvent.screenY=e.screenY,this.showGrabbingCursor(),this.data.pointerLockEnabled&&!this.pointerLocked&&(n.requestPointerLock?n.requestPointerLock():n.mozRequestPointerLock&&n.mozRequestPointerLock())}},showGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor="grabbing"},hideGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor=""},onMouseUp:function(){this.mouseDown=!1,this.hideGrabbingCursor()},onTouchStart:function(e){1!==e.touches.length||!this.data.touchEnabled||this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode")||(this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY},this.touchStarted=!0)},onTouchMove:function(e){var t,n,i=this.el.sceneEl.canvas,r=this.yawObject;this.touchStarted&&this.data.touchEnabled&&(n=2*Math.PI*(e.touches[0].pageX-this.touchStart.x)/i.clientWidth,t=this.data.reverseTouchDrag?1:-1,r.rotation.y-=.5*n*t,this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY})},onTouchEnd:function(){this.touchStarted=!1},onEnterVR:function(){var e=this.el.sceneEl;e.checkHeadsetConnected()&&(this.saveCameraPose(),this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),e.hasWebXR&&(this.el.object3D.matrixAutoUpdate=!1,this.el.object3D.updateMatrix()))},onExitVR:function(){this.el.sceneEl.checkHeadsetConnected()&&(this.restoreCameraPose(),this.previousHMDPosition.set(0,0,0),this.el.object3D.matrixAutoUpdate=!0)},onPointerLockChange:function(){this.pointerLocked=!(!document.pointerLockElement&&!document.mozPointerLockElement)},onPointerLockError:function(){this.pointerLocked=!1},exitPointerLock:function(){document.exitPointerLock(),this.pointerLocked=!1},updateGrabCursor:function(e){var t=this.el.sceneEl;function n(){t.canvas.classList.add("a-grab-cursor")}function i(){t.canvas.classList.remove("a-grab-cursor")}t.canvas?e?n():i():e?t.addEventListener("render-target-loaded",n):t.addEventListener("render-target-loaded",i)},saveCameraPose:function(){var e=this.el;this.savedPose.position.copy(e.object3D.position),this.savedPose.rotation.copy(e.object3D.rotation),this.hasSavedPose=!0},restoreCameraPose:function(){var e=this.el,t=this.savedPose;this.hasSavedPose&&(e.object3D.position.copy(t.position),e.object3D.rotation.copy(t.rotation),this.hasSavedPose=!1)}})},298:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l="magicleap-one",c=n(1343).AFRAME_CDN_ROOT+"controllers/magicleap/magicleap-one-controller.glb";e.exports.Component=i("magicleap-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","menu"]},init:function(){var e=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;s(this,l,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:l,hand:t.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",c)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){e.detail.model.scale.set(.01,.01,.01)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){},setButtonColor:function(e,t){}})},3069:(e,t,n)=>{var i=n(7427),r=n(8190),s=n(9437),o=n(5892),a=i.debug("components:material:error"),l=r.registerComponent,c=o.shaders,h=o.shaderNames;function d(e,t){e.dispose(),t.unregisterMaterial(e),Object.keys(e).filter((function(t){return e[t]&&e[t].isTexture})).forEach((function(t){e[t].dispose()}))}e.exports.Component=l("material",{schema:{alphaTest:{default:0,min:0,max:1},depthTest:{default:!0},depthWrite:{default:!0},flatShading:{default:!1},npot:{default:!1},offset:{type:"vec2",default:{x:0,y:0}},opacity:{default:1,min:0,max:1},repeat:{type:"vec2",default:{x:1,y:1}},shader:{default:"standard",oneOf:h,schemaChange:!0},side:{default:"front",oneOf:["front","back","double"]},transparent:{default:!1},vertexColorsEnabled:{default:!1},visible:{default:!0},blending:{default:"normal",oneOf:["none","normal","additive","subtractive","multiply"]},dithering:{default:!0},anisotropy:{default:0,min:0}},init:function(){this.material=null},update:function(e){var t=this.data;this.shader&&t.shader===e.shader||this.updateShader(t.shader),this.shader.update(this.data),this.updateMaterial(e)},updateSchema:function(e){var t,n,i,r;n=e&&e.shader,t=this.oldData&&this.oldData.shader,(i=c[r=n||t]&&c[r].schema)||a("Unknown shader schema "+r),t&&n===t||(this.extendSchema(i),this.updateBehavior())},updateBehavior:function(){var e,t,n=this.el.sceneEl,i=this.schema,r=this;function s(e,n){var i;for(i in t)t[i]=e;r.shader.update(t)}for(e in this.tick=void 0,t={},i)"time"===i[e].type&&(this.tick=s,t[e]=!0);n&&(this.tick?n.addBehavior(this):n.removeBehavior(this))},updateShader:function(e){var t,n=this.data,i=c[e]&&c[e].Shader;if(!i)throw new Error("Unknown shader "+e);(t=this.shader=new i).el=this.el,t.init(n),this.setMaterial(t.material),this.updateSchema(n)},updateMaterial:function(e){var t,n=this.data,i=this.material;for(t in i.alphaTest=n.alphaTest,i.depthTest=!1!==n.depthTest,i.depthWrite=!1!==n.depthWrite,i.opacity=n.opacity,i.flatShading=n.flatShading,i.side=function(e){switch(e){case"back":return s.BackSide;case"double":return s.DoubleSide;default:return s.FrontSide}}(n.side),i.transparent=!1!==n.transparent||n.opacity<1,i.vertexColors=n.vertexColorsEnabled,i.visible=n.visible,i.blending=function(e){switch(e){case"none":return s.NoBlending;case"additive":return s.AdditiveBlending;case"subtractive":return s.SubtractiveBlending;case"multiply":return s.MultiplyBlending;default:return s.NormalBlending}}(n.blending),i.dithering=n.dithering,e)break;!t||e.alphaTest===n.alphaTest&&e.side===n.side&&e.vertexColorsEnabled===n.vertexColorsEnabled||(i.needsUpdate=!0)},remove:function(){var e=new s.MeshBasicMaterial,t=this.material,n=this.el.getObject3D("mesh");n&&(n.material=e),d(t,this.system)},setMaterial:function(e){var t,n=this.el,i=this.system;this.material&&d(this.material,i),this.material=e,i.registerMaterial(e),(t=n.getObject3D("mesh"))?t.material=e:n.addEventListener("object3dset",(function t(i){"mesh"===i.detail.type&&i.target===n&&(n.getObject3D("mesh").material=e,n.removeEventListener("object3dset",t))}))}})},3942:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="oculus-touch",h=n(1343).AFRAME_CDN_ROOT,d=h+"controllers/oculus/oculus-touch-controller-",u=h+"controllers/meta/",p={left:{modelUrl:d+"left.gltf",rayOrigin:{origin:{x:.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new r.Vector3(-.005,.036,-.037),modelPivotRotation:new r.Euler(Math.PI/4.5,0,0)},right:{modelUrl:d+"right.gltf",rayOrigin:{origin:{x:-.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new r.Vector3(.005,.036,-.037),modelPivotRotation:new r.Euler(Math.PI/4.5,0,0)}},A="oculus-touch",f={"oculus-touch":p,"oculus-touch-v2":{left:{modelUrl:d+"gen2-left.gltf",rayOrigin:{origin:{x:-.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new r.Vector3(0,-.007,-.021),modelPivotRotation:new r.Euler(-Math.PI/4,0,0)},right:{modelUrl:d+"gen2-right.gltf",rayOrigin:{origin:{x:.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new r.Vector3(0,-.007,-.021),modelPivotRotation:new r.Euler(-Math.PI/4,0,0)}},"oculus-touch-v3":{left:{modelUrl:d+"v3-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)},right:{modelUrl:d+"v3-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)}},"meta-quest-touch-pro":{left:{modelUrl:u+"quest-touch-pro-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)},right:{modelUrl:u+"quest-touch-pro-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)}},"meta-quest-touch-plus":{left:{modelUrl:u+"quest-touch-plus-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)},right:{modelUrl:u+"quest-touch-plus-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)}}},m={schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#999"},buttonTouchColor:{type:"color",default:"#8AB"},buttonHighlightColor:{type:"color",default:"#2DF"},model:{default:!0},controllerType:{default:"auto",oneOf:["auto","oculus-touch","oculus-touch-v2","oculus-touch-v3"]}},after:["tracked-controls"],mapping:{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton","surface"]}},bindMethods:function(){this.onButtonChanged=this.onButtonChanged.bind(this),this.onThumbstickMoved=this.onThumbstickMoved.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonDown=function(t){l(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){l(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e,e.data.hand)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e,e.data.hand)},this.controllerPresent=!1,this.previousButtonValues={},this.bindMethods(),this.triggerEuler=new r.Euler},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.controllerObject3D;e&&(e.visible=!1),o(this,c,{hand:this.data.hand,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},loadModel:function(e){var t,n=this.data;if(n.model){if(this.controllerObject3D)return this.controllerObject3D.visible=!0,void this.el.setObject3D("mesh",this.controllerObject3D);if(this.displayModel=f[n.controllerType]||f[A],"auto"===n.controllerType){t=A;for(var i=Object.keys(f),r=0;r<e.profiles.length;r++)if(-1!==i.indexOf(e.profiles[r])){t=e.profiles[r];break}this.displayModel=f[t]}var s=this.displayModel[n.hand].modelUrl;this.isTouchV3orPROorPlus=this.displayModel===f["oculus-touch-v3"]||this.displayModel===f["meta-quest-touch-pro"]||this.displayModel===f["meta-quest-touch-plus"],this.el.setAttribute("gltf-model",s)}},injectTrackedControls:function(e){var t=this.data,n=c;this.el.setAttribute("tracked-controls",{id:n,hand:t.hand,handTrackingEnabled:!1,iterateControllerProfiles:!0}),this.loadModel(e)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t=this.mapping[this.data.hand].buttons[e.detail.id];if(t){if(this.isTouchV3orPROorPlus)this.onButtonChangedV3orPROorPlus(e);else{var n,i=this.buttonMeshes;"trigger"!==t&&"grip"!==t||(n=e.detail.state.value),i&&("trigger"===t&&i.trigger&&(i.trigger.rotation.x=this.originalXRotationTrigger-n*(Math.PI/26)),"grip"===t&&i.grip&&(n*="left"===this.data.hand?-1:1,i.grip.position.x=this.originalXPositionGrip+.004*n))}this.el.emit(t+"changed",e.detail.state)}},onButtonChangedV3orPROorPlus:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id],i=this.buttonObjects;i&&i[n]&&(t=e.detail.state.value,i[n].quaternion.slerpQuaternions(this.buttonRanges[n].min.quaternion,this.buttonRanges[n].max.quaternion,t),i[n].position.lerpVectors(this.buttonRanges[n].min.position,this.buttonRanges[n].max.position,t))},onModelLoaded:function(e){if(e.target===this.el&&this.data.model){if(this.isTouchV3orPROorPlus)this.onTouchV3orPROorPlusModelLoaded(e);else{var t,n=this.controllerObject3D=e.detail.model;(t=this.buttonMeshes={}).grip=n.getObjectByName("buttonHand"),this.originalXPositionGrip=t.grip&&t.grip.position.x,t.trigger=n.getObjectByName("buttonTrigger"),this.originalXRotationTrigger=t.trigger&&t.trigger.rotation.x,t.thumbstick=n.getObjectByName("stick"),t.xbutton=n.getObjectByName("buttonX"),t.abutton=n.getObjectByName("buttonA"),t.ybutton=n.getObjectByName("buttonY"),t.bbutton=n.getObjectByName("buttonB")}for(var i in this.buttonMeshes)this.buttonMeshes[i]&&g(this.buttonMeshes[i]);this.applyOffset(e.detail.model),this.el.emit("controllermodelready",{name:"meta-touch-controls",model:this.data.model,rayOrigin:this.displayModel[this.data.hand].rayOrigin})}},applyOffset:function(e){e.position.copy(this.displayModel[this.data.hand].modelPivotOffset),e.rotation.copy(this.displayModel[this.data.hand].modelPivotRotation)},onTouchV3orPROorPlusModelLoaded:function(e){var t=this.controllerObject3D=e.detail.model,n=this.buttonObjects={},i=this.buttonMeshes={},r=this.buttonRanges={};i.grip=t.getObjectByName("squeeze"),n.grip=t.getObjectByName("xr_standard_squeeze_pressed_value"),r.grip={min:t.getObjectByName("xr_standard_squeeze_pressed_min"),max:t.getObjectByName("xr_standard_squeeze_pressed_max")},n.grip.minX=n.grip.position.x,i.thumbstick=t.getObjectByName("thumbstick"),n.thumbstick=t.getObjectByName("xr_standard_thumbstick_pressed_value"),r.thumbstick={min:t.getObjectByName("xr_standard_thumbstick_pressed_min"),max:t.getObjectByName("xr_standard_thumbstick_pressed_max")},n.thumbstickXAxis=t.getObjectByName("xr_standard_thumbstick_xaxis_pressed_value"),r.thumbstickXAxis={min:t.getObjectByName("xr_standard_thumbstick_xaxis_pressed_min"),max:t.getObjectByName("xr_standard_thumbstick_xaxis_pressed_max")},n.thumbstickYAxis=t.getObjectByName("xr_standard_thumbstick_yaxis_pressed_value"),r.thumbstickYAxis={min:t.getObjectByName("xr_standard_thumbstick_yaxis_pressed_min"),max:t.getObjectByName("xr_standard_thumbstick_yaxis_pressed_max")},i.trigger=t.getObjectByName("trigger"),n.trigger=t.getObjectByName("xr_standard_trigger_pressed_value"),r.trigger={min:t.getObjectByName("xr_standard_trigger_pressed_min"),max:t.getObjectByName("xr_standard_trigger_pressed_max")},r.trigger.diff={x:Math.abs(r.trigger.max.rotation.x)-Math.abs(r.trigger.min.rotation.x),y:Math.abs(r.trigger.max.rotation.y)-Math.abs(r.trigger.min.rotation.y),z:Math.abs(r.trigger.max.rotation.z)-Math.abs(r.trigger.min.rotation.z)};var s="left"===this.data.hand?"x":"a",o="left"===this.data.hand?"y":"b",a=s+"button",l=o+"button";i[a]=t.getObjectByName(s+"_button"),n[a]=t.getObjectByName(s+"_button_pressed_value"),r[a]={min:t.getObjectByName(s+"_button_pressed_min"),max:t.getObjectByName(s+"_button_pressed_max")},i[l]=t.getObjectByName(o+"_button"),n[l]=t.getObjectByName(o+"_button_pressed_value"),r[l]={min:t.getObjectByName(o+"_button_pressed_min"),max:t.getObjectByName(o+"_button_pressed_max")}},onAxisMoved:function(e){a(this,this.mapping[this.data.hand].axes,e)},onThumbstickMoved:function(e){if(this.buttonMeshes&&this.buttonMeshes.thumbstick)if(this.isTouchV3orPROorPlus)this.updateThumbstickTouchV3orPROorPlus(e);else for(var t in e.detail)this.buttonObjects.thumbstick.rotation[this.axisMap[t]]=this.buttonRanges.thumbstick.originalRotation[this.axisMap[t]]-Math.PI/8*e.detail[t]*("y"===t||"right"===this.data.hand?-1:1)},axisMap:{y:"x",x:"z"},updateThumbstickTouchV3orPROorPlus:function(e){var t=(e.detail.x+1)/2;this.buttonObjects.thumbstickXAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickXAxis.min.quaternion,this.buttonRanges.thumbstickXAxis.max.quaternion,t);var n=(e.detail.y+1)/2;this.buttonObjects.thumbstickYAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickYAxis.min.quaternion,this.buttonRanges.thumbstickYAxis.max.quaternion,n)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n,i=this.buttonMeshes;i&&i[e]&&(n="up"===t||"touchend"===t?i[e].originalColor||this.data.buttonColor:"touchstart"===t?this.data.buttonTouchColor:this.data.buttonHighlightColor,i[e].material.color.set(n))}};function g(e){e.traverse((function(t){var n;"Mesh"===t.type&&(n=t.material.clone(),e.originalColor=t.material.color,t.material.dispose(),t.material=n)}))}i("oculus-touch-controls",m),e.exports.Component=i("meta-touch-controls",m)},3176:(e,t,n)=>{var i,r,s,o,a,l=n(8190).registerComponent,c=n(9437);l("obb-collider",{schema:{size:{default:0},trackedObject3D:{default:""},minimumColliderDimension:{default:.02},centerModel:{default:!1}},init:function(){this.previousScale=(new c.Vector3).copy(this.el.object3D.scale),this.auxEuler=new c.Euler,this.boundingBox=new c.Box3,this.boundingBoxSize=new c.Vector3,this.updateCollider=this.updateCollider.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.updateBoundingBox=this.updateBoundingBox.bind(this),this.el.addEventListener("model-loaded",this.onModelLoaded),this.updateCollider(),this.system.addCollider(this.el)},remove:function(){this.system.removeCollider(this.el)},update:function(){this.data.trackedObject3D&&(this.trackedObject3DPath=this.data.trackedObject3D.split("."))},onModelLoaded:function(){this.data.centerModel&&this.centerModel(),this.updateCollider()},centerModel:function(){var e,t=this.el,n=t.components["gltf-model"]&&t.components["gltf-model"].model;n&&(this.el.removeObject3D("mesh"),e=(new c.Box3).setFromObject(n).getCenter(new c.Vector3),n.position.x+=n.position.x-e.x,n.position.y+=n.position.y-e.y,n.position.z+=n.position.z-e.z,this.el.setObject3D("mesh",n))},updateCollider:function(){var e=this.el,t=this.boundingBoxSize,n=this.aabb=this.aabb||new c.OBB;this.obb=this.obb||new c.OBB,e.hasLoaded?(this.updateBoundingBox(),n.halfSize.copy(t).multiplyScalar(.5),this.el.sceneEl.systems["obb-collider"].data.showColliders&&this.showCollider()):e.addEventListener("loaded",this.updateCollider)},showCollider:function(){this.updateColliderMesh(),this.renderColliderMesh.visible=!0},updateColliderMesh:function(){var e=this.renderColliderMesh,t=this.boundingBoxSize;e?(e.geometry.dispose(),e.geometry=new c.BoxGeometry(t.x,t.y,t.z)):this.initColliderMesh()},hideCollider:function(){this.renderColliderMesh&&(this.renderColliderMesh.visible=!1)},initColliderMesh:function(){var e,t,n;e=this.boundingBoxSize,t=this.renderColliderGeometry=new c.BoxGeometry(e.x,e.y,e.z),(n=this.renderColliderMesh=new c.Mesh(t,new c.MeshLambertMaterial({color:65280,side:c.DoubleSide}))).matrixAutoUpdate=!1,n.matrixWorldAutoUpdate=!1,n.updateMatrixWorld=function(){},this.el.sceneEl.object3D.add(n)},updateBoundingBox:(i=new c.Vector3,r=new c.Vector3,s=new c.Quaternion,o=new c.Quaternion,a=new c.Matrix4,function(){var e=this.auxEuler,t=this.boundingBox,n=this.data.size,l=this.trackedObject3D||this.el.object3D,c=this.boundingBoxSize,h=this.data.minimumColliderDimension;if(n)return this.boundingBoxSize.x=n,this.boundingBoxSize.y=n,void(this.boundingBoxSize.z=n);e.copy(l.rotation),l.rotation.set(0,0,0),l.parent.matrixWorld.decompose(i,s,r),a.compose(i,o,r),l.parent.matrixWorld.copy(a),t.setFromObject(l,!0),t.getSize(c),c.x=c.x<h?h:c.x,c.y=c.y<h?h:c.y,c.z=c.z<h?h:c.z,l.parent.matrixWorld.compose(i,s,r),this.el.object3D.rotation.copy(e)}),checkTrackedObject:function(){var e,t=this.trackedObject3DPath;if(t&&t.length&&!this.trackedObject3D){e=this.el;for(var n=0;n<t.length&&(e=e[t[n]]);n++);e&&(this.trackedObject3D=e,this.updateCollider())}return this.trackedObject3D},tick:function(){var e=new c.Vector3,t=new c.Vector3,n=new c.Quaternion,i=new c.Matrix4;return function(){var r=this.obb,s=this.renderColliderMesh,o=this.checkTrackedObject()||this.el.object3D;o&&(o.updateMatrix(),o.updateMatrixWorld(!0),o.matrixWorld.decompose(e,n,t),(Math.abs(t.x-this.previousScale.x)>1e-4||Math.abs(t.y-this.previousScale.y)>1e-4||Math.abs(t.z-this.previousScale.z)>1e-4)&&this.updateCollider(),this.previousScale.copy(t),t.set(1,1,1),i.compose(e,n,t),s&&s.matrixWorld.copy(i),r.copy(this.aabb),r.applyMatrix4(i))}}()})},8771:(e,t,n)=>{var i=n(8940),r=n(8190).registerComponent,s=n(9437),o=i("components:obj-model:warn");e.exports.Component=r("obj-model",{schema:{mtl:{type:"model"},obj:{type:"model"}},init:function(){var e=this;this.model=null,this.objLoader=new s.OBJLoader,this.mtlLoader=new s.MTLLoader(this.objLoader.manager),this.mtlLoader.crossOrigin="",this.el.addEventListener("componentinitialized",(function(t){e.model&&"material"===t.detail.name&&e.applyMaterial()}))},update:function(){var e=this.data;e.obj&&(this.resetMesh(),this.loadObj(e.obj,e.mtl))},remove:function(){this.resetMesh()},resetMesh:function(){this.model&&this.el.removeObject3D("mesh")},loadObj:function(e,t){var n=this,i=this.el,r=this.mtlLoader,s=this.objLoader,a=this.el.sceneEl.systems.renderer,l=t.substr(0,t.lastIndexOf("/")+1);if(t)return i.hasAttribute("material")&&o("Material component properties are ignored when a .MTL is provided"),r.setResourcePath(l),void r.load(t,(function(t){t.preload(),s.setMaterials(t),s.load(e,(function(e){n.model=e,n.model.traverse((function(e){if(e.isMesh){var t=e.material;t.map&&a.applyColorCorrection(t.map),t.emissiveMap&&a.applyColorCorrection(t.emissiveMap)}})),i.setObject3D("mesh",e),i.emit("model-loaded",{format:"obj",model:e})}))}));s.load(e,(function(e){n.model=e,n.applyMaterial(),i.setObject3D("mesh",e),i.emit("model-loaded",{format:"obj",model:e})}))},applyMaterial:function(){var e=this.el.components.material;e&&this.model.traverse((function(t){t instanceof s.Mesh&&(t.material=e.material)}))}})},6077:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l=n(1343).AFRAME_CDN_ROOT+"controllers/oculus/go/oculus-go-controller.gltf",c="oculus-go";e.exports.Component=i("oculus-go-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#FFFFFF"},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad"]},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.bindMethods()},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){s(this,c,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{hand:t.hand,idPrefix:c}),this.data.model&&this.el.setAttribute("gltf-model",l)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(e){var t,n=e.detail.model;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).trigger=n.getObjectByName("oculus_go_button_trigger"),t.trackpad=n.getObjectByName("oculus_go_touchpad"),t.touchpad=n.getObjectByName("oculus_go_touchpad"))},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n=this.buttonMeshes;if(n&&n[e]){var i;switch(t){case"down":i=this.data.buttonHighlightColor;break;case"touchstart":i=this.data.buttonTouchedColor;break;default:i=this.data.buttonColor}n[e].material.color.set(i)}}})},2588:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="pico-4",h=n(1343).AFRAME_CDN_ROOT+"controllers/pico/pico4/";e.exports.Component=i("pico-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){l(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e,e.data.hand)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e,e.data.hand)},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;o(this,c,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:c,hand:t.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",h+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){e.target===this.el&&this.data.model&&this.el.emit("controllermodelready",{name:"pico-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)})},onAxisMoved:function(e){a(this,this.mapping[this.data.hand].axes,e)}})},7519:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("position",{schema:{type:"vec3"},update:function(){var e=this.el.object3D,t=this.data;e.position.set(t.x,t.y,t.z)},remove:function(){this.el.object3D.position.set(0,0,0)}})},7394:(e,t,n)=>{var i,r,s=n(8190).registerComponent,o=n(9437),a=n(7427).debug("components:raycaster:warn"),l=/^[\w\s-.,[\]#]*$/,c={childList:!0,attributes:!0,subtree:!0},h="raycaster-intersected-cleared",d="raycaster-intersection-cleared";function u(e,t){var n;for(e.length=t.length,n=0;n<t.length;n++)e[n]=t[n]}e.exports.Component=s("raycaster",{schema:{autoRefresh:{default:!0},direction:{type:"vec3",default:{x:0,y:0,z:-1}},enabled:{default:!0},far:{default:1e3},interval:{default:0},near:{default:0},objects:{default:""},origin:{type:"vec3"},showLine:{default:!1},lineColor:{default:"white"},lineOpacity:{default:1},useWorldCoordinates:{default:!1}},multiple:!0,init:function(){this.clearedIntersectedEls=[],this.unitLineEndVec3=new o.Vector3,this.intersectedEls=[],this.intersections=[],this.newIntersectedEls=[],this.newIntersections=[],this.objects=[],this.prevCheckTime=void 0,this.prevIntersectedEls=[],this.rawIntersections=[],this.raycaster=new o.Raycaster,this.updateOriginDirection(),this.setDirty=this.setDirty.bind(this),this.updateLine=this.updateLine.bind(this),this.observer=new MutationObserver(this.setDirty),this.dirty=!0,this.lineEndVec3=new o.Vector3,this.otherLineEndVec3=new o.Vector3,this.lineData={end:this.lineEndVec3},this.getIntersection=this.getIntersection.bind(this),this.intersectedDetail={el:this.el,getIntersection:this.getIntersection},this.intersectedClearedDetail={el:this.el},this.intersectionClearedDetail={clearedEls:this.clearedIntersectedEls},this.intersectionDetail={}},update:function(e){var t=this.data,n=this.el,i=this.raycaster;i.far=t.far,i.near=t.near,!t.showLine||t.far===e.far&&t.origin===e.origin&&t.direction===e.direction&&e.showLine||(this.unitLineEndVec3.copy(t.direction).normalize(),this.drawLine()),!t.showLine&&e.showLine&&n.removeAttribute("line"),t.objects===e.objects||l.test(t.objects)||a('[raycaster] Selector "'+t.objects+'" may not update automatically with DOM changes.'),t.objects||a('[raycaster] For performance, please define raycaster.objects when using raycaster or cursor components to whitelist which entities to intersect with. e.g., raycaster="objects: [data-raycastable]".'),t.autoRefresh!==e.autoRefresh&&n.isPlaying&&(t.autoRefresh?this.addEventListeners():this.removeEventListeners()),e.enabled&&!t.enabled&&this.clearAllIntersections(),t.objects!==e.objects&&this.setDirty()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){this.data.showLine&&this.el.removeAttribute("line"),this.clearAllIntersections()},addEventListeners:function(){this.data.autoRefresh&&(this.observer.observe(this.el.sceneEl,c),this.el.sceneEl.addEventListener("object3dset",this.setDirty),this.el.sceneEl.addEventListener("object3dremove",this.setDirty))},removeEventListeners:function(){this.observer.disconnect(),this.el.sceneEl.removeEventListener("object3dset",this.setDirty),this.el.sceneEl.removeEventListener("object3dremove",this.setDirty)},setDirty:function(){this.dirty=!0},refreshObjects:function(){var e,t=this.data;e=t.objects?this.el.sceneEl.querySelectorAll(t.objects):this.el.sceneEl.querySelectorAll("*"),this.objects=this.flattenObject3DMaps(e),this.dirty=!1},tock:function(e){var t=this.data,n=this.prevCheckTime;t.enabled&&(n&&e-n<t.interval||(this.prevCheckTime=e,this.checkIntersections()))},checkIntersections:function(){var e,t,n=this.clearedIntersectedEls,i=this.el,r=this.data,s=this.intersectedEls,o=this.intersections,a=this.newIntersectedEls,l=this.newIntersections,c=this.prevIntersectedEls,p=this.rawIntersections;for(this.dirty&&this.refreshObjects(),u(this.prevIntersectedEls,this.intersectedEls),this.updateOriginDirection(),p.length=0,this.raycaster.intersectObjects(this.objects,!0,p),o.length=0,s.length=0,e=0;e<p.length;e++)t=p[e],r.showLine&&t.object===i.getObject3D("line")||t.object.el&&(o.push(t),s.push(t.object.el));for(l.length=0,a.length=0,e=0;e<o.length;e++)-1===c.indexOf(o[e].object.el)&&(l.push(o[e]),a.push(o[e].object.el));for(n.length=0,e=0;e<c.length;e++)-1===s.indexOf(c[e])&&(c[e].emit(h,this.intersectedClearedDetail),n.push(c[e]));for(n.length&&i.emit(d,this.intersectionClearedDetail),e=0;e<a.length;e++)a[e].emit("raycaster-intersected",this.intersectedDetail);l.length&&(this.intersectionDetail.els=a,this.intersectionDetail.intersections=l,i.emit("raycaster-intersection",this.intersectionDetail)),(0===c.length&&o.length>0||c.length>0&&0===o.length||c.length&&o.length&&c[0]!==o[0].object.el)&&(this.intersectionDetail.els=this.intersectedEls,this.intersectionDetail.intersections=o,i.emit("raycaster-closest-entity-changed",this.intersectionDetail)),r.showLine&&setTimeout(this.updateLine)},updateLine:function(){var e,t=this.el,n=this.intersections;n.length&&(e=n[0].object.el===t&&n[1]?n[1].distance:n[0].distance),this.drawLine(e)},getIntersection:function(e){var t,n;for(t=0;t<this.intersections.length;t++)if((n=this.intersections[t]).object.el===e)return n;return null},updateOriginDirection:(i=new o.Vector3,r=new o.Vector3,function(){var e=this.el,t=this.data;t.useWorldCoordinates?this.raycaster.set(t.origin,t.direction):(e.object3D.updateMatrixWorld(),r.setFromMatrixPosition(e.object3D.matrixWorld),0===t.origin.x&&0===t.origin.y&&0===t.origin.z||(r=e.object3D.localToWorld(r.copy(t.origin))),i.copy(t.direction).transformDirection(e.object3D.matrixWorld).normalize(),this.raycaster.set(r,i))}),drawLine:function(e){var t,n=this.data,i=this.el;t=this.lineData.end===this.lineEndVec3?this.otherLineEndVec3:this.lineEndVec3,void 0===e&&(e=n.far===1/0?1e3:n.far),this.lineData.start=n.origin,this.lineData.end=t.copy(this.unitLineEndVec3).multiplyScalar(e).add(n.origin),this.lineData.color=n.lineColor,this.lineData.opacity=n.lineOpacity,i.setAttribute("line",this.lineData)},flattenObject3DMaps:function(e){var t,n,i=this.objects,r=this.el.sceneEl.object3D;function s(e){return e.parent?s(e.parent):e===r}for(i.length=0,n=0;n<e.length;n++){var o=e[n];if(o.isEntity&&o.object3D&&s(o.object3D))for(t in o.object3DMap)i.push(o.getObject3D(t))}return i},clearAllIntersections:function(){var e;for(e=0;e<this.intersectedEls.length;e++)this.intersectedEls[e].emit(h,this.intersectedClearedDetail);u(this.clearedIntersectedEls,this.intersectedEls),this.intersectedEls.length=0,this.intersections.length=0,this.el.emit(d,this.intersectionClearedDetail)}})},2310:(e,t,n)=>{var i=n(9437).MathUtils.degToRad,r=n(8190).registerComponent;e.exports.Component=r("rotation",{schema:{type:"vec3"},update:function(){var e=this.data;this.el.object3D.rotation.set(i(e.x),i(e.y),i(e.z),"YXZ")},remove:function(){this.el.object3D.rotation.set(0,0,0)}})},4760:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("scale",{schema:{type:"vec3",default:{x:1,y:1,z:1}},update:function(){var e=this.data;this.el.object3D.scale.set(e.x,e.y,e.z)},remove:function(){this.el.object3D.scale.set(1,1,1)}})},3575:(e,t,n)=>{var i,r,s,o=n(8190).registerComponent,a=n(9437),l=(i=new a.Quaternion,r=new a.Vector3,function(e,t,n){t.position.copy(e.transform.position),t.quaternion.copy(e.transform.orientation),r.copy(n),i.copy(e.transform.orientation),r.applyQuaternion(i),t.position.sub(r)});function c(e,t){this.renderer=e,this.xrHitTestSource=null,e.xr.addEventListener("sessionend",function(){this.xrHitTestSource=null}.bind(this)),e.xr.addEventListener("sessionstart",function(){this.sessionStart(t)}.bind(this)),this.renderer.xr.isPresenting&&this.sessionStart(t)}function h(e){console.warn(e.message),console.warn('Cannot requestHitTestSource Are you missing: webxr="optionalFeatures: hit-test;" from <a-scene>?')}l.tempFakePose={transform:{orientation:new a.Quaternion,position:new a.Vector3}},c.prototype.previousFrameAnchors=new Set,c.prototype.anchorToObject3D=new Map,c.prototype.sessionStart=function(e){this.session=this.renderer.xr.getSession(),"requestHitTestSource"in this.session?e.space?this.session.requestHitTestSource(e).then(function(e){this.xrHitTestSource=e}.bind(this)).catch(h):e.profile&&this.session.requestHitTestSourceForTransientInput(e).then(function(e){this.xrHitTestSource=e,this.transient=!0}.bind(this)).catch(h):h({message:"No requestHitTestSource on the session."})},c.prototype.anchorFromLastHitTestResult=function(e,t){var n=this.lastHitTest;if(n){var i={object3D:e,offset:t};Array.from(this.anchorToObject3D.entries()).forEach(function(t){var n=t[1].object3D,i=t[0];n===e&&(this.anchorToObject3D.delete(i),i.delete())}.bind(this)),n.createAnchor&&n.createAnchor().then(function(e){this.anchorToObject3D.set(e,i)}.bind(this)).catch((function(e){console.warn(e.message),console.warn('Cannot create anchor, are you missing: webxr="optionalFeatures: anchors;" from <a-scene>?')}))}},c.prototype.doHit=function(e){if(this.renderer.xr.isPresenting){var t,n,i=this.renderer.xr.getReferenceSpace(),r=e.getViewerPose(i);return this.xrHitTestSource&&r?this.transient?(t=e.getHitTestResultsForTransientInput(this.xrHitTestSource)).length>0&&(n=t[0].results).length>0&&(this.lastHitTest=n[0],n[0].getPose(i)):(t=e.getHitTestResults(this.xrHitTestSource)).length>0&&(this.lastHitTest=t[0],t[0].getPose(i)):void 0}},c.updateAnchorPoses=function(e,t){var n=e.trackedAnchors||c.prototype.previousFrameAnchors;c.prototype.previousFrameAnchors.forEach((function(e){n.has(e)||c.prototype.anchorToObject3D.delete(e)})),n.forEach((function(n){var i,r,s,o;try{if(i=e.getPose(n.anchorSpace,t)){if(!(r=c.prototype.anchorToObject3D.get(n)))return;s=r.offset,o=r.object3D,l(i,o,s)}}catch(e){console.error("while updating anchor poses:",e)}})),c.prototype.previousFrameAnchors=n},e.exports.Component=o("ar-hit-test",{schema:{target:{type:"selector"},enabled:{default:!0},src:{default:"data:image/webp;base64,UklGRkQHAABXRUJQVlA4WAoAAAAQAAAA/wEA/wEAQUxQSL0DAAARDzD/ERGCjrY9sYYFfgo6aa1kJ7K0w9Lo3AadLSVeFxevQwj5kuM8RfR/Atw/C0+ozB/oUBrloFZs6ElSW88j1KA4yExNWQaqRZquIDF0JYmlq0hAuUDTFu66tng3teW7pa3cQf1V1edvur54M/Slm6Wv3Gx9zw0MXlQLntcsBN6wkHjTQuYtC4W3LTw8mGRVG57TbAROtxHfZNhInGkjc5aNwtk2Hg6Mvki14k+NkZzCwQgCxalcAv3kddRTPI1DcUrXId1FLf1uHpzaQz4tquhZVLlKesbVpqKeTj0n0F5PpXDlFN9UqmhalL/ImuZFo6KmToWLoKlddMprqlS8cKovBvHo2kTiFV2LN4msaxKZl3QNiair8xYRdDWivIvXVXmbcMqJ51UebZuFXxZt6xd4laxtciqRtA3Cv0nU1t+kEUFbI8JvCa+tvkm3FDlO/W+OR99+kWEp/YYo+tYfTVnf/K8cE/F///3vv//993eeL+a+uvjawLcX3xjYvJotBFY3kVjTRGFtE+BU2AiMbiQyhpHMWEYeBozAH5qNBYRDB5KBCaTDBKKBAZTDBoKBDjwHAN5ABeCJBsAZcAAC0YHHxAYSMYBiYgGZWEA2MYFCbCCZGAAIANFEB+AnYgMQTDQAYSJ2AN5EBZAm4gDgTDgAeSIu4DGygTIRN1CMLOCZiACykQlg4jsAycgA8AO+BxCNdJyDkcbwRirDGXGnx8w+FDPrkM3MQ9JQZMYhiiwV/RDMtIM3U1/DmXHUo+IR2kSR2ToWkQ1NIn2qf2J8LCqJKiDUiSADHY3whirhdHgZ94HKaR97PhE+twEUJUFoAcgyTct8hfSxSkShASDKdMJ/ritKHwgyQ0sD4D/miCxU5SbhOOUDTnZpccCjYP/i0bZ/8bAgtVGEoGapWIQXyzKVKLwgNJFk2rtMIgoNRJlOZF7SNSSyUEeQmbxBFKEmtYjEe8S8zOZ1AkJVCmS88FJOtF40Ksg4oUaFiygk3C8qlTVNyl8UTevCUdAE2t14PfVqU1FPp57TopKeQZWromddTQp6QOfTOEQt/ZDuipZ11w/wOiqO8dRORcc6BQEkDQMClaHcn5wV9yLbxsNZNgpn2sicYSNxuo34Js1G4FQbnuNsOPa28PCWhcKbFjJvWEi8ZiHwqgXPcxbc5db33Cx95WboSzddX7yp+vyN0+eul7ZyN7Xlu64t3jVt4c5pc4JLV5EYupJE0xUknC4nOjVlmaYpyLit53HCQ0+ScnqceNcS5dzUkd0/CwMAVlA4IGADAAAQXwCdASoAAgACP8ne6Wy/tjCpqJ/IA/A5CWlu4XYBG/Pz8AfwD8APz//f3v8E1fuHZnxKYACtfuHZnxKYACrYTb5mOslhxu843ecbvON3nG7zjd3a0VCn7G1MABVxwH/Xd25gAK1+4dmfEpe2+PHhQaj75++riG6FuYACtfuHZnxKYACRrK3q9xO8Ss3uWKnMhs/rDF1hi6wxdYYusMXWGI5QRcCFDZog5OgqNlse1NDuz/UoFa/cOzPiUwAEsAOK4/nu5eZHK2tlXxJfNYlMABWv3Dsz4bvNJ5YA/LtxJ38SmAArX7h2Z8Sk5vdZUYv7mZPiUwAFa/cOzPh21s5OgZxf1mfEpemRyFr/rM+JS9noA/LtxJ38SmAAlUJIotzAASn6TjdhK+D3Dsz4dyvB7h2Z8O2tnJ0DOL+sz4lL2nKLT4lL/+iSLOocxq639w7M34MNZdm55uJ8v8ra2cpVZnxKTq2F3PN/cNksAfl24k7+JTAASqrD37h2Z7b1W+VtbOUqsz4lJ1bC7nm/uGyWAPy7cSd/EpgAJVVh79w7M9t6rfK2tnKVWZ8Sk6thdzzf3DZLAH5duJO/iUwAEqqw9+4dme29VvlbWzlKrM+JSdWwu55v7hslgD8u3EnfxKYACVVYe/cOzPbeq3ytrZylVme0kYJ8557FLerqFrzIbPrrf3DZLAH5duJO/iUvaVMS9BoaF4p7pSDFTP1XMyfElelrM0DOL+sz4eBJ13nV1OppBGPuKb4YzXQgq9uH19uS/0+JS9t9fr6ZUlQBelDG6GMgq97otb5QMPJwtKyBTbFp8Sl7b6/X0ykkawEOsgdiE6Fi0vb/Eve6xkwsmug0Z4nGNHQO8839bpTsjpz7SWIJxKagvd1QWMa6FYT1KEw3j4XDT6vJ9Xk+nyfT5Pq8n1eEmk5dinMM/9Fcfz4Z3Dsz3KD2dw7LxBRxKrqUUGQPH/7zxr1KIfNpLEJ0MZB2ITM/0Z2EFoh12NlXnEcpYcbvON3nG7zjd5xu84vfcNIAAP7+y8ceyzbVxkakPYY4lcr72fqOnDwipv+yxC71wAADBrjKnAAAAAAAAAAAAAAw7oNGHttqWONcoFN/2WIDc2pa6WVFtFYROlsaMaTXdcOjXHz93+YxAglKa4AAAAA=",type:"map"},type:{default:"footprint",oneOf:["footprint","map"]},footprintDepth:{default:.1},mapSize:{type:"vec2",default:{x:.5,y:.5}}},sceneOnly:!0,init:function(){this.hitTest=null,this.imageDataArray=new Uint8ClampedArray(1048576),this.imageData=new ImageData(this.imageDataArray,512,512),this.textureCache=new Map,this.orthoCam=new a.OrthographicCamera,this.orthoCam.layers.set(21),this.textureTarget=new a.WebGLRenderTarget(512,512,{}),this.basicMaterial=new a.MeshBasicMaterial({color:0,side:a.DoubleSide}),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.context.imageSmoothingEnabled=!1,this.canvas.width=512,this.canvas.height=512,this.canvasTexture=new a.CanvasTexture(this.canvas,{alpha:!0}),this.canvasTexture.flipY=!1;var e=this.el.getAttribute("webxr"),t=e.optionalFeatures;t.includes("hit-test")&&t.includes("anchors")||(t.push("hit-test"),t.push("anchors"),this.el.setAttribute("webxr",e)),this.el.sceneEl.renderer.xr.addEventListener("sessionend",function(){this.hitTest=null}.bind(this)),this.el.sceneEl.renderer.xr.addEventListener("sessionstart",function(){if(this.el.is("ar-mode")){var e=this.el.sceneEl.renderer,t=this.session=e.xr.getSession();this.hasPosedOnce=!1,this.bboxMesh.visible=!1,s||(s=new Map),t.requestReferenceSpace("viewer").then(function(t){this.viewerHitTest=this.hitTest=new c(e,{space:t}),this.el.emit("ar-hit-test-start")}.bind(this));var n=this;this.el.sceneEl.addEventListener("controllersupdated",(function(){var t=this.xrSession&&this.xrSession.inputSources;if(t)for(var i=0;i<t.length;++i)if("tracked-pointer"===t[i].targetRayMode){n.hitTest=new c(e,{space:t[i].targetRaySpace}),s.set(t[i],n.hitTest),n.viewerHitTest&&"function"==typeof n.viewerHitTest.cancel&&(n.viewerHitTest.cancel(),n.viewerHitTest=null);break}}));var i="generic-touchscreen",r=new c(e,{profile:i});t.addEventListener("selectstart",function(t){if(!0===this.data.enabled){var n=t.inputSource;this.bboxMesh.visible=!0,!0===this.hasPosedOnce&&(this.el.emit("ar-hit-test-select-start",{inputSource:n,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),n.profiles[0]===i?this.hitTest=r:(this.hitTest=s.get(n)||new c(e,{space:n.targetRaySpace}),s.set(n,this.hitTest)))}}.bind(this)),t.addEventListener("selectend",function(e){if(this.hitTest&&!0===this.data.enabled){var t,n=e.inputSource;!0===this.hasPosedOnce&&(this.bboxMesh.visible=!1,this.data.target&&(t=this.data.target.object3D)&&(l.tempFakePose.transform.position.copy(this.bboxMesh.position),l.tempFakePose.transform.orientation.copy(this.bboxMesh.quaternion),l(l.tempFakePose,t,this.bboxOffset),t.visible=!0,this.hitTest.anchorFromLastHitTestResult(t,this.bboxOffset)),this.el.emit("ar-hit-test-select",{inputSource:n,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),this.hitTest=null)}else this.hitTest=null}.bind(this))}}.bind(this)),this.bboxOffset=new a.Vector3,this.update=this.update.bind(this),this.makeBBox()},update:function(){!1===this.data.enabled&&(this.hitTest=null,this.bboxMesh.visible=!1),this.data.target&&(this.data.target.object3D?(this.data.target.addEventListener("model-loaded",this.update),this.data.target.object3D.layers.enable(21),this.data.target.object3D.traverse((function(e){e.layers.enable(21)}))):this.data.target.addEventListener("loaded",this.update,{once:!0})),this.bboxNeedsUpdate=!0},makeBBox:function(){var e=new a.PlaneGeometry(1,1),t=new a.MeshBasicMaterial({transparent:!0,color:16777215});e.rotateX(-Math.PI/2),e.rotateY(-Math.PI/2),this.bbox=new a.Box3,this.bboxMesh=new a.Mesh(e,t),this.el.setObject3D("ar-hit-test",this.bboxMesh),this.bboxMesh.visible=!1},updateFootprint:function(){var e,t,n,i=this.el.sceneEl.renderer,r=i.xr.enabled;this.bboxMesh.material.map=this.canvasTexture,this.bboxMesh.material.needsUpdate=!0,this.orthoCam.rotation.set(-Math.PI/2,0,-Math.PI/2),this.orthoCam.position.copy(this.bboxMesh.position),this.orthoCam.position.y-=this.bboxMesh.scale.y/2,this.orthoCam.near=.1,this.orthoCam.far=this.orthoCam.near+this.data.footprintDepth*this.bboxMesh.scale.y,this.orthoCam.position.y+=this.orthoCam.far,this.orthoCam.right=this.bboxMesh.scale.z/2,this.orthoCam.left=-this.bboxMesh.scale.z/2,this.orthoCam.top=this.bboxMesh.scale.x/2,this.orthoCam.bottom=-this.bboxMesh.scale.x/2,this.orthoCam.updateProjectionMatrix(),t=i.getRenderTarget(),i.setRenderTarget(this.textureTarget),i.xr.enabled=!1,n=this.el.object3D.background,this.el.object3D.overrideMaterial=this.basicMaterial,this.el.object3D.background=null,i.render(this.el.object3D,this.orthoCam),this.el.object3D.background=n,this.el.object3D.overrideMaterial=null,i.xr.enabled=r,i.setRenderTarget(t),i.readRenderTargetPixels(this.textureTarget,0,0,512,512,this.imageDataArray),this.context.putImageData(this.imageData,0,0),this.context.shadowColor="white",this.context.shadowBlur=10,this.context.drawImage(this.canvas,0,0),e=this.context.getImageData(0,0,512,512);for(var s=0;s<262144;s++)0!==e.data[4*s+3]&&255!==e.data[4*s+3]&&(e.data[4*s+3]=128);this.context.putImageData(e,0,0),this.canvasTexture.needsUpdate=!0},tick:function(){var e,t,n=this.el.sceneEl.frame,i=this.el.sceneEl.renderer;(n&&c.updateAnchorPoses(n,i.xr.getReferenceSpace()),this.bboxNeedsUpdate)&&(this.bboxNeedsUpdate=!1,this.data.target&&"map"!==this.data.type||(this.textureCache.has(this.data.src)?t=this.textureCache.get(this.data.src):(t=(new a.TextureLoader).load(this.data.src),this.textureCache.set(this.data.src,t)),this.bboxMesh.material.map=t,this.bboxMesh.material.needsUpdate=!0),this.data.target&&this.data.target.object3D?(this.bbox.setFromObject(this.data.target.object3D),this.bbox.getCenter(this.bboxMesh.position),this.bbox.getSize(this.bboxMesh.scale),"footprint"===this.data.type&&(this.bboxMesh.scale.x*=1.04,this.bboxMesh.scale.z*=1.04,this.updateFootprint()),this.bboxMesh.position.y-=this.bboxMesh.scale.y/2,this.bboxOffset.copy(this.bboxMesh.position),this.bboxOffset.sub(this.data.target.object3D.position)):this.bboxMesh.scale.set(this.data.mapSize.x,1,this.data.mapSize.y));this.hitTest&&(e=this.hitTest.doHit(n))&&(!0!==this.hasPosedOnce&&(this.hasPosedOnce=!0,this.el.emit("ar-hit-test-achieved")),this.bboxMesh.visible=!0,this.bboxMesh.position.copy(e.transform.position),this.bboxMesh.quaternion.copy(e.transform.orientation))}})},4005:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("background",{schema:{color:{type:"color",default:"black"},transparent:{default:!1}},sceneOnly:!0,update:function(){var e=this.data,t=this.el.object3D;e.transparent?t.background=null:t.background=new THREE.Color(e.color)},remove:function(){this.el.object3D.background=null}})},3494:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("debug",{schema:{default:!0},sceneOnly:!0})},6273:(e,t,n)=>{var i=n(8190).registerComponent,r=n(1343),s="a-dialog-buttons-container",o="a-dialog-button";function a(e,t){var n,i,s,o;return(n=document.createElement("div")).classList.add("a-modal"),n.setAttribute(r.AFRAME_INJECTED,""),(i=document.createElement("div")).className="a-dialog",i.setAttribute(r.AFRAME_INJECTED,""),n.appendChild(i),(s=document.createElement("div")).classList.add("a-dialog-text-container"),i.appendChild(s),(o=document.createElement("div")).classList.add("a-dialog-text"),o.innerHTML=e,s.appendChild(o),i.appendChild(t),n}e.exports.Component=i("device-orientation-permission-ui",{schema:{enabled:{default:!0},deviceMotionMessage:{default:"This immersive website requires access to your device motion sensors."},httpsMessage:{default:"Access this site over HTTPS to enter VR mode and grant access to the device sensors."},denyButtonText:{default:"Deny"},allowButtonText:{default:"Allow"},cancelButtonText:{default:"Cancel"}},sceneOnly:!0,init:function(){var e=this;this.data.enabled&&(window.isSecureContext||this.showHTTPAlert(),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission?(this.onDeviceMotionDialogAllowClicked=this.onDeviceMotionDialogAllowClicked.bind(this),this.onDeviceMotionDialogDenyClicked=this.onDeviceMotionDialogDenyClicked.bind(this),DeviceOrientationEvent.requestPermission().then((function(){e.el.emit("deviceorientationpermissiongranted"),e.permissionGranted=!0})).catch((function(){var t,n,i,l,c,h,d,u;e.devicePermissionDialogEl=(t=e.data.denyButtonText,n=e.data.allowButtonText,i=e.data.deviceMotionMessage,l=e.onDeviceMotionDialogAllowClicked,c=e.onDeviceMotionDialogDenyClicked,(h=document.createElement("div")).classList.add(s),(d=document.createElement("button")).classList.add(o,"a-dialog-deny-button"),d.setAttribute(r.AFRAME_INJECTED,""),d.innerHTML=t,h.appendChild(d),(u=document.createElement("button")).classList.add(o,"a-dialog-allow-button"),u.setAttribute(r.AFRAME_INJECTED,""),u.innerHTML=n,h.appendChild(u),u.addEventListener("click",(function(e){e.stopPropagation(),l()})),d.addEventListener("click",(function(e){e.stopPropagation(),c()})),a(i,h)),e.el.appendChild(e.devicePermissionDialogEl)}))):this.permissionGranted=!0)},remove:function(){this.devicePermissionDialogEl&&this.el.removeChild(this.devicePermissionDialogEl)},onDeviceMotionDialogDenyClicked:function(){this.remove()},showHTTPAlert:function(){var e,t,n,i,l,c=this,h=(e=c.data.cancelButtonText,t=c.data.httpsMessage,n=function(){c.el.removeChild(h)},(i=document.createElement("div")).classList.add(s),(l=document.createElement("button")).classList.add(o,"a-dialog-ok-button"),l.setAttribute(r.AFRAME_INJECTED,""),l.innerHTML=e,i.appendChild(l),l.addEventListener("click",(function(e){e.stopPropagation(),n()})),a(t,i));this.el.appendChild(h)},onDeviceMotionDialogAllowClicked:function(){var e=this;this.el.emit("deviceorientationpermissionrequested"),DeviceOrientationEvent.requestPermission().then((function(t){"granted"===t?(e.el.emit("deviceorientationpermissiongranted"),e.permissionGranted=!0):e.el.emit("deviceorientationpermissionrejected"),e.remove()})).catch(console.error)}})},3239:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("embedded",{dependencies:["xr-mode-ui"],schema:{default:!0},sceneOnly:!0,update:function(){var e=this.el,t=e.querySelector(".a-enter-vr");!0===this.data?(t&&t.classList.add("embedded"),e.removeFullScreenStyles()):(t&&t.classList.remove("embedded"),e.addFullScreenStyles())}})},6149:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437);n(8940)("components:fog:warn"),e.exports.Component=i("fog",{schema:{color:{type:"color",default:"#000"},density:{default:25e-5},far:{default:1e3,min:0},near:{default:1,min:0},type:{default:"linear",oneOf:["linear","exponential"]}},sceneOnly:!0,update:function(){var e=this.data,t=this.el,n=this.el.object3D.fog;n&&e.type===n.name?Object.keys(this.schema).forEach((function(t){var i=e[t];"color"===t&&(i=new r.Color(i)),n[t]=i})):t.object3D.fog=function(e){var t;return(t="exponential"===e.type?new r.FogExp2(e.color,e.density):new r.Fog(e.color,e.near,e.far)).name=e.type,t}(e)},remove:function(){var e=this.el;this.el.object3D.fog&&(e.object3D.fog=null)}})},2288:(e,t,n)=>{var i,r=n(1343).AFRAME_INJECTED,s=n(8330),o=n(8190).registerComponent,a=n(7427),l="https://unpkg.com/aframe-inspector@"+((i=s.version.split("."))[2]="x",i.join(".")+"/dist/aframe-inspector.min.js");e.exports.Component=o("inspector",{schema:{url:{default:l}},sceneOnly:!0,init:function(){this.firstPlay=!0,this.onKeydown=this.onKeydown.bind(this),this.onMessage=this.onMessage.bind(this),this.initOverlay(),window.addEventListener("keydown",this.onKeydown),window.addEventListener("message",this.onMessage)},play:function(){var e;this.firstPlay&&"false"!==(e=a.getUrlParameter("inspector"))&&e&&(this.openInspector(),this.firstPlay=!1)},initOverlay:function(){this.loadingMessageEl=document.createElement("div"),this.loadingMessageEl.classList.add("a-inspector-loader"),this.loadingMessageEl.innerHTML='Loading Inspector<span class="dots"><span>.</span><span>.</span><span>.</span></span>'},remove:function(){this.removeEventListeners()},onKeydown:function(e){73===e.keyCode&&(e.ctrlKey&&e.altKey||e.getModifierState("AltGraph"))&&this.openInspector()},showLoader:function(){document.body.appendChild(this.loadingMessageEl)},hideLoader:function(){document.body.removeChild(this.loadingMessageEl)},onMessage:function(e){"INJECT_AFRAME_INSPECTOR"===e.data&&this.openInspector()},openInspector:function(e){var t,n=this;AFRAME.INSPECTOR||AFRAME.inspectorInjected?AFRAME.INSPECTOR.open(e):(this.showLoader(),(t=document.createElement("script")).src=this.data.url,t.setAttribute("data-name","aframe-inspector"),t.setAttribute(r,""),t.onload=function(){AFRAME.INSPECTOR.open(e),n.hideLoader(),n.removeEventListeners()},t.onerror=function(){n.loadingMessageEl.innerHTML="Error loading Inspector"},document.head.appendChild(t),AFRAME.inspectorInjected=!0)},removeEventListeners:function(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("message",this.onMessage)}})},2130:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7427).shouldCaptureKeyEvent;e.exports.Component=i("keyboard-shortcuts",{schema:{enterVR:{default:!0},exitVR:{default:!0}},sceneOnly:!0,init:function(){this.onKeyup=this.onKeyup.bind(this)},play:function(){window.addEventListener("keyup",this.onKeyup,!1)},pause:function(){window.removeEventListener("keyup",this.onKeyup)},onKeyup:function(e){var t=this.el;r(e)&&(this.data.enterVR&&70===e.keyCode&&t.enterVR(),this.data.exitVR&&27===e.keyCode&&t.exitVR())}})},3791:(e,t,n)=>{var i=n(8940),r=n(8190).registerComponent,s=i("components:pool:warn");e.exports.Component=r("pool",{schema:{container:{default:""},mixin:{default:""},size:{default:0},dynamic:{default:!1}},sceneOnly:!0,multiple:!0,initPool:function(){var e;for(this.availableEls=[],this.usedEls=[],this.data.mixin||s("No mixin provided for pool component."),this.data.container&&(this.container=document.querySelector(this.data.container),this.container||s("Container "+this.data.container+" not found.")),this.container=this.container||this.el,e=0;e<this.data.size;++e)this.createEntity()},update:function(e){var t=this.data;e.mixin===t.mixin&&e.size===t.size||this.initPool()},createEntity:function(){var e;(e=document.createElement("a-entity")).play=this.wrapPlay(e.play),e.setAttribute("mixin",this.data.mixin),e.object3D.visible=!1,e.pause(),this.container.appendChild(e),this.availableEls.push(e);var t=this.usedEls;e.addEventListener("loaded",(function(){-1===t.indexOf(e)&&(e.object3DParent=e.object3D.parent,e.object3D.parent.remove(e.object3D))}))},wrapPlay:function(e){var t=this.usedEls;return function(){-1!==t.indexOf(this)&&e.call(this)}},requestEntity:function(){var e;if(0===this.availableEls.length){if(!1===this.data.dynamic)return void s("Requested entity from empty pool: "+this.attrName);s("Requested entity from empty pool. This pool is dynamic and will resize automatically. You might want to increase its initial size: "+this.attrName),this.createEntity()}return e=this.availableEls.shift(),this.usedEls.push(e),e.object3DParent&&(e.object3DParent.add(e.object3D),this.updateRaycasters()),e.object3D.visible=!0,e},returnEntity:function(e){var t=this.usedEls.indexOf(e);if(-1!==t)return this.usedEls.splice(t,1),this.availableEls.push(e),e.object3DParent=e.object3D.parent,e.object3D.parent.remove(e.object3D),this.updateRaycasters(),e.object3D.visible=!1,e.pause(),e;s("The returned entity was not previously pooled from "+this.attrName)},updateRaycasters:function(){document.querySelectorAll("[raycaster]").forEach((function(e){e.components.raycaster.setDirty()}))}})},2662:(e,t,n)=>{var i,r=n(8190).registerComponent,s=n(9437);e.exports.Component=r("real-world-meshing",{schema:{filterLabels:{type:"array"},meshesEnabled:{default:!0},meshMixin:{default:!0},planesEnabled:{default:!0},planeMixin:{default:""}},sceneOnly:!0,init:function(){var e=this.el.getAttribute("webxr"),t=e.requiredFeatures;-1===t.indexOf("mesh-detection")&&(t.push("mesh-detection"),this.el.setAttribute("webxr",e)),-1===t.indexOf("plane-detection")&&(t.push("plane-detection"),this.el.setAttribute("webxr",e)),this.meshEntities=[],this.initWorldMeshEntity=this.initWorldMeshEntity.bind(this)},tick:function(){this.el.is("ar-mode")&&(this.detectMeshes(),this.updateMeshes())},detectMeshes:function(){var e,t,n,i=this.data,r=this.el,s=(r.renderer.xr,this.meshEntities),o=!1,a=[],l=this.data.filterLabels;e=(n=r.frame).detectedMeshes,t=n.detectedPlanes;for(var c=0;c<s.length;c++)s[c].present=!1;if(i.meshesEnabled)for(var h of e.values())if(!l.length||-1!==l.indexOf(h.semanticLabel)){for(c=0;c<s.length;c++)if(h===s[c].mesh){o=!0,s[c].present=!0,s[c].lastChangedTime<h.lastChangedTime&&this.updateMeshGeometry(s[c].el,h),s[c].lastChangedTime=h.lastChangedTime;break}o||a.push(h),o=!1}if(i.planesEnabled)for(h of t.values())if(!l.length||-1!==l.indexOf(h.semanticLabel)){for(c=0;c<s.length;c++)if(h===s[c].mesh){o=!0,s[c].present=!0,s[c].lastChangedTime<h.lastChangedTime&&this.updateMeshGeometry(s[c].el,h),s[c].lastChangedTime=h.lastChangedTime;break}o||a.push(h),o=!1}this.deleteMeshes(),this.createNewMeshes(a)},updateMeshes:(i=new s.Matrix4,function(){for(var e,t,n,r=this.el,s=r.frame,o=this.meshEntities,a=r.renderer.xr.getReferenceSpace(),l=0;l<o.length;l++)n=o[l].mesh.meshSpace||o[l].mesh.planeSpace,e=s.getPose(n,a),(t=o[l].el).hasLoaded&&(i.fromArray(e.transform.matrix),i.decompose(t.object3D.position,t.object3D.quaternion,t.object3D.scale))}),deleteMeshes:function(){for(var e=this.meshEntities,t=[],n=0;n<e.length;n++)e[n].present?t.push(e[n]):this.el.removeChild(e[n]);this.meshEntities=t},createNewMeshes:function(e){for(var t,n=0;n<e.length;n++)t=document.createElement("a-entity"),this.meshEntities.push({mesh:e[n],el:t}),t.addEventListener("loaded",this.initWorldMeshEntity),this.el.appendChild(t)},initMeshGeometry:function(e){var t,n,i;if(e instanceof XRPlane){n=new s.Shape,i=e.polygon;for(var r=0;r<i.length;++r)0===r?n.moveTo(i[r].x,i[r].z):n.lineTo(i[r].x,i[r].z);return(t=new s.ShapeGeometry(n)).rotateX(Math.PI/2),t}return(t=new s.BufferGeometry).setAttribute("position",new s.BufferAttribute(e.vertices,3)),t.setIndex(new s.BufferAttribute(e.indices,1)),t},initWorldMeshEntity:function(e){for(var t,n,i,r=e.target,o=this.meshEntities,a=0;a<o.length;a++)if(o[a].el===r){i=o[a];break}t=this.initMeshGeometry(i.mesh),n=new s.Mesh(t,new s.MeshBasicMaterial({color:16777215*Math.random(),side:s.DoubleSide})),r.setObject3D("mesh",n),i.mesh instanceof XRPlane&&this.data.planeMixin?r.setAttribute("mixin",this.data.planeMixin):this.data.meshMixin&&r.setAttribute("mixin",this.data.meshMixin),r.setAttribute("data-world-mesh",i.mesh.semanticLabel)},updateMeshGeometry:function(e,t){var n=e.getObject3D("mesh");n.geometry.dispose(),n.geometry=this.initMeshGeometry(t)}})},952:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("reflection",{schema:{directionalLight:{type:"selector"}},sceneOnly:!0,init:function(){var e=this;this.cubeRenderTarget=new THREE.WebGLCubeRenderTarget(16),this.cubeCamera=new THREE.CubeCamera(.1,1e3,this.cubeRenderTarget),this.lightingEstimationTexture=new THREE.WebGLCubeRenderTarget(16).texture,this.needsVREnvironmentUpdate=!0;var t=this.el.getAttribute("webxr"),n=t.optionalFeatures;n.includes("light-estimation")||(n.push("light-estimation"),this.el.setAttribute("webxr",t)),this.el.addEventListener("enter-vr",(function(){e.el.is("ar-mode")&&e.el.renderer.xr.getSession().requestLightProbe&&e.startLightProbe()})),this.el.addEventListener("exit-vr",(function(){e.xrLightProbe&&e.stopLightProbe()})),this.el.object3D.environment=this.cubeRenderTarget.texture},stopLightProbe:function(){this.xrLightProbe=null,this.probeLight&&(this.probeLight.components.light.light.intensity=0),this.needsVREnvironmentUpdate=!0,this.el.object3D.environment=this.cubeRenderTarget.texture},startLightProbe:function(){this.needsLightProbeUpdate=!0},setupLightProbe:function(){var e=this.el.renderer,t=e.xr.getSession(),n=this,i=e.getContext();if(!this.probeLight){var r=document.createElement("a-light");r.setAttribute("type","probe"),r.setAttribute("intensity",0),this.el.appendChild(r),this.probeLight=r}switch(t.preferredReflectionFormat){case"srgba8":i.getExtension("EXT_sRGB");break;case"rgba16f":i.getExtension("OES_texture_half_float")}this.glBinding=new XRWebGLBinding(t,i),i.getExtension("EXT_sRGB"),i.getExtension("OES_texture_half_float"),t.requestLightProbe().then((function(e){n.xrLightProbe=e,e.addEventListener("reflectionchange",n.updateXRCubeMap.bind(n))})).catch((function(e){console.warn("Lighting estimation not supported: "+e.message),console.warn('Are you missing: webxr="optionalFeatures: light-estimation;" from <a-scene>?')}))},updateXRCubeMap:function(){var e=this.el.renderer,t=this.glBinding.getReflectionCubeMap(this.xrLightProbe);t&&(e.properties.get(this.lightingEstimationTexture).__webglTexture=t,this.lightingEstimationTexture.needsPMREMUpdate=!0,this.el.object3D.environment=this.lightingEstimationTexture)},tick:function(){var e=this.el.object3D,t=this.el.renderer,n=this.el.frame;if(n&&this.xrLightProbe){var i=n.getLightEstimate(this.xrLightProbe);i&&function(e,t,n,i){var r=Math.max(e.primaryLightIntensity.x,Math.max(e.primaryLightIntensity.y,e.primaryLightIntensity.z));t.sh.fromArray(e.sphericalHarmonicsCoefficients),t.intensity=3.14,n&&(n.color.setRGB(e.primaryLightIntensity.x/r,e.primaryLightIntensity.y/r,e.primaryLightIntensity.z/r),n.intensity=r,i.copy(e.primaryLightDirection))}(i,this.probeLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.object3D.position)}this.needsVREnvironmentUpdate&&(e.environment=null,this.needsVREnvironmentUpdate=!1,this.cubeCamera.position.set(0,1.6,0),this.cubeCamera.update(t,e),e.environment=this.cubeRenderTarget.texture),this.needsLightProbeUpdate&&n&&(this.setupLightProbe(),this.needsLightProbeUpdate=!1)},remove:function(){this.el.object3D.environment=null,this.probeLight&&this.el.removeChild(this.probeLight)}})},1217:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=["attribute vec3 position;","attribute vec2 uv;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","varying vec2 vUv;","void main() {"," vUv = vec2( 1.- uv.x, uv.y );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),o=["precision mediump float;","uniform samplerCube map;","varying vec2 vUv;","#define M_PI 3.141592653589793238462643383279","void main() {"," vec2 uv = vUv;"," float longitude = uv.x * 2. * M_PI - M_PI + M_PI / 2.;"," float latitude = uv.y * M_PI;"," vec3 dir = vec3("," - sin( longitude ) * sin( latitude ),"," cos( latitude ),"," - cos( longitude ) * sin( latitude )"," );"," normalize( dir );"," gl_FragColor = vec4( textureCube( map, dir ).rgb, 1.0 );","}"].join("\n");e.exports.Component=i("screenshot",{schema:{width:{default:4096},height:{default:2048},camera:{type:"selector"}},sceneOnly:!0,setup:function(){var e=this.el;if(!this.canvas){var t=e.renderer.getContext();t&&(this.cubeMapSize=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),this.material=new r.RawShaderMaterial({uniforms:{map:{type:"t",value:null}},vertexShader:s,fragmentShader:o,side:r.DoubleSide}),this.quad=new r.Mesh(new r.PlaneGeometry(1,1),this.material),this.quad.visible=!1,this.camera=new r.OrthographicCamera(-.5,.5,.5,-.5,-1e4,1e4),this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),e.object3D.add(this.quad),this.onKeyDown=this.onKeyDown.bind(this))}},getRenderTarget:function(e,t){return new r.WebGLRenderTarget(e,t,{colorSpace:this.el.sceneEl.renderer.outputColorSpace,minFilter:r.LinearFilter,magFilter:r.LinearFilter,wrapS:r.ClampToEdgeWrapping,wrapT:r.ClampToEdgeWrapping,format:r.RGBAFormat,type:r.UnsignedByteType})},resize:function(e,t){this.quad.scale.set(e,t,1),this.camera.left=-1*e/2,this.camera.right=e/2,this.camera.top=t/2,this.camera.bottom=-1*t/2,this.camera.updateProjectionMatrix(),this.canvas.width=e,this.canvas.height=t},play:function(){window.addEventListener("keydown",this.onKeyDown)},onKeyDown:function(e){var t=83===e.keyCode&&e.ctrlKey&&e.altKey;if(this.data&&t){var n=e.shiftKey?"equirectangular":"perspective";this.capture(n)}},setCapture:function(e){var t,n,i,s,o=this.el;return"perspective"===e?(this.quad.visible=!1,n=this.data.camera&&this.data.camera.components.camera.camera||o.camera,t={width:this.data.width,height:this.data.height}):(n=this.camera,s=new r.WebGLCubeRenderTarget(Math.min(this.cubeMapSize,2048),{format:r.RGBFormat,generateMipmaps:!0,minFilter:r.LinearMipmapLinearFilter,colorSpace:r.SRGBColorSpace}),i=new r.CubeCamera(o.camera.near,o.camera.far,s),o.camera.getWorldPosition(i.position),o.camera.getWorldQuaternion(i.quaternion),i.update(o.renderer,o.object3D),this.quad.material.uniforms.map.value=i.renderTarget.texture,t={width:this.data.width,height:this.data.height},this.quad.visible=!0),{camera:n,size:t,projection:e}},capture:function(e){var t,n=this.el.renderer.xr.enabled,i=this.el.renderer;this.setup(),i.xr.enabled=!1,t=this.setCapture(e),this.renderCapture(t.camera,t.size,t.projection),this.saveCapture(),i.xr.enabled=n},getCanvas:function(e){var t=this.el.renderer.xr.enabled,n=this.el.renderer;this.setup();var i=this.setCapture(e);return n.xr.enabled=!1,this.renderCapture(i.camera,i.size,i.projection),n.xr.enabled=t,this.canvas},renderCapture:function(e,t,n){var i,r,s,o=this.el.renderer.autoClear,a=this.el,l=a.renderer;r=this.getRenderTarget(t.width,t.height),s=new Uint8Array(4*t.width*t.height),this.resize(t.width,t.height),l.autoClear=!0,l.clear(),l.setRenderTarget(r),l.render(a.object3D,e),l.autoClear=o,l.readRenderTargetPixels(r,0,0,t.width,t.height,s),l.setRenderTarget(null),"perspective"===n&&(s=this.flipPixelsVertically(s,t.width,t.height)),i=new ImageData(new Uint8ClampedArray(s),t.width,t.height),this.quad.visible=!1,this.ctx.putImageData(i,0,0)},flipPixelsVertically:function(e,t,n){for(var i=e.slice(0),r=0;r<t;++r)for(var s=0;s<n;++s)i[4*r+s*t*4]=e[4*r+(n-s)*t*4],i[4*r+1+s*t*4]=e[4*r+1+(n-s)*t*4],i[4*r+2+s*t*4]=e[4*r+2+(n-s)*t*4],i[4*r+3+s*t*4]=e[4*r+3+(n-s)*t*4];return i},saveCapture:function(){this.canvas.toBlob((function(e){var t="screenshot-"+document.title.toLowerCase()+"-"+Date.now()+".png",n=document.createElement("a"),i=URL.createObjectURL(e);n.href=i,n.setAttribute("download",t),n.innerHTML="downloading...",n.style.display="none",document.body.appendChild(n),setTimeout((function(){n.click(),document.body.removeChild(n)}),1)}),"image/png")}})},8346:(e,t,n)=>{var i=n(8190).registerComponent,r=n(282),s=n(7427);n(3729),n(8132);var o=window.aframeStats,a="a-hidden",l=window.threeStats;e.exports.Component=i("stats",{schema:{default:!0},sceneOnly:!0,init:function(){var e=this.el;"false"!==s.getUrlParameter("stats")&&(this.stats=function(e){var t=new l(e.renderer),n=new o(e),i=e.isMobile?[]:[t,n];return new r({css:[],values:{fps:{caption:"fps",below:30}},groups:[{caption:"Framerate",values:["fps","raf"]}],plugins:i})}(e),this.statsEl=document.querySelector(".rs-base"),this.hideBound=this.hide.bind(this),this.showBound=this.show.bind(this),e.addEventListener("enter-vr",this.hideBound),e.addEventListener("exit-vr",this.showBound))},update:function(){if(this.stats)return this.data?this.show():this.hide()},remove:function(){this.el.removeEventListener("enter-vr",this.hideBound),this.el.removeEventListener("exit-vr",this.showBound),this.statsEl&&this.statsEl.parentNode.removeChild(this.statsEl)},tick:function(){var e=this.stats;e&&(e("rAF").tick(),e("FPS").frame(),e().update())},hide:function(){this.statsEl.classList.add(a)},show:function(){this.statsEl.classList.remove(a)}})},6469:(e,t,n)=>{var i=n(8190).registerComponent,r=n(1343),s=n(7427),o="a-hidden";function a(e){e.addEventListener("touchstart",(function(){e.classList.remove("resethover")}),{passive:!0}),e.addEventListener("touchend",(function(){e.classList.add("resethover")}),{passive:!0})}e.exports.Component=i("xr-mode-ui",{dependencies:["canvas"],schema:{enabled:{default:!0},cardboardModeEnabled:{default:!1},enterVRButton:{default:""},enterVREnabled:{default:!0},enterARButton:{default:""},enterAREnabled:{default:!0},XRMode:{default:"vr",oneOf:["vr","ar","xr"]}},sceneOnly:!0,init:function(){var e=this,t=this.el;"false"!==s.getUrlParameter("ui")&&(this.insideLoader=!1,this.enterVREl=null,this.enterAREl=null,this.orientationModalEl=null,this.bindMethods(),t.addEventListener("enter-vr",this.updateEnterInterfaces),t.addEventListener("exit-vr",this.updateEnterInterfaces),t.addEventListener("update-vr-devices",this.updateEnterInterfaces),window.addEventListener("message",(function(t){"loaderReady"===t.data.type&&(e.insideLoader=!0,e.remove())})),window.addEventListener("orientationchange",this.toggleOrientationModalIfNeeded))},bindMethods:function(){this.onEnterVRButtonClick=this.onEnterVRButtonClick.bind(this),this.onEnterARButtonClick=this.onEnterARButtonClick.bind(this),this.onModalClick=this.onModalClick.bind(this),this.toggleOrientationModalIfNeeded=this.toggleOrientationModalIfNeeded.bind(this),this.updateEnterInterfaces=this.updateEnterInterfaces.bind(this)},onModalClick:function(){this.el.exitVR()},onEnterVRButtonClick:function(){this.el.enterVR()},onEnterARButtonClick:function(){this.el.enterAR()},update:function(){var e,t,n,i=this.data,l=this.el;if(!i.enabled||this.insideLoader||"false"===s.getUrlParameter("ui"))return this.remove();this.enterVREl||this.enterAREl||this.orientationModalEl||(this.enterVREl||!i.enterVREnabled||"xr"!==i.XRMode&&"vr"!==i.XRMode||(i.enterVRButton?(this.enterVREl=document.querySelector(i.enterVRButton),this.enterVREl.addEventListener("click",this.onEnterVRButtonClick)):(this.enterVREl=(e=this.onEnterVRButtonClick,(n=document.createElement("div")).classList.add("a-enter-vr"),n.setAttribute(r.AFRAME_INJECTED,""),(t=document.createElement("button")).className="a-enter-vr-button",t.setAttribute("title","Enter VR mode with a headset or fullscreen without"),t.setAttribute(r.AFRAME_INJECTED,""),s.device.isMobile()&&a(t),n.appendChild(t),t.addEventListener("click",(function(t){e(),t.stopPropagation()})),n),l.appendChild(this.enterVREl))),this.enterAREl||!i.enterAREnabled||"xr"!==i.XRMode&&"ar"!==i.XRMode||(i.enterARButton?(this.enterAREl=document.querySelector(i.enterARButton),this.enterAREl.addEventListener("click",this.onEnterARButtonClick)):(this.enterAREl=function(e,t){var n,i;return(i=document.createElement("div")).classList.add("a-enter-ar"),t&&i.classList.add("xr"),i.setAttribute(r.AFRAME_INJECTED,""),(n=document.createElement("button")).className="a-enter-ar-button",n.setAttribute("title","Enter AR mode with a headset or handheld device."),n.setAttribute(r.AFRAME_INJECTED,""),s.device.isMobile()&&a(n),i.appendChild(n),n.addEventListener("click",(function(t){e(),t.stopPropagation()})),i}(this.onEnterARButtonClick,"xr"===i.XRMode),l.appendChild(this.enterAREl))),this.orientationModalEl=function(e){var t=document.createElement("div");t.className="a-orientation-modal",t.classList.add(o),t.setAttribute(r.AFRAME_INJECTED,"");var n=document.createElement("button");return n.setAttribute(r.AFRAME_INJECTED,""),n.innerHTML="Exit VR",n.addEventListener("click",e),t.appendChild(n),t}(this.onModalClick),l.appendChild(this.orientationModalEl),this.updateEnterInterfaces())},remove:function(){[this.enterVREl,this.enterAREl,this.orientationModalEl].forEach((function(e){e&&e.parentNode&&e.parentNode.removeChild(e)})),this.enterVREl=void 0,this.enterAREl=void 0,this.orientationModalEl=void 0},updateEnterInterfaces:function(){this.toggleEnterVRButtonIfNeeded(),this.toggleEnterARButtonIfNeeded(),this.toggleOrientationModalIfNeeded()},toggleEnterVRButtonIfNeeded:function(){var e=this.el;this.enterVREl&&(e.is("vr-mode")||(e.isMobile||s.device.isMobileDeviceRequestingDesktopSite())&&!this.data.cardboardModeEnabled&&!s.device.checkVRSupport()?this.enterVREl.classList.add(o):(s.device.checkVRSupport()||this.enterVREl.classList.add("fullscreen"),this.enterVREl.classList.remove(o),e.enterVR(!1,!0)))},toggleEnterARButtonIfNeeded:function(){var e=this.el;this.enterAREl&&(e.is("vr-mode")||!s.device.checkARSupport()?this.enterAREl.classList.add(o):(this.enterAREl.classList.remove(o),e.enterVR(!0,!0)))},toggleOrientationModalIfNeeded:function(){var e=this.el,t=this.orientationModalEl;t&&e.isMobile&&(!s.device.isLandscape()&&e.is("vr-mode")?t.classList.remove(o):t.classList.add(o))}})},1072:(e,t,n)=>{var i=n(8190),r=n(9437),s=i.registerComponent;e.exports.Component=s("shadow",{schema:{cast:{default:!0},receive:{default:!0}},init:function(){this.onMeshChanged=this.update.bind(this),this.el.addEventListener("object3dset",this.onMeshChanged),this.system.setShadowMapEnabled(!0)},update:function(){var e=this.data;this.updateDescendants(e.cast,e.receive)},remove:function(){this.el.removeEventListener("object3dset",this.onMeshChanged),this.updateDescendants(!1,!1)},updateDescendants:function(e,t){var n=this.el.sceneEl;this.el.object3D.traverse((function(i){if(i instanceof r.Mesh&&(i.castShadow=e,i.receiveShadow=t,n.hasLoaded&&i.material))for(var s=Array.isArray(i.material)?i.material:[i.material],o=0;o<s.length;o++)s[o].needsUpdate=!0}))}})},477:(e,t,n)=>{var i=n(8190).registerComponent,r=n(8940),s=n(9437),o=r("components:sound:warn");e.exports.Component=i("sound",{schema:{autoplay:{default:!1},distanceModel:{default:"inverse",oneOf:["linear","inverse","exponential"]},loop:{default:!1},loopStart:{default:0},loopEnd:{default:0},maxDistance:{default:1e4},on:{default:""},poolSize:{default:1},positional:{default:!0},refDistance:{default:1},rolloffFactor:{default:1},src:{type:"audio"},volume:{default:1}},multiple:!0,init:function(){var e=this;this.listener=null,this.audioLoader=new s.AudioLoader,this.pool=new s.Group,this.loaded=!1,this.mustPlay=!1,this.playSoundBound=function(){e.playSound()}},update:function(e){var t,n,i=this.data,r=i.src!==e.src;if(r){if(!i.src)return;this.setupSound()}for(t=0;t<this.pool.children.length;t++)n=this.pool.children[t],i.positional&&(n.setDistanceModel(i.distanceModel),n.setMaxDistance(i.maxDistance),n.setRefDistance(i.refDistance),n.setRolloffFactor(i.rolloffFactor)),n.setLoop(i.loop),n.setLoopStart(i.loopStart),0!==i.loopStart&&0===i.loopEnd?n.setLoopEnd(n.buffer.duration):n.setLoopEnd(i.loopEnd),n.setVolume(i.volume),n.isPaused=!1;if(i.on!==e.on&&this.updateEventListener(e.on),r){var o=this;this.loaded=!1,this.audioLoader.load(i.src,(function(e){for(t=0;t<o.pool.children.length;t++)(n=o.pool.children[t]).setBuffer(e);o.loaded=!0,s.Cache.remove(i.src),(o.data.autoplay||o.mustPlay)&&o.playSound(o.processSound),o.el.emit("sound-loaded",o.evtDetail,!1)}))}},pause:function(){this.stopSound(),this.removeEventListener()},play:function(){this.data.autoplay&&this.playSound(),this.updateEventListener()},remove:function(){var e;this.removeEventListener(),this.el.getObject3D(this.attrName)&&this.el.removeObject3D(this.attrName);try{for(e=0;e<this.pool.children.length;e++)this.pool.children[e].disconnect()}catch(e){o("Audio source not properly disconnected")}},updateEventListener:function(e){var t=this.el;e&&t.removeEventListener(e,this.playSoundBound),t.addEventListener(this.data.on,this.playSoundBound)},removeEventListener:function(){this.el.removeEventListener(this.data.on,this.playSoundBound)},setupSound:function(){var e,t,n=this.el,i=n.sceneEl,r=this;this.pool.children.length>0&&(this.stopSound(),n.removeObject3D("sound"));var o=this.listener=i.audioListener||new s.AudioListener;for(i.audioListener=o,i.camera&&i.camera.add(o),i.addEventListener("camera-set-active",(function(e){e.detail.cameraEl.getObject3D("camera").add(o)})),this.pool=new s.Group,e=0;e<this.data.poolSize;e++)t=this.data.positional?new s.PositionalAudio(o):new s.Audio(o),this.pool.add(t);for(n.setObject3D(this.attrName,this.pool),e=0;e<this.pool.children.length;e++)(t=this.pool.children[e]).onEnded=function(){this.isPlaying=!1,r.el.emit("sound-ended",r.evtDetail,!1)}},pauseSound:function(){var e,t;for(this.isPlaying=!1,e=0;e<this.pool.children.length;e++)(t=this.pool.children[e]).source&&t.source.buffer&&t.isPlaying&&!t.isPaused&&(t.isPaused=!0,t.pause())},playSound:function(e){var t,n,i;if(!this.loaded)return o("Sound not loaded yet. It will be played once it finished loading"),this.mustPlay=!0,void(this.processSound=e);for(t=!1,this.isPlaying=!0,n=0;n<this.pool.children.length;n++)(i=this.pool.children[n]).isPlaying||!i.buffer||t||(e&&e(i),i.play(),i.isPaused=!1,t=!0);t?(this.mustPlay=!1,this.processSound=void 0):o("All the sounds are playing. If you need to play more sounds simultaneously consider increasing the size of pool with the `poolSize` attribute.",this.el)},stopSound:function(){var e,t;for(this.isPlaying=!1,e=0;e<this.pool.children.length;e++){if(!(t=this.pool.children[e]).source||!t.source.buffer)return;t.stop()}}})},1603:(e,t,n)=>{var i=n(4433),r=n(5751),s=n(8190).registerComponent,o=n(5892),a=n(9437),l=n(7427),c=l.debug("components:text:error"),h=o.shaders,d=l.debug("components:text:warn"),u=n(1343).AFRAME_CDN_ROOT+"fonts/",p={aileronsemibold:u+"Aileron-Semibold.fnt",dejavu:u+"DejaVu-sdf.fnt",exo2bold:u+"Exo2Bold.fnt",exo2semibold:u+"Exo2SemiBold.fnt",kelsonsans:u+"KelsonSans.fnt",monoid:u+"Monoid.fnt",mozillavr:u+"mozillavr.fnt",roboto:u+"Roboto-msdf.json",sourcecodepro:u+"SourceCodePro.fnt"},A=["roboto"],f="roboto";e.exports.FONTS=p;var m,g,v,y,E=new function(){var e=this.cache={};this.get=function(t,n){return t in e||(e[t]=n()),e[t]}},x={},b={},C=/^\w+:/;function w(e,t,n){return e||(.5+t)*n}e.exports.Component=s("text",{multiple:!0,schema:{align:{type:"string",default:"left",oneOf:["left","right","center"]},alphaTest:{default:.5},anchor:{default:"center",oneOf:["left","right","center","align"]},baseline:{default:"center",oneOf:["top","center","bottom"]},color:{type:"color",default:"#FFF"},font:{type:"string",default:f},fontImage:{type:"string"},height:{type:"number"},letterSpacing:{type:"number",default:0},lineHeight:{type:"number"},negate:{type:"boolean",default:!0},opacity:{type:"number",default:1},shader:{default:"sdf",oneOf:h},side:{default:"front",oneOf:["front","back","double"]},tabSize:{default:4},transparent:{default:!0},value:{type:"string"},whiteSpace:{default:"normal",oneOf:["normal","pre","nowrap"]},width:{type:"number"},wrapCount:{type:"number",default:40},wrapPixels:{type:"number"},xOffset:{type:"number",default:0},yOffset:{type:"number",default:0},zOffset:{type:"number",default:.001}},init:function(){this.shaderData={},this.geometry=i(),this.createOrUpdateMaterial(),this.explicitGeoDimensionsChecked=!1},update:function(e){var t=this.data,n=this.currentFont;b[t.font]?this.texture=b[t.font]:(this.texture=b[t.font]=new a.Texture,this.texture.anisotropy=16),this.createOrUpdateMaterial(),e.font===t.font?n&&(this.updateGeometry(this.geometry,n),this.updateLayout()):this.updateFont()},remove:function(){this.geometry.dispose(),this.geometry=null,this.el.removeObject3D(this.attrName),this.material.dispose(),this.material=null,this.texture.dispose(),this.texture=null,this.shaderObject&&delete this.shaderObject},createOrUpdateMaterial:function(){var e,t,n,i=this.data,r=this.material,s=this.shaderData;if(n=i.shader,-1!==A.indexOf(i.font)||i.font.indexOf("-msdf.")>=0?n="msdf":i.font in p&&-1===A.indexOf(i.font)&&(n="sdf"),e=(this.shaderObject&&this.shaderObject.name)!==n,s.alphaTest=i.alphaTest,s.color=i.color,s.map=this.texture,s.opacity=i.opacity,s.side=function(e){switch(e){case"back":return a.FrontSide;case"double":return a.DoubleSide;default:return a.BackSide}}(i.side),s.transparent=i.transparent,s.negate=i.negate,!e)return this.shaderObject.update(s),r.transparent=s.transparent,void(r.side=s.side);t=function(e,t,n){var i,r;return(r=new h[t].Shader).el=e,r.init(n),r.update(n),(i=r.material).transparent=n.transparent,{material:i,shader:r}}(this.el,n,s),this.material=t.material,this.shaderObject=t.shader,this.material.side=s.side,this.mesh&&(this.mesh.material=this.material)},updateFont:function(){var e,t=this.data,n=this.el,i=this.geometry,s=this;t.font||d("No font specified. Using the default font."),this.mesh&&(this.mesh.visible=!1),e=this.lookupFont(t.font||f)||t.font,E.get(e,(function(){return n=e,i=t.yOffset,new Promise((function(e,t){r(n,(function(r,s){if(r)return c("Error loading font",n),void t(r);n.indexOf("/Roboto-msdf.json")>=0&&(i=30),i&&s.chars.map((function(e){e.yoffset+=i})),e(s)}))}));var n,i})).then((function(r){var o;if(1!==r.pages.length)throw new Error("Currently only single-page bitmap fonts are supported.");x[e]||(r.widthFactor=x[r]=function(e){var t=0,n=0,i=0;return e.chars.map((function(e){t+=e.xadvance,e.id>=48&&e.id<=57&&(i++,n+=e.xadvance)})),i?n/i:t/e.chars.length}(r)),s.currentFont=r,o=s.getFontImageSrc(),E.get(o,(function(){return e=o,new Promise((function(t,n){(new a.ImageLoader).load(e,(function(e){t(e)}),void 0,(function(){c("Error loading font image",e),n(null)}))}));var e})).then((function(e){var o=s.texture;o&&(o.image=e,o.needsUpdate=!0,b[t.font]=o,s.texture=o,s.initMesh(),s.currentFont=r,s.updateGeometry(i,r),s.updateLayout(),s.mesh.visible=!0,n.emit("textfontset",{font:t.font,fontObj:r}))})).catch((function(e){c(e.message),c(e.stack)}))})).catch((function(e){c(e.message),c(e.stack)}))},initMesh:function(){this.mesh||(this.mesh=new a.Mesh(this.geometry,this.material),this.el.setObject3D(this.attrName,this.mesh))},getFontImageSrc:function(){if(this.data.fontImage)return this.data.fontImage;var e=this.lookupFont(this.data.font||f)||this.data.font,t=this.currentFont.pages[0];return t.match(C)&&0!==t.indexOf("http")?e.replace(/(\.fnt)|(\.json)/,".png"):a.LoaderUtils.extractUrlBase(e)+t},updateLayout:function(){var e,t,n,i,r,s,o,a,l,c=this.el,h=this.data,d=this.geometry,u=this.mesh;if(u&&d.layout){if(n=c.getAttribute("geometry"),i=(s=(o=h.width||n&&n.width||1)/w(h.wrapPixels,h.wrapCount,this.currentFont.widthFactor))*((r=d.layout).height+r.descender),n&&"plane"===n.primitive&&(this.explicitGeoDimensionsChecked||(this.explicitGeoDimensionsChecked=!0,this.hasExplicitGeoWidth=!!n.width,this.hasExplicitGeoHeight=!!n.height),this.hasExplicitGeoWidth||c.setAttribute("geometry","width",o),this.hasExplicitGeoHeight||c.setAttribute("geometry","height",i)),"left"===(e="align"===h.anchor?h.align:h.anchor))a=0;else if("right"===e)a=-1*r.width;else{if("center"!==e)throw new TypeError("Invalid text.anchor property value",e);a=-1*r.width/2}if("bottom"===(t=h.baseline))l=0;else if("top"===t)l=-1*r.height+r.ascender;else{if("center"!==t)throw new TypeError("Invalid text.baseline property value",t);l=-1*r.height/2}u.position.x=a*s+h.xOffset,u.position.y=l*s,u.position.z=h.zOffset,u.scale.set(s,-1*s,s)}},lookupFont:function(e){return p[e]},updateGeometry:(m={},g={},v=/\\n/g,y=/\\t/g,function(e,t){var n=this.data;g.font=t,g.lineHeight=n.lineHeight&&isFinite(n.lineHeight)?n.lineHeight:t.common.lineHeight,g.text=n.value.toString().replace(v,"\n").replace(y,"\t"),g.width=w(n.wrapPixels,n.wrapCount,t.widthFactor),e.update(l.extend(m,n,g))})})},6547:(e,t,n)=>{var i=n(7960),r=n(8190).registerComponent;e.exports.Component=r("tracked-controls",{schema:{id:{type:"string",default:""},controller:{default:-1},autoHide:{default:!0},hand:{type:"string",default:""},handTrackingEnabled:{default:!1},iterateControllerProfiles:{default:!1}},init:function(){this.buttonEventDetails={},this.buttonStates=this.el.components["tracked-controls"].buttonStates={},this.axis=this.el.components["tracked-controls"].axis=[0,0,0],this.changedAxes=[],this.axisMoveEventDetail={axis:this.axis,changed:this.changedAxes},this.updateController=this.updateController.bind(this)},update:function(){this.updateController()},play:function(){var e=this.el.sceneEl;this.updateController(),e.addEventListener("controllersupdated",this.updateController)},pause:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.updateController)},isControllerPresent:function(e){return!(!this.controller||this.controller.gamepad||"none"!==e.inputSource.handedness&&e.inputSource.handedness!==this.data.hand)},updateController:function(){this.controller=i.findMatchingControllerWebXR(this.system.controllers,this.data.id,this.data.hand,this.data.controller,this.data.iterateControllerProfiles,this.data.handTrackingEnabled),this.el.components["tracked-controls"].controller=this.controller},tick:function(){var e=this.el.sceneEl,t=this.controller,n=e.frame;this.data.autoHide&&(this.el.object3D.visible=!!t),t&&e.frame&&this.system.referenceSpace&&(t.hand||(this.pose=n.getPose(t.gripSpace,this.system.referenceSpace),this.updatePose(),this.updateButtons()))},updatePose:function(){var e=this.el.object3D,t=this.pose;t&&(e.matrix.elements=t.transform.matrix,e.matrix.decompose(e.position,e.rotation,e.scale))},updateButtons:function(){var e,t,n,i=this.controller;if(i&&i.gamepad){for(n=i.gamepad,t=0;t<n.buttons.length;++t)this.buttonStates[t]||(this.buttonStates[t]={pressed:!1,touched:!1,value:0}),this.buttonEventDetails[t]||(this.buttonEventDetails[t]={id:t,state:this.buttonStates[t]}),e=n.buttons[t],this.handleButton(t,e);this.handleAxes()}},handleButton:function(e,t){return!!(this.handlePress(e,t)|this.handleTouch(e,t)|this.handleValue(e,t))&&(this.el.emit("buttonchanged",this.buttonEventDetails[e],!1),!0)},handleAxes:function(){var e,t=!1,n=this.controller.gamepad.axes,i=this.axis,r=this.changedAxes;for(this.changedAxes.splice(0,this.changedAxes.length),e=0;e<n.length;++e)r.push(i[e]!==n[e]),r[e]&&(t=!0);if(!t)return!1;for(this.axis.splice(0,this.axis.length),e=0;e<n.length;e++)this.axis.push(n[e]);return this.el.emit("axismove",this.axisMoveEventDetail,!1),!0},handlePress:function(e,t){var n,i=this.buttonStates[e];return t.pressed!==i.pressed&&(n=t.pressed?"buttondown":"buttonup",this.el.emit(n,this.buttonEventDetails[e],!1),i.pressed=t.pressed,!0)},handleTouch:function(e,t){var n,i=this.buttonStates[e];return t.touched!==i.touched&&(n=t.touched?"touchstart":"touchend",this.el.emit(n,this.buttonEventDetails[e],!1),i.touched=t.touched,!0)},handleValue:function(e,t){var n=this.buttonStates[e];return t.value!==n.value&&(n.value=t.value,!0)}})},7360:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c=n(1343).AFRAME_CDN_ROOT+"controllers/valve/index/valve-index-",h={left:c+"left.glb",right:c+"right.glb"},d="valve",u={left:{x:0,y:-.05,z:.06},right:{x:0,y:-.05,z:.06}},p={left:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"},right:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"}};e.exports.Component=i("valve-index-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{trackpad:[0,1],thumbstick:[2,3]},buttons:["trigger","grip","trackpad","thumbstick","abutton"]},init:function(){var e=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.bindMethods()},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data,t="right"===e.hand?0:"left"===e.hand?1:2;o(this,d,{index:t,iterateControllerProfiles:!0,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:d,controller:"right"===t.hand?1:"left"===t.hand?0:2,hand:t.hand}),this.loadModel()},loadModel:function(){var e=this.data;e.model&&this.el.setAttribute("gltf-model",""+h[e.hand])},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(t=e.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=this.triggerOriginalRotationX-t*(Math.PI/40))),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t,n=e.detail.model,i=this;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},t.menu=n.getObjectByName("menubutton"),t.system=n.getObjectByName("systembutton"),t.trackpad=n.getObjectByName("touchpad"),t.trigger=n.getObjectByName("trigger"),this.triggerOriginalRotationX=t.trigger.rotation.x,Object.keys(t).forEach((function(e){i.setButtonColor(e,i.data.buttonColor)})),n.position.copy(p[this.data.hand]),n.rotation.copy(u[this.data.hand]),this.el.emit("controllermodelready",{name:"valve-index-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)}))},onAxisMoved:function(e){a(this,this.mapping.axes,e)},updateModel:function(e,t){var n;this.data.model&&(-1!==t.indexOf("touch")||(n="up"===t?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(e,n)))},setButtonColor:function(e,t){}})},5300:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("visible",{schema:{default:!0},update:function(){this.el.object3D.visible=this.data}})},1507:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l=n(1343).AFRAME_CDN_ROOT,c=l+"controllers/vive/vr_controller_vive.obj",h=l+"controllers/vive/vr_controller_vive.mtl",d="htc-vive";e.exports.Component=i("vive-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","none"]},init:function(){var e=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;s(this,d,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:d,hand:t.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("obj-model",{obj:c,mtl:h})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(t=e.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=-t*(Math.PI/12))),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t,n=e.detail.model,i=this;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},t.menu=n.getObjectByName("menubutton"),t.system=n.getObjectByName("systembutton"),t.trackpad=n.getObjectByName("touchpad"),t.touchpad=n.getObjectByName("touchpad"),t.trigger=n.getObjectByName("trigger"),Object.keys(t).forEach((function(e){i.setButtonColor(e,i.data.buttonColor)})),n.position.set(0,-.015,.04))},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){var n;this.data.model&&(-1!==t.indexOf("touch")||(n="up"===t?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(e,n)))},setButtonColor:function(e,t){var n=this.buttonMeshes;if(n)return"grip"===e?(n.grip.left.material.color.set(t),void n.grip.right.material.color.set(t)):void n[e].material.color.set(t)}})},4592:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l=n(1343).AFRAME_CDN_ROOT+"controllers/vive/focus-controller/focus-controller.gltf",c="htc-vive-focus";e.exports.Component=i("vive-focus-controls",{schema:{hand:{default:""},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad","none","menu"]},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.bindMethods()},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0,this.addControllersUpdateListener()},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1,this.removeControllersUpdateListener()},checkIfControllerPresent:function(){s(this,c,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el;this.data,e.setAttribute("tracked-controls",{idPrefix:c}),this.data.model&&this.el.setAttribute("gltf-model",l)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(e){var t,n=e.detail.model;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).trigger=n.getObjectByName("BumperKey"),t.triggerPressed=n.getObjectByName("BumperKey_Press"),t.triggerPressed&&(t.triggerPressed.visible=!1),t.touchpad=n.getObjectByName("TouchPad"),t.touchpadPressed=n.getObjectByName("TouchPad_Press"),t.trackpad=n.getObjectByName("TouchPad"),t.trackpadPressed=n.getObjectByName("TouchPad_Press"),t.trackpadPressed&&(t.trackpadPressed.visible=!1))},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n=this.buttonMeshes,i=e+"Pressed";if(n&&n[e]&&n[i]){var r;switch(t){case"down":r=this.data.buttonHighlightColor;break;case"touchstart":r=this.data.buttonTouchedColor}r&&n[i].material.color.set(r),n[i].visible=!!r,n[e].visible=!r}}})},6458:(e,t,n)=>{var i,r,s=n(1343).keyboardevent.KEYCODE_TO_CODE,o=n(8190).registerComponent,a=n(9437),l=n(7427).shouldCaptureKeyEvent,c=1e-5,h=["KeyW","KeyA","KeyS","KeyD","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"];e.exports.Component=o("wasd-controls",{schema:{acceleration:{default:65},adAxis:{default:"x",oneOf:["x","y","z"]},adEnabled:{default:!0},adInverted:{default:!1},enabled:{default:!0},fly:{default:!1},wsAxis:{default:"z",oneOf:["x","y","z"]},wsEnabled:{default:!0},wsInverted:{default:!1}},after:["look-controls"],init:function(){this.keys={},this.easing=1.1,this.velocity=new a.Vector3,this.onBlur=this.onBlur.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.onFocus=this.onFocus.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.attachVisibilityEventListeners()},tick:function(e,t){var n=this.data,i=this.el,r=this.velocity;(r[n.adAxis]||r[n.wsAxis]||!function(e){var t;for(t in e)return!1;return!0}(this.keys))&&(t/=1e3,this.updateVelocity(t),(r[n.adAxis]||r[n.wsAxis])&&i.object3D.position.add(this.getMovementVector(t)))},update:function(e){e.adAxis!==this.data.adAxis&&(this.velocity[e.adAxis]=0),e.wsAxis!==this.data.wsAxis&&(this.velocity[e.wsAxis]=0)},remove:function(){this.removeKeyEventListeners(),this.removeVisibilityEventListeners()},play:function(){this.attachKeyEventListeners()},pause:function(){this.keys={},this.removeKeyEventListeners()},updateVelocity:function(e){var t,n,i,r,s,o=this.data,a=this.keys,l=this.velocity;if(n=o.adAxis,r=o.wsAxis,e>.2)return l[n]=0,void(l[r]=0);var h=Math.pow(1/this.easing,60*e);0!==l[n]&&(l[n]=l[n]*h),0!==l[r]&&(l[r]=l[r]*h),Math.abs(l[n])<c&&(l[n]=0),Math.abs(l[r])<c&&(l[r]=0),o.enabled&&(t=o.acceleration,o.adEnabled&&(i=o.adInverted?-1:1,(a.KeyA||a.ArrowLeft)&&(l[n]-=i*t*e),(a.KeyD||a.ArrowRight)&&(l[n]+=i*t*e)),o.wsEnabled&&(s=o.wsInverted?-1:1,(a.KeyW||a.ArrowUp)&&(l[r]-=s*t*e),(a.KeyS||a.ArrowDown)&&(l[r]+=s*t*e)))},getMovementVector:(i=new a.Vector3(0,0,0),r=new a.Euler(0,0,0,"YXZ"),function(e){var t,n=this.el.getAttribute("rotation"),s=this.velocity;return i.copy(s),i.multiplyScalar(e),n?(t=this.data.fly?n.x:0,r.set(a.MathUtils.degToRad(t),a.MathUtils.degToRad(n.y),0),i.applyEuler(r),i):i}),attachVisibilityEventListeners:function(){window.oncontextmenu=this.onContextMenu,window.addEventListener("blur",this.onBlur),window.addEventListener("focus",this.onFocus),document.addEventListener("visibilitychange",this.onVisibilityChange)},removeVisibilityEventListeners:function(){window.removeEventListener("blur",this.onBlur),window.removeEventListener("focus",this.onFocus),document.removeEventListener("visibilitychange",this.onVisibilityChange)},attachKeyEventListeners:function(){window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp)},removeKeyEventListeners:function(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp)},onContextMenu:function(){for(var e=Object.keys(this.keys),t=0;t<e.length;t++)delete this.keys[e[t]]},onBlur:function(){this.pause()},onFocus:function(){this.play()},onVisibilityChange:function(){document.hidden?this.onBlur():this.onFocus()},onKeyDown:function(e){var t;l(e)&&(t=e.code||s[e.keyCode],-1!==h.indexOf(t)&&(this.keys[t]=!0))},onKeyUp:function(e){var t;t=e.code||s[e.keyCode],delete this.keys[t]}})},221:(e,t,n)=>{var i,r=n(8190).registerComponent,s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c=n(7427),h=c.debug("components:windows-motion-controls:debug"),d=c.debug("components:windows-motion-controls:warn"),u=n(1343).DEFAULT_HANDEDNESS,p=n(1343).AFRAME_CDN_ROOT+"controllers/microsoft/",A={left:"left.glb",right:"right.glb",default:"universal.glb"},f="windows-mixed-reality";e.exports.Component=r("windows-motion-controls",{schema:{hand:{default:u},pair:{default:0},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick","menu"],axisMeshNames:["TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_X","THUMBSTICK_X","THUMBSTICK_Y"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",squeeze:"GRASP",thumbstick:"THUMBSTICK_PRESS",touchpad:"TOUCHPAD_PRESS"},pointingPoseMeshName:"POINTING_POSE"},bindMethods:function(){this.onModelError=this.onModelError.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this,t=this.el;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.onControllerConnected=function(){e.setModelVisibility(!0)},this.onControllerDisconnected=function(){e.setModelVisibility(!1)},this.controllerPresent=!1,this.previousButtonValues={},this.bindMethods(),this.loadedMeshInfo={buttonMeshes:null,axisMeshes:null},this.rayOrigin={origin:new THREE.Vector3,direction:new THREE.Vector3(0,0,-1),createdFromMesh:!1},t.addEventListener("controllerconnected",this.onControllerConnected),t.addEventListener("controllerdisconnected",this.onControllerDisconnected)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-error",this.onModelError),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-error",this.onModelError),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){o(this,f,{hand:this.data.hand,index:this.data.pair,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},updateControllerModel:function(){if(this.data.model&&!this.rayOrigin.createdFromMesh){var e=this.createControllerModelUrl();this.loadModel(e)}else this.modelReady()},createControllerModelUrl:function(e){var t=this.data.hand;return p+"default/"+(A[t]||A.default)},injectTrackedControls:function(){var e=this.data;this.el.setAttribute("tracked-controls",{idPrefix:f,controller:e.pair,hand:e.hand}),this.updateControllerModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelError:function(e){var t=this.createControllerModelUrl(!0);e.detail.src!==t?(d("Failed to load controller model for device, attempting to load default."),this.loadModel(t)):d("Failed to load default controller model.")},loadModel:function(e){this.el.setAttribute("gltf-model","url("+e+")")},onModelLoaded:function(e){var t,n,i,r,s=this.controllerModel=e.detail.model,o=this.loadedMeshInfo;if(e.target===this.el){if(h("Processing model"),o.buttonMeshes={},o.axisMeshes={},s){for(t=0;t<this.mapping.buttons.length;t++)(n=this.mapping.buttonMeshNames[this.mapping.buttons[t]])?(i=s.getObjectByName(n))?(r={index:t,value:a(i,"VALUE"),pressed:a(i,"PRESSED"),unpressed:a(i,"UNPRESSED")}).value&&r.pressed&&r.unpressed?o.buttonMeshes[this.mapping.buttons[t]]=r:d("Missing button submesh under mesh with name: "+n+"(VALUE: "+!!r.value+", PRESSED: "+!!r.pressed+", UNPRESSED:"+!!r.unpressed+")"):d("Missing button mesh with name: "+n):h("Skipping unknown button at index: "+t+" with mapped name: "+this.mapping.buttons[t]);for(t=0;t<this.mapping.axisMeshNames.length;t++)(n=this.mapping.axisMeshNames[t])?(i=s.getObjectByName(n))?(r={index:t,value:a(i,"VALUE"),min:a(i,"MIN"),max:a(i,"MAX")}).value&&r.min&&r.max?o.axisMeshes[t]=r:d("Missing axis submesh under mesh with name: "+n+"(VALUE: "+!!r.value+", MIN: "+!!r.min+", MAX:"+!!r.max+")"):d("Missing axis mesh with name: "+n):h("Skipping unknown axis at index: "+t);this.calculateRayOriginFromMesh(s),this.setModelVisibility()}h("Model load complete.")}function a(e,t){for(var n=0,i=e.children.length;n<i;n++){var r=e.children[n];if(r&&r.name===t)return r}}},calculateRayOriginFromMesh:(i=new THREE.Quaternion,function(e){var t;if(this.rayOrigin.origin.set(0,0,0),this.rayOrigin.direction.set(0,0,-1),this.rayOrigin.createdFromMesh=!0,t=e.getObjectByName(this.mapping.pointingPoseMeshName)){var n=e.parent;n&&(e.parent=null,e.updateMatrixWorld(!0),e.parent=n),t.getWorldPosition(this.rayOrigin.origin),t.getWorldQuaternion(i),this.rayOrigin.direction.applyQuaternion(i),n&&e.updateMatrixWorld(!0)}else h("Mesh does not contain pointing origin data, defaulting to none.");this.modelReady()}),lerpAxisTransform:function(){var e=new THREE.Quaternion;return function(t,n){var i=this.loadedMeshInfo.axisMeshes[t];if(i){var r=i.min,s=i.max,o=i.value,a=.5*n+.5;o.setRotationFromQuaternion(e.copy(r.quaternion).slerp(s.quaternion,a)),o.position.lerpVectors(r.position,s.position,a)}}}(),lerpButtonTransform:function(){var e=new THREE.Quaternion;return function(t,n){var i=this.loadedMeshInfo.buttonMeshes[t];if(i){var r=i.unpressed,s=i.pressed,o=i.value;o.setRotationFromQuaternion(e.copy(r.quaternion).slerp(s.quaternion,n)),o.position.lerpVectors(r.position,s.position,n)}}}(),modelReady:function(){this.el.emit("controllermodelready",{name:"windows-motion-controls",model:this.data.model,rayOrigin:this.rayOrigin})},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&(this.loadedMeshInfo&&this.loadedMeshInfo.buttonMeshes&&this.lerpButtonTransform(t,e.detail.state.value),this.el.emit(t+"changed",e.detail.state))},onAxisMoved:function(e){var t=this.mapping.axisMeshNames.length;if(this.loadedMeshInfo&&this.loadedMeshInfo.axisMeshes)for(var n=0;n<t;n++)this.lerpAxisTransform(n,e.detail.axis[n]||0);a(this,this.mapping.axes,e)},setModelVisibility:function(e){var t=this.el.getObject3D("mesh");this.controllerPresent&&(e=void 0!==e?e:this.modelVisible,this.modelVisible=e,t&&(t.visible=e))}})},1343:(e,t,n)=>{e.exports={AFRAME_CDN_ROOT:window.AFRAME_CDN_ROOT||"https://cdn.aframe.io/",AFRAME_INJECTED:"aframe-injected",DEFAULT_CAMERA_HEIGHT:1.6,DEFAULT_HANDEDNESS:"right",keyboardevent:n(5440)}},5440:e=>{e.exports={KEYCODE_TO_CODE:{38:"ArrowUp",37:"ArrowLeft",40:"ArrowDown",39:"ArrowRight",87:"KeyW",65:"KeyA",83:"KeyS",68:"KeyD"}}},842:(e,t,n)=>{var i=n(2203).a,r=n(8940),s=n(9437),o=new s.FileLoader,a=r("core:a-assets:warn");function l(e){if(e.hasAttribute("autoplay")||"auto"===e.getAttribute("preload"))return new Promise((function(t,n){if(4===e.readyState)return t();if(e.error)return n();function i(){for(var n=0,i=0;i<e.buffered.length;i++)n+=e.buffered.end(i)-e.buffered.start(i);n>=e.duration&&("VIDEO"===e.tagName&&s.Cache.add(e.getAttribute("src"),e),t())}e.addEventListener("loadeddata",i,!1),e.addEventListener("progress",i,!1),e.addEventListener("error",n,!1)}))}function c(e){var t=function(e){var t,n,i;if(e.hasAttribute("crossorigin"))return e;if(null!==(t=e.getAttribute("src"))){if(-1===t.indexOf("://"))return e;if((i=(n=t).indexOf("://")>-1?n.split("/")[2]:n.split("/")[0]).substring(0,i.indexOf(":"))===window.location.host)return e}return a('Cross-origin element (e.g., <img>) was requested without `crossorigin` set. A-Frame will re-request the asset with `crossorigin` attribute set. Please set `crossorigin` on the element (e.g., <img crossorigin="anonymous">)',t),e.crossOrigin="anonymous",e.cloneNode(!0)}(e);return t.tagName&&"video"===t.tagName.toLowerCase()&&(t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline","")),t!==e&&(e.parentNode.appendChild(t),e.parentNode.removeChild(e)),t}function h(e){var t=d(e),n=t.lastIndexOf(".");return n>=0&&".glb"===t.slice(n,e.search(/\?|#|$/))?"arraybuffer":"text"}function d(e){var t=document.createElement("a");t.href=e;var n=t.search.replace(/^\?/,""),i=e.replace(n,"").replace("?","");return i.substring(i.lastIndexOf("/")+1)}customElements.define("a-assets",class extends i{constructor(){super(),this.isAssets=!0,this.fileLoader=o,this.timeout=null}doConnectedCallback(){var e,t,n,i,r,o,h=this,d=[];if(super.doConnectedCallback(),!this.parentNode.isScene)throw new Error("<a-assets> must be a child of a <a-scene>.");for(r=this.querySelectorAll("img"),e=0;e<r.length;e++)i=c(r[e]),d.push(new Promise((function(t,n){s.Cache.add(r[e].getAttribute("src"),i),i.complete?t():(i.onload=t,i.onerror=n)})));for(n=this.querySelectorAll("audio, video"),e=0;e<n.length;e++)(t=c(n[e])).src||t.srcObject||a("Audio/video asset has neither `src` nor `srcObject` attributes."),d.push(l(t));this.getChildren().forEach((function(e){e.isAssetItem&&e.hasAttribute("src")&&d.push(new Promise((function(t,n){if(e.hasLoaded)return t();e.addEventListener("loaded",t),e.addEventListener("error",n)})))})),Promise.allSettled(d).then((function(){null!==h.timeout&&h.load()})),o=parseInt(this.getAttribute("timeout"),10)||3e3,this.timeout=setTimeout((function(){h.hasLoaded||(a("Asset loading timed out in",o,"ms"),h.timeout=null,h.emit("timeout"),h.load())}),o)}disconnectedCallback(){super.disconnectedCallback(),this.timeout&&clearTimeout(this.timeout)}load(){super.load.call(this,null,(function(){return!1}))}}),customElements.define("a-asset-item",class extends i{constructor(){super(),this.data=null,this.isAssetItem=!0}connectedCallback(){var e=this,t=this.getAttribute("src");o.setResponseType(this.getAttribute("response-type")||h(t)),o.load(t,(function(t){e.data=t,i.prototype.load.call(e)}),(function(t){e.emit("progress",{loadedBytes:t.loaded,totalBytes:t.total,xhr:t})}),(function(t){e.emit("error",{xhr:t},!1)}))}}),e.exports.inferResponseType=h,e.exports.getFileNameFromURL=d},6178:(e,t,n)=>{var i=n(8940)("core:cubemap:warn");class r extends HTMLElement{constructor(e){return super(e)}onReadyStateChange(){"complete"===document.readyState&&this.doConnectedCallback()}connectedCallback(){"complete"===document.readyState?r.prototype.doConnectedCallback.call(this):document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){this.srcs=this.validate()}validate(){var e,t=this.querySelectorAll("[src]"),n=[];if(6===t.length){for(e=0;e<t.length;e++)"IMG"===t[e].tagName?n.push(t[e]):n.push(t[e].getAttribute("src"));return n}i("<a-cubemap> did not contain exactly six elements each with a `src` attribute.")}}customElements.define("a-cubemap",r)},4056:(e,t,n)=>{var i=n(2203).a,r=n(8190).components,s=n(9437),o=n(7427),a=o.debug("core:a-entity:debug"),l=o.debug("core:a-entity:warn"),c="__",h=["position","rotation","scale","visible"],d={once:!0};class u extends i{constructor(){super(),this.components={},this.initializingComponents={},this.componentsToUpdate={},this.isEntity=!0,this.isPlaying=!1,this.object3D=new s.Group,this.object3D.rotation.order="YXZ",this.object3D.el=this,this.object3DMap={},this.parentEl=null,this.rotationObj={},this.states=[]}attributeChangedCallback(e,t,n){var i=this.components[e];super.attributeChangedCallback(),i&&i.justInitialized&&""===n?delete i.justInitialized:(i||null!==n)&&this.setEntityAttribute(e,t,n)}doConnectedCallback(){var e,t,n=this;super.doConnectedCallback(),t=this.sceneEl,this.addToParent(),this.isScene||(t?!(e=t.querySelector("a-assets"))||e.hasLoaded?this.load():e.addEventListener("loaded",(function(){n.load()})):this.load())}disconnectedCallback(){var e;if(this.parentEl){for(e in this.components)this.removeComponent(e,!1);this.isScene||(this.removeFromParent(),super.disconnectedCallback(),this.object3D.el=null)}}getObject3D(e){return this.object3DMap[e]}setObject3D(e,t){var n,i=this;if(!(t instanceof s.Object3D))throw new Error("`Entity.setObject3D` was called with an object that was not an instance of THREE.Object3D.");(n=this.getObject3D(e))&&this.object3D.remove(n),t.el=this,t.children.length&&t.traverse((function(e){e.el=i})),this.object3D.add(t),this.object3DMap[e]=t,this.emit("object3dset",{object:t,type:e})}removeObject3D(e){var t=this.getObject3D(e);t?(this.object3D.remove(t),delete this.object3DMap[e],this.emit("object3dremove",{type:e})):l("Tried to remove `Object3D` of type:",e,"which was not defined.")}getOrCreateObject3D(e,t){var n=this.getObject3D(e);return!n&&t&&(n=new t,this.setObject3D(e,n)),l("`getOrCreateObject3D` has been deprecated. Use `setObject3D()` and `object3dset` event instead."),n}add(e){if(!e.object3D)throw new Error("Trying to add an element that doesn't have an `object3D`");this.object3D.add(e.object3D),this.emit("child-attached",{el:e})}addToParent(){var e=this.parentEl=this.parentNode;e&&e.add&&!this.attachedToParent&&(e.add(this),this.attachedToParent=!0)}removeFromParent(){var e=this.parentEl;this.parentEl.remove(this),this.attachedToParent=!1,this.parentEl=null,e.emit("child-detached",{el:this})}load(){var e=this;!this.hasLoaded&&this.parentEl&&super.load.call(this,(function(){e.parentEl&&(e.updateComponents(),(e.isScene||e.parentEl.isPlaying)&&e.play())}))}remove(e){e?this.object3D.remove(e.object3D):this.parentNode.removeChild(this)}getChildEntities(){for(var e=this.children,t=[],n=0;n<e.length;n++){var i=e[n];i instanceof u&&t.push(i)}return t}initComponent(e,t,n){var i,s,l,h;h=(l=o.split(e,c))[0],s=l.length>2?l.slice(1).join("__"):l[1],r[h]&&(p(this,e)||void 0!==t||n)&&(e in this.components||(this.initComponentDependencies(h),i=new r[h].Component(this,t,s),this.isPlaying&&i.play(),this.hasAttribute(e)||(i.justInitialized=!0,window.HTMLElement.prototype.setAttribute.call(this,e,"")),a("Component initialized: %s",e)))}initComponentDependencies(e){var t,n;if(r[e]&&(t=r[e].dependencies))for(n=0;n<t.length;n++)this.initComponent(t[n],window.HTMLElement.prototype.getAttribute.call(this,t[n])||void 0,!0)}removeComponent(e,t){var n;(n=this.components[e])&&(n.initialized?(n.pause(),n.remove(),t&&(n.destroy(),delete this.components[e],this.hasAttribute(e)&&window.HTMLElement.prototype.removeAttribute.call(this,e)),this.emit("componentremoved",n.evtDetail,!1)):this.addEventListener("componentinitialized",(function n(i){i.detail.name===e&&(this.removeComponent(e,t),this.removeEventListener("componentinitialized",n))})))}updateComponents(){var e,t,n,i,r,s,a=this.componentsToUpdate;if(this.hasLoaded||this.isLoading){for(n=0;n<this.mixinEls.length;n++)for(i in this.mixinEls[n].componentCache)A(i)&&(a[i]=!0);if(this.getExtraComponents)for(i in t=this.getExtraComponents())A(i)&&(a[i]=!0);for(n=0;n<this.attributes.length;++n)i=this.attributes[n].name,-1===h.indexOf(i)&&A(i)&&(a[i]=!0);for(n=0;n<h.length;n++)i=h[n],this.hasAttribute(i)&&this.updateComponent(i,this.getDOMAttribute(i));for(i in a)r=this.getDOMAttribute(i),e=(s=t&&t[i])?s.constructor===Object?o.extend(s,o.styleParser.parse(r||{})):r||s:r,this.updateComponent(i,e),delete a[i]}}updateComponent(e,t,n){var i=this.components[e];if(i)return null!==t||p(this,e)?void i.updateProperties(t,n):void this.removeComponent(e,!0);this.initComponent(e,t,!1)}removeAttribute(e,t){var n=this.components[e];n&&void 0===t&&this.removeComponent(e,!0),n&&void 0!==t?n.resetProperty(t):("mixin"===e&&this.mixinUpdate(""),window.HTMLElement.prototype.removeAttribute.call(this,e))}play(){var e,t,n;if(!this.isPlaying&&(this.hasLoaded||this.isLoading)){for(n in this.isPlaying=!0,this.components)this.components[n].play();for(e=this.getChildEntities(),t=0;t<e.length;t++)e[t].play();this.emit("play")}}pause(){var e,t,n;if(this.isPlaying){for(n in this.isPlaying=!1,this.components)this.components[n].pause();for(e=this.getChildEntities(),t=0;t<e.length;t++)e[t].pause();this.emit("pause")}}setEntityAttribute(e,t,n){if(r[e]||this.components[e])this.updateComponent(e,n);else if("mixin"===e){if(n===this.computedMixinStr)return;this.mixinUpdate(n,t)}}mixinUpdate(e,t,n){var i,r,s,o,a=u.componentsUpdated,l=this;if(n||(t=t||this.getAttribute("mixin")),this.hasLoaded){for(s=this.updateMixins(e,t),a.length=0,o=0;o<this.mixinEls.length;o++)for(i in this.mixinEls[o].componentCache)-1===a.indexOf(i)&&(this.components[i]?this.components[i].handleMixinUpdate():this.initComponent(i,null),a.push(i));for(o=0;o<s.oldMixinIds.length;o++)if(r=document.getElementById(s.oldMixinIds[o]))for(i in r.componentCache)-1===a.indexOf(i)&&this.components[i]&&(this.getDOMAttribute(i)?this.components[i].handleMixinUpdate():this.removeComponent(i,!0))}else this.addEventListener("loaded-private",(function(){l.mixinUpdate(e,t,!0)}),d)}setAttribute(e,t,n){var i,s,a,l,h,d=u.singlePropUpdate;if(a=(l=e.indexOf(c))>0?e.substring(0,l):e,!r[a])return"mixin"===e&&this.mixinUpdate(t),void super.setAttribute.call(this,e,t);if(!this.components[e]&&this.hasAttribute(e)&&this.updateComponent(e,window.HTMLElement.prototype.getAttribute.call(this,e)),void 0!==n&&"string"==typeof t&&t.length>0&&"string"==typeof o.styleParser.parse(t)){for(h in d)delete d[h];(i=d)[t]=n,s=!1}else i=t,s=!0===n;this.updateComponent(e,i,s),this.sceneEl&&this.sceneEl.getAttribute("debug")&&this.components[e].flushToDOM()}flushToDOM(e){var t,n,i,r=this.components,s=this.children;for(i in r)r[i].flushToDOM();if(e)for(n=0;n<s.length;++n)(t=s[n]).flushToDOM&&t.flushToDOM(e)}getAttribute(e){var t,n,i,r;return"position"===e?this.object3D.position:"rotation"===e?(n=s.MathUtils.radToDeg,i=this.object3D.rotation,(r=this.rotationObj).x=n(i.x),r.y=n(i.y),r.z=n(i.z),r):"scale"===e?this.object3D.scale:"visible"===e?this.object3D.visible:(t=this.components[e])?t.data:window.HTMLElement.prototype.getAttribute.call(this,e)}getDOMAttribute(e){var t=this.components[e];return t?t.attrValue:window.HTMLElement.prototype.getAttribute.call(this,e)}addState(e){this.is(e)||(this.states.push(e),this.emit("stateadded",e))}removeState(e){var t=this.states.indexOf(e);-1!==t&&(this.states.splice(t,1),this.emit("stateremoved",e))}is(e){return-1!==this.states.indexOf(e)}inspect(){this.sceneEl.components.inspector.openInspector(this)}destroy(){var e;if(this.parentNode)l("Entity can only be destroyed if detached from scenegraph.");else for(e in this.components)this.components[e].destroy()}}function p(e,t){return!(!e.components[t]||!e.components[t].attrValue)||function(e,t){var n,i=!1;for(n=0;n<t.length&&!(i=t[n].hasAttribute(e));++n);return i}(t,e.mixinEls)}function A(e){return-1!==e.indexOf(c)&&(e=o.split(e,c)[0]),!!r[e]}u.componentsUpdated=[],u.singlePropUpdate={},customElements.define("a-entity",u),e.exports.P=u},5890:(e,t,n)=>{var i=n(2203).a,r=n(8190).components,s=n(7427),o=s.styleParser;customElements.define("a-mixin",class extends i{constructor(){super(),this.componentCache={},this.rawAttributeCache={},this.isMixin=!0}doConnectedCallback(){super.doConnectedCallback(),this.sceneEl=this.closestScene(),this.id=this.getAttribute("id"),this.cacheAttributes(),this.updateEntities(),this.load()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(),this.cacheAttribute(e,n),this.updateEntities()}setAttribute(e,t){window.HTMLElement.prototype.setAttribute.call(this,e,t),this.cacheAttribute(e,t)}cacheAttribute(e,t){var n,i;i=s.split(e,"__")[0],n=r[i],void 0===t&&(t=window.HTMLElement.prototype.getAttribute.call(this,e)),this.rawAttributeCache[e]=t,n&&(this.componentCache[e]=this.parseComponentAttrValue(n,t))}parseComponentAttrValue(e,t){var n;return"string"!=typeof t?t:(e.isSingleProperty?"string"==typeof(n=e.schema.parse(t))&&(n=t):n=o.parse(t),n)}getAttribute(e){return this.componentCache[e]||window.HTMLElement.prototype.getAttribute.call(this,e)}cacheAttributes(){var e,t,n=this.attributes;for(t=0;t<n.length;t++)e=n[t].name,this.cacheAttribute(e)}updateEntities(){var e,t,n;if(this.sceneEl)for(t=this.sceneEl.querySelectorAll("[mixin~="+this.id+"]"),n=0;n<t.length;n++)(e=t[n]).hasLoaded&&!e.isMixin&&e.mixinUpdate(this.id)}})},2203:(e,t,n)=>{var i=n(7427),r=n(2849),s=i.debug("core:a-node:warn"),o={"a-scene":!0,"a-assets":!0,"a-assets-items":!0,"a-cubemap":!0,"a-mixin":!0,"a-node":!0,"a-entity":!0};function a(e){return e.tagName.toLowerCase()in o||e.isNode}class l extends HTMLElement{constructor(){super(),this.computedMixinStr="",this.hasLoaded=!1,this.isNode=!0,this.mixinEls=[]}connectedCallback(){r.canInitializeElements?this.doConnectedCallback():document.addEventListener("aframeready",this.connectedCallback.bind(this))}doConnectedCallback(){var e;this.sceneEl=this.closestScene(),this.sceneEl||s("You are attempting to attach <"+this.tagName+"> outside of an A-Frame scene. Append this element to `<a-scene>` instead."),this.hasLoaded=!1,this.emit("nodeready",void 0,!1),this.isMixin||(e=this.getAttribute("mixin"))&&this.updateMixins(e)}attributeChangedCallback(e,t,n){n!==this.computedMixinStr&&("mixin"!==e||this.isMixin||this.updateMixins(n,t))}closestScene(){for(var e=this;e&&!e.isScene;)e=e.parentElement;return e}closest(e){for(var t=this.matches||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector,n=this;n&&!t.call(n,e);)n=n.parentElement;return n}disconnectedCallback(){this.hasLoaded=!1}load(e,t){var n,i=this;this.hasLoaded||(t=t||a,n=this.getChildren().filter(t).map((function(e){return new Promise((function(t,n){if(e.hasLoaded)return t();e.addEventListener("loaded",t),e.addEventListener("error",n)}))})),Promise.allSettled(n).then((function(t){t.forEach((function(e){"rejected"===e.status&&s("Rendering scene with errors on node: ",e.reason.target)})),i.isLoading=!0,i.setupMutationObserver(),e&&e(),i.isLoading=!1,i.hasLoaded=!0,i.emit("loaded-private",void 0,!1),i.emit("loaded",void 0,!1)})))}setupMutationObserver(){var e=this;new MutationObserver((function(t){var n;for(n=0;n<t.length;n++)if("attributes"===t[n].type){var i=t[n].attributeName,r=window.HTMLElement.prototype.getAttribute.call(e,i),s=t[n].oldValue;e.attributeChangedCallback(i,s,r)}})).observe(this,{attributes:!0,attributeOldValue:!0})}getChildren(){return Array.prototype.slice.call(this.children,0)}updateMixins(e,t){var n,r,s,o=l.newMixinIdArray,a=l.oldMixinIdArray,c=l.mixinIds;for(o.length=0,a.length=0,r=e?i.split(e.trim(),/\s+/):o,s=t?i.split(t.trim(),/\s+/):a,c.newMixinIds=r,c.oldMixinIds=s,n=0;n<s.length;n++)-1===r.indexOf(s[n])&&this.unregisterMixin(s[n]);for(this.computedMixinStr="",this.mixinEls.length=0,n=0;n<r.length;n++)this.registerMixin(r[n]);return this.computedMixinStr&&(this.computedMixinStr=this.computedMixinStr.trim(),window.HTMLElement.prototype.setAttribute.call(this,"mixin",this.computedMixinStr)),0===r.length&&window.HTMLElement.prototype.removeAttribute.call(this,"mixin"),c}registerMixin(e){var t,n,r,o=document.getElementById(e);if(o){if(r=o.getAttribute("mixin"))for(t=i.split(r.trim(),/\s+/),n=0;n<t.length;n++)this.registerMixin(t[n]);this.computedMixinStr=this.computedMixinStr+" "+o.id,this.mixinEls.push(o)}else s("No mixin was found with id `%s`",e)}setAttribute(e,t){"mixin"===e&&this.updateMixins(t),window.HTMLElement.prototype.setAttribute.call(this,e,t)}unregisterMixin(e){var t,n=this.mixinEls;for(t=0;t<n.length;++t)if(e===n[t].id){n.splice(t,1);break}}emit(e,t,n,r){var s=l.evtData;void 0===n&&(n=!0),s.bubbles=!!n,s.detail=t,r&&(s=i.extend({},r,s)),this.dispatchEvent(new CustomEvent(e,s))}}l.evtData={},l.newMixinIdArray=[],l.oldMixinIdArray=[],l.mixinIds={},customElements.define("a-node",l),e.exports.a=l,e.exports.$=o},8190:(e,t,n)=>{var i=n(7282),r=n(8313),s=n(1876),o=n(7427),a=e.exports.components={},l=i.parseProperty,c=i.process,h=i.isSingleProperty,d=i.stringifyProperties,u=i.stringifyProperty,p=o.styleParser,A=o.debug("core:component:warn"),f=document.currentScript,m=new RegExp("[A-Z]+"),g={},v=Object.freeze({}),y=[],E={get:function(e,t){return e.getComputedPropertyValue(t)},set:function(e,t,n){return t in e.schema?e.recomputeProperty(t,n):void 0!==n&&e.handleUnknownProperty(t,n),!0}},x=e.exports.Component=function(e,t,n){var i=this;if(this.sceneOnly&&!e.isScene)throw new Error("Component `"+this.name+"` can only be applied to <a-scene>");if(n&&!this.multiple)throw new Error("Trying to initialize multiple components of type `"+this.name+"`. There can only be one component of this type per entity.");this.el=e,this.id=n,this.attrName=this.name+(n?"__"+n:""),this.evtDetail={id:this.id,name:this.name},this.initialized=!1,this.el.components[this.attrName]=this,this.objectPool=g[this.name];var r=this.events;this.events={},function(e,t){var n;for(n in t)e.events[n]=t[n].bind(e)}(this,r),this.attrValue=void 0,this.isObjectBased?(this.data=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.data,this.schema),this.oldData=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.oldData,this.schema),this.attrValueProxy=new Proxy(this,E)):(this.data=void 0,this.oldData=void 0,this.attrValueProxy=void 0),this.deferUnknownPropertyWarnings=!!this.updateSchema,this.throttledEmitComponentChanged=o.throttleLeadingAndTrailing((function(){e.emit("componentchanged",i.evtDetail,!1)}),200),this.updateProperties(t,!0)};if(x.prototype={schema:{},init:function(){},events:{},update:function(e){},updateSchema:void 0,tick:void 0,tock:void 0,play:function(){},pause:function(){},remove:function(){},stringify:function(e){var t=this.schema;return"string"==typeof e?e:this.isSingleProperty?u(e,t):(e=d(e,t),p.stringify(e))},flushToDOM:function(e){var t=e?this.data:this.attrValue;null!=t&&window.HTMLElement.prototype.setAttribute.call(this.el,this.attrName,this.stringify(t))},updateProperties:function(e,t){var n=this.el;this.updateData(e,t),(n.hasLoaded||n.isLoading)&&(this.initialized?this.callUpdateHandler():this.initComponent())},initComponent:function(){var e,t=this.el;t.initializingComponents[this.name]||(t.initializingComponents[this.name]=!0,this.init(),this.initialized=!0,delete t.initializingComponents[this.name],e=this.isObjectBased?v:void 0,this.dataChanged=!1,this.storeOldData(),this.update(e),t.isPlaying&&this.play(),t.emit("componentinitialized",this.evtDetail,!1))},updateData:function(e,t){this.isSingleProperty?this.recomputeProperty(void 0,e):(t?(o.objectPool.clearObject(this.attrValue),this.recomputeData(e),this.schemaChangeRequired=!!this.updateSchema):"string"==typeof e?p.parse(e,this.attrValueProxy):o.extend(this.attrValueProxy,e),this.updateSchemaIfNeeded(e))},updateSchemaIfNeeded:function(e){if(this.schemaChangeRequired&&this.updateSchema)for(var t in y.length=0,this.updateSchema(this.data),o.objectPool.removeUnusedKeys(this.data,this.schema),this.recomputeData(e),this.schemaChangeRequired=!1,this.attrValue)void 0!==this.attrValue[t]&&-1===y.indexOf(t)&&(t in this.schema||A("Unknown property `"+t+"` for component `"+this.name+"`."));for(var n=0;n<y.length;n++)A("Unknown property `"+y[n]+"` for component `"+this.name+"`.");y.length=0},callUpdateHandler:function(){if(this.isPositionRotationScale||this.dataChanged){this.dataChanged=!1;var e=this.oldData;this.oldDataInUse=!0,this.update(e),e!==this.oldData&&this.objectPool.recycle(e),this.oldDataInUse=!1,this.storeOldData(),this.throttledEmitComponentChanged()}},handleMixinUpdate:function(){this.recomputeData(),this.updateSchemaIfNeeded(),this.callUpdateHandler()},resetProperty:function(e){(this.isSingleProperty||e in this.schema)&&(e?this.attrValue[e]=void 0:(this.isObjectBased&&this.objectPool.recycle(this.attrValue),this.attrValue=void 0),this.recomputeProperty(e,void 0),this.updateSchemaIfNeeded(),this.callUpdateHandler())},extendSchema:function(e){var t;t=o.extend({},a[this.name].schema),o.extend(t,e),this.schema=c(t),this.el.emit("schemachanged",this.evtDetail)},getComputedPropertyValue:function(e){var t=this.el.mixinEls,n=this.attrValue&&e?this.attrValue[e]:this.attrValue;if(void 0!==n)return n;for(var i=t.length-1;i>=0;i--){var r=t[i].getAttribute(this.attrName);if(null!==r&&(!e||e in r))return e?r[e]:r}return e?this.schema[e].default:this.schema.default},recomputeProperty:function(e,t){var n=e?this.schema[e]:this.schema;if(null!=t){void 0===this.attrValue&&this.isObjectBased&&(this.attrValue=this.objectPool.use());var i=e?this.attrValue[e]:this.attrValue;"string"==typeof(i=n.isCacheable?l(t,n,i):t)&&(i=""===t?void 0:t),e?this.attrValue[e]=i:this.attrValue=i}this.oldDataInUse&&(this.oldData=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.oldData,this.schema),this.storeOldData(),this.oldDataInUse=!1);var r=e?this.oldData[e]:this.oldData,s=e?this.data[e]:this.data,a=l(this.getComputedPropertyValue(e),n,s);return"array"!==n.type||e||(a=o.clone(a)),n.equals(a,r)||(this.dataChanged=!0,n.schemaChange&&(this.schemaChangeRequired=!0)),e?this.data[e]=a:this.data=a,a},handleUnknownProperty:function(e,t){void 0===this.attrValue&&(this.attrValue=this.objectPool.use()),this.attrValue[e]=t,this.deferUnknownPropertyWarnings?y.push(e):this.silenceUnknownPropertyWarnings||A("Unknown property `"+e+"` for component `"+this.name+"`.")},storeOldData:function(){var e;if(this.isObjectBased)if(this.isSingleProperty)this.oldData=l(this.data,this.schema,this.oldData);else for(e in this.schema)void 0!==this.data[e]&&(this.data[e]&&"object"==typeof this.data[e]?this.oldData[e]=l(this.data[e],this.schema[e],this.oldData[e]):this.oldData[e]=this.data[e]);else this.oldData=this.data},recomputeData:function(e){var t;if(this.isSingleProperty)this.recomputeProperty(void 0,e);else{for(t in this.schema)this.attrValueProxy[t]=void 0;e&&"object"==typeof e?o.extend(this.attrValueProxy,e):"string"==typeof e&&p.parse(e,this.attrValueProxy)}},eventsAttach:function(){var e;for(e in this.eventsDetach(),this.events)this.el.addEventListener(e,this.events[e])},eventsDetach:function(){var e;for(e in this.events)this.el.removeEventListener(e,this.events[e])},destroy:function(){this.objectPool.recycle(this.attrValue),this.objectPool.recycle(this.data),this.objectPool.recycle(this.oldData),this.attrValue=this.data=this.oldData=this.attrValueProxy=void 0}},window.debug)var b=e.exports.registrationOrderWarnings={};function C(e){return e.tick||e.tock}function w(e){return e&&e.constructor===Object&&!(e instanceof window.HTMLElement)}e.exports.registerComponent=function(e,t){var n,i,d,u,p,v={};if(document.currentScript&&document.currentScript!==f&&r.forEach((function(t){t.hasLoaded||document.currentScript.compareDocumentPosition(t)!==Node.DOCUMENT_POSITION_FOLLOWING&&(A("The component `"+e+"` was registered in a <script> tag after the scene. Component <script> tags in an HTML file should be declared *before* the scene such that the component is available to entities during scene initialization."),window.debug&&(b[e]=!0))})),!0===m.test(e)&&A("The component name `"+e+"` contains uppercase characters, but HTML will ignore the capitalization of attribute names. Change the name to be lowercase: `"+e.toLowerCase()+"`"),-1!==e.indexOf("__"))throw new Error("The component name `"+e+"` is not allowed. The sequence __ (double underscore) is reserved to specify an id for multiple components of the same type");if(Object.keys(t).forEach((function(e){v[e]={value:t[e],writable:!0}})),a[e])throw new Error("The component `"+e+"` has been already registered. Check that you are not loading two versions of the same component or two different components of the same name.");((n=function(e,t,n){x.call(this,e,t,n)}).prototype=Object.create(x.prototype,v)).name=e,n.prototype.isPositionRotationScale="position"===e||"rotation"===e||"scale"===e,n.prototype.constructor=n,n.prototype.system=s&&s.systems[e],n.prototype.play=(u=n.prototype.play,function(){var e=this.el.sceneEl,t=this.el.isPlaying&&!this.isPlaying;this.initialized&&t&&(u.call(this),this.isPlaying=!0,this.eventsAttach(),C(this)&&e.addBehavior(this))}),n.prototype.pause=(p=n.prototype.pause,function(){var e=this.el.sceneEl;this.isPlaying&&(p.call(this),this.isPlaying=!1,this.eventsDetach(),C(this)&&e.removeBehavior(this))}),i=o.extend(c(n.prototype.schema,n.prototype.name)),n.prototype.isSingleProperty=d=h(n.prototype.schema),n.prototype.isObjectBased=!d||d&&(w(i.default)||w(l(void 0,i))),g[e]=o.objectPool.createPool(),a[e]={Component:n,dependencies:n.prototype.dependencies,before:n.prototype.before,after:n.prototype.after,isSingleProperty:n.prototype.isSingleProperty,isObjectBased:n.prototype.isObjectBased,multiple:n.prototype.multiple,sceneOnly:n.prototype.sceneOnly,name:e,schema:i,stringify:n.prototype.stringify};for(var y=0;y<r.length;y++)r[y].emit("componentregistered",{name:e},!1);return n}},7045:(e,t,n)=>{var i=n(7282).process,r=e.exports.to={},s=e.exports.Ls=[],o=n(9437),a=function(){};a.prototype={schema:{},init:function(e){return this.geometry=new o.BufferGeometry,this.geometry},update:function(e){}},e.exports.Az=function(e,t){var n,o={};if(Object.keys(t).forEach((function(e){o[e]={value:t[e],writable:!0}})),r[e])throw new Error("The geometry `"+e+"` has been already registered");return((n=function(){a.call(this)}).prototype=Object.create(a.prototype,o)).name=e,n.prototype.constructor=n,r[e]={Geometry:n,schema:i(n.prototype.schema)},s.push(e),n}},1551:(e,t,n)=>{var i=n(676),r=n(8878)("core:propertyTypes:warn"),s=e.exports.propertyTypes={},o=/[,> .[\]:]/,a=/url\((.+)\)/;function l(e,t,n,i,r,o){if(e in s)throw new Error("Property type "+e+" is already registered.");s[e]={default:t,parse:n||u,stringify:i||p,equals:r||A,isCacheable:!1!==o}}function c(e,t){if(!Array.isArray(e)||!Array.isArray(t))return e===t;if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function h(e){var t,n;return"string"!=typeof e?e:(n=e.match(a))?n[1]:"#"===e.charAt(0)?(t=document.getElementById(e.substring(1)))?"CANVAS"===t.tagName||"VIDEO"===t.tagName||"IMG"===t.tagName?t:t.getAttribute("src"):void r('"'+e+'" asset not found.'):e}function d(e){return e.getAttribute?e.getAttribute("id")?"#"+e.getAttribute("id"):e.getAttribute("src"):p(e)}function u(e){return e}function p(e){return null===e?"null":e.toString()}function A(e,t){return e===t}function f(e){return parseInt(e,10)}function m(e,t,n){return i.parse(e,t,n)}function g(e,t){if(null===e)return!0;if("object"!=typeof e)return!1;if(Object.keys(e).length!==t)return!1;var n=e.x,i=e.y,r=e.z,s=e.w;return!("number"!=typeof n||"number"!=typeof i||t>2&&"number"!=typeof r||t>3&&"number"!=typeof s)}l("audio","",h,d),l("array",[],(function(e){return Array.isArray(e)?e:e&&"string"==typeof e?e.split(",").map((function(e){return e.trim()})):[]}),(function(e){return e.join(", ")}),c),l("asset","",h,d),l("boolean",!1,(function(e){return"false"!==e&&!1!==e})),l("color","#FFF"),l("int",0,f),l("number",0,(function(e){return parseFloat(e,10)})),l("map","",h,d),l("model","",h,d),l("selector",null,(function(e){return e?"string"!=typeof e?e:"#"!==e[0]||o.test(e)?document.querySelector(e):document.getElementById(e.substring(1)):null}),(function(e){return e.getAttribute?"#"+e.getAttribute("id"):p(e)}),A,!1),l("selectorAll",null,(function(e){return e?"string"!=typeof e?e:Array.prototype.slice.call(document.querySelectorAll(e),0):null}),(function(e){return e instanceof Array?e.map((function(e){return"#"+e.getAttribute("id")})).join(", "):p(e)}),c,!1),l("src","",(function(e){return r("`src` property type is deprecated. Use `asset` instead."),h(e)}),d),l("string",""),l("time",0,f),l("vec2",{x:0,y:0},m,i.stringify,i.equals),l("vec3",{x:0,y:0,z:0},m,i.stringify,i.equals),l("vec4",{x:0,y:0,z:0,w:1},m,i.stringify,i.equals),e.exports.registerPropertyType=l,e.exports.isValidDefaultValue=function(e,t){return("audio"!==e||"string"==typeof t)&&!("array"===e&&!Array.isArray(t))&&("asset"!==e||"string"==typeof t)&&("boolean"!==e||"boolean"==typeof t)&&("color"!==e||"string"==typeof t)&&("int"!==e||"number"==typeof t)&&("number"!==e||"number"==typeof t)&&("map"!==e||"string"==typeof t)&&("model"!==e||"string"==typeof t)&&("selector"!==e||"string"==typeof t||null===t)&&("selectorAll"!==e||"string"==typeof t||null===t)&&("src"!==e||"string"==typeof t)&&("string"!==e||"string"==typeof t)&&("time"!==e||"number"==typeof t)&&("vec2"===e?g(t,2):"vec3"===e?g(t,3):"vec4"!==e||g(t,4))},e.exports.isValidDefaultCoordinate=g},2849:e=>{function t(){e.exports.canInitializeElements||(e.exports.canInitializeElements=!0,setTimeout((function(){document.dispatchEvent(new CustomEvent("aframeready"))})))}e.exports.canInitializeElements=!1,e.exports.waitForDocumentReadyState=function(){"complete"!==document.readyState?document.addEventListener("readystatechange",(function e(){"complete"===document.readyState&&(document.removeEventListener("readystatechange",e),t())})):t()},e.exports.emitReady=t},5076:(e,t,n)=>{var i=n(8316).W,r=n(6147),s=n(9762),o=n(8313),a=n(1876).systems,l=n(8190).components,c=n(9437),h=n(7427),d=h.debug("core:a-scene:warn"),u=n(4056).P,p=n(2203).a,A=n(8371),f=h.device.isIOS(),m=h.device.isMobile(),g=h.device.isWebXRAvailable;f&&n(1957);class v extends u{constructor(){var e;super(),(e=this).clock=new c.Clock,e.isIOS=f,e.isMobile=m,e.hasWebXR=g,e.isAR=!1,e.isScene=!0,e.object3D=new c.Scene,e.object3D.onAfterRender=function(t,n,i){e.isPlaying&&e.tock(e.time,e.delta,i)},e.resize=e.resize.bind(e),e.render=e.render.bind(e),e.systems={},e.systemNames=[],e.time=e.delta=0,e.usedOfferSession=!1,e.componentOrder=[],e.behaviors={},e.hasLoaded=!1,e.isPlaying=!1,e.originalHTML=e.innerHTML}addFullScreenStyles(){document.documentElement.classList.add("a-fullscreen")}removeFullScreenStyles(){document.documentElement.classList.remove("a-fullscreen")}doConnectedCallback(){var e=this,t=this.hasAttribute("embedded");this.setAttribute("inspector",""),this.setAttribute("keyboard-shortcuts",""),this.setAttribute("screenshot",""),this.setAttribute("xr-mode-ui",""),this.setAttribute("device-orientation-permission-ui",""),super.doConnectedCallback(),function(e){var t;function n(){document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||e.exitVR(),document.activeElement.blur(),document.body.focus()}(t=document.createElement("canvas")).classList.add("a-canvas"),t.dataset.aframeCanvas=!0,e.appendChild(t),document.addEventListener("fullscreenchange",n),document.addEventListener("mozfullscreenchange",n),document.addEventListener("webkitfullscreenchange",n),document.addEventListener("MSFullscreenChange",n),t.addEventListener("touchmove",(function(e){e.preventDefault()}),{passive:!1}),e.canvas=t,e.emit("render-target-loaded",{target:t}),setTimeout(e.resize.bind(e),0)}(this),this.setupRenderer(),s.setup(this,x),this.resize(),t||this.addFullScreenStyles(),A(this),i(this),r(this),this.enterVRBound=function(){e.enterVR()},this.exitVRBound=function(){e.exitVR()},window.addEventListener("sessionend",this.resize),this.addEventListener("cameraready",(function(){e.attachedCallbackPostCamera()})),this.initSystems(),this.componentOrder=y(l,this.componentOrder),this.addEventListener("componentregistered",(function(){e.componentOrder=y(l,e.componentOrder)})),this.hasWebXR&&navigator.xr&&navigator.xr.addEventListener&&navigator.xr.addEventListener("sessiongranted",(function(){e.enterVR()}))}attachedCallbackPostCamera(){var e=this;window.addEventListener("load",void 0),window.addEventListener("resize",(function(){e.isIOS?setTimeout(e.resize,100):e.resize()})),this.play(),o.push(this)}initSystems(){var e;for(e in this.initSystem("camera"),a)"camera"!==e&&this.initSystem(e)}initSystem(e){this.systems[e]||(this.systems[e]=new a[e](this),this.systemNames.push(e))}disconnectedCallback(){var e=o.indexOf(this);super.disconnectedCallback(),o.splice(e,1),window.removeEventListener("sessionend",this.resize),this.removeFullScreenStyles(),this.renderer.dispose()}addBehavior(e){var t,n,i=this.behaviors[e.name];for(n in i||(i=this.behaviors[e.name]={tick:{inUse:!1,array:[],markedForRemoval:[]},tock:{inUse:!1,array:[],markedForRemoval:[]}}),i)if(e[n]){if((t=i[n]).inUse){var r=t.markedForRemoval.indexOf(e);-1!==r&&t.markedForRemoval.splice(r,1)}-1===t.array.indexOf(e)&&t.array.push(e)}}getPointerLockElement(){return document.pointerLockElement}checkHeadsetConnected(){return h.device.checkHeadsetConnected()}enterAR(){var e;if(!this.hasWebXR)throw e="Failed to enter AR mode, WebXR not supported.",new Error(e);if(!h.device.checkARSupport())throw e="Failed to enter AR, WebXR immersive-ar mode not supported in your browser or device.",new Error(e);return this.enterVR(!0)}enterVR(e,t){var n,i=this,r=i.renderer.xr;if(t&&(!navigator.xr||!navigator.xr.offerSession))return Promise.resolve("OfferSession is not supported.");if(i.usedOfferSession&&t)return Promise.resolve("OfferSession was already called.");if(this.is("vr-mode"))return Promise.resolve("Already in VR.");if(this.checkHeadsetConnected()||this.isMobile){var s=i.getAttribute("renderer");if(r.enabled=!0,this.hasWebXR){this.xrSession&&this.xrSession.removeEventListener("end",this.exitVRBound);var o=this.sceneEl.systems.webxr.sessionReferenceSpaceType;r.setReferenceSpaceType(o);var a=e?"immersive-ar":"immersive-vr";return n=this.sceneEl.systems.webxr.sessionConfiguration,new Promise((function(e,o){var c=t?navigator.xr.offerSession.bind(navigator.xr):navigator.xr.requestSession.bind(navigator.xr);i.usedOfferSession|=t,c(a,n).then((function(o){t&&(i.usedOfferSession=!1),r.layersEnabled=-1!==n.requiredFeatures.indexOf("layers"),r.setSession(o).then((function(){r.setFoveation(s.foveationLevel),i.xrSession=o,i.systems.renderer.setWebXRFrameRate(o),o.addEventListener("end",i.exitVRBound),l(e)}))}),(function(e){o(new Error("Failed to enter "+("immersive-ar"===a?"AR":"VR")+" mode (`requestSession`)",{cause:e}))}))}))}throw new Error("Failed to enter "+(e?"AR":"VR")+" no WebXR")}return l(),Promise.resolve();function l(t){var n;e?i.addState("ar-mode"):i.addState("vr-mode"),i.emit("enter-vr",{target:i}),!i.hasWebXR&&i.isMobile&&screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape"),i.addFullScreenStyles(),i.isMobile||i.checkHeadsetConnected()||((n=i.canvas).requestFullscreen||n.webkitRequestFullscreen||n.mozRequestFullScreen||n.msRequestFullscreen).apply(n,[{navigationUI:"hide"}]),i.resize(),t&&t()}}exitVR(){var e=this,t=this.renderer.xr;if(!this.is("vr-mode")&&!this.is("ar-mode"))return Promise.resolve("Not in immersive mode.");if(this.checkHeadsetConnected()||this.isMobile){if(t.enabled=!1,!this.hasWebXR)throw Error("Failed to exit VR - no WebXR");this.xrSession.removeEventListener("end",this.exitVRBound),this.xrSession.end().then((function(){}),(function(){})),this.xrSession=void 0}else(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen());return e.removeState("vr-mode"),e.removeState("ar-mode"),e.isMobile&&screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),e.hasAttribute("embedded")&&e.removeFullScreenStyles(),e.resize(),e.isIOS&&h.forceCanvasResizeSafariMobile(e.canvas),e.renderer.setPixelRatio(window.devicePixelRatio),e.emit("exit-vr",{target:e}),Promise.resolve()}getAttribute(e){var t=this.systems[e];return t?t.data:u.prototype.getAttribute.call(this,e)}getDOMAttribute(e){var t=this.systems[e];return t?t.data:u.prototype.getDOMAttribute.call(this,e)}setAttribute(e,t,n){if(a[e]){p.prototype.setAttribute.call(this,e,t);var i=this.systems[e];i&&i.updateProperties(t)}else u.prototype.setAttribute.call(this,e,t,n)}removeBehavior(e){var t,n,i,r=this.behaviors[e.name];for(n in r)e[n]&&-1!==(i=(t=r[n]).array.indexOf(e))&&(t.inUse?-1===t.markedForRemoval.indexOf(e)&&t.markedForRemoval.push(e):(t.array[i]=t.array[t.array.length-1],t.array.pop()))}resize(){var e,t,n=this.camera,i=this.canvas,r=this.renderer.xr.isPresenting;e=this.renderer.xr.enabled&&r,!n||!i||this.is("vr-mode")&&(this.isMobile||e)||(t=x(i,this.getAttribute("embedded")&&!this.is("vr-mode"),this.maxCanvasSize,this.is("vr-mode")),n.aspect=t.width/t.height,n.updateProjectionMatrix(),this.renderer.setSize(t.width,t.height,!1),this.emit("rendererresize",null,!1))}setupRenderer(){var e,t,n,i,r=this;i={alpha:!0,antialias:!m,canvas:this.canvas,logarithmicDepthBuffer:!1,powerPreference:"high-performance"},this.maxCanvasSize={height:-1,width:-1},this.hasAttribute("renderer")&&(n=this.getAttribute("renderer"),(t=h.styleParser.parse(n)).precision&&(i.precision=t.precision+"p"),t.antialias&&"auto"!==t.antialias&&(i.antialias="true"===t.antialias),t.logarithmicDepthBuffer&&"auto"!==t.logarithmicDepthBuffer&&(i.logarithmicDepthBuffer="true"===t.logarithmicDepthBuffer),t.alpha&&(i.alpha="true"===t.alpha),t.stencil&&(i.stencil="true"===t.stencil),t.multiviewStereo&&(i.multiviewStereo="true"===t.multiviewStereo),this.maxCanvasSize={width:t.maxCanvasWidth?parseInt(t.maxCanvasWidth):this.maxCanvasSize.width,height:t.maxCanvasHeight?parseInt(t.maxCanvasHeight):this.maxCanvasSize.height}),(e=this.renderer=new c.WebGLRenderer(i)).setPixelRatio(window.devicePixelRatio),this.camera&&e.xr.setPoseTarget(this.camera.el.object3D),this.addEventListener("camera-set-active",(function(){e.xr.setPoseTarget(r.camera.el.object3D)}))}play(){var e=this,t=this;this.renderStarted?u.prototype.play.call(this):(this.addEventListener("loaded",(function(){var e=this.renderer;u.prototype.play.call(this),t.renderStarted||(t.resize(),t.renderer&&(window.performance&&window.performance.mark("render-started"),s.remove(),e.setAnimationLoop(this.render),t.renderStarted=!0,t.emit("renderstart")))})),setTimeout((function(){u.prototype.load.call(e)})))}updateComponent(e){e in a||u.prototype.updateComponent.apply(this,arguments)}tick(e,t){var n,i=this.systems;for(this.callComponentBehaviors("tick",e,t),n=0;n<this.systemNames.length;n++)i[this.systemNames[n]].tick&&i[this.systemNames[n]].tick(e,t)}tock(e,t,n){var i,r=this.systems;for(this.callComponentBehaviors("tock",e,t),i=0;i<this.systemNames.length;i++)r[this.systemNames[i]].tock&&r[this.systemNames[i]].tock(e,t,n)}render(e,t){var n=this.renderer;this.frame=t,this.delta=1e3*this.clock.getDelta(),this.time=1e3*this.clock.elapsedTime,this.isPlaying&&this.tick(this.time,this.delta);var i=null;this.is("ar-mode")&&(i=this.object3D.background,this.object3D.background=null),n.render(this.object3D,this.camera),i&&(this.object3D.background=i)}callComponentBehaviors(e,t,n){for(var i,r=0;r<this.componentOrder.length;r++){var s=this.behaviors[this.componentOrder[r]];if(s){var o=s[e];for(o.inUse=!0,i=0;i<o.array.length;i++)o.array[i].isPlaying&&o.array[i][e](t,n);for(o.inUse=!1,i=0;i<o.markedForRemoval.length;i++)this.removeBehavior(o.markedForRemoval[i]);o.markedForRemoval.length=0}}}}function y(e,t){var n,i,r={},s=t||[];for(i in s.length=0,e){var o=e[i];if(void 0!==o){var a=o.before?o.before.slice(0):[],l=o.after?o.after.slice(0):[];r[i]={before:a,after:l,visited:!1,done:!1}}}for(i in r)for(n=0;n<r[i].before.length;n++){var c=r[i].before[n];c in r?r[c].after.push(i):d("Invalid ordering constraint, no component named `"+c+"` referenced by `"+i+"`")}function h(e){if(e in r&&!r[e].done)if(r[e].visited)d("Cycle detected, ignoring one or more before/after constraints. The resulting order might be incorrect");else{r[e].visited=!0;for(var t=0;t<r[e].after.length;t++){var n=r[e].after[t];n in r||d("Invalid before/after constraint, no component named `"+n+"` referenced in `"+e+"`"),h(n)}r[e].done=!0,s.push(e)}}for(i in r)r[i].done||h(i);return s}function E(e,t){var n,i=window.devicePixelRatio;return!t||-1===t.width&&-1===t.height||e.width*i<t.width&&e.height*i<t.height||(n=e.width/e.height,e.width*i>t.width&&-1!==t.width&&(e.width=Math.round(t.width/i),e.height=Math.round(t.width/n/i)),e.height*i>t.height&&-1!==t.height&&(e.height=Math.round(t.height/i),e.width=Math.round(t.height*n/i))),e}function x(e,t,n,i){return e.parentElement?t?E({height:e.parentElement.offsetHeight,width:e.parentElement.offsetWidth},n):function(e,t){var n;return n={height:document.body.offsetHeight,width:document.body.offsetWidth},t?n:E(n,e)}(n,i):{height:0,width:0}}customElements.define("a-scene",v),e.exports.aQ=v},9762:(e,t,n)=>{var i,r,s,o=n(1343).AFRAME_INJECTED,a=n(7427).styleParser,l="loading-screen";function c(e){var t=i.hasAttribute("embedded"),n=s(i.canvas,t,i.maxCanvasSize,i.is("vr-mode"));e.aspect=n.width/n.height,e.updateProjectionMatrix(),i.renderer.setSize(n.width,n.height,!1)}e.exports.setup=function(e,t){s=t;var n,h,d,u,p,A,f,m,g,v,y=(i=e).hasAttribute(l)?a.parse(i.getAttribute(l)):void 0,E=y&&y.dotsColor||"white",x=y&&y.backgroundColor||"#24CAFF";(void 0===y||"true"===y.enabled||void 0===y.enabled)&&(n=new THREE.Scene,h=new THREE.SphereGeometry(.2,36,18,0,2*Math.PI,0,Math.PI),d=new THREE.MeshBasicMaterial({color:E}),u=new THREE.Mesh(h,d),p=u.clone(),A=u.clone(),f=new THREE.PerspectiveCamera(80,window.innerWidth/window.innerHeight,5e-4,1e4),m=new THREE.Clock,g=0,v=function(){i.renderer.render(n,f),g=m.getElapsedTime()%4,u.visible=g>=1,p.visible=g>=2,A.visible=g>=3},n.background=new THREE.Color(x),n.add(f),u.position.set(-1,0,-15),p.position.set(0,0,-15),A.position.set(1,0,-15),f.add(u),f.add(p),f.add(A),(r=document.createElement("div")).className="a-loader-title",r.innerHTML=document.title,r.style.display="none",r.setAttribute(o,""),i.appendChild(r),setTimeout((function(){i.hasLoaded||(c(f),r.style.display="block",window.addEventListener("resize",(function(){c(f)})),i.renderer.setAnimationLoop(v))}),200))},e.exports.remove=function(){window.removeEventListener("resize",c),r&&(r.style.display="none")}},8316:(e,t,n)=>{var i,r=n(1343),s=n(7427).extend,o=[l({name:"viewport",content:"width=device-width,initial-scale=1,maximum-scale=1,shrink-to-fit=no,user-scalable=no,minimal-ui,viewport-fit=cover"}),l({name:"mobile-web-app-capable",content:"yes"}),l({name:"theme-color",content:"black"})],a=[l({name:"apple-mobile-web-app-capable",content:"yes"}),l({name:"apple-mobile-web-app-status-bar-style",content:"black"}),(i={rel:"apple-touch-icon",href:"https://aframe.io/images/aframe-logo-152.png"},{tagName:"link",attributes:i,exists:function(){return document.querySelector('link[rel="'+i.rel+'"]')}})];function l(e){return{tagName:"meta",attributes:e,exists:function(){return document.querySelector('meta[name="'+e.name+'"]')}}}e.exports.W=function(e){var t,n=document.head,i=n.querySelector("script"),l=[];return o.forEach(c),e.isIOS&&a.forEach(c),l;function c(e){e&&!e.exists()&&(t=function(e){if(e&&e.tagName){var t=document.createElement(e.tagName);return t.setAttribute(r.AFRAME_INJECTED,""),s(t,e.attributes)}}(e),t&&(i?i.parentNode.insertBefore(t,i):n.appendChild(t),l.push(t)))}}},8371:(e,t,n)=>{var i=n(7427).isIframed;function r(e){if(e.data&&"vr"===e.data.type)switch(e.data.data){case"enter":this.enterVR();break;case"exit":this.exitVR()}}e.exports=function(e){i()&&window.addEventListener("message",r.bind(e))}},8313:e=>{e.exports=[]},6147:(e,t,n)=>{var i=n(5928);e.exports=function(e){if(e.isMobile){var t=e.wakelock=new i;e.addEventListener("enter-vr",(function(){t.request()})),e.addEventListener("exit-vr",(function(){t.release()}))}}},7282:(e,t,n)=>{var i,r=n(7427),s=n(1551),o=r.debug,a=s.isValidDefaultValue,l=s.propertyTypes,c=o("core:schema:warn");function h(e){return"type"in e?"string"==typeof e.type:"default"in e}function d(e,t){var n,i,r=e.default,s=e.type;return e.type?"bool"===e.type?s="boolean":"float"===e.type&&(s="number"):s=void 0===r||"boolean"!=typeof r&&"number"!=typeof r?Array.isArray(r)?"array":"string":typeof r,(i=l[s])||c("Unknown property type for component `"+t+"`: "+s),n=!!e.parse,e.parse=e.parse||i.parse,e.stringify=e.stringify||i.stringify,e.equals=e.equals||i.equals,e.isCacheable=!0===e.isCacheable||i.isCacheable,e.type=s,"default"in e?n||a(s,r)||c("Default value `"+r+"` does not match type `"+s+"` in component `"+t+"`"):e.default=i.default,e}function u(e,t,n){return null!=e&&""!==e||(e=t.default,Array.isArray(e)&&(e=e.slice())),t.parse(e,t.default,n)}function p(e,t){return"object"!=typeof e?e:t&&null!==e?t.stringify(e):JSON.stringify(e)}e.exports.isSingleProperty=h,e.exports.process=function(e,t){var n;if(h(e))return d(e,t);for(n in e)e[n]=d(e[n],t);return e},e.exports.processPropertyDefinition=d,e.exports.parseProperties=(i=[],function(e,t,n,r,s){var o,a,l,h;for(a in i.length=0,n?e:t)n&&void 0===e[a]||i.push(a);if(null===e||"object"!=typeof e)return e;for(a in e)void 0===e[a]||t[a]||s||c("Unknown property `"+a+"` for component/system `"+r+"`.");for(o=0;o<i.length;o++){if(l=t[a=i[o]],h=e[a],!t[a])return;e[a]=u(h,l)}return e}),e.exports.parseProperty=u,e.exports.stringifyProperties=function(e,t){var n,i,r,s,o={};for(n in e)i=t[n],"object"==typeof(s=r=e[n])&&(s=p(r,i),i||c("Unknown component property: "+n)),void 0!==s&&(o[n]=s);return o},e.exports.stringifyProperty=p},5892:(e,t,n)=>{var i=n(7282).process,r=e.exports.shaders={},s=e.exports.shaderNames=[],o=n(9437),a=n(7427),l={array:"v3",color:"v3",int:"i",number:"f",map:"t",time:"f",vec2:"v2",vec3:"v3",vec4:"v4"},c=e.exports.Shader=function(){};c.prototype={schema:{},vertexShader:"void main() {gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);}",fragmentShader:"void main() {gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);}",init:function(e){return this.uniforms=this.initUniforms(),this.material=new(this.raw?o.RawShaderMaterial:o.ShaderMaterial)({uniforms:this.uniforms,glslVersion:this.raw||this.glsl3?o.GLSL3:null,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader}),this.material},initUniforms:function(){var e,t,n=this.schema,i={};for(e in n)"uniform"===n[e].is&&(t=l[n[e].type],i[e]={type:t,value:void 0});return i},update:function(e){var t,n,i=this.schema,r=this.uniforms;for(t in e)if(i[t]&&"uniform"===i[t].is)if("map"!==i[t].type)r[t].value=this.parseValue(i[t].type,e[t]),r[t].needsUpdate=!0;else{if(!r[t]||r[t].value===e[t])continue;n="_texture_"+t,this.setMapOnTextureLoad(r,t,n),a.material.updateMapMaterialFromData(n,t,this,e)}},parseValue:function(e,t){var n;switch(e){case"vec2":return new o.Vector2(t.x,t.y);case"vec3":return new o.Vector3(t.x,t.y,t.z);case"vec4":return new o.Vector4(t.x,t.y,t.z,t.w);case"color":return n=new o.Color(t),new o.Vector3(n.r,n.g,n.b);default:return t}},setMapOnTextureLoad:function(e,t,n){var i=this;this.el.addEventListener("materialtextureloaded",(function(){e[t].value=i.material[n],e[t].needsUpdate=!0}))}},e.exports.registerShader=function(e,t){var n,o={};if(Object.keys(t).forEach((function(e){o[e]={value:t[e],writable:!0}})),r[e])throw new Error("The shader "+e+" has already been registered");return((n=function(){c.call(this)}).prototype=Object.create(c.prototype,o)).name=e,n.prototype.constructor=n,r[e]={Shader:n,schema:i(n.prototype.schema)},s.push(e),n}},1876:(e,t,n)=>{var i=n(8190),r=n(7282),s=n(7427),o=n(2849),a=r.parseProperties,l=r.parseProperty,c=r.process,h=r.isSingleProperty,d=s.styleParser,u=e.exports.systems={},p=e.exports.System=function(e){var t=i&&i.components[this.name];this.el=e,this.sceneEl=e,t&&(t.Component.prototype.system=this),this.buildData(),this.init(),this.update({})};p.prototype={schema:{},init:function(){},update:function(e){},updateProperties:function(e){var t=this.data;Object.keys(r).length&&(this.buildData(e),this.update(t))},buildData:function(e){var t=this.schema;Object.keys(t).length&&(e=e||window.HTMLElement.prototype.getAttribute.call(this.sceneEl,this.name),h(t)?this.data=l(e,t):this.data=a(d.parse(e)||{},t,!1,this.name))},tick:void 0,tock:void 0,play:function(){},pause:function(){}},e.exports.registerSystem=function(e,t){var n,i,r={},a=s.findAllScenes(document);if(Object.keys(t).forEach((function(e){r[e]={value:t[e],writable:!0}})),u[e])throw new Error("The system `"+e+"` has been already registered. Check that you are not loading two versions of the same system or two different systems of the same name.");if(((i=function(e){p.call(this,e)}).prototype=Object.create(p.prototype,r)).name=e,i.prototype.constructor=i,i.prototype.schema=s.extend(c(i.prototype.schema)),u[e]=i,o.canInitializeElements)for(n=0;n<a.length;n++)a[n].initSystem(e)}},258:(e,t,n)=>{n(4530)},4530:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=new r.Vector3,o=new r.Vector3;i("pivot",{dependencies:["position"],schema:{type:"vec3"},init:function(){var e=this.data,t=this.el,n=t.object3D.parent,i=t.object3D,a=new r.Group;s.copy(i.position),o.copy(i.rotation),n.remove(i),a.add(i),n.add(a),t.object3D=a,i.position.set(-1*e.x,-1*e.y,-1*e.z),a.position.set(e.x+s.x,e.y+s.y,e.z+s.z),a.rotation.copy(i.rotation),i.rotation.set(0,0,0)}})},1028:(e,t,n)=>{var i=n(8190).components,r=n(5892).shaders,s=n(7427),o={};function a(e){var t=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();"fog"===e&&(t="material-fog"),"visible"===e&&(t="material-visible"),o[t]="material."+e}Object.keys(i.material.schema).forEach(a),Object.keys(r.standard.schema).forEach(a),e.exports=function(){return{defaultComponents:{material:{}},mappings:s.extend({},o)}}},196:(e,t,n)=>{n(5702),n(9099),n(1907),n(3200),n(3120),n(9357),n(7161),n(9172),n(9012),n(4814),n(542),n(2414),n(1199),n(6672)},5920:(e,t,n)=>{var i=n(2203).$,r=n(4056).P,s=n(8190).components,o=n(7427),a=o.debug,l=o.entity.setComponentProperty,c=a("extras:primitives:debug"),h=a("extras:primitives:warn"),d=a("extras:primitives:error"),u=e.exports.primitives={};function p(e,t,n){var i=o.entity.getComponentPropertyPath(e);i.constructor===Array?(n[i[0]]=n[i[0]]||{},n[i[0]][i[1]]=t.trim()):n[i]=t.trim()}e.exports.registerPrimitive=function(e,t){if(e=e.toLowerCase(),!i[e]){i[e]=!0,c("Registering <%s>",e),t.defaultAttributes&&h("The 'defaultAttributes' object is deprecated. Use 'defaultComponents' instead.");var n=t.mappings||{},a=class extends r{constructor(){super(),this.defaultComponentsFromPrimitive=t.defaultComponents||t.defaultAttributes||{},this.deprecated=t.deprecated||null,this.deprecatedMappings=t.deprecatedMappings||{},this.mappings=n,t.deprecated&&console.warn(t.deprecated),this.resolveMappingCollisions()}resolveMappingCollisions(){var e=this.mappings,t=this;Object.keys(e).forEach((function(n){var i;n!==n.toLowerCase()&&h("Mapping keys should be specified in lower case. The mapping key "+n+" may not be recognized"),s[n]&&(i=e[n].replace(".","-"),e[i]=e[n],delete e[n],console.warn("The primitive "+t.tagName.toLowerCase()+" has a mapping collision. The attribute "+n+" has the same name as a registered component and has been renamed to "+i))}))}getExtraComponents(){var e,t,n,i,r,s=this;for(t=o.clone(this.defaultComponentsFromPrimitive),(r=this.getAttribute("mixin"))&&(r=o.split(r.trim(),/\s+/)).forEach((function(e){var n,r,h=document.getElementById(e);if(h){var d=h.rawAttributeCache,u=h.componentCache;for(var A in d){if(i=s.mappings[A])return void p(i,d[A],t);A in u&&(t[A]=(n=t[A],r=u[A],a(n)?l(r):a(r)?l(n):c(n)&&c(r)?o.extendDeep(n,r):l(r)))}}})),n=0;n<this.attributes.length;n++)e=this.attributes[n],(i=this.mappings[e.name])&&p(i,e.value,t);return t;function a(e){return void 0===e}function l(e){return c(e)?o.extendDeep({},e):e}function c(e){return null!==e&&e.constructor===Object}}attributeChangedCallback(e,t,n){var i=this.mappings[e];e in this.deprecatedMappings&&console.warn(this.deprecatedMappings[e]),e&&i?l(this,i,n):super.attributeChangedCallback(e,t,n)}};return customElements.define(e,a),a.mappings=n,u[e]=a,a}d("Trying to register primitive "+e+" that has been already previously registered")},e.exports.definePrimitive=function(t,n,i){i=i||{},Object.keys(n).map((function(e){!function(e,t){var n=s[e].schema;Object.keys(n).map((function(n){var i=n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();void 0!==t[i]&&(i=e+"-"+n),t[i]=e+"."+n}))}(e,i)})),e.exports.registerPrimitive(t,o.extendDeep({},null,{defaultComponents:n,mappings:i}))}},5702:(e,t,n)=>{(0,n(5920).registerPrimitive)("a-camera",{defaultComponents:{camera:{},"look-controls":{},"wasd-controls":{},position:{x:0,y:1.6,z:0}},mappings:{active:"camera.active",far:"camera.far",fov:"camera.fov","look-controls-enabled":"look-controls.enabled",near:"camera.near","pointer-lock-enabled":"look-controls.pointerLockEnabled","wasd-controls-enabled":"wasd-controls.enabled","reverse-mouse-drag":"look-controls.reverseMouseDrag",zoom:"camera.zoom"}})},9099:(e,t,n)=>{var i=n(1028);(0,n(5920).registerPrimitive)("a-cursor",n(7427).extendDeep({},i(),{defaultComponents:{cursor:{},geometry:{primitive:"ring",radiusOuter:.016,radiusInner:.01,segmentsTheta:32},material:{color:"#000",shader:"flat",opacity:.8},position:{x:0,y:0,z:-1}},mappings:{far:"raycaster.far",fuse:"cursor.fuse","fuse-timeout":"cursor.fuseTimeout",interval:"raycaster.interval",objects:"raycaster.objects"}}))},1907:(e,t,n)=>{var i=n(1028);(0,n(5920).registerPrimitive)("a-curvedimage",n(7427).extendDeep({},i(),{defaultComponents:{geometry:{height:1,primitive:"cylinder",radius:2,segmentsRadial:48,thetaLength:270,openEnded:!0,thetaStart:0},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0,repeat:"-1 1"}},mappings:{height:"geometry.height","open-ended":"geometry.openEnded",radius:"geometry.radius",segments:"geometry.segmentsRadial",start:"geometry.thetaStart","theta-length":"geometry.thetaLength","theta-start":"geometry.thetaStart",width:"geometry.thetaLength"}}))},3200:(e,t,n)=>{(0,n(5920).registerPrimitive)("a-gltf-model",{mappings:{src:"gltf-model"}})},3120:(e,t,n)=>{var i=n(1028);(0,n(5920).registerPrimitive)("a-image",n(7427).extendDeep({},i(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}}))},9357:(e,t,n)=>{(0,n(5920).registerPrimitive)("a-light",{defaultComponents:{light:{}},mappings:{angle:"light.angle",color:"light.color","ground-color":"light.groundColor",decay:"light.decay",distance:"light.distance",intensity:"light.intensity",penumbra:"light.penumbra",type:"light.type",target:"light.target",envmap:"light.envMap","shadow-camera-automatic":"light.shadowCameraAutomatic"}})},7161:(e,t,n)=>{(0,n(5920).registerPrimitive)("a-link",{defaultComponents:{link:{visualAspectEnabled:!0}},mappings:{href:"link.href",image:"link.image",title:"link.title"}})},9172:(e,t,n)=>{var i=n(1028)();(0,n(5920).registerPrimitive)("a-obj-model",n(7427).extendDeep({},i,{defaultComponents:{"obj-model":{}},mappings:{src:"obj-model.obj",mtl:"obj-model.mtl"}}))},9012:(e,t,n)=>{var i=n(1028),r=n(5920).registerPrimitive,s=n(7427),o=n(6672);r("a-sky",s.extendDeep({},i(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",side:"back",shader:"flat",npot:!0},scale:"-1 1 1"},mappings:s.extendDeep({},o["a-sphere"].mappings)}))},4814:(e,t,n)=>{(0,n(5920).registerPrimitive)("a-sound",{defaultComponents:{sound:{}},mappings:{src:"sound.src",on:"sound.on",autoplay:"sound.autoplay",loop:"sound.loop",volume:"sound.volume"}})},542:(e,t,n)=>{(0,n(5920).definePrimitive)("a-text",{text:{anchor:"align",width:5}})},2414:(e,t,n)=>{var i=n(1028);(0,n(5920).registerPrimitive)("a-video",n(7427).extendDeep({},i(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}}))},1199:(e,t,n)=>{var i=n(1028);(0,n(5920).registerPrimitive)("a-videosphere",n(7427).extendDeep({},i(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",shader:"flat",side:"back",npot:!0},scale:"-1 1 1"},mappings:{radius:"geometry.radius","segments-height":"geometry.segmentsHeight","segments-width":"geometry.segmentsWidth"}}))},6672:(e,t,n)=>{var i=n(1028),r=n(7045).to,s=n(7045).Ls,o=n(5920).registerPrimitive,a=n(7427),l=e.exports={};function c(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}s.forEach((function(e){var t=r[e],n=c(e),s={};Object.keys(t.schema).forEach((function(e){s[c(e)]="geometry."+e}));var h="a-"+n,d=o(h,a.extendDeep({},i(),{defaultComponents:{geometry:{primitive:e}},mappings:s}));l[h]=d}))},5459:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("box",{schema:{depth:{default:1,min:0},height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"},segmentsDepth:{default:1,min:1,max:20,type:"int"}},init:function(e){this.geometry=new r.BoxGeometry(e.width,e.height,e.depth,e.segmentsWidth,e.segmentsHeight,e.segmentsDepth)}})},2328:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("circle",{schema:{radius:{default:1,min:0},segments:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new r.CircleGeometry(e.radius,e.segments,s(e.thetaStart),s(e.thetaLength))}})},4907:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("cone",{schema:{height:{default:1,min:0},openEnded:{default:!1},radiusBottom:{default:1,min:0},radiusTop:{default:.01,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new r.CylinderGeometry(e.radiusTop,e.radiusBottom,e.height,e.segmentsRadial,e.segmentsHeight,e.openEnded,s(e.thetaStart),s(e.thetaLength))}})},6362:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("cylinder",{schema:{height:{default:1,min:0},openEnded:{default:!1},radius:{default:1,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new r.CylinderGeometry(e.radius,e.radius,e.height,e.segmentsRadial,e.segmentsHeight,e.openEnded,s(e.thetaStart),s(e.thetaLength))}})},3934:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("dodecahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new r.DodecahedronGeometry(e.radius,e.detail)}})},4763:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("icosahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new r.IcosahedronGeometry(e.radius,e.detail)}})},6394:(e,t,n)=>{n(5459),n(2328),n(4907),n(6362),n(3934),n(4763),n(7049),n(6184),n(4110),n(7313),n(1394),n(6103),n(5553),n(7020)},7049:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("octahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new r.OctahedronGeometry(e.radius,e.detail)}})},6184:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("plane",{schema:{height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"}},init:function(e){this.geometry=new r.PlaneGeometry(e.width,e.height,e.segmentsWidth,e.segmentsHeight)}})},4110:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("ring",{schema:{radiusInner:{default:.8,min:0},radiusOuter:{default:1.2,min:0},segmentsPhi:{default:10,min:1,type:"int"},segmentsTheta:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new r.RingGeometry(e.radiusInner,e.radiusOuter,e.segmentsTheta,e.segmentsPhi,s(e.thetaStart),s(e.thetaLength))}})},7313:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("sphere",{schema:{radius:{default:1,min:0},phiLength:{default:360},phiStart:{default:0,min:0},thetaLength:{default:180,min:0},thetaStart:{default:0},segmentsHeight:{default:18,min:2,type:"int"},segmentsWidth:{default:36,min:3,type:"int"}},init:function(e){this.geometry=new r.SphereGeometry(e.radius,e.segmentsWidth,e.segmentsHeight,s(e.phiStart),s(e.phiLength),s(e.thetaStart),s(e.thetaLength))}})},1394:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("tetrahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new r.TetrahedronGeometry(e.radius,e.detail)}})},6103:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("torus",{schema:{arc:{default:360},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:36,min:2,type:"int"},segmentsTubular:{default:32,min:3,type:"int"}},init:function(e){this.geometry=new r.TorusGeometry(e.radius,2*e.radiusTubular,e.segmentsRadial,e.segmentsTubular,s(e.arc))}})},5553:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("torusKnot",{schema:{p:{default:2,min:1},q:{default:3,min:1},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:8,min:3,type:"int"},segmentsTubular:{default:100,min:3,type:"int"}},init:function(e){this.geometry=new r.TorusKnotGeometry(e.radius,2*e.radiusTubular,e.segmentsTubular,e.segmentsRadial,e.p,e.q)}})},7020:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=new r.Quaternion,o=new r.Vector3(0,0,1),a=new r.Vector2,l=new r.Vector2,c=new r.Vector2;i("triangle",{schema:{vertexA:{type:"vec3",default:{x:0,y:.5,z:0}},vertexB:{type:"vec3",default:{x:-.5,y:-.5,z:0}},vertexC:{type:"vec3",default:{x:.5,y:-.5,z:0}}},init:function(e){var t,n,i,h,d,u,p,A,f;(i=new r.Triangle).a.set(e.vertexA.x,e.vertexA.y,e.vertexA.z),i.b.set(e.vertexB.x,e.vertexB.y,e.vertexB.z),i.c.set(e.vertexC.x,e.vertexC.y,e.vertexC.z),n=i.getNormal(new r.Vector3),s.setFromUnitVectors(n,o),h=i.a.clone().applyQuaternion(s),d=i.b.clone().applyQuaternion(s),u=i.c.clone().applyQuaternion(s),a.set(Math.min(h.x,d.x,u.x),Math.min(h.y,d.y,u.y)),l.set(Math.max(h.x,d.x,u.x),Math.max(h.y,d.y,u.y)),c.set(0,0).subVectors(l,a),h=(new r.Vector2).subVectors(h,a).divide(c),d=(new r.Vector2).subVectors(d,a).divide(c),u=(new r.Vector2).subVectors(u,a).divide(c),t=this.geometry=new r.BufferGeometry,p=[i.a.x,i.a.y,i.a.z,i.b.x,i.b.y,i.b.z,i.c.x,i.c.y,i.c.z],A=[n.x,n.y,n.z,n.x,n.y,n.z,n.x,n.y,n.z],f=[h.x,h.y,d.x,d.y,u.x,u.y],t.setAttribute("position",new r.Float32BufferAttribute(p,3)),t.setAttribute("normal",new r.Float32BufferAttribute(A,3)),t.setAttribute("uv",new r.Float32BufferAttribute(f,2))}})},4497:(e,t,n)=>{var i=n(7427),r=i.debug,s=r("A-Frame:error"),o=r("A-Frame:warn");window.document.currentScript&&window.document.currentScript.parentNode!==window.document.head&&!window.debug&&o("Put the A-Frame <script> tag in the <head> of the HTML *before* the scene to ensure everything for A-Frame is properly registered before they are used from HTML."),window.cordova||"file:"!==window.location.protocol||s("This HTML file is currently being served via the file:// protocol. Assets, textures, and models WILL NOT WORK due to cross-origin policy! Please use a local or hosted server: https://aframe.io/docs/1.4.0/introduction/installation.html#use-a-local-server."),i.device.isBrowserEnvironment&&(n(7180),n(9379));var a=n(5076).aQ,l=n(8190).components,c=n(8190).registerComponent,h=n(7045).Az,d=n(5920).registerPrimitive,u=n(5892).registerShader,p=n(1876).registerSystem,A=n(5892).shaders,f=n(1876).systems,m=window.THREE=n(9437),g=n(2849),v=n(8330);n(8850),n(6394),n(344),n(3072);var y=n(2203).a,E=n(4056).P;n(842),n(6178),n(5890),n(258),n(196),console.log("A-Frame Version: 1.6.0 (Date 2025-01-10, Commit #24c2bad)"),console.log("THREE Version (https://github.com/supermedium/three.js):",m.REVISION),window.AFRAME_ASYNC||g.waitForDocumentReadyState(),e.exports=window.AFRAME={AComponent:n(8190).Component,AEntity:E,ANode:y,ANIME:n(4635).A,AScene:a,components:l,coreComponents:Object.keys(l),geometries:n(7045).to,registerComponent:c,registerGeometry:h,registerPrimitive:d,registerShader:u,registerSystem:p,primitives:{getMeshMixin:n(1028),primitives:n(5920).primitives},scenes:n(8313),schema:n(7282),shaders:A,systems:f,emitReady:g.emitReady,THREE:m,utils:i,version:v.version}},8132:e=>{window.aframeStats=function(e){var t=null,n=e;return{update:function(){var e;t("te").set((e=n.querySelectorAll("*"),Array.prototype.slice.call(e).filter((function(e){return e.isEntity})),e.length)),window.performance.getEntriesByName&&t("lt").set(window.performance.getEntriesByName("render-started")[0].startTime.toFixed(0))},start:function(){},end:function(){},attach:function(e){t=e},values:{te:{caption:"Entities"},lt:{caption:"Load Time"}},groups:[{caption:"A-Frame",values:["te","lt"]}],fractions:[]}},e.exports={aframeStats:window.aframeStats}},9437:(e,t,n)=>{var i=n(7496).A;n.g.THREE=i,n(7469),i.Cache&&(i.Cache.enabled=!0),e.exports=i},2621:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437),s=n(7427);function o(e,t){return t.color.set(e.color),t.fog=e.fog,t.wireframe=e.wireframe,t.toneMapped=e.toneMapped,t.wireframeLinewidth=e.wireframeLinewidth,t}e.exports.Shader=i("flat",{schema:{color:{type:"color"},fog:{default:!0},height:{default:256},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},src:{type:"map"},width:{default:512},wireframe:{default:!1},wireframeLinewidth:{default:2},toneMapped:{default:!0}},init:function(e){this.materialData={color:new r.Color},o(e,this.materialData),this.material=new r.MeshBasicMaterial(this.materialData)},update:function(e){this.updateMaterial(e),s.material.updateMap(this,e)},updateMaterial:function(e){var t;for(t in o(e,this.materialData),this.materialData)this.material[t]=this.materialData[t]}})},344:(e,t,n)=>{n(2621),n(9583),n(8318),n(6419),n(1152),n(7002)},1152:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437),s=["#include <common>","#include <fog_pars_vertex>","#include <logdepthbuf_pars_vertex>","out vec2 vUV;","void main(void) {"," vUV = uv;"," #include <begin_vertex>"," #include <project_vertex>"," #include <logdepthbuf_vertex>"," #include <fog_vertex>","}"].join("\n"),o=["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","uniform bool negate;","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","float median(float r, float g, float b) {"," return max(min(r, g), min(max(r, g), b));","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec3 sampleColor = texture(map, vUV).rgb;"," if (negate) { sampleColor = 1.0 - sampleColor; }"," float sigDist = median(sampleColor.r, sampleColor.g, sampleColor.b) - 0.5;"," float alpha = clamp(sigDist / fwidth(sigDist) + 0.5, 0.0, 1.0);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(vUV) + dFdy(vUV));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," // Do modified alpha test."," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * (sigDist + 0.5);"," }"," // Do modified alpha test."," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," gl_FragColor = vec4(color.xyz, alpha * opacity);"," #include <logdepthbuf_fragment>"," #include <tonemapping_fragment>"," #include <colorspace_fragment>"," #include <fog_fragment>","}"].join("\n");e.exports.Shader=i("msdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},negate:{type:"boolean",is:"uniform",default:!0},opacity:{type:"number",is:"uniform",default:1}},vertexShader:s,fragmentShader:o,init:function(){return this.uniforms=r.UniformsUtils.merge([r.UniformsLib.fog,this.initUniforms()]),this.material=new r.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,fog:!0}),this.material}})},8318:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437),s=n(7427);function o(e,t){switch(t.color.set(e.color),t.specular.set(e.specular),t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity,t.fog=e.fog,t.transparent=e.transparent,t.wireframe=e.wireframe,t.wireframeLinewidth=e.wireframeLinewidth,t.shininess=e.shininess,t.flatShading=e.flatShading,t.wireframe=e.wireframe,t.wireframeLinewidth=e.wireframeLinewidth,t.reflectivity=e.reflectivity,t.refractionRatio=e.refractionRatio,e.combine){case"mix":t.combine=r.MixOperation;break;case"multiply":t.combine=r.MultiplyOperation;break;case"add":t.combine=r.AddOperation}return e.normalMap&&(t.normalScale=e.normalScale),e.ambientOcclusionMap&&(t.aoMapIntensity=e.ambientOcclusionMapIntensity),e.bumpMap&&(t.bumpScale=e.bumpMapScale),e.displacementMap&&(t.displacementScale=e.displacementScale,t.displacementBias=e.displacementBias),t}e.exports.Shader=i("phong",{schema:{color:{type:"color"},emissive:{type:"color",default:"black"},emissiveIntensity:{default:1},specular:{type:"color",default:"#111111"},transparent:{default:!1},fog:{default:!0},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},src:{type:"map"},envMap:{default:""},sphericalEnvMap:{type:"map"},shininess:{default:30},flatShading:{default:!1},wireframe:{default:!1},wireframeLinewidth:{default:2},combine:{oneOF:["multiply","mix","add"],default:"mix"},reflectivity:{default:.9},refractionRatio:{default:.98},refract:{default:!1},normalMap:{type:"map"},normalScale:{type:"vec2",default:{x:1,y:1}},normalTextureOffset:{type:"vec2"},normalTextureRepeat:{type:"vec2",default:{x:1,y:1}},ambientOcclusionMap:{type:"map"},ambientOcclusionMapIntensity:{default:1},displacementMap:{type:"map"},displacementScale:{default:1},displacementBias:{default:.5},displacementTextureOffset:{type:"vec2"},displacementTextureRepeat:{type:"vec2",default:{x:1,y:1}},bumpMap:{type:"map"},bumpMapScale:{default:1},bumpTextureOffset:{type:"vec2"},bumpTextureRepeat:{type:"vec2",default:{x:1,y:1}}},init:function(e){this.materialData={color:new r.Color,specular:new r.Color,emissive:new r.Color},o(e,this.materialData),this.material=new r.MeshPhongMaterial(this.materialData);var t=this.el.sceneEl;Object.defineProperty(this.material,"envMap",{get:function(){return this._envMap||t.object3D.environment},set:function(e){this._envMap=e}})},update:function(e){this.updateMaterial(e),s.material.updateMap(this,e),s.material.updateDistortionMap("normal",this,e),s.material.updateDistortionMap("displacement",this,e),s.material.updateDistortionMap("ambientOcclusion",this,e),s.material.updateDistortionMap("bump",this,e),s.material.updateEnvMap(this,e)},updateMaterial:function(e){var t;for(t in o(e,this.materialData),this.materialData)this.material[t]=this.materialData[t]}})},6419:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437),s=["#include <common>","#include <fog_pars_vertex>","#include <logdepthbuf_pars_vertex>","out vec2 vUV;","void main(void) {"," vUV = uv;"," #include <begin_vertex>"," #include <project_vertex>"," #include <logdepthbuf_vertex>"," #include <fog_vertex>","}"].join("\n"),o=["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","float contour(float width, float value) {"," return smoothstep(0.5 - value, 0.5 + value, width);","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec2 uv = vUV;"," vec4 texColor = texture(map, uv);"," float dist = texColor.a;"," float width = fwidth(dist);"," float alpha = contour(dist, width);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(uv) + dFdy(uv));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * dist;"," }"," if (isBigEnough <= BIG_ENOUGH) {"," vec4 box = vec4 (uv - duv, uv + duv);"," alpha = (alpha + 0.5 * ("," contour(texture(map, box.xy).a, width)"," + contour(texture(map, box.zw).a, width)"," + contour(texture(map, box.xw).a, width)"," + contour(texture(map, box.zy).a, width)"," )) / 3.0;"," }"," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," gl_FragColor = vec4(color, opacity * alpha);"," #include <logdepthbuf_fragment>"," #include <tonemapping_fragment>"," #include <colorspace_fragment>"," #include <fog_fragment>","}"].join("\n");e.exports.Shader=i("sdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},opacity:{type:"number",is:"uniform",default:1}},vertexShader:s,fragmentShader:o,init:function(){return this.uniforms=r.UniformsUtils.merge([r.UniformsLib.fog,this.initUniforms()]),this.material=new r.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,fog:!0}),this.material}})},7002:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437);e.exports.Shader=i("shadow",{schema:{opacity:{default:.5},transparent:{default:!0},alphaToCoverage:{default:!0}},init:function(e){this.material=new r.ShadowMaterial},update:function(e){this.material.opacity=e.opacity,this.material.alphaToCoverage=e.alphaToCoverage,this.material.transparent=e.transparent}})},9583:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437),s=n(7427);function o(e,t){return t.color.set(e.color),t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity,t.fog=e.fog,t.metalness=e.metalness,t.roughness=e.roughness,t.wireframe=e.wireframe,t.wireframeLinewidth=e.wireframeLinewidth,e.normalMap&&(t.normalScale=e.normalScale),e.ambientOcclusionMap&&(t.aoMapIntensity=e.ambientOcclusionMapIntensity),e.displacementMap&&(t.displacementScale=e.displacementScale,t.displacementBias=e.displacementBias),t}e.exports.Shader=i("standard",{schema:{ambientOcclusionMap:{type:"map"},ambientOcclusionMapIntensity:{default:1},ambientOcclusionTextureOffset:{type:"vec2"},ambientOcclusionTextureRepeat:{type:"vec2",default:{x:1,y:1}},color:{type:"color"},displacementMap:{type:"map"},displacementScale:{default:1},displacementBias:{default:.5},displacementTextureOffset:{type:"vec2"},displacementTextureRepeat:{type:"vec2",default:{x:1,y:1}},emissive:{type:"color",default:"#000"},emissiveIntensity:{default:1},envMap:{default:""},fog:{default:!0},height:{default:256},metalness:{default:0,min:0,max:1},metalnessMap:{type:"map"},metalnessTextureOffset:{type:"vec2"},metalnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},normalMap:{type:"map"},normalScale:{type:"vec2",default:{x:1,y:1}},normalTextureOffset:{type:"vec2"},normalTextureRepeat:{type:"vec2",default:{x:1,y:1}},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},roughness:{default:.5,min:0,max:1},roughnessMap:{type:"map"},roughnessTextureOffset:{type:"vec2"},roughnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},sphericalEnvMap:{type:"map"},src:{type:"map"},width:{default:512},wireframe:{default:!1},wireframeLinewidth:{default:2}},init:function(e){this.materialData={color:new r.Color,emissive:new r.Color},o(e,this.materialData),this.material=new r.MeshStandardMaterial(this.materialData)},update:function(e){this.updateMaterial(e),s.material.updateMap(this,e),s.material.updateDistortionMap("normal",this,e),s.material.updateDistortionMap("displacement",this,e),s.material.updateDistortionMap("ambientOcclusion",this,e),s.material.updateDistortionMap("metalness",this,e),s.material.updateDistortionMap("roughness",this,e),s.material.updateEnvMap(this,e)},updateMaterial:function(e){var t,n=this.material;for(t in o(e,this.materialData),this.materialData)n[t]=this.materialData[t]}})},409:(e,t,n)=>{var i=n(1343),r=n(1876).registerSystem,s="data-aframe-default-camera";e.exports.System=r("camera",{init:function(){this.activeCameraEl=null,this.render=this.render.bind(this),this.unwrapRender=this.unwrapRender.bind(this),this.wrapRender=this.wrapRender.bind(this),this.initialCameraFound=!1,this.numUserCameras=0,this.numUserCamerasChecked=0,this.setupInitialCamera()},setupInitialCamera:function(){var e,t,n=this.sceneEl,i=this;if(!n.camera||n.camera.el.getAttribute("camera").spectator)if((e=n.querySelectorAll("a-camera, :not(a-mixin)[camera]")).length)for(this.numUserCameras=e.length,t=0;t<e.length;t++)e[t].addEventListener("object3dset",(function(e){"camera"===e.detail.type&&i.checkUserCamera(this)})),e[t].isNode?e[t].load():e[t].addEventListener("nodeready",(function(){this.load()}));else this.createDefaultCamera();else n.emit("cameraready",{cameraEl:n.camera.el})},checkUserCamera:function(e){var t,n=this.el.sceneEl;this.numUserCamerasChecked++,this.initialCameraFound||((t=e.getAttribute("camera")).active&&!t.spectator?(this.initialCameraFound=!0,n.camera=e.getObject3D("camera"),n.emit("cameraready",{cameraEl:e})):this.numUserCamerasChecked===this.numUserCameras&&this.createDefaultCamera())},createDefaultCamera:function(){var e,t=this.sceneEl;(e=document.createElement("a-entity")).setAttribute("camera",{active:!0}),e.setAttribute("position",{x:0,y:i.DEFAULT_CAMERA_HEIGHT,z:0}),e.setAttribute("wasd-controls",""),e.setAttribute("look-controls",""),e.setAttribute(i.AFRAME_INJECTED,""),e.addEventListener("object3dset",(function(n){"camera"===n.detail.type&&(t.camera=n.detail.object,t.emit("cameraready",{cameraEl:e}))})),t.appendChild(e)},disableActiveCamera:function(){var e;(e=this.sceneEl.querySelectorAll(":not(a-mixin)[camera]"))[e.length-1].setAttribute("camera","active",!0)},setActiveCamera:function(e){var t,n,i,r,o=this.activeCameraEl,a=this.sceneEl;if((r=e.getObject3D("camera"))&&e!==this.activeCameraEl){var l=a.querySelector("["+s+"]");for(e!==(l&&l.querySelector(":not(a-mixin)[camera]"))&&function(e){var t;e.camera&&(t=e.querySelector("["+s+"]"))&&e.removeChild(t)}(a),this.activeCameraEl=e,this.activeCameraEl.play(),a.camera=r,o&&o.setAttribute("camera","active",!1),n=a.querySelectorAll(":not(a-mixin)[camera]"),i=0;i<n.length;i++)(t=n[i]).isEntity&&e!==t&&(t.setAttribute("camera","active",!1),t.pause());a.emit("camera-set-active",{cameraEl:e})}},setSpectatorCamera:function(e){var t,n=this.spectatorCameraEl,i=this.sceneEl;e.getObject3D("camera")&&e!==this.spectatorCameraEl&&(n&&n.setAttribute("camera","spectator",!1),t=this.spectatorCameraEl=e,i.addEventListener("enter-vr",this.wrapRender),i.addEventListener("exit-vr",this.unwrapRender),t.setAttribute("camera","active",!1),t.play(),i.emit("camera-set-spectator",{cameraEl:e}))},disableSpectatorCamera:function(){this.spectatorCameraEl=void 0},wrapRender:function(){this.spectatorCameraEl&&!this.originalRender&&(this.originalRender=this.sceneEl.renderer.render,this.sceneEl.renderer.render=this.render)},unwrapRender:function(){this.originalRender&&(this.sceneEl.renderer.render=this.originalRender,this.originalRender=void 0)},render:function(e,t){var n,i,r=this.sceneEl;n=r.renderer.xr.enabled,this.originalRender.call(r.renderer,e,t),this.spectatorCameraEl&&!r.isMobile&&n&&(i=this.spectatorCameraEl.components.camera.camera,r.renderer.xr.enabled=!1,this.originalRender.call(r.renderer,e,i),r.renderer.xr.enabled=n)}})},810:(e,t,n)=>{var i=n(7045).to,r=n(1876).registerSystem;function s(e){var t=e.primitive,n=i[t]&&i[t].Geometry,r=new n;if(!n)throw new Error("Unknown geometry `"+t+"`");return r.init(e),r.geometry}e.exports.System=r("geometry",{init:function(){this.cache={},this.cacheCount={}},clearCache:function(){this.cache={},this.cacheCount={}},getOrCreateGeometry:function(e){var t,n,i=this.cache;return e.skipCache?s(e):(t=i[n=this.hash(e)],function(e,t){e[t]=void 0===e[t]?1:e[t]+1}(this.cacheCount,n),t||(t=s(e),i[n]=t,t))},unuseGeometry:function(e){var t,n=this.cache,i=this.cacheCount;e.skipCache||n[t=this.hash(e)]&&(function(e,t){e[t]--}(i,t),i[t]>0||(n[t].dispose(),delete n[t],delete i[t]))},hash:function(e){return JSON.stringify(e)}})},4211:(e,t,n)=>{var i=n(1876).registerSystem,r=n(9437);e.exports.System=i("gltf-model",{schema:{dracoDecoderPath:{default:"https://www.gstatic.com/draco/versioned/decoders/1.5.7/"},basisTranscoderPath:{default:""},meshoptDecoderPath:{default:""}},init:function(){this.update()},update:function(){var e,t=this.data.dracoDecoderPath,n=this.data.basisTranscoderPath,i=this.data.meshoptDecoderPath;!this.dracoLoader&&t&&(this.dracoLoader=new r.DRACOLoader,this.dracoLoader.setDecoderPath(t)),!this.ktx2Loader&&n&&(this.ktx2Loader=new r.KTX2Loader,this.ktx2Loader.setTranscoderPath(n).detectSupport(this.el.renderer)),!this.meshoptDecoder&&i&&(this.meshoptDecoder=(e=i,new Promise((function(t,n){var i=document.createElement("script");document.body.appendChild(i),i.onload=t,i.onerror=n,i.async=!0,i.src=e}))).then((function(){return window.MeshoptDecoder.ready})).then((function(){return window.MeshoptDecoder})))},getDRACOLoader:function(){return this.dracoLoader},getKTX2Loader:function(){return this.ktx2Loader},getMeshoptDecoder:function(){return this.meshoptDecoder}})},3072:(e,t,n)=>{n(409),n(810),n(4211),n(6540),n(1855),n(2382),n(6769),n(5426),n(2941),n(6696)},6540:(e,t,n)=>{var i=n(1876).registerSystem,r=n(1343),s="data-aframe-default-light";e.exports.System=i("light",{schema:{defaultLightsEnabled:{default:!0}},init:function(){this.defaultLights=!1,this.userDefinedLights=!1,this.sceneEl.addEventListener("loaded",this.setupDefaultLights.bind(this))},registerLight:function(e){e.hasAttribute(s)||(this.removeDefaultLights(),this.userDefinedLights=!0)},removeDefaultLights:function(){var e,t=this.sceneEl;if(this.defaultLights){e=document.querySelectorAll("["+s+"]");for(var n=0;n<e.length;n++)t.removeChild(e[n]);this.defaultLights=!1}},setupDefaultLights:function(){var e,t,n=this.sceneEl;this.userDefinedLights||this.defaultLights||!this.data.defaultLightsEnabled||((e=document.createElement("a-entity")).setAttribute("light",{color:"#BBB",type:"ambient"}),e.setAttribute(s,""),e.setAttribute(r.AFRAME_INJECTED,""),n.appendChild(e),(t=document.createElement("a-entity")).setAttribute("light",{color:"#FFF",intensity:1.884,castShadow:!0}),t.setAttribute("position",{x:-.5,y:1,z:1}),t.setAttribute(s,""),t.setAttribute(r.AFRAME_INJECTED,""),n.appendChild(t),this.defaultLights=!0)}})},1855:(e,t,n)=>{var i=n(1876).registerSystem,r=n(9437),s=n(7427),o=n(8066).setTextureProperties,a=n(8066).createCompatibleTexture,l=s.debug,c=l("components:texture:error"),h=l("components:texture:warn"),d=new r.ImageLoader;e.exports.System=i("material",{init:function(){this.materials={},this.sourceCache={}},clearTextureSourceCache:function(){this.sourceCache={}},loadTexture:function(e,t,n){this.loadTextureSource(e,(function(e){var i=a(e);o(i,t),n(i)}))},loadTextureSource:function(e,t){var n=this,i=this.sourceCache,o=this.hash(e);function a(e){i[o]=Promise.resolve(e),i[o].then(t)}i[o]?i[o].then(t):"CANVAS"!==e.tagName?a(new Promise((function(t,i){s.srcLoader.validateSrc(e,(function(e){n.loadImage(e,t)}),(function(e){n.loadVideo(e,t)}))}))):a(new r.Source(e))},loadCubeMapTexture:function(e,t){var n=this,i=0,s=new r.CubeTexture;function o(r){n.loadTextureSource(e[r],(function(e){s.images[r]=e.data,6==++i&&(s.needsUpdate=!0,t(s))}))}if(s.colorSpace=r.SRGBColorSpace,6===e.length)for(var a=0;a<e.length;a++)o(a);else h("Cube map texture requires exactly 6 sources, got only %s sources",e.length)},loadImage:function(e,t){t("string"==typeof e?function(e){return new Promise((function(t,n){d.load(e,(function(e){t(new r.Source(e))}),(function(){}),(function(e){c("`$s` could not be fetched (Error code: %s; Response: %s)",e.status,e.statusText)}))}))}(e):new r.Source(e))},loadVideo:function(e,t){var n;"string"!=typeof e&&function(e){e.autoplay=e.hasAttribute("autoplay")&&"false"!==e.getAttribute("autoplay"),e.controls=e.hasAttribute("controls")&&"false"!==e.getAttribute("controls"),"false"===e.getAttribute("loop")&&e.removeAttribute("loop"),"false"===e.getAttribute("preload")&&(e.preload="none"),e.crossOrigin=e.crossOrigin||"anonymous",e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline","")}(n=e),n=n||function(e){var t=document.createElement("video");return t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline",""),t.autoplay=!0,t.loop=!0,t.crossOrigin="anonymous",t.addEventListener("error",(function(){h("`%s` is not a valid video",e)}),!0),t.src=e,t}(e),t(new r.Source(n))},hash:function(e){return e.tagName&&(e.id||e.src)||e},registerMaterial:function(e){this.materials[e.uuid]=e},unregisterMaterial:function(e){delete this.materials[e.uuid]}})},2382:(e,t,n)=>{(0,n(1876).registerSystem)("obb-collider",{schema:{showColliders:{default:!1}},init:function(){this.collisions=[],this.colliderEls=[]},addCollider:function(e){this.colliderEls.push(e),this.data.showColliders?e.components["obb-collider"].showCollider():e.components["obb-collider"].hideCollider(),this.tick=this.detectCollisions},removeCollider:function(e){var t=this.colliderEls,n=t.indexOf(e);e.components["obb-collider"].hideCollider(),n>-1&&t.splice(n,1),0===t.length&&(this.tick=void 0)},registerCollision:function(e,t){var n=this.collisions,i=!1,r=e.obb,s=t.obb,o=e.renderColliderMesh,a=t.renderColliderMesh;o&&o.material.color.set(16711680),a&&a.material.color.set(16711680);for(var l=0;l<n.length;l++)if(n[l].componentA.obb===r&&n[l].componentB.obb===s||n[l].componentA.obb===s&&n[l].componentB.obb===r){i=!0,n[l].detected=!0;break}i||(n.push({componentA:e,componentB:t,detected:!0}),e.el.emit("obbcollisionstarted",{trackedObject3D:e.trackedObject3D,withEl:t.el}),t.el.emit("obbcollisionstarted",{trackedObject3D:t.trackedObject3D,withEl:e.el}))},resetCollisions:function(){for(var e=this.collisions,t=0;t<e.length;t++)e[t].detected=!1},clearCollisions:function(){for(var e,t,n,i,r=this.collisions,s=[],o=0;o<r.length;o++)r[o].detected?s.push(r[o]):(e=r[o].componentA,t=r[o].componentB,n=e.renderColliderMesh,i=t.renderColliderMesh,n&&n.material.color.set(65280),e.el.emit("obbcollisionended",{trackedObject3D:this.trackedObject3D,withEl:t.el}),i&&i.material.color.set(65280),t.el.emit("obbcollisionended",{trackedObject3D:this.trackedObject3D,withEl:e.el}));this.collisions=s},detectCollisions:function(){var e,t,n,i,r=this.colliderEls;if(!(r.length<2)){this.resetCollisions();for(var s=0;s<r.length;s++)if(n=r[s].components["obb-collider"],0!==(e=r[s].components["obb-collider"].obb).halfSize.x&&0!==e.halfSize.y&&0!==e.halfSize.z)for(var o=s+1;o<r.length;o++)0!==(t=(i=r[o].components["obb-collider"]).obb).halfSize.x&&0!==t.halfSize.y&&0!==t.halfSize.z&&e.intersectsOBB(t)&&this.registerCollision(n,i);this.clearCollisions()}}})},6769:(e,t,n)=>{var i=n(1876).registerSystem,r=n(7427),s=n(9437),o=(0,r.debug)("components:renderer:warn");function a(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z-t.z}function l(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder-t.renderOrder}function c(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:t.z-e.z}e.exports.System=i("renderer",{schema:{antialias:{default:"auto",oneOf:["true","false","auto"]},highRefreshRate:{default:r.device.isOculusBrowser()},logarithmicDepthBuffer:{default:"auto",oneOf:["true","false","auto"]},maxCanvasWidth:{default:-1},maxCanvasHeight:{default:-1},multiviewStereo:{default:!1},exposure:{default:1,if:{toneMapping:["ACESFilmic","linear","reinhard","cineon","AgX","neutral"]}},toneMapping:{default:"no",oneOf:["no","ACESFilmic","linear","reinhard","cineon","AgX","neutral"]},precision:{default:"high",oneOf:["high","medium","low"]},anisotropy:{default:1},sortTransparentObjects:{default:!1},colorManagement:{default:!0},alpha:{default:!0},stencil:{default:!1},foveationLevel:{default:1}},init:function(){var e=this.data,t=this.el,n=this.data.toneMapping.charAt(0).toUpperCase()+this.data.toneMapping.slice(1),i=t.renderer;i.toneMapping=s[n+"ToneMapping"],s.Texture.DEFAULT_ANISOTROPY=e.anisotropy,s.ColorManagement.enabled=e.colorManagement,i.outputColorSpace=e.colorManagement?s.SRGBColorSpace:s.LinearSRGBColorSpace,t.hasAttribute("antialias")&&o('Component `antialias` is deprecated. Use `renderer="antialias: true"` instead.'),t.hasAttribute("logarithmicDepthBuffer")&&o('Component `logarithmicDepthBuffer` is deprecated. Use `renderer="logarithmicDepthBuffer: true"` instead.'),i.sortObjects=!0,i.setOpaqueSort(a)},update:function(){var e=this.data,t=this.el.renderer,n=this.data.toneMapping.charAt(0).toUpperCase()+this.data.toneMapping.slice(1);t.toneMapping=s[n+"ToneMapping"],t.toneMappingExposure=e.exposure,t.xr.setFoveation(e.foveationLevel),e.sortObjects&&o('`sortObjects` property is deprecated. Use `renderer="sortTransparentObjects: true"` instead.'),e.sortTransparentObjects?t.setTransparentSort(c):t.setTransparentSort(l)},applyColorCorrection:function(e){this.data.colorManagement&&e&&e.isTexture&&e.colorSpace!==s.SRGBColorSpace&&(e.colorSpace=s.SRGBColorSpace,e.needsUpdate=!0)},setWebXRFrameRate:function(e){var t,n=this.data,i=e.supportedFrameRates;i&&e.updateTargetFrameRate&&(t=i.includes(90)?n.highRefreshRate?90:72:n.highRefreshRate?72:60,e.updateTargetFrameRate(t).catch((function(e){console.warn("failed to set target frame rate of "+t+". Error info: "+e)})))}}),e.exports.sortFrontToBack=a,e.exports.sortRenderOrderOnly=l,e.exports.sortBackToFront=c},5426:(e,t,n)=>{var i=n(1876).registerSystem,r=n(9437),s={basic:r.BasicShadowMap,pcf:r.PCFShadowMap,pcfsoft:r.PCFSoftShadowMap};e.exports.System=i("shadow",{schema:{enabled:{default:!0},autoUpdate:{default:!0},type:{default:"pcf",oneOf:["basic","pcf","pcfsoft"]}},init:function(){var e=this.sceneEl,t=this.data;this.shadowMapEnabled=!1,e.renderer.shadowMap.type=s[t.type],e.renderer.shadowMap.autoUpdate=t.autoUpdate},update:function(e){e.enabled!==this.data.enabled&&this.setShadowMapEnabled(this.shadowMapEnabled)},setShadowMapEnabled:function(e){var t=this.sceneEl,n=this.sceneEl.renderer;this.shadowMapEnabled=e;var i=this.data.enabled&&this.shadowMapEnabled;n&&i!==n.shadowMap.enabled&&(n.shadowMap.enabled=i,function(e){e.hasLoaded&&e.object3D.traverse((function(e){if(e.material)for(var t=Array.isArray(e.material)?e.material:[e.material],n=0;n<t.length;n++)t[n].needsUpdate=!0}))}(t))}})},2941:(e,t,n)=>{var i=n(1876).registerSystem;n(7427),e.exports.System=i("tracked-controls",{init:function(){this.controllers=[],this.onInputSourcesChange=this.onInputSourcesChange.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.el.addEventListener("enter-vr",this.onEnterVR),this.onExitVR=this.onExitVR.bind(this),this.el.addEventListener("exit-vr",this.onExitVR)},onEnterVR:function(){this.el.xrSession.addEventListener("inputsourceschange",this.onInputSourcesChange)},onExitVR:function(){this.referenceSpace=void 0,this.controllers=[],this.el.emit("controllersupdated",void 0,!1)},onInputSourcesChange:function(){var e=this,t=this.el.xrSession,n=this.el.sceneEl.systems.webxr.sessionReferenceSpaceType;t.requestReferenceSpace(n).then((function(t){e.referenceSpace=t})).catch((function(t){throw e.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(n,'tracked-controls uses reference space "'+n+'".'),t})),this.controllers=t.inputSources,this.el.emit("controllersupdated",void 0,!1)}})},6696:(e,t,n)=>{var i=n(1876).registerSystem,r=n(7427).debug("systems:webxr:warn");e.exports.System=i("webxr",{schema:{referenceSpaceType:{type:"string",default:"local-floor"},requiredFeatures:{type:"array",default:["local-floor"]},optionalFeatures:{type:"array",default:["bounded-floor"]},overlayElement:{type:"selector"}},update:function(){var e=this.data;this.sessionConfiguration={requiredFeatures:e.requiredFeatures,optionalFeatures:e.optionalFeatures},this.sessionReferenceSpaceType=e.referenceSpaceType,e.overlayElement&&(e.overlayElement.classList.remove("a-dom-overlay"),e.optionalFeatures.includes("dom-overlay")||(e.optionalFeatures.push("dom-overlay"),this.el.setAttribute("webxr",e)),this.warnIfFeatureNotRequested("dom-overlay"),this.sessionConfiguration.domOverlay={root:e.overlayElement},e.overlayElement.classList.add("a-dom-overlay"))},wasFeatureRequested:function(e){return"viewer"===e||"local"===e||!(!this.sessionConfiguration.requiredFeatures.includes(e)&&!this.sessionConfiguration.optionalFeatures.includes(e))},warnIfFeatureNotRequested:function(e,t){this.wasFeatureRequested(e)||r((t?t+" ":"")+'Please add the feature "'+e+"\" to a-scene's webxr system options in requiredFeatures/optionalFeatures.")}})},676:(e,t,n)=>{var i=n(8940)("utils:coordinates:warn"),r=["x","y","z","w"],s=/^\s*((-?\d*\.{0,1}\d+(e-?\d+)?)\s+){2,3}(-?\d*\.{0,1}\d+(e-?\d+)?)\s*$/;e.exports.regex=s;var o=/\s+/g;function a(e){return s.test(e)}function l(e){return null!=e&&e.constructor===String?parseFloat(e,10):e}e.exports.parse=function(e,t,n){var i,s,a,c,h,d,u,p,A=n&&"object"==typeof n?n:{};if(e&&e instanceof Object)return h=void 0===e.x?t&&t.x:e.x,d=void 0===e.y?t&&t.y:e.y,u=void 0===e.z?t&&t.z:e.z,p=void 0===e.w?t&&t.w:e.w,null!=h&&(A.x=l(h)),null!=d&&(A.y=l(d)),null!=u&&(A.z=l(u)),null!=p&&(A.w=l(p)),A;if(null==e)return"object"==typeof t?Object.assign(A,t):t;for(i=e.trim().split(o),c=0;c<r.length;c++)if(a=r[c],i[c])A[a]=parseFloat(i[c],10);else{if(void 0===(s=t&&t[a]))continue;A[a]=l(s)}return A},e.exports.stringify=function(e){var t;return"object"!=typeof e?e:(t=e.x+" "+e.y,null!=e.z&&(t+=" "+e.z),null!=e.w&&(t+=" "+e.w),t)},e.exports.equals=function(e,t){return"object"!=typeof e||"object"!=typeof t?e===t:e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},e.exports.isCoordinates=a,e.exports.isCoordinate=function(e){return i("`AFRAME.utils.isCoordinate` has been renamed to `AFRAME.utils.isCoordinates`"),a(e)},e.exports.toVector3=function(e){return new THREE.Vector3(e.x,e.y,e.z)}},8940:(e,t,n)=>{var i=n(8878),r=n(9485).isBrowserEnvironment,s={colors:{debug:"gray",error:"red",info:"gray",warn:"orange"}};i.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" "),this.useColors){var t;this.color=(t=function(e){var t=e.split(":");return t[t.length-1]}(this.namespace),s.colors&&s.colors[t]||null);var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,r=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(r=i))})),e.splice(r,0,n)}};var o=function(){try{return window.localStorage}catch(e){}}();o&&(parseInt(o.logs,10)||"true"===o.logs)?i.enable("*"):i.enable("*:error,*:info,*:warn"),r&&(window.logs=i),e.exports=i},9485:(e,t,n)=>{var i=n(8878)("device:error"),r=!1,s=!1,o=e.exports.isWebXRAvailable=void 0!==navigator.xr;if(o){var a=function(){var e=document.querySelector("a-scene");e?e.hasLoaded?e.components["xr-mode-ui"].updateEnterInterfaces():e.addEventListener("loaded",a):window.addEventListener("DOMContentLoaded",a)},l=function(e){i("WebXR session support error: "+e.message)};navigator.xr.isSessionSupported?(navigator.xr.isSessionSupported("immersive-vr").then((function(e){r=e,a()})).catch(l),navigator.xr.isSessionSupported("immersive-ar").then((function(e){s=e,a()})).catch((function(){}))):navigator.xr.supportsSession?(navigator.xr.supportsSession("immersive-vr").then((function(){r=!0,a()})).catch(l),navigator.xr.supportsSession("immersive-ar").then((function(){s=!0,a()})).catch((function(){}))):i("WebXR has neither isSessionSupported or supportsSession?!")}e.exports.checkHeadsetConnected=function(){return r||s},e.exports.checkARSupport=function(){return s},e.exports.checkVRSupport=function(){return r};var c,h,d=(h=!1,c=window.navigator.userAgent||window.navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(c)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(c.substr(0,4)))&&(h=!0),(f()||u()||y())&&(h=!0),v()&&(h=!1),function(){return h});function u(e){var t=e||window.navigator.userAgent;return/Nexus (7|9)|xoom|sch-i800|playbook|tablet|kindle/i.test(t)||p()}function p(e,t,n){var i=e||window.navigator.userAgent,r=t||window.navigator.platform,s=n||window.navigator.maxTouchPoints||0;return("iPad"===r||"MacIntel"===r)&&s>0&&/Macintosh|Intel|iPad|ipad/i.test(i)&&!window.MSStream}function A(){var e=navigator.userAgent.includes("Macintosh"),t=5===navigator.maxTouchPoints;return e&&t&&o}function f(){return/iPad|iPhone|iPod/.test(window.navigator.platform)}function m(){return/(OculusBrowser)/i.test(window.navigator.userAgent)}function g(){return/(Mobile VR)/i.test(window.navigator.userAgent)}function v(){return m()||g()||A()}function y(){return/R7 Build/.test(window.navigator.userAgent)}e.exports.isMobile=d,e.exports.isTablet=u,e.exports.isIpad=p,e.exports.isAppleVisionPro=A,e.exports.isIOS=f,e.exports.isMobileDeviceRequestingDesktopSite=function(){return!d()&&!v()&&void 0!==window.orientation},e.exports.isOculusBrowser=m,e.exports.isFirefoxReality=g,e.exports.isMobileVR=v,e.exports.isR7=y,e.exports.isLandscape=function(){var e=window.orientation;return y()&&(e+=90),90===e||-90===e},e.exports.isBrowserEnvironment="undefined"==typeof process||!0===process.browser,e.exports.isNodeEnvironment=!e.exports.isBrowserEnvironment},7264:(e,t,n)=>{var i=n(8183).split;function r(e,t){var n=i(e,t=t||".");return 1===n.length?n[0]:n}e.exports.getComponentPropertyPath=r,e.exports.getComponentProperty=function(e,t,n){var i;return n=n||".",-1!==t.indexOf(n)?(i=r(t,n)).constructor===String?e.getAttribute(i):e.getAttribute(i[0])[i[1]]:e.getAttribute(t)},e.exports.setComponentProperty=function(e,t,n,i){var s;i=i||".",-1===t.indexOf(i)?e.setAttribute(t,n):(s=r(t,i)).constructor===String?e.setAttribute(s,n):e.setAttribute(s[0],s[1],n)}},9202:e=>{e.exports=function(e){var t=e.style.width,n=e.style.height;e.style.width=parseInt(t,10)+1+"px",e.style.height=parseInt(n,10)+1+"px",setTimeout((function(){e.style.width=t,e.style.height=n}),200)}},7427:(e,t,n)=>{var i=n(8940),r=n(1124),s=n(9485),o=n(1451),a=i("utils:warn");e.exports.bind=function(e){return e.bind.apply(e,Array.prototype.slice.call(arguments,1))},e.exports.coordinates=n(676),e.exports.debug=i,e.exports.device=s,e.exports.entity=n(7264),e.exports.forceCanvasResizeSafariMobile=n(9202),e.exports.material=n(8066),e.exports.objectPool=o,e.exports.split=n(8183).split,e.exports.styleParser=n(3845),e.exports.trackedControls=n(7960),e.exports.checkHeadsetConnected=function(){return a("`utils.checkHeadsetConnected` has moved to `utils.device.checkHeadsetConnected`"),s.checkHeadsetConnected(arguments)},e.exports.isGearVR=e.exports.device.isGearVR=function(){a("`utils.isGearVR` has been deprecated, use `utils.device.isMobileVR`")},e.exports.isIOS=function(){return a("`utils.isIOS` has moved to `utils.device.isIOS`"),s.isIOS(arguments)},e.exports.isOculusGo=e.exports.device.isOculusGo=function(){a("`utils.isOculusGo` has been deprecated, use `utils.device.isMobileVR`")},e.exports.isMobile=function(){return a("`utils.isMobile has moved to `utils.device.isMobile`"),s.isMobile(arguments)},e.exports.throttle=function(e,t,n){var i;return n&&(e=e.bind(n)),function(){var n=Date.now();(void 0===i||(void 0===i?t:n-i)>=t)&&(i=n,e.apply(null,arguments))}},e.exports.throttleLeadingAndTrailing=function(e,t,n){var i,r,s;n&&(e=e.bind(n));var o=function(){i=Date.now(),e.apply(this,s),r=void 0};return function(){var n=Date.now(),a=void 0===i?t:n-i;a>=t?(clearTimeout(r),r=void 0,i=n,e.apply(null,arguments)):(r=r||setTimeout(o,t-a),s=arguments)}},e.exports.throttleTick=function(e,t,n){var i;return n&&(e=e.bind(n)),function(n,r){var s=void 0===i?r:n-i;(void 0===i||s>=t)&&(i=n,e(n,s))}},e.exports.debounce=function(e,t,n){var i;return function(){var r=this,s=arguments,o=n&&!i;clearTimeout(i),i=setTimeout((function(){i=null,n||e.apply(r,s)}),t),o&&e.apply(r,s)}},e.exports.extend=Object.assign,e.exports.extendDeep=r,e.exports.clone=function(e){return JSON.parse(JSON.stringify(e))};var l,c,h=(l=o.createPool((function(){return[]})),function(e,t){var n,i,r,s,o,a;if(void 0===e||void 0===t||null===e||null===t||!(e&&t&&e.constructor===Object&&t.constructor===Object||e.constructor===Array&&t.constructor===Array))return e===t;for(n in i=l.use(),r=l.use(),i.length=0,r.length=0,e)i.push(n);for(n in t)r.push(n);if(i.length!==r.length)return l.recycle(i),l.recycle(r),!1;for(s=0;s<i.length;++s)if(o=e[i[s]],a=t[i[s]],"object"==typeof o||"object"==typeof a||Array.isArray(o)&&Array.isArray(a)){if(o===a)continue;if(!h(o,a))return l.recycle(i),l.recycle(r),!1}else if(o!==a)return l.recycle(i),l.recycle(r),!1;return l.recycle(i),l.recycle(r),!0});e.exports.deepEqual=h,e.exports.diff=(c=[],function(e,t,n){var i,r,s,o,a,l,d;for(a in o=n||{},c.length=0,e)c.push(a);if(!t)return o;for(s in t)-1===c.indexOf(s)&&c.push(s);for(l=0;l<c.length;l++)i=e[a=c[l]],r=t[a],((d=i&&r&&i.constructor===Object&&r.constructor===Object)&&!h(i,r)||!d&&i!==r)&&(o[a]=r);return o}),e.exports.shouldCaptureKeyEvent=function(e){return!e.metaKey&&document.activeElement===document.body},e.exports.splitString=function(e,t){void 0===t&&(t=" ");var n=new RegExp(t,"g");return(e=(e||"").replace(n,t)).split(t)},e.exports.getElData=function(e,t){t=t||{};var n={};return Object.keys(t).forEach((function(t){e.hasAttribute(t)&&(n[t]=e.getAttribute(t))})),n},e.exports.getUrlParameter=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},e.exports.isIframed=function(){return window.top!==window.self},e.exports.findAllScenes=function(e){for(var t=[],n=e.getElementsByTagName("*"),i=0,r=n.length;i<r;i++)n[i].isScene&&t.push(n[i]);return t},e.exports.srcLoader=n(1857)},1957:()=>{window.addEventListener("orientationchange",(function(){document.documentElement.style.height="initial",setTimeout((function(){document.documentElement.style.height="100%",setTimeout((function(){window.scrollTo(0,1)}),500)}),500)}))},8066:(e,t,n)=>{var i=n(9437),r=n(1857),s=n(8940)("utils:material:warn"),o=new Set(["emissiveMap","envMap","map","specularMap"]);function a(e,t){var n=t.offset||{x:0,y:0},r=t.repeat||{x:1,y:1},s=t.npot||!1,o=t.anisotropy||i.Texture.DEFAULT_ANISOTROPY,a=e.wrapS,l=e.wrapT,c=e.magFilter,h=e.minFilter;s&&(a=i.ClampToEdgeWrapping,l=i.ClampToEdgeWrapping,c=i.LinearFilter,h=i.LinearFilter),1===r.x&&1===r.y||(a=i.RepeatWrapping,l=i.RepeatWrapping),e.offset.set(n.x,n.y),e.repeat.set(r.x,r.y),e.wrapS===a&&e.wrapT===l&&e.magFilter===c&&e.minFilter===h&&e.anisotropy===o||(e.wrapS=a,e.wrapT=l,e.magFilter=c,e.minFilter=h,e.anisotropy=o,e.needsUpdate=!0)}e.exports.setTextureProperties=a,e.exports.updateMapMaterialFromData=function(e,t,n,r){var s=n.el,l=n.material,u=s.sceneEl.systems.renderer,p=r[t];if(n.materialSrcs||(n.materialSrcs={}),!p)return delete n.materialSrcs[e],void A(null);function A(t){l[e]!==t&&(l[e]&&l[e].dispose(),l[e]=t,l.needsUpdate=!0,c(s,t))}p===n.materialSrcs[e]&&l[e]?a(l[e],r):(n.materialSrcs[e]=p,p instanceof i.Texture?A(p):s.sceneEl.systems.material.loadTextureSource(p,(function(t){if(n.materialSrcs[e]===p){var i=l[e];!i||null!==t&&h(i,t)||(i=null),!i&&t&&(i=d(t)),i&&(i.source!==t&&(i.source=t,i.needsUpdate=!0),o.has(e)&&u.applyColorCorrection(i),a(i,r)),A(i)}})))},e.exports.updateMap=function(t,n){return e.exports.updateMapMaterialFromData("map","src",t,n)},e.exports.updateDistortionMap=function(t,n,i){var r=t;"ambientOcclusion"===t&&(r="ao");var s={};return s.src=i[t+"Map"],s.offset=i[t+"TextureOffset"],s.repeat=i[t+"TextureRepeat"],s.wrap=i[t+"TextureWrap"],e.exports.updateMapMaterialFromData(r+"Map","src",n,s)};var l={};function c(e,t){function n(){e.emit("materialvideoloadeddata",{src:t.image,texture:t})}function i(){e.emit("materialvideoended",{src:t.image,texture:t})}t&&(e.emit("materialtextureloaded",{src:t.image,texture:t}),t.image&&"VIDEO"===t.image.tagName&&(t.image.addEventListener("loadeddata",n),t.image.addEventListener("ended",i),t.addEventListener("dispose",(function(){t.image.removeEventListener("loadeddata",n),t.image.removeEventListener("ended",i)}))))}function h(e,t){return e.source===t&&(t.data instanceof HTMLCanvasElement?e.isCanvasTexture:t.data instanceof HTMLVideoElement?e.isVideoTexture:e.isTexture&&!e.isCanvasTexture&&!e.isVideoTexture)}function d(e){var t;return(t=e.data instanceof HTMLCanvasElement?new i.CanvasTexture:e.data instanceof HTMLVideoElement?new i.VideoTexture(e.data):new i.Texture).source=e,t.needsUpdate=!0,t}e.exports.updateEnvMap=function(e,t){var n=e.material,o=e.el,a="envMap",h=t.envMap,d=t.sphericalEnvMap,u=t.refract;if(d&&(h=d,s("`sphericalEnvMap` property is deprecated, using spherical map as equirectangular map instead. Use `envMap` property with a CubeMap or Equirectangular image instead.")),e.materialSrcs||(e.materialSrcs={}),!h)return delete e.materialSrcs[a],n.envMap=null,void(n.needsUpdate=!0);function p(t){e.materialSrcs[a]===h&&(n.envMap=t,n.needsUpdate=!0,c(o,t))}e.materialSrcs[a]=h,l[h]?l[h].then(p):l[h]=new Promise((function(e){r.validateEnvMapSrc(h,(function(t){o.sceneEl.systems.material.loadCubeMapTexture(t,(function(t){t.mapping=u?i.CubeRefractionMapping:i.CubeReflectionMapping,p(t),e(t)}))}),(function(t){o.sceneEl.systems.material.loadTexture(t,{src:t},(function(t){t.mapping=u?i.EquirectangularRefractionMapping:i.EquirectangularReflectionMapping,p(t),e(t)}))}))}))},e.exports.handleTextureEvents=c,e.exports.isCompatibleTexture=h,e.exports.createCompatibleTexture=d},3657:e=>{function t(e,t,n){return(t.dot(e)-t.dot(n))/t.length()}e.exports.distanceOfPointFromPlane=t,e.exports.nearestPointInPlane=function(e,n,i,r){var s=t(e,n,i);return r.copy(n),r.multiplyScalar(s),r.add(i),r}},1451:e=>{var t=Object.freeze(Object.create(null));function n(){return{}}function i(e){var t;if(e&&e.constructor===Object)for(t in e)e[t]=void 0}e.exports.createPool=function(e){var r=[],s=null;function o(t){var n,i;if((t=void 0===t?r.length:t)>0&&null==s&&(s=0),t>0)for(n=r.length,r.length+=Number(t),i=n;i<r.length;i++)r[i]=e();return r.length}return e=e||n,{grow:o,pool:r,recycle:function(e){e instanceof Object&&(null!==s&&-1!==s?r[--s]=e:r[r.length]=e)},size:function(){return r.length},use:function(){var e;return null!==s&&s!==r.length||o(r.length||5),e=r[s],r[s++]=t,i(e),e}}},e.exports.clearObject=i,e.exports.removeUnusedKeys=function(e,t){var n;if(e&&e.constructor===Object)for(n in e)n in t||delete e[n]}},8183:e=>{var t;e.exports.split=(t={},function(e,n){return n in t||(t[n]={}),e in t[n]||(t[n][e]=e.split(n)),t[n][e]})},1857:(e,t,n)=>{var i=n(8940)("utils:src-loader:warn");function r(e,t,n){!function(e,t){var n;e.tagName?t("IMG"===e.tagName):((n=new XMLHttpRequest).open("HEAD",e),n.addEventListener("load",(function(i){var r;n.status>=200&&n.status<300?null==(r=n.getResponseHeader("Content-Type"))?a(e,t):r.startsWith("image")?t(!0):t(!1):a(e,t),n.abort()})),n.send())}(e,(function(i){i?t(e):n(e)}))}function s(e,t,n){var s,a,l,c="",h=[];if("string"==typeof e){for(a=0;a<5;a++)c+="(url\\((?:[^\\)]+)\\),\\s*)";function d(e){h.push(e),6===h.length&&t(h)}if(c+="(url\\((?:[^\\)]+)\\)\\s*)",l=e.match(new RegExp(c))){for(a=1;a<7;a++)r(o(l[a]),d);return}if(!e.startsWith("#"))return void r(o(e)||e,n)}if(s=e.tagName?e:function(e){try{var t=document.querySelector(e);return t||i('No element was found matching the selector: "%s"',e),t}catch(t){return void i('"%s" is not a valid selector',e)}}(e))return"A-CUBEMAP"===s.tagName&&s.srcs?t(s.srcs):"IMG"===s.tagName?n(s):void i('Selector "%s" does not point to <a-cubemap> or <img>',e)}function o(e){var t=e.match(/url\((.+)\)/);if(t)return t[1]}function a(e,t){var n=new Image;n.addEventListener("load",(function(){t(!0)})),n.addEventListener("error",(function(){t(!1)})),n.src=e}e.exports={parseUrl:o,validateSrc:r,validateCubemapSrc:function(e,t){return s(e,t,(function(){i("Expected cubemap but got image")}))},validateEnvMapSrc:s}},3845:e=>{var t=/-([a-z])/g;function n(e){return e.replace(t,o)}e.exports.parse=function(e,t){var i;return"string"!=typeof e?e:(i=function(e,t){var i,r,o,a,l,c;for(t=t||{},i=s(e),r=0;r<i.length;r++)(o=i[r])&&(a=o.indexOf(":"),l=o.substr(0,a).trim(),c=o.substr(a+1).trim(),t[n(l)]=c);return t}(e,t),i[""]?e:i)},e.exports.stringify=function(e){return"string"==typeof e?e:function(e){var t,n=0,i=0,r="";for(t in e)n++;for(t in e)r+=t+": "+e[t],i<n-1&&(r+="; "),i++;return r}(e)},e.exports.toCamelCase=n;var i,r,s=(i=[],r=/url\([^)]+$/,function(e){var t,n="",s=0;for(i.length=0;s<e.length;)-1===(t=e.indexOf(";",s))&&(t=e.length),n+=e.substring(s,t),r.test(n)?(n+=";",s=t+1):(i.push(n.trim()),n="",s=t+1);return i});function o(e){return e[1].toUpperCase()}},7960:e=>{var t=["x","y","z","w"];function n(e,t,n){var r,s=e.el.sceneEl,o=s&&s.systems["tracked-controls"];return!!o&&!(!(r=o.controllers)||!r.length)&&i(r,t,n.hand,n.index,n.iterateControllerProfiles,n.handTracking)}function i(e,t,n,i,r,s){var o,a,l,c,h=!1;for(o=0;o<e.length;o++){if(c=(l=e[o]).profiles,s)h=l.hand;else if(r)for(a=0;a<c.length&&!(h=c[a].startsWith(t));a++);else h=c.length>0&&c[0].startsWith(t);if(h)if("right"===l.handedness||"left"===l.handedness){if(l.handedness===n)return e[o]}else if(o===i)return e[o]}}e.exports.checkControllerPresentAndSetup=function(e,t,i){var r,s,o=e.el;if((s=!!(r=n(e,t,i)))===e.controllerPresent)return s;e.controllerPresent=s,s?(e.addEventListeners(),e.injectTrackedControls(r),o.emit("controllerconnected",{name:e.name,component:e})):(e.removeEventListeners(),o.emit("controllerdisconnected",{name:e.name,component:e}))},e.exports.isControllerPresentWebXR=n,e.exports.findMatchingControllerWebXR=i,e.exports.emitIfAxesChanged=function(e,n,i){var r,s,o,a,l;for(s in n){for(r=n[s],o=!1,l=0;l<r.length;l++)i.detail.changed[r[l]]&&(o=!0);if(o){for(a={},l=0;l<r.length;l++)a[t[l]]=i.detail.axis[r[l]];e.el.emit(s+"moved",a)}}},e.exports.onButtonEvent=function(e,t,n,i){var r=(i?n.mapping[i]:n.mapping).buttons[e];n.el.emit(r+t),n.updateModel&&n.updateModel(r,t)}},7469:()=>{THREE.DeviceOrientationControls=function(e){var t=this;this.object=e,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0,this.alphaOffset=0;var n,i,r,s,o=function(e){t.deviceOrientation=e},a=function(){t.screenOrientation=window.orientation||0},l=(n=new THREE.Vector3(0,0,1),i=new THREE.Euler,r=new THREE.Quaternion,s=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),function(e,t,o,a,l){i.set(o,t,-a,"YXZ"),e.setFromEuler(i),e.multiply(s),e.multiply(r.setFromAxisAngle(n,-l))});this.connect=function(){a(),window.addEventListener("orientationchange",a,!1),window.addEventListener("deviceorientation",o,!1),t.enabled=!0},this.disconnect=function(){window.removeEventListener("orientationchange",a,!1),window.removeEventListener("deviceorientation",o,!1),t.enabled=!1},this.update=function(){if(!1!==t.enabled){var e=t.deviceOrientation;if(e){var n=e.alpha?THREE.MathUtils.degToRad(e.alpha)+t.alphaOffset:0,i=e.beta?THREE.MathUtils.degToRad(e.beta):0,r=e.gamma?THREE.MathUtils.degToRad(e.gamma):0,s=t.screenOrientation?THREE.MathUtils.degToRad(t.screenOrientation):0;l(t.object.quaternion,n,i,r,s)}}},this.dispose=function(){t.disconnect()},this.connect()}},3729:e=>{window.glStats=function(){var e=null,t=0,n=0,i=0,r=0,s=0,o=0,a=0;function l(e,t){return function(){t.apply(this,arguments),e.apply(this,arguments)}}return WebGLRenderingContext.prototype.drawArrays=l(WebGLRenderingContext.prototype.drawArrays,(function(){t++,arguments[0]==this.POINTS?o+=arguments[2]:s+=arguments[2]})),WebGLRenderingContext.prototype.drawElements=l(WebGLRenderingContext.prototype.drawElements,(function(){n++,r+=arguments[1]/3,s+=arguments[1]})),WebGLRenderingContext.prototype.useProgram=l(WebGLRenderingContext.prototype.useProgram,(function(){i++})),WebGLRenderingContext.prototype.bindTexture=l(WebGLRenderingContext.prototype.bindTexture,(function(){a++})),{update:function(){e("allcalls").set(t+n),e("drawElements").set(n),e("drawArrays").set(t),e("bindTexture").set(a),e("useProgram").set(i),e("glfaces").set(r),e("glvertices").set(s),e("glpoints").set(o)},start:function(){t=0,n=0,i=0,r=0,s=0,o=0,a=0},end:function(){},attach:function(t){e=t},values:{allcalls:{over:3e3,caption:"Calls (hook)"},drawelements:{caption:"drawElements (hook)"},drawarrays:{caption:"drawArrays (hook)"}},groups:[{caption:"WebGL",values:["allcalls","drawelements","drawarrays","useprogram","bindtexture","glfaces","glvertices","glpoints"]}],fractions:[{base:"allcalls",steps:["drawelements","drawarrays"]}]}},window.threeStats=function(e){var t=null;return{update:function(){t("renderer.info.memory.geometries").set(e.info.memory.geometries),t("renderer.info.programs").set(e.info.programs.length),t("renderer.info.memory.textures").set(e.info.memory.textures),t("renderer.info.render.calls").set(e.info.render.calls),t("renderer.info.render.triangles").set(e.info.render.triangles),t("renderer.info.render.points").set(e.info.render.points)},start:function(){},end:function(){},attach:function(e){t=e},values:{"renderer.info.memory.geometries":{caption:"Geometries"},"renderer.info.memory.textures":{caption:"Textures"},"renderer.info.programs":{caption:"Programs"},"renderer.info.render.calls":{caption:"Calls"},"renderer.info.render.triangles":{caption:"Triangles",over:1e3},"renderer.info.render.points":{caption:"Points"}},groups:[{caption:"Three.js - Memory",values:["renderer.info.memory.geometries","renderer.info.programs","renderer.info.memory.textures"]},{caption:"Three.js - Render",values:["renderer.info.render.calls","renderer.info.render.triangles","renderer.info.render.points"]}],fractions:[]}},window.BrowserStats=function(){var e=null,t=0,n=0;window.performance&&!performance.memory&&(performance.memory={usedJSHeapSize:0,totalJSHeapSize:0}),0===performance.memory.totalJSHeapSize&&console.warn("totalJSHeapSize === 0... performance.memory is only available in Chrome .");var i=Math.log(1024);function r(e){var t=Math.floor(Math.log(e)/i);return Math.round(100*e/Math.pow(1024,t))/100}return{update:function(){t=r(performance.memory.usedJSHeapSize),n=r(performance.memory.totalJSHeapSize),e("memory").set(t),e("total").set(n)},start:function(){t=0},end:function(){},attach:function(t){e=t},values:{memory:{caption:"Used Memory",average:!0,avgMs:1e3,over:22},total:{caption:"Total Memory"}},groups:[{caption:"Browser",values:["memory","total"]}],fractions:[{base:"total",steps:["memory"]}]}},e.exports={glStats:window.glStats,threeStats:window.threeStats,BrowserStats:window.BrowserStats}},282:e=>{"use strict";!function(){"performance"in window==0&&(window.performance={});var e=window.performance;if("now"in e==0){var t=Date.now();e.timing&&e.timing.navigationStart&&(t=e.timing.navigationStart),e.now=function(){return Date.now()-t}}e.mark||(e.mark=function(){}),e.measure||(e.measure=function(){})}(),window.rStats=function(e){function t(e,t){for(var n=Object.keys(e),i=0,r=n.length;i<r;i++)t(n[i])}var n=e||{},i=n.colours||["#850700","#c74900","#fcb300","#284280","#4c7c0c"],r=(n.CSSPath?n.CSSPath:"")+"rStats.css";(n.css||["https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300",r]).forEach((function(e){var t,n;t=e,(n=document.createElement("link")).href=t,n.rel="stylesheet",n.type="text/css",document.getElementsByTagName("head")[0].appendChild(n)})),n.values||(n.values={});var s,o,a=10,l={};function c(e,t,n){var i=n||{},r=document.createElement("canvas"),s=r.getContext("2d"),o=0,l=0,c=i.color?i.color:"#666666",h=document.createElement("canvas"),d=h.getContext("2d");h.width=1,h.height=20,d.fillStyle="#444444",d.fillRect(0,0,1,20),d.fillStyle=c,d.fillRect(0,a,1,a),d.fillStyle="#ffffff",d.globalAlpha=.5,d.fillRect(0,a,1,1),d.globalAlpha=1;var u=document.createElement("canvas"),p=u.getContext("2d");return u.width=1,u.height=20,p.fillStyle="#444444",p.fillRect(0,0,1,20),p.fillStyle="#b70000",p.fillRect(0,a,1,a),p.globalAlpha=.5,p.fillStyle="#ffffff",p.fillRect(0,a,1,1),p.globalAlpha=1,r.width=200,r.height=a,r.style.width=r.width+"px",r.style.height=r.height+"px",r.className="rs-canvas",e.appendChild(r),s.fillStyle="#444444",s.fillRect(0,0,r.width,r.height),{draw:function(e,t){(l+=.1*(e-l))>(o*=.99)&&(o=l),s.drawImage(r,1,0,r.width-1,r.height,0,0,r.width-1,r.height),t?s.drawImage(u,r.width-1,r.height-l*r.height/o-a):s.drawImage(h,r.width-1,r.height-l*r.height/o-a)}}}function h(e,n){var r=document.createElement("canvas"),s=r.getContext("2d");return r.width=200,r.height=a*n,r.style.width=r.width+"px",r.style.height=r.height+"px",r.className="rs-canvas",e.appendChild(r),s.fillStyle="#444444",s.fillRect(0,0,r.width,r.height),{draw:function(e){s.drawImage(r,1,0,r.width-1,r.height,0,0,r.width-1,r.height);var n=0;t(e,(function(t){var o=e[t]*r.height;s.fillStyle=i[t],s.fillRect(r.width-1,n,1,o),n+=o}))}}}function d(e,t){var i,r=e,s=0,a=0,l=0,h=0,d=performance.now(),u=0,p=document.createElement("div"),A=document.createElement("span"),f=document.createElement("div"),m=document.createTextNode(""),g=n?n.values[r.toLowerCase()]:null,v=new c(p,r,g),y=!1;function E(e){if(g&&g.average){h+=e,u++;var t=performance.now();t-d>=(g.avgMs||1e3)&&(l=h/u,h=0,d=t,u=0)}}function x(){i=performance.now(),n.userTimingAPI&&performance.mark(r+"-start"),y=!0}function b(){s=performance.now()-i,n.userTimingAPI&&(performance.mark(r+"-end"),y&&performance.measure(r,r+"-start",r+"-end")),E(s)}return A.className="rs-counter-id",A.textContent=g&&g.caption?g.caption:r,f.className="rs-counter-value",f.appendChild(m),p.appendChild(A),p.appendChild(f),t?t.div.appendChild(p):o.appendChild(p),i=performance.now(),{set:function(e){E(s=e)},start:x,tick:function(){b(),x()},end:b,frame:function(){var e=performance.now(),t=e-i;a++,t>1e3&&(s=g&&!1===g.interpolate?a:1e3*a/t,a=0,i=e,E(s))},value:function(){return s},draw:function(){var e=g&&g.average?l:s;m.nodeValue=Math.round(100*e)/100;var t=g&&(g.below&&s<g.below||g.over&&s>g.over);v.draw(s,t),p.className=t?"rs-counter-base alarm":"rs-counter-base"}}}function u(e){var i=e.toLowerCase();if(void 0===i&&(i="default"),l[i])return l[i];var r=null;n&&n.groups&&t(n.groups,(function(e){var t=n.groups[parseInt(e,10)];r||-1===t.values.indexOf(i.toLowerCase())||(r=t)}));var s=new d(i,r);return l[i]=s,s}function p(){t(n.plugins,(function(e){n.plugins[e].update()})),t(l,(function(e){l[e].draw()})),n&&n.fractions&&t(n.fractions,(function(e){var i=n.fractions[parseInt(e,10)],r=[],s=l[i.base.toLowerCase()];s&&(s=s.value(),t(n.fractions[e].steps,(function(t){var i=n.fractions[e].steps[parseInt(t,10)].toLowerCase(),o=l[i];o&&r.push(o.value()/s)}))),i.graph.draw(r)}))}return function(){if(n.plugins){n.values||(n.values={}),n.groups||(n.groups=[]),n.fractions||(n.fractions=[]);for(var e=0;e<n.plugins.length;e++)n.plugins[e].attach(u),t(n.plugins[e].values,(function(t){n.values[t]=n.plugins[e].values[t]})),n.groups=n.groups.concat(n.plugins[e].groups),n.fractions=n.fractions.concat(n.plugins[e].fractions)}else n.plugins={};(s=document.createElement("div")).className="rs-base",(o=document.createElement("div")).className="rs-container",o.style.height="auto",s.appendChild(o),document.body.appendChild(s),n&&(n.groups&&t(n.groups,(function(e){var t=n.groups[parseInt(e,10)],i=document.createElement("div");i.className="rs-group",t.div=i;var r=document.createElement("h1");r.textContent=t.caption,r.addEventListener("click",function(e){this.classList.toggle("hidden"),e.preventDefault()}.bind(i)),o.appendChild(r),o.appendChild(i)})),n.fractions&&t(n.fractions,(function(e){var r=n.fractions[parseInt(e,10)],s=document.createElement("div");s.className="rs-fraction";var l=document.createElement("div");l.className="rs-legend";var c=0;t(n.fractions[e].steps,(function(t){var r=document.createElement("p");r.textContent=n.fractions[e].steps[t],r.style.color=i[c],l.appendChild(r),c++})),s.appendChild(l),s.style.height=c*a+"px",r.div=s;var d=new h(s,c);r.graph=d,o.appendChild(s)})))}(),function(e){return e?u(e):{element:s,update:p}}},e.exports=window.rStats},2535:e=>{var t={base64:function(e,t){return"data:"+e+";base64,"+t},isMobile:function(){var e,t=!1;return e=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0),t},isIOS:function(){return/(iPad|iPhone|iPod)/g.test(navigator.userAgent)},isIFrame:function(){try{return window.self!==window.top}catch(e){return!0}},appendQueryParameter:function(e,t,n){var i=e.indexOf("?")<0?"?":"&";return e+(i+t+"=")+n},getQueryParameter:function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},isLandscapeMode:function(){return 90==window.orientation||-90==window.orientation}};e.exports=t},5928:(e,t,n)=>{var i,r=n(2535);e.exports=(i=navigator.userAgent||navigator.vendor||window.opera).match(/iPhone/i)||i.match(/iPod/i)?function(){var e=null;this.request=function(){e||(e=setInterval((function(){window.location.href="/",setTimeout(window.stop,0)}),15e3))},this.release=function(){e&&(clearInterval(e),e=null)}}:function(){var e=document.createElement("video");e.addEventListener("ended",(function(){e.play()})),this.request=function(){e.paused&&(e.src=r.base64("video/webm","GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4ECQoWBAhhTgGcBAAAAAAAH4xFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsggfG7AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU2LjQwLjEwMVdBjUxhdmY1Ni40MC4xMDFzpJAGSJTMbsLpDt/ySkipgX1fRImIQO1MAAAAAAAWVK5rAQAAAAAAADuuAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDmDgQEj44OEO5rKAOABAAAAAAAABrCBsLqBkB9DtnUBAAAAAAAAo+eBAKOmgQAAgKJJg0IAAV4BHsAHBIODCoAACmH2MAAAZxgz4dPSTFi5JACjloED6ACmAECSnABMQAADYAAAWi0quoCjloEH0ACmAECSnABNwAADYAAAWi0quoCjloELuACmAECSnABNgAADYAAAWi0quoCjloEPoACmAECSnABNYAADYAAAWi0quoCjloETiACmAECSnABNIAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTnghdwo5aBAAAApgBAkpwATOAAA2AAAFotKrqAo5aBA+gApgBAkpwATMAAA2AAAFotKrqAo5aBB9AApgBAkpwATIAAA2AAAFotKrqAo5aBC7gApgBAkpwATEAAA2AAAFotKrqAo5aBD6AApgDAkpwAQ2AAA2AAAFotKrqAo5aBE4gApgBAkpwATCAAA2AAAFotKrqAH0O2dQEAAAAAAACU54Iu4KOWgQAAAKYAQJKcAEvAAANgAABaLSq6gKOWgQPoAKYAQJKcAEtgAANgAABaLSq6gKOWgQfQAKYAQJKcAEsAAANgAABaLSq6gKOWgQu4AKYAQJKcAEqAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEogAANgAABaLSq6gKOWgROIAKYAQJKcAEnAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCRlCjloEAAACmAECSnABJgAADYAAAWi0quoCjloED6ACmAECSnABJIAADYAAAWi0quoCjloEH0ACmAMCSnABDYAADYAAAWi0quoCjloELuACmAECSnABI4AADYAAAWi0quoCjloEPoACmAECSnABIoAADYAAAWi0quoCjloETiACmAECSnABIYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngl3Ao5aBAAAApgBAkpwASCAAA2AAAFotKrqAo5aBA+gApgBAkpwASAAAA2AAAFotKrqAo5aBB9AApgBAkpwAR8AAA2AAAFotKrqAo5aBC7gApgBAkpwAR4AAA2AAAFotKrqAo5aBD6AApgBAkpwAR2AAA2AAAFotKrqAo5aBE4gApgBAkpwARyAAA2AAAFotKrqAH0O2dQEAAAAAAACU54J1MKOWgQAAAKYAwJKcAENgAANgAABaLSq6gKOWgQPoAKYAQJKcAEbgAANgAABaLSq6gKOWgQfQAKYAQJKcAEagAANgAABaLSq6gKOWgQu4AKYAQJKcAEaAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEZAAANgAABaLSq6gKOWgROIAKYAQJKcAEYAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCjKCjloEAAACmAECSnABF4AADYAAAWi0quoCjloED6ACmAECSnABFwAADYAAAWi0quoCjloEH0ACmAECSnABFoAADYAAAWi0quoCjloELuACmAECSnABFgAADYAAAWi0quoCjloEPoACmAMCSnABDYAADYAAAWi0quoCjloETiACmAECSnABFYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngqQQo5aBAAAApgBAkpwARUAAA2AAAFotKrqAo5aBA+gApgBAkpwARSAAA2AAAFotKrqAo5aBB9AApgBAkpwARQAAA2AAAFotKrqAo5aBC7gApgBAkpwARQAAA2AAAFotKrqAo5aBD6AApgBAkpwAROAAA2AAAFotKrqAo5aBE4gApgBAkpwARMAAA2AAAFotKrqAH0O2dQEAAAAAAACU54K7gKOWgQAAAKYAQJKcAESgAANgAABaLSq6gKOWgQPoAKYAQJKcAESAAANgAABaLSq6gKOWgQfQAKYAwJKcAENgAANgAABaLSq6gKOWgQu4AKYAQJKcAERgAANgAABaLSq6gKOWgQ+gAKYAQJKcAERAAANgAABaLSq6gKOWgROIAKYAQJKcAEQgAANgAABaLSq6gB9DtnUBAAAAAAAAlOeC0vCjloEAAACmAECSnABEIAADYAAAWi0quoCjloED6ACmAECSnABEAAADYAAAWi0quoCjloEH0ACmAECSnABD4AADYAAAWi0quoCjloELuACmAECSnABDwAADYAAAWi0quoCjloEPoACmAECSnABDoAADYAAAWi0quoCjloETiACmAECSnABDgAADYAAAWi0quoAcU7trAQAAAAAAABG7j7OBALeK94EB8YIBd/CBAw=="),e.play())},this.release=function(){e.pause(),e.src=""}}},8217:(e,t,n)=>{"use strict";n.d(t,{A:()=>E});var i=n(963),r=n.n(i),s=n(9089),o=n.n(s),a=n(6492),l=n.n(a),c=new URL(n(9169),n.b),h=new URL(n(6085),n.b),d=new URL(n(3931),n.b),u=new URL(n(7889),n.b),p=new URL(n(6517),n.b),A=o()(r()),f=l()(c),m=l()(h),g=l()(d),v=l()(u),y=l()(p);A.push([e.id,`/* .a-fullscreen means not embedded. */\nhtml.a-fullscreen {\n bottom: 0;\n left: 0;\n position: fixed;\n right: 0;\n top: 0;\n}\n\nhtml.a-fullscreen body {\n height: 100%;\n margin: 0;\n overflow: hidden;\n padding: 0;\n width: 100%;\n}\n\n/* Class is removed when doing <a-scene embedded>. */\nhtml.a-fullscreen .a-canvas {\n width: 100% !important;\n height: 100% !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n position: fixed !important;\n}\n\nhtml:not(.a-fullscreen) .a-enter-vr,\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 5px;\n bottom: 5px;\n}\n\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 60px;\n}\n\n/* In chrome mobile the user agent stylesheet set it to white */\n:-webkit-full-screen {\n background-color: transparent;\n}\n\n.a-hidden {\n display: none !important;\n}\n\n.a-canvas {\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.a-canvas.a-grab-cursor:hover {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\ncanvas.a-canvas.a-mouse-cursor-hover:hover {\n cursor: pointer;\n}\n\n.a-inspector-loader {\n background-color: #ed3160;\n position: fixed;\n left: 3px;\n top: 3px;\n padding: 6px 10px;\n color: #fff;\n text-decoration: none;\n font-size: 12px;\n font-family: Roboto,sans-serif;\n text-align: center;\n z-index: 99999;\n width: 204px;\n}\n\n/* Inspector loader animation */\n@keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n@-webkit-keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@-webkit-keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@-webkit-keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n\n.a-inspector-loader .dots span {\n animation: dots-1 2s infinite steps(1);\n -webkit-animation: dots-1 2s infinite steps(1);\n}\n\n.a-inspector-loader .dots span:first-child + span {\n animation-name: dots-2;\n -webkit-animation-name: dots-2;\n}\n\n.a-inspector-loader .dots span:first-child + span + span {\n animation-name: dots-3;\n -webkit-animation-name: dots-3;\n}\n\na-scene {\n display: block;\n position: relative;\n height: 100%;\n width: 100%;\n}\n\na-assets,\na-scene video,\na-scene img,\na-scene audio {\n display: none;\n}\n\n.a-enter-vr-modal,\n.a-orientation-modal {\n font-family: Consolas, Andale Mono, Courier New, monospace;\n}\n\n.a-enter-vr-modal a {\n border-bottom: 1px solid #fff;\n padding: 2px 0;\n text-decoration: none;\n transition: .1s color ease-in;\n}\n\n.a-enter-vr-modal a:hover {\n background-color: #fff;\n color: #111;\n padding: 2px 4px;\n position: relative;\n left: -4px;\n}\n\n.a-enter-vr,\n.a-enter-ar {\n font-family: sans-serif, monospace;\n font-size: 13px;\n width: 100%;\n font-weight: 200;\n line-height: 16px;\n position: absolute;\n right: 20px;\n bottom: 20px;\n}\n\n.a-enter-ar.xr {\n right: 90px;\n}\n\n.a-enter-vr-button,\n.a-enter-vr-modal,\n.a-enter-vr-modal a {\n color: #fff;\n user-select: none;\n outline: none;\n}\n\n.a-enter-vr-button {\n background: rgba(0, 0, 0, 0.35) url(${f}) 50% 50% no-repeat;\n}\n\n.a-enter-ar-button {\n background: rgba(0, 0, 0, 0.20) url(${m}) 50% 50% no-repeat;\n}\n\n.a-enter-vr.fullscreen .a-enter-vr-button {\n background-image: url(${g});\n}\n\n.a-enter-vr-button,\n.a-enter-ar-button {\n background-size: 90% 90%;\n border: 0;\n bottom: 0;\n cursor: pointer;\n min-width: 58px;\n min-height: 34px;\n /* 1.74418604651 */\n /*\n In order to keep the aspect ratio when resizing\n padding-top percentages are relative to the containing block's width.\n http://stackoverflow.com/questions/12121090/responsively-change-div-size-keeping-aspect-ratio\n */\n padding-right: 0;\n padding-top: 0;\n position: absolute;\n right: 0;\n transition: background-color .05s ease;\n -webkit-transition: background-color .05s ease;\n z-index: 9999;\n border-radius: 8px;\n touch-action: manipulation; /* Prevent iOS double tap zoom on the button */\n}\n\n.a-enter-ar-button {\n background-size: 100% 90%;\n border-radius: 7px;\n}\n\n.a-enter-ar-button:active,\n.a-enter-ar-button:hover,\n.a-enter-vr-button:active,\n.a-enter-vr-button:hover {\n background-color: #ef2d5e;\n}\n\n.a-enter-vr-button.resethover {\n background-color: rgba(0, 0, 0, 0.35);\n}\n\n.a-enter-vr-modal {\n background-color: #666;\n border-radius: 0;\n display: none;\n min-height: 32px;\n margin-right: 70px;\n padding: 9px;\n width: 280px;\n right: 2%;\n position: absolute;\n}\n\n.a-enter-vr-modal:after {\n border-bottom: 10px solid transparent;\n border-left: 10px solid #666;\n border-top: 10px solid transparent;\n display: inline-block;\n content: '';\n position: absolute;\n right: -5px;\n top: 5px;\n width: 0;\n height: 0;\n}\n\n.a-enter-vr-modal p,\n.a-enter-vr-modal a {\n display: inline;\n}\n\n.a-enter-vr-modal p {\n margin: 0;\n}\n\n.a-enter-vr-modal p:after {\n content: ' ';\n}\n\n.a-orientation-modal {\n background: rgba(244, 244, 244, 1) url(${v}) center no-repeat;\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-orientation-modal:after {\n color: #666;\n content: "Insert phone into Cardboard holder.";\n display: block;\n position: absolute;\n text-align: center;\n top: 70%;\n transform: translateY(-70%);\n width: 100%;\n}\n\n.a-orientation-modal button {\n background: url(${y}) no-repeat;\n border: none;\n height: 50px;\n text-indent: -9999px;\n width: 50px;\n}\n\n.a-loader-title {\n background-color: rgba(0, 0, 0, 0.6);\n font-family: sans-serif, monospace;\n text-align: center;\n font-size: 20px;\n height: 50px;\n font-weight: 300;\n line-height: 50px;\n position: absolute;\n right: 0px;\n left: 0px;\n top: 0px;\n color: white;\n}\n\n.a-modal {\n position: absolute;\n background: rgba(0, 0, 0, 0.60);\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-dialog {\n position: relative;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n z-index: 199995;\n width: 300px;\n height: 200px;\n background-size: contain;\n background-color: white;\n font-family: sans-serif, monospace;\n font-size: 20px;\n border-radius: 3px;\n padding: 6px;\n}\n\n.a-dialog-text-container {\n width: 100%;\n height: 70%;\n align-self: flex-start;\n display: flex;\n justify-content: center;\n align-content: center;\n flex-direction: column;\n}\n\n.a-dialog-text {\n display: inline-block;\n font-weight: normal;\n font-size: 14pt;\n margin: 8px;\n}\n\n.a-dialog-buttons-container {\n display: inline-flex;\n align-self: flex-end;\n width: 100%;\n height: 30%;\n}\n\n.a-dialog-button {\n cursor: pointer;\n align-self: center;\n opacity: 0.9;\n height: 80%;\n width: 50%;\n font-size: 12pt;\n margin: 4px;\n border-radius: 2px;\n text-align:center;\n border: none;\n display: inline-block;\n -webkit-transition: all 0.25s ease-in-out;\n transition: all 0.25s ease-in-out;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.20);\n user-select: none;\n}\n\n.a-dialog-permission-button:hover {\n box-shadow: 0 7px 14px rgba(0,0,0,0.20), 0 2px 2px rgba(0,0,0,0.20);\n}\n\n.a-dialog-allow-button {\n background-color: #00ceff;\n}\n\n.a-dialog-deny-button {\n background-color: #ff005b;\n}\n\n.a-dialog-ok-button {\n background-color: #00ceff;\n width: 100%;\n}\n\n.a-dom-overlay:not(.a-no-style) {\n overflow: hidden;\n position: absolute;\n pointer-events: none;\n box-sizing: border-box;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n padding: 1em;\n}\n\n.a-dom-overlay:not(.a-no-style)>* {\n pointer-events: auto;\n}\n`,"",{version:3,sources:["webpack://./src/style/aframe.css"],names:[],mappings:"AAAA,sCAAsC;AACtC;EACE,SAAS;EACT,OAAO;EACP,eAAe;EACf,QAAQ;EACR,MAAM;AACR;;AAEA;EACE,YAAY;EACZ,SAAS;EACT,gBAAgB;EAChB,UAAU;EACV,WAAW;AACb;;AAEA,oDAAoD;AACpD;EACE,sBAAsB;EACtB,uBAAuB;EACvB,iBAAiB;EACjB,kBAAkB;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,0BAA0B;AAC5B;;AAEA;;EAEE,UAAU;EACV,WAAW;AACb;;AAEA;EACE,WAAW;AACb;;AAEA,gEAAgE;AAChE;EACE,6BAA6B;AAC/B;;AAEA;EACE,wBAAwB;AAC1B;;AAEA;EACE,YAAY;EACZ,OAAO;EACP,kBAAkB;EAClB,MAAM;EACN,WAAW;AACb;;AAEA;EACE,YAAY;EACZ,iBAAiB;EACjB,oBAAoB;AACtB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,yBAAyB;EACzB,eAAe;EACf,SAAS;EACT,QAAQ;EACR,iBAAiB;EACjB,WAAW;EACX,qBAAqB;EACrB,eAAe;EACf,8BAA8B;EAC9B,kBAAkB;EAClB,cAAc;EACd,YAAY;AACd;;AAEA,+BAA+B;AAC/B,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AACrE,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AACrE,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;;AAErE;EACE,sCAAsC;EACtC,8CAA8C;AAChD;;AAEA;EACE,sBAAsB;EACtB,8BAA8B;AAChC;;AAEA;EACE,sBAAsB;EACtB,8BAA8B;AAChC;;AAEA;EACE,cAAc;EACd,kBAAkB;EAClB,YAAY;EACZ,WAAW;AACb;;AAEA;;;;EAIE,aAAa;AACf;;AAEA;;EAEE,0DAA0D;AAC5D;;AAEA;EACE,6BAA6B;EAC7B,cAAc;EACd,qBAAqB;EACrB,6BAA6B;AAC/B;;AAEA;EACE,sBAAsB;EACtB,WAAW;EACX,gBAAgB;EAChB,kBAAkB;EAClB,UAAU;AACZ;;AAEA;;EAEE,kCAAkC;EAClC,eAAe;EACf,WAAW;EACX,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EAClB,WAAW;EACX,YAAY;AACd;;AAEA;EACE,WAAW;AACb;;AAEA;;;EAGE,WAAW;EACX,iBAAiB;EACjB,aAAa;AACf;;AAEA;EACE,yFAA4qB;AAC9qB;;AAEA;EACE,yFAAkzB;AACpzB;;AAEA;EACE,yDAA2qK;AAC7qK;;AAEA;;EAEE,wBAAwB;EACxB,SAAS;EACT,SAAS;EACT,eAAe;EACf,eAAe;EACf,gBAAgB;EAChB,kBAAkB;EAClB;;;;GAIC;EACD,gBAAgB;EAChB,cAAc;EACd,kBAAkB;EAClB,QAAQ;EACR,sCAAsC;EACtC,8CAA8C;EAC9C,aAAa;EACb,kBAAkB;EAClB,0BAA0B,EAAE,8CAA8C;AAC5E;;AAEA;EACE,yBAAyB;EACzB,kBAAkB;AACpB;;AAEA;;;;EAIE,yBAAyB;AAC3B;;AAEA;EACE,qCAAqC;AACvC;;AAEA;EACE,sBAAsB;EACtB,gBAAgB;EAChB,aAAa;EACb,gBAAgB;EAChB,kBAAkB;EAClB,YAAY;EACZ,YAAY;EACZ,SAAS;EACT,kBAAkB;AACpB;;AAEA;EACE,qCAAqC;EACrC,4BAA4B;EAC5B,kCAAkC;EAClC,qBAAqB;EACrB,WAAW;EACX,kBAAkB;EAClB,WAAW;EACX,QAAQ;EACR,QAAQ;EACR,SAAS;AACX;;AAEA;;EAEE,eAAe;AACjB;;AAEA;EACE,SAAS;AACX;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,2FAAivF;EACjvF,wBAAwB;EACxB,SAAS;EACT,eAAe;EACf,gBAAgB;EAChB,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,eAAe;EACf,MAAM;EACN,gBAAgB;AAClB;;AAEA;EACE,WAAW;EACX,8CAA8C;EAC9C,cAAc;EACd,kBAAkB;EAClB,kBAAkB;EAClB,QAAQ;EACR,2BAA2B;EAC3B,WAAW;AACb;;AAEA;EACE,6DAA25B;EAC35B,YAAY;EACZ,YAAY;EACZ,oBAAoB;EACpB,WAAW;AACb;;AAEA;EACE,oCAAoC;EACpC,kCAAkC;EAClC,kBAAkB;EAClB,eAAe;EACf,YAAY;EACZ,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EAClB,UAAU;EACV,SAAS;EACT,QAAQ;EACR,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,+BAA+B;EAC/B,wBAAwB;EACxB,SAAS;EACT,eAAe;EACf,gBAAgB;EAChB,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,eAAe;EACf,MAAM;EACN,gBAAgB;AAClB;;AAEA;EACE,kBAAkB;EAClB,SAAS;EACT,QAAQ;EACR,gCAAgC;EAChC,eAAe;EACf,YAAY;EACZ,aAAa;EACb,wBAAwB;EACxB,uBAAuB;EACvB,kCAAkC;EAClC,eAAe;EACf,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,WAAW;EACX,WAAW;EACX,sBAAsB;EACtB,aAAa;EACb,uBAAuB;EACvB,qBAAqB;EACrB,sBAAsB;AACxB;;AAEA;EACE,qBAAqB;EACrB,mBAAmB;EACnB,eAAe;EACf,WAAW;AACb;;AAEA;EACE,oBAAoB;EACpB,oBAAoB;EACpB,WAAW;EACX,WAAW;AACb;;AAEA;EACE,eAAe;EACf,kBAAkB;EAClB,YAAY;EACZ,WAAW;EACX,UAAU;EACV,eAAe;EACf,WAAW;EACX,kBAAkB;EAClB,iBAAiB;EACjB,YAAY;EACZ,qBAAqB;EACrB,yCAAyC;EACzC,iCAAiC;EACjC,wEAAwE;EACxE,iBAAiB;AACnB;;AAEA;EACE,mEAAmE;AACrE;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,yBAAyB;EACzB,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,oBAAoB;EACpB,sBAAsB;EACtB,SAAS;EACT,OAAO;EACP,QAAQ;EACR,MAAM;EACN,YAAY;AACd;;AAEA;EACE,oBAAoB;AACtB",sourcesContent:["/* .a-fullscreen means not embedded. */\nhtml.a-fullscreen {\n bottom: 0;\n left: 0;\n position: fixed;\n right: 0;\n top: 0;\n}\n\nhtml.a-fullscreen body {\n height: 100%;\n margin: 0;\n overflow: hidden;\n padding: 0;\n width: 100%;\n}\n\n/* Class is removed when doing <a-scene embedded>. */\nhtml.a-fullscreen .a-canvas {\n width: 100% !important;\n height: 100% !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n position: fixed !important;\n}\n\nhtml:not(.a-fullscreen) .a-enter-vr,\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 5px;\n bottom: 5px;\n}\n\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 60px;\n}\n\n/* In chrome mobile the user agent stylesheet set it to white */\n:-webkit-full-screen {\n background-color: transparent;\n}\n\n.a-hidden {\n display: none !important;\n}\n\n.a-canvas {\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.a-canvas.a-grab-cursor:hover {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\ncanvas.a-canvas.a-mouse-cursor-hover:hover {\n cursor: pointer;\n}\n\n.a-inspector-loader {\n background-color: #ed3160;\n position: fixed;\n left: 3px;\n top: 3px;\n padding: 6px 10px;\n color: #fff;\n text-decoration: none;\n font-size: 12px;\n font-family: Roboto,sans-serif;\n text-align: center;\n z-index: 99999;\n width: 204px;\n}\n\n/* Inspector loader animation */\n@keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n@-webkit-keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@-webkit-keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@-webkit-keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n\n.a-inspector-loader .dots span {\n animation: dots-1 2s infinite steps(1);\n -webkit-animation: dots-1 2s infinite steps(1);\n}\n\n.a-inspector-loader .dots span:first-child + span {\n animation-name: dots-2;\n -webkit-animation-name: dots-2;\n}\n\n.a-inspector-loader .dots span:first-child + span + span {\n animation-name: dots-3;\n -webkit-animation-name: dots-3;\n}\n\na-scene {\n display: block;\n position: relative;\n height: 100%;\n width: 100%;\n}\n\na-assets,\na-scene video,\na-scene img,\na-scene audio {\n display: none;\n}\n\n.a-enter-vr-modal,\n.a-orientation-modal {\n font-family: Consolas, Andale Mono, Courier New, monospace;\n}\n\n.a-enter-vr-modal a {\n border-bottom: 1px solid #fff;\n padding: 2px 0;\n text-decoration: none;\n transition: .1s color ease-in;\n}\n\n.a-enter-vr-modal a:hover {\n background-color: #fff;\n color: #111;\n padding: 2px 4px;\n position: relative;\n left: -4px;\n}\n\n.a-enter-vr,\n.a-enter-ar {\n font-family: sans-serif, monospace;\n font-size: 13px;\n width: 100%;\n font-weight: 200;\n line-height: 16px;\n position: absolute;\n right: 20px;\n bottom: 20px;\n}\n\n.a-enter-ar.xr {\n right: 90px;\n}\n\n.a-enter-vr-button,\n.a-enter-vr-modal,\n.a-enter-vr-modal a {\n color: #fff;\n user-select: none;\n outline: none;\n}\n\n.a-enter-vr-button {\n background: rgba(0, 0, 0, 0.35) url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-vrmode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M68.81,21.56H64.23v8.27h4.58a4.13,4.13,0,0,0,3.1-1.09,4.2,4.2,0,0,0,1-3,4.24,4.24,0,0,0-1-3A4.05,4.05,0,0,0,68.81,21.56Z' fill='%23fff'/%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0ZM41.9,46H34L24,16h8l6,21.84,6-21.84H52Zm39.29,0H73.44L68.15,35.39H64.23V46H57V16H68.81q5.32,0,8.34,2.37a8,8,0,0,1,3,6.69,9.68,9.68,0,0,1-1.27,5.18,8.9,8.9,0,0,1-4,3.34l6.26,12.11Z' fill='%23fff'/%3E%3C/svg%3E\") 50% 50% no-repeat;\n}\n\n.a-enter-ar-button {\n background: rgba(0, 0, 0, 0.20) url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0Zm8,50a8,8,0,0,1-8,8H12a8,8,0,0,1-8-8V12a8,8,0,0,1,8-8H96a8,8,0,0,1,8,8Z' fill='%23fff'/%3E%3Cpath d='M43.35,39.82H32.51L30.45,46H23.88L35,16h5.73L52,46H45.43Zm-9.17-5h7.5L37.91,23.58Z' fill='%23fff'/%3E%3Cpath d='M68.11,35H63.18V46H57V16H68.15q5.31,0,8.2,2.37a8.18,8.18,0,0,1,2.88,6.7,9.22,9.22,0,0,1-1.33,5.12,9.09,9.09,0,0,1-4,3.26l6.49,12.26V46H73.73Zm-4.93-5h5a5.09,5.09,0,0,0,3.6-1.18,4.21,4.21,0,0,0,1.28-3.27,4.56,4.56,0,0,0-1.2-3.34A5,5,0,0,0,68.15,21h-5Z' fill='%23fff'/%3E%3C/svg%3E\") 50% 50% no-repeat;\n}\n\n.a-enter-vr.fullscreen .a-enter-vr-button {\n background-image: url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8' standalone='no'%3F%3E%3Csvg width='108' height='62' viewBox='0 0 108 62' version='1.1' id='svg320' sodipodi:docname='fullscreen-aframe.svg' xml:space='preserve' inkscape:version='1.2.1 (9c6d41e 2022-07-14)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3E%3Cdefs id='defs324' /%3E%3Csodipodi:namedview id='namedview322' pagecolor='%23ffffff' bordercolor='%23000000' borderopacity='0.25' inkscape:showpageshadow='2' inkscape:pageopacity='0.0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23d1d1d1' showgrid='false' inkscape:zoom='3.8064516' inkscape:cx='91.423729' inkscape:cy='-1.4449153' inkscape:window-width='1440' inkscape:window-height='847' inkscape:window-x='32' inkscape:window-y='25' inkscape:window-maximized='0' inkscape:current-layer='svg320' /%3E%3Ctitle id='title312'%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M96 0H12A12 12 0 0 0 0 12V50A12 12 0 0 0 12 62H96a12 12 0 0 0 12-12V12A12 12 0 0 0 96 0Zm8 50a8 8 0 0 1-8 8H12a8 8 0 0 1-8-8V12a8 8 0 0 1 8-8H96a8 8 0 0 1 8 8Z' fill='%23fff' id='path314' style='fill:%23ffffff' /%3E%3Cg id='g356' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g358' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g360' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g362' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g364' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g366' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g368' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g370' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g372' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g374' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g376' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g378' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g380' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g382' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g384' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cmetadata id='metadata561'%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=''%3E%3Cdc:title%3Eaframe-armode-noborder-reduced-tracking%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cpath d='m 98.168511 40.083649 c 0 -1.303681 -0.998788 -2.358041 -2.239389 -2.358041 -1.230088 0.0031 -2.240892 1.05436 -2.240892 2.358041 v 4.881296 l -9.041661 -9.041662 c -0.874129 -0.875631 -2.288954 -0.875631 -3.16308 0 -0.874129 0.874126 -0.874129 2.293459 0 3.167585 l 8.995101 8.992101 h -4.858767 c -1.323206 0.0031 -2.389583 1.004796 -2.389583 2.239386 0 1.237598 1.066377 2.237888 2.389583 2.237888 h 10.154599 c 1.323206 0 2.388082 -0.998789 2.392587 -2.237888 -0.0044 -0.03305 -0.009 -0.05858 -0.0134 -0.09161 0.0046 -0.04207 0.0134 -0.08712 0.0134 -0.13066 V 40.085172 h -1.52e-4' id='path596' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 23.091002 35.921781 -9.026643 9.041662 v -4.881296 c 0 -1.303681 -1.009302 -2.355037 -2.242393 -2.358041 -1.237598 0 -2.237888 1.05436 -2.237888 2.358041 l -0.0031 10.016421 c 0 0.04356 0.01211 0.08862 0.0015 0.130659 -0.0031 0.03153 -0.009 0.05709 -0.01211 0.09161 0.0031 1.239099 1.069379 2.237888 2.391085 2.237888 h 10.156101 c 1.320202 0 2.388079 -1.000291 2.388079 -2.237888 0 -1.234591 -1.067877 -2.236383 -2.388079 -2.239387 h -4.858767 l 8.995101 -8.9921 c 0.871126 -0.874127 0.871126 -2.293459 0 -3.167586 -0.875628 -0.877132 -2.291957 -0.877132 -3.169087 -1.52e-4' id='path598' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 84.649572 25.978033 9.041662 -9.041664 v 4.881298 c 0 1.299176 1.010806 2.350532 2.240891 2.355037 1.240601 0 2.23939 -1.055861 2.23939 -2.355037 V 11.798242 c 0 -0.04356 -0.009 -0.08862 -0.0134 -0.127671 0.0044 -0.03153 0.009 -0.06157 0.0134 -0.09313 -0.0044 -1.240598 -1.069379 -2.2393873 -2.391085 -2.2393873 h -10.1546 c -1.323205 0 -2.38958 0.9987893 -2.38958 2.2393873 0 1.233091 1.066375 2.237887 2.38958 2.240891 h 4.858768 l -8.995102 8.9921 c -0.874129 0.872625 -0.874129 2.288954 0 3.161578 0.874127 0.880137 2.288951 0.880137 3.16308 1.5e-4' id='path600' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 17.264988 13.822853 h 4.857265 c 1.320202 -0.0031 2.388079 -1.0078 2.388079 -2.240889 0 -1.240601 -1.067877 -2.2393893 -2.388079 -2.2393893 H 11.967654 c -1.321707 0 -2.388082 0.9987883 -2.391085 2.2393893 0.0031 0.03153 0.009 0.06157 0.01211 0.09313 -0.0031 0.03905 -0.0015 0.08262 -0.0015 0.127671 l 0.0031 10.020926 c 0 1.299176 1.00029 2.355038 2.237887 2.355038 1.233092 -0.0044 2.242393 -1.055862 2.242393 -2.355038 v -4.881295 l 9.026644 9.041661 c 0.877132 0.878635 2.293459 0.878635 3.169087 0 0.871125 -0.872624 0.871125 -2.288953 0 -3.161577 l -8.995282 -8.993616' id='path602' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3C/svg%3E\");\n}\n\n.a-enter-vr-button,\n.a-enter-ar-button {\n background-size: 90% 90%;\n border: 0;\n bottom: 0;\n cursor: pointer;\n min-width: 58px;\n min-height: 34px;\n /* 1.74418604651 */\n /*\n In order to keep the aspect ratio when resizing\n padding-top percentages are relative to the containing block's width.\n http://stackoverflow.com/questions/12121090/responsively-change-div-size-keeping-aspect-ratio\n */\n padding-right: 0;\n padding-top: 0;\n position: absolute;\n right: 0;\n transition: background-color .05s ease;\n -webkit-transition: background-color .05s ease;\n z-index: 9999;\n border-radius: 8px;\n touch-action: manipulation; /* Prevent iOS double tap zoom on the button */\n}\n\n.a-enter-ar-button {\n background-size: 100% 90%;\n border-radius: 7px;\n}\n\n.a-enter-ar-button:active,\n.a-enter-ar-button:hover,\n.a-enter-vr-button:active,\n.a-enter-vr-button:hover {\n background-color: #ef2d5e;\n}\n\n.a-enter-vr-button.resethover {\n background-color: rgba(0, 0, 0, 0.35);\n}\n\n.a-enter-vr-modal {\n background-color: #666;\n border-radius: 0;\n display: none;\n min-height: 32px;\n margin-right: 70px;\n padding: 9px;\n width: 280px;\n right: 2%;\n position: absolute;\n}\n\n.a-enter-vr-modal:after {\n border-bottom: 10px solid transparent;\n border-left: 10px solid #666;\n border-top: 10px solid transparent;\n display: inline-block;\n content: '';\n position: absolute;\n right: -5px;\n top: 5px;\n width: 0;\n height: 0;\n}\n\n.a-enter-vr-modal p,\n.a-enter-vr-modal a {\n display: inline;\n}\n\n.a-enter-vr-modal p {\n margin: 0;\n}\n\n.a-enter-vr-modal p:after {\n content: ' ';\n}\n\n.a-orientation-modal {\n background: rgba(244, 244, 244, 1) url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E) center no-repeat;\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-orientation-modal:after {\n color: #666;\n content: \"Insert phone into Cardboard holder.\";\n display: block;\n position: absolute;\n text-align: center;\n top: 70%;\n transform: translateY(-70%);\n width: 100%;\n}\n\n.a-orientation-modal button {\n background: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E) no-repeat;\n border: none;\n height: 50px;\n text-indent: -9999px;\n width: 50px;\n}\n\n.a-loader-title {\n background-color: rgba(0, 0, 0, 0.6);\n font-family: sans-serif, monospace;\n text-align: center;\n font-size: 20px;\n height: 50px;\n font-weight: 300;\n line-height: 50px;\n position: absolute;\n right: 0px;\n left: 0px;\n top: 0px;\n color: white;\n}\n\n.a-modal {\n position: absolute;\n background: rgba(0, 0, 0, 0.60);\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-dialog {\n position: relative;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n z-index: 199995;\n width: 300px;\n height: 200px;\n background-size: contain;\n background-color: white;\n font-family: sans-serif, monospace;\n font-size: 20px;\n border-radius: 3px;\n padding: 6px;\n}\n\n.a-dialog-text-container {\n width: 100%;\n height: 70%;\n align-self: flex-start;\n display: flex;\n justify-content: center;\n align-content: center;\n flex-direction: column;\n}\n\n.a-dialog-text {\n display: inline-block;\n font-weight: normal;\n font-size: 14pt;\n margin: 8px;\n}\n\n.a-dialog-buttons-container {\n display: inline-flex;\n align-self: flex-end;\n width: 100%;\n height: 30%;\n}\n\n.a-dialog-button {\n cursor: pointer;\n align-self: center;\n opacity: 0.9;\n height: 80%;\n width: 50%;\n font-size: 12pt;\n margin: 4px;\n border-radius: 2px;\n text-align:center;\n border: none;\n display: inline-block;\n -webkit-transition: all 0.25s ease-in-out;\n transition: all 0.25s ease-in-out;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.20);\n user-select: none;\n}\n\n.a-dialog-permission-button:hover {\n box-shadow: 0 7px 14px rgba(0,0,0,0.20), 0 2px 2px rgba(0,0,0,0.20);\n}\n\n.a-dialog-allow-button {\n background-color: #00ceff;\n}\n\n.a-dialog-deny-button {\n background-color: #ff005b;\n}\n\n.a-dialog-ok-button {\n background-color: #00ceff;\n width: 100%;\n}\n\n.a-dom-overlay:not(.a-no-style) {\n overflow: hidden;\n position: absolute;\n pointer-events: none;\n box-sizing: border-box;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n padding: 1em;\n}\n\n.a-dom-overlay:not(.a-no-style)>* {\n pointer-events: auto;\n}\n"],sourceRoot:""}]);const E=A},2470:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(963),r=n.n(i),s=n(9089),o=n.n(s)()(r());o.push([e.id,".rs-base {\n background-color: #333;\n color: #fafafa;\n border-radius: 0;\n font: 10px monospace;\n left: 5px;\n line-height: 1em;\n opacity: 0.85;\n overflow: hidden;\n padding: 10px;\n position: fixed;\n top: 5px;\n width: 300px;\n z-index: 10000;\n}\n\n.rs-base div.hidden {\n display: none;\n}\n\n.rs-base h1 {\n color: #fff;\n cursor: pointer;\n font-size: 1.4em;\n font-weight: 300;\n margin: 0 0 5px;\n padding: 0;\n}\n\n.rs-group {\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n -webkit-flex-direction: column-reverse;\n flex-direction: column-reverse;\n margin-bottom: 5px;\n}\n\n.rs-group:last-child {\n margin-bottom: 0;\n}\n\n.rs-counter-base {\n align-items: center;\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n height: 10px;\n -webkit-justify-content: space-between;\n justify-content: space-between;\n margin: 2px 0;\n}\n\n.rs-counter-base.alarm {\n color: #b70000;\n text-shadow: 0 0 0 #b70000,\n 0 0 1px #fff,\n 0 0 1px #fff,\n 0 0 2px #fff,\n 0 0 2px #fff,\n 0 0 3px #fff,\n 0 0 3px #fff,\n 0 0 4px #fff,\n 0 0 4px #fff;\n}\n\n.rs-counter-id {\n font-weight: 300;\n -webkit-box-ordinal-group: 0;\n -webkit-order: 0;\n order: 0;\n width: 54px;\n}\n\n.rs-counter-value {\n font-weight: 300;\n -webkit-box-ordinal-group: 1;\n -webkit-order: 1;\n order: 1;\n text-align: right;\n width: 35px;\n}\n\n.rs-canvas {\n -webkit-box-ordinal-group: 2;\n -webkit-order: 2;\n order: 2;\n}\n\n@media (min-width: 480px) {\n .rs-base {\n left: 20px;\n top: 20px;\n }\n}\n","",{version:3,sources:["webpack://./src/style/rStats.css"],names:[],mappings:"AAAA;EACE,sBAAsB;EACtB,cAAc;EACd,gBAAgB;EAChB,oBAAoB;EACpB,SAAS;EACT,gBAAgB;EAChB,aAAa;EACb,gBAAgB;EAChB,aAAa;EACb,eAAe;EACf,QAAQ;EACR,YAAY;EACZ,cAAc;AAChB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,WAAW;EACX,eAAe;EACf,gBAAgB;EAChB,gBAAgB;EAChB,eAAe;EACf,UAAU;AACZ;;AAEA;EACE,oBAAoB;EACpB,qBAAqB;EACrB,aAAa;EACb,sCAAsC;EACtC,8BAA8B;EAC9B,kBAAkB;AACpB;;AAEA;EACE,gBAAgB;AAClB;;AAEA;EACE,mBAAmB;EACnB,oBAAoB;EACpB,qBAAqB;EACrB,aAAa;EACb,YAAY;EACZ,sCAAsC;EACtC,8BAA8B;EAC9B,aAAa;AACf;;AAEA;EACE,cAAc;EACd;;;;;;;;2BAQyB;AAC3B;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;EACR,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;EACR,iBAAiB;EACjB,WAAW;AACb;;AAEA;EACE,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;AACV;;AAEA;EACE;IACE,UAAU;IACV,SAAS;EACX;AACF",sourcesContent:[".rs-base {\n background-color: #333;\n color: #fafafa;\n border-radius: 0;\n font: 10px monospace;\n left: 5px;\n line-height: 1em;\n opacity: 0.85;\n overflow: hidden;\n padding: 10px;\n position: fixed;\n top: 5px;\n width: 300px;\n z-index: 10000;\n}\n\n.rs-base div.hidden {\n display: none;\n}\n\n.rs-base h1 {\n color: #fff;\n cursor: pointer;\n font-size: 1.4em;\n font-weight: 300;\n margin: 0 0 5px;\n padding: 0;\n}\n\n.rs-group {\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n -webkit-flex-direction: column-reverse;\n flex-direction: column-reverse;\n margin-bottom: 5px;\n}\n\n.rs-group:last-child {\n margin-bottom: 0;\n}\n\n.rs-counter-base {\n align-items: center;\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n height: 10px;\n -webkit-justify-content: space-between;\n justify-content: space-between;\n margin: 2px 0;\n}\n\n.rs-counter-base.alarm {\n color: #b70000;\n text-shadow: 0 0 0 #b70000,\n 0 0 1px #fff,\n 0 0 1px #fff,\n 0 0 2px #fff,\n 0 0 2px #fff,\n 0 0 3px #fff,\n 0 0 3px #fff,\n 0 0 4px #fff,\n 0 0 4px #fff;\n}\n\n.rs-counter-id {\n font-weight: 300;\n -webkit-box-ordinal-group: 0;\n -webkit-order: 0;\n order: 0;\n width: 54px;\n}\n\n.rs-counter-value {\n font-weight: 300;\n -webkit-box-ordinal-group: 1;\n -webkit-order: 1;\n order: 1;\n text-align: right;\n width: 35px;\n}\n\n.rs-canvas {\n -webkit-box-ordinal-group: 2;\n -webkit-order: 2;\n order: 2;\n}\n\n@media (min-width: 480px) {\n .rs-base {\n left: 20px;\n top: 20px;\n }\n}\n"],sourceRoot:""}]);const a=o},7180:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>g});var i=n(5072),r=n.n(i),s=n(7825),o=n.n(s),a=n(7659),l=n.n(a),c=n(5056),h=n.n(c),d=n(540),u=n.n(d),p=n(1113),A=n.n(p),f=n(8217),m={};m.styleTagTransform=A(),m.setAttributes=h(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=u(),r()(f.A,m);const g=f.A&&f.A.locals?f.A.locals:void 0},9379:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>g});var i=n(5072),r=n.n(i),s=n(7825),o=n.n(s),a=n(7659),l=n.n(a),c=n(5056),h=n.n(c),d=n(540),u=n.n(d),p=n(1113),A=n.n(p),f=n(2470),m={};m.styleTagTransform=A(),m.setAttributes=h(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=u(),r()(f.A,m);const g=f.A&&f.A.locals?f.A.locals:void 0},5072:e=>{"use strict";var t=[];function n(e){for(var n=-1,i=0;i<t.length;i++)if(t[i].identifier===e){n=i;break}return n}function i(e,i){for(var s={},o=[],a=0;a<e.length;a++){var l=e[a],c=i.base?l[0]+i.base:l[0],h=s[c]||0,d="".concat(c," ").concat(h);s[c]=h+1;var u=n(d),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==u)t[u].references++,t[u].updater(p);else{var A=r(p,i);i.byIndex=a,t.splice(a,0,{identifier:d,updater:A,references:1})}o.push(d)}return o}function r(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var s=i(e=e||[],r=r||{});return function(e){e=e||[];for(var o=0;o<s.length;o++){var a=n(s[o]);t[a].references--}for(var l=i(e,r),c=0;c<s.length;c++){var h=n(s[c]);0===t[h].references&&(t[h].updater(),t.splice(h,1))}s=l}}},7659:e=>{"use strict";var t={};e.exports=function(e,n){var i=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},5056:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},7825:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(i,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},1113:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},3931:e=>{"use strict";e.exports="data:image/svg+xml,%3C%3Fxml version=%271.0%27 encoding=%27UTF-8%27 standalone=%27no%27%3F%3E%3Csvg width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27 version=%271.1%27 id=%27svg320%27 sodipodi:docname=%27fullscreen-aframe.svg%27 xml:space=%27preserve%27 inkscape:version=%271.2.1 %289c6d41e 2022-07-14%29%27 xmlns:inkscape=%27http://www.inkscape.org/namespaces/inkscape%27 xmlns:sodipodi=%27http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd%27 xmlns=%27http://www.w3.org/2000/svg%27 xmlns:svg=%27http://www.w3.org/2000/svg%27 xmlns:rdf=%27http://www.w3.org/1999/02/22-rdf-syntax-ns%23%27 xmlns:cc=%27http://creativecommons.org/ns%23%27 xmlns:dc=%27http://purl.org/dc/elements/1.1/%27%3E%3Cdefs id=%27defs324%27 /%3E%3Csodipodi:namedview id=%27namedview322%27 pagecolor=%27%23ffffff%27 bordercolor=%27%23000000%27 borderopacity=%270.25%27 inkscape:showpageshadow=%272%27 inkscape:pageopacity=%270.0%27 inkscape:pagecheckerboard=%270%27 inkscape:deskcolor=%27%23d1d1d1%27 showgrid=%27false%27 inkscape:zoom=%273.8064516%27 inkscape:cx=%2791.423729%27 inkscape:cy=%27-1.4449153%27 inkscape:window-width=%271440%27 inkscape:window-height=%27847%27 inkscape:window-x=%2732%27 inkscape:window-y=%2725%27 inkscape:window-maximized=%270%27 inkscape:current-layer=%27svg320%27 /%3E%3Ctitle id=%27title312%27%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M96 0H12A12 12 0 0 0 0 12V50A12 12 0 0 0 12 62H96a12 12 0 0 0 12-12V12A12 12 0 0 0 96 0Zm8 50a8 8 0 0 1-8 8H12a8 8 0 0 1-8-8V12a8 8 0 0 1 8-8H96a8 8 0 0 1 8 8Z%27 fill=%27%23fff%27 id=%27path314%27 style=%27fill:%23ffffff%27 /%3E%3Cg id=%27g356%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g358%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g360%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g362%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g364%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g366%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g368%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g370%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g372%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g374%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g376%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g378%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g380%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g382%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g384%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cmetadata id=%27metadata561%27%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=%27%27%3E%3Cdc:title%3Eaframe-armode-noborder-reduced-tracking%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cpath d=%27m 98.168511 40.083649 c 0 -1.303681 -0.998788 -2.358041 -2.239389 -2.358041 -1.230088 0.0031 -2.240892 1.05436 -2.240892 2.358041 v 4.881296 l -9.041661 -9.041662 c -0.874129 -0.875631 -2.288954 -0.875631 -3.16308 0 -0.874129 0.874126 -0.874129 2.293459 0 3.167585 l 8.995101 8.992101 h -4.858767 c -1.323206 0.0031 -2.389583 1.004796 -2.389583 2.239386 0 1.237598 1.066377 2.237888 2.389583 2.237888 h 10.154599 c 1.323206 0 2.388082 -0.998789 2.392587 -2.237888 -0.0044 -0.03305 -0.009 -0.05858 -0.0134 -0.09161 0.0046 -0.04207 0.0134 -0.08712 0.0134 -0.13066 V 40.085172 h -1.52e-4%27 id=%27path596%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 23.091002 35.921781 -9.026643 9.041662 v -4.881296 c 0 -1.303681 -1.009302 -2.355037 -2.242393 -2.358041 -1.237598 0 -2.237888 1.05436 -2.237888 2.358041 l -0.0031 10.016421 c 0 0.04356 0.01211 0.08862 0.0015 0.130659 -0.0031 0.03153 -0.009 0.05709 -0.01211 0.09161 0.0031 1.239099 1.069379 2.237888 2.391085 2.237888 h 10.156101 c 1.320202 0 2.388079 -1.000291 2.388079 -2.237888 0 -1.234591 -1.067877 -2.236383 -2.388079 -2.239387 h -4.858767 l 8.995101 -8.9921 c 0.871126 -0.874127 0.871126 -2.293459 0 -3.167586 -0.875628 -0.877132 -2.291957 -0.877132 -3.169087 -1.52e-4%27 id=%27path598%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 84.649572 25.978033 9.041662 -9.041664 v 4.881298 c 0 1.299176 1.010806 2.350532 2.240891 2.355037 1.240601 0 2.23939 -1.055861 2.23939 -2.355037 V 11.798242 c 0 -0.04356 -0.009 -0.08862 -0.0134 -0.127671 0.0044 -0.03153 0.009 -0.06157 0.0134 -0.09313 -0.0044 -1.240598 -1.069379 -2.2393873 -2.391085 -2.2393873 h -10.1546 c -1.323205 0 -2.38958 0.9987893 -2.38958 2.2393873 0 1.233091 1.066375 2.237887 2.38958 2.240891 h 4.858768 l -8.995102 8.9921 c -0.874129 0.872625 -0.874129 2.288954 0 3.161578 0.874127 0.880137 2.288951 0.880137 3.16308 1.5e-4%27 id=%27path600%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 17.264988 13.822853 h 4.857265 c 1.320202 -0.0031 2.388079 -1.0078 2.388079 -2.240889 0 -1.240601 -1.067877 -2.2393893 -2.388079 -2.2393893 H 11.967654 c -1.321707 0 -2.388082 0.9987883 -2.391085 2.2393893 0.0031 0.03153 0.009 0.06157 0.01211 0.09313 -0.0031 0.03905 -0.0015 0.08262 -0.0015 0.127671 l 0.0031 10.020926 c 0 1.299176 1.00029 2.355038 2.237887 2.355038 1.233092 -0.0044 2.242393 -1.055862 2.242393 -2.355038 v -4.881295 l 9.026644 9.041661 c 0.877132 0.878635 2.293459 0.878635 3.169087 0 0.871125 -0.872624 0.871125 -2.288953 0 -3.161577 l -8.995282 -8.993616%27 id=%27path602%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3C/svg%3E"},6085:e=>{"use strict";e.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27%3E%3Ctitle%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0Zm8,50a8,8,0,0,1-8,8H12a8,8,0,0,1-8-8V12a8,8,0,0,1,8-8H96a8,8,0,0,1,8,8Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M43.35,39.82H32.51L30.45,46H23.88L35,16h5.73L52,46H45.43Zm-9.17-5h7.5L37.91,23.58Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M68.11,35H63.18V46H57V16H68.15q5.31,0,8.2,2.37a8.18,8.18,0,0,1,2.88,6.7,9.22,9.22,0,0,1-1.33,5.12,9.09,9.09,0,0,1-4,3.26l6.49,12.26V46H73.73Zm-4.93-5h5a5.09,5.09,0,0,0,3.6-1.18,4.21,4.21,0,0,0,1.28-3.27,4.56,4.56,0,0,0-1.2-3.34A5,5,0,0,0,68.15,21h-5Z%27 fill=%27%23fff%27/%3E%3C/svg%3E"},9169:e=>{"use strict";e.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27%3E%3Ctitle%3Eaframe-vrmode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M68.81,21.56H64.23v8.27h4.58a4.13,4.13,0,0,0,3.1-1.09,4.2,4.2,0,0,0,1-3,4.24,4.24,0,0,0-1-3A4.05,4.05,0,0,0,68.81,21.56Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0ZM41.9,46H34L24,16h8l6,21.84,6-21.84H52Zm39.29,0H73.44L68.15,35.39H64.23V46H57V16H68.81q5.32,0,8.34,2.37a8,8,0,0,1,3,6.69,9.68,9.68,0,0,1-1.27,5.18,8.9,8.9,0,0,1-4,3.34l6.26,12.11Z%27 fill=%27%23fff%27/%3E%3C/svg%3E"},6517:e=>{"use strict";e.exports="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E"},7889:e=>{"use strict";e.exports="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E"},7496:(e,t,n)=>{"use strict";n.d(t,{A:()=>qg});var i={};n.r(i),n.d(i,{ACESFilmicToneMapping:()=>oe,AddEquation:()=>_,AddOperation:()=>te,AdditiveAnimationBlendMode:()=>Vt,AdditiveBlending:()=>x,AgXToneMapping:()=>le,AlphaFormat:()=>He,AlwaysCompare:()=>Bn,AlwaysDepth:()=>W,AlwaysStencilFunc:()=>xn,AmbientLight:()=>Th,AnimationAction:()=>Ed,AnimationClip:()=>$c,AnimationLoader:()=>lh,AnimationMixer:()=>bd,AnimationObjectGroup:()=>yd,AnimationUtils:()=>Qc,ArcCurve:()=>nl,ArrayCamera:()=>Jh,ArrowHelper:()=>fu,AttachedBindMode:()=>he,Audio:()=>rd,AudioAnalyser:()=>hd,AudioContext:()=>Vh,AudioListener:()=>id,AudioLoader:()=>jh,AxesHelper:()=>mu,BackSide:()=>g,BasicDepthPacking:()=>Xt,BasicShadowMap:()=>u,BatchedMesh:()=>wa,Bone:()=>Qo,BooleanKeyframeTrack:()=>Wc,Box2:()=>Od,Box3:()=>Ui,Box3Helper:()=>hu,BoxGeometry:()=>Hs,BoxHelper:()=>cu,BufferAttribute:()=>us,BufferGeometry:()=>Bs,BufferGeometryLoader:()=>Fh,ByteType:()=>Le,Cache:()=>th,Camera:()=>Ys,CameraHelper:()=>ou,CanvasTexture:()=>Za,CapsuleGeometry:()=>Cl,CatmullRomCurve3:()=>ll,CineonToneMapping:()=>se,CircleGeometry:()=>wl,ClampToEdgeWrapping:()=>ye,Clock:()=>Kh,Color:()=>es,ColorKeyframeTrack:()=>qc,ColorManagement:()=>Ai,CompressedArrayTexture:()=>Ja,CompressedCubeTexture:()=>Ka,CompressedTexture:()=>Ya,CompressedTextureLoader:()=>ch,ConeGeometry:()=>Ml,ConstantAlphaFactor:()=>H,ConstantColorFactor:()=>G,Controls:()=>vu,CubeCamera:()=>to,CubeReflectionMapping:()=>pe,CubeRefractionMapping:()=>Ae,CubeTexture:()=>no,CubeTextureLoader:()=>dh,CubeUVReflectionMapping:()=>ge,CubicBezierCurve:()=>ul,CubicBezierCurve3:()=>pl,CubicInterpolant:()=>zc,CullFaceBack:()=>c,CullFaceFront:()=>h,CullFaceFrontBack:()=>d,CullFaceNone:()=>l,Curve:()=>el,CurvePath:()=>El,CustomBlending:()=>w,CustomToneMapping:()=>ae,CylinderGeometry:()=>_l,Cylindrical:()=>Dd,Data3DTexture:()=>Bi,DataArrayTexture:()=>Si,DataTexture:()=>Go,DataTextureLoader:()=>uh,DataUtils:()=>cs,DecrementStencilOp:()=>hn,DecrementWrapStencilOp:()=>un,DefaultLoadingManager:()=>ih,DepthFormat:()=>Xe,DepthStencilFormat:()=>Ye,DepthTexture:()=>$a,DetachedBindMode:()=>de,DirectionalLight:()=>Bh,DirectionalLightHelper:()=>iu,DiscreteInterpolant:()=>Vc,DodecahedronGeometry:()=>Il,DoubleSide:()=>v,DstAlphaFactor:()=>O,DstColorFactor:()=>k,DynamicCopyUsage:()=>Fn,DynamicDrawUsage:()=>Rn,DynamicReadUsage:()=>Pn,EdgesGeometry:()=>Dl,EllipseCurve:()=>tl,EqualCompare:()=>wn,EqualDepth:()=>Y,EqualStencilFunc:()=>mn,EquirectangularReflectionMapping:()=>fe,EquirectangularRefractionMapping:()=>me,Euler:()=>vr,EventDispatcher:()=>Hn,ExtrudeGeometry:()=>lc,FileLoader:()=>ah,Float16BufferAttribute:()=>Es,Float32BufferAttribute:()=>xs,FloatType:()=>Fe,Fog:()=>so,FogExp2:()=>ro,FramebufferTexture:()=>Xa,FrontSide:()=>m,Frustum:()=>oa,GLBufferAttribute:()=>Sd,GLSL1:()=>Nn,GLSL3:()=>Qn,GreaterCompare:()=>Mn,GreaterDepth:()=>K,GreaterEqualCompare:()=>In,GreaterEqualDepth:()=>J,GreaterEqualStencilFunc:()=>En,GreaterStencilFunc:()=>vn,GridHelper:()=>Zd,Group:()=>Wa,HalfFloatType:()=>ke,HemisphereLight:()=>fh,HemisphereLightHelper:()=>Kd,IcosahedronGeometry:()=>hc,ImageBitmapLoader:()=>zh,ImageLoader:()=>hh,ImageUtils:()=>vi,IncrementStencilOp:()=>cn,IncrementWrapStencilOp:()=>dn,InstancedBufferAttribute:()=>jo,InstancedBufferGeometry:()=>Oh,InstancedInterleavedBuffer:()=>Md,InstancedMesh:()=>$o,Int16BufferAttribute:()=>ms,Int32BufferAttribute:()=>vs,Int8BufferAttribute:()=>ps,IntType:()=>Ue,InterleavedBuffer:()=>ao,InterleavedBufferAttribute:()=>co,Interpolant:()=>Gc,InterpolateDiscrete:()=>Ft,InterpolateLinear:()=>kt,InterpolateSmooth:()=>Nt,InvertStencilOp:()=>pn,KeepStencilOp:()=>an,KeyframeTrack:()=>jc,LOD:()=>Bo,LatheGeometry:()=>bl,Layers:()=>yr,LessCompare:()=>Cn,LessDepth:()=>q,LessEqualCompare:()=>_n,LessEqualDepth:()=>X,LessEqualStencilFunc:()=>gn,LessStencilFunc:()=>fn,Light:()=>Ah,LightProbe:()=>Dh,Line:()=>Da,Line3:()=>Nd,LineBasicMaterial:()=>_a,LineCurve:()=>Al,LineCurve3:()=>fl,LineDashedMaterial:()=>Pc,LineLoop:()=>ka,LineSegments:()=>Fa,LinearFilter:()=>Me,LinearInterpolant:()=>Hc,LinearMipMapLinearFilter:()=>Te,LinearMipMapNearestFilter:()=>Ie,LinearMipmapLinearFilter:()=>Be,LinearMipmapNearestFilter:()=>Se,LinearSRGBColorSpace:()=>nn,LinearToneMapping:()=>ie,LinearTransfer:()=>rn,Loader:()=>rh,LoaderUtils:()=>Uh,LoadingManager:()=>nh,LoopOnce:()=>Pt,LoopPingPong:()=>Ot,LoopRepeat:()=>Ut,LuminanceAlphaFormat:()=>qe,LuminanceFormat:()=>We,MOUSE:()=>o,Material:()=>is,MaterialLoader:()=>Ph,MathUtils:()=>ei,Matrix2:()=>Pd,Matrix3:()=>ni,Matrix4:()=>lr,MaxEquation:()=>B,Mesh:()=>Gs,MeshBasicMaterial:()=>rs,MeshDepthMaterial:()=>Rc,MeshDistanceMaterial:()=>Lc,MeshLambertMaterial:()=>Tc,MeshMatcapMaterial:()=>Dc,MeshNormalMaterial:()=>Bc,MeshPhongMaterial:()=>Sc,MeshPhysicalMaterial:()=>Mc,MeshStandardMaterial:()=>_c,MeshToonMaterial:()=>Ic,MinEquation:()=>I,MirroredRepeatWrapping:()=>Ee,MixOperation:()=>ee,MultiplyBlending:()=>C,MultiplyOperation:()=>$,NearestFilter:()=>xe,NearestMipMapLinearFilter:()=>_e,NearestMipMapNearestFilter:()=>Ce,NearestMipmapLinearFilter:()=>we,NearestMipmapNearestFilter:()=>be,NeutralToneMapping:()=>ce,NeverCompare:()=>bn,NeverDepth:()=>j,NeverStencilFunc:()=>An,NoBlending:()=>y,NoColorSpace:()=>en,NoToneMapping:()=>ne,NormalAnimationBlendMode:()=>Ht,NormalBlending:()=>E,NotEqualCompare:()=>Sn,NotEqualDepth:()=>Z,NotEqualStencilFunc:()=>yn,NumberKeyframeTrack:()=>Xc,Object3D:()=>Ur,ObjectLoader:()=>kh,ObjectSpaceNormalMap:()=>$t,OctahedronGeometry:()=>dc,OneFactor:()=>R,OneMinusConstantAlphaFactor:()=>V,OneMinusConstantColorFactor:()=>z,OneMinusDstAlphaFactor:()=>F,OneMinusDstColorFactor:()=>N,OneMinusSrcAlphaFactor:()=>U,OneMinusSrcColorFactor:()=>D,OrthographicCamera:()=>Sh,PCFShadowMap:()=>p,PCFSoftShadowMap:()=>A,PMREMGenerator:()=>Wu,Path:()=>xl,PerspectiveCamera:()=>$s,Plane:()=>ia,PlaneGeometry:()=>uc,PlaneHelper:()=>du,PointLight:()=>Mh,PointLightHelper:()=>qd,Points:()=>Va,PointsMaterial:()=>Na,PolarGridHelper:()=>$d,PolyhedronGeometry:()=>Sl,PositionalAudio:()=>cd,PropertyBinding:()=>vd,PropertyMixer:()=>dd,QuadraticBezierCurve:()=>ml,QuadraticBezierCurve3:()=>gl,Quaternion:()=>Ri,QuaternionKeyframeTrack:()=>Jc,QuaternionLinearInterpolant:()=>Yc,RED_GREEN_RGTC2_Format:()=>Lt,RED_RGTC1_Format:()=>Tt,REVISION:()=>s,RGBADepthPacking:()=>Yt,RGBAFormat:()=>je,RGBAIntegerFormat:()=>tt,RGBA_ASTC_10x10_Format:()=>wt,RGBA_ASTC_10x5_Format:()=>xt,RGBA_ASTC_10x6_Format:()=>bt,RGBA_ASTC_10x8_Format:()=>Ct,RGBA_ASTC_12x10_Format:()=>_t,RGBA_ASTC_12x12_Format:()=>Mt,RGBA_ASTC_4x4_Format:()=>pt,RGBA_ASTC_5x4_Format:()=>At,RGBA_ASTC_5x5_Format:()=>ft,RGBA_ASTC_6x5_Format:()=>mt,RGBA_ASTC_6x6_Format:()=>gt,RGBA_ASTC_8x5_Format:()=>vt,RGBA_ASTC_8x6_Format:()=>yt,RGBA_ASTC_8x8_Format:()=>Et,RGBA_BPTC_Format:()=>St,RGBA_ETC2_EAC_Format:()=>ut,RGBA_PVRTC_2BPPV1_Format:()=>ct,RGBA_PVRTC_4BPPV1_Format:()=>lt,RGBA_S3TC_DXT1_Format:()=>it,RGBA_S3TC_DXT3_Format:()=>rt,RGBA_S3TC_DXT5_Format:()=>st,RGBDepthPacking:()=>Jt,RGBFormat:()=>Ve,RGBIntegerFormat:()=>et,RGB_BPTC_SIGNED_Format:()=>It,RGB_BPTC_UNSIGNED_Format:()=>Bt,RGB_ETC1_Format:()=>ht,RGB_ETC2_Format:()=>dt,RGB_PVRTC_2BPPV1_Format:()=>at,RGB_PVRTC_4BPPV1_Format:()=>ot,RGB_S3TC_DXT1_Format:()=>nt,RGDepthPacking:()=>Kt,RGFormat:()=>Ze,RGIntegerFormat:()=>$e,RawShaderMaterial:()=>wc,Ray:()=>ar,Raycaster:()=>Bd,RectAreaLight:()=>Rh,RedFormat:()=>Je,RedIntegerFormat:()=>Ke,ReinhardToneMapping:()=>re,RenderTarget:()=>_i,RepeatWrapping:()=>ve,ReplaceStencilOp:()=>ln,ReverseSubtractEquation:()=>S,RingGeometry:()=>pc,SIGNED_RED_GREEN_RGTC2_Format:()=>Dt,SIGNED_RED_RGTC1_Format:()=>Rt,SRGBColorSpace:()=>tn,SRGBTransfer:()=>sn,Scene:()=>oo,ShaderChunk:()=>wu,ShaderLib:()=>Mu,ShaderMaterial:()=>Xs,ShadowMaterial:()=>Cc,Shape:()=>Pl,ShapeGeometry:()=>Ac,ShapePath:()=>gu,ShapeUtils:()=>sc,ShortType:()=>De,Skeleton:()=>Vo,SkeletonHelper:()=>jd,SkinnedMesh:()=>No,Source:()=>Ei,Sphere:()=>$i,SphereGeometry:()=>fc,Spherical:()=>Ld,SphericalHarmonics3:()=>Lh,SplineCurve:()=>vl,SpotLight:()=>xh,SpotLightHelper:()=>Gd,Sprite:()=>_o,SpriteMaterial:()=>ho,SrcAlphaFactor:()=>P,SrcAlphaSaturateFactor:()=>Q,SrcColorFactor:()=>L,StaticCopyUsage:()=>On,StaticDrawUsage:()=>Tn,StaticReadUsage:()=>Dn,StereoCamera:()=>Yh,StreamCopyUsage:()=>kn,StreamDrawUsage:()=>Ln,StreamReadUsage:()=>Un,StringKeyframeTrack:()=>Kc,SubtractEquation:()=>M,SubtractiveBlending:()=>b,TOUCH:()=>a,TangentSpaceNormalMap:()=>Zt,TetrahedronGeometry:()=>mc,Texture:()=>Ci,TextureLoader:()=>ph,TextureUtils:()=>Eu,TorusGeometry:()=>gc,TorusKnotGeometry:()=>vc,Triangle:()=>Yr,TriangleFanDrawMode:()=>qt,TriangleStripDrawMode:()=>Wt,TrianglesDrawMode:()=>jt,TubeGeometry:()=>yc,UVMapping:()=>ue,Uint16BufferAttribute:()=>gs,Uint32BufferAttribute:()=>ys,Uint8BufferAttribute:()=>As,Uint8ClampedBufferAttribute:()=>fs,Uniform:()=>Cd,UniformsGroup:()=>_d,UniformsLib:()=>_u,UniformsUtils:()=>qs,UnsignedByteType:()=>Re,UnsignedInt248Type:()=>Ge,UnsignedInt5999Type:()=>ze,UnsignedIntType:()=>Oe,UnsignedShort4444Type:()=>Ne,UnsignedShort5551Type:()=>Qe,UnsignedShortType:()=>Pe,VSMShadowMap:()=>f,Vector2:()=>ti,Vector3:()=>Li,Vector4:()=>wi,VectorKeyframeTrack:()=>Zc,VideoTexture:()=>qa,WebGL3DRenderTarget:()=>Ti,WebGLArrayRenderTarget:()=>Ii,WebGLCoordinateSystem:()=>Gn,WebGLCubeRenderTarget:()=>io,WebGLMultipleRenderTargets:()=>xu,WebGLRenderTarget:()=>Mi,WebGLRenderer:()=>sf,WebGLUtils:()=>XA,WebGPUCoordinateSystem:()=>zn,WireframeGeometry:()=>Ec,WrapAroundEnding:()=>zt,ZeroCurvatureEnding:()=>Qt,ZeroFactor:()=>T,ZeroSlopeEnding:()=>Gt,ZeroStencilOp:()=>on,createCanvasElement:()=>li});var r={};n.r(r),n.d(r,{computeMikkTSpaceTangents:()=>lf,computeMorphedAttributes:()=>vf,deepCloneAttribute:()=>df,deinterleaveAttribute:()=>pf,deinterleaveGeometry:()=>Af,estimateBytesUsed:()=>ff,interleaveAttributes:()=>uf,mergeAttributes:()=>hf,mergeGeometries:()=>cf,mergeGroups:()=>yf,mergeVertices:()=>mf,toCreasedNormals:()=>Ef,toTrianglesDrawMode:()=>gf});const s="171",o={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},a={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},l=0,c=1,h=2,d=3,u=0,p=1,A=2,f=3,m=0,g=1,v=2,y=0,E=1,x=2,b=3,C=4,w=5,_=100,M=101,S=102,I=103,B=104,T=200,R=201,L=202,D=203,P=204,U=205,O=206,F=207,k=208,N=209,Q=210,G=211,z=212,H=213,V=214,j=0,W=1,q=2,X=3,Y=4,J=5,K=6,Z=7,$=0,ee=1,te=2,ne=0,ie=1,re=2,se=3,oe=4,ae=5,le=6,ce=7,he="attached",de="detached",ue=300,pe=301,Ae=302,fe=303,me=304,ge=306,ve=1e3,ye=1001,Ee=1002,xe=1003,be=1004,Ce=1004,we=1005,_e=1005,Me=1006,Se=1007,Ie=1007,Be=1008,Te=1008,Re=1009,Le=1010,De=1011,Pe=1012,Ue=1013,Oe=1014,Fe=1015,ke=1016,Ne=1017,Qe=1018,Ge=1020,ze=35902,He=1021,Ve=1022,je=1023,We=1024,qe=1025,Xe=1026,Ye=1027,Je=1028,Ke=1029,Ze=1030,$e=1031,et=1032,tt=1033,nt=33776,it=33777,rt=33778,st=33779,ot=35840,at=35841,lt=35842,ct=35843,ht=36196,dt=37492,ut=37496,pt=37808,At=37809,ft=37810,mt=37811,gt=37812,vt=37813,yt=37814,Et=37815,xt=37816,bt=37817,Ct=37818,wt=37819,_t=37820,Mt=37821,St=36492,It=36494,Bt=36495,Tt=36283,Rt=36284,Lt=36285,Dt=36286,Pt=2200,Ut=2201,Ot=2202,Ft=2300,kt=2301,Nt=2302,Qt=2400,Gt=2401,zt=2402,Ht=2500,Vt=2501,jt=0,Wt=1,qt=2,Xt=3200,Yt=3201,Jt=3202,Kt=3203,Zt=0,$t=1,en="",tn="srgb",nn="srgb-linear",rn="linear",sn="srgb",on=0,an=7680,ln=7681,cn=7682,hn=7683,dn=34055,un=34056,pn=5386,An=512,fn=513,mn=514,gn=515,vn=516,yn=517,En=518,xn=519,bn=512,Cn=513,wn=514,_n=515,Mn=516,Sn=517,In=518,Bn=519,Tn=35044,Rn=35048,Ln=35040,Dn=35045,Pn=35049,Un=35041,On=35046,Fn=35050,kn=35042,Nn="100",Qn="300 es",Gn=2e3,zn=2001;class Hn{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<i;t++)n[t].call(this,e);e.target=null}}}const Vn=["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 jn=1234567;const Wn=Math.PI/180,qn=180/Math.PI;function Xn(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(Vn[255&e]+Vn[e>>8&255]+Vn[e>>16&255]+Vn[e>>24&255]+"-"+Vn[255&t]+Vn[t>>8&255]+"-"+Vn[t>>16&15|64]+Vn[t>>24&255]+"-"+Vn[63&n|128]+Vn[n>>8&255]+"-"+Vn[n>>16&255]+Vn[n>>24&255]+Vn[255&i]+Vn[i>>8&255]+Vn[i>>16&255]+Vn[i>>24&255]).toLowerCase()}function Yn(e,t,n){return Math.max(t,Math.min(n,e))}function Jn(e,t){return(e%t+t)%t}function Kn(e,t,n){return(1-n)*e+n*t}function Zn(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function $n(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const ei={DEG2RAD:Wn,RAD2DEG:qn,generateUUID:Xn,clamp:Yn,euclideanModulo:Jn,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:Kn,damp:function(e,t,n,i){return Kn(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(Jn(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(jn=e);let t=jn+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*Wn},radToDeg:function(e){return e*qn},isPowerOfTwo:function(e){return!(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((t+i)/2),h=o((t+i)/2),d=s((t-i)/2),u=o((t-i)/2),p=s((i-t)/2),A=o((i-t)/2);switch(r){case"XYX":e.set(a*h,l*d,l*u,a*c);break;case"YZY":e.set(l*u,a*h,l*d,a*c);break;case"ZXZ":e.set(l*d,l*u,a*h,a*c);break;case"XZX":e.set(a*h,l*A,l*p,a*c);break;case"YXY":e.set(l*p,a*h,l*A,a*c);break;case"ZYZ":e.set(l*A,l*p,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:$n,denormalize:Zn};class ti{constructor(e=0,t=0){ti.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,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=Yn(this.x,e.x,t.x),this.y=Yn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Yn(this.x,e,t),this.y=Yn(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Yn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Yn(n,-1,1))}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){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ni{constructor(e,t,n,i,r,s,o,a,l){ni.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,s,o,a,l)}set(e,t,n,i,r,s,o,a,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],d=n[2],u=n[5],p=n[8],A=i[0],f=i[3],m=i[6],g=i[1],v=i[4],y=i[7],E=i[2],x=i[5],b=i[8];return r[0]=s*A+o*g+a*E,r[3]=s*f+o*v+a*x,r[6]=s*m+o*y+a*b,r[1]=l*A+c*g+h*E,r[4]=l*f+c*v+h*x,r[7]=l*m+c*y+h*b,r[2]=d*A+u*g+p*E,r[5]=d*f+u*v+p*x,r[8]=d*m+u*y+p*b,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8];return t*s*c-t*o*l-n*r*c+n*o*a+i*r*l-i*s*a}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=c*s-o*l,d=o*a-c*r,u=l*r-s*a,p=t*h+n*d+i*u;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const A=1/p;return e[0]=h*A,e[1]=(i*l-c*n)*A,e[2]=(o*n-i*s)*A,e[3]=d*A,e[4]=(c*t-i*a)*A,e[5]=(i*r-o*t)*A,e[6]=u*A,e[7]=(n*a-l*t)*A,e[8]=(s*t-n*r)*A,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,s,o){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*s+l*o)+s+e,-i*l,i*a,-i*(-l*s+a*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(ii.makeScale(e,t)),this}rotate(e){return this.premultiply(ii.makeRotation(-e)),this}translate(e,t){return this.premultiply(ii.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,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)}}const ii=new ni;function ri(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}const si={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function oi(e,t){return new si[e](t)}function ai(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function li(){const e=ai("canvas");return e.style.display="block",e}const ci={};function hi(e){e in ci||(ci[e]=!0,console.warn(e))}const di=(new ni).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ui=(new ni).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function pi(){const e={enabled:!0,workingColorSpace:nn,spaces:{},convert:function(e,t,n){return!1!==this.enabled&&t!==n&&t&&n?(this.spaces[t].transfer===sn&&(e.r=fi(e.r),e.g=fi(e.g),e.b=fi(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===sn&&(e.r=mi(e.r),e.g=mi(e.g),e.b=mi(e.b)),e):e},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===en?rn:this.spaces[e].transfer},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return e.define({[nn]:{primaries:t,whitePoint:i,transfer:rn,toXYZ:di,fromXYZ:ui,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:tn},outputColorSpaceConfig:{drawingBufferColorSpace:tn}},[tn]:{primaries:t,whitePoint:i,transfer:sn,toXYZ:di,fromXYZ:ui,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:tn}}}),e}const Ai=pi();function fi(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function mi(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let gi;class vi{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===gi&&(gi=ai("canvas")),gi.width=e.width,gi.height=e.height;const n=gi.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=gi}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")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=ai("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e<r.length;e++)r[e]=255*fi(r[e]/255);return n.putImageData(i,0,0),t}if(e.data){const t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*fi(t[e]/255)):t[e]=fi(t[e]);return{data:t,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let yi=0;class Ei{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:yi++}),this.uuid=Xn(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(xi(i[t].image)):e.push(xi(i[t]))}else e=xi(i);n.url=e}return t||(e.images[this.uuid]=n),n}}function xi(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?vi.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let bi=0;class Ci extends Hn{constructor(e=Ci.DEFAULT_IMAGE,t=Ci.DEFAULT_MAPPING,n=ye,i=ye,r=Me,s=Be,o=je,a=Re,l=Ci.DEFAULT_ANISOTROPY,c=en){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:bi++}),this.uuid=Xn(),this.name="",this.source=new Ei(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new ti(0,0),this.repeat=new ti(1,1),this.center=new ti(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ni,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ue)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ve:e.x=e.x-Math.floor(e.x);break;case ye:e.x=e.x<0?0:1;break;case Ee: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 ve:e.y=e.y-Math.floor(e.y);break;case ye:e.y=e.y<0?0:1;break;case Ee:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}Ci.DEFAULT_IMAGE=null,Ci.DEFAULT_MAPPING=ue,Ci.DEFAULT_ANISOTROPY=1;class wi{constructor(e=0,t=0,n=0,i=1){wi.prototype.isVector4=!0,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){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,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}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const s=.01,o=.1,a=e.elements,l=a[0],c=a[4],h=a[8],d=a[1],u=a[5],p=a[9],A=a[2],f=a[6],m=a[10];if(Math.abs(c-d)<s&&Math.abs(h-A)<s&&Math.abs(p-f)<s){if(Math.abs(c+d)<o&&Math.abs(h+A)<o&&Math.abs(p+f)<o&&Math.abs(l+u+m-3)<o)return this.set(1,0,0,0),this;t=Math.PI;const e=(l+1)/2,a=(u+1)/2,g=(m+1)/2,v=(c+d)/4,y=(h+A)/4,E=(p+f)/4;return e>a&&e>g?e<s?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(e),i=v/n,r=y/n):a>g?a<s?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(a),n=v/i,r=E/i):g<s?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(g),n=y/r,i=E/r),this.set(n,i,r,t),this}let g=Math.sqrt((f-p)*(f-p)+(h-A)*(h-A)+(d-c)*(d-c));return Math.abs(g)<.001&&(g=1),this.x=(f-p)/g,this.y=(h-A)/g,this.z=(d-c)/g,this.w=Math.acos((l+u+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Yn(this.x,e.x,t.x),this.y=Yn(this.y,e.y,t.y),this.z=Yn(this.z,e.z,t.z),this.w=Yn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Yn(this.x,e,t),this.y=Yn(this.y,e,t),this.z=Yn(this.z,e,t),this.w=Yn(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Yn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,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.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class _i extends Hn{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new wi(0,0,e,t),this.scissorTest=!1,this.viewport=new wi(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Me,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new Ci(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const s=n.count;for(let e=0;e<s;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++)this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Ei(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Mi extends _i{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Si extends Ci{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xe,this.minFilter=xe,this.wrapR=ye,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ii extends Mi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Si(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Bi extends Ci{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xe,this.minFilter=xe,this.wrapR=ye,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ti extends Mi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Bi(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Ri{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,s,o){let a=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const d=r[s+0],u=r[s+1],p=r[s+2],A=r[s+3];if(0===o)return e[t+0]=a,e[t+1]=l,e[t+2]=c,void(e[t+3]=h);if(1===o)return e[t+0]=d,e[t+1]=u,e[t+2]=p,void(e[t+3]=A);if(h!==A||a!==d||l!==u||c!==p){let e=1-o;const t=a*d+l*u+c*p+h*A,n=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,t*n);e=Math.sin(e*s)/r,o=Math.sin(o*s)/r}const r=o*n;if(a=a*e+d*r,l=l*e+u*r,c=c*e+p*r,h=h*e+A*r,e===1-o){const e=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=e,l*=e,c*=e,h*=e}}e[t]=a,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,s){const o=n[i],a=n[i+1],l=n[i+2],c=n[i+3],h=r[s],d=r[s+1],u=r[s+2],p=r[s+3];return e[t]=o*p+c*h+a*u-l*d,e[t+1]=a*p+c*d+l*h-o*u,e[t+2]=l*p+c*u+o*d-a*h,e[t+3]=c*p-o*h-a*d-l*u,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=!0){const n=e._x,i=e._y,r=e._z,s=e._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),d=a(n/2),u=a(i/2),p=a(r/2);switch(s){case"XYZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"YXZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"ZXY":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"ZYX":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"YZX":this._x=d*c*h+l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h-d*u*p;break;case"XZY":this._x=d*c*h-l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h+d*u*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],o=t[5],a=t[9],l=t[2],c=t[6],h=t[10],d=n+o+h;if(d>0){const e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(c-a)*e,this._y=(r-l)*e,this._z=(s-i)*e}else if(n>o&&n>h){const e=2*Math.sqrt(1+n-o-h);this._w=(c-a)/e,this._x=.25*e,this._y=(i+s)/e,this._z=(r+l)/e}else if(o>h){const e=2*Math.sqrt(1+o-n-h);this._w=(r-l)/e,this._x=(i+s)/e,this._y=.25*e,this._z=(a+c)/e}else{const e=2*Math.sqrt(1+h-n-o);this._w=(s-i)/e,this._x=(r+l)/e,this._y=(a+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.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(Yn(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){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,s=e._w,o=t._x,a=t._y,l=t._z,c=t._w;return this._x=n*c+s*o+i*l-r*a,this._y=i*c+s*a+r*o-n*l,this._z=r*c+s*l+n*a-i*o,this._w=s*c-n*o-i*a-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,s=this._w;let o=s*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const e=1-t;return this._w=e*s+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,d=Math.sin(t*c)/l;return this._w=s*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Li{constructor(e=0,t=0,n=0){Li.prototype.isVector3=!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){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Pi.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Pi.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,s=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,s=e.y,o=e.z,a=e.w,l=2*(s*i-o*n),c=2*(o*t-r*i),h=2*(r*n-s*t);return this.x=t+a*l+s*h-o*c,this.y=n+a*c+o*l-r*h,this.z=i+a*h+r*c-s*l,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=Yn(this.x,e.x,t.x),this.y=Yn(this.y,e.y,t.y),this.z=Yn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Yn(this.x,e,t),this.y=Yn(this.y,e,t),this.z=Yn(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Yn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,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){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,s=t.x,o=t.y,a=t.z;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-i*s,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Di.copy(this).projectOnVector(e),this.sub(Di)}reflect(e){return this.sub(Di.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(Yn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Di=new Li,Pi=new Ri;class Ui{constructor(e=new Li(1/0,1/0,1/0),t=new Li(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Fi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Fi.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Fi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===t&&void 0!==i&&!0!==e.isInstancedMesh)for(let t=0,n=i.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,Fi):Fi.fromBufferAttribute(i,t),Fi.applyMatrix4(e.matrixWorld),this.expandByPoint(Fi);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),ki.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),ki.copy(n.boundingBox)),ki.applyMatrix4(e.matrixWorld),this.union(ki)}const i=e.children;for(let e=0,n=i.length;e<n;e++)this.expandByObject(i[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Fi),Fi.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(ji),Wi.subVectors(this.max,ji),Ni.subVectors(e.a,ji),Qi.subVectors(e.b,ji),Gi.subVectors(e.c,ji),zi.subVectors(Qi,Ni),Hi.subVectors(Gi,Qi),Vi.subVectors(Ni,Gi);let t=[0,-zi.z,zi.y,0,-Hi.z,Hi.y,0,-Vi.z,Vi.y,zi.z,0,-zi.x,Hi.z,0,-Hi.x,Vi.z,0,-Vi.x,-zi.y,zi.x,0,-Hi.y,Hi.x,0,-Vi.y,Vi.x,0];return!!Yi(t,Ni,Qi,Gi,Wi)&&(t=[1,0,0,0,1,0,0,0,1],!!Yi(t,Ni,Qi,Gi,Wi)&&(qi.crossVectors(zi,Hi),t=[qi.x,qi.y,qi.z],Yi(t,Ni,Qi,Gi,Wi)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Fi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(Fi).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()||(Oi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Oi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Oi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Oi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Oi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Oi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Oi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Oi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Oi)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Oi=[new Li,new Li,new Li,new Li,new Li,new Li,new Li,new Li],Fi=new Li,ki=new Ui,Ni=new Li,Qi=new Li,Gi=new Li,zi=new Li,Hi=new Li,Vi=new Li,ji=new Li,Wi=new Li,qi=new Li,Xi=new Li;function Yi(e,t,n,i,r){for(let s=0,o=e.length-3;s<=o;s+=3){Xi.fromArray(e,s);const o=r.x*Math.abs(Xi.x)+r.y*Math.abs(Xi.y)+r.z*Math.abs(Xi.z),a=t.dot(Xi),l=n.dot(Xi),c=i.dot(Xi);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const Ji=new Ui,Ki=new Li,Zi=new Li;class $i{constructor(e=new Li,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):Ji.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;t<r;t++)i=Math.max(i,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ki.subVectors(e,this.center);const t=Ki.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(Ki,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(Zi.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ki.copy(e.center).add(Zi)),this.expandByPoint(Ki.copy(e.center).sub(Zi))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const er=new Li,tr=new Li,nr=new Li,ir=new Li,rr=new Li,sr=new Li,or=new Li;class ar{constructor(e=new Li,t=new Li(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,er)),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.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=er.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(er.copy(this.origin).addScaledVector(this.direction,t),er.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){tr.copy(e).add(t).multiplyScalar(.5),nr.copy(t).sub(e).normalize(),ir.copy(this.origin).sub(tr);const r=.5*e.distanceTo(t),s=-this.direction.dot(nr),o=ir.dot(this.direction),a=-ir.dot(nr),l=ir.lengthSq(),c=Math.abs(1-s*s);let h,d,u,p;if(c>0)if(h=s*a-o,d=s*o-a,p=r*c,h>=0)if(d>=-p)if(d<=p){const e=1/c;h*=e,d*=e,u=h*(h+s*d+2*o)+d*(s*h+d+2*a)+l}else d=r,h=Math.max(0,-(s*d+o)),u=-h*h+d*(d+2*a)+l;else d=-r,h=Math.max(0,-(s*d+o)),u=-h*h+d*(d+2*a)+l;else d<=-p?(h=Math.max(0,-(-s*r+o)),d=h>0?-r:Math.min(Math.max(-r,-a),r),u=-h*h+d*(d+2*a)+l):d<=p?(h=0,d=Math.min(Math.max(-r,-a),r),u=d*(d+2*a)+l):(h=Math.max(0,-(s*r+o)),d=h>0?r:Math.min(Math.max(-r,-a),r),u=-h*h+d*(d+2*a)+l);else d=s>0?-r:r,h=Math.max(0,-(s*d+o)),u=-h*h+d*(d+2*a)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(tr).addScaledVector(nr,d),u}intersectSphere(e,t){er.subVectors(e.center,this.origin);const n=er.dot(this.direction),i=er.dot(er)-n*n,r=e.radius*e.radius;if(i>r)return null;const s=Math.sqrt(r-i),o=n-s,a=n+s;return a<0?null:o<0?this.at(a,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),c>=0?(r=(e.min.y-d.y)*c,s=(e.max.y-d.y)*c):(r=(e.max.y-d.y)*c,s=(e.min.y-d.y)*c),n>s||r>i?null:((r>n||isNaN(n))&&(n=r),(s<i||isNaN(i))&&(i=s),h>=0?(o=(e.min.z-d.z)*h,a=(e.max.z-d.z)*h):(o=(e.max.z-d.z)*h,a=(e.min.z-d.z)*h),n>a||o>i?null:((o>n||n!=n)&&(n=o),(a<i||i!=i)&&(i=a),i<0?null:this.at(n>=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,er)}intersectTriangle(e,t,n,i,r){rr.subVectors(t,e),sr.subVectors(n,e),or.crossVectors(rr,sr);let s,o=this.direction.dot(or);if(o>0){if(i)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}ir.subVectors(this.origin,e);const a=s*this.direction.dot(sr.crossVectors(ir,sr));if(a<0)return null;const l=s*this.direction.dot(rr.cross(ir));if(l<0)return null;if(a+l>o)return null;const c=-s*ir.dot(or);return c<0?null:this.at(c/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class lr{constructor(e,t,n,i,r,s,o,a,l,c,h,d,u,p,A,f){lr.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,s,o,a,l,c,h,d,u,p,A,f)}set(e,t,n,i,r,s,o,a,l,c,h,d,u,p,A,f){const m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=i,m[1]=r,m[5]=s,m[9]=o,m[13]=a,m[2]=l,m[6]=c,m[10]=h,m[14]=d,m[3]=u,m[7]=p,m[11]=A,m[15]=f,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 lr).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/cr.setFromMatrixColumn(e,0).length(),r=1/cr.setFromMatrixColumn(e,1).length(),s=1/cr.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){const t=this.elements,n=e.x,i=e.y,r=e.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){const e=s*c,n=s*h,i=o*c,r=o*h;t[0]=a*c,t[4]=-a*h,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-o*a,t[2]=r-e*l,t[6]=i+n*l,t[10]=s*a}else if("YXZ"===e.order){const e=a*c,n=a*h,i=l*c,r=l*h;t[0]=e+r*o,t[4]=i*o-n,t[8]=s*l,t[1]=s*h,t[5]=s*c,t[9]=-o,t[2]=n*o-i,t[6]=r+e*o,t[10]=s*a}else if("ZXY"===e.order){const e=a*c,n=a*h,i=l*c,r=l*h;t[0]=e-r*o,t[4]=-s*h,t[8]=i+n*o,t[1]=n+i*o,t[5]=s*c,t[9]=r-e*o,t[2]=-s*l,t[6]=o,t[10]=s*a}else if("ZYX"===e.order){const e=s*c,n=s*h,i=o*c,r=o*h;t[0]=a*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=a*h,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=o*a,t[10]=s*a}else if("YZX"===e.order){const e=s*a,n=s*l,i=o*a,r=o*l;t[0]=a*c,t[4]=r-e*h,t[8]=i*h+n,t[1]=h,t[5]=s*c,t[9]=-o*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-r*h}else if("XZY"===e.order){const e=s*a,n=s*l,i=o*a,r=o*l;t[0]=a*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=s*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=o*c,t[10]=r*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(dr,e,ur)}lookAt(e,t,n){const i=this.elements;return fr.subVectors(e,t),0===fr.lengthSq()&&(fr.z=1),fr.normalize(),pr.crossVectors(n,fr),0===pr.lengthSq()&&(1===Math.abs(n.z)?fr.x+=1e-4:fr.z+=1e-4,fr.normalize(),pr.crossVectors(n,fr)),pr.normalize(),Ar.crossVectors(fr,pr),i[0]=pr.x,i[4]=Ar.x,i[8]=fr.x,i[1]=pr.y,i[5]=Ar.y,i[9]=fr.y,i[2]=pr.z,i[6]=Ar.z,i[10]=fr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],d=n[9],u=n[13],p=n[2],A=n[6],f=n[10],m=n[14],g=n[3],v=n[7],y=n[11],E=n[15],x=i[0],b=i[4],C=i[8],w=i[12],_=i[1],M=i[5],S=i[9],I=i[13],B=i[2],T=i[6],R=i[10],L=i[14],D=i[3],P=i[7],U=i[11],O=i[15];return r[0]=s*x+o*_+a*B+l*D,r[4]=s*b+o*M+a*T+l*P,r[8]=s*C+o*S+a*R+l*U,r[12]=s*w+o*I+a*L+l*O,r[1]=c*x+h*_+d*B+u*D,r[5]=c*b+h*M+d*T+u*P,r[9]=c*C+h*S+d*R+u*U,r[13]=c*w+h*I+d*L+u*O,r[2]=p*x+A*_+f*B+m*D,r[6]=p*b+A*M+f*T+m*P,r[10]=p*C+A*S+f*R+m*U,r[14]=p*w+A*I+f*L+m*O,r[3]=g*x+v*_+y*B+E*D,r[7]=g*b+v*M+y*T+E*P,r[11]=g*C+v*S+y*R+E*U,r[15]=g*w+v*I+y*L+E*O,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],s=e[1],o=e[5],a=e[9],l=e[13],c=e[2],h=e[6],d=e[10],u=e[14];return e[3]*(+r*a*h-i*l*h-r*o*d+n*l*d+i*o*u-n*a*u)+e[7]*(+t*a*u-t*l*d+r*s*d-i*s*u+i*l*c-r*a*c)+e[11]*(+t*l*h-t*o*u-r*s*h+n*s*u+r*o*c-n*l*c)+e[15]*(-i*o*c-t*a*h+t*o*d+i*s*h-n*s*d+n*a*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=e[9],d=e[10],u=e[11],p=e[12],A=e[13],f=e[14],m=e[15],g=h*f*l-A*d*l+A*a*u-o*f*u-h*a*m+o*d*m,v=p*d*l-c*f*l-p*a*u+s*f*u+c*a*m-s*d*m,y=c*A*l-p*h*l+p*o*u-s*A*u-c*o*m+s*h*m,E=p*h*a-c*A*a-p*o*d+s*A*d+c*o*f-s*h*f,x=t*g+n*v+i*y+r*E;if(0===x)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/x;return e[0]=g*b,e[1]=(A*d*r-h*f*r-A*i*u+n*f*u+h*i*m-n*d*m)*b,e[2]=(o*f*r-A*a*r+A*i*l-n*f*l-o*i*m+n*a*m)*b,e[3]=(h*a*r-o*d*r-h*i*l+n*d*l+o*i*u-n*a*u)*b,e[4]=v*b,e[5]=(c*f*r-p*d*r+p*i*u-t*f*u-c*i*m+t*d*m)*b,e[6]=(p*a*r-s*f*r-p*i*l+t*f*l+s*i*m-t*a*m)*b,e[7]=(s*d*r-c*a*r+c*i*l-t*d*l-s*i*u+t*a*u)*b,e[8]=y*b,e[9]=(p*h*r-c*A*r-p*n*u+t*A*u+c*n*m-t*h*m)*b,e[10]=(s*A*r-p*o*r+p*n*l-t*A*l-s*n*m+t*o*m)*b,e[11]=(c*o*r-s*h*r-c*n*l+t*h*l+s*n*u-t*o*u)*b,e[12]=E*b,e[13]=(c*A*i-p*h*i+p*n*d-t*A*d-c*n*f+t*h*f)*b,e[14]=(p*o*i-s*A*i-p*n*a+t*A*a+s*n*f-t*o*f)*b,e[15]=(s*h*i-c*o*i+c*n*a-t*h*a-s*n*d+t*o*d)*b,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 e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,s=e.x,o=e.y,a=e.z,l=r*s,c=r*o;return this.set(l*s+n,l*o-i*a,l*a+i*o,0,l*o+i*a,c*o+n,c*a-i*s,0,l*a-i*o,c*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,s){return this.set(1,n,r,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,s=t._y,o=t._z,a=t._w,l=r+r,c=s+s,h=o+o,d=r*l,u=r*c,p=r*h,A=s*c,f=s*h,m=o*h,g=a*l,v=a*c,y=a*h,E=n.x,x=n.y,b=n.z;return i[0]=(1-(A+m))*E,i[1]=(u+y)*E,i[2]=(p-v)*E,i[3]=0,i[4]=(u-y)*x,i[5]=(1-(d+m))*x,i[6]=(f+g)*x,i[7]=0,i[8]=(p+v)*b,i[9]=(f-g)*b,i[10]=(1-(d+A))*b,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=cr.set(i[0],i[1],i[2]).length();const s=cr.set(i[4],i[5],i[6]).length(),o=cr.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],hr.copy(this);const a=1/r,l=1/s,c=1/o;return hr.elements[0]*=a,hr.elements[1]*=a,hr.elements[2]*=a,hr.elements[4]*=l,hr.elements[5]*=l,hr.elements[6]*=l,hr.elements[8]*=c,hr.elements[9]*=c,hr.elements[10]*=c,t.setFromRotationMatrix(hr),n.x=r,n.y=s,n.z=o,this}makePerspective(e,t,n,i,r,s,o=Gn){const a=this.elements,l=2*r/(t-e),c=2*r/(n-i),h=(t+e)/(t-e),d=(n+i)/(n-i);let u,p;if(o===Gn)u=-(s+r)/(s-r),p=-2*s*r/(s-r);else{if(o!==zn)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);u=-s/(s-r),p=-s*r/(s-r)}return a[0]=l,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=c,a[9]=d,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,r,s,o=Gn){const a=this.elements,l=1/(t-e),c=1/(n-i),h=1/(s-r),d=(t+e)*l,u=(n+i)*c;let p,A;if(o===Gn)p=(s+r)*h,A=-2*h;else{if(o!==zn)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);p=r*h,A=-1*h}return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-d,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=A,a[14]=-p,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}}const cr=new Li,hr=new lr,dr=new Li(0,0,0),ur=new Li(1,1,1),pr=new Li,Ar=new Li,fr=new Li,mr=new lr,gr=new Ri;class vr{constructor(e=0,t=0,n=0,i=vr.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],s=i[4],o=i[8],a=i[1],l=i[5],c=i[9],h=i[2],d=i[6],u=i[10];switch(t){case"XYZ":this._y=Math.asin(Yn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Yn(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,u),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Yn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,u),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-Yn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Yn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,u));break;case"XZY":this._z=Math.asin(-Yn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,u),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 mr.makeRotationFromQuaternion(e),this.setFromRotationMatrix(mr,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return gr.setFromEuler(this),this.setFromQuaternion(gr,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}vr.DEFAULT_ORDER="XYZ";class yr{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return!!(this.mask&e.mask)}isEnabled(e){return!!(this.mask&1<<e)}}let Er=0;const xr=new Li,br=new Ri,Cr=new lr,wr=new Li,_r=new Li,Mr=new Li,Sr=new Ri,Ir=new Li(1,0,0),Br=new Li(0,1,0),Tr=new Li(0,0,1),Rr={type:"added"},Lr={type:"removed"},Dr={type:"childadded",child:null},Pr={type:"childremoved",child:null};class Ur extends Hn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Er++}),this.uuid=Xn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ur.DEFAULT_UP.clone();const e=new Li,t=new vr,n=new Ri,i=new Li(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new lr},normalMatrix:{value:new ni}}),this.matrix=new lr,this.matrixWorld=new lr,this.matrixAutoUpdate=Ur.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ur.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new yr,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return br.setFromAxisAngle(e,t),this.quaternion.multiply(br),this}rotateOnWorldAxis(e,t){return br.setFromAxisAngle(e,t),this.quaternion.premultiply(br),this}rotateX(e){return this.rotateOnAxis(Ir,e)}rotateY(e){return this.rotateOnAxis(Br,e)}rotateZ(e){return this.rotateOnAxis(Tr,e)}translateOnAxis(e,t){return xr.copy(e).applyQuaternion(this.quaternion),this.position.add(xr.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ir,e)}translateY(e){return this.translateOnAxis(Br,e)}translateZ(e){return this.translateOnAxis(Tr,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Cr.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?wr.copy(e):wr.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),_r.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Cr.lookAt(_r,wr,this.up):Cr.lookAt(wr,_r,this.up),this.quaternion.setFromRotationMatrix(Cr),i&&(Cr.extractRotation(i.matrixWorld),br.setFromRotationMatrix(Cr),this.quaternion.premultiply(br.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Rr),Dr.child=e,this.dispatchEvent(Dr),Dr.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Lr),Pr.child=e,this.dispatchEvent(Pr),Pr.child=null),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Cr.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Cr.multiply(e.parent.matrixWorld)),e.applyMatrix4(Cr),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Rr),Dr.child=e,this.dispatchEvent(Dr),Dr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,s=i.length;r<s;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_r,e,Mr),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_r,Sr,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){const t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map((e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()}))),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const i=n[t];r(e.shapes,i)}else r(e.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let n=0,i=this.material.length;n<i;n++)t.push(r(e.materials,this.material[n]));i.material=t}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){const n=this.animations[t];i.animations.push(r(e.animations,n))}}if(t){const t=s(e.geometries),i=s(e.materials),r=s(e.textures),o=s(e.images),a=s(e.shapes),l=s(e.skeletons),c=s(e.animations),h=s(e.nodes);t.length>0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];this.add(n.clone())}return this}}Ur.DEFAULT_UP=new Li(0,1,0),Ur.DEFAULT_MATRIX_AUTO_UPDATE=!0,Ur.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Or=new Li,Fr=new Li,kr=new Li,Nr=new Li,Qr=new Li,Gr=new Li,zr=new Li,Hr=new Li,Vr=new Li,jr=new Li,Wr=new wi,qr=new wi,Xr=new wi;class Yr{constructor(e=new Li,t=new Li,n=new Li){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Or.subVectors(e,t),i.cross(Or);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Or.subVectors(i,t),Fr.subVectors(n,t),kr.subVectors(e,t);const s=Or.dot(Or),o=Or.dot(Fr),a=Or.dot(kr),l=Fr.dot(Fr),c=Fr.dot(kr),h=s*l-o*o;if(0===h)return r.set(0,0,0),null;const d=1/h,u=(l*a-o*c)*d,p=(s*c-o*a)*d;return r.set(1-u-p,p,u)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,Nr)&&Nr.x>=0&&Nr.y>=0&&Nr.x+Nr.y<=1}static getInterpolation(e,t,n,i,r,s,o,a){return null===this.getBarycoord(e,t,n,i,Nr)?(a.x=0,a.y=0,"z"in a&&(a.z=0),"w"in a&&(a.w=0),null):(a.setScalar(0),a.addScaledVector(r,Nr.x),a.addScaledVector(s,Nr.y),a.addScaledVector(o,Nr.z),a)}static getInterpolatedAttribute(e,t,n,i,r,s){return Wr.setScalar(0),qr.setScalar(0),Xr.setScalar(0),Wr.fromBufferAttribute(e,t),qr.fromBufferAttribute(e,n),Xr.fromBufferAttribute(e,i),s.setScalar(0),s.addScaledVector(Wr,r.x),s.addScaledVector(qr,r.y),s.addScaledVector(Xr,r.z),s}static isFrontFacing(e,t,n,i){return Or.subVectors(n,t),Fr.subVectors(e,t),Or.cross(Fr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Or.subVectors(this.c,this.b),Fr.subVectors(this.a,this.b),.5*Or.cross(Fr).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Yr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Yr.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Yr.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Yr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Yr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let s,o;Qr.subVectors(i,n),Gr.subVectors(r,n),Hr.subVectors(e,n);const a=Qr.dot(Hr),l=Gr.dot(Hr);if(a<=0&&l<=0)return t.copy(n);Vr.subVectors(e,i);const c=Qr.dot(Vr),h=Gr.dot(Vr);if(c>=0&&h<=c)return t.copy(i);const d=a*h-c*l;if(d<=0&&a>=0&&c<=0)return s=a/(a-c),t.copy(n).addScaledVector(Qr,s);jr.subVectors(e,r);const u=Qr.dot(jr),p=Gr.dot(jr);if(p>=0&&u<=p)return t.copy(r);const A=u*l-a*p;if(A<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(n).addScaledVector(Gr,o);const f=c*p-u*h;if(f<=0&&h-c>=0&&u-p>=0)return zr.subVectors(r,i),o=(h-c)/(h-c+(u-p)),t.copy(i).addScaledVector(zr,o);const m=1/(f+A+d);return s=A*m,o=d*m,t.copy(n).addScaledVector(Qr,s).addScaledVector(Gr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Jr={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},Kr={h:0,s:0,l:0},Zr={h:0,s:0,l:0};function $r(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}class es{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=tn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Ai.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Ai.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ai.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Ai.workingColorSpace){if(e=Jn(e,1),t=Yn(t,0,1),n=Yn(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=$r(r,i,e+1/3),this.g=$r(r,i,e),this.b=$r(r,i,e-1/3)}return Ai.toWorkingColorSpace(this,i),this}setStyle(e,t=tn){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const s=i[1],o=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=tn){const n=Jr[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=fi(e.r),this.g=fi(e.g),this.b=fi(e.b),this}copyLinearToSRGB(e){return this.r=mi(e.r),this.g=mi(e.g),this.b=mi(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=tn){return Ai.fromWorkingColorSpace(ts.copy(this),e),65536*Math.round(Yn(255*ts.r,0,255))+256*Math.round(Yn(255*ts.g,0,255))+Math.round(Yn(255*ts.b,0,255))}getHexString(e=tn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ai.workingColorSpace){Ai.fromWorkingColorSpace(ts.copy(this),t);const n=ts.r,i=ts.g,r=ts.b,s=Math.max(n,i,r),o=Math.min(n,i,r);let a,l;const c=(o+s)/2;if(o===s)a=0,l=0;else{const e=s-o;switch(l=c<=.5?e/(s+o):e/(2-s-o),s){case n:a=(i-r)/e+(i<r?6:0);break;case i:a=(r-n)/e+2;break;case r:a=(n-i)/e+4}a/=6}return e.h=a,e.s=l,e.l=c,e}getRGB(e,t=Ai.workingColorSpace){return Ai.fromWorkingColorSpace(ts.copy(this),t),e.r=ts.r,e.g=ts.g,e.b=ts.b,e}getStyle(e=tn){Ai.fromWorkingColorSpace(ts.copy(this),e);const t=ts.r,n=ts.g,i=ts.b;return e!==tn?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(e,t,n){return this.getHSL(Kr),this.setHSL(Kr.h+e,Kr.s+t,Kr.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Kr),e.getHSL(Zr);const n=Kn(Kr.h,Zr.h,t),i=Kn(Kr.s,Zr.s,t),r=Kn(Kr.l,Zr.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const ts=new es;es.NAMES=Jr;let ns=0;class is extends Hn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ns++}),this.uuid=Xn(),this.name="",this.type="Material",this.blending=E,this.side=m,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=P,this.blendDst=U,this.blendEquation=_,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new es(0,0,0),this.blendAlpha=0,this.depthFunc=X,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=xn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=an,this.stencilZFail=an,this.stencilZPass=an,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);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.Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),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&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==E&&(n.blending=this.blending),this.side!==m&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==P&&(n.blendSrc=this.blendSrc),this.blendDst!==U&&(n.blendDst=this.blendDst),this.blendEquation!==_&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==X&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==xn&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==an&&(n.stencilFail=this.stencilFail),this.stencilZFail!==an&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==an&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),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=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let 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.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class rs extends is{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new es(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vr,this.combine=$,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const ss=os();function os(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(i[e]=0,i[256|e]=32768,r[e]=24,r[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,r[e]=-t-1,r[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,r[e]=13,r[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,r[e]=24,r[256|e]=24):(i[e]=31744,i[256|e]=64512,r[e]=13,r[256|e]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,s[e]=t|n}for(let e=1024;e<2048;++e)s[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)o[e]=e<<23;o[31]=1199570944,o[32]=2147483648;for(let e=33;e<63;++e)o[e]=2147483648+(e-32<<23);o[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(a[e]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function as(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Yn(e,-65504,65504),ss.floatView[0]=e;const t=ss.uint32View[0],n=t>>23&511;return ss.baseTable[n]+((8388607&t)>>ss.shiftTable[n])}function ls(e){const t=e>>10;return ss.uint32View[0]=ss.mantissaTable[ss.offsetTable[t]+(1023&e)]+ss.exponentTable[t],ss.floatView[0]}const cs={toHalfFloat:as,fromHalfFloat:ls},hs=new Li,ds=new ti;class us{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=Tn,this.updateRanges=[],this.gpuType=Fe,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)ds.fromBufferAttribute(this,t),ds.applyMatrix3(e),this.setXY(t,ds.x,ds.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)hs.fromBufferAttribute(this,t),hs.applyMatrix3(e),this.setXYZ(t,hs.x,hs.y,hs.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)hs.fromBufferAttribute(this,t),hs.applyMatrix4(e),this.setXYZ(t,hs.x,hs.y,hs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)hs.fromBufferAttribute(this,t),hs.applyNormalMatrix(e),this.setXYZ(t,hs.x,hs.y,hs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)hs.fromBufferAttribute(this,t),hs.transformDirection(e),this.setXYZ(t,hs.x,hs.y,hs.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Zn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=$n(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Zn(t,this.array)),t}setX(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Zn(t,this.array)),t}setY(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Zn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Zn(t,this.array)),t}setW(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array),r=$n(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Tn&&(e.usage=this.usage),e}}class ps extends us{constructor(e,t,n){super(new Int8Array(e),t,n)}}class As extends us{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class fs extends us{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class ms extends us{constructor(e,t,n){super(new Int16Array(e),t,n)}}class gs extends us{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class vs extends us{constructor(e,t,n){super(new Int32Array(e),t,n)}}class ys extends us{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Es extends us{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=ls(this.array[e*this.itemSize]);return this.normalized&&(t=Zn(t,this.array)),t}setX(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize]=as(t),this}getY(e){let t=ls(this.array[e*this.itemSize+1]);return this.normalized&&(t=Zn(t,this.array)),t}setY(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+1]=as(t),this}getZ(e){let t=ls(this.array[e*this.itemSize+2]);return this.normalized&&(t=Zn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+2]=as(t),this}getW(e){let t=ls(this.array[e*this.itemSize+3]);return this.normalized&&(t=Zn(t,this.array)),t}setW(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+3]=as(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array)),this.array[e+0]=as(t),this.array[e+1]=as(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array)),this.array[e+0]=as(t),this.array[e+1]=as(n),this.array[e+2]=as(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array),r=$n(r,this.array)),this.array[e+0]=as(t),this.array[e+1]=as(n),this.array[e+2]=as(i),this.array[e+3]=as(r),this}}class xs extends us{constructor(e,t,n){super(new Float32Array(e),t,n)}}let bs=0;const Cs=new lr,ws=new Ur,_s=new Li,Ms=new Ui,Ss=new Ui,Is=new Li;class Bs extends Hn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:bs++}),this.uuid=Xn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=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(ri(e)?ys:gs)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}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 ni).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 Cs.makeRotationFromQuaternion(e),this.applyMatrix4(Cs),this}rotateX(e){return Cs.makeRotationX(e),this.applyMatrix4(Cs),this}rotateY(e){return Cs.makeRotationY(e),this.applyMatrix4(Cs),this}rotateZ(e){return Cs.makeRotationZ(e),this.applyMatrix4(Cs),this}translate(e,t,n){return Cs.makeTranslation(e,t,n),this.applyMatrix4(Cs),this}scale(e,t,n){return Cs.makeScale(e,t,n),this.applyMatrix4(Cs),this}lookAt(e){return ws.lookAt(e),ws.updateMatrix(),this.applyMatrix4(ws.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(_s).negate(),this.translate(_s.x,_s.y,_s.z),this}setFromPoints(e){const t=this.getAttribute("position");if(void 0===t){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n];t.push(i.x,i.y,i.z||0)}this.setAttribute("position",new xs(t,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const n=e[i];t.setXYZ(i,n.x,n.y,n.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Ui);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Li(-1/0,-1/0,-1/0),new Li(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];Ms.setFromBufferAttribute(n),this.morphTargetsRelative?(Is.addVectors(this.boundingBox.min,Ms.min),this.boundingBox.expandByPoint(Is),Is.addVectors(this.boundingBox.max,Ms.max),this.boundingBox.expandByPoint(Is)):(this.boundingBox.expandByPoint(Ms.min),this.boundingBox.expandByPoint(Ms.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new $i);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new Li,1/0);if(e){const n=this.boundingSphere.center;if(Ms.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];Ss.setFromBufferAttribute(n),this.morphTargetsRelative?(Is.addVectors(Ms.min,Ss.min),Ms.expandByPoint(Is),Is.addVectors(Ms.max,Ss.max),Ms.expandByPoint(Is)):(Ms.expandByPoint(Ss.min),Ms.expandByPoint(Ss.max))}Ms.getCenter(n);let i=0;for(let t=0,r=e.count;t<r;t++)Is.fromBufferAttribute(e,t),i=Math.max(i,n.distanceToSquared(Is));if(t)for(let r=0,s=t.length;r<s;r++){const s=t[r],o=this.morphTargetsRelative;for(let t=0,r=s.count;t<r;t++)Is.fromBufferAttribute(s,t),o&&(_s.fromBufferAttribute(e,t),Is.add(_s)),i=Math.max(i,n.distanceToSquared(Is))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.position,i=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new us(new Float32Array(4*n.count),4));const s=this.getAttribute("tangent"),o=[],a=[];for(let e=0;e<n.count;e++)o[e]=new Li,a[e]=new Li;const l=new Li,c=new Li,h=new Li,d=new ti,u=new ti,p=new ti,A=new Li,f=new Li;function m(e,t,i){l.fromBufferAttribute(n,e),c.fromBufferAttribute(n,t),h.fromBufferAttribute(n,i),d.fromBufferAttribute(r,e),u.fromBufferAttribute(r,t),p.fromBufferAttribute(r,i),c.sub(l),h.sub(l),u.sub(d),p.sub(d);const s=1/(u.x*p.y-p.x*u.y);isFinite(s)&&(A.copy(c).multiplyScalar(p.y).addScaledVector(h,-u.y).multiplyScalar(s),f.copy(h).multiplyScalar(u.x).addScaledVector(c,-p.x).multiplyScalar(s),o[e].add(A),o[t].add(A),o[i].add(A),a[e].add(f),a[t].add(f),a[i].add(f))}let g=this.groups;0===g.length&&(g=[{start:0,count:e.count}]);for(let t=0,n=g.length;t<n;++t){const n=g[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)m(e.getX(t+0),e.getX(t+1),e.getX(t+2))}const v=new Li,y=new Li,E=new Li,x=new Li;function b(e){E.fromBufferAttribute(i,e),x.copy(E);const t=o[e];v.copy(t),v.sub(E.multiplyScalar(E.dot(t))).normalize(),y.crossVectors(x,t);const n=y.dot(a[e])<0?-1:1;s.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=g.length;t<n;++t){const n=g[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)b(e.getX(t+0)),b(e.getX(t+1)),b(e.getX(t+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new us(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);const i=new Li,r=new Li,s=new Li,o=new Li,a=new Li,l=new Li,c=new Li,h=new Li;if(e)for(let d=0,u=e.count;d<u;d+=3){const u=e.getX(d+0),p=e.getX(d+1),A=e.getX(d+2);i.fromBufferAttribute(t,u),r.fromBufferAttribute(t,p),s.fromBufferAttribute(t,A),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),o.fromBufferAttribute(n,u),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,A),o.add(c),a.add(c),l.add(c),n.setXYZ(u,o.x,o.y,o.z),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(A,l.x,l.y,l.z)}else for(let e=0,o=t.count;e<o;e+=3)i.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),s.fromBufferAttribute(t,e+2),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),n.setXYZ(e+0,c.x,c.y,c.z),n.setXYZ(e+1,c.x,c.y,c.z),n.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Is.fromBufferAttribute(e,t),Is.normalize(),e.setXYZ(t,Is.x,Is.y,Is.z)}toNonIndexed(){function e(e,t){const n=e.array,i=e.itemSize,r=e.normalized,s=new n.constructor(t.length*i);let o=0,a=0;for(let r=0,l=t.length;r<l;r++){o=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*i;for(let e=0;e<i;e++)s[a++]=n[o++]}return new us(s,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Bs,n=this.index.array,i=this.attributes;for(const r in i){const s=e(i[r],n);t.setAttribute(r,s)}const r=this.morphAttributes;for(const i in r){const s=[],o=r[i];for(let t=0,i=o.length;t<i;t++){const i=e(o[t],n);s.push(i)}t.morphAttributes[i]=s}t.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let e=0,n=s.length;e<n;e++){const n=s[e];t.addGroup(n.start,n.count,n.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const 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;t<i;t++){const i=n[t];s.push(i.toJSON(e.data))}s.length>0&&(i[t]=s,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e<r;e++)n.push(i[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;const s=e.groups;for(let e=0,t=s.length;e<t;e++){const t=s[e];this.addGroup(t.start,t.count,t.materialIndex)}const o=e.boundingBox;null!==o&&(this.boundingBox=o.clone());const a=e.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Ts=new lr,Rs=new ar,Ls=new $i,Ds=new Li,Ps=new Li,Us=new Li,Os=new Li,Fs=new Li,ks=new Li,Ns=new Li,Qs=new Li;class Gs extends Ur{constructor(e=new Bs,t=new rs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(r&&o){ks.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=o[n],a=r[n];0!==i&&(Fs.fromBufferAttribute(a,e),s?ks.addScaledVector(Fs,i):ks.addScaledVector(Fs.sub(t),i))}t.add(ks)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),Ls.copy(n.boundingSphere),Ls.applyMatrix4(r),Rs.copy(e.ray).recast(e.near),!1===Ls.containsPoint(Rs.origin)){if(null===Rs.intersectSphere(Ls,Ds))return;if(Rs.origin.distanceToSquared(Ds)>(e.far-e.near)**2)return}Ts.copy(r).invert(),Rs.copy(e.ray).applyMatrix4(Ts),null!==n.boundingBox&&!1===Rs.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,Rs)}}_computeIntersections(e,t,n){let i;const r=this.geometry,s=this.material,o=r.index,a=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,d=r.groups,u=r.drawRange;if(null!==o)if(Array.isArray(s))for(let r=0,a=d.length;r<a;r++){const a=d[r],p=s[a.materialIndex];for(let r=Math.max(a.start,u.start),s=Math.min(o.count,Math.min(a.start+a.count,u.start+u.count));r<s;r+=3)i=zs(this,p,e,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=a.materialIndex,t.push(i))}else for(let r=Math.max(0,u.start),a=Math.min(o.count,u.start+u.count);r<a;r+=3)i=zs(this,s,e,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),t.push(i));else if(void 0!==a)if(Array.isArray(s))for(let r=0,o=d.length;r<o;r++){const o=d[r],p=s[o.materialIndex];for(let r=Math.max(o.start,u.start),s=Math.min(a.count,Math.min(o.start+o.count,u.start+u.count));r<s;r+=3)i=zs(this,p,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,t.push(i))}else for(let r=Math.max(0,u.start),o=Math.min(a.count,u.start+u.count);r<o;r+=3)i=zs(this,s,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),t.push(i))}}function zs(e,t,n,i,r,s,o,a,l,c){e.getVertexPosition(a,Ps),e.getVertexPosition(l,Us),e.getVertexPosition(c,Os);const h=function(e,t,n,i,r,s,o,a){let l;if(l=t.side===g?i.intersectTriangle(o,s,r,!0,a):i.intersectTriangle(r,s,o,t.side===m,a),null===l)return null;Qs.copy(a),Qs.applyMatrix4(e.matrixWorld);const c=n.ray.origin.distanceTo(Qs);return c<n.near||c>n.far?null:{distance:c,point:Qs.clone(),object:e}}(e,t,n,i,Ps,Us,Os,Ns);if(h){const e=new Li;Yr.getBarycoord(Ns,Ps,Us,Os,e),r&&(h.uv=Yr.getInterpolatedAttribute(r,a,l,c,e,new ti)),s&&(h.uv1=Yr.getInterpolatedAttribute(s,a,l,c,e,new ti)),o&&(h.normal=Yr.getInterpolatedAttribute(o,a,l,c,e,new Li),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const t={a,b:l,c,normal:new Li,materialIndex:0};Yr.getNormal(Ps,Us,Os,t.normal),h.face=t,h.barycoord=e}return h}class Hs extends Bs{constructor(e=1,t=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const a=[],l=[],c=[],h=[];let d=0,u=0;function p(e,t,n,i,r,s,p,A,f,m,g){const v=s/f,y=p/m,E=s/2,x=p/2,b=A/2,C=f+1,w=m+1;let _=0,M=0;const S=new Li;for(let s=0;s<w;s++){const o=s*y-x;for(let a=0;a<C;a++){const d=a*v-E;S[e]=d*i,S[t]=o*r,S[n]=b,l.push(S.x,S.y,S.z),S[e]=0,S[t]=0,S[n]=A>0?1:-1,c.push(S.x,S.y,S.z),h.push(a/f),h.push(1-s/m),_+=1}}for(let e=0;e<m;e++)for(let t=0;t<f;t++){const n=d+t+C*e,i=d+t+C*(e+1),r=d+(t+1)+C*(e+1),s=d+(t+1)+C*e;a.push(n,i,s),a.push(i,r,s),M+=6}o.addGroup(u,M,g),u+=M,d+=_}p("z","y","x",-1,-1,n,t,e,s,r,0),p("z","y","x",1,-1,n,t,-e,s,r,1),p("x","z","y",1,1,e,n,t,i,s,2),p("x","z","y",1,-1,e,n,-t,i,s,3),p("x","y","z",1,-1,e,t,n,i,r,4),p("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(a),this.setAttribute("position",new xs(l,3)),this.setAttribute("normal",new xs(c,3)),this.setAttribute("uv",new xs(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Hs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Vs(e){const t={};for(const n in e){t[n]={};for(const i in e[n]){const r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}}return t}function js(e){const t={};for(let n=0;n<e.length;n++){const i=Vs(e[n]);for(const e in i)t[e]=i[e]}return t}function Ws(e){const t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:Ai.workingColorSpace}const qs={clone:Vs,merge:js};class Xs extends is{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Vs(e.uniforms),this.uniformsGroups=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Ys extends Ur{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new lr,this.projectionMatrix=new lr,this.projectionMatrixInverse=new lr,this.coordinateSystem=Gn}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const Js=new Li,Ks=new ti,Zs=new ti;class $s extends Ys{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,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*qn*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Wn*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*qn*Math.atan(Math.tan(.5*Wn*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Js.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Js.x,Js.y).multiplyScalar(-e/Js.z),Js.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Js.x,Js.y).multiplyScalar(-e/Js.z)}getViewSize(e,t){return this.getViewBounds(e,Ks,Zs),t.subVectors(Zs,Ks)}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*Wn*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const e=s.fullWidth,o=s.fullHeight;r+=s.offsetX*i/e,t-=s.offsetY*n/o,i*=s.width/e,n*=s.height/o}const o=this.filmOffset;0!==o&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const eo=-90;class to extends Ur{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new $s(eo,1,e,t);i.layers=this.layers,this.add(i);const r=new $s(eo,1,e,t);r.layers=this.layers,this.add(r);const s=new $s(eo,1,e,t);s.layers=this.layers,this.add(s);const o=new $s(eo,1,e,t);o.layers=this.layers,this.add(o);const a=new $s(eo,1,e,t);a.layers=this.layers,this.add(a);const l=new $s(eo,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,s,o,a]=t;for(const e of t)this.remove(e);if(e===Gn)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),a.up.set(0,1,0),a.lookAt(0,0,-1);else{if(e!==zn)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),a.up.set(0,-1,0),a.lookAt(0,0,-1)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,s,o,a,l,c]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const A=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,s),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,a),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=A,e.setRenderTarget(n,5,i),e.render(t,c),e.setRenderTarget(h,d,u),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class no extends Ci{constructor(e,t,n,i,r,s,o,a,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:pe,n,i,r,s,o,a,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class io extends Mi{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new no(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:Me}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const 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 <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\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 <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",s=new Hs(5,5,5),o=new Xs({name:"CubemapFromEquirect",uniforms:Vs(n),vertexShader:i,fragmentShader:r,side:g,blending:y});o.uniforms.tEquirect.value=t;const a=new Gs(s,o),l=t.minFilter;return t.minFilter===Be&&(t.minFilter=Me),new to(1,10,this).update(e,a),t.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}class ro{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new es(e),this.density=t}clone(){return new ro(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class so{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new es(e),this.near=t,this.far=n}clone(){return new so(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class oo extends Ur{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new vr,this.environmentIntensity=1,this.environmentRotation=new vr,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class ao{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Tn,this.updateRanges=[],this.version=0,this.uuid=Xn()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Xn()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Xn()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const lo=new Li;class co{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)lo.fromBufferAttribute(this,t),lo.applyMatrix4(e),this.setXYZ(t,lo.x,lo.y,lo.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)lo.fromBufferAttribute(this,t),lo.applyNormalMatrix(e),this.setXYZ(t,lo.x,lo.y,lo.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)lo.fromBufferAttribute(this,t),lo.transformDirection(e),this.setXYZ(t,lo.x,lo.y,lo.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Zn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=$n(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=$n(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=$n(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=$n(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=$n(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Zn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Zn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Zn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Zn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array),r=$n(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new us(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new co(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class ho extends is{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new es(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let uo;const po=new Li,Ao=new Li,fo=new Li,mo=new ti,go=new ti,vo=new lr,yo=new Li,Eo=new Li,xo=new Li,bo=new ti,Co=new ti,wo=new ti;class _o extends Ur{constructor(e=new ho){if(super(),this.isSprite=!0,this.type="Sprite",void 0===uo){uo=new Bs;const e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),t=new ao(e,5);uo.setIndex([0,1,2,0,2,3]),uo.setAttribute("position",new co(t,3,0,!1)),uo.setAttribute("uv",new co(t,2,3,!1))}this.geometry=uo,this.material=e,this.center=new ti(.5,.5)}raycast(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ao.setFromMatrixScale(this.matrixWorld),vo.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),fo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Ao.multiplyScalar(-fo.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const s=this.center;Mo(yo.set(-.5,-.5,0),fo,s,Ao,i,r),Mo(Eo.set(.5,-.5,0),fo,s,Ao,i,r),Mo(xo.set(.5,.5,0),fo,s,Ao,i,r),bo.set(0,0),Co.set(1,0),wo.set(1,1);let o=e.ray.intersectTriangle(yo,Eo,xo,!1,po);if(null===o&&(Mo(Eo.set(-.5,.5,0),fo,s,Ao,i,r),Co.set(0,1),o=e.ray.intersectTriangle(yo,xo,Eo,!1,po),null===o))return;const a=e.ray.origin.distanceTo(po);a<e.near||a>e.far||t.push({distance:a,point:po.clone(),uv:Yr.getInterpolation(po,yo,Eo,xo,bo,Co,wo,new ti),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function Mo(e,t,n,i,r,s){mo.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(go.x=s*mo.x-r*mo.y,go.y=r*mo.x+s*mo.y):go.copy(mo),e.copy(t),e.x+=go.x,e.y+=go.y,e.applyMatrix4(vo)}const So=new Li,Io=new Li;class Bo extends Ur{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;e<n;e++){const n=t[e];this.addLevel(n.object.clone(),n.distance,n.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let r;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const e=t.splice(n,1);return this.remove(e[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let i=t[n].distance;if(t[n].object.visible&&(i-=i*t[n].hysteresis),e<i)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){So.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(So);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){So.setFromMatrixPosition(e.matrixWorld),Io.setFromMatrixPosition(this.matrixWorld);const n=So.distanceTo(Io)/e.zoom;let i,r;for(t[0].object.visible=!0,i=1,r=t.length;i<r;i++){let e=t[i].distance;if(t[i].object.visible&&(e-=e*t[i].hysteresis),!(n>=e))break;t[i-1].object.visible=!1,t[i].object.visible=!0}for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let e=0,i=n.length;e<i;e++){const i=n[e];t.object.levels.push({object:i.object.uuid,distance:i.distance,hysteresis:i.hysteresis})}return t}}const To=new Li,Ro=new wi,Lo=new wi,Do=new Li,Po=new lr,Uo=new Li,Oo=new $i,Fo=new lr,ko=new ar;class No extends Gs{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=he,this.bindMatrix=new lr,this.bindMatrixInverse=new lr,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;null===this.boundingBox&&(this.boundingBox=new Ui),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,Uo),this.boundingBox.expandByPoint(Uo)}computeBoundingSphere(){const e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new $i),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,Uo),this.boundingSphere.expandByPoint(Uo)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),Oo.copy(this.boundingSphere),Oo.applyMatrix4(i),!1!==e.ray.intersectsSphere(Oo)&&(Fo.copy(i).invert(),ko.copy(e.ray).applyMatrix4(Fo),null!==this.boundingBox&&!1===ko.intersectsBox(this.boundingBox)||this._computeIntersections(e,t,ko)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new wi,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===he?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===de?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Ro.fromBufferAttribute(i.attributes.skinIndex,e),Lo.fromBufferAttribute(i.attributes.skinWeight,e),To.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){const i=Lo.getComponent(e);if(0!==i){const r=Ro.getComponent(e);Po.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),t.addScaledVector(Do.copy(To).applyMatrix4(Po),i)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Qo extends Ur{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Go extends Ci{constructor(e=null,t=1,n=1,i,r,s,o,a,l=xe,c=xe,h,d){super(null,s,o,a,l,c,i,r,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const zo=new lr,Ho=new lr;class Vo{constructor(e=[],t=[]){this.uuid=Xn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new lr)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new lr;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=e.length;i<r;i++){const r=e[i]?e[i].matrixWorld:Ho;zo.multiplyMatrices(r,t[i]),zo.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new Vo(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Go(t,e,e,je,Fe);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const i=e.bones[n];let r=t[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new Qo),this.bones.push(r),this.boneInverses.push((new lr).fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const r=t[i];e.bones.push(r.uuid);const s=n[i];e.boneInverses.push(s.toArray())}return e}}class jo extends us{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Wo=new lr,qo=new lr,Xo=[],Yo=new Ui,Jo=new lr,Ko=new Gs,Zo=new $i;class $o extends Gs{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new jo(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,Jo)}computeBoundingBox(){const e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new Ui),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Wo),Yo.copy(e.boundingBox).applyMatrix4(Wo),this.boundingBox.union(Yo)}computeBoundingSphere(){const e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new $i),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Wo),Zo.copy(e.boundingSphere).applyMatrix4(Wo),this.boundingSphere.union(Zo)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=i[r+e]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Ko.geometry=this.geometry,Ko.material=this.material,void 0!==Ko.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Zo.copy(this.boundingSphere),Zo.applyMatrix4(n),!1!==e.ray.intersectsSphere(Zo)))for(let r=0;r<i;r++){this.getMatrixAt(r,Wo),qo.multiplyMatrices(n,Wo),Ko.matrixWorld=qo,Ko.raycast(e,Xo);for(let e=0,n=Xo.length;e<n;e++){const n=Xo[e];n.instanceId=r,n.object=this,t.push(n)}Xo.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new jo(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new Go(new Float32Array(i*this.count),i,this.count,Je,Fe));const r=this.morphTexture.source.data.data;let s=0;for(let e=0;e<n.length;e++)s+=n[e];const o=this.geometry.morphTargetsRelative?1:1-s,a=i*e;r[a]=o,r.set(n,a+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}}const ea=new Li,ta=new Li,na=new ni;class ia{constructor(e=new Li(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,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=ea.subVectors(n,t).cross(ta.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(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(ea),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(e.start).addScaledVector(n,r)}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||na.getNormalMatrix(e),i=this.coplanarPoint(ea).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)}}const ra=new $i,sa=new Li;class oa{constructor(e=new ia,t=new ia,n=new ia,i=new ia,r=new ia,s=new ia){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Gn){const n=this.planes,i=e.elements,r=i[0],s=i[1],o=i[2],a=i[3],l=i[4],c=i[5],h=i[6],d=i[7],u=i[8],p=i[9],A=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];if(n[0].setComponents(a-r,d-l,f-u,y-m).normalize(),n[1].setComponents(a+r,d+l,f+u,y+m).normalize(),n[2].setComponents(a+s,d+c,f+p,y+g).normalize(),n[3].setComponents(a-s,d-c,f-p,y-g).normalize(),n[4].setComponents(a-o,d-h,f-A,y-v).normalize(),t===Gn)n[5].setComponents(a+o,d+h,f+A,y+v).normalize();else{if(t!==zn)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(o,h,A,v).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),ra.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),ra.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ra)}intersectsSprite(e){return ra.center.set(0,0,0),ra.radius=.7071067811865476,ra.applyMatrix4(e.matrixWorld),this.intersectsSphere(ra)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(sa.x=i.normal.x>0?e.max.x:e.min.x,sa.y=i.normal.y>0?e.max.y:e.min.y,sa.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(sa)<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 aa(e,t){return e-t}function la(e,t){return e.z-t.z}function ca(e,t){return t.z-e.z}class ha{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const r=this.pool,s=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const o=r[this.index];s.push(o),this.index++,o.start=e,o.count=t,o.z=n,o.index=i}reset(){this.list.length=0,this.index=0}}const da=new lr,ua=new es(1,1,1),pa=new oa,Aa=new Ui,fa=new $i,ma=new Li,ga=new Li,va=new Li,ya=new ha,Ea=new Gs,xa=[];function ba(e,t,n=0){const i=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){const r=e.count;for(let s=0;s<r;s++)for(let r=0;r<i;r++)t.setComponent(s+n,r,e.getComponent(s,r))}else t.array.set(e.array,n*i);t.needsUpdate=!0}function Ca(e,t){if(e.constructor!==t.constructor){const n=Math.min(e.length,t.length);for(let i=0;i<n;i++)t[i]=e[i]}else{const n=Math.min(e.length,t.length);t.set(new e.constructor(e.buffer,0,n))}}class wa extends Gs{get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}constructor(e,t,n=2*t,i){super(new Bs,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let e=Math.sqrt(4*this._maxInstanceCount);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Go(t,e,e,je,Fe);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Go(t,e,e,Ke,Oe);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new Go(t,e,e,je,Fe);n.colorSpace=Ai.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(!1===this._geometryInitialized){for(const i in e.attributes){const r=e.getAttribute(i),{array:s,itemSize:o,normalized:a}=r,l=new s.constructor(n*o),c=new us(l,o,a);t.setAttribute(i,c)}if(null!==e.getIndex()){const e=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new us(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(Boolean(e.getIndex())!==Boolean(t.getIndex()))throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||!1===t[e].active)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||!1===t[e].active)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Ui);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(!1===t[n].active)continue;const i=t[n].geometryIndex;this.getMatrixAt(n,da),this.getBoundingBoxAt(i,Aa).applyMatrix4(da),e.union(Aa)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new $i);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(!1===t[n].active)continue;const i=t[n].geometryIndex;this.getMatrixAt(n,da),this.getBoundingSphereAt(i,fa).applyMatrix4(da),e.union(fa)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const t={visible:!0,active:!0,geometryIndex:e};let n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(aa),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));const i=this._matricesTexture;da.identity().toArray(i.image.data,16*n),i.needsUpdate=!0;const r=this._colorsTexture;return r&&(ua.toArray(r.image.data,4*n),r.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=-1===t?e.getAttribute("position").count:t;const s=e.getIndex();if(null!==s&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=-1===n?s.count:n),-1!==i.indexStart&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let o;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(aa),o=this._availableGeometryIds.shift(),r[o]=i):(o=this._geometryCount,this._geometryCount++,r.push(i)),this.setGeometryAt(o,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,o}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=null!==n.getIndex(),r=n.getIndex(),s=t.getIndex(),o=this._geometryInfo[e];if(i&&s.count>o.reservedIndexCount||t.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const a=o.vertexStart,l=o.reservedVertexCount;o.vertexCount=t.getAttribute("position").count;for(const e in n.attributes){const i=t.getAttribute(e),r=n.getAttribute(e);ba(i,r,a);const s=i.itemSize;for(let e=i.count,t=l;e<t;e++){const t=a+e;for(let e=0;e<s;e++)r.setComponent(t,e,0)}r.needsUpdate=!0,r.addUpdateRange(a*s,l*s)}if(i){const e=o.indexStart,n=o.reservedIndexCount;o.indexCount=t.getIndex().count;for(let t=0;t<s.count;t++)r.setX(e+t,a+s.getX(t));for(let t=s.count,i=n;t<i;t++)r.setX(e+t,a);r.needsUpdate=!0,r.addUpdateRange(e,o.reservedIndexCount)}return o.start=i?o.indexStart:o.vertexStart,o.count=i?o.indexCount:o.vertexCount,o.boundingBox=null,null!==t.boundingBox&&(o.boundingBox=t.boundingBox.clone()),o.boundingSphere=null,null!==t.boundingSphere&&(o.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||!1===t[e].active)return this;const n=this._instanceInfo;for(let t=0,i=n.length;t<i;t++)n[t].geometryIndex===e&&this.deleteInstance(t);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,i=n.map(((e,t)=>t)).sort(((e,t)=>n[e].vertexStart-n[t].vertexStart)),r=this.geometry;for(let s=0,o=n.length;s<o;s++){const o=i[s],a=n[o];if(!1!==a.active){if(null!==r.index){if(a.indexStart!==t){const{indexStart:n,vertexStart:i,reservedIndexCount:s}=a,o=r.index,l=o.array,c=e-i;for(let e=n;e<n+s;e++)l[e]=l[e]+c;o.array.copyWithin(t,n,n+s),o.addUpdateRange(t,s),a.indexStart=t}t+=a.reservedIndexCount}if(a.vertexStart!==e){const{vertexStart:t,reservedVertexCount:n}=a,i=r.attributes;for(const r in i){const s=i[r],{array:o,itemSize:a}=s;o.copyWithin(e*a,t*a,(t+n)*a),s.addUpdateRange(e*a,n*a)}a.vertexStart=e}e+=a.reservedVertexCount,a.start=r.index?a.indexStart:a.vertexStart,this._nextIndexStart=r.index?a.indexStart+a.reservedIndexCount:0,this._nextVertexStart=a.vertexStart+a.reservedVertexCount}}return this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(null===i.boundingBox){const e=new Ui,t=n.index,r=n.attributes.position;for(let n=i.start,s=i.start+i.count;n<s;n++){let i=n;t&&(i=t.getX(i)),e.expandByPoint(ma.fromBufferAttribute(r,i))}i.boundingBox=e}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(null===i.boundingSphere){const t=new $i;this.getBoundingBoxAt(e,Aa),Aa.getCenter(t.center);const r=n.index,s=n.attributes.position;let o=0;for(let e=i.start,n=i.start+i.count;e<n;e++){let n=e;r&&(n=r.getX(n)),ma.fromBufferAttribute(s,n),o=Math.max(o,t.center.distanceToSquared(ma))}t.radius=Math.sqrt(o),i.boundingSphere=t}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,16*e),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,16*e)}setColorAt(e,t){return this.validateInstanceId(e),null===this._colorsTexture&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,4*e),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,4*e)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t||(this._instanceInfo[e].visible=t,this._visibilityChanged=!0),this}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(aa);t[t.length-1]===n.length;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),r=new Int32Array(e);Ca(this._multiDrawCounts,i),Ca(this._multiDrawStarts,r),this._multiDrawCounts=i,this._multiDrawStarts=r,this._maxInstanceCount=e;const s=this._indirectTexture,o=this._matricesTexture,a=this._colorsTexture;s.dispose(),this._initIndirectTexture(),Ca(s.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),Ca(o.image.data,this._matricesTexture.image.data),a&&(a.dispose(),this._initColorsTexture(),Ca(a.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter((e=>e.active));if(Math.max(...n.map((e=>e.vertexStart+e.reservedVertexCount)))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map((e=>e.indexStart+e.reservedIndexCount)))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const i=this.geometry;i.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Bs,this._initializeGeometry(i));const r=this.geometry;i.index&&Ca(i.index.array,r.index.array);for(const e in i.attributes)Ca(i.attributes[e].array,r.attributes[e].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,s=this.geometry;Ea.material=this.material,Ea.geometry.index=s.index,Ea.geometry.attributes=s.attributes,null===Ea.geometry.boundingBox&&(Ea.geometry.boundingBox=new Ui),null===Ea.geometry.boundingSphere&&(Ea.geometry.boundingSphere=new $i);for(let s=0,o=n.length;s<o;s++){if(!n[s].visible||!n[s].active)continue;const o=n[s].geometryIndex,a=i[o];Ea.geometry.setDrawRange(a.start,a.count),this.getMatrixAt(s,Ea.matrixWorld).premultiply(r),this.getBoundingBoxAt(o,Ea.geometry.boundingBox),this.getBoundingSphereAt(o,Ea.geometry.boundingSphere),Ea.raycast(e,xa);for(let e=0,n=xa.length;e<n;e++){const n=xa[e];n.object=this,n.batchId=s,t.push(n)}xa.length=0}Ea.material=null,Ea.geometry.index=null,Ea.geometry.attributes={},Ea.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=null!==e.boundingBox?e.boundingBox.clone():null,this.boundingSphere=null!==e.boundingSphere?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map((e=>({...e,boundingBox:null!==e.boundingBox?e.boundingBox.clone():null,boundingSphere:null!==e.boundingSphere?e.boundingSphere.clone():null}))),this._instanceInfo=e._instanceInfo.map((e=>({...e}))),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const s=i.getIndex(),o=null===s?1:s.array.BYTES_PER_ELEMENT,a=this._instanceInfo,l=this._multiDrawStarts,c=this._multiDrawCounts,h=this._geometryInfo,d=this.perObjectFrustumCulled,u=this._indirectTexture,p=u.image.data;d&&(da.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),pa.setFromProjectionMatrix(da,e.coordinateSystem));let A=0;if(this.sortObjects){da.copy(this.matrixWorld).invert(),ma.setFromMatrixPosition(n.matrixWorld).applyMatrix4(da),ga.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(da);for(let e=0,t=a.length;e<t;e++)if(a[e].visible&&a[e].active){const t=a[e].geometryIndex;this.getMatrixAt(e,da),this.getBoundingSphereAt(t,fa).applyMatrix4(da);let n=!1;if(d&&(n=!pa.intersectsSphere(fa)),!n){const n=h[t],i=va.subVectors(fa.center,ma).dot(ga);ya.push(n.start,n.count,i,e)}}const e=ya.list,t=this.customSort;null===t?e.sort(r.transparent?ca:la):t.call(this,e,n);for(let t=0,n=e.length;t<n;t++){const n=e[t];l[A]=n.start*o,c[A]=n.count,p[A]=n.index,A++}ya.reset()}else for(let e=0,t=a.length;e<t;e++)if(a[e].visible&&a[e].active){const t=a[e].geometryIndex;let n=!1;if(d&&(this.getMatrixAt(e,da),this.getBoundingSphereAt(t,fa).applyMatrix4(da),n=!pa.intersectsSphere(fa)),!n){const n=h[t];l[A]=n.start*o,c[A]=n.count,p[A]=e,A++}}u.needsUpdate=!0,this._multiDrawCount=A,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,r,s){this.onBeforeRender(e,null,i,r,s)}}class _a extends is{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new es(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Ma=new Li,Sa=new Li,Ia=new lr,Ba=new ar,Ta=new $i,Ra=new Li,La=new Li;class Da extends Ur{constructor(e=new Bs,t=new _a){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,i=t.count;e<i;e++)Ma.fromBufferAttribute(t,e-1),Sa.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=Ma.distanceTo(Sa);e.setAttribute("lineDistance",new xs(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ta.copy(n.boundingSphere),Ta.applyMatrix4(i),Ta.radius+=r,!1===e.ray.intersectsSphere(Ta))return;Ia.copy(i).invert(),Ba.copy(e.ray).applyMatrix4(Ia);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,l=this.isLineSegments?2:1,c=n.index,h=n.attributes.position;if(null!==c){const n=Math.max(0,s.start),i=Math.min(c.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=c.getX(r),i=c.getX(r+1),s=Pa(this,e,Ba,a,n,i);s&&t.push(s)}if(this.isLineLoop){const r=c.getX(i-1),s=c.getX(n),o=Pa(this,e,Ba,a,r,s);o&&t.push(o)}}else{const n=Math.max(0,s.start),i=Math.min(h.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=Pa(this,e,Ba,a,r,r+1);n&&t.push(n)}if(this.isLineLoop){const r=Pa(this,e,Ba,a,i-1,n);r&&t.push(r)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function Pa(e,t,n,i,r,s){const o=e.geometry.attributes.position;if(Ma.fromBufferAttribute(o,r),Sa.fromBufferAttribute(o,s),n.distanceSqToSegment(Ma,Sa,Ra,La)>i)return;Ra.applyMatrix4(e.matrixWorld);const a=t.ray.origin.distanceTo(Ra);return a<t.near||a>t.far?void 0:{distance:a,point:La.clone().applyMatrix4(e.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:e}}const Ua=new Li,Oa=new Li;class Fa extends Da{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e<i;e+=2)Ua.fromBufferAttribute(t,e),Oa.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+Ua.distanceTo(Oa);e.setAttribute("lineDistance",new xs(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ka extends Da{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Na extends is{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new es(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Qa=new lr,Ga=new ar,za=new $i,Ha=new Li;class Va extends Ur{constructor(e=new Bs,t=new Na){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),za.copy(n.boundingSphere),za.applyMatrix4(i),za.radius+=r,!1===e.ray.intersectsSphere(za))return;Qa.copy(i).invert(),Ga.copy(e.ray).applyMatrix4(Qa);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,l=n.index,c=n.attributes.position;if(null!==l)for(let n=Math.max(0,s.start),r=Math.min(l.count,s.start+s.count);n<r;n++){const r=l.getX(n);Ha.fromBufferAttribute(c,r),ja(Ha,r,a,i,e,t,this)}else for(let n=Math.max(0,s.start),r=Math.min(c.count,s.start+s.count);n<r;n++)Ha.fromBufferAttribute(c,n),ja(Ha,n,a,i,e,t,this)}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function ja(e,t,n,i,r,s,o){const a=Ga.distanceSqToPoint(e);if(a<n){const n=new Li;Ga.closestPointToPoint(e,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}class Wa extends Ur{constructor(){super(),this.isGroup=!0,this.type="Group"}}class qa extends Ci{constructor(e,t,n,i,r,s,o,a,l){super(e,t,n,i,r,s,o,a,l),this.isVideoTexture=!0,this.minFilter=void 0!==s?s:Me,this.magFilter=void 0!==r?r:Me,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)}}class Xa extends Ci{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=xe,this.minFilter=xe,this.generateMipmaps=!1,this.needsUpdate=!0}}class Ya extends Ci{constructor(e,t,n,i,r,s,o,a,l,c,h,d){super(null,s,o,a,l,c,i,r,h,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Ja extends Ya{constructor(e,t,n,i,r,s){super(e,t,n,r,s),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=ye,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ka extends Ya{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,pe),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Za extends Ci{constructor(e,t,n,i,r,s,o,a,l){super(e,t,n,i,r,s,o,a,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class $a extends Ci{constructor(e,t,n,i,r,s,o,a,l,c=Xe){if(c!==Xe&&c!==Ye)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Xe&&(n=Oe),void 0===n&&c===Ye&&(n=Ge),super(null,i,r,s,o,a,c,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==o?o:xe,this.minFilter=void 0!==a?a:xe,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class el{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let s=1;s<=e;s++)n=this.getPoint(s/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let s;s=t||e*n[r-1];let o,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),o=n[i]-s,o<0)a=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(e,t){const n=1e-4;let i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),o=this.getPoint(r),a=t||(s.isVector2?new ti:new Li);return a.copy(o).sub(s).normalize(),a}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new Li,i=[],r=[],s=[],o=new Li,a=new lr;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new Li)}r[0]=new Li,s[0]=new Li;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),d<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),s[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),s[t]=s[t-1].clone(),o.crossVectors(i[t-1],i[t]),o.length()>Number.EPSILON){o.normalize();const e=Math.acos(Yn(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(a.makeRotationAxis(o,e))}s[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(Yn(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],t*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class tl extends el{constructor(e=0,t=0,n=1,i=1,r=0,s=2*Math.PI,o=!1,a=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(e,t=new ti){const n=t,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=s?0:i),!0!==this.aClockwise||s||(r===i?r=-i:r-=i);const o=this.aStartAngle+e*r;let a=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=a-this.aX,i=l-this.aY;a=n*e-i*t+this.aX,l=n*t+i*e+this.aY}return n.set(a,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class nl extends tl{constructor(e,t,n,i,r,s){super(e,t,n,n,i,r,s),this.isArcCurve=!0,this.type="ArcCurve"}}function il(){let e=0,t=0,n=0,i=0;function r(r,s,o,a){e=r,t=o,n=-3*r+3*s-2*o-a,i=2*r-2*s+o+a}return{initCatmullRom:function(e,t,n,i,s){r(t,n,s*(n-e),s*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,s,o,a){let l=(t-e)/s-(n-e)/(s+o)+(n-t)/o,c=(n-t)/o-(i-t)/(o+a)+(i-n)/a;l*=o,c*=o,r(t,n,l,c)},calc:function(r){const s=r*r;return e+t*r+n*s+i*(s*r)}}}const rl=new Li,sl=new il,ol=new il,al=new il;class ll extends el{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new Li){const n=t,i=this.points,r=i.length,s=(r-(this.closed?0:1))*e;let o,a,l=Math.floor(s),c=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?o=i[(l-1)%r]:(rl.subVectors(i[0],i[1]).add(i[0]),o=rl);const h=i[l%r],d=i[(l+1)%r];if(this.closed||l+2<r?a=i[(l+2)%r]:(rl.subVectors(i[r-1],i[r-2]).add(i[r-1]),a=rl),"centripetal"===this.curveType||"chordal"===this.curveType){const e="chordal"===this.curveType?.5:.25;let t=Math.pow(o.distanceToSquared(h),e),n=Math.pow(h.distanceToSquared(d),e),i=Math.pow(d.distanceToSquared(a),e);n<1e-4&&(n=1),t<1e-4&&(t=n),i<1e-4&&(i=n),sl.initNonuniformCatmullRom(o.x,h.x,d.x,a.x,t,n,i),ol.initNonuniformCatmullRom(o.y,h.y,d.y,a.y,t,n,i),al.initNonuniformCatmullRom(o.z,h.z,d.z,a.z,t,n,i)}else"catmullrom"===this.curveType&&(sl.initCatmullRom(o.x,h.x,d.x,a.x,this.tension),ol.initCatmullRom(o.y,h.y,d.y,a.y,this.tension),al.initCatmullRom(o.z,h.z,d.z,a.z,this.tension));return n.set(sl.calc(c),ol.calc(c),al.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new Li).fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function cl(e,t,n,i,r){const s=.5*(i-t),o=.5*(r-n),a=e*e;return(2*n-2*i+s+o)*(e*a)+(-3*n+3*i-2*s-o)*a+s*e+n}function hl(e,t,n,i){return function(e,t){const n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function dl(e,t,n,i,r){return function(e,t){const n=1-e;return n*n*n*t}(e,t)+function(e,t){const n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}class ul extends el{constructor(e=new ti,t=new ti,n=new ti,i=new ti){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new ti){const n=t,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(dl(e,i.x,r.x,s.x,o.x),dl(e,i.y,r.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class pl extends el{constructor(e=new Li,t=new Li,n=new Li,i=new Li){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new Li){const n=t,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(dl(e,i.x,r.x,s.x,o.x),dl(e,i.y,r.y,s.y,o.y),dl(e,i.z,r.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Al extends el{constructor(e=new ti,t=new ti){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ti){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ti){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class fl extends el{constructor(e=new Li,t=new Li){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new Li){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Li){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class ml extends el{constructor(e=new ti,t=new ti,n=new ti){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ti){const n=t,i=this.v0,r=this.v1,s=this.v2;return n.set(hl(e,i.x,r.x,s.x),hl(e,i.y,r.y,s.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class gl extends el{constructor(e=new Li,t=new Li,n=new Li){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Li){const n=t,i=this.v0,r=this.v1,s=this.v2;return n.set(hl(e,i.x,r.x,s.x),hl(e,i.y,r.y,s.y),hl(e,i.z,r.z,s.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class vl extends el{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ti){const n=t,i=this.points,r=(i.length-1)*e,s=Math.floor(r),o=r-s,a=i[0===s?s:s-1],l=i[s],c=i[s>i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(cl(o,a.x,l.x,c.x,h.x),cl(o,a.y,l.y,c.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new ti).fromArray(n))}return this}}var yl=Object.freeze({__proto__:null,ArcCurve:nl,CatmullRomCurve3:ll,CubicBezierCurve:ul,CubicBezierCurve3:pl,EllipseCurve:tl,LineCurve:Al,LineCurve3:fl,QuadraticBezierCurve:ml,QuadraticBezierCurve3:gl,SplineCurve:vl});class El extends el{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);if(!e.equals(t)){const n=!0===e.isVector2?"LineCurve":"LineCurve3";this.curves.push(new yl[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const e=i[r]-n,s=this.curves[r],o=s.getLength(),a=0===o?0:1-e/o;return s.getPointAt(a,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const s=r[i],o=s.isEllipseCurve?2*e:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?e*s.points.length:e,a=s.getPoints(o);for(let e=0;e<a.length;e++){const i=a[e];n&&n.equals(i)||(t.push(i),n=i)}}return this.autoClose&&t.length>1&&!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;t<n;t++){const n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const n=e.curves[t];this.curves.push((new yl[n.type]).fromJSON(n))}return this}}class xl extends El{constructor(e){super(),this.type="Path",this.currentPoint=new ti,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Al(this.currentPoint.clone(),new ti(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new ml(this.currentPoint.clone(),new ti(e,t),new ti(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,s){const o=new ul(this.currentPoint.clone(),new ti(e,t),new ti(n,i),new ti(r,s));return this.curves.push(o),this.currentPoint.set(r,s),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new vl(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,s){const o=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(e+o,t+a,n,i,r,s),this}absarc(e,t,n,i,r,s){return this.absellipse(e,t,n,n,i,r,s),this}ellipse(e,t,n,i,r,s,o,a){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,n,i,r,s,o,a),this}absellipse(e,t,n,i,r,s,o,a){const l=new tl(e,t,n,i,r,s,o,a);if(this.curves.length>0){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 bl extends Bs{constructor(e=[new ti(0,-.5),new ti(.5,0),new ti(0,.5)],t=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Yn(i,0,2*Math.PI);const r=[],s=[],o=[],a=[],l=[],c=1/t,h=new Li,d=new ti,u=new Li,p=new Li,A=new Li;let f=0,m=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:f=e[t+1].x-e[t].x,m=e[t+1].y-e[t].y,u.x=1*m,u.y=-f,u.z=0*m,A.copy(u),u.normalize(),a.push(u.x,u.y,u.z);break;case e.length-1:a.push(A.x,A.y,A.z);break;default:f=e[t+1].x-e[t].x,m=e[t+1].y-e[t].y,u.x=1*m,u.y=-f,u.z=0*m,p.copy(u),u.x+=A.x,u.y+=A.y,u.z+=A.z,u.normalize(),a.push(u.x,u.y,u.z),A.copy(p)}for(let r=0;r<=t;r++){const u=n+r*c*i,p=Math.sin(u),A=Math.cos(u);for(let n=0;n<=e.length-1;n++){h.x=e[n].x*p,h.y=e[n].y,h.z=e[n].x*A,s.push(h.x,h.y,h.z),d.x=r/t,d.y=n/(e.length-1),o.push(d.x,d.y);const i=a[3*n+0]*p,c=a[3*n+1],u=a[3*n+0]*A;l.push(i,c,u)}}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){const i=t+n*e.length,s=i,o=i+e.length,a=i+e.length+1,l=i+1;r.push(s,o,l),r.push(a,l,o)}this.setIndex(r),this.setAttribute("position",new xs(s,3)),this.setAttribute("uv",new xs(o,2)),this.setAttribute("normal",new xs(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bl(e.points,e.segments,e.phiStart,e.phiLength)}}class Cl extends bl{constructor(e=1,t=1,n=4,i=8){const r=new xl;r.absarc(0,-t/2,e,1.5*Math.PI,0),r.absarc(0,t/2,e,0,.5*Math.PI),super(r.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new Cl(e.radius,e.length,e.capSegments,e.radialSegments)}}class wl extends Bs{constructor(e=1,t=32,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=[],o=[],a=[],l=new Li,c=new ti;s.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let r=0,h=3;r<=t;r++,h+=3){const d=n+r/t*i;l.x=e*Math.cos(d),l.y=e*Math.sin(d),s.push(l.x,l.y,l.z),o.push(0,0,1),c.x=(s[h]/e+1)/2,c.y=(s[h+1]/e+1)/2,a.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 xs(s,3)),this.setAttribute("normal",new xs(o,3)),this.setAttribute("uv",new xs(a,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new wl(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class _l extends Bs{constructor(e=1,t=1,n=1,i=32,r=1,s=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a};const l=this;i=Math.floor(i),r=Math.floor(r);const c=[],h=[],d=[],u=[];let p=0;const A=[],f=n/2;let m=0;function g(n){const r=p,s=new ti,A=new Li;let g=0;const v=!0===n?e:t,y=!0===n?1:-1;for(let e=1;e<=i;e++)h.push(0,f*y,0),d.push(0,y,0),u.push(.5,.5),p++;const E=p;for(let e=0;e<=i;e++){const t=e/i*a+o,n=Math.cos(t),r=Math.sin(t);A.x=v*r,A.y=f*y,A.z=v*n,h.push(A.x,A.y,A.z),d.push(0,y,0),s.x=.5*n+.5,s.y=.5*r*y+.5,u.push(s.x,s.y),p++}for(let e=0;e<i;e++){const t=r+e,i=E+e;!0===n?c.push(i,i+1,t):c.push(i+1,i,t),g+=3}l.addGroup(m,g,!0===n?1:2),m+=g}!function(){const s=new Li,g=new Li;let v=0;const y=(t-e)/n;for(let l=0;l<=r;l++){const c=[],m=l/r,v=m*(t-e)+e;for(let e=0;e<=i;e++){const t=e/i,r=t*a+o,l=Math.sin(r),A=Math.cos(r);g.x=v*l,g.y=-m*n+f,g.z=v*A,h.push(g.x,g.y,g.z),s.set(l,y,A).normalize(),d.push(s.x,s.y,s.z),u.push(t,1-m),c.push(p++)}A.push(c)}for(let n=0;n<i;n++)for(let i=0;i<r;i++){const s=A[i][n],o=A[i+1][n],a=A[i+1][n+1],l=A[i][n+1];(e>0||0!==i)&&(c.push(s,o,l),v+=3),(t>0||i!==r-1)&&(c.push(o,a,l),v+=3)}l.addGroup(m,v,0),m+=v}(),!1===s&&(e>0&&g(!0),t>0&&g(!1)),this.setIndex(c),this.setAttribute("position",new xs(h,3)),this.setAttribute("normal",new xs(d,3)),this.setAttribute("uv",new xs(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _l(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ml extends _l{constructor(e=1,t=1,n=32,i=1,r=!1,s=0,o=2*Math.PI){super(0,e,t,n,i,r,s,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:o}}static fromJSON(e){return new Ml(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Sl extends Bs{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],s=[];function o(e,t,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const o=e.clone().lerp(n,i/r),a=t.clone().lerp(n,i/r),l=r-i;for(let e=0;e<=l;e++)s[i][e]=0===e&&i===r?o:o.clone().lerp(a,e/l)}for(let e=0;e<r;e++)for(let t=0;t<2*(r-e)-1;t++){const n=Math.floor(t/2);t%2==0?(a(s[e][n+1]),a(s[e+1][n]),a(s[e][n])):(a(s[e][n+1]),a(s[e+1][n+1]),a(s[e+1][n]))}}function a(e){r.push(e.x,e.y,e.z)}function l(t,n){const i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function c(e,t,n,i){i<0&&1===e.x&&(s[t]=e.x-1),0===n.x&&0===n.z&&(s[t]=i/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}!function(e){const n=new Li,i=new Li,r=new Li;for(let s=0;s<t.length;s+=3)l(t[s+0],n),l(t[s+1],i),l(t[s+2],r),o(n,i,r,e)}(i),function(e){const t=new Li;for(let n=0;n<r.length;n+=3)t.x=r[n+0],t.y=r[n+1],t.z=r[n+2],t.normalize().multiplyScalar(e),r[n+0]=t.x,r[n+1]=t.y,r[n+2]=t.z}(n),function(){const e=new Li;for(let n=0;n<r.length;n+=3){e.x=r[n+0],e.y=r[n+1],e.z=r[n+2];const i=h(e)/2/Math.PI+.5,o=(t=e,Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5);s.push(i,1-o)}var t;(function(){const e=new Li,t=new Li,n=new Li,i=new Li,o=new ti,a=new ti,l=new ti;for(let d=0,u=0;d<r.length;d+=9,u+=6){e.set(r[d+0],r[d+1],r[d+2]),t.set(r[d+3],r[d+4],r[d+5]),n.set(r[d+6],r[d+7],r[d+8]),o.set(s[u+0],s[u+1]),a.set(s[u+2],s[u+3]),l.set(s[u+4],s[u+5]),i.copy(e).add(t).add(n).divideScalar(3);const p=h(i);c(o,u+0,e,p),c(a,u+2,t,p),c(l,u+4,n,p)}})(),function(){for(let e=0;e<s.length;e+=6){const t=s[e+0],n=s[e+2],i=s[e+4],r=Math.max(t,n,i),o=Math.min(t,n,i);r>.9&&o<.1&&(t<.2&&(s[e+0]+=1),n<.2&&(s[e+2]+=1),i<.2&&(s[e+4]+=1))}}()}(),this.setAttribute("position",new xs(r,3)),this.setAttribute("normal",new xs(r.slice(),3)),this.setAttribute("uv",new xs(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sl(e.vertices,e.indices,e.radius,e.details)}}class Il extends Sl{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 Il(e.radius,e.detail)}}const Bl=new Li,Tl=new Li,Rl=new Li,Ll=new Yr;class Dl extends Bs{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const n=4,i=Math.pow(10,n),r=Math.cos(Wn*t),s=e.getIndex(),o=e.getAttribute("position"),a=s?s.count:o.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),d={},u=[];for(let e=0;e<a;e+=3){s?(l[0]=s.getX(e),l[1]=s.getX(e+1),l[2]=s.getX(e+2)):(l[0]=e,l[1]=e+1,l[2]=e+2);const{a:t,b:n,c:a}=Ll;if(t.fromBufferAttribute(o,l[0]),n.fromBufferAttribute(o,l[1]),a.fromBufferAttribute(o,l[2]),Ll.getNormal(Rl),h[0]=`${Math.round(t.x*i)},${Math.round(t.y*i)},${Math.round(t.z*i)}`,h[1]=`${Math.round(n.x*i)},${Math.round(n.y*i)},${Math.round(n.z*i)}`,h[2]=`${Math.round(a.x*i)},${Math.round(a.y*i)},${Math.round(a.z*i)}`,h[0]!==h[1]&&h[1]!==h[2]&&h[2]!==h[0])for(let e=0;e<3;e++){const t=(e+1)%3,n=h[e],i=h[t],s=Ll[c[e]],o=Ll[c[t]],a=`${n}_${i}`,p=`${i}_${n}`;p in d&&d[p]?(Rl.dot(d[p].normal)<=r&&(u.push(s.x,s.y,s.z),u.push(o.x,o.y,o.z)),d[p]=null):a in d||(d[a]={index0:l[e],index1:l[t],normal:Rl.clone()})}}for(const e in d)if(d[e]){const{index0:t,index1:n}=d[e];Bl.fromBufferAttribute(o,t),Tl.fromBufferAttribute(o,n),u.push(Bl.x,Bl.y,Bl.z),u.push(Tl.x,Tl.y,Tl.z)}this.setAttribute("position",new xs(u,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Pl extends xl{constructor(e){super(e),this.uuid=Xn(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push((new xl).fromJSON(n))}return this}}function Ul(e,t,n,i,r){let s,o;if(r===function(e,t,n,i){let r=0;for(let s=t,o=n-i;s<n;s+=i)r+=(e[o]-e[s])*(e[s+1]+e[o+1]),o=s;return r}(e,t,n,i)>0)for(s=t;s<n;s+=i)o=nc(s,e[s],e[s+1],o);else for(s=n-i;s>=t;s-=i)o=nc(s,e[s],e[s+1],o);return o&&Jl(o,o.next)&&(ic(o),o=o.next),o}function Ol(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!Jl(i,i.next)&&0!==Yl(i.prev,i,i.next))i=i.next;else{if(ic(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function Fl(e,t,n,i,r,s,o){if(!e)return;!o&&s&&function(e,t,n,i){let r=e;do{0===r.z&&(r.z=jl(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n,i,r,s,o,a,l,c=1;do{for(n=e,e=null,s=null,o=0;n;){for(o++,i=n,a=0,t=0;t<c&&(a++,i=i.nextZ,i);t++);for(l=c;a>0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(o>1)}(r)}(e,i,r,s);let a,l,c=e;for(;e.prev!==e.next;)if(a=e.prev,l=e.next,s?Nl(e,i,r,s):kl(e))t.push(a.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),ic(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?Fl(e=Ql(Ol(e),t,n),t,n,i,r,s,2):2===o&&Gl(e,t,n,i,r,s):Fl(Ol(e),t,n,i,r,s,1);break}}function kl(e){const t=e.prev,n=e,i=e.next;if(Yl(t,n,i)>=0)return!1;const r=t.x,s=n.x,o=i.x,a=t.y,l=n.y,c=i.y,h=r<s?r<o?r:o:s<o?s:o,d=a<l?a<c?a:c:l<c?l:c,u=r>s?r>o?r:o:s>o?s:o,p=a>l?a>c?a:c:l>c?l:c;let A=i.next;for(;A!==t;){if(A.x>=h&&A.x<=u&&A.y>=d&&A.y<=p&&ql(r,a,s,l,o,c,A.x,A.y)&&Yl(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function Nl(e,t,n,i){const r=e.prev,s=e,o=e.next;if(Yl(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,h=r.y,d=s.y,u=o.y,p=a<l?a<c?a:c:l<c?l:c,A=h<d?h<u?h:u:d<u?d:u,f=a>l?a>c?a:c:l>c?l:c,m=h>d?h>u?h:u:d>u?d:u,g=jl(p,A,t,n,i),v=jl(f,m,t,n,i);let y=e.prevZ,E=e.nextZ;for(;y&&y.z>=g&&E&&E.z<=v;){if(y.x>=p&&y.x<=f&&y.y>=A&&y.y<=m&&y!==r&&y!==o&&ql(a,h,l,d,c,u,y.x,y.y)&&Yl(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,E.x>=p&&E.x<=f&&E.y>=A&&E.y<=m&&E!==r&&E!==o&&ql(a,h,l,d,c,u,E.x,E.y)&&Yl(E.prev,E,E.next)>=0)return!1;E=E.nextZ}for(;y&&y.z>=g;){if(y.x>=p&&y.x<=f&&y.y>=A&&y.y<=m&&y!==r&&y!==o&&ql(a,h,l,d,c,u,y.x,y.y)&&Yl(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;E&&E.z<=v;){if(E.x>=p&&E.x<=f&&E.y>=A&&E.y<=m&&E!==r&&E!==o&&ql(a,h,l,d,c,u,E.x,E.y)&&Yl(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function Ql(e,t,n){let i=e;do{const r=i.prev,s=i.next.next;!Jl(r,s)&&Kl(r,i,i.next,s)&&ec(r,s)&&ec(s,r)&&(t.push(r.i/n|0),t.push(i.i/n|0),t.push(s.i/n|0),ic(i),ic(i.next),i=e=s),i=i.next}while(i!==e);return Ol(i)}function Gl(e,t,n,i,r,s){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&Xl(o,e)){let a=tc(o,e);return o=Ol(o,o.next),a=Ol(a,a.next),Fl(o,t,n,i,r,s,0),void Fl(a,t,n,i,r,s,0)}e=e.next}o=o.next}while(o!==e)}function zl(e,t){return e.x-t.x}function Hl(e,t){const n=function(e,t){let n,i=t,r=-1/0;const s=e.x,o=e.y;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){const e=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=s&&e>r&&(r=e,n=i.x<i.next.x?i:i.next,e===s))return n}i=i.next}while(i!==t);if(!n)return null;const a=n,l=n.x,c=n.y;let h,d=1/0;i=n;do{s>=i.x&&i.x>=l&&s!==i.x&&ql(o<c?s:r,o,l,c,o<c?r:s,o,i.x,i.y)&&(h=Math.abs(o-i.y)/(s-i.x),ec(i,e)&&(h<d||h===d&&(i.x>n.x||i.x===n.x&&Vl(n,i)))&&(n=i,d=h)),i=i.next}while(i!==a);return n}(e,t);if(!n)return t;const i=tc(n,e);return Ol(i,i.next),Ol(n,n.next)}function Vl(e,t){return Yl(e.prev,e,t.prev)<0&&Yl(t.next,e,e.next)<0}function jl(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Wl(e){let t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function ql(e,t,n,i,r,s,o,a){return(r-o)*(t-a)>=(e-o)*(s-a)&&(e-o)*(i-a)>=(n-o)*(t-a)&&(n-o)*(s-a)>=(r-o)*(i-a)}function Xl(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&&Kl(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(ec(e,t)&&ec(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)&&(Yl(e.prev,e,t.prev)||Yl(e,t.prev,t))||Jl(e,t)&&Yl(e.prev,e,e.next)>0&&Yl(t.prev,t,t.next)>0)}function Yl(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Jl(e,t){return e.x===t.x&&e.y===t.y}function Kl(e,t,n,i){const r=$l(Yl(e,t,n)),s=$l(Yl(e,t,i)),o=$l(Yl(n,i,e)),a=$l(Yl(n,i,t));return r!==s&&o!==a||!(0!==r||!Zl(e,n,t))||!(0!==s||!Zl(e,i,t))||!(0!==o||!Zl(n,e,i))||!(0!==a||!Zl(n,t,i))}function Zl(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 $l(e){return e>0?1:e<0?-1:0}function ec(e,t){return Yl(e.prev,e,e.next)<0?Yl(e,t,e.next)>=0&&Yl(e,e.prev,t)>=0:Yl(e,t,e.prev)<0||Yl(e,e.next,t)<0}function tc(e,t){const n=new rc(e.i,e.x,e.y),i=new rc(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 nc(e,t,n,i){const r=new rc(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 ic(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 rc(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class sc{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n}static isClockWise(e){return sc.area(e)<0}static triangulateShape(e,t){const n=[],i=[],r=[];oc(e),ac(n,e);let s=e.length;t.forEach(oc);for(let e=0;e<t.length;e++)i.push(s),s+=t[e].length,ac(n,t[e]);const o=function(e,t,n=2){const i=t&&t.length,r=i?t[0]*n:e.length;let s=Ul(e,0,r,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,h,d,u,p;if(i&&(s=function(e,t,n,i){const r=[];let s,o,a,l,c;for(s=0,o=t.length;s<o;s++)a=t[s]*i,l=s<o-1?t[s+1]*i:e.length,c=Ul(e,a,l,i,!1),c===c.next&&(c.steiner=!0),r.push(Wl(c));for(r.sort(zl),s=0;s<r.length;s++)n=Hl(r[s],n);return n}(e,t,s,n)),e.length>80*n){a=c=e[0],l=h=e[1];for(let t=n;t<r;t+=n)d=e[t],u=e[t+1],d<a&&(a=d),u<l&&(l=u),d>c&&(c=d),u>h&&(h=u);p=Math.max(c-a,h-l),p=0!==p?32767/p:0}return Fl(s,o,n,a,l,p,0),o}(n,i);for(let e=0;e<o.length;e+=3)r.push(o.slice(e,e+3));return r}}function oc(e){const t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function ac(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}class lc extends Bs{constructor(e=new Pl([new ti(.5,.5),new ti(-.5,.5),new ti(-.5,-.5),new ti(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let t=0,n=e.length;t<n;t++)s(e[t]);function s(e){const s=[],o=void 0!==t.curveSegments?t.curveSegments:12,a=void 0!==t.steps?t.steps:1,l=void 0!==t.depth?t.depth:1;let c=void 0===t.bevelEnabled||t.bevelEnabled,h=void 0!==t.bevelThickness?t.bevelThickness:.2,d=void 0!==t.bevelSize?t.bevelSize:h-.1,u=void 0!==t.bevelOffset?t.bevelOffset:0,p=void 0!==t.bevelSegments?t.bevelSegments:3;const A=t.extrudePath,f=void 0!==t.UVGenerator?t.UVGenerator:cc;let m,g,v,y,E,x=!1;A&&(m=A.getSpacedPoints(a),x=!0,c=!1,g=A.computeFrenetFrames(a,!1),v=new Li,y=new Li,E=new Li),c||(p=0,h=0,d=0,u=0);const b=e.extractPoints(o);let C=b.shape;const w=b.holes;if(!sc.isClockWise(C)){C=C.reverse();for(let e=0,t=w.length;e<t;e++){const t=w[e];sc.isClockWise(t)&&(w[e]=t.reverse())}}const _=sc.triangulateShape(C,w),M=C;for(let e=0,t=w.length;e<t;e++){const t=w[e];C=C.concat(t)}function S(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().addScaledVector(t,n)}const I=C.length,B=_.length;function T(e,t,n){let i,r,s;const o=e.x-t.x,a=e.y-t.y,l=n.x-e.x,c=n.y-e.y,h=o*o+a*a,d=o*c-a*l;if(Math.abs(d)>Number.EPSILON){const d=Math.sqrt(h),u=Math.sqrt(l*l+c*c),p=t.x-a/d,A=t.y+o/d,f=((n.x-c/u-p)*c-(n.y+l/u-A)*l)/(o*c-a*l);i=p+o*f-e.x,r=A+a*f-e.y;const m=i*i+r*r;if(m<=2)return new ti(i,r);s=Math.sqrt(m/2)}else{let e=!1;o>Number.EPSILON?l>Number.EPSILON&&(e=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(a)===Math.sign(c)&&(e=!0),e?(i=-a,r=o,s=Math.sqrt(h)):(i=o,r=a,s=Math.sqrt(h/2))}return new ti(i/s,r/s)}const R=[];for(let e=0,t=M.length,n=t-1,i=e+1;e<t;e++,n++,i++)n===t&&(n=0),i===t&&(i=0),R[e]=T(M[e],M[n],M[i]);const L=[];let D,P=R.concat();for(let e=0,t=w.length;e<t;e++){const t=w[e];D=[];for(let e=0,n=t.length,i=n-1,r=e+1;e<n;e++,i++,r++)i===n&&(i=0),r===n&&(r=0),D[e]=T(t[e],t[i],t[r]);L.push(D),P=P.concat(D)}for(let e=0;e<p;e++){const t=e/p,n=h*Math.cos(t*Math.PI/2),i=d*Math.sin(t*Math.PI/2)+u;for(let e=0,t=M.length;e<t;e++){const t=S(M[e],R[e],i);F(t.x,t.y,-n)}for(let e=0,t=w.length;e<t;e++){const t=w[e];D=L[e];for(let e=0,r=t.length;e<r;e++){const r=S(t[e],D[e],i);F(r.x,r.y,-n)}}}const U=d+u;for(let e=0;e<I;e++){const t=c?S(C[e],P[e],U):C[e];x?(y.copy(g.normals[0]).multiplyScalar(t.x),v.copy(g.binormals[0]).multiplyScalar(t.y),E.copy(m[0]).add(y).add(v),F(E.x,E.y,E.z)):F(t.x,t.y,0)}for(let e=1;e<=a;e++)for(let t=0;t<I;t++){const n=c?S(C[t],P[t],U):C[t];x?(y.copy(g.normals[e]).multiplyScalar(n.x),v.copy(g.binormals[e]).multiplyScalar(n.y),E.copy(m[e]).add(y).add(v),F(E.x,E.y,E.z)):F(n.x,n.y,l/a*e)}for(let e=p-1;e>=0;e--){const t=e/p,n=h*Math.cos(t*Math.PI/2),i=d*Math.sin(t*Math.PI/2)+u;for(let e=0,t=M.length;e<t;e++){const t=S(M[e],R[e],i);F(t.x,t.y,l+n)}for(let e=0,t=w.length;e<t;e++){const t=w[e];D=L[e];for(let e=0,r=t.length;e<r;e++){const r=S(t[e],D[e],i);x?F(r.x,r.y+m[a-1].y,m[a-1].x+n):F(r.x,r.y,l+n)}}}function O(e,t){let n=e.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=e.length-1);for(let e=0,n=a+2*p;e<n;e++){const n=I*e,s=I*(e+1);N(t+i+n,t+r+n,t+r+s,t+i+s)}}}function F(e,t,n){s.push(e),s.push(t),s.push(n)}function k(e,t,r){Q(e),Q(t),Q(r);const s=i.length/3,o=f.generateTopUV(n,i,s-3,s-2,s-1);G(o[0]),G(o[1]),G(o[2])}function N(e,t,r,s){Q(e),Q(t),Q(s),Q(t),Q(r),Q(s);const o=i.length/3,a=f.generateSideWallUV(n,i,o-6,o-3,o-2,o-1);G(a[0]),G(a[1]),G(a[3]),G(a[1]),G(a[2]),G(a[3])}function Q(e){i.push(s[3*e+0]),i.push(s[3*e+1]),i.push(s[3*e+2])}function G(e){r.push(e.x),r.push(e.y)}!function(){const e=i.length/3;if(c){let e=0,t=I*e;for(let e=0;e<B;e++){const n=_[e];k(n[2]+t,n[1]+t,n[0]+t)}e=a+2*p,t=I*e;for(let e=0;e<B;e++){const n=_[e];k(n[0]+t,n[1]+t,n[2]+t)}}else{for(let e=0;e<B;e++){const t=_[e];k(t[2],t[1],t[0])}for(let e=0;e<B;e++){const t=_[e];k(t[0]+I*a,t[1]+I*a,t[2]+I*a)}}n.addGroup(e,i.length/3-e,0)}(),function(){const e=i.length/3;let t=0;O(M,t),t+=M.length;for(let e=0,n=w.length;e<n;e++){const n=w[e];O(n,t),t+=n.length}n.addGroup(e,i.length/3-e,1)}()}this.setAttribute("position",new xs(i,3)),this.setAttribute("uv",new xs(r,2)),this.computeVertexNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,i=e.length;t<i;t++){const i=e[t];n.shapes.push(i.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const r=t[e.shapes[i]];n.push(r)}const i=e.options.extrudePath;return void 0!==i&&(e.options.extrudePath=(new yl[i.type]).fromJSON(i)),new lc(n,e.options)}}const cc={generateTopUV:function(e,t,n,i,r){const s=t[3*n],o=t[3*n+1],a=t[3*i],l=t[3*i+1],c=t[3*r],h=t[3*r+1];return[new ti(s,o),new ti(a,l),new ti(c,h)]},generateSideWallUV:function(e,t,n,i,r,s){const o=t[3*n],a=t[3*n+1],l=t[3*n+2],c=t[3*i],h=t[3*i+1],d=t[3*i+2],u=t[3*r],p=t[3*r+1],A=t[3*r+2],f=t[3*s],m=t[3*s+1],g=t[3*s+2];return Math.abs(a-h)<Math.abs(o-c)?[new ti(o,1-l),new ti(c,1-d),new ti(u,1-A),new ti(f,1-g)]:[new ti(a,1-l),new ti(h,1-d),new ti(p,1-A),new ti(m,1-g)]}};class hc extends Sl{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new hc(e.radius,e.detail)}}class dc extends Sl{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new dc(e.radius,e.detail)}}class uc extends Bs{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,s=t/2,o=Math.floor(n),a=Math.floor(i),l=o+1,c=a+1,h=e/o,d=t/a,u=[],p=[],A=[],f=[];for(let e=0;e<c;e++){const t=e*d-s;for(let n=0;n<l;n++){const i=n*h-r;p.push(i,-t,0),A.push(0,0,1),f.push(n/o),f.push(1-e/a)}}for(let e=0;e<a;e++)for(let t=0;t<o;t++){const n=t+l*e,i=t+l*(e+1),r=t+1+l*(e+1),s=t+1+l*e;u.push(n,i,s),u.push(i,r,s)}this.setIndex(u),this.setAttribute("position",new xs(p,3)),this.setAttribute("normal",new xs(A,3)),this.setAttribute("uv",new xs(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new uc(e.width,e.height,e.widthSegments,e.heightSegments)}}class pc extends Bs{constructor(e=.5,t=1,n=32,i=1,r=0,s=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:s},n=Math.max(3,n);const o=[],a=[],l=[],c=[];let h=e;const d=(t-e)/(i=Math.max(1,i)),u=new Li,p=new ti;for(let e=0;e<=i;e++){for(let e=0;e<=n;e++){const i=r+e/n*s;u.x=h*Math.cos(i),u.y=h*Math.sin(i),a.push(u.x,u.y,u.z),l.push(0,0,1),p.x=(u.x/t+1)/2,p.y=(u.y/t+1)/2,c.push(p.x,p.y)}h+=d}for(let e=0;e<i;e++){const t=e*(n+1);for(let e=0;e<n;e++){const i=e+t,r=i,s=i+n+1,a=i+n+2,l=i+1;o.push(r,s,l),o.push(s,a,l)}}this.setIndex(o),this.setAttribute("position",new xs(a,3)),this.setAttribute("normal",new xs(l,3)),this.setAttribute("uv",new xs(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new pc(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Ac extends Bs{constructor(e=new Pl([new ti(0,.5),new ti(-.5,-.5),new ti(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],s=[];let o=0,a=0;if(!1===Array.isArray(e))l(e);else for(let t=0;t<e.length;t++)l(e[t]),this.addGroup(o,a,t),o+=a,a=0;function l(e){const o=i.length/3,l=e.extractPoints(t);let c=l.shape;const h=l.holes;!1===sc.isClockWise(c)&&(c=c.reverse());for(let e=0,t=h.length;e<t;e++){const t=h[e];!0===sc.isClockWise(t)&&(h[e]=t.reverse())}const d=sc.triangulateShape(c,h);for(let e=0,t=h.length;e<t;e++){const t=h[e];c=c.concat(t)}for(let e=0,t=c.length;e<t;e++){const t=c[e];i.push(t.x,t.y,0),r.push(0,0,1),s.push(t.x,t.y)}for(let e=0,t=d.length;e<t;e++){const t=d[e],i=t[0]+o,r=t[1]+o,s=t[2]+o;n.push(i,r,s),a+=3}}this.setIndex(n),this.setAttribute("position",new xs(i,3)),this.setAttribute("normal",new xs(r,3)),this.setAttribute("uv",new xs(s,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return function(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,i=e.length;n<i;n++){const i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const r=t[e.shapes[i]];n.push(r)}return new Ac(n,e.curveSegments)}}class fc extends Bs{constructor(e=1,t=32,n=16,i=0,r=2*Math.PI,s=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:s,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const a=Math.min(s+o,Math.PI);let l=0;const c=[],h=new Li,d=new Li,u=[],p=[],A=[],f=[];for(let u=0;u<=n;u++){const m=[],g=u/n;let v=0;0===u&&0===s?v=.5/t:u===n&&a===Math.PI&&(v=-.5/t);for(let n=0;n<=t;n++){const a=n/t;h.x=-e*Math.cos(i+a*r)*Math.sin(s+g*o),h.y=e*Math.cos(s+g*o),h.z=e*Math.sin(i+a*r)*Math.sin(s+g*o),p.push(h.x,h.y,h.z),d.copy(h).normalize(),A.push(d.x,d.y,d.z),f.push(a+v,1-g),m.push(l++)}c.push(m)}for(let e=0;e<n;e++)for(let i=0;i<t;i++){const t=c[e][i+1],r=c[e][i],o=c[e+1][i],l=c[e+1][i+1];(0!==e||s>0)&&u.push(t,r,l),(e!==n-1||a<Math.PI)&&u.push(r,o,l)}this.setIndex(u),this.setAttribute("position",new xs(p,3)),this.setAttribute("normal",new xs(A,3)),this.setAttribute("uv",new xs(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fc(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class mc extends Sl{constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new mc(e.radius,e.detail)}}class gc extends Bs{constructor(e=1,t=.4,n=12,i=48,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const s=[],o=[],a=[],l=[],c=new Li,h=new Li,d=new Li;for(let s=0;s<=n;s++)for(let u=0;u<=i;u++){const p=u/i*r,A=s/n*Math.PI*2;h.x=(e+t*Math.cos(A))*Math.cos(p),h.y=(e+t*Math.cos(A))*Math.sin(p),h.z=t*Math.sin(A),o.push(h.x,h.y,h.z),c.x=e*Math.cos(p),c.y=e*Math.sin(p),d.subVectors(h,c).normalize(),a.push(d.x,d.y,d.z),l.push(u/i),l.push(s/n)}for(let e=1;e<=n;e++)for(let t=1;t<=i;t++){const n=(i+1)*e+t-1,r=(i+1)*(e-1)+t-1,o=(i+1)*(e-1)+t,a=(i+1)*e+t;s.push(n,r,a),s.push(r,o,a)}this.setIndex(s),this.setAttribute("position",new xs(o,3)),this.setAttribute("normal",new xs(a,3)),this.setAttribute("uv",new xs(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gc(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class vc extends Bs{constructor(e=1,t=.4,n=64,i=8,r=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:s},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],l=[],c=[],h=new Li,d=new Li,u=new Li,p=new Li,A=new Li,f=new Li,m=new Li;for(let o=0;o<=n;++o){const v=o/n*r*Math.PI*2;g(v,r,s,e,u),g(v+.01,r,s,e,p),f.subVectors(p,u),m.addVectors(p,u),A.crossVectors(f,m),m.crossVectors(A,f),A.normalize(),m.normalize();for(let e=0;e<=i;++e){const r=e/i*Math.PI*2,s=-t*Math.cos(r),p=t*Math.sin(r);h.x=u.x+(s*m.x+p*A.x),h.y=u.y+(s*m.y+p*A.y),h.z=u.z+(s*m.z+p*A.z),a.push(h.x,h.y,h.z),d.subVectors(h,u).normalize(),l.push(d.x,d.y,d.z),c.push(o/n),c.push(e/i)}}for(let e=1;e<=n;e++)for(let t=1;t<=i;t++){const n=(i+1)*(e-1)+(t-1),r=(i+1)*e+(t-1),s=(i+1)*e+t,a=(i+1)*(e-1)+t;o.push(n,r,a),o.push(r,s,a)}function g(e,t,n,i,r){const s=Math.cos(e),o=Math.sin(e),a=n/t*e,l=Math.cos(a);r.x=i*(2+l)*.5*s,r.y=i*(2+l)*o*.5,r.z=i*Math.sin(a)*.5}this.setIndex(o),this.setAttribute("position",new xs(a,3)),this.setAttribute("normal",new xs(l,3)),this.setAttribute("uv",new xs(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vc(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class yc extends Bs{constructor(e=new gl(new Li(-1,-1,0),new Li(-1,1,0),new Li(1,1,0)),t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const s=e.computeFrenetFrames(t,r);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;const o=new Li,a=new Li,l=new ti;let c=new Li;const h=[],d=[],u=[],p=[];function A(r){c=e.getPointAt(r/t,c);const l=s.normals[r],u=s.binormals[r];for(let e=0;e<=i;e++){const t=e/i*Math.PI*2,r=Math.sin(t),s=-Math.cos(t);a.x=s*l.x+r*u.x,a.y=s*l.y+r*u.y,a.z=s*l.z+r*u.z,a.normalize(),d.push(a.x,a.y,a.z),o.x=c.x+n*a.x,o.y=c.y+n*a.y,o.z=c.z+n*a.z,h.push(o.x,o.y,o.z)}}!function(){for(let e=0;e<t;e++)A(e);A(!1===r?t:0),function(){for(let e=0;e<=t;e++)for(let n=0;n<=i;n++)l.x=e/t,l.y=n/i,u.push(l.x,l.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=i;t++){const n=(i+1)*(e-1)+(t-1),r=(i+1)*e+(t-1),s=(i+1)*e+t,o=(i+1)*(e-1)+t;p.push(n,r,o),p.push(r,s,o)}}()}(),this.setIndex(p),this.setAttribute("position",new xs(h,3)),this.setAttribute("normal",new xs(d,3)),this.setAttribute("uv",new xs(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new yc((new yl[e.path.type]).fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Ec extends Bs{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},null!==e){const t=[],n=new Set,i=new Li,r=new Li;if(null!==e.index){const s=e.attributes.position,o=e.index;let a=e.groups;0===a.length&&(a=[{start:0,count:o.count,materialIndex:0}]);for(let e=0,l=a.length;e<l;++e){const l=a[e],c=l.start;for(let e=c,a=c+l.count;e<a;e+=3)for(let a=0;a<3;a++){const l=o.getX(e+a),c=o.getX(e+(a+1)%3);i.fromBufferAttribute(s,l),r.fromBufferAttribute(s,c),!0===xc(i,r,n)&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}}else{const s=e.attributes.position;for(let e=0,o=s.count/3;e<o;e++)for(let o=0;o<3;o++){const a=3*e+o,l=3*e+(o+1)%3;i.fromBufferAttribute(s,a),r.fromBufferAttribute(s,l),!0===xc(i,r,n)&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new xs(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function xc(e,t,n){const i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return!0!==n.has(i)&&!0!==n.has(r)&&(n.add(i),n.add(r),!0)}var bc=Object.freeze({__proto__:null,BoxGeometry:Hs,CapsuleGeometry:Cl,CircleGeometry:wl,ConeGeometry:Ml,CylinderGeometry:_l,DodecahedronGeometry:Il,EdgesGeometry:Dl,ExtrudeGeometry:lc,IcosahedronGeometry:hc,LatheGeometry:bl,OctahedronGeometry:dc,PlaneGeometry:uc,PolyhedronGeometry:Sl,RingGeometry:pc,ShapeGeometry:Ac,SphereGeometry:fc,TetrahedronGeometry:mc,TorusGeometry:gc,TorusKnotGeometry:vc,TubeGeometry:yc,WireframeGeometry:Ec});class Cc extends is{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new es(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class wc extends Xs{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class _c extends is{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new es(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new es(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vr,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Mc extends _c{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ti(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Yn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new es(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new es(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new es(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Sc extends is{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new es(16777215),this.specular=new es(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new es(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vr,this.combine=$,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Ic extends is{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new es(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new es(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class Bc extends is{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Tc extends is{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new es(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new es(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vr,this.combine=$,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Rc extends is{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Xt,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Lc extends is{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class Dc extends is{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new es(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Pc extends _a{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Uc(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function Oc(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Fc(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n}function kc(e,t,n){const i=e.length,r=new e.constructor(i);for(let s=0,o=0;o!==i;++s){const i=n[s]*t;for(let n=0;n!==t;++n)r[o++]=e[i+n]}return r}function Nc(e,t,n,i){let r=1,s=e[0];for(;void 0!==s&&void 0===s[i];)s=e[r++];if(void 0===s)return;let o=s[i];if(void 0!==o)if(Array.isArray(o))do{o=s[i],void 0!==o&&(t.push(s.time),n.push.apply(n,o)),s=e[r++]}while(void 0!==s);else if(void 0!==o.toArray)do{o=s[i],void 0!==o&&(t.push(s.time),o.toArray(n,n.length)),s=e[r++]}while(void 0!==s);else do{o=s[i],void 0!==o&&(t.push(s.time),n.push(o)),s=e[r++]}while(void 0!==s)}const Qc={convertArray:Uc,isTypedArray:Oc,getKeyframeOrder:Fc,sortedArray:kc,flattenJSON:Nc,subclip:function(e,t,n,i,r=30){const s=e.clone();s.name=t;const o=[];for(let e=0;e<s.tracks.length;++e){const t=s.tracks[e],a=t.getValueSize(),l=[],c=[];for(let e=0;e<t.times.length;++e){const s=t.times[e]*r;if(!(s<n||s>=i)){l.push(t.times[e]);for(let n=0;n<a;++n)c.push(t.values[e*a+n])}}0!==l.length&&(t.times=Uc(l,t.times.constructor),t.values=Uc(c,t.values.constructor),o.push(t))}s.tracks=o;let a=1/0;for(let e=0;e<s.tracks.length;++e)a>s.tracks[e].times[0]&&(a=s.tracks[e].times[0]);for(let e=0;e<s.tracks.length;++e)s.tracks[e].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(e,t=0,n=e,i=30){i<=0&&(i=30);const r=n.tracks.length,s=t/i;for(let t=0;t<r;++t){const i=n.tracks[t],r=i.ValueTypeName;if("bool"===r||"string"===r)continue;const o=e.tracks.find((function(e){return e.name===i.name&&e.ValueTypeName===r}));if(void 0===o)continue;let a=0;const l=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let c=0;const h=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=h/3);const d=i.times.length-1;let u;if(s<=i.times[0]){const e=a,t=l-a;u=i.values.slice(e,t)}else if(s>=i.times[d]){const e=d*l+a,t=e+l-a;u=i.values.slice(e,t)}else{const e=i.createInterpolant(),t=a,n=l-a;e.evaluate(s),u=e.resultBuffer.slice(t,n)}"quaternion"===r&&(new Ri).fromArray(u).normalize().conjugate().toArray(u);const p=o.times.length;for(let e=0;e<p;++e){const t=e*h+c;if("quaternion"===r)Ri.multiplyQuaternionsFlat(o.values,t,u,0,o.values,t);else{const e=h-2*c;for(let n=0;n<e;++n)o.values[t+n]-=u[n]}}}return e.blendMode=Vt,e}};class Gc{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let s;n:{i:if(!(e<i)){for(let s=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===s)break;if(r=i,i=t[++n],e<i)break t}s=t.length;break n}if(e>=r)break e;{const o=t[1];e<o&&(n=2,r=o);for(let s=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===s)break;if(i=r,r=t[--n-1],e>=r)break t}s=n,n=0}}for(;n<s;){const i=n+s>>>1;e<t[i]?s=i:n=i+1}if(i=t[n],r=t[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let e=0;e!==i;++e)t[e]=n[r+e];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class zc extends Gc{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Qt,endingEnd:Qt}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,s=e+1,o=i[r],a=i[s];if(void 0===o)switch(this.getSettings_().endingStart){case Gt:r=e,o=2*t-n;break;case zt:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(void 0===a)switch(this.getSettings_().endingEnd){case Gt:s=e,a=2*n-t;break;case zt:s=1,a=n+i[1]-i[0];break;default:s=e-1,a=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(a-n),this._offsetPrev=r*c,this._offsetNext=s*c}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,l=a-o,c=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,u=this._weightNext,p=(n-t)/(i-t),A=p*p,f=A*p,m=-d*f+2*d*A-d*p,g=(1+d)*f+(-1.5-2*d)*A+(-.5+d)*p+1,v=(-1-u)*f+(1.5+u)*A+.5*p,y=u*f-u*A;for(let e=0;e!==o;++e)r[e]=m*s[c+e]+g*s[l+e]+v*s[a+e]+y*s[h+e];return r}}class Hc extends Gc{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,l=a-o,c=(n-t)/(i-t),h=1-c;for(let e=0;e!==o;++e)r[e]=s[l+e]*h+s[a+e]*c;return r}}class Vc extends Gc{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class jc{constructor(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Uc(t,this.TimeBufferType),this.values=Uc(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Uc(e.times,Array),values:Uc(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Vc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Hc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new zc(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Ft:t=this.InterpolantFactoryMethodDiscrete;break;case kt:t=this.InterpolantFactoryMethodLinear;break;case Nt:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){const t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(t);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ft;case this.InterpolantFactoryMethodLinear:return kt;case this.InterpolantFactoryMethodSmooth:return Nt}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(1!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,s=i-1;for(;r!==i&&n[r]<e;)++r;for(;-1!==s&&n[s]>t;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const e=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(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&&Oc(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=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Nt,r=e.length-1;let s=1;for(let o=1;o<r;++o){let r=!1;const a=e[o];if(a!==e[o+1]&&(1!==o||a!==e[0]))if(i)r=!0;else{const e=o*n,i=e-n,s=e+n;for(let o=0;o!==n;++o){const n=t[e+o];if(n!==t[i+o]||n!==t[s+o]){r=!0;break}}}if(r){if(o!==s){e[s]=e[o];const i=o*n,r=s*n;for(let e=0;e!==n;++e)t[r+e]=t[i+e]}++s}}if(r>0){e[s]=e[r];for(let e=r*n,i=s*n,o=0;o!==n;++o)t[i+o]=t[e+o];++s}return s!==e.length?(this.times=e.slice(0,s),this.values=t.slice(0,s*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}jc.prototype.TimeBufferType=Float32Array,jc.prototype.ValueBufferType=Float32Array,jc.prototype.DefaultInterpolation=kt;class Wc extends jc{constructor(e,t,n){super(e,t,n)}}Wc.prototype.ValueTypeName="bool",Wc.prototype.ValueBufferType=Array,Wc.prototype.DefaultInterpolation=Ft,Wc.prototype.InterpolantFactoryMethodLinear=void 0,Wc.prototype.InterpolantFactoryMethodSmooth=void 0;class qc extends jc{}qc.prototype.ValueTypeName="color";class Xc extends jc{}Xc.prototype.ValueTypeName="number";class Yc extends Gc{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-t)/(i-t);let l=e*o;for(let e=l+o;l!==e;l+=4)Ri.slerpFlat(r,0,s,l-o,s,l,a);return r}}class Jc extends jc{InterpolantFactoryMethodLinear(e){return new Yc(this.times,this.values,this.getValueSize(),e)}}Jc.prototype.ValueTypeName="quaternion",Jc.prototype.InterpolantFactoryMethodSmooth=void 0;class Kc extends jc{constructor(e,t,n){super(e,t,n)}}Kc.prototype.ValueTypeName="string",Kc.prototype.ValueBufferType=Array,Kc.prototype.DefaultInterpolation=Ft,Kc.prototype.InterpolantFactoryMethodLinear=void 0,Kc.prototype.InterpolantFactoryMethodSmooth=void 0;class Zc extends jc{}Zc.prototype.ValueTypeName="vector";class $c{constructor(e="",t=-1,n=[],i=Ht){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Xn(),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(eh(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(jc.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,s=[];for(let e=0;e<r;e++){let o=[],a=[];o.push((e+r-1)%r,e,(e+1)%r),a.push(0,1,0);const l=Fc(o);o=kc(o,1,l),a=kc(a,1,l),i||0!==o[0]||(o.push(r),a.push(a[0])),s.push(new Xc(".morphTargetInfluences["+t[e].name+"]",o,a).scale(1/n))}return new this(e,-1,s)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){const n=e[t],s=n.name.match(r);if(s&&s.length>1){const e=s[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const s=[];for(const e in i)s.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const s=[],o=[];Nc(n,s,o,i),0!==s.length&&r.push(new e(t,s,o))}},i=[],r=e.name||"default",s=e.fps||30,o=e.blendMode;let a=e.length||-1;const l=e.hierarchy||[];for(let e=0;e<l.length;e++){const r=l[e].keys;if(r&&0!==r.length)if(r[0].morphTargets){const e={};let t;for(t=0;t<r.length;t++)if(r[t].morphTargets)for(let n=0;n<r[t].morphTargets.length;n++)e[r[t].morphTargets[n]]=-1;for(const n in e){const e=[],s=[];for(let i=0;i!==r[t].morphTargets.length;++i){const i=r[t];e.push(i.time),s.push(i.morphTarget===n?1:0)}i.push(new Xc(".morphTargetInfluence["+n+"]",e,s))}a=e.length*s}else{const s=".bones["+t[e].name+"]";n(Zc,s+".position",r,"pos",i),n(Jc,s+".quaternion",r,"rot",i),n(Zc,s+".scale",r,"scl",i)}}return 0===i.length?null:new this(r,a,i,o)}resetDuration(){let e=0;for(let t=0,n=this.tracks.length;t!==n;++t){const n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function eh(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Xc;case"vector":case"vector2":case"vector3":case"vector4":return Zc;case"color":return qc;case"quaternion":return Jc;case"bool":case"boolean":return Wc;case"string":return Kc}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],n=[];Nc(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}const th={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class nh{constructor(e,t,n){const i=this;let r,s=!1,o=0,a=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){a++,!1===s&&void 0!==i.onStart&&i.onStart(e,o,a),s=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,a),o===a&&(s=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return r?r(e):e},this.setURLModifier=function(e){return r=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){const n=l[t],i=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}}}const ih=new nh;class rh{constructor(e){this.manager=void 0!==e?e:ih,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise((function(i,r){n.load(e,i,t,r)}))}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}rh.DEFAULT_MATERIAL_NAME="__DEFAULT";const sh={};class oh extends Error{constructor(e,t){super(e),this.response=t}}class ah extends rh{constructor(e){super(e)}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=th.get(e);if(void 0!==r)return this.manager.itemStart(e),setTimeout((()=>{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==sh[e])return void sh[e].push({onLoad:t,onProgress:n,onError:i});sh[e]=[],sh[e].push({onLoad:t,onProgress:n,onError:i});const s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(s).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=sh[e],i=t.body.getReader(),r=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),s=r?parseInt(r):0,o=0!==s;let a=0;const l=new ReadableStream({start(e){!function t(){i.read().then((({done:i,value:r})=>{if(i)e.close();else{a+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:s});for(let e=0,t=n.length;e<t;e++){const t=n[e];t.onProgress&&t.onProgress(i)}e.enqueue(r),t()}}),(t=>{e.error(t)}))}()}});return new Response(l)}throw new oh(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)})).then((e=>{switch(a){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,o)));case"json":return e.json();default:if(void 0===o)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((e=>i.decode(e)))}}})).then((t=>{th.add(e,t);const n=sh[e];delete sh[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onLoad&&i.onLoad(t)}})).catch((t=>{const n=sh[e];if(void 0===n)throw this.manager.itemError(e),t;delete sh[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onError&&i.onError(t)}this.manager.itemError(e)})).finally((()=>{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class lh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new ah(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=$c.parse(e[n]);t.push(i)}return t}}class ch extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=[],o=new Ya,a=new ah(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(r.withCredentials);let l=0;function c(c){a.load(e[c],(function(e){const n=r.parse(e,!0);s[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(o.minFilter=Me),o.image=s,o.format=n.format,o.needsUpdate=!0,t&&t(o))}),n,i)}if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)c(t);else a.load(e,(function(e){const n=r.parse(e,!0);if(n.isCubemap){const e=n.mipmaps.length/n.mipmapCount;for(let t=0;t<e;t++){s[t]={mipmaps:[]};for(let e=0;e<n.mipmapCount;e++)s[t].mipmaps.push(n.mipmaps[t*n.mipmapCount+e]),s[t].format=n.format,s[t].width=n.width,s[t].height=n.height}o.image=s}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=Me),o.format=n.format,o.needsUpdate=!0,t&&t(o)}),n,i);return o}}class hh extends rh{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=th.get(e);if(void 0!==s)return r.manager.itemStart(e),setTimeout((function(){t&&t(s),r.manager.itemEnd(e)}),0),s;const o=ai("img");function a(){c(),th.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){c(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function c(){o.removeEventListener("load",a,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",a,!1),o.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}}class dh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=new no;r.colorSpace=tn;const s=new hh(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let o=0;function a(n){s.load(e[n],(function(e){r.images[n]=e,o++,6===o&&(r.needsUpdate=!0,t&&t(r))}),void 0,i)}for(let t=0;t<e.length;++t)a(t);return r}}class uh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new Go,o=new ah(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(e,(function(e){let n;try{n=r.parse(e)}catch(e){if(void 0===i)return void console.error(e);i(e)}void 0!==n.image?s.image=n.image:void 0!==n.data&&(s.image.width=n.width,s.image.height=n.height,s.image.data=n.data),s.wrapS=void 0!==n.wrapS?n.wrapS:ye,s.wrapT=void 0!==n.wrapT?n.wrapT:ye,s.magFilter=void 0!==n.magFilter?n.magFilter:Me,s.minFilter=void 0!==n.minFilter?n.minFilter:Me,s.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(s.colorSpace=n.colorSpace),void 0!==n.flipY&&(s.flipY=n.flipY),void 0!==n.format&&(s.format=n.format),void 0!==n.type&&(s.type=n.type),void 0!==n.mipmaps&&(s.mipmaps=n.mipmaps,s.minFilter=Be),1===n.mipmapCount&&(s.minFilter=Me),void 0!==n.generateMipmaps&&(s.generateMipmaps=n.generateMipmaps),s.needsUpdate=!0,t&&t(s,n)}),n,i),s}}class ph extends rh{constructor(e){super(e)}load(e,t,n,i){const r=new Ci,s=new hh(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,(function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r}}class Ah extends Ur{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new es(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(t.object.target=this.target.uuid),t}}class fh extends Ah{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Ur.DEFAULT_UP),this.updateMatrix(),this.groundColor=new es(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const mh=new lr,gh=new Li,vh=new Li;class yh{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ti(512,512),this.map=null,this.mapPass=null,this.matrix=new lr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new oa,this._frameExtents=new ti(1,1),this._viewportCount=1,this._viewports=[new wi(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;gh.setFromMatrixPosition(e.matrixWorld),t.position.copy(gh),vh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(vh),t.updateMatrixWorld(),mh.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(mh),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(mh)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Eh extends yh{constructor(){super(new $s(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=2*qn*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class xh extends Ah{constructor(e,t,n=0,i=Math.PI/3,r=0,s=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ur.DEFAULT_UP),this.updateMatrix(),this.target=new Ur,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new Eh}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const bh=new lr,Ch=new Li,wh=new Li;class _h extends yh{constructor(){super(new $s(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new ti(4,2),this._viewportCount=6,this._viewports=[new wi(2,1,1,1),new wi(0,1,1,1),new wi(3,1,1,1),new wi(1,1,1,1),new wi(3,0,1,1),new wi(1,0,1,1)],this._cubeDirections=[new Li(1,0,0),new Li(-1,0,0),new Li(0,0,1),new Li(0,0,-1),new Li(0,1,0),new Li(0,-1,0)],this._cubeUps=[new Li(0,1,0),new Li(0,1,0),new Li(0,1,0),new Li(0,1,0),new Li(0,0,1),new Li(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Ch.setFromMatrixPosition(e.matrixWorld),n.position.copy(Ch),wh.copy(n.position),wh.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(wh),n.updateMatrixWorld(),i.makeTranslation(-Ch.x,-Ch.y,-Ch.z),bh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(bh)}}class Mh extends Ah{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new _h}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Sh extends Ys{constructor(e=-1,t=1,n=1,i=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,s=n+e,o=i+t,a=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,s=r+e*this.view.width,o-=t*this.view.offsetY,a=o-t*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}class Ih extends yh{constructor(){super(new Sh(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Bh extends Ah{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ur.DEFAULT_UP),this.updateMatrix(),this.target=new Ur,this.shadow=new Ih}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Th extends Ah{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Rh extends Ah{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Lh{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new Li)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,r=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.282095),t.addScaledVector(s[1],.488603*i),t.addScaledVector(s[2],.488603*r),t.addScaledVector(s[3],.488603*n),t.addScaledVector(s[4],n*i*1.092548),t.addScaledVector(s[5],i*r*1.092548),t.addScaledVector(s[6],.315392*(3*r*r-1)),t.addScaledVector(s[7],n*r*1.092548),t.addScaledVector(s[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.886227),t.addScaledVector(s[1],1.023328*i),t.addScaledVector(s[2],1.023328*r),t.addScaledVector(s[3],1.023328*n),t.addScaledVector(s[4],.858086*n*i),t.addScaledVector(s[5],.858086*i*r),t.addScaledVector(s[6],.743125*r*r-.247708),t.addScaledVector(s[7],.858086*n*r),t.addScaledVector(s[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+3*i);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+3*i);return e}static getBasisAt(e,t){const n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}class Dh extends Ah{constructor(e=new Lh,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Ph extends rh{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,s=new ah(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}const i=this.createMaterialFromType(e.type);if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=e.sheen),void 0!==e.sheenColor&&(i.sheenColor=(new es).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(i.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.specular&&i.specular.setHex(e.specular),void 0!==e.specularIntensity&&(i.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(i.dispersion=e.dispersion),void 0!==e.iridescence&&(i.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(i.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(i.transmission=e.transmission),void 0!==e.thickness&&(i.thickness=e.thickness),void 0!==e.attenuationDistance&&(i.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(i.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(i.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.shadowSide&&(i.shadowSide=e.shadowSide),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(i.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(i.depthFunc=e.depthFunc),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(i.blendSrc=e.blendSrc),void 0!==e.blendDst&&(i.blendDst=e.blendDst),void 0!==e.blendEquation&&(i.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(i.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&(i.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(i.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==i.blendColor&&i.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(i.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),void 0!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(i.forceSinglePass=e.forceSinglePass),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=e.vertexColors>0: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 es).setHex(r.value);break;case"v2":i.uniforms[t].value=(new ti).fromArray(r.value);break;case"v3":i.uniforms[t].value=(new Li).fromArray(r.value);break;case"v4":i.uniforms[t].value=(new wi).fromArray(r.value);break;case"m3":i.uniforms[t].value=(new ni).fromArray(r.value);break;case"m4":i.uniforms[t].value=(new lr).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.glslVersion&&(i.glslVersion=e.glslVersion),void 0!==e.extensions)for(const t in e.extensions)i.extensions[t]=e.extensions[t];if(void 0!==e.lights&&(i.lights=e.lights),void 0!==e.clipping&&(i.clipping=e.clipping),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 ti).fromArray(t)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapRotation&&i.envMapRotation.fromArray(e.envMapRotation),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 ti).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(i.iridescenceMap=n(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=n(e.thicknessMap)),void 0!==e.anisotropyMap&&(i.anisotropyMap=n(e.anisotropyMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Ph.createMaterialFromType(e)}static createMaterialFromType(e){return new{ShadowMaterial:Cc,SpriteMaterial:ho,RawShaderMaterial:wc,ShaderMaterial:Xs,PointsMaterial:Na,MeshPhysicalMaterial:Mc,MeshStandardMaterial:_c,MeshPhongMaterial:Sc,MeshToonMaterial:Ic,MeshNormalMaterial:Bc,MeshLambertMaterial:Tc,MeshDepthMaterial:Rc,MeshDistanceMaterial:Lc,MeshBasicMaterial:rs,MeshMatcapMaterial:Dc,LineDashedMaterial:Pc,LineBasicMaterial:_a,Material:is}[e]}}class Uh{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Oh extends Bs{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Fh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new ah(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t={},n={};function i(e,i){if(void 0!==t[i])return t[i];const r=e.interleavedBuffers[i],s=function(e,t){if(void 0!==n[t])return n[t];const i=e.arrayBuffers[t],r=new Uint32Array(i).buffer;return n[t]=r,r}(e,r.buffer),o=oi(r.type,s),a=new ao(o,r.stride);return a.uuid=r.uuid,t[i]=a,a}const r=e.isInstancedBufferGeometry?new Oh:new Bs,s=e.data.index;if(void 0!==s){const e=oi(s.type,s.array);r.setIndex(new us(e,1))}const o=e.data.attributes;for(const t in o){const n=o[t];let s;if(n.isInterleavedBufferAttribute){const t=i(e.data,n.data);s=new co(t,n.itemSize,n.offset,n.normalized)}else{const e=oi(n.type,n.array);s=new(n.isInstancedBufferAttribute?jo:us)(e,n.itemSize,n.normalized)}void 0!==n.name&&(s.name=n.name),void 0!==n.usage&&s.setUsage(n.usage),r.setAttribute(t,s)}const a=e.data.morphAttributes;if(a)for(const t in a){const n=a[t],s=[];for(let t=0,r=n.length;t<r;t++){const r=n[t];let o;if(r.isInterleavedBufferAttribute){const t=i(e.data,r.data);o=new co(t,r.itemSize,r.offset,r.normalized)}else{const e=oi(r.type,r.array);o=new us(e,r.itemSize,r.normalized)}void 0!==r.name&&(o.name=r.name),s.push(o)}r.morphAttributes[t]=s}e.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);const l=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==l)for(let e=0,t=l.length;e!==t;++e){const t=l[e];r.addGroup(t.start,t.count,t.materialIndex)}const c=e.data.boundingSphere;if(void 0!==c){const e=new Li;void 0!==c.center&&e.fromArray(c.center),r.boundingSphere=new $i(e,c.radius)}return e.name&&(r.name=e.name),e.userData&&(r.userData=e.userData),r}}class kh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=""===this.path?Uh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||s;const o=new ah(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){let s=null;try{s=JSON.parse(n)}catch(t){return void 0!==i&&i(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}const o=s.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())return void 0!==i&&i(new Error("THREE.ObjectLoader: Can't load "+e)),void console.error("THREE.ObjectLoader: Can't load "+e);r.parse(s,t)}),n,i)}async loadAsync(e,t){const n=""===this.path?Uh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||n;const i=new ah(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);const r=await i.loadAsync(e,t),s=JSON.parse(r),o=s.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+e);return await this.parseAsync(s)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=this.parseImages(e.images,(function(){void 0!==t&&t(l)})),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,r,a,o,n),c=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,c),this.bindLightTargets(l),void 0!==t){let e=!1;for(const t in s)if(s[t].data instanceof HTMLImageElement){e=!0;break}!1===e&&t(l)}return l}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),r=await this.parseImagesAsync(e.images),s=this.parseTextures(e.textures,r),o=this.parseMaterials(e.materials,s),a=this.parseObject(e.object,i,o,s,t),l=this.parseSkeletons(e.skeletons,a);return this.bindSkeletons(a,l),this.bindLightTargets(a),a}parseShapes(e){const t={};if(void 0!==e)for(let n=0,i=e.length;n<i;n++){const i=(new Pl).fromJSON(e[n]);t[i.uuid]=i}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse((function(e){e.isBone&&(i[e.uuid]=e)})),void 0!==e)for(let t=0,r=e.length;t<r;t++){const r=(new Vo).fromJSON(e[t],i);n[r.uuid]=r}return n}parseGeometries(e,t){const n={};if(void 0!==e){const i=new Fh;for(let r=0,s=e.length;r<s;r++){let s;const o=e[r];switch(o.type){case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(o);break;case"Geometry":"THREE"in window&&"LegacyJSONLoader"in THREE?s=(new THREE.LegacyJSONLoader).parse(o,this.resourcePath).geometry:console.error('THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".');break;default:o.type in bc?s=bc[o.type].fromJSON(o,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${o.type}"`)}s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.userData&&(s.userData=o.userData),n[o.uuid]=s}}return n}parseMaterials(e,t){const n={},i={};if(void 0!==e){const r=new Ph;r.setTextures(t);for(let t=0,s=e.length;t<s;t++){const s=e[t];void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i}parseAnimations(e){const t={};if(void 0!==e)for(let n=0;n<e.length;n++){const i=e[n],r=$c.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function s(e){if("string"==typeof e){const t=e;return function(e){return n.manager.itemStart(e),r.load(e,(function(){n.manager.itemEnd(e)}),void 0,(function(){n.manager.itemError(e),n.manager.itemEnd(e)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:n.resourcePath+t)}return e.data?{data:oi(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){const n=new nh(t);r=new hh(n),r.setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t<n;t++){const n=e[t],r=n.url;if(Array.isArray(r)){const e=[];for(let t=0,n=r.length;t<n;t++){const n=s(r[t]);null!==n&&(n instanceof HTMLImageElement?e.push(n):e.push(new Go(n.data,n.width,n.height)))}i[n.uuid]=new Ei(e)}else{const e=s(n.url);i[n.uuid]=new Ei(e)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function r(e){if("string"==typeof e){const n=e,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:t.resourcePath+n;return await i.loadAsync(r)}return e.data?{data:oi(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){i=new hh(this.manager),i.setCrossOrigin(this.crossOrigin);for(let t=0,i=e.length;t<i;t++){const i=e[t],s=i.url;if(Array.isArray(s)){const e=[];for(let t=0,n=s.length;t<n;t++){const n=s[t],i=await r(n);null!==i&&(i instanceof HTMLImageElement?e.push(i):e.push(new Go(i.data,i.width,i.height)))}n[i.uuid]=new Ei(e)}else{const e=await r(i.url);n[i.uuid]=new Ei(e)}}}return n}parseTextures(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}const i={};if(void 0!==e)for(let r=0,s=e.length;r<s;r++){const s=e[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);const o=t[s.image],a=o.data;let l;Array.isArray(a)?(l=new no,6===a.length&&(l.needsUpdate=!0)):(l=a&&a.data?new Go:new Ci,a&&(l.needsUpdate=!0)),l.source=o,l.uuid=s.uuid,void 0!==s.name&&(l.name=s.name),void 0!==s.mapping&&(l.mapping=n(s.mapping,Nh)),void 0!==s.channel&&(l.channel=s.channel),void 0!==s.offset&&l.offset.fromArray(s.offset),void 0!==s.repeat&&l.repeat.fromArray(s.repeat),void 0!==s.center&&l.center.fromArray(s.center),void 0!==s.rotation&&(l.rotation=s.rotation),void 0!==s.wrap&&(l.wrapS=n(s.wrap[0],Qh),l.wrapT=n(s.wrap[1],Qh)),void 0!==s.format&&(l.format=s.format),void 0!==s.internalFormat&&(l.internalFormat=s.internalFormat),void 0!==s.type&&(l.type=s.type),void 0!==s.colorSpace&&(l.colorSpace=s.colorSpace),void 0!==s.minFilter&&(l.minFilter=n(s.minFilter,Gh)),void 0!==s.magFilter&&(l.magFilter=n(s.magFilter,Gh)),void 0!==s.anisotropy&&(l.anisotropy=s.anisotropy),void 0!==s.flipY&&(l.flipY=s.flipY),void 0!==s.generateMipmaps&&(l.generateMipmaps=s.generateMipmaps),void 0!==s.premultiplyAlpha&&(l.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(l.unpackAlignment=s.unpackAlignment),void 0!==s.compareFunction&&(l.compareFunction=s.compareFunction),void 0!==s.userData&&(l.userData=s.userData),i[s.uuid]=l}return i}parseObject(e,t,n,i,r){let s,o,a;function l(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function c(e){if(void 0!==e){if(Array.isArray(e)){const t=[];for(let i=0,r=e.length;i<r;i++){const r=e[i];void 0===n[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),t.push(n[r])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}function h(e){return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined texture",e),i[e]}switch(e.type){case"Scene":s=new oo,void 0!==e.background&&(Number.isInteger(e.background)?s.background=new es(e.background):s.background=h(e.background)),void 0!==e.environment&&(s.environment=h(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?s.fog=new so(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(s.fog=new ro(e.fog.color,e.fog.density)),""!==e.fog.name&&(s.fog.name=e.fog.name)),void 0!==e.backgroundBlurriness&&(s.backgroundBlurriness=e.backgroundBlurriness),void 0!==e.backgroundIntensity&&(s.backgroundIntensity=e.backgroundIntensity),void 0!==e.backgroundRotation&&s.backgroundRotation.fromArray(e.backgroundRotation),void 0!==e.environmentIntensity&&(s.environmentIntensity=e.environmentIntensity),void 0!==e.environmentRotation&&s.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":s=new $s(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(s.focus=e.focus),void 0!==e.zoom&&(s.zoom=e.zoom),void 0!==e.filmGauge&&(s.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(s.filmOffset=e.filmOffset),void 0!==e.view&&(s.view=Object.assign({},e.view));break;case"OrthographicCamera":s=new Sh(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(s.zoom=e.zoom),void 0!==e.view&&(s.view=Object.assign({},e.view));break;case"AmbientLight":s=new Th(e.color,e.intensity);break;case"DirectionalLight":s=new Bh(e.color,e.intensity),s.target=e.target||"";break;case"PointLight":s=new Mh(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":s=new Rh(e.color,e.intensity,e.width,e.height);break;case"SpotLight":s=new xh(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),s.target=e.target||"";break;case"HemisphereLight":s=new fh(e.color,e.groundColor,e.intensity);break;case"LightProbe":s=(new Dh).fromJSON(e);break;case"SkinnedMesh":o=l(e.geometry),a=c(e.material),s=new No(o,a),void 0!==e.bindMode&&(s.bindMode=e.bindMode),void 0!==e.bindMatrix&&s.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(s.skeleton=e.skeleton);break;case"Mesh":o=l(e.geometry),a=c(e.material),s=new Gs(o,a);break;case"InstancedMesh":o=l(e.geometry),a=c(e.material);const t=e.count,n=e.instanceMatrix,i=e.instanceColor;s=new $o(o,a,t),s.instanceMatrix=new jo(new Float32Array(n.array),16),void 0!==i&&(s.instanceColor=new jo(new Float32Array(i.array),i.itemSize));break;case"BatchedMesh":o=l(e.geometry),a=c(e.material),s=new wa(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,a),s.geometry=o,s.perObjectFrustumCulled=e.perObjectFrustumCulled,s.sortObjects=e.sortObjects,s._drawRanges=e.drawRanges,s._reservedRanges=e.reservedRanges,s._visibility=e.visibility,s._active=e.active,s._bounds=e.bounds.map((e=>{const t=new Ui;t.min.fromArray(e.boxMin),t.max.fromArray(e.boxMax);const n=new $i;return n.radius=e.sphereRadius,n.center.fromArray(e.sphereCenter),{boxInitialized:e.boxInitialized,box:t,sphereInitialized:e.sphereInitialized,sphere:n}})),s._maxInstanceCount=e.maxInstanceCount,s._maxVertexCount=e.maxVertexCount,s._maxIndexCount=e.maxIndexCount,s._geometryInitialized=e.geometryInitialized,s._geometryCount=e.geometryCount,s._matricesTexture=h(e.matricesTexture.uuid),void 0!==e.colorsTexture&&(s._colorsTexture=h(e.colorsTexture.uuid));break;case"LOD":s=new Bo;break;case"Line":s=new Da(l(e.geometry),c(e.material));break;case"LineLoop":s=new ka(l(e.geometry),c(e.material));break;case"LineSegments":s=new Fa(l(e.geometry),c(e.material));break;case"PointCloud":case"Points":s=new Va(l(e.geometry),c(e.material));break;case"Sprite":s=new _o(c(e.material));break;case"Group":s=new Wa;break;case"Bone":s=new Qo;break;default:s=new Ur}if(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.up&&s.up.fromArray(e.up),void 0!==e.castShadow&&(s.castShadow=e.castShadow),void 0!==e.receiveShadow&&(s.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.intensity&&(s.shadow.intensity=e.shadow.intensity),void 0!==e.shadow.bias&&(s.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(s.shadow.normalBias=e.shadow.normalBias),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.userData&&(s.userData=e.userData),void 0!==e.layers&&(s.layers.mask=e.layers),void 0!==e.children){const o=e.children;for(let e=0;e<o.length;e++)s.add(this.parseObject(o[e],t,n,i,r))}if(void 0!==e.animations){const t=e.animations;for(let e=0;e<t.length;e++){const n=t[e];s.animations.push(r[n])}}if("LOD"===e.type){void 0!==e.autoUpdate&&(s.autoUpdate=e.autoUpdate);const t=e.levels;for(let e=0;e<t.length;e++){const n=t[e],i=s.getObjectByProperty("uuid",n.object);void 0!==i&&s.addLevel(i,n.distance,n.hysteresis)}}return s}bindSkeletons(e,t){0!==Object.keys(t).length&&e.traverse((function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){const n=t[e.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(n,e.bindMatrix)}}))}bindLightTargets(e){e.traverse((function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);t.target=void 0!==i?i:new Ur}}))}}const Nh={UVMapping:ue,CubeReflectionMapping:pe,CubeRefractionMapping:Ae,EquirectangularReflectionMapping:fe,EquirectangularRefractionMapping:me,CubeUVReflectionMapping:ge},Qh={RepeatWrapping:ve,ClampToEdgeWrapping:ye,MirroredRepeatWrapping:Ee},Gh={NearestFilter:xe,NearestMipmapNearestFilter:be,NearestMipmapLinearFilter:we,LinearFilter:Me,LinearMipmapNearestFilter:Se,LinearMipmapLinearFilter:Be};class zh extends rh{constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=th.get(e);if(void 0!==s)return r.manager.itemStart(e),s.then?void s.then((n=>{t&&t(n),r.manager.itemEnd(e)})).catch((e=>{i&&i(e)})):(setTimeout((function(){t&&t(s),r.manager.itemEnd(e)}),0),s);const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader;const a=fetch(e,o).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){return th.add(e,n),t&&t(n),r.manager.itemEnd(e),n})).catch((function(t){i&&i(t),th.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)}));th.add(e,a),r.manager.itemStart(e)}}let Hh;class Vh{static getContext(){return void 0===Hh&&(Hh=new(window.AudioContext||window.webkitAudioContext)),Hh}static setContext(e){Hh=e}}class jh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new ah(this.manager);function o(t){i?i(t):console.error(t),r.manager.itemError(e)}s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(e){try{const n=e.slice(0);Vh.getContext().decodeAudioData(n,(function(e){t(e)})).catch(o)}catch(e){o(e)}}),n,i)}}const Wh=new lr,qh=new lr,Xh=new lr;class Yh{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new $s,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new $s,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Xh.copy(e.projectionMatrix);const n=t.eyeSep/2,i=n*t.near/t.focus,r=t.near*Math.tan(Wn*t.fov*.5)/t.zoom;let s,o;qh.elements[12]=-n,Wh.elements[12]=n,s=-r*t.aspect+i,o=r*t.aspect+i,Xh.elements[0]=2*t.near/(o-s),Xh.elements[8]=(o+s)/(o-s),this.cameraL.projectionMatrix.copy(Xh),s=-r*t.aspect-i,o=r*t.aspect-i,Xh.elements[0]=2*t.near/(o-s),Xh.elements[8]=(o+s)/(o-s),this.cameraR.projectionMatrix.copy(Xh)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(qh),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Wh)}}class Jh extends $s{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Kh{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Zh(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Zh();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Zh(){return performance.now()}const $h=new Li,ed=new Ri,td=new Li,nd=new Li;class id extends Ur{constructor(){super(),this.type="AudioListener",this.context=Vh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Kh}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose($h,ed,td),nd.set(0,0,-1).applyQuaternion(ed),t.positionX){const e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime($h.x,e),t.positionY.linearRampToValueAtTime($h.y,e),t.positionZ.linearRampToValueAtTime($h.z,e),t.forwardX.linearRampToValueAtTime(nd.x,e),t.forwardY.linearRampToValueAtTime(nd.y,e),t.forwardZ.linearRampToValueAtTime(nd.z,e),t.upX.linearRampToValueAtTime(n.x,e),t.upY.linearRampToValueAtTime(n.y,e),t.upZ.linearRampToValueAtTime(n.z,e)}else t.setPosition($h.x,$h.y,$h.z),t.setOrientation(nd.x,nd.y,nd.z,n.x,n.y,n.z)}}class rd extends Ur{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(e=0){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),"buffer"!==e.sourceType?(console.warn("THREE.Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const sd=new Li,od=new Ri,ad=new Li,ld=new Li;class cd extends rd{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(sd,od,ad),ld.set(0,0,1).applyQuaternion(od);const t=this.panner;if(t.positionX){const e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(sd.x,e),t.positionY.linearRampToValueAtTime(sd.y,e),t.positionZ.linearRampToValueAtTime(sd.z,e),t.orientationX.linearRampToValueAtTime(ld.x,e),t.orientationY.linearRampToValueAtTime(ld.y,e),t.orientationZ.linearRampToValueAtTime(ld.z,e)}else t.setPosition(sd.x,sd.y,sd.z),t.setOrientation(ld.x,ld.y,ld.z)}}class hd{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class dd{constructor(e,t,n){let i,r,s;switch(this.binding=e,this.valueSize=n,t){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,r=e*i+i;let s=this.cumulativeWeight;if(0===s){for(let e=0;e!==i;++e)n[r+e]=n[e];s=t}else{s+=t;const e=t/s;this._mixBufferRegion(n,r,0,e,i)}this.cumulativeWeight=s}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const e=t*this._origIndex;this._mixBufferRegion(n,i,e,1-r,t)}s>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let e=t,r=t+t;e!==r;++e)if(n[e]!==n[e+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let e=n,r=i;e!==r;++e)t[e]=t[i+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)e[t+i]=e[n+i]}_slerp(e,t,n,i){Ri.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const s=this._workIndex*r;Ri.multiplyQuaternionsFlat(e,s,e,t,e,n),Ri.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){const s=1-i;for(let o=0;o!==r;++o){const r=t+o;e[r]=e[r]*s+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){const r=t+s;e[r]=e[r]+e[n+s]*i}}}const ud="\\[\\]\\.:\\/",pd=new RegExp("["+ud+"]","g"),Ad="[^"+ud+"]",fd="[^"+ud.replace("\\.","")+"]",md=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Ad)+/(WCOD+)?/.source.replace("WCOD",fd)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ad)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ad)+"$"),gd=["material","materials","bones","map"];class vd{constructor(e,t,n){this.path=t,this.parsedPath=n||vd.parseTrackName(t),this.node=vd.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new vd.Composite(e,t,n):new vd(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(pd,"")}static parseTrackName(e){const t=md.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==gd.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i<e.length;i++){const r=e[i];if(r.name===t||r.uuid===t)return r;const s=n(r.children);if(s)return s}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=vd.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(n){let i=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===i){i=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==i){if(void 0===e[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[i]}}const s=e[i];if(void 0===s){const n=t.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",e)}let o=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(a=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}vd.Composite=class{constructor(e,t,n){const i=n||vd.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},vd.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},vd.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},vd.prototype.GetterByBindingType=[vd.prototype._getValue_direct,vd.prototype._getValue_array,vd.prototype._getValue_arrayElement,vd.prototype._getValue_toArray],vd.prototype.SetterByBindingTypeAndVersioning=[[vd.prototype._setValue_direct,vd.prototype._setValue_direct_setNeedsUpdate,vd.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[vd.prototype._setValue_array,vd.prototype._setValue_array_setNeedsUpdate,vd.prototype._setValue_array_setMatrixWorldNeedsUpdate],[vd.prototype._setValue_arrayElement,vd.prototype._setValue_arrayElement_setNeedsUpdate,vd.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[vd.prototype._setValue_fromArray,vd.prototype._setValue_fromArray_setNeedsUpdate,vd.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class yd{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Xn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,s=r.length;let o,a=e.length,l=this.nCachedObjects_;for(let c=0,h=arguments.length;c!==h;++c){const h=arguments[c],d=h.uuid;let u=t[d];if(void 0===u){u=a++,t[d]=u,e.push(h);for(let e=0,t=s;e!==t;++e)r[e].push(new vd(h,n[e],i[e]))}else if(u<l){o=e[u];const a=--l,c=e[a];t[c.uuid]=u,e[u]=c,t[d]=a,e[a]=h;for(let e=0,t=s;e!==t;++e){const t=r[e],s=t[a];let o=t[u];t[u]=s,void 0===o&&(o=new vd(h,n[e],i[e])),t[a]=o}}else e[u]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let s=0,o=arguments.length;s!==o;++s){const o=arguments[s],a=o.uuid,l=t[a];if(void 0!==l&&l>=r){const s=r++,c=e[s];t[c.uuid]=l,e[l]=c,t[a]=s,e[s]=o;for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[s],r=t[l];t[l]=i,t[s]=r}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=e.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=t[a];if(void 0!==l)if(delete t[a],l<r){const o=--r,a=e[o],c=--s,h=e[c];t[a.uuid]=l,e[l]=a,t[h.uuid]=o,e[o]=h,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[o],r=t[c];t[l]=i,t[o]=r,t.pop()}}else{const r=--s,o=e[r];r>0&&(t[o.uuid]=l),e[l]=o,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e];t[l]=t[r],t.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[e]=i,s.push(e),o.push(t),r.push(h);for(let n=c,i=a.length;n!==i;++n){const i=a[n];h[n]=new vd(i,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];t[e[o]]=n,s[n]=a,s.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}class Ed{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,s=r.length,o=new Array(s),a={endingStart:Qt,endingEnd:Qt};for(let e=0;e!==s;++e){const t=r[e].createInterpolant(null);o[e]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ut,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const n=this._clip.duration,i=e._clip.duration,r=i/n,s=n/i;e.warp(1,r,t),this.warp(s,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,a[1]=r+n,l[0]=e/s,l[1]=t/s,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled)return void this._updateWeight(e);const r=this._startTime;if(null!==r){const i=(e-r)*n;i<0||0===n?t=0:(this._startTime=null,t=n*i)}t*=this._updateTimeScale(e);const s=this._updateTime(t),o=this._updateWeight(e);if(o>0){const e=this._interpolants,t=this._propertyBindings;if(this.blendMode===Vt)for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(s),t[n].accumulateAdditive(o);else for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(s),t[n].accumulate(i,o)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const s=n===Ot;if(0===e)return-1===r||!s||1&~r?i:t-i;if(n===Pt){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=t||i<0){const n=Math.floor(i/t);i-=t*n,r+=Math.abs(n);const o=this.repetitions-r;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===o){const t=e<0;this._setEndings(t,!t,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&!(1&~r))return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Gt,i.endingEnd=Gt):(i.endingStart=e?this.zeroSlopeAtStart?Gt:Qt:zt,i.endingEnd=t?this.zeroSlopeAtEnd?Gt:Qt:zt)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=t,o[1]=r+e,a[1]=n,this}}const xd=new Float32Array(1);class bd extends Hn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,s=e._propertyBindings,o=e._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let e=0;e!==r;++e){const r=i[e],l=r.name;let h=c[l];if(void 0!==h)++h.referenceCount,s[e]=h;else{if(h=s[e],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,a,l));continue}const i=t&&t._propertyBindings[e].binding.parsedPath;h=new dd(vd.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),s[e]=h}o[e].resultBuffer=h.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,r=this._actionsByClip;let s=r[t];if(void 0===s)s={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=s;else{const t=s.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=i.length,i.push(e),s.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,s=this._actionsByClip,o=s[r],a=o.knownActions,l=a[a.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,a[c]=l,a.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===a.length&&delete s[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let s=i[t];void 0===s&&(s={},i[t]=s),s[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,o=s[i],a=t[t.length-1],l=e._cacheIndex;a._cacheIndex=l,t[l]=a,t.pop(),delete o[r],0===Object.keys(o).length&&delete s[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return void 0===n&&(n=new Hc(new Float32Array(2),new Float32Array(2),1,xd),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let s="string"==typeof e?$c.findByName(i,e):e;const o=null!==s?s.uuid:e,a=this._actionsByClip[o];let l=null;if(void 0===n&&(n=null!==s?s.blendMode:Ht),void 0!==a){const e=a.actionByRoot[r];if(void 0!==e&&e.blendMode===n)return e;l=a.knownActions[0],null===s&&(s=l._clip)}if(null===s)return null;const c=new Ed(this,s,t,n);return this._bindAction(c,l),this._addInactiveAction(c,o,r),c}existingAction(e,t){const n=t||this._root,i=n.uuid,r="string"==typeof e?$c.findByName(n,e):e,s=r?r.uuid:e,o=this._actionsByClip[s];return void 0!==o&&o.actionByRoot[i]||null}stopAllAction(){const e=this._actions;for(let t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let o=0;o!==n;++o)t[o]._update(i,e,r,s);const o=this._bindings,a=this._nActiveBindings;for(let e=0;e!==a;++e)o[e].apply(s);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const e=r.knownActions;for(let n=0,i=e.length;n!==i;++n){const i=e[n];this._deactivateAction(i);const r=i._cacheIndex,s=t[t.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,s._cacheIndex=r,t[r]=s,t.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const e in n){const i=n[e].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}const i=this._bindingsByRootAndName[t];if(void 0!==i)for(const e in i){const t=i[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){const n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class Cd{constructor(e){this.value=e}clone(){return new Cd(void 0===this.value.clone?this.value:this.value.clone())}}let wd=0;class _d extends Hn{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:wd++}),this.name="",this.usage=Tn,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let e=0,n=t.length;e<n;e++){const n=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0;e<n.length;e++)this.uniforms.push(n[e].clone())}return this}clone(){return(new this.constructor).copy(this)}}class Md extends ao{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class Sd{constructor(e,t,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(e){!0===e&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Id=new lr;class Bd{constructor(e,t,n=0,i=1/0){this.ray=new ar(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new yr,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Id.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Id),this}intersectObject(e,t=!0,n=[]){return Rd(e,this,n,t),n.sort(Td),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)Rd(e[i],this,n,t);return n.sort(Td),n}}function Td(e,t){return e.distance-t.distance}function Rd(e,t,n,i){let r=!0;if(e.layers.test(t.layers)&&!1===e.raycast(t,n)&&(r=!1),!0===r&&!0===i){const i=e.children;for(let e=0,r=i.length;e<r;e++)Rd(i[e],t,n,!0)}}class Ld{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){const e=1e-6;return this.phi=Yn(this.phi,e,Math.PI-e),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Yn(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class Dd{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return(new this.constructor).copy(this)}}class Pd{constructor(e,t,n,i){Pd.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==e&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}const Ud=new ti;class Od{constructor(e=new ti(1/0,1/0),t=new ti(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Ud.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.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.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ud).distanceTo(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}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Fd=new Li,kd=new Li;class Nd{constructor(e=new Li,t=new Li){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){Fd.subVectors(e,this.start),kd.subVectors(this.end,this.start);const n=kd.dot(kd);let i=kd.dot(Fd)/n;return t&&(i=Yn(i,0,1)),i}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const Qd=new Li;class Gd extends Ur{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new Bs,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<n;e++,t++){const r=e/n*Math.PI*2,s=t/n*Math.PI*2;i.push(Math.cos(r),Math.sin(r),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new xs(i,3));const r=new _a({fog:!1,toneMapped:!1});this.cone=new Fa(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Qd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Qd),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const zd=new Li,Hd=new lr,Vd=new lr;class jd extends Fa{constructor(e){const t=Wd(e),n=new Bs,i=[],r=[],s=new es(0,0,1),o=new es(0,1,0);for(let e=0;e<t.length;e++){const n=t[e];n.parent&&n.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(s.r,s.g,s.b),r.push(o.r,o.g,o.b))}n.setAttribute("position",new xs(i,3)),n.setAttribute("color",new xs(r,3)),super(n,new _a({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Vd.copy(this.root.matrixWorld).invert();for(let e=0,n=0;e<t.length;e++){const r=t[e];r.parent&&r.parent.isBone&&(Hd.multiplyMatrices(Vd,r.matrixWorld),zd.setFromMatrixPosition(Hd),i.setXYZ(n,zd.x,zd.y,zd.z),Hd.multiplyMatrices(Vd,r.parent.matrixWorld),zd.setFromMatrixPosition(Hd),i.setXYZ(n+1,zd.x,zd.y,zd.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Wd(e){const t=[];!0===e.isBone&&t.push(e);for(let n=0;n<e.children.length;n++)t.push.apply(t,Wd(e.children[n]));return t}class qd extends Gs{constructor(e,t,n){super(new fc(t,4,2),new rs({wireframe:!0,fog:!1,toneMapped:!1})),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Xd=new Li,Yd=new es,Jd=new es;class Kd extends Ur{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new dc(t);i.rotateY(.5*Math.PI),this.material=new rs({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),s=new Float32Array(3*r.count);i.setAttribute("color",new us(s,3)),this.add(new Gs(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Yd.copy(this.light.color),Jd.copy(this.light.groundColor);for(let e=0,n=t.count;e<n;e++){const i=e<n/2?Yd:Jd;t.setXYZ(e,i.r,i.g,i.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Xd.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Zd extends Fa{constructor(e=10,t=10,n=4473924,i=8947848){n=new es(n),i=new es(i);const r=t/2,s=e/t,o=e/2,a=[],l=[];for(let e=0,c=0,h=-o;e<=t;e++,h+=s){a.push(-o,0,h,o,0,h),a.push(h,0,-o,h,0,o);const t=e===r?n:i;t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3}const c=new Bs;c.setAttribute("position",new xs(a,3)),c.setAttribute("color",new xs(l,3)),super(c,new _a({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class $d extends Fa{constructor(e=10,t=16,n=8,i=64,r=4473924,s=8947848){r=new es(r),s=new es(s);const o=[],a=[];if(t>1)for(let n=0;n<t;n++){const i=n/t*(2*Math.PI),l=Math.sin(i)*e,c=Math.cos(i)*e;o.push(0,0,0),o.push(l,0,c);const h=1&n?r:s;a.push(h.r,h.g,h.b),a.push(h.r,h.g,h.b)}for(let t=0;t<n;t++){const l=1&t?r:s,c=e-e/n*t;for(let e=0;e<i;e++){let t=e/i*(2*Math.PI),n=Math.sin(t)*c,r=Math.cos(t)*c;o.push(n,0,r),a.push(l.r,l.g,l.b),t=(e+1)/i*(2*Math.PI),n=Math.sin(t)*c,r=Math.cos(t)*c,o.push(n,0,r),a.push(l.r,l.g,l.b)}}const l=new Bs;l.setAttribute("position",new xs(o,3)),l.setAttribute("color",new xs(a,3)),super(l,new _a({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const eu=new Li,tu=new Li,nu=new Li;class iu extends Ur{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",void 0===t&&(t=1);let i=new Bs;i.setAttribute("position",new xs([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new _a({fog:!1,toneMapped:!1});this.lightPlane=new Da(i,r),this.add(this.lightPlane),i=new Bs,i.setAttribute("position",new xs([0,0,0,0,0,1],3)),this.targetLine=new Da(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),eu.setFromMatrixPosition(this.light.matrixWorld),tu.setFromMatrixPosition(this.light.target.matrixWorld),nu.subVectors(tu,eu),this.lightPlane.lookAt(tu),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(tu),this.targetLine.scale.z=nu.length()}}const ru=new Li,su=new Ys;class ou extends Fa{constructor(e){const t=new Bs,n=new _a({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={};function o(e,t){a(e),a(t)}function a(e){i.push(0,0,0),r.push(0,0,0),void 0===s[e]&&(s[e]=[]),s[e].push(i.length/3-1)}o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4"),t.setAttribute("position",new xs(i,3)),t.setAttribute("color",new xs(r,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update();const l=new es(16755200),c=new es(16711680),h=new es(43775),d=new es(16777215),u=new es(3355443);this.setColors(l,c,h,d,u)}setColors(e,t,n,i,r){const s=this.geometry.getAttribute("color");s.setXYZ(0,e.r,e.g,e.b),s.setXYZ(1,e.r,e.g,e.b),s.setXYZ(2,e.r,e.g,e.b),s.setXYZ(3,e.r,e.g,e.b),s.setXYZ(4,e.r,e.g,e.b),s.setXYZ(5,e.r,e.g,e.b),s.setXYZ(6,e.r,e.g,e.b),s.setXYZ(7,e.r,e.g,e.b),s.setXYZ(8,e.r,e.g,e.b),s.setXYZ(9,e.r,e.g,e.b),s.setXYZ(10,e.r,e.g,e.b),s.setXYZ(11,e.r,e.g,e.b),s.setXYZ(12,e.r,e.g,e.b),s.setXYZ(13,e.r,e.g,e.b),s.setXYZ(14,e.r,e.g,e.b),s.setXYZ(15,e.r,e.g,e.b),s.setXYZ(16,e.r,e.g,e.b),s.setXYZ(17,e.r,e.g,e.b),s.setXYZ(18,e.r,e.g,e.b),s.setXYZ(19,e.r,e.g,e.b),s.setXYZ(20,e.r,e.g,e.b),s.setXYZ(21,e.r,e.g,e.b),s.setXYZ(22,e.r,e.g,e.b),s.setXYZ(23,e.r,e.g,e.b),s.setXYZ(24,t.r,t.g,t.b),s.setXYZ(25,t.r,t.g,t.b),s.setXYZ(26,t.r,t.g,t.b),s.setXYZ(27,t.r,t.g,t.b),s.setXYZ(28,t.r,t.g,t.b),s.setXYZ(29,t.r,t.g,t.b),s.setXYZ(30,t.r,t.g,t.b),s.setXYZ(31,t.r,t.g,t.b),s.setXYZ(32,n.r,n.g,n.b),s.setXYZ(33,n.r,n.g,n.b),s.setXYZ(34,n.r,n.g,n.b),s.setXYZ(35,n.r,n.g,n.b),s.setXYZ(36,n.r,n.g,n.b),s.setXYZ(37,n.r,n.g,n.b),s.setXYZ(38,i.r,i.g,i.b),s.setXYZ(39,i.r,i.g,i.b),s.setXYZ(40,r.r,r.g,r.b),s.setXYZ(41,r.r,r.g,r.b),s.setXYZ(42,r.r,r.g,r.b),s.setXYZ(43,r.r,r.g,r.b),s.setXYZ(44,r.r,r.g,r.b),s.setXYZ(45,r.r,r.g,r.b),s.setXYZ(46,r.r,r.g,r.b),s.setXYZ(47,r.r,r.g,r.b),s.setXYZ(48,r.r,r.g,r.b),s.setXYZ(49,r.r,r.g,r.b),s.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap;su.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),au("c",t,e,su,0,0,-1),au("t",t,e,su,0,0,1),au("n1",t,e,su,-1,-1,-1),au("n2",t,e,su,1,-1,-1),au("n3",t,e,su,-1,1,-1),au("n4",t,e,su,1,1,-1),au("f1",t,e,su,-1,-1,1),au("f2",t,e,su,1,-1,1),au("f3",t,e,su,-1,1,1),au("f4",t,e,su,1,1,1),au("u1",t,e,su,.7,1.1,-1),au("u2",t,e,su,-.7,1.1,-1),au("u3",t,e,su,0,2,-1),au("cf1",t,e,su,-1,0,1),au("cf2",t,e,su,1,0,1),au("cf3",t,e,su,0,-1,1),au("cf4",t,e,su,0,1,1),au("cn1",t,e,su,-1,0,-1),au("cn2",t,e,su,1,0,-1),au("cn3",t,e,su,0,-1,-1),au("cn4",t,e,su,0,1,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function au(e,t,n,i,r,s,o){ru.set(r,s,o).unproject(i);const a=t[e];if(void 0!==a){const e=n.getAttribute("position");for(let t=0,n=a.length;t<n;t++)e.setXYZ(a[t],ru.x,ru.y,ru.z)}}const lu=new Ui;class cu extends Fa{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new Bs;r.setIndex(new us(n,1)),r.setAttribute("position",new us(i,3)),super(r,new _a({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&lu.setFromObject(this.object),lu.isEmpty())return;const t=lu.min,n=lu.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class hu extends Fa{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Bs;i.setIndex(new us(n,1)),i.setAttribute("position",new xs([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new _a({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class du extends Da{constructor(e,t=1,n=16776960){const i=n,r=new Bs;r.setAttribute("position",new xs([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),r.computeBoundingSphere(),super(r,new _a({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const s=new Bs;s.setAttribute("position",new xs([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),this.add(new Gs(s,new rs({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const uu=new Li;let pu,Au;class fu extends Ur{constructor(e=new Li(0,0,1),t=new Li(0,0,0),n=1,i=16776960,r=.2*n,s=.2*r){super(),this.type="ArrowHelper",void 0===pu&&(pu=new Bs,pu.setAttribute("position",new xs([0,0,0,0,1,0],3)),Au=new _l(0,.5,1,5,1),Au.translate(0,-.5,0)),this.position.copy(t),this.line=new Da(pu,new _a({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Gs(Au,new rs({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,s)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{uu.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(uu,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}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class mu extends Fa{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 Bs;n.setAttribute("position",new xs(t,3)),n.setAttribute("color",new xs([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new _a({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,n){const i=new es,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class gu{constructor(){this.type="ShapePath",this.color=new es,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new xl,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,s){return this.currentPath.bezierCurveTo(e,t,n,i,r,s),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(e,t){const n=t.length;let i=!1;for(let r=n-1,s=0;s<n;r=s++){let n=t[r],o=t[s],a=o.x-n.x,l=o.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=t[s],a=-a,o=t[r],l=-l),e.y<n.y||e.y>o.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-a*(e.y-n.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==n.y)continue;if(o.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=o.x)return!0}}return i}const n=sc.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,s,o;const a=[];if(1===i.length)return s=i[0],o=new Pl,o.curves=s.curves,a.push(o),a;let l=!n(i[0].getPoints());l=e?!l:l;const c=[],h=[];let d,u,p=[],A=0;h[A]=void 0,p[A]=[];for(let t=0,o=i.length;t<o;t++)s=i[t],d=s.getPoints(),r=n(d),r=e?!r:r,r?(!l&&h[A]&&A++,h[A]={s:new Pl,p:d},h[A].s.curves=s.curves,l&&A++,p[A]=[]):p[A].push({h:s,p:d[0]});if(!h[0])return function(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n],r=new Pl;r.curves=i.curves,t.push(r)}return t}(i);if(h.length>1){let e=!1,n=0;for(let e=0,t=h.length;e<t;e++)c[e]=[];for(let i=0,r=h.length;i<r;i++){const r=p[i];for(let s=0;s<r.length;s++){const o=r[s];let a=!0;for(let r=0;r<h.length;r++)t(o.p,h[r].p)&&(i!==r&&n++,a?(a=!1,c[r].push(o)):e=!0);a&&c[i].push(o)}}n>0&&!1===e&&(p=c)}for(let e=0,t=h.length;e<t;e++){o=h[e].s,a.push(o),u=p[e];for(let e=0,t=u.length;e<t;e++)o.holes.push(u[e].h)}return a}}class vu extends Hn{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}function yu(e,t,n,i){const r=function(e){switch(e){case Re:case Le:return{byteLength:1,components:1};case Pe:case De:case ke:return{byteLength:2,components:1};case Ne:case Qe:return{byteLength:2,components:4};case Oe:case Ue:case Fe:return{byteLength:4,components:1};case ze:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${e}.`)}(i);switch(n){case He:case We:return e*t;case qe:return e*t*2;case Je:case Ke:return e*t/r.components*r.byteLength;case Ze:case $e:return e*t*2/r.components*r.byteLength;case Ve:return e*t*3/r.components*r.byteLength;case je:case tt:return e*t*4/r.components*r.byteLength;case nt:case it:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case rt:case st:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case at:case ct:return Math.max(e,16)*Math.max(t,8)/4;case ot:case lt:return Math.max(e,8)*Math.max(t,8)/2;case ht:case dt:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case ut:case pt:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case At:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case ft:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case mt:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case gt:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case vt:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case yt:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case Et:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case xt:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case bt:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case Ct:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case wt:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case _t:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case Mt:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case St:case It:case Bt:return Math.ceil(e/4)*Math.ceil(t/4)*16;case Tt:case Rt:return Math.ceil(e/4)*Math.ceil(t/4)*8;case Lt:case Dt:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}const Eu={contain:function(e,t){const n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e},cover:function(e,t){const n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e},fill:function(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e},getByteLength:yu};class xu extends Mi{constructor(e=1,t=1,n=1,i={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,t,{...i,count:n}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}function bu(){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 Cu(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.version<n.version)&&t.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}const r=t.get(n);if(void 0===r)t.set(n,function(t,n){const i=t.array,r=t.usage,s=i.byteLength,o=e.createBuffer();let a;if(e.bindBuffer(n,o),e.bufferData(n,i,r),t.onUploadCallback(),i instanceof Float32Array)a=e.FLOAT;else if(i instanceof Uint16Array)a=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(i instanceof Int16Array)a=e.SHORT;else if(i instanceof Uint32Array)a=e.UNSIGNED_INT;else if(i instanceof Int32Array)a=e.INT;else if(i instanceof Int8Array)a=e.BYTE;else if(i instanceof Uint8Array)a=e.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);a=e.UNSIGNED_BYTE}return{buffer:o,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version,size:s}}(n,i));else if(r.version<n.version){if(r.size!==n.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,n,i){const r=n.array,s=n.updateRanges;if(e.bindBuffer(i,t),0===s.length)e.bufferSubData(i,0,r);else{s.sort(((e,t)=>e.start-t.start));let t=0;for(let e=1;e<s.length;e++){const n=s[t],i=s[e];i.start<=n.start+n.count+1?n.count=Math.max(n.count,i.start+i.count-n.start):(++t,s[t]=i)}s.length=t+1;for(let t=0,n=s.length;t<n;t++){const n=s[t];e.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:s}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=s);const wu={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_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 ) || defined( USE_BATCHING_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\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( 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 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in 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( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\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 shadowIntensity;\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\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 shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, 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.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},_u={common:{diffuse:{value:new es(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ni},alphaMap:{value:null},alphaMapTransform:{value:new ni},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ni}},envmap:{envMap:{value:null},envMapRotation:{value:new ni},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ni}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ni}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ni},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ni},normalScale:{value:new ti(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ni},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ni}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ni}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ni}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new es(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 es(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ni},alphaTest:{value:0},uvTransform:{value:new ni}},sprite:{diffuse:{value:new es(16777215)},opacity:{value:1},center:{value:new ti(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ni},alphaMap:{value:null},alphaMapTransform:{value:new ni},alphaTest:{value:0}}},Mu={basic:{uniforms:js([_u.common,_u.specularmap,_u.envmap,_u.aomap,_u.lightmap,_u.fog]),vertexShader:wu.meshbasic_vert,fragmentShader:wu.meshbasic_frag},lambert:{uniforms:js([_u.common,_u.specularmap,_u.envmap,_u.aomap,_u.lightmap,_u.emissivemap,_u.bumpmap,_u.normalmap,_u.displacementmap,_u.fog,_u.lights,{emissive:{value:new es(0)}}]),vertexShader:wu.meshlambert_vert,fragmentShader:wu.meshlambert_frag},phong:{uniforms:js([_u.common,_u.specularmap,_u.envmap,_u.aomap,_u.lightmap,_u.emissivemap,_u.bumpmap,_u.normalmap,_u.displacementmap,_u.fog,_u.lights,{emissive:{value:new es(0)},specular:{value:new es(1118481)},shininess:{value:30}}]),vertexShader:wu.meshphong_vert,fragmentShader:wu.meshphong_frag},standard:{uniforms:js([_u.common,_u.envmap,_u.aomap,_u.lightmap,_u.emissivemap,_u.bumpmap,_u.normalmap,_u.displacementmap,_u.roughnessmap,_u.metalnessmap,_u.fog,_u.lights,{emissive:{value:new es(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:wu.meshphysical_vert,fragmentShader:wu.meshphysical_frag},toon:{uniforms:js([_u.common,_u.aomap,_u.lightmap,_u.emissivemap,_u.bumpmap,_u.normalmap,_u.displacementmap,_u.gradientmap,_u.fog,_u.lights,{emissive:{value:new es(0)}}]),vertexShader:wu.meshtoon_vert,fragmentShader:wu.meshtoon_frag},matcap:{uniforms:js([_u.common,_u.bumpmap,_u.normalmap,_u.displacementmap,_u.fog,{matcap:{value:null}}]),vertexShader:wu.meshmatcap_vert,fragmentShader:wu.meshmatcap_frag},points:{uniforms:js([_u.points,_u.fog]),vertexShader:wu.points_vert,fragmentShader:wu.points_frag},dashed:{uniforms:js([_u.common,_u.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:wu.linedashed_vert,fragmentShader:wu.linedashed_frag},depth:{uniforms:js([_u.common,_u.displacementmap]),vertexShader:wu.depth_vert,fragmentShader:wu.depth_frag},normal:{uniforms:js([_u.common,_u.bumpmap,_u.normalmap,_u.displacementmap,{opacity:{value:1}}]),vertexShader:wu.meshnormal_vert,fragmentShader:wu.meshnormal_frag},sprite:{uniforms:js([_u.sprite,_u.fog]),vertexShader:wu.sprite_vert,fragmentShader:wu.sprite_frag},background:{uniforms:{uvTransform:{value:new ni},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:wu.background_vert,fragmentShader:wu.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ni}},vertexShader:wu.backgroundCube_vert,fragmentShader:wu.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:wu.cube_vert,fragmentShader:wu.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:wu.equirect_vert,fragmentShader:wu.equirect_frag},distanceRGBA:{uniforms:js([_u.common,_u.displacementmap,{referencePosition:{value:new Li},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:wu.distanceRGBA_vert,fragmentShader:wu.distanceRGBA_frag},shadow:{uniforms:js([_u.lights,_u.fog,{color:{value:new es(0)},opacity:{value:1}}]),vertexShader:wu.shadow_vert,fragmentShader:wu.shadow_frag}};Mu.physical={uniforms:js([Mu.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ni},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ni},clearcoatNormalScale:{value:new ti(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ni},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ni},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ni},sheen:{value:0},sheenColor:{value:new es(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ni},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ni},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ni},transmissionSamplerSize:{value:new ti},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ni},attenuationDistance:{value:0},attenuationColor:{value:new es(0)},specularColor:{value:new es(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ni},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ni},anisotropyVector:{value:new ti},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ni}}]),vertexShader:wu.meshphysical_vert,fragmentShader:wu.meshphysical_frag};const Su={r:0,b:0,g:0},Iu=new vr,Bu=new lr;function Tu(e,t,n,i,r,s,o){const a=new es(0);let l,c,h=!0===s?0:1,d=null,u=0,p=null;function A(e){let i=!0===e.isScene?e.background:null;return i&&i.isTexture&&(i=(e.backgroundBlurriness>0?n:t).get(i)),i}function f(t,n){t.getRGB(Su,Ws(e)),i.buffers.color.setClear(Su.r,Su.g,Su.b,n,o)}return{getClearColor:function(){return a},setClearColor:function(e,t=1){a.set(e),h=t,f(a,h)},getClearAlpha:function(){return h},setClearAlpha:function(e){h=e,f(a,h)},render:function(t){let n=!1;const r=A(t);null===r?f(a,h):r&&r.isColor&&(f(r,1),n=!0);const s=e.xr.getEnvironmentBlendMode();"additive"===s?i.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===s&&i.buffers.color.setClear(0,0,0,0,o),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const i=A(n);i&&(i.isCubeTexture||i.mapping===ge)?(void 0===c&&(c=new Gs(new Hs(1e4,1e4,1e4),new Xs({name:"BackgroundCubeMaterial",uniforms:Vs(Mu.backgroundCube.uniforms),vertexShader:Mu.backgroundCube.vertexShader,fragmentShader:Mu.backgroundCube.fragmentShader,side:g,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),Iu.copy(n.backgroundRotation),Iu.x*=-1,Iu.y*=-1,Iu.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(Iu.y*=-1,Iu.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Bu.makeRotationFromEuler(Iu)),c.material.toneMapped=Ai.getTransfer(i.colorSpace)!==sn,d===i&&u===i.version&&p===e.toneMapping||(c.material.needsUpdate=!0,d=i,u=i.version,p=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new Gs(new uc(2,2),new Xs({name:"BackgroundMaterial",uniforms:Vs(Mu.background.uniforms),vertexShader:Mu.background.vertexShader,fragmentShader:Mu.background.fragmentShader,side:m,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=Ai.getTransfer(i.colorSpace)!==sn,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),d===i&&u===i.version&&p===e.toneMapping||(l.material.needsUpdate=!0,d=i,u=i.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==c&&(c.geometry.dispose(),c.material.dispose()),void 0!==l&&(l.geometry.dispose(),l.material.dispose())}}}function Ru(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=c(null);let s=r,o=!1;function a(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){const t=[],i=[],r=[];for(let e=0;e<n;e++)t[e]=0,i[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:i,attributeDivisors:r,object:e,attributes:{},index:null}}function h(){const e=s.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function d(e){u(e,0)}function u(t,n){const i=s.newAttributes,r=s.enabledAttributes,o=s.attributeDivisors;i[t]=1,0===r[t]&&(e.enableVertexAttribArray(t),r[t]=1),o[t]!==n&&(e.vertexAttribDivisor(t,n),o[t]=n)}function p(){const t=s.newAttributes,n=s.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==t[i]&&(e.disableVertexAttribArray(i),n[i]=0)}function A(t,n,i,r,s,o,a){!0===a?e.vertexAttribIPointer(t,n,i,s,o):e.vertexAttribPointer(t,n,i,r,s,o)}function f(){m(),o=!0,s!==r&&(s=r,a(s.object))}function m(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,f,m){let g=!1;const v=function(t,n,r){const s=!0===r.wireframe;let o=i[t.id];void 0===o&&(o={},i[t.id]=o);let a=o[n.id];void 0===a&&(a={},o[n.id]=a);let l=a[s];return void 0===l&&(l=c(e.createVertexArray()),a[s]=l),l}(f,l,r);s!==v&&(s=v,a(s.object)),g=function(e,t,n,i){const r=s.attributes,o=t.attributes;let a=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){const n=r[t];let i=o[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;a++}return s.attributesNum!==a||s.index!==i}(n,f,l,m),g&&function(e,t,n,i){const r={},o=t.attributes;let a=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){let n=o[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,a++}s.attributes=r,s.attributesNum=a,s.index=i}(n,f,l,m),null!==m&&t.update(m,e.ELEMENT_ARRAY_BUFFER),(g||o)&&(o=!1,function(n,i,r,s){h();const o=s.attributes,a=r.getAttributes(),l=i.defaultAttributeValues;for(const i in a){const r=a[i];if(r.location>=0){let a=o[i];if(void 0===a&&("instanceMatrix"===i&&n.instanceMatrix&&(a=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(a=n.instanceColor)),void 0!==a){const i=a.normalized,o=a.itemSize,l=t.get(a);if(void 0===l)continue;const c=l.buffer,h=l.type,p=l.bytesPerElement,f=h===e.INT||h===e.UNSIGNED_INT||a.gpuType===Ue;if(a.isInterleavedBufferAttribute){const t=a.data,l=t.stride,m=a.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)u(r.location+e,t.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<r.locationSize;e++)d(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)A(r.location+e,o/r.locationSize,h,i,l*p,(m+o/r.locationSize*e)*p,f)}else{if(a.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)u(r.location+e,a.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let e=0;e<r.locationSize;e++)d(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)A(r.location+e,o/r.locationSize,h,i,o*p,o/r.locationSize*e*p,f)}}else if(void 0!==l){const t=l[i];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(r.location,t);break;case 3:e.vertexAttrib3fv(r.location,t);break;case 4:e.vertexAttrib4fv(r.location,t);break;default:e.vertexAttrib1fv(r.location,t)}}}}p()}(n,r,l,f),null!==m&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(m).buffer))},reset:f,resetDefaultState:m,dispose:function(){f();for(const e in i){const t=i[e];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e]}},releaseStatesOfGeometry:function(e){if(void 0===i[e.id])return;const t=i[e.id];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e.id]},releaseStatesOfProgram:function(e){for(const t in i){const n=i[t];if(void 0===n[e.id])continue;const r=n[e.id];for(const e in r)l(r[e].object),delete r[e];delete n[e.id]}},initAttributes:h,enableAttribute:d,disableUnusedAttributes:p}}function Lu(e,t,n){let i;function r(t,r,s){0!==s&&(e.drawArraysInstanced(i,t,r,s),n.update(r,i,s))}this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(e,r,s){if(0===s)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,e,0,r,0,s);let o=0;for(let e=0;e<s;e++)o+=r[e];n.update(o,i,1)},this.renderMultiDrawInstances=function(e,s,o,a){if(0===o)return;const l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)r(e[t],s[t],a[t]);else{l.multiDrawArraysInstancedWEBGL(i,e,0,s,0,a,0,o);let t=0;for(let e=0;e<o;e++)t+=s[e]*a[e];n.update(t,i,1)}}}function Du(e,t,n,i){let r;function s(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==n.precision?n.precision:"highp";const a=s(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=!0===n.logarithmicDepthBuffer,c=!0===n.reverseDepthBuffer&&t.has("EXT_clip_control"),h=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:s,textureFormatReadable:function(t){return t===je||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===ke&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==Re&&i.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==Fe&&!r)},precision:o,logarithmicDepthBuffer:l,reverseDepthBuffer:c,maxTextures:h,maxVertexTextures:d,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:d>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function Pu(e){const t=this;let n=null,i=0,r=!1,s=!1;const o=new ia,a=new ni,l={value:null,needsUpdate:!1};function c(e,n,i,r){const s=null!==e?e.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const t=i+4*s,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===c||c.length<t)&&(c=new Float32Array(t));for(let t=0,n=i;t!==s;++t,n+=4)o.copy(e[t]).applyMatrix4(r,a),o.normal.toArray(c,n),c[n+3]=o.constant}l.value=c,l.needsUpdate=!0}return t.numPlanes=s,t.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){const n=0!==e.length||t||0!==i||r;return r=t,i=e.length,n},this.beginShadows=function(){s=!0,c(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(e,t){n=c(e,t,0)},this.setState=function(o,a,h){const d=o.clippingPlanes,u=o.clipIntersection,p=o.clipShadows,A=e.get(o);if(!r||null===d||0===d.length||s&&!p)s?c(null):(l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0);else{const e=s?0:i,t=4*e;let r=A.clippingState||null;l.value=r,r=c(d,a,t,h);for(let e=0;e!==t;++e)r[e]=n[e];A.clippingState=r,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=e}}}function Uu(e){let t=new WeakMap;function n(e,t){return t===fe?e.mapping=pe:t===me&&(e.mapping=Ae),e}function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping;if(s===fe||s===me){if(t.has(r))return n(t.get(r).texture,r.mapping);{const s=r.image;if(s&&s.height>0){const o=new io(s.height);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}const Ou=[.125,.215,.35,.446,.526,.582],Fu=new Sh,ku=new es;let Nu=null,Qu=0,Gu=0,zu=!1;const Hu=(1+Math.sqrt(5))/2,Vu=1/Hu,ju=[new Li(-Hu,Vu,0),new Li(Hu,Vu,0),new Li(-Vu,0,Hu),new Li(Vu,0,Hu),new Li(0,Hu,-Vu),new Li(0,Hu,Vu),new Li(-1,1,-1),new Li(1,1,-1),new Li(-1,1,1),new Li(1,1,1)];class Wu{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Nu=this._renderer.getRenderTarget(),Qu=this._renderer.getActiveCubeFace(),Gu=this._renderer.getActiveMipmapLevel(),zu=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Ju(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Yu(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Nu,Qu,Gu),this._renderer.xr.enabled=zu,e.scissorTest=!1,Xu(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===pe||e.mapping===Ae?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Nu=this._renderer.getRenderTarget(),Qu=this._renderer.getActiveCubeFace(),Gu=this._renderer.getActiveMipmapLevel(),zu=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Me,minFilter:Me,generateMipmaps:!1,type:ke,format:je,colorSpace:nn,depthBuffer:!1},i=qu(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=qu(e,t,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){const t=[],n=[],i=[];let r=e;const s=e-4+1+Ou.length;for(let o=0;o<s;o++){const s=Math.pow(2,r);n.push(s);let a=1/s;o>e-4?a=Ou[o-e+4-1]:0===o&&(a=0),i.push(a);const l=1/(s-2),c=-l,h=1+l,d=[c,c,h,c,h,h,c,c,h,h,c,h],u=6,p=6,A=3,f=2,m=1,g=new Float32Array(A*p*u),v=new Float32Array(f*p*u),y=new Float32Array(m*p*u);for(let e=0;e<u;e++){const t=e%3*2/3-1,n=e>2?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,A*p*e),v.set(d,f*p*e);const r=[e,e,e,e,e,e];y.set(r,m*p*e)}const E=new Bs;E.setAttribute("position",new us(g,A)),E.setAttribute("uv",new us(v,f)),E.setAttribute("faceIndex",new us(y,m)),t.push(E),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(20),r=new Li(0,1,0);return new Xs({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:y,depthTest:!1,depthWrite:!1})}(i,e,t)}return i}_compileMaterial(e){const t=new Gs(this._lodPlanes[0],e);this._renderer.compile(t,Fu)}_sceneToCubeUV(e,t,n,i){const r=new $s(90,1,t,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,c=a.toneMapping;a.getClearColor(ku),a.toneMapping=ne,a.autoClear=!1;const h=new rs({name:"PMREM.Background",side:g,depthWrite:!1,depthTest:!1}),d=new Gs(new Hs,h);let u=!1;const p=e.background;p?p.isColor&&(h.color.copy(p),e.background=null,u=!0):(h.color.copy(ku),u=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,s[t],0),r.lookAt(o[t],0,0)):1===n?(r.up.set(0,0,s[t]),r.lookAt(0,o[t],0)):(r.up.set(0,s[t],0),r.lookAt(0,0,o[t]));const l=this._cubeSize;Xu(i,n*l,t>2?l:0,l,l),a.setRenderTarget(i),u&&a.render(d,r),a.render(e,r)}d.geometry.dispose(),d.material.dispose(),a.toneMapping=c,a.autoClear=l,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===pe||e.mapping===Ae;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Ju()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Yu());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new Gs(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const o=this._cubeSize;Xu(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(s,Fu)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let t=1;t<i;t++){const n=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),r=ju[(i-t-1)%ju.length];this._blur(e,t-1,t,n,r)}t.autoClear=n}_blur(e,t,n,i,r){const s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,i,"latitudinal",r),this._halfBlur(s,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,s,o){const a=this._renderer,l=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Gs(this._lodPlanes[i],l),h=l.uniforms,d=this._sizeLods[n]-1,u=isFinite(r)?Math.PI/(2*d):2*Math.PI/39,p=r/u,A=isFinite(r)?1+Math.floor(3*p):20;A>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${A} samples when the maximum is set to 20`);const f=[];let m=0;for(let e=0;e<20;++e){const t=e/p,n=Math.exp(-t*t/2);f.push(n),0===e?m+=n:e<A&&(m+=2*n)}for(let e=0;e<f.length;e++)f[e]=f[e]/m;h.envMap.value=e.texture,h.samples.value=A,h.weights.value=f,h.latitudinal.value="latitudinal"===s,o&&(h.poleAxis.value=o);const{_lodMax:g}=this;h.dTheta.value=u,h.mipInt.value=g-n;const v=this._sizeLods[i];Xu(t,3*v*(i>g-4?i-g+4:0),4*(this._cubeSize-v),3*v,2*v),a.setRenderTarget(t),a.render(c,Fu)}}function qu(e,t,n){const i=new Mi(e,t,n);return i.texture.mapping=ge,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Xu(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Yu(){return new Xs({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:y,depthTest:!1,depthWrite:!1})}function Ju(){return new Xs({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:y,depthTest:!1,depthWrite:!1})}function Ku(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,o=s===fe||s===me,a=s===pe||s===Ae;if(o||a){let s=t.get(r);const l=void 0!==s?s.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new Wu(e)),s=o?n.fromEquirectangular(r,s):n.fromCubemap(r,s),s.texture.pmremVersion=r.pmremVersion,t.set(r,s),s.texture;if(void 0!==s)return s.texture;{const l=r.image;return o&&l&&l.height>0||a&&l&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)?(null===n&&(n=new Wu(e)),s=o?n.fromEquirectangular(r):n.fromCubemap(r),s.texture.pmremVersion=r.pmremVersion,t.set(r,s),r.addEventListener("dispose",i),s.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Zu(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(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){const t=n(e);return null===t&&hi("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function $u(e,t,n,i){const r={},s=new WeakMap;function o(e){const a=e.target;null!==a.index&&t.remove(a.index);for(const e in a.attributes)t.remove(a.attributes[e]);a.removeEventListener("dispose",o),delete r[a.id];const l=s.get(a);l&&(t.remove(l),s.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(e){const n=[],i=e.index,r=e.attributes.position;let o=0;if(null!==i){const e=i.array;o=i.version;for(let t=0,i=e.length;t<i;t+=3){const i=e[t+0],r=e[t+1],s=e[t+2];n.push(i,r,r,s,s,i)}}else{if(void 0===r)return;{const e=r.array;o=r.version;for(let t=0,i=e.length/3-1;t<i;t+=3){const e=t+0,i=t+1,r=t+2;n.push(e,i,i,r,r,e)}}}const a=new(ri(n)?ys:gs)(n,1);a.version=o;const l=s.get(e);l&&t.remove(l),s.set(e,a)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",o),r[t.id]=!0,n.memory.geometries++),t},update:function(n){const i=n.attributes;for(const n in i)t.update(i[n],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){const t=s.get(e);if(t){const n=e.index;null!==n&&t.version<n.version&&a(e)}else a(e);return s.get(e)}}}function ep(e,t,n){let i,r,s;function o(t,o,a){0!==a&&(e.drawElementsInstanced(i,o,r,t*s,a),n.update(o,i,a))}this.setMode=function(e){i=e},this.setIndex=function(e){r=e.type,s=e.bytesPerElement},this.render=function(t,o){e.drawElements(i,o,r,t*s),n.update(o,i,1)},this.renderInstances=o,this.renderMultiDraw=function(e,s,o){if(0===o)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,s,0,r,e,0,o);let a=0;for(let e=0;e<o;e++)a+=s[e];n.update(a,i,1)},this.renderMultiDrawInstances=function(e,a,l,c){if(0===l)return;const h=t.get("WEBGL_multi_draw");if(null===h)for(let t=0;t<e.length;t++)o(e[t]/s,a[t],c[t]);else{h.multiDrawElementsInstancedWEBGL(i,a,0,r,e,0,c,0,l);let t=0;for(let e=0;e<l;e++)t+=a[e]*c[e];n.update(t,i,1)}}}function tp(e){const t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,i,r){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=r*(n/3);break;case e.LINES:t.lines+=r*(n/2);break;case e.LINE_STRIP:t.lines+=r*(n-1);break;case e.LINE_LOOP:t.lines+=r*n;break;case e.POINTS:t.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function np(e,t,n){const i=new WeakMap,r=new wi;return{update:function(s,o,a){const l=s.morphTargetInfluences,c=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=void 0!==c?c.length:0;let d=i.get(o);if(void 0===d||d.count!==h){void 0!==d&&d.texture.dispose();const u=void 0!==o.morphAttributes.position,p=void 0!==o.morphAttributes.normal,A=void 0!==o.morphAttributes.color,f=o.morphAttributes.position||[],m=o.morphAttributes.normal||[],g=o.morphAttributes.color||[];let v=0;!0===u&&(v=1),!0===p&&(v=2),!0===A&&(v=3);let y=o.attributes.position.count*v,E=1;y>t.maxTextureSize&&(E=Math.ceil(y/t.maxTextureSize),y=t.maxTextureSize);const x=new Float32Array(y*E*4*h),b=new Si(x,y,E,h);b.type=Fe,b.needsUpdate=!0;const C=4*v;for(let _=0;_<h;_++){const M=f[_],S=m[_],I=g[_],B=y*E*4*_;for(let T=0;T<M.count;T++){const R=T*C;!0===u&&(r.fromBufferAttribute(M,T),x[B+R+0]=r.x,x[B+R+1]=r.y,x[B+R+2]=r.z,x[B+R+3]=0),!0===p&&(r.fromBufferAttribute(S,T),x[B+R+4]=r.x,x[B+R+5]=r.y,x[B+R+6]=r.z,x[B+R+7]=0),!0===A&&(r.fromBufferAttribute(I,T),x[B+R+8]=r.x,x[B+R+9]=r.y,x[B+R+10]=r.z,x[B+R+11]=4===I.itemSize?r.w:1)}}function w(){b.dispose(),i.delete(o),o.removeEventListener("dispose",w)}d={count:h,texture:b,size:new ti(y,E)},i.set(o,d),o.addEventListener("dispose",w)}if(!0===s.isInstancedMesh&&null!==s.morphTexture)a.getUniforms().setValue(e,"morphTexture",s.morphTexture,n);else{let L=0;for(let P=0;P<l.length;P++)L+=l[P];const D=o.morphTargetsRelative?1:1-L;a.getUniforms().setValue(e,"morphTargetBaseInfluence",D),a.getUniforms().setValue(e,"morphTargetInfluences",l)}a.getUniforms().setValue(e,"morphTargetsTexture",d.texture,n),a.getUniforms().setValue(e,"morphTargetsTextureSize",d.size)}}}class ip{constructor(e,t,n){if(this.renderer=e,this.DEFAULT_NUMVIEWS=2,this.maxNumViews=0,this.gl=n,this.extensions=t,this.available=this.extensions.has("OCULUS_multiview"),this.available){const e=this.extensions.get("OCULUS_multiview");this.maxNumViews=this.gl.getParameter(e.MAX_VIEWS_OVR),this.mat4=[],this.mat3=[],this.cameraArray=[];for(var i=0;i<this.maxNumViews;i++)this.mat4[i]=new lr,this.mat3[i]=new ni}}getCameraArray(e){return e.isArrayCamera?e.cameras:(this.cameraArray[0]=e,this.cameraArray)}updateCameraProjectionMatricesUniform(e,t){for(var n=this.getCameraArray(e),i=0;i<n.length;i++)this.mat4[i].copy(n[i].projectionMatrix);t.setValue(this.gl,"projectionMatrices",this.mat4)}updateCameraViewMatricesUniform(e,t){for(var n=this.getCameraArray(e),i=0;i<n.length;i++)this.mat4[i].copy(n[i].matrixWorldInverse);t.setValue(this.gl,"viewMatrices",this.mat4)}updateObjectMatricesUniforms(e,t,n){for(var i=this.getCameraArray(t),r=0;r<i.length;r++)this.mat4[r].multiplyMatrices(i[r].matrixWorldInverse,e.matrixWorld),this.mat3[r].getNormalMatrix(this.mat4[r]);n.setValue(this.gl,"modelViewMatrices",this.mat4),n.setValue(this.gl,"normalMatrices",this.mat3)}}function rp(e,t,n,i){let r=new WeakMap;function s(e){const t=e.target;t.removeEventListener("dispose",s),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(o){const a=i.render.frame,l=o.geometry,c=t.get(o,l);if(r.get(c)!==a&&(t.update(c),r.set(c,a)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",s)&&o.addEventListener("dispose",s),r.get(o)!==a&&(n.update(o.instanceMatrix,e.ARRAY_BUFFER),null!==o.instanceColor&&n.update(o.instanceColor,e.ARRAY_BUFFER),r.set(o,a))),o.isSkinnedMesh){const e=o.skeleton;r.get(e)!==a&&(e.update(),r.set(e,a))}return c},dispose:function(){r=new WeakMap}}}const sp=new Ci,op=new $a(1,1),ap=new Si,lp=new Bi,cp=new no,hp=[],dp=[],up=new Float32Array(16),pp=new Float32Array(9),Ap=new Float32Array(4);function fp(e,t,n){const i=e[0];if(i<=0||i>0)return e;const r=t*n;let s=hp[r];if(void 0===s&&(s=new Float32Array(r),hp[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 mp(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function gp(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function vp(e,t){let n=dp[t];void 0===n&&(n=new Int32Array(t),dp[t]=n);for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function yp(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Ep(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(mp(n,t))return;e.uniform2fv(this.addr,t),gp(n,t)}}function xp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(mp(n,t))return;e.uniform3fv(this.addr,t),gp(n,t)}}function bp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(mp(n,t))return;e.uniform4fv(this.addr,t),gp(n,t)}}function Cp(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(mp(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),gp(n,t)}else{if(mp(n,i))return;Ap.set(i),e.uniformMatrix2fv(this.addr,!1,Ap),gp(n,i)}}function wp(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(mp(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),gp(n,t)}else{if(mp(n,i))return;pp.set(i),e.uniformMatrix3fv(this.addr,!1,pp),gp(n,i)}}function _p(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(mp(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),gp(n,t)}else{if(mp(n,i))return;up.set(i),e.uniformMatrix4fv(this.addr,!1,up),gp(n,i)}}function Mp(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Sp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(mp(n,t))return;e.uniform2iv(this.addr,t),gp(n,t)}}function Ip(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(mp(n,t))return;e.uniform3iv(this.addr,t),gp(n,t)}}function Bp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(mp(n,t))return;e.uniform4iv(this.addr,t),gp(n,t)}}function Tp(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Rp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(mp(n,t))return;e.uniform2uiv(this.addr,t),gp(n,t)}}function Lp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(mp(n,t))return;e.uniform3uiv(this.addr,t),gp(n,t)}}function Dp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(mp(n,t))return;e.uniform4uiv(this.addr,t),gp(n,t)}}function Pp(e,t,n){const i=this.cache,r=n.allocateTextureUnit();let s;i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),this.type===e.SAMPLER_2D_SHADOW?(op.compareFunction=_n,s=op):s=sp,n.setTexture2D(t||s,r)}function Up(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||lp,r)}function Op(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(t||cp,r)}function Fp(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||ap,r)}function kp(e,t){e.uniform1fv(this.addr,t)}function Np(e,t){const n=fp(t,this.size,2);e.uniform2fv(this.addr,n)}function Qp(e,t){const n=fp(t,this.size,3);e.uniform3fv(this.addr,n)}function Gp(e,t){const n=fp(t,this.size,4);e.uniform4fv(this.addr,n)}function zp(e,t){const n=fp(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Hp(e,t){const n=fp(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Vp(e,t){const n=fp(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function jp(e,t){e.uniform1iv(this.addr,t)}function Wp(e,t){e.uniform2iv(this.addr,t)}function qp(e,t){e.uniform3iv(this.addr,t)}function Xp(e,t){e.uniform4iv(this.addr,t)}function Yp(e,t){e.uniform1uiv(this.addr,t)}function Jp(e,t){e.uniform2uiv(this.addr,t)}function Kp(e,t){e.uniform3uiv(this.addr,t)}function Zp(e,t){e.uniform4uiv(this.addr,t)}function $p(e,t,n){const i=this.cache,r=t.length,s=vp(n,r);mp(i,s)||(e.uniform1iv(this.addr,s),gp(i,s));for(let e=0;e!==r;++e)n.setTexture2D(t[e]||sp,s[e])}function eA(e,t,n){const i=this.cache,r=t.length,s=vp(n,r);mp(i,s)||(e.uniform1iv(this.addr,s),gp(i,s));for(let e=0;e!==r;++e)n.setTexture3D(t[e]||lp,s[e])}function tA(e,t,n){const i=this.cache,r=t.length,s=vp(n,r);mp(i,s)||(e.uniform1iv(this.addr,s),gp(i,s));for(let e=0;e!==r;++e)n.setTextureCube(t[e]||cp,s[e])}function nA(e,t,n){const i=this.cache,r=t.length,s=vp(n,r);mp(i,s)||(e.uniform1iv(this.addr,s),gp(i,s));for(let e=0;e!==r;++e)n.setTexture2DArray(t[e]||ap,s[e])}class iA{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return yp;case 35664:return Ep;case 35665:return xp;case 35666:return bp;case 35674:return Cp;case 35675:return wp;case 35676:return _p;case 5124:case 35670:return Mp;case 35667:case 35671:return Sp;case 35668:case 35672:return Ip;case 35669:case 35673:return Bp;case 5125:return Tp;case 36294:return Rp;case 36295:return Lp;case 36296:return Dp;case 35678:case 36198:case 36298:case 36306:case 35682:return Pp;case 35679:case 36299:case 36307:return Up;case 35680:case 36300:case 36308:case 36293:return Op;case 36289:case 36303:case 36311:case 36292:return Fp}}(t.type)}}class rA{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return kp;case 35664:return Np;case 35665:return Qp;case 35666:return Gp;case 35674:return zp;case 35675:return Hp;case 35676:return Vp;case 5124:case 35670:return jp;case 35667:case 35671:return Wp;case 35668:case 35672:return qp;case 35669:case 35673:return Xp;case 5125:return Yp;case 36294:return Jp;case 36295:return Kp;case 36296:return Zp;case 35678:case 36198:case 36298:case 36306:case 35682:return $p;case 35679:case 36299:case 36307:return eA;case 35680:case 36300:case 36308:case 36293:return tA;case 36289:case 36303:case 36311:case 36292:return nA}}(t.type)}}class sA{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,s=i.length;r!==s;++r){const s=i[r];s.setValue(e,t[s.id],n)}}}const oA=/(\w+)(\])?(\[|\.)?/g;function aA(e,t){e.seq.push(t),e.map[t.id]=t}function lA(e,t,n){const i=e.name,r=i.length;for(oA.lastIndex=0;;){const s=oA.exec(i),o=oA.lastIndex;let a=s[1];const l="]"===s[2],c=s[3];if(l&&(a|=0),void 0===c||"["===c&&o+2===r){aA(n,void 0===c?new iA(a,e,t):new rA(a,e,t));break}{let e=n.map[a];void 0===e&&(e=new sA(a),aA(n,e)),n=e}}}class cA{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=e.getActiveUniform(t,i);lA(n,e.getUniformLocation(t,n.name),this)}}setValue(e,t,n,i){const r=this.map[t];void 0!==r&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];void 0!==i&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,s=t.length;r!==s;++r){const s=t[r],o=n[s.id];!1!==o.needsUpdate&&s.setValue(e,o.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const r=e[i];r.id in t&&n.push(r)}return n}}function hA(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}let dA=0;const uA=new ni;function pA(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(i&&""===r)return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const i=parseInt(s[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){const n=e.split("\n"),i=[],r=Math.max(t-6,0),s=Math.min(t+6,n.length);for(let e=r;e<s;e++){const r=e+1;i.push(`${r===t?">":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}return r}function AA(e,t){const n=function(e){Ai._getMatrix(uA,Ai.workingColorSpace,e);const t=`mat3( ${uA.elements.map((e=>e.toFixed(4)))} )`;switch(Ai.getTransfer(e)){case rn:return[t,"LinearTransferOETF"];case sn:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(t);return[`vec4 ${e}( vec4 value ) {`,`\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join("\n")}function fA(e,t){let n;switch(t){case ie:n="Linear";break;case re:n="Reinhard";break;case se:n="Cineon";break;case oe:n="ACESFilmic";break;case le:n="AgX";break;case ce:n="Neutral";break;case ae:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const mA=new Li;function gA(e){return""!==e}function vA(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function yA(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const EA=/^[ \t]*#include +<([\w\d./]+)>/gm;function xA(e){return e.replace(EA,CA)}const bA=new Map;function CA(e,t){let n=wu[t];if(void 0===n){const e=bA.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=wu[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return xA(n)}const wA=/#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 _A(e){return e.replace(wA,MA)}function MA(e,t,n,i){let r="";for(let e=parseInt(t);e<parseInt(n);e++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return r}function SA(e){let t=`precision ${e.precision} float;\n\tprecision ${e.precision} int;\n\tprecision ${e.precision} sampler2D;\n\tprecision ${e.precision} samplerCube;\n\tprecision ${e.precision} sampler3D;\n\tprecision ${e.precision} sampler2DArray;\n\tprecision ${e.precision} sampler2DShadow;\n\tprecision ${e.precision} samplerCubeShadow;\n\tprecision ${e.precision} sampler2DArrayShadow;\n\tprecision ${e.precision} isampler2D;\n\tprecision ${e.precision} isampler3D;\n\tprecision ${e.precision} isamplerCube;\n\tprecision ${e.precision} isampler2DArray;\n\tprecision ${e.precision} usampler2D;\n\tprecision ${e.precision} usampler3D;\n\tprecision ${e.precision} usamplerCube;\n\tprecision ${e.precision} usampler2DArray;\n\t`;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function IA(e,t,n,i){const r=e.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=function(e){let t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===p?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===A?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===f&&(t="SHADOWMAP_TYPE_VSM"),t}(n),c=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case pe:case Ae:t="ENVMAP_TYPE_CUBE";break;case ge:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),h=function(e){let t="ENVMAP_MODE_REFLECTION";return e.envMap&&e.envMapMode===Ae&&(t="ENVMAP_MODE_REFRACTION"),t}(n),d=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case $:t="ENVMAP_BLENDING_MULTIPLY";break;case ee:t="ENVMAP_BLENDING_MIX";break;case te:t="ENVMAP_BLENDING_ADD"}return t}(n),u=function(e){const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),m=function(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(gA).join("\n")}(n),g=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),v=r.createProgram();let y,E,x=n.glslVersion?"#version "+n.glslVersion+"\n":"";const b=n.numMultiviewViews;n.isRawShaderMaterial?(y=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g].filter(gA).join("\n"),y.length>0&&(y+="\n"),E=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g].filter(gA).join("\n"),E.length>0&&(E+="\n")):(y=[SA(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",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.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(gA).join("\n"),E=[SA(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",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 "+d:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",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.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==ne?"#define TONE_MAPPING":"",n.toneMapping!==ne?wu.tonemapping_pars_fragment:"",n.toneMapping!==ne?fA("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",wu.colorspace_pars_fragment,AA("linearToOutputTexel",n.outputColorSpace),(Ai.getLuminanceCoefficients(mA),["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${mA.x.toFixed(4)}, ${mA.y.toFixed(4)}, ${mA.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(gA).join("\n")),o=xA(o),o=vA(o,n),o=yA(o,n),a=xA(a),a=vA(a,n),a=yA(a,n),o=_A(o),a=_A(a),!0!==n.isRawShaderMaterial&&(x="#version 300 es\n",y=[m,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+y,E=["#define varying in",n.glslVersion===Qn?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Qn?"":"#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"+E,b>0&&(y=["#extension GL_OVR_multiview : require","layout(num_views = "+b+") in;","#define VIEW_ID gl_ViewID_OVR"].join("\n")+"\n"+y,y=y.replace(["uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;"].join("\n"),["uniform mat4 modelViewMatrices["+b+"];","uniform mat4 projectionMatrices["+b+"];","uniform mat4 viewMatrices["+b+"];","uniform mat3 normalMatrices["+b+"];","#define modelViewMatrix modelViewMatrices[VIEW_ID]","#define projectionMatrix projectionMatrices[VIEW_ID]","#define viewMatrix viewMatrices[VIEW_ID]","#define normalMatrix normalMatrices[VIEW_ID]"].join("\n")),E=["#extension GL_OVR_multiview : require","#define VIEW_ID gl_ViewID_OVR"].join("\n")+"\n"+E,E=E.replace("uniform mat4 viewMatrix;",["uniform mat4 viewMatrices["+b+"];","#define viewMatrix viewMatrices[VIEW_ID]"].join("\n"))));const C=x+y+o,w=x+E+a,_=hA(r,r.VERTEX_SHADER,C),M=hA(r,r.FRAGMENT_SHADER,w);function S(t){if(e.debug.checkShaderErrors){const n=r.getProgramInfoLog(v).trim(),i=r.getShaderInfoLog(_).trim(),s=r.getShaderInfoLog(M).trim();let o=!0,a=!0;if(!1===r.getProgramParameter(v,r.LINK_STATUS))if(o=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(r,v,_,M);else{const e=pA(r,_,"vertex"),i=pA(r,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(v,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+n+"\n"+e+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==s||(a=!1);a&&(t.diagnostics={runnable:o,programLog:n,vertexShader:{log:i,prefix:y},fragmentShader:{log:s,prefix:E}})}r.deleteShader(_),r.deleteShader(M),I=new cA(r,v),B=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=e.getActiveAttrib(t,r),s=i.name;let o=1;i.type===e.FLOAT_MAT2&&(o=2),i.type===e.FLOAT_MAT3&&(o=3),i.type===e.FLOAT_MAT4&&(o=4),n[s]={type:i.type,location:e.getAttribLocation(t,s),locationSize:o}}return n}(r,v)}let I,B;r.attachShader(v,_),r.attachShader(v,M),void 0!==n.index0AttributeName?r.bindAttribLocation(v,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(v,0,"position"),r.linkProgram(v),this.getUniforms=function(){return void 0===I&&S(this),I},this.getAttributes=function(){return void 0===B&&S(this),B};let T=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===T&&(T=r.getProgramParameter(v,37297)),T},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(v),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=dA++,this.cacheKey=t,this.usedTimes=1,this.program=v,this.vertexShader=_,this.fragmentShader=M,this.numMultiviewViews=b,this}let BA=0;class TA{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),s=this._getShaderCacheForMaterial(e);return!1===s.has(i)&&(s.add(i),i.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return void 0===n&&(n=new RA(e),t.set(e,n)),n}}class RA{constructor(e){this.id=BA++,this.code=e,this.usedTimes=0}}function LA(e,t,n,i,r,s,o){const a=new yr,l=new TA,c=new Set,h=[],d=r.logarithmicDepthBuffer,u=r.vertexTextures;let p=r.precision;const A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function f(e){return c.add(e),0===e?"uv":`uv${e}`}return{getParameters:function(s,a,h,m,y){const x=m.fog,b=y.geometry,C=s.isMeshStandardMaterial?m.environment:null,w=(s.isMeshStandardMaterial?n:t).get(s.envMap||C),_=w&&w.mapping===ge?w.image.height:null,M=A[s.type];null!==s.precision&&(p=r.getMaxPrecision(s.precision),p!==s.precision&&console.warn("THREE.WebGLProgram.getParameters:",s.precision,"not supported, using",p,"instead."));const S=b.morphAttributes.position||b.morphAttributes.normal||b.morphAttributes.color,I=void 0!==S?S.length:0;let B,T,R,L,D=0;if(void 0!==b.morphAttributes.position&&(D=1),void 0!==b.morphAttributes.normal&&(D=2),void 0!==b.morphAttributes.color&&(D=3),M){const e=Mu[M];B=e.vertexShader,T=e.fragmentShader}else B=s.vertexShader,T=s.fragmentShader,l.update(s),R=l.getVertexShaderID(s),L=l.getFragmentShaderID(s);const P=e.getRenderTarget(),U=e.state.buffers.depth.getReversed(),O=P&&P.isWebGLMultiviewRenderTarget?P.numViews:0,F=!0===y.isInstancedMesh,k=!0===y.isBatchedMesh,N=!!s.map,Q=!!s.matcap,G=!!w,z=!!s.aoMap,H=!!s.lightMap,V=!!s.bumpMap,j=!!s.normalMap,W=!!s.displacementMap,q=!!s.emissiveMap,X=!!s.metalnessMap,Y=!!s.roughnessMap,J=s.anisotropy>0,K=s.clearcoat>0,Z=s.dispersion>0,$=s.iridescence>0,ee=s.sheen>0,te=s.transmission>0,ie=J&&!!s.anisotropyMap,re=K&&!!s.clearcoatMap,se=K&&!!s.clearcoatNormalMap,oe=K&&!!s.clearcoatRoughnessMap,ae=$&&!!s.iridescenceMap,le=$&&!!s.iridescenceThicknessMap,ce=ee&&!!s.sheenColorMap,he=ee&&!!s.sheenRoughnessMap,de=!!s.specularMap,ue=!!s.specularColorMap,pe=!!s.specularIntensityMap,Ae=te&&!!s.transmissionMap,fe=te&&!!s.thicknessMap,me=!!s.gradientMap,ve=!!s.alphaMap,ye=s.alphaTest>0,Ee=!!s.alphaHash,xe=!!s.extensions;let be=ne;s.toneMapped&&(null!==P&&!0!==P.isXRRenderTarget||(be=e.toneMapping));const Ce={shaderID:M,shaderType:s.type,shaderName:s.name,vertexShader:B,fragmentShader:T,defines:s.defines,customVertexShaderID:R,customFragmentShaderID:L,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,batching:k,batchingColor:k&&null!==y._colorsTexture,instancing:F,instancingColor:F&&null!==y.instanceColor,instancingMorph:F&&null!==y.morphTexture,supportsVertexTextures:u,numMultiviewViews:O,outputColorSpace:null===P?e.outputColorSpace:!0===P.isXRRenderTarget?P.texture.colorSpace:nn,alphaToCoverage:!!s.alphaToCoverage,map:N,matcap:Q,envMap:G,envMapMode:G&&w.mapping,envMapCubeUVHeight:_,aoMap:z,lightMap:H,bumpMap:V,normalMap:j,displacementMap:u&&W,emissiveMap:q,normalMapObjectSpace:j&&s.normalMapType===$t,normalMapTangentSpace:j&&s.normalMapType===Zt,metalnessMap:X,roughnessMap:Y,anisotropy:J,anisotropyMap:ie,clearcoat:K,clearcoatMap:re,clearcoatNormalMap:se,clearcoatRoughnessMap:oe,dispersion:Z,iridescence:$,iridescenceMap:ae,iridescenceThicknessMap:le,sheen:ee,sheenColorMap:ce,sheenRoughnessMap:he,specularMap:de,specularColorMap:ue,specularIntensityMap:pe,transmission:te,transmissionMap:Ae,thicknessMap:fe,gradientMap:me,opaque:!1===s.transparent&&s.blending===E&&!1===s.alphaToCoverage,alphaMap:ve,alphaTest:ye,alphaHash:Ee,combine:s.combine,mapUv:N&&f(s.map.channel),aoMapUv:z&&f(s.aoMap.channel),lightMapUv:H&&f(s.lightMap.channel),bumpMapUv:V&&f(s.bumpMap.channel),normalMapUv:j&&f(s.normalMap.channel),displacementMapUv:W&&f(s.displacementMap.channel),emissiveMapUv:q&&f(s.emissiveMap.channel),metalnessMapUv:X&&f(s.metalnessMap.channel),roughnessMapUv:Y&&f(s.roughnessMap.channel),anisotropyMapUv:ie&&f(s.anisotropyMap.channel),clearcoatMapUv:re&&f(s.clearcoatMap.channel),clearcoatNormalMapUv:se&&f(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:oe&&f(s.clearcoatRoughnessMap.channel),iridescenceMapUv:ae&&f(s.iridescenceMap.channel),iridescenceThicknessMapUv:le&&f(s.iridescenceThicknessMap.channel),sheenColorMapUv:ce&&f(s.sheenColorMap.channel),sheenRoughnessMapUv:he&&f(s.sheenRoughnessMap.channel),specularMapUv:de&&f(s.specularMap.channel),specularColorMapUv:ue&&f(s.specularColorMap.channel),specularIntensityMapUv:pe&&f(s.specularIntensityMap.channel),transmissionMapUv:Ae&&f(s.transmissionMap.channel),thicknessMapUv:fe&&f(s.thicknessMap.channel),alphaMapUv:ve&&f(s.alphaMap.channel),vertexTangents:!!b.attributes.tangent&&(j||J),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,pointsUvs:!0===y.isPoints&&!!b.attributes.uv&&(N||ve),fog:!!x,useFog:!0===s.fog,fogExp2:!!x&&x.isFogExp2,flatShading:!0===s.flatShading,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:d,reverseDepthBuffer:U,skinning:!0===y.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:I,morphTextureStride:D,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numSpotLightMaps:a.spotLightMap.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numSpotLightShadowsWithMaps:a.numSpotLightShadowsWithMaps,numLightProbes:a.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:be,decodeVideoTexture:N&&!0===s.map.isVideoTexture&&Ai.getTransfer(s.map.colorSpace)===sn,decodeVideoTextureEmissive:q&&!0===s.emissiveMap.isVideoTexture&&Ai.getTransfer(s.emissiveMap.colorSpace)===sn,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===v,flipSided:s.side===g,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionClipCullDistance:xe&&!0===s.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(xe&&!0===s.extensions.multiDraw||k)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:s.customProgramCacheKey()};return Ce.vertexUv1s=c.has(1),Ce.vertexUv2s=c.has(2),Ce.vertexUv3s=c.has(3),c.clear(),Ce},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){a.disableAll(),t.supportsVertexTextures&&a.enable(0),t.instancing&&a.enable(1),t.instancingColor&&a.enable(2),t.instancingMorph&&a.enable(3),t.matcap&&a.enable(4),t.envMap&&a.enable(5),t.normalMapObjectSpace&&a.enable(6),t.normalMapTangentSpace&&a.enable(7),t.clearcoat&&a.enable(8),t.iridescence&&a.enable(9),t.alphaTest&&a.enable(10),t.vertexColors&&a.enable(11),t.vertexAlphas&&a.enable(12),t.vertexUv1s&&a.enable(13),t.vertexUv2s&&a.enable(14),t.vertexUv3s&&a.enable(15),t.vertexTangents&&a.enable(16),t.anisotropy&&a.enable(17),t.alphaHash&&a.enable(18),t.batching&&a.enable(19),t.dispersion&&a.enable(20),t.batchingColor&&a.enable(21),e.push(a.mask),a.disableAll(),t.fog&&a.enable(0),t.useFog&&a.enable(1),t.flatShading&&a.enable(2),t.logarithmicDepthBuffer&&a.enable(3),t.reverseDepthBuffer&&a.enable(4),t.skinning&&a.enable(5),t.morphTargets&&a.enable(6),t.morphNormals&&a.enable(7),t.morphColors&&a.enable(8),t.premultipliedAlpha&&a.enable(9),t.shadowMapEnabled&&a.enable(10),t.doubleSided&&a.enable(11),t.flipSided&&a.enable(12),t.useDepthPacking&&a.enable(13),t.dithering&&a.enable(14),t.transmission&&a.enable(15),t.sheen&&a.enable(16),t.opaque&&a.enable(17),t.pointsUvs&&a.enable(18),t.decodeVideoTexture&&a.enable(19),t.decodeVideoTextureEmissive&&a.enable(20),t.alphaToCoverage&&a.enable(21),t.numMultiviewViews&&a.enable(21),e.push(a.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=A[e.type];let n;if(t){const e=Mu[t];n=qs.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=h.length;e<t;e++){const t=h[e];if(t.cacheKey===n){i=t,++i.usedTimes;break}}return void 0===i&&(i=new IA(e,n,t,s),h.push(i)),i},releaseProgram:function(e){if(0==--e.usedTimes){const t=h.indexOf(e);h[t]=h[h.length-1],h.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:h,dispose:function(){l.dispose()}}}function DA(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function PA(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function UA(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function OA(){const e=[];let t=0;const n=[],i=[],r=[];function s(n,i,r,s,o,a){let l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:s,renderOrder:n.renderOrder,z:o,group:a},e[t]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=s,l.renderOrder=n.renderOrder,l.z=o,l.group=a),t++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,o,a,l,c){const h=s(e,t,o,a,l,c);o.transmission>0?i.push(h):!0===o.transparent?r.push(h):n.push(h)},unshift:function(e,t,o,a,l,c){const h=s(e,t,o,a,l,c);o.transmission>0?i.unshift(h):!0===o.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n<i;n++){const t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){n.length>1&&n.sort(e||PA),i.length>1&&i.sort(t||UA),r.length>1&&r.sort(t||UA)}}}function FA(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let r;return void 0===i?(r=new OA,e.set(t,[r])):n>=i.length?(r=new OA,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function kA(){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 Li,color:new es};break;case"SpotLight":n={position:new Li,direction:new Li,color:new es,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Li,color:new es,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Li,skyColor:new es,groundColor:new es};break;case"RectAreaLight":n={color:new es,position:new Li,halfWidth:new Li,halfHeight:new Li}}return e[t.id]=n,n}}}let NA=0;function QA(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function GA(e){const t=new kA,n=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={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ti};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ti,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)i.probe.push(new Li);const r=new Li,s=new lr,o=new lr;return{setup:function(r){let s=0,o=0,a=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let l=0,c=0,h=0,d=0,u=0,p=0,A=0,f=0,m=0,g=0,v=0;r.sort(QA);for(let e=0,y=r.length;e<y;e++){const y=r[e],E=y.color,x=y.intensity,b=y.distance,C=y.shadow&&y.shadow.map?y.shadow.map.texture:null;if(y.isAmbientLight)s+=E.r*x,o+=E.g*x,a+=E.b*x;else if(y.isLightProbe){for(let e=0;e<9;e++)i.probe[e].addScaledVector(y.sh.coefficients[e],x);v++}else if(y.isDirectionalLight){const e=t.get(y);if(e.color.copy(y.color).multiplyScalar(y.intensity),y.castShadow){const e=y.shadow,t=n.get(y);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,i.directionalShadow[l]=t,i.directionalShadowMap[l]=C,i.directionalShadowMatrix[l]=y.shadow.matrix,p++}i.directional[l]=e,l++}else if(y.isSpotLight){const e=t.get(y);e.position.setFromMatrixPosition(y.matrixWorld),e.color.copy(E).multiplyScalar(x),e.distance=b,e.coneCos=Math.cos(y.angle),e.penumbraCos=Math.cos(y.angle*(1-y.penumbra)),e.decay=y.decay,i.spot[h]=e;const r=y.shadow;if(y.map&&(i.spotLightMap[m]=y.map,m++,r.updateMatrices(y),y.castShadow&&g++),i.spotLightMatrix[h]=r.matrix,y.castShadow){const e=n.get(y);e.shadowIntensity=r.intensity,e.shadowBias=r.bias,e.shadowNormalBias=r.normalBias,e.shadowRadius=r.radius,e.shadowMapSize=r.mapSize,i.spotShadow[h]=e,i.spotShadowMap[h]=C,f++}h++}else if(y.isRectAreaLight){const e=t.get(y);e.color.copy(E).multiplyScalar(x),e.halfWidth.set(.5*y.width,0,0),e.halfHeight.set(0,.5*y.height,0),i.rectArea[d]=e,d++}else if(y.isPointLight){const e=t.get(y);if(e.color.copy(y.color).multiplyScalar(y.intensity),e.distance=y.distance,e.decay=y.decay,y.castShadow){const e=y.shadow,t=n.get(y);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,i.pointShadow[c]=t,i.pointShadowMap[c]=C,i.pointShadowMatrix[c]=y.shadow.matrix,A++}i.point[c]=e,c++}else if(y.isHemisphereLight){const e=t.get(y);e.skyColor.copy(y.color).multiplyScalar(x),e.groundColor.copy(y.groundColor).multiplyScalar(x),i.hemi[u]=e,u++}}d>0&&(!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=_u.LTC_FLOAT_1,i.rectAreaLTC2=_u.LTC_FLOAT_2):(i.rectAreaLTC1=_u.LTC_HALF_1,i.rectAreaLTC2=_u.LTC_HALF_2)),i.ambient[0]=s,i.ambient[1]=o,i.ambient[2]=a;const y=i.hash;y.directionalLength===l&&y.pointLength===c&&y.spotLength===h&&y.rectAreaLength===d&&y.hemiLength===u&&y.numDirectionalShadows===p&&y.numPointShadows===A&&y.numSpotShadows===f&&y.numSpotMaps===m&&y.numLightProbes===v||(i.directional.length=l,i.spot.length=h,i.rectArea.length=d,i.point.length=c,i.hemi.length=u,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=A,i.pointShadowMap.length=A,i.spotShadow.length=f,i.spotShadowMap.length=f,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=A,i.spotLightMatrix.length=f+m-g,i.spotLightMap.length=m,i.numSpotLightShadowsWithMaps=g,i.numLightProbes=v,y.directionalLength=l,y.pointLength=c,y.spotLength=h,y.rectAreaLength=d,y.hemiLength=u,y.numDirectionalShadows=p,y.numPointShadows=A,y.numSpotShadows=f,y.numSpotMaps=m,y.numLightProbes=v,i.version=NA++)},setupView:function(e,t){let n=0,a=0,l=0,c=0,h=0;const d=t.matrixWorldInverse;for(let t=0,u=e.length;t<u;t++){const u=e[t];if(u.isDirectionalLight){const e=i.directional[n];e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(d),n++}else if(u.isSpotLight){const e=i.spot[l];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(d),e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(d),l++}else if(u.isRectAreaLight){const e=i.rectArea[c];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(d),o.identity(),s.copy(u.matrixWorld),s.premultiply(d),o.extractRotation(s),e.halfWidth.set(.5*u.width,0,0),e.halfHeight.set(0,.5*u.height,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),c++}else if(u.isPointLight){const e=i.point[a];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(d),a++}else if(u.isHemisphereLight){const e=i.hemi[h];e.direction.setFromMatrixPosition(u.matrixWorld),e.direction.transformDirection(d),h++}}},state:i}}function zA(e){const t=new GA(e),n=[],i=[],r={lightsArray:n,shadowsArray:i,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){r.camera=e,n.length=0,i.length=0},state:r,setupLights:function(){t.setup(n)},setupLightsView:function(e){t.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){i.push(e)}}}function HA(e){let t=new WeakMap;return{get:function(n,i=0){const r=t.get(n);let s;return void 0===r?(s=new zA(e),t.set(n,[s])):i>=r.length?(s=new zA(e),r.push(s)):s=r[i],s},dispose:function(){t=new WeakMap}}}function VA(e,t,n){let i=new oa;const r=new ti,s=new ti,o=new wi,a=new Rc({depthPacking:Yt}),l=new Lc,c={},h=n.maxTextureSize,d={[m]:g,[g]:m,[v]:v},u=new Xs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ti},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),A=u.clone();A.defines.HORIZONTAL_PASS=1;const E=new Bs;E.setAttribute("position",new us(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Gs(E,u),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=p;let C=this.type;function w(n,i){const s=t.update(x);u.defines.VSM_SAMPLES!==n.blurSamples&&(u.defines.VSM_SAMPLES=n.blurSamples,A.defines.VSM_SAMPLES=n.blurSamples,u.needsUpdate=!0,A.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Mi(r.x,r.y)),u.uniforms.shadow_pass.value=n.map.texture,u.uniforms.resolution.value=n.mapSize,u.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,s,u,x,null),A.uniforms.shadow_pass.value=n.mapPass.texture,A.uniforms.resolution.value=n.mapSize,A.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,s,A,x,null)}function _(t,n,i,r){let s=null;const o=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)s=o;else if(s=!0===i.isPointLight?l:a,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const e=s.uuid,t=n.uuid;let i=c[e];void 0===i&&(i={},c[e]=i);let r=i[t];void 0===r&&(r=s.clone(),i[t]=r,n.addEventListener("dispose",S)),s=r}return s.visible=n.visible,s.wireframe=n.wireframe,s.side=r===f?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:d[n.side],s.alphaMap=n.alphaMap,s.alphaTest=n.alphaTest,s.map=n.map,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.displacementMap=n.displacementMap,s.displacementScale=n.displacementScale,s.displacementBias=n.displacementBias,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===i.isPointLight&&!0===s.isMeshDistanceMaterial&&(e.properties.get(s).light=i),s}function M(n,r,s,o,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===f)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=t.update(n),l=n.material;if(Array.isArray(l)){const t=i.groups;for(let c=0,h=t.length;c<h;c++){const h=t[c],d=l[h.materialIndex];if(d&&d.visible){const t=_(n,d,o,a);n.onBeforeShadow(e,n,r,s,i,t,h),e.renderBufferDirect(s,null,i,t,n,h),n.onAfterShadow(e,n,r,s,i,t,h)}}}else if(l.visible){const t=_(n,l,o,a);n.onBeforeShadow(e,n,r,s,i,t,null),e.renderBufferDirect(s,null,i,t,n,null),n.onAfterShadow(e,n,r,s,i,t,null)}}const l=n.children;for(let e=0,t=l.length;e<t;e++)M(l[e],r,s,o,a)}function S(e){e.target.removeEventListener("dispose",S);for(const t in c){const n=c[t],i=e.target.uuid;i in n&&(n[i].dispose(),delete n[i])}}this.render=function(t,n,a){if(!1===b.enabled)return;if(!1===b.autoUpdate&&!1===b.needsUpdate)return;if(0===t.length)return;const l=e.getRenderTarget(),c=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),u=e.state;u.setBlending(y),u.buffers.color.setClear(1,1,1,1),u.buffers.depth.setTest(!0),u.setScissorTest(!1);const p=C!==f&&this.type===f,A=C===f&&this.type!==f;for(let l=0,c=t.length;l<c;l++){const c=t[l],d=c.shadow;if(void 0===d){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===d.autoUpdate&&!1===d.needsUpdate)continue;r.copy(d.mapSize);const m=d.getFrameExtents();if(r.multiply(m),s.copy(d.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/m.x),r.x=s.x*m.x,d.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/m.y),r.y=s.y*m.y,d.mapSize.y=s.y)),null===d.map||!0===p||!0===A){const e=this.type!==f?{minFilter:xe,magFilter:xe}:{};null!==d.map&&d.map.dispose(),d.map=new Mi(r.x,r.y,e),d.map.texture.name=c.name+".shadowMap",d.camera.updateProjectionMatrix()}e.setRenderTarget(d.map),e.clear();const g=d.getViewportCount();for(let e=0;e<g;e++){const t=d.getViewport(e);o.set(s.x*t.x,s.y*t.y,s.x*t.z,s.y*t.w),u.viewport(o),d.updateMatrices(c,e),i=d.getFrustum(),M(n,a,d.camera,c,this.type)}!0!==d.isPointLightShadow&&this.type===f&&w(d,a),d.needsUpdate=!1}C=this.type,b.needsUpdate=!1,e.setRenderTarget(l,c,d)}}const jA={[j]:W,[q]:K,[Y]:Z,[X]:J,[W]:j,[K]:q,[Z]:Y,[J]:X};function WA(e,t){const n=new function(){let t=!1;const n=new wi;let i=null;const r=new wi(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,s,o,a){!0===a&&(t*=o,i*=o,s*=o),n.set(t,i,s,o),!1===r.equals(n)&&(e.clearColor(t,i,s,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},i=new function(){let n=!1,i=!1,r=null,s=null,o=null;return{setReversed:function(e){if(i!==e){const e=t.get("EXT_clip_control");i?e.clipControlEXT(e.LOWER_LEFT_EXT,e.ZERO_TO_ONE_EXT):e.clipControlEXT(e.LOWER_LEFT_EXT,e.NEGATIVE_ONE_TO_ONE_EXT);const n=o;o=null,this.setClear(n)}i=e},getReversed:function(){return i},setTest:function(t){t?_e(e.DEPTH_TEST):Me(e.DEPTH_TEST)},setMask:function(t){r===t||n||(e.depthMask(t),r=t)},setFunc:function(t){if(i&&(t=jA[t]),s!==t){switch(t){case j:e.depthFunc(e.NEVER);break;case W:e.depthFunc(e.ALWAYS);break;case q:e.depthFunc(e.LESS);break;case X:e.depthFunc(e.LEQUAL);break;case Y:e.depthFunc(e.EQUAL);break;case J:e.depthFunc(e.GEQUAL);break;case K:e.depthFunc(e.GREATER);break;case Z:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}s=t}},setLocked:function(e){n=e},setClear:function(t){o!==t&&(i&&(t=1-t),e.clearDepth(t),o=t)},reset:function(){n=!1,r=null,s=null,o=null,i=!1}}},r=new function(){let t=!1,n=null,i=null,r=null,s=null,o=null,a=null,l=null,c=null;return{setTest:function(n){t||(n?_e(e.STENCIL_TEST):Me(e.STENCIL_TEST))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&s===o||(e.stencilFunc(t,n,o),i=t,r=n,s=o)},setOp:function(t,n,i){o===t&&a===n&&l===i||(e.stencilOp(t,n,i),o=t,a=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,s=null,o=null,a=null,l=null,c=null}}},s=new WeakMap,o=new WeakMap;let a={},d={},u=new WeakMap,p=[],A=null,f=!1,m=null,$=null,ee=null,te=null,ne=null,ie=null,re=null,se=new es(0,0,0),oe=0,ae=!1,le=null,ce=null,he=null,de=null,ue=null;const pe=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Ae=!1,fe=0;const me=e.getParameter(e.VERSION);-1!==me.indexOf("WebGL")?(fe=parseFloat(/^WebGL (\d)/.exec(me)[1]),Ae=fe>=1):-1!==me.indexOf("OpenGL ES")&&(fe=parseFloat(/^OpenGL ES (\d)/.exec(me)[1]),Ae=fe>=2);let ge=null,ve={};const ye=e.getParameter(e.SCISSOR_BOX),Ee=e.getParameter(e.VIEWPORT),xe=(new wi).fromArray(ye),be=(new wi).fromArray(Ee);function Ce(t,n,i,r){const s=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o<i;o++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,s):e.texImage2D(n+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,s);return o}const we={};function _e(t){!0!==a[t]&&(e.enable(t),a[t]=!0)}function Me(t){!1!==a[t]&&(e.disable(t),a[t]=!1)}we[e.TEXTURE_2D]=Ce(e.TEXTURE_2D,e.TEXTURE_2D,1),we[e.TEXTURE_CUBE_MAP]=Ce(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),we[e.TEXTURE_2D_ARRAY]=Ce(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),we[e.TEXTURE_3D]=Ce(e.TEXTURE_3D,e.TEXTURE_3D,1,1),n.setClear(0,0,0,1),i.setClear(1),r.setClear(0),_e(e.DEPTH_TEST),i.setFunc(X),Te(!1),Re(c),_e(e.CULL_FACE),Be(y);const Se={[_]:e.FUNC_ADD,[M]:e.FUNC_SUBTRACT,[S]:e.FUNC_REVERSE_SUBTRACT};Se[I]=e.MIN,Se[B]=e.MAX;const Ie={[T]:e.ZERO,[R]:e.ONE,[L]:e.SRC_COLOR,[P]:e.SRC_ALPHA,[Q]:e.SRC_ALPHA_SATURATE,[k]:e.DST_COLOR,[O]:e.DST_ALPHA,[D]:e.ONE_MINUS_SRC_COLOR,[U]:e.ONE_MINUS_SRC_ALPHA,[N]:e.ONE_MINUS_DST_COLOR,[F]:e.ONE_MINUS_DST_ALPHA,[G]:e.CONSTANT_COLOR,[z]:e.ONE_MINUS_CONSTANT_COLOR,[H]:e.CONSTANT_ALPHA,[V]:e.ONE_MINUS_CONSTANT_ALPHA};function Be(t,n,i,r,s,o,a,l,c,h){if(t!==y){if(!1===f&&(_e(e.BLEND),f=!0),t===w)s=s||n,o=o||i,a=a||r,n===$&&s===ne||(e.blendEquationSeparate(Se[n],Se[s]),$=n,ne=s),i===ee&&r===te&&o===ie&&a===re||(e.blendFuncSeparate(Ie[i],Ie[r],Ie[o],Ie[a]),ee=i,te=r,ie=o,re=a),!1!==l.equals(se)&&c===oe||(e.blendColor(l.r,l.g,l.b,c),se.copy(l),oe=c),m=t,ae=!1;else if(t!==m||h!==ae){if($===_&&ne===_||(e.blendEquation(e.FUNC_ADD),$=_,ne=_),h)switch(t){case E:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case x:e.blendFunc(e.ONE,e.ONE);break;case b:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case C:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case E:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case x:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case b:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case C:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}ee=null,te=null,ie=null,re=null,se.set(0,0,0),oe=0,m=t,ae=h}}else!0===f&&(Me(e.BLEND),f=!1)}function Te(t){le!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),le=t)}function Re(t){t!==l?(_e(e.CULL_FACE),t!==ce&&(t===c?e.cullFace(e.BACK):t===h?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):Me(e.CULL_FACE),ce=t}function Le(t,n,i){t?(_e(e.POLYGON_OFFSET_FILL),de===n&&ue===i||(e.polygonOffset(n,i),de=n,ue=i)):Me(e.POLYGON_OFFSET_FILL)}return{buffers:{color:n,depth:i,stencil:r},enable:_e,disable:Me,bindFramebuffer:function(t,n){return d[t]!==n&&(e.bindFramebuffer(t,n),d[t]=n,t===e.DRAW_FRAMEBUFFER&&(d[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(d[e.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(t,n){let i=p,r=!1;if(t){i=u.get(n),void 0===i&&(i=[],u.set(n,i));const s=t.textures;if(i.length!==s.length||i[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=s.length;t<n;t++)i[t]=e.COLOR_ATTACHMENT0+t;i.length=s.length,r=!0}}else i[0]!==e.BACK&&(i[0]=e.BACK,r=!0);r&&e.drawBuffers(i)},useProgram:function(t){return A!==t&&(e.useProgram(t),A=t,!0)},setBlending:Be,setMaterial:function(t,s){t.side===v?Me(e.CULL_FACE):_e(e.CULL_FACE);let o=t.side===g;s&&(o=!o),Te(o),t.blending===E&&!1===t.transparent?Be(y):Be(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),i.setFunc(t.depthFunc),i.setTest(t.depthTest),i.setMask(t.depthWrite),n.setMask(t.colorWrite);const a=t.stencilWrite;r.setTest(a),a&&(r.setMask(t.stencilWriteMask),r.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),r.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),Le(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?_e(e.SAMPLE_ALPHA_TO_COVERAGE):Me(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:Te,setCullFace:Re,setLineWidth:function(t){t!==he&&(Ae&&e.lineWidth(t),he=t)},setPolygonOffset:Le,setScissorTest:function(t){t?_e(e.SCISSOR_TEST):Me(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+pe-1),ge!==t&&(e.activeTexture(t),ge=t)},bindTexture:function(t,n,i){void 0===i&&(i=null===ge?e.TEXTURE0+pe-1:ge);let r=ve[i];void 0===r&&(r={type:void 0,texture:void 0},ve[i]=r),r.type===t&&r.texture===n||(ge!==i&&(e.activeTexture(i),ge=i),e.bindTexture(t,n||we[t]),r.type=t,r.texture=n)},unbindTexture:function(){const t=ve[ge];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){let i=o.get(n);void 0===i&&(i=new WeakMap,o.set(n,i));let r=i.get(t);void 0===r&&(r=e.getUniformBlockIndex(n,t.name),i.set(t,r))},uniformBlockBinding:function(t,n){const i=o.get(n).get(t);s.get(n)!==i&&(e.uniformBlockBinding(n,i,t.__bindingPointIndex),s.set(n,i))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===xe.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),xe.copy(t))},viewport:function(t){!1===be.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),be.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),i.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),a={},ge=null,ve={},d={},u=new WeakMap,p=[],A=null,f=!1,m=null,$=null,ee=null,te=null,ne=null,ie=null,re=null,se=new es(0,0,0),oe=0,ae=!1,le=null,ce=null,he=null,de=null,ue=null,xe.set(0,0,e.canvas.width,e.canvas.height),be.set(0,0,e.canvas.width,e.canvas.height),n.reset(),i.reset(),r.reset()}}}function qA(e,t,n,i,r,s,o){const a=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=t.has("OCULUS_multiview")?t.get("OCULUS_multiview"):null,h=new ti,d=new WeakMap;let u;const p=new WeakMap;let A=[],f=!1,m=!1;try{m="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function g(e,t){return m?new OffscreenCanvas(e,t):ai("canvas")}function v(e,t,n){let i=1;const r=W(e);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(i*r.width),s=Math.floor(i*r.height);void 0===u&&(u=g(n,s));const o=t?g(n,s):u;return o.width=n,o.height=s,o.getContext("2d").drawImage(e,0,0,n,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+s+")."),o}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),e}return e}function y(e){return e.generateMipmaps}function E(t){e.generateMipmap(t)}function x(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function b(n,i,r,s,o=!1){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 a=i;if(i===e.RED&&(r===e.FLOAT&&(a=e.R32F),r===e.HALF_FLOAT&&(a=e.R16F),r===e.UNSIGNED_BYTE&&(a=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(a=e.R8UI),r===e.UNSIGNED_SHORT&&(a=e.R16UI),r===e.UNSIGNED_INT&&(a=e.R32UI),r===e.BYTE&&(a=e.R8I),r===e.SHORT&&(a=e.R16I),r===e.INT&&(a=e.R32I)),i===e.RG&&(r===e.FLOAT&&(a=e.RG32F),r===e.HALF_FLOAT&&(a=e.RG16F),r===e.UNSIGNED_BYTE&&(a=e.RG8)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(a=e.RG8UI),r===e.UNSIGNED_SHORT&&(a=e.RG16UI),r===e.UNSIGNED_INT&&(a=e.RG32UI),r===e.BYTE&&(a=e.RG8I),r===e.SHORT&&(a=e.RG16I),r===e.INT&&(a=e.RG32I)),i===e.RGB_INTEGER&&(r===e.UNSIGNED_BYTE&&(a=e.RGB8UI),r===e.UNSIGNED_SHORT&&(a=e.RGB16UI),r===e.UNSIGNED_INT&&(a=e.RGB32UI),r===e.BYTE&&(a=e.RGB8I),r===e.SHORT&&(a=e.RGB16I),r===e.INT&&(a=e.RGB32I)),i===e.RGBA_INTEGER&&(r===e.UNSIGNED_BYTE&&(a=e.RGBA8UI),r===e.UNSIGNED_SHORT&&(a=e.RGBA16UI),r===e.UNSIGNED_INT&&(a=e.RGBA32UI),r===e.BYTE&&(a=e.RGBA8I),r===e.SHORT&&(a=e.RGBA16I),r===e.INT&&(a=e.RGBA32I)),i===e.RGB&&r===e.UNSIGNED_INT_5_9_9_9_REV&&(a=e.RGB9_E5),i===e.RGBA){const t=o?rn:Ai.getTransfer(s);r===e.FLOAT&&(a=e.RGBA32F),r===e.HALF_FLOAT&&(a=e.RGBA16F),r===e.UNSIGNED_BYTE&&(a=t===sn?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(a=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(a=e.RGB5_A1)}return a!==e.R16F&&a!==e.R32F&&a!==e.RG16F&&a!==e.RG32F&&a!==e.RGBA16F&&a!==e.RGBA32F||t.get("EXT_color_buffer_float"),a}function C(t,n){let i;return t?null===n||n===Oe||n===Ge?i=e.DEPTH24_STENCIL8:n===Fe?i=e.DEPTH32F_STENCIL8:n===Pe&&(i=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===Oe||n===Ge?i=e.DEPTH_COMPONENT24:n===Fe?i=e.DEPTH_COMPONENT32F:n===Pe&&(i=e.DEPTH_COMPONENT16),i}function w(e,t){return!0===y(e)||e.isFramebufferTexture&&e.minFilter!==xe&&e.minFilter!==Me?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function _(e){const t=e.target;t.removeEventListener("dispose",_),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=p.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&S(e),0===Object.keys(r).length&&p.delete(n)}i.remove(e)}(t),t.isVideoTexture&&d.delete(t)}function M(t){const n=t.target;n.removeEventListener("dispose",M),function(t){const n=i.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),i.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let i=0;i<n.__webglFramebuffer[t].length;i++)e.deleteFramebuffer(n.__webglFramebuffer[t][i]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=t.textures;for(let t=0,n=r.length;t<n;t++){const n=i.get(r[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),o.memory.textures--),i.remove(r[t])}i.remove(t)}(n)}function S(t){const n=i.get(t);e.deleteTexture(n.__webglTexture);const r=t.source;delete p.get(r)[n.__cacheKey],o.memory.textures--}let I=0;function B(t,r){const s=i.get(t);if(t.isVideoTexture&&function(e){const t=o.render.frame;d.get(e)!==t&&(d.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&s.__version!==t.version){const e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===e.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else if(O(s,t,r))return}n.bindTexture(e.TEXTURE_2D,s.__webglTexture,e.TEXTURE0+r)}function T(t,r){const s=i.get(t);t.version>0&&s.__version!==t.version?O(s,t,r):n.bindTexture(e.TEXTURE_2D_ARRAY,s.__webglTexture,e.TEXTURE0+r)}const R={[ve]:e.REPEAT,[ye]:e.CLAMP_TO_EDGE,[Ee]:e.MIRRORED_REPEAT},L={[xe]:e.NEAREST,[be]:e.NEAREST_MIPMAP_NEAREST,[we]:e.NEAREST_MIPMAP_LINEAR,[Me]:e.LINEAR,[Se]:e.LINEAR_MIPMAP_NEAREST,[Be]:e.LINEAR_MIPMAP_LINEAR},D={[bn]:e.NEVER,[Bn]:e.ALWAYS,[Cn]:e.LESS,[_n]:e.LEQUAL,[wn]:e.EQUAL,[In]:e.GEQUAL,[Mn]:e.GREATER,[Sn]:e.NOTEQUAL};function P(n,s){if(s.type!==Fe||!1!==t.has("OES_texture_float_linear")||s.magFilter!==Me&&s.magFilter!==Se&&s.magFilter!==we&&s.magFilter!==Be&&s.minFilter!==Me&&s.minFilter!==Se&&s.minFilter!==we&&s.minFilter!==Be||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,R[s.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,R[s.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,R[s.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,L[s.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,L[s.minFilter]),s.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,D[s.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(s.magFilter===xe)return;if(s.minFilter!==we&&s.minFilter!==Be)return;if(s.type===Fe&&!1===t.has("OES_texture_float_linear"))return;if(s.anisotropy>1||i.get(s).__currentAnisotropy){const o=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy}}}function U(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",_));const r=n.source;let s=p.get(r);void 0===s&&(s={},p.set(r,s));const a=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(a!==t.__cacheKey){void 0===s[a]&&(s[a]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,i=!0),s[a].usedTimes++;const r=s[t.__cacheKey];void 0!==r&&(s[t.__cacheKey].usedTimes--,0===r.usedTimes&&S(n)),t.__cacheKey=a,t.__webglTexture=s[a].texture}return i}function O(t,o,a){if(f)return o.isPendingDeferredUpload||(o.isPendingDeferredUpload=!0,A.push({textureProperties:t,texture:o,slot:a})),!1;let l=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(l=e.TEXTURE_3D);const c=U(t,o),h=o.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+a);const d=i.get(h);if(h.version!==d.__version||!0===c){n.activeTexture(e.TEXTURE0+a);const t=Ai.getPrimaries(Ai.workingColorSpace),i=o.colorSpace===en?null:Ai.getPrimaries(o.colorSpace),u=o.colorSpace===en||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);let p=v(o.image,!1,r.maxTextureSize);p=j(o,p);const A=s.convert(o.format,o.colorSpace),f=s.convert(o.type);let m,g=b(o.internalFormat,A,f,o.colorSpace,o.isVideoTexture);P(l,o);const x=o.mipmaps,_=!0!==o.isVideoTexture,M=void 0===d.__version||!0===c,S=h.dataReady,I=w(o,p);if(o.isDepthTexture)g=C(o.format===Ye,o.type),M&&(_?n.texStorage2D(e.TEXTURE_2D,1,g,p.width,p.height):n.texImage2D(e.TEXTURE_2D,0,g,p.width,p.height,0,A,f,null));else if(o.isDataTexture)if(x.length>0){_&&M&&n.texStorage2D(e.TEXTURE_2D,I,g,x[0].width,x[0].height);for(let t=0,i=x.length;t<i;t++)m=x[t],_?S&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,m.width,m.height,A,f,m.data):n.texImage2D(e.TEXTURE_2D,t,g,m.width,m.height,0,A,f,m.data);o.generateMipmaps=!1}else _?(M&&n.texStorage2D(e.TEXTURE_2D,I,g,p.width,p.height),S&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,p.width,p.height,A,f,p.data)):n.texImage2D(e.TEXTURE_2D,0,g,p.width,p.height,0,A,f,p.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){_&&M&&n.texStorage3D(e.TEXTURE_2D_ARRAY,I,g,x[0].width,x[0].height,p.depth);for(let t=0,i=x.length;t<i;t++)if(m=x[t],o.format!==je)if(null!==A)if(_){if(S)if(o.layerUpdates.size>0){const i=yu(m.width,m.height,o.format,o.type);for(const r of o.layerUpdates){const s=m.data.subarray(r*i/m.data.BYTES_PER_ELEMENT,(r+1)*i/m.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,r,m.width,m.height,1,A,s)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,m.width,m.height,p.depth,A,m.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,g,m.width,m.height,p.depth,0,m.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else _?S&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,m.width,m.height,p.depth,A,f,m.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,g,m.width,m.height,p.depth,0,A,f,m.data)}else{_&&M&&n.texStorage2D(e.TEXTURE_2D,I,g,x[0].width,x[0].height);for(let t=0,i=x.length;t<i;t++)m=x[t],o.format!==je?null!==A?_?S&&n.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,m.width,m.height,A,m.data):n.compressedTexImage2D(e.TEXTURE_2D,t,g,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_?S&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,m.width,m.height,A,f,m.data):n.texImage2D(e.TEXTURE_2D,t,g,m.width,m.height,0,A,f,m.data)}else if(o.isDataArrayTexture)if(_){if(M&&n.texStorage3D(e.TEXTURE_2D_ARRAY,I,g,p.width,p.height,p.depth),S)if(o.layerUpdates.size>0){const t=yu(p.width,p.height,o.format,o.type);for(const i of o.layerUpdates){const r=p.data.subarray(i*t/p.data.BYTES_PER_ELEMENT,(i+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,i,p.width,p.height,1,A,f,r)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,A,f,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,g,p.width,p.height,p.depth,0,A,f,p.data);else if(o.isData3DTexture)_?(M&&n.texStorage3D(e.TEXTURE_3D,I,g,p.width,p.height,p.depth),S&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,A,f,p.data)):n.texImage3D(e.TEXTURE_3D,0,g,p.width,p.height,p.depth,0,A,f,p.data);else if(o.isFramebufferTexture){if(M)if(_)n.texStorage2D(e.TEXTURE_2D,I,g,p.width,p.height);else{let t=p.width,i=p.height;for(let r=0;r<I;r++)n.texImage2D(e.TEXTURE_2D,r,g,t,i,0,A,f,null),t>>=1,i>>=1}}else if(x.length>0){if(_&&M){const t=W(x[0]);n.texStorage2D(e.TEXTURE_2D,I,g,t.width,t.height)}for(let t=0,i=x.length;t<i;t++)m=x[t],_?S&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,A,f,m):n.texImage2D(e.TEXTURE_2D,t,g,A,f,m);o.generateMipmaps=!1}else if(_){if(M){const t=W(p);n.texStorage2D(e.TEXTURE_2D,I,g,t.width,t.height)}S&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,A,f,p)}else n.texImage2D(e.TEXTURE_2D,0,g,A,f,p);y(o)&&E(l),d.__version=h.version,o.onUpdate&&o.onUpdate(o)}return t.__version=o.version,!0}function F(t,r,o,l,h,d){const u=s.convert(o.format,o.colorSpace),p=s.convert(o.type),A=b(o.internalFormat,u,p,o.colorSpace),f=i.get(r),m=i.get(o);if(m.__renderTarget=r,!f.__hasExternalTextures){const t=Math.max(1,r.width>>d),i=Math.max(1,r.height>>d);!0===r.isWebGLMultiviewRenderTarget?n.texStorage3D(e.TEXTURE_2D_ARRAY,0,A,r.width,r.height,r.numViews):h===e.TEXTURE_3D||h===e.TEXTURE_2D_ARRAY?n.texImage3D(h,d,A,t,i,r.depth,0,u,p,null):n.texImage2D(h,d,A,t,i,0,u,p,null)}n.bindFramebuffer(e.FRAMEBUFFER,t);const g=V(r);!0===r.isWebGLMultiviewRenderTarget?g?c.framebufferTextureMultisampleMultiviewOVR(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,m.__webglTexture,0,H(r),0,r.numViews):c.framebufferTextureMultiviewOVR(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,m.__webglTexture,0,0,r.numViews):(h===e.TEXTURE_2D||h>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&h<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&(g?a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,h,m.__webglTexture,0,H(r)):e.framebufferTexture2D(e.FRAMEBUFFER,l,h,m.__webglTexture,d)),n.bindFramebuffer(e.FRAMEBUFFER,null)}function k(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),!0===n.isWebGLMultiviewRenderTarget){const t=V(n),r=n.numViews,s=n.depthTexture;let o=e.DEPTH_COMPONENT24,a=e.DEPTH_ATTACHMENT;s&&s.isDepthTexture&&(s.type===Fe?o=e.DEPTH_COMPONENT32F:s.type===Ge&&(o=e.DEPTH24_STENCIL8,a=e.DEPTH_STENCIL_ATTACHMENT));let l=i.get(n.depthTexture).__webglTexture;void 0===l&&(l=e.createTexture(),e.bindTexture(e.TEXTURE_2D_ARRAY,l),e.texStorage3D(e.TEXTURE_2D_ARRAY,1,o,n.width,n.height,r)),t?c.framebufferTextureMultisampleMultiviewOVR(e.FRAMEBUFFER,a,l,0,H(n),0,r):c.framebufferTextureMultiviewOVR(e.FRAMEBUFFER,a,l,0,0,r)}else if(n.depthBuffer&&!n.stencilBuffer){const i=n.depthTexture,s=i&&i.isDepthTexture?i.type:null,o=C(n.stencilBuffer,s),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=H(n);V(n)?a.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{const t=n.textures;for(let i=0;i<t.length;i++){const o=t[i],l=s.convert(o.format,o.colorSpace),c=s.convert(o.type),h=b(o.internalFormat,l,c,o.colorSpace),d=H(n);r&&!1===V(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,d,h,n.width,n.height):V(n)?a.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,d,h,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,h,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function N(t,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,t),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const s=i.get(r.depthTexture);s.__renderTarget=r,s.__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),B(r.depthTexture,0),1!=r.depthTexture.image.depth?T(r.depthTexture,0):B(r.depthTexture,0);const o=s.__webglTexture,l=H(r);if(!0===r.isWebGLMultiviewRenderTarget){const t=V(r),n=r.numViews;if(r.depthTexture.format===Xe)t?c.framebufferTextureMultisampleMultiviewOVR(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,o,0,l,0,n):c.framebufferTextureMultiviewOVR(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,o,0,0,n);else{if(r.depthTexture.format!==Ye)throw new Error("Unknown depthTexture format");t?c.framebufferTextureMultisampleMultiviewOVR(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,o,0,l,0,n):c.framebufferTextureMultiviewOVR(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,o,0,0,n)}}else if(r.depthTexture.format===Xe)V(r)?a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,o,0,l):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,o,0);else{if(r.depthTexture.format!==Ye)throw new Error("Unknown depthTexture format");V(r)?a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,o,0,l):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,o,0)}}function Q(t){const r=i.get(t),s=!0===t.isWebGLCubeRenderTarget;if(r.__boundDepthTexture!==t.depthTexture){const e=t.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),e){const t=()=>{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),r.__depthDisposeCallback=t}r.__boundDepthTexture=e}if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(s)throw new Error("target.depthTexture not supported in Cube render targets");N(r.__webglFramebuffer,t)}else if(s){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[i]),void 0===r.__webglDepthbuffer[i])r.__webglDepthbuffer[i]=e.createRenderbuffer(),k(r.__webglDepthbuffer[i],t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,s=r.__webglDepthbuffer[i];e.bindRenderbuffer(e.RENDERBUFFER,s),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,s)}}else if(n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=e.createRenderbuffer(),k(r.__webglDepthbuffer,t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,i=r.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,i)}n.bindFramebuffer(e.FRAMEBUFFER,null)}const G=[],z=[];function H(e){return Math.min(r.maxSamples,e.samples)}function V(e){const n=i.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function j(e,t){const n=e.colorSpace,i=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==nn&&n!==en&&(Ai.getTransfer(n)===sn?i===je&&r===Re||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function W(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(h.width=e.naturalWidth||e.width,h.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(h.width=e.displayWidth,h.height=e.displayHeight):(h.width=e.width,h.height=e.height),h}this.allocateTextureUnit=function(){const e=I;return e>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),I+=1,e},this.resetTextureUnits=function(){I=0},this.setTexture2D=B,this.setTexture2DArray=T,this.setTexture3D=function(t,r){const s=i.get(t);t.version>0&&s.__version!==t.version?O(s,t,r):n.bindTexture(e.TEXTURE_3D,s.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,o){const a=i.get(t);t.version>0&&a.__version!==t.version?function(t,o,a){if(6!==o.image.length)return;const l=U(t,o),c=o.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+a);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(e.TEXTURE0+a);const t=Ai.getPrimaries(Ai.workingColorSpace),i=o.colorSpace===en?null:Ai.getPrimaries(o.colorSpace),d=o.colorSpace===en||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);const u=o.isCompressedTexture||o.image[0].isCompressedTexture,p=o.image[0]&&o.image[0].isDataTexture,A=[];for(let e=0;e<6;e++)A[e]=u||p?p?o.image[e].image:o.image[e]:v(o.image[e],!0,r.maxCubemapSize),A[e]=j(o,A[e]);const f=A[0],m=s.convert(o.format,o.colorSpace),g=s.convert(o.type),x=b(o.internalFormat,m,g,o.colorSpace),C=!0!==o.isVideoTexture,_=void 0===h.__version||!0===l,M=c.dataReady;let S,I=w(o,f);if(P(e.TEXTURE_CUBE_MAP,o),u){C&&_&&n.texStorage2D(e.TEXTURE_CUBE_MAP,I,x,f.width,f.height);for(let t=0;t<6;t++){S=A[t].mipmaps;for(let i=0;i<S.length;i++){const r=S[i];o.format!==je?null!==m?C?M&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,m,r.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,x,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):C?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,m,g,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,x,r.width,r.height,0,m,g,r.data)}}}else{if(S=o.mipmaps,C&&_){S.length>0&&I++;const t=W(A[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,I,x,t.width,t.height)}for(let t=0;t<6;t++)if(p){C?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,A[t].width,A[t].height,m,g,A[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,x,A[t].width,A[t].height,0,m,g,A[t].data);for(let i=0;i<S.length;i++){const r=S[i].image[t].image;C?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,r.width,r.height,m,g,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,x,r.width,r.height,0,m,g,r.data)}}else{C?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m,g,A[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,x,m,g,A[t]);for(let i=0;i<S.length;i++){const r=S[i];C?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,m,g,r.image[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,x,m,g,r.image[t])}}}y(o)&&E(e.TEXTURE_CUBE_MAP),h.__version=c.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}(a,t,o):n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+o)},this.rebindTextures=function(t,n,r){const s=i.get(t);void 0!==n&&F(s.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&Q(t)},this.uploadTexture=O,this.setupRenderTarget=function(t){const r=t.texture,a=i.get(t),l=i.get(r);t.addEventListener("dispose",M);const c=t.textures,h=!0===t.isWebGLCubeRenderTarget,d=c.length>1;if(d||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,o.memory.textures++),h){a.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){a.__webglFramebuffer[t]=[];for(let n=0;n<r.mipmaps.length;n++)a.__webglFramebuffer[t][n]=e.createFramebuffer()}else a.__webglFramebuffer[t]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){a.__webglFramebuffer=[];for(let t=0;t<r.mipmaps.length;t++)a.__webglFramebuffer[t]=e.createFramebuffer()}else a.__webglFramebuffer=e.createFramebuffer();if(d)for(let t=0,n=c.length;t<n;t++){const n=i.get(c[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),o.memory.textures++)}if(t.samples>0&&!1===V(t)){a.__webglMultisampledFramebuffer=e.createFramebuffer(),a.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,a.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const i=c[n];a.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,a.__webglColorRenderbuffer[n]);const r=s.convert(i.format,i.colorSpace),o=s.convert(i.type),l=b(i.internalFormat,r,o,i.colorSpace,!0===t.isXRRenderTarget),h=H(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,h,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,a.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(a.__webglDepthRenderbuffer=e.createRenderbuffer(),k(a.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(h){n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),P(e.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)F(a.__webglFramebuffer[n][i],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else F(a.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);y(r)&&E(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(d){for(let r=0,s=c.length;r<s;r++){const s=c[r],o=i.get(s);n.bindTexture(e.TEXTURE_2D,o.__webglTexture),P(e.TEXTURE_2D,s),F(a.__webglFramebuffer,t,s,e.COLOR_ATTACHMENT0+r,e.TEXTURE_2D,0),y(s)&&E(e.TEXTURE_2D)}n.unbindTexture()}else{let i=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(i=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),!0===t.isWebGLMultiviewRenderTarget&&(i=e.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),P(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)F(a.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,i,n);else F(a.__webglFramebuffer,t,r,e.COLOR_ATTACHMENT0,i,0);y(r)&&E(i),n.unbindTexture()}(t.depthBuffer||!0===t.isWebGLMultiviewRenderTarget)&&this.setupDepthRenderbuffer(t)},this.updateRenderTargetMipmap=function(e){const t=e.textures;for(let r=0,s=t.length;r<s;r++){const s=t[r];if(y(s)){const t=x(e),r=i.get(s).__webglTexture;n.bindTexture(t,r),E(t),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0)if(!1===V(t)){const r=t.textures,s=t.width,o=t.height;let a=e.COLOR_BUFFER_BIT;const c=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=i.get(t),d=r.length>1;if(d)for(let t=0;t<r.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let n=0;n<r.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(a|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(a|=e.STENCIL_BUFFER_BIT)),d){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,h.__webglColorRenderbuffer[n]);const t=i.get(r[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,s,o,0,0,s,o,a,e.NEAREST),!0===l&&(G.length=0,z.length=0,G.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&!1===t.resolveDepthBuffer&&(G.push(c),z.push(c),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,z)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,G))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),d)for(let t=0;t<r.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,h.__webglColorRenderbuffer[t]);const s=i.get(r[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,s,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&l){const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}},this.setupDepthTexture=N,this.setupDepthRenderbuffer=Q,this.setupFrameBufferTexture=F,this.useMultisampledRTT=V,this.runDeferredUploads=function(){const e=f;f=!1;for(const e of A)O(e.textureProperties,e.texture,e.slot),e.texture.isPendingDeferredUpload=!1;A=[],f=e},this.setDeferTextureUploads=function(e){f=e}}function XA(e,t){return{convert:function(n,i=en){let r;const s=Ai.getTransfer(i);if(n===Re)return e.UNSIGNED_BYTE;if(n===Ne)return e.UNSIGNED_SHORT_4_4_4_4;if(n===Qe)return e.UNSIGNED_SHORT_5_5_5_1;if(n===ze)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===Le)return e.BYTE;if(n===De)return e.SHORT;if(n===Pe)return e.UNSIGNED_SHORT;if(n===Ue)return e.INT;if(n===Oe)return e.UNSIGNED_INT;if(n===Fe)return e.FLOAT;if(n===ke)return e.HALF_FLOAT;if(n===He)return e.ALPHA;if(n===Ve)return e.RGB;if(n===je)return e.RGBA;if(n===We)return e.LUMINANCE;if(n===qe)return e.LUMINANCE_ALPHA;if(n===Xe)return e.DEPTH_COMPONENT;if(n===Ye)return e.DEPTH_STENCIL;if(n===Je)return e.RED;if(n===Ke)return e.RED_INTEGER;if(n===Ze)return e.RG;if(n===$e)return e.RG_INTEGER;if(n===tt)return e.RGBA_INTEGER;if(n===nt||n===it||n===rt||n===st)if(s===sn){if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===nt)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===it)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===rt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===st)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=t.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===nt)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===it)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===rt)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===st)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===ot||n===at||n===lt||n===ct){if(r=t.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===ot)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===at)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===lt)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ct)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===ht||n===dt||n===ut){if(r=t.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===ht||n===dt)return s===sn?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===ut)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===pt||n===At||n===ft||n===mt||n===gt||n===vt||n===yt||n===Et||n===xt||n===bt||n===Ct||n===wt||n===_t||n===Mt){if(r=t.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===pt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===At)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ft)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===mt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===gt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===vt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===yt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Et)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===xt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===bt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ct)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===wt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===_t)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Mt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===St||n===It||n===Bt){if(r=t.get("EXT_texture_compression_bptc"),null===r)return null;if(n===St)return s===sn?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===It)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Bt)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===Tt||n===Rt||n===Lt||n===Dt){if(r=t.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===St)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Rt)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Lt)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Dt)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===Ge?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}class YA extends Mi{constructor(e,t,n,i={}){super(e,t,i),this.depthBuffer=!1,this.stencilBuffer=!1,this.numViews=n}copy(e){return super.copy(e),this.numViews=e.numViews,this}}YA.prototype.isWebGLMultiviewRenderTarget=!0;const JA={type:"move"};class KA{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Wa,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Wa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Li,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Li),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Wa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Li,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Li),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){s=!0;for(const i of e.hand.values()){const e=t.getJointPose(i,n),r=this._getHandJoint(l,i);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=i.position.distanceTo(r.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==a&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));null!==o&&(i=t.getPose(e.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(JA)))}return null!==o&&(o.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new Wa;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class ZA{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(null===this.texture){const i=new Ci;e.properties.get(i).__webglTexture=t.texture,t.depthNear==n.depthNear&&t.depthFar==n.depthFar||(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(null!==this.texture&&null===this.mesh){const t=e.cameras[0].viewport,n=new Xs({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Gs(new uc(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class $A extends Hn{constructor(e,t,n,i){super();const r=this;let s=null,o=1;var a=null;let l=null,c="local-floor",h=1,d=null,u=null;var p=[];let A=null,f=null,m=null,g=null;const v=new ZA,y=t.getContextAttributes();let E=null,x=null;const b=[],C=[],w=new ti;let _=null;const M=new $s;M.viewport=new wi;const S=new $s;S.viewport=new wi;const I=[M,S],B=new Jh;let T=null,R=null;function L(e){const t=C.indexOf(e.inputSource);if(-1===t)return;const n=b[t];void 0!==n&&(n.update(e.inputSource,e.frame,d||l),n.dispatchEvent({type:e.type,data:e.inputSource}))}function D(){s.removeEventListener("select",L),s.removeEventListener("selectstart",L),s.removeEventListener("selectend",L),s.removeEventListener("squeeze",L),s.removeEventListener("squeezestart",L),s.removeEventListener("squeezeend",L),s.removeEventListener("end",D),s.removeEventListener("inputsourceschange",P);for(let e=0;e<b.length;e++){const t=C[e];null!==t&&(C[e]=null,b[e].disconnect(t))}T=null,R=null,v.reset(),e.setRenderTarget(E),m=null,f=null,A=null,s=null,x=null,N.stop(),r.isPresenting=!1,e.setPixelRatio(_),e.setSize(w.width,w.height,!1),r.dispatchEvent({type:"sessionend"})}function P(e){for(let t=0;t<e.removed.length;t++){const n=e.removed[t],i=C.indexOf(n);i>=0&&(C[i]=null,b[i].disconnect(n))}for(let t=0;t<e.added.length;t++){const n=e.added[t];let i=C.indexOf(n);if(-1===i){for(let e=0;e<b.length;e++){if(e>=C.length){C.push(n),i=e;break}if(null===C[e]){C[e]=n,i=e;break}}if(-1===i)break}const r=b[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.layersEnabled=!1,this.enabled=!1,this.isPresenting=!1,this.isMultiview=!1,this.getCameraPose=function(){return u},this.getController=function(e){let t=b[e];return void 0===t&&(t=new KA,b[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=b[e];return void 0===t&&(t=new KA,b[e]=t),t.getGripSpace()},this.getHand=function(e){let t=b[e];return void 0===t&&(t=new KA,b[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){o=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){c=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||l},this.setReferenceSpace=function(e){d=e},this.getBaseLayer=function(){return null!==f?f:m},this.getBinding=function(){return A},this.getFrame=function(){return g},this.getSession=function(){return s},this.setSession=async function(a){if(s=a,null!==s){if(E=e.getRenderTarget(),s.addEventListener("select",L),s.addEventListener("selectstart",L),s.addEventListener("selectend",L),s.addEventListener("squeeze",L),s.addEventListener("squeezestart",L),s.addEventListener("squeezeend",L),s.addEventListener("end",D),s.addEventListener("inputsourceschange",P),!0!==y.xrCompatible&&await t.makeXRCompatible(),_=e.getPixelRatio(),e.getSize(w),void 0===s.renderState.layers){const n={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:o};m=new XRWebGLLayer(s,t,n),s.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),x=new Mi(m.framebufferWidth,m.framebufferHeight,{format:je,type:Re,colorSpace:e.outputColorSpace,stencilBuffer:y.stencil})}else{let a=null,l=null,c=null;y.depth&&(c=y.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,a=y.stencil?Ye:Xe,l=y.stencil?Ge:Oe),r.isMultiview=i&&n.has("OCULUS_multiview");const h={colorFormat:t.RGBA8,depthFormat:c,scaleFactor:o};r.isMultiview&&(h.textureType="texture-array"),A=new XRWebGLBinding(s,t),f=A.createProjectionLayer(h),s.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1);const d={format:je,type:Re,depthTexture:new $a(f.textureWidth,f.textureHeight,l,void 0,void 0,void 0,void 0,void 0,void 0,a),stencilBuffer:y.stencil,colorSpace:e.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:!1===f.ignoreDepthValues};if(r.isMultiview){const e=n.get("OCULUS_multiview");this.maxNumViews=t.getParameter(e.MAX_VIEWS_OVR),x=new YA(f.textureWidth,f.textureHeight,2,d)}else x=new Mi(f.textureWidth,f.textureHeight,d)}x.isXRRenderTarget=!0,this.setFoveation(h),d=null,l=await s.requestReferenceSpace(c),N.setContext(s),N.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==s)return s.environmentBlendMode},this.addLayer=function(e){window.XRWebGLBinding&&this.layersEnabled&&s&&(p.push(e),this.updateLayers())},this.removeLayer=function(e){p.splice(p.indexOf(e),1),window.XRWebGLBinding&&this.layersEnabled&&s&&this.updateLayers()},this.updateLayers=function(){var e=p.map((function(e){return e}));e.unshift(s.renderState.layers[0]),s.updateRenderState({layers:e})},this.getDepthTexture=function(){return v.getDepthTexture()};const U=new Li,O=new Li;function F(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.setPoseTarget=function(e){void 0!==e&&(a=e)},this.updateCamera=function(e){if(null===s)return;let t=e.near,n=e.far;null!==v.texture&&(v.depthNear>0&&(t=v.depthNear),v.depthFar>0&&(n=v.depthFar)),B.near=S.near=M.near=t,B.far=S.far=M.far=n,T===B.near&&R===B.far||(s.updateRenderState({depthNear:B.near,depthFar:B.far}),T=B.near,R=B.far),M.layers.mask=2|e.layers.mask,S.layers.mask=4|e.layers.mask,B.layers.mask=M.layers.mask|S.layers.mask;const i=B.cameras;var r=a||e;const o=r.parent;F(B,o);for(let e=0;e<i.length;e++)F(i[e],o);2===i.length?function(e,t,n){U.setFromMatrixPosition(t.matrixWorld),O.setFromMatrixPosition(n.matrixWorld);const i=U.distanceTo(O),r=t.projectionMatrix.elements,s=n.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],d=(s[8]+1)/s[0],u=o*h,p=o*d,A=i/(-h+d),f=A*-h;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(f),e.translateZ(A),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===r[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{const t=o+A,n=a+A,r=u-f,s=p+(i-f),h=l*a/n*t,d=c*a/n*t;e.projectionMatrix.makePerspective(r,s,h,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(B,M,S):B.projectionMatrix.copy(M.projectionMatrix),function(e,t,n){t.matrixWorld.decompose(t.position,t.quaternion,t.scale),null===n.parent?n.matrix.copy(t.matrixWorld):(n.matrix.copy(n.parent.matrixWorld),n.matrix.invert(),n.matrix.multiply(t.matrixWorld)),n.matrix.decompose(n.position,n.quaternion,n.scale),n.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*qn*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,B,r)},this.getCamera=function(){return B},this.getFoveation=function(){if(null!==f||null!==m)return h},this.setFoveation=function(e){h=e,null!==f&&(f.fixedFoveation=e),null!==m&&void 0!==m.fixedFoveation&&(m.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==v.texture},this.getDepthSensingMesh=function(){return v.getMesh(B)};let k=null;const N=new bu;N.setAnimationLoop((function(t,n){if(u=n.getViewerPose(d||l),g=n,null!==u){const t=u.views;null!==m&&(e.setRenderTargetFramebuffer(x,m.framebuffer),e.setRenderTarget(x));let n=!1;t.length!==B.cameras.length&&(B.cameras.length=0,n=!0);for(let i=0;i<t.length;i++){const r=t[i];let s=null;if(null!==m)s=m.getViewport(r);else{const t=A.getViewSubImage(f,r);s=t.viewport,0===i&&(e.setRenderTargetTextures(x,t.colorTexture,f.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(x))}let o=I[i];void 0===o&&(o=new $s,o.layers.enable(i),o.viewport=new wi,I[i]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(s.x,s.y,s.width,s.height),0===i&&(B.matrix.copy(o.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),!0===n&&B.cameras.push(o)}const i=s.enabledFeatures;if(i&&i.includes("depth-sensing")){const n=A.getDepthInformation(t[0]);n&&n.isValid&&n.texture&&v.init(e,n,s.renderState)}}for(let e=0;e<b.length;e++){const t=C[e],i=b[e];null!==t&&void 0!==i&&i.update(t,n,d||l)}k&&k(t,n),n.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:n}),g=null})),this.setAnimationLoop=function(e){k=e},this.dispose=function(){}}}const ef=new vr,tf=new lr;function nf(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map,n(i.map,e.mapTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,n(i.alphaMap,e.alphaMapTransform)),i.bumpMap&&(e.bumpMap.value=i.bumpMap,n(i.bumpMap,e.bumpMapTransform),e.bumpScale.value=i.bumpScale,i.side===g&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,n(i.normalMap,e.normalMapTransform),e.normalScale.value.copy(i.normalScale),i.side===g&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,n(i.displacementMap,e.displacementMapTransform),e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,e.emissiveMapTransform)),i.specularMap&&(e.specularMap.value=i.specularMap,n(i.specularMap,e.specularMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);const r=t.get(i),s=r.envMap,o=r.envMapRotation;s&&(e.envMap.value=s,ef.copy(o),ef.x*=-1,ef.y*=-1,ef.z*=-1,s.isCubeTexture&&!1===s.isRenderTargetTexture&&(ef.y*=-1,ef.z*=-1),e.envMapRotation.value.setFromMatrix4(tf.makeRotationFromEuler(ef)),e.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,Ws(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,s,o,a){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===g&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,a)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,s,o):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function rf(e,t,n,i){let r={},s={},o=[];const a=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,i){const r=e.value,s=t+"_"+n;if(void 0===i[s])return i[s]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const e=i[s];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return i[s]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}function c(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function h(t){const n=t.target;n.removeEventListener("dispose",h);const i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete s[n.id]}return{bind:function(e,t){const n=t.program;i.uniformBlockBinding(e,n)},update:function(n,d){let u=r[n.id];void 0===u&&(function(e){const t=e.uniforms;let n=0;for(let e=0,i=t.length;e<i;e++){const i=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=i.length;e<t;e++){const t=i[e],r=Array.isArray(t.value)?t.value:[t.value];for(let e=0,i=r.length;e<i;e++){const i=c(r[e]),s=n%16,o=s%i.boundary,a=s+o;n+=o,0!==a&&16-a<i.storage&&(n+=16-a),t.__data=new Float32Array(i.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=i.storage}}}const i=n%16;i>0&&(n+=16-i),e.__size=n,e.__cache={}}(n),u=function(t){const n=function(){for(let e=0;e<a;e++)if(-1===o.indexOf(e))return o.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;const i=e.createBuffer(),r=t.__size,s=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,i),e.bufferData(e.UNIFORM_BUFFER,r,s),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=u,n.addEventListener("dispose",h));const p=d.program;i.updateUBOMapping(n,p);const A=t.render.frame;s[n.id]!==A&&(function(t){const n=r[t.id],i=t.uniforms,s=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let t=0,n=i.length;t<n;t++){const n=Array.isArray(i[t])?i[t]:[i[t]];for(let i=0,r=n.length;i<r;i++){const r=n[i];if(!0===l(r,t,i,s)){const t=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let s=0;s<n.length;s++){const o=n[s],a=c(o);"number"==typeof o||"boolean"==typeof o?(r.__data[0]=o,e.bufferSubData(e.UNIFORM_BUFFER,t+i,r.__data)):o.isMatrix3?(r.__data[0]=o.elements[0],r.__data[1]=o.elements[1],r.__data[2]=o.elements[2],r.__data[3]=0,r.__data[4]=o.elements[3],r.__data[5]=o.elements[4],r.__data[6]=o.elements[5],r.__data[7]=0,r.__data[8]=o.elements[6],r.__data[9]=o.elements[7],r.__data[10]=o.elements[8],r.__data[11]=0):(o.toArray(r.__data,i),i+=a.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,r.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),s[n.id]=A)},dispose:function(){for(const t in r)e.deleteBuffer(r[t]);o=[],r={},s={}}}}class sf{constructor(e={}){const{canvas:t=li(),context:n=null,depth:i=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reverseDepthBuffer:u=!1,multiviewStereo:p=!1}=e;let A;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");A=n.getContextAttributes().alpha}else A=o;const f=new Uint32Array(4),y=new Int32Array(4);let E=null,x=null;const b=[],C=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=tn,this.toneMapping=ne,this.toneMappingExposure=1;const w=this;let _=!1,M=0,S=0,I=null,B=-1,T=null;const R=new wi,L=new wi;let D=null;const P=new es(0);let U=0,O=t.width,F=t.height,k=1,N=null,Q=null;const G=new wi(0,0,O,F),z=new wi(0,0,O,F);let H=!1;const V=new oa;let j=!1,W=!1;const q=new lr,X=new lr,Y=new Li,J=new wi,K={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Z=!1;function $(){return null===I?k:1}let ee,te,ie,re,se,oe,ae,le,ce,he,de,ue,pe,Ae,fe,me,ge,ve,ye,Ee,xe,be,Ce,we,_e,Me=n;function Se(e,n){return t.getContext(e,n)}try{const e={alpha:!0,depth:i,stencil:r,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${s}`),t.addEventListener("webglcontextlost",Le,!1),t.addEventListener("webglcontextrestored",De,!1),t.addEventListener("webglcontextcreationerror",Ue,!1),null===Me){const t="webgl2";if(Me=Se(t,e),null===Me)throw Se(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function Ie(){ee=new Zu(Me),ee.init(),Ce=new XA(Me,ee),te=new Du(Me,ee,e,Ce),ie=new WA(Me,ee),te.reverseDepthBuffer&&u&&ie.buffers.depth.setReversed(!0),re=new tp(Me),se=new DA,oe=new qA(Me,ee,ie,se,te,Ce,re),ae=new Uu(w),le=new Ku(w),ce=new Cu(Me),we=new Ru(Me,ce),he=new $u(Me,ce,re,we),de=new rp(Me,he,ce,re),Ee=new np(Me,te,oe),me=new Pu(se),ue=new LA(w,ae,le,ee,te,we,me),pe=new nf(w,se),Ae=new FA,fe=new HA(ee),ye=new Tu(w,ae,le,ie,de,A,l),ve=new ip(w,ee,Me),ge=new VA(w,de,te),_e=new rf(Me,re,te,ie),xe=new Lu(Me,ee,re),be=new ep(Me,ee,re),re.programs=ue.programs,w.capabilities=te,w.extensions=ee,w.properties=se,w.renderLists=Ae,w.shadowMap=ge,w.state=ie,w.info=re}Ie();const Te=new $A(w,Me);function Le(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),_=!0}function De(){console.log("THREE.WebGLRenderer: Context Restored."),_=!1;const e=re.autoReset,t=ge.enabled,n=ge.autoUpdate,i=ge.needsUpdate,r=ge.type;Ie(),re.autoReset=e,ge.enabled=t,ge.autoUpdate=n,ge.needsUpdate=i,ge.type=r}function Ue(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function Fe(e){const t=e.target;t.removeEventListener("dispose",Fe),function(e){(function(e){const t=se.get(e).programs;void 0!==t&&(t.forEach((function(e){ue.releaseProgram(e)})),e.isShaderMaterial&&ue.releaseShaderCache(e))})(e),se.remove(e)}(t)}function ze(e,t,n){!0===e.transparent&&e.side===v&&!1===e.forceSinglePass?(e.side=g,e.needsUpdate=!0,et(e,t,n),e.side=m,e.needsUpdate=!0,et(e,t,n),e.side=v):et(e,t,n)}this.xr=Te,this.getContext=function(){return Me},this.getContextAttributes=function(){return Me.getContextAttributes()},this.forceContextLoss=function(){const e=ee.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=ee.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return k},this.setPixelRatio=function(e){void 0!==e&&(k=e,this.setSize(O,F,!1))},this.getSize=function(e){return e.set(O,F)},this.setSize=function(e,n,i=!0){Te.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(O=e,F=n,t.width=Math.floor(e*k),t.height=Math.floor(n*k),!0===i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(O*k,F*k).floor()},this.setDrawingBufferSize=function(e,n,i){O=e,F=n,k=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(R)},this.getViewport=function(e){return e.copy(G)},this.setViewport=function(e,t,n,i){e.isVector4?G.set(e.x,e.y,e.z,e.w):G.set(e,t,n,i),ie.viewport(R.copy(G).multiplyScalar(k).round())},this.getScissor=function(e){return e.copy(z)},this.setScissor=function(e,t,n,i){e.isVector4?z.set(e.x,e.y,e.z,e.w):z.set(e,t,n,i),ie.scissor(L.copy(z).multiplyScalar(k).round())},this.getScissorTest=function(){return H},this.setScissorTest=function(e){ie.setScissorTest(H=e)},this.setOpaqueSort=function(e){N=e},this.setTransparentSort=function(e){Q=e},this.getClearColor=function(e){return e.copy(ye.getClearColor())},this.setClearColor=function(){ye.setClearColor.apply(ye,arguments)},this.getClearAlpha=function(){return ye.getClearAlpha()},this.setClearAlpha=function(){ye.setClearAlpha.apply(ye,arguments)},this.clear=function(e=!0,t=!0,n=!0){let i=0;if(e){let e=!1;if(null!==I){const t=I.texture.format;e=t===tt||t===$e||t===Ke}if(e){const e=I.texture.type,t=e===Re||e===Oe||e===Pe||e===Ge||e===Ne||e===Qe,n=ye.getClearColor(),i=ye.getClearAlpha(),r=n.r,s=n.g,o=n.b;t?(f[0]=r,f[1]=s,f[2]=o,f[3]=i,Me.clearBufferuiv(Me.COLOR,0,f)):(y[0]=r,y[1]=s,y[2]=o,y[3]=i,Me.clearBufferiv(Me.COLOR,0,y))}else i|=Me.COLOR_BUFFER_BIT}t&&(i|=Me.DEPTH_BUFFER_BIT),n&&(i|=Me.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Me.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Le,!1),t.removeEventListener("webglcontextrestored",De,!1),t.removeEventListener("webglcontextcreationerror",Ue,!1),ye.dispose(),Ae.dispose(),fe.dispose(),se.dispose(),ae.dispose(),le.dispose(),de.dispose(),we.dispose(),_e.dispose(),ue.dispose(),Te.dispose(),Te.removeEventListener("sessionstart",Ve),Te.removeEventListener("sessionend",je),We.stop()},this.renderBufferDirect=function(e,t,n,i,r,s){null===t&&(t=K);const o=r.isMesh&&r.matrixWorld.determinant()<0,a=function(e,t,n,i,r){!0!==t.isScene&&(t=K),oe.resetTextureUnits();const s=t.fog,o=i.isMeshStandardMaterial?t.environment:null,a=null===I?w.outputColorSpace:!0===I.isXRRenderTarget?I.texture.colorSpace:nn,l=(i.isMeshStandardMaterial?le:ae).get(i.envMap||o),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),d=!!n.morphAttributes.position,u=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let A=ne;i.toneMapped&&(null!==I&&!0!==I.isXRRenderTarget||(A=w.toneMapping));const f=I&&I.isWebGLMultiviewRenderTarget?I.numViews:0,m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,g=void 0!==m?m.length:0,v=se.get(i),y=x.state.lights;if(!0===j&&(!0===W||e!==T)){const t=e===T&&i.id===B;me.setState(i,e,t)}let E=!1;i.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version||v.outputColorSpace!==a||r.isBatchedMesh&&!1===v.batching?E=!0:r.isBatchedMesh||!0!==v.batching?r.isBatchedMesh&&!0===v.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===v.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===v.instancing?E=!0:r.isInstancedMesh||!0!==v.instancing?r.isSkinnedMesh&&!1===v.skinning?E=!0:r.isSkinnedMesh||!0!==v.skinning?r.isInstancedMesh&&!0===v.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===v.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===v.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===v.instancingMorph&&null!==r.morphTexture||v.envMap!==l||!0===i.fog&&v.fog!==s?E=!0:void 0===v.numClippingPlanes||v.numClippingPlanes===me.numPlanes&&v.numIntersection===me.numIntersection?(v.vertexAlphas!==c||v.vertexTangents!==h||v.morphTargets!==d||v.morphNormals!==u||v.morphColors!==p||v.toneMapping!==A||v.morphTargetsCount!==g||v.numMultiviewViews!==f)&&(E=!0):E=!0:E=!0:E=!0:E=!0:(E=!0,v.__version=i.version);let b=v.currentProgram;!0===E&&(b=et(i,t,r));let C=!1,_=!1,M=!1;const S=b.getUniforms(),R=v.uniforms;if(ie.useProgram(b.program)&&(C=!0,_=!0,M=!0),i.id!==B&&(B=i.id,_=!0),C||T!==e){b.numMultiviewViews>0?(ve.updateCameraProjectionMatricesUniform(e,S),ve.updateCameraViewMatricesUniform(e,S)):(ie.buffers.depth.getReversed()?(q.copy(e.projectionMatrix),function(e){const t=e.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}(q),function(e){const t=e.elements;-1===t[11]?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=1-t[14])}(q),S.setValue(Me,"projectionMatrix",q)):S.setValue(Me,"projectionMatrix",e.projectionMatrix),S.setValue(Me,"viewMatrix",e.matrixWorldInverse));const t=S.map.cameraPosition;void 0!==t&&t.setValue(Me,Y.setFromMatrixPosition(e.matrixWorld)),te.logarithmicDepthBuffer&&S.setValue(Me,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&S.setValue(Me,"isOrthographic",!0===e.isOrthographicCamera),T!==e&&(T=e,_=!0,M=!0)}if(r.isSkinnedMesh){S.setOptional(Me,r,"bindMatrix"),S.setOptional(Me,r,"bindMatrixInverse");const e=r.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),S.setValue(Me,"boneTexture",e.boneTexture,oe))}r.isBatchedMesh&&(S.setOptional(Me,r,"batchingTexture"),S.setValue(Me,"batchingTexture",r._matricesTexture,oe),S.setOptional(Me,r,"batchingIdTexture"),S.setValue(Me,"batchingIdTexture",r._indirectTexture,oe),S.setOptional(Me,r,"batchingColorTexture"),null!==r._colorsTexture&&S.setValue(Me,"batchingColorTexture",r._colorsTexture,oe));const L=n.morphAttributes;var D,P;if(void 0===L.position&&void 0===L.normal&&void 0===L.color||Ee.update(r,n,b),(_||v.receiveShadow!==r.receiveShadow)&&(v.receiveShadow=r.receiveShadow,S.setValue(Me,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(R.envMap.value=l,R.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==t.environment&&(R.envMapIntensity.value=t.environmentIntensity),_&&(S.setValue(Me,"toneMappingExposure",w.toneMappingExposure),v.needsLights&&(P=M,(D=R).ambientLightColor.needsUpdate=P,D.lightProbe.needsUpdate=P,D.directionalLights.needsUpdate=P,D.directionalLightShadows.needsUpdate=P,D.pointLights.needsUpdate=P,D.pointLightShadows.needsUpdate=P,D.spotLights.needsUpdate=P,D.spotLightShadows.needsUpdate=P,D.rectAreaLights.needsUpdate=P,D.hemisphereLights.needsUpdate=P),s&&!0===i.fog&&pe.refreshFogUniforms(R,s),pe.refreshMaterialUniforms(R,i,k,F,x.state.transmissionRenderTarget[e.id]),cA.upload(Me,nt(v),R,oe)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(cA.upload(Me,nt(v),R,oe),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&S.setValue(Me,"center",r.center),b.numMultiviewViews>0?ve.updateObjectMatricesUniforms(r,e,S):(S.setValue(Me,"modelViewMatrix",r.modelViewMatrix),S.setValue(Me,"normalMatrix",r.normalMatrix)),S.setValue(Me,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const e=i.uniformsGroups;for(let t=0,n=e.length;t<n;t++){const n=e[t];_e.update(n,b),_e.bind(n,b)}}return b}(e,t,n,i,r);ie.setMaterial(i,o);let l=n.index,c=1;if(!0===i.wireframe){if(l=he.getWireframeAttribute(n),void 0===l)return;c=2}const h=n.drawRange,d=n.attributes.position;let u=h.start*c,p=(h.start+h.count)*c;null!==s&&(u=Math.max(u,s.start*c),p=Math.min(p,(s.start+s.count)*c)),null!==l?(u=Math.max(u,0),p=Math.min(p,l.count)):null!=d&&(u=Math.max(u,0),p=Math.min(p,d.count));const A=p-u;if(A<0||A===1/0)return;let f;we.setup(r,i,a,n,l);let m=xe;if(null!==l&&(f=ce.get(l),m=be,m.setIndex(f)),r.isMesh)!0===i.wireframe?(ie.setLineWidth(i.wireframeLinewidth*$()),m.setMode(Me.LINES)):m.setMode(Me.TRIANGLES);else if(r.isLine){let e=i.linewidth;void 0===e&&(e=1),ie.setLineWidth(e*$()),r.isLineSegments?m.setMode(Me.LINES):r.isLineLoop?m.setMode(Me.LINE_LOOP):m.setMode(Me.LINE_STRIP)}else r.isPoints?m.setMode(Me.POINTS):r.isSprite&&m.setMode(Me.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)m.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(ee.get("WEBGL_multi_draw"))m.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const e=r._multiDrawStarts,t=r._multiDrawCounts,n=r._multiDrawCount,s=l?ce.get(l).bytesPerElement:1,o=se.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)o.setValue(Me,"_gl_DrawID",i),m.render(e[i]/s,t[i])}else if(r.isInstancedMesh)m.renderInstances(u,A,r.count);else if(n.isInstancedBufferGeometry){const e=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,t=Math.min(n.instanceCount,e);m.renderInstances(u,A,t)}else m.render(u,A)},this.compile=function(e,t,n=null){null===n&&(n=e),x=fe.get(n),x.init(t),C.push(x),n.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(x.pushLight(e),e.castShadow&&x.pushShadow(e))})),e!==n&&e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(x.pushLight(e),e.castShadow&&x.pushShadow(e))})),x.setupLights();const i=new Set;return e.traverse((function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;const t=e.material;if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++){const s=t[r];ze(s,n,e),i.add(s)}else ze(t,n,e),i.add(t)})),C.pop(),x=null,i},this.compileAsync=function(e,t,n=null){const i=this.compile(e,t,n);return new Promise((t=>{function n(){i.forEach((function(e){se.get(e).currentProgram.isReady()&&i.delete(e)})),0!==i.size?setTimeout(n,10):t(e)}null!==ee.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};let He=null;function Ve(){We.stop()}function je(){We.start()}const We=new bu;function qe(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)x.pushLight(e),e.castShadow&&x.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||V.intersectsSprite(e)){i&&J.setFromMatrixPosition(e.matrixWorld).applyMatrix4(X);const t=de.update(e),r=e.material;r.visible&&E.push(e,t,r,n,J.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||V.intersectsObject(e))){const t=de.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),J.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),J.copy(t.boundingSphere.center)),J.applyMatrix4(e.matrixWorld).applyMatrix4(X)),Array.isArray(r)){const i=t.groups;for(let s=0,o=i.length;s<o;s++){const o=i[s],a=r[o.materialIndex];a&&a.visible&&E.push(e,t,a,n,J.z,o)}}else r.visible&&E.push(e,t,r,n,J.z,null)}const r=e.children;for(let e=0,s=r.length;e<s;e++)qe(r[e],t,n,i)}function Xe(e,t,n,i){const r=e.opaque,s=e.transmissive,o=e.transparent;x.setupLightsView(n),!0===j&&me.setGlobalState(w.clippingPlanes,n),i&&ie.viewport(R.copy(i)),r.length>0&&Je(r,t,n),s.length>0&&Je(s,t,n),o.length>0&&Je(o,t,n),ie.buffers.depth.setTest(!0),ie.buffers.depth.setMask(!0),ie.buffers.color.setMask(!0),ie.setPolygonOffset(!1)}function Ye(e,t,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===x.state.transmissionRenderTarget[i.id]&&(x.state.transmissionRenderTarget[i.id]=new Mi(1,1,{generateMipmaps:!0,type:ee.has("EXT_color_buffer_half_float")||ee.has("EXT_color_buffer_float")?ke:Re,minFilter:Be,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ai.workingColorSpace}));const s=x.state.transmissionRenderTarget[i.id],o=i.viewport||R;s.setSize(o.z,o.w);const a=w.getRenderTarget();w.setRenderTarget(s),w.getClearColor(P),U=w.getClearAlpha(),U<1&&w.setClearColor(16777215,.5),w.clear(),Z&&ye.render(n);const l=w.toneMapping;w.toneMapping=ne;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),x.setupLightsView(i),!0===j&&me.setGlobalState(w.clippingPlanes,i),Je(e,n,i),oe.updateMultisampleRenderTarget(s),oe.updateRenderTargetMipmap(s),!1===ee.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,s=t.length;r<s;r++){const s=t[r],o=s.object,a=s.geometry,l=s.material,c=s.group;if(l.side===v&&o.layers.test(i.layers)){const t=l.side;l.side=g,l.needsUpdate=!0,Ze(o,n,i,a,l,c),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(oe.updateMultisampleRenderTarget(s),oe.updateRenderTargetMipmap(s))}w.setRenderTarget(a),w.setClearColor(P,U),void 0!==c&&(i.viewport=c),w.toneMapping=l}function Je(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,s=e.length;r<s;r++){const s=e[r],o=s.object,a=s.geometry,l=null===i?s.material:i,c=s.group;o.layers.test(n.layers)&&Ze(o,t,n,a,l,c)}}function Ze(e,t,n,i,r,s){e.onBeforeRender(w,t,n,i,r,s),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(w,t,n,i,e,s),!0===r.transparent&&r.side===v&&!1===r.forceSinglePass?(r.side=g,r.needsUpdate=!0,w.renderBufferDirect(n,t,i,r,e,s),r.side=m,r.needsUpdate=!0,w.renderBufferDirect(n,t,i,r,e,s),r.side=v):w.renderBufferDirect(n,t,i,r,e,s),e.onAfterRender(w,t,n,i,r,s)}function et(e,t,n){!0!==t.isScene&&(t=K);const i=se.get(e),r=x.state.lights,s=x.state.shadowsArray,o=r.state.version,a=ue.getParameters(e,r.state,s,t,n),l=ue.getProgramCacheKey(a);let c=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=(e.isMeshStandardMaterial?le:ae).get(e.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===c&&(e.addEventListener("dispose",Fe),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===o)return it(e,a),h}else a.uniforms=ue.getUniforms(e),e.onBeforeCompile(a,w),h=ue.acquireProgram(a,l),c.set(l,h),i.uniforms=a.uniforms;const d=i.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(d.clippingPlanes=me.uniform),it(e,a),i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=o,i.needsLights&&(d.ambientLightColor.value=r.state.ambient,d.lightProbe.value=r.state.probe,d.directionalLights.value=r.state.directional,d.directionalLightShadows.value=r.state.directionalShadow,d.spotLights.value=r.state.spot,d.spotLightShadows.value=r.state.spotShadow,d.rectAreaLights.value=r.state.rectArea,d.ltc_1.value=r.state.rectAreaLTC1,d.ltc_2.value=r.state.rectAreaLTC2,d.pointLights.value=r.state.point,d.pointLightShadows.value=r.state.pointShadow,d.hemisphereLights.value=r.state.hemi,d.directionalShadowMap.value=r.state.directionalShadowMap,d.directionalShadowMatrix.value=r.state.directionalShadowMatrix,d.spotShadowMap.value=r.state.spotShadowMap,d.spotLightMatrix.value=r.state.spotLightMatrix,d.spotLightMap.value=r.state.spotLightMap,d.pointShadowMap.value=r.state.pointShadowMap,d.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=h,i.uniformsList=null,h}function nt(e){if(null===e.uniformsList){const t=e.currentProgram.getUniforms();e.uniformsList=cA.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function it(e,t){const n=se.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping,n.numMultiviewViews=t.numMultiviewViews}var rt;We.setAnimationLoop((function(e){He&&He(e)})),"undefined"!=typeof self&&We.setContext(self),this.setAnimationLoop=function(e){He=e,Te.setAnimationLoop(e),null===e?We.stop():We.start()},Te.addEventListener("sessionstart",Ve),Te.addEventListener("sessionend",je),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===_)return;if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===Te.enabled&&!0===Te.isPresenting&&(!0===Te.cameraAutoUpdate&&Te.updateCamera(t),t=Te.getCamera()),!0===e.isScene&&e.onBeforeRender(w,e,t,I),x=fe.get(e,C.length),x.init(t),C.push(x),X.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),V.setFromProjectionMatrix(X),W=this.localClippingEnabled,j=me.init(this.clippingPlanes,W),E=Ae.get(e,b.length),E.init(),b.push(E),!0===Te.enabled&&!0===Te.isPresenting){const e=w.xr.getDepthSensingMesh();null!==e&&qe(e,t,-1/0,w.sortObjects)}qe(e,t,0,w.sortObjects),E.finish(),!0===w.sortObjects&&E.sort(N,Q),Z=!1===Te.enabled||!1===Te.isPresenting||!1===Te.hasDepthSensing(),Z&&ye.addToRenderList(E,e),this.info.render.frame++,!0===j&&me.beginShadows();const n=x.state.shadowsArray;ge.render(n,e,t),!0===j&&me.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=E.opaque,r=E.transmissive;if(x.setupLights(),t.isArrayCamera){const n=t.cameras;if(r.length>0)for(let t=0,s=n.length;t<s;t++)Ye(i,r,e,n[t]);if(Z&&ye.render(e),Te.enabled&&Te.isMultiview)oe.setDeferTextureUploads(!0),Xe(E,e,t,t.cameras[0].viewport);else for(let t=0,i=n.length;t<i;t++){const i=n[t];Xe(E,e,i,i.viewport)}}else r.length>0&&Ye(i,r,e,t),Z&&ye.render(e),Xe(E,e,t);null!==I&&(oe.updateMultisampleRenderTarget(I),oe.updateRenderTargetMipmap(I)),!0===e.isScene&&e.onAfterRender(w,e,t),we.resetDefaultState(),B=-1,T=null,C.pop(),C.length>0?(x=C[C.length-1],!0===j&&me.setGlobalState(w.clippingPlanes,x.state.camera)):x=null,b.pop(),E=b.length>0?b[b.length-1]:null},this.setTexture2D=(rt=!1,function(e,t){e&&e.isWebGLRenderTarget&&(rt||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),rt=!0),e=e.texture),oe.setTexture2D(e,t)}),this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return I},this.setRenderTargetTextures=function(e,t,n){se.get(e.texture).__webglTexture=t,se.get(e.depthTexture).__webglTexture=n;const i=se.get(e);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||I&&I.isWebGLMultiviewRenderTarget||!0===ee.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(e,t){const n=se.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){I=e,M=t,S=n;let i=!0,r=null,s=!1,o=!1;if(e){const a=se.get(e);if(void 0!==a.__useDefaultFramebuffer)ie.bindFramebuffer(Me.FRAMEBUFFER,null),i=!1;else if(void 0===a.__webglFramebuffer)oe.setupRenderTarget(e);else if(a.__hasExternalTextures)oe.rebindTextures(e,se.get(e.texture).__webglTexture,se.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){const t=e.depthTexture;if(a.__boundDepthTexture!==t){if(null!==t&&se.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");oe.setupDepthRenderbuffer(e)}}const l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);const c=se.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],s=!0):r=e.samples>0&&!1===oe.useMultisampledRTT(e)?se.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,R.copy(e.viewport),L.copy(e.scissor),D=e.scissorTest}else R.copy(G).multiplyScalar(k).floor(),L.copy(z).multiplyScalar(k).floor(),D=H;if(ie.bindFramebuffer(Me.FRAMEBUFFER,r)&&i&&ie.drawBuffers(e,r),ie.viewport(R),ie.scissor(L),ie.setScissorTest(D),s){const i=se.get(e.texture);Me.framebufferTexture2D(Me.FRAMEBUFFER,Me.COLOR_ATTACHMENT0,Me.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(o){const i=se.get(e.texture),r=t||0;Me.framebufferTextureLayer(Me.FRAMEBUFFER,Me.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}B=-1},this.readRenderTargetPixels=function(e,t,n,i,r,s,o){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=se.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){ie.bindFramebuffer(Me.FRAMEBUFFER,a);try{const o=e.texture,a=o.format,l=o.type;if(!te.textureFormatReadable(a))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!te.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&Me.readPixels(t,n,i,r,Ce.convert(a),Ce.convert(l),s)}finally{const e=null!==I?se.get(I).__webglFramebuffer:null;ie.bindFramebuffer(Me.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,r,s,o){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=se.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){const o=e.texture,l=o.format,c=o.type;if(!te.textureFormatReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!te.textureTypeReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r){ie.bindFramebuffer(Me.FRAMEBUFFER,a);const e=Me.createBuffer();Me.bindBuffer(Me.PIXEL_PACK_BUFFER,e),Me.bufferData(Me.PIXEL_PACK_BUFFER,s.byteLength,Me.STREAM_READ),Me.readPixels(t,n,i,r,Ce.convert(l),Ce.convert(c),0);const o=null!==I?se.get(I).__webglFramebuffer:null;ie.bindFramebuffer(Me.FRAMEBUFFER,o);const h=Me.fenceSync(Me.SYNC_GPU_COMMANDS_COMPLETE,0);return Me.flush(),await function(e,t){return new Promise((function(n,i){setTimeout((function r(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(r,4);break;default:n()}}),4)}))}(Me,h),Me.bindBuffer(Me.PIXEL_PACK_BUFFER,e),Me.getBufferSubData(Me.PIXEL_PACK_BUFFER,0,s),Me.deleteBuffer(e),Me.deleteSync(h),s}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(e,t=null,n=0){!0!==e.isTexture&&(hi("WebGLRenderer: copyFramebufferToTexture function signature has changed."),t=arguments[0]||null,e=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),s=Math.floor(e.image.height*i),o=null!==t?t.x:0,a=null!==t?t.y:0;oe.setTexture2D(e,0),Me.copyTexSubImage2D(Me.TEXTURE_2D,n,0,0,o,a,r,s),ie.unbindTexture()};const st=Me.createFramebuffer(),ot=Me.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,i=null,r=0,s=null){let o,a,l,c,h,d,u,p,A;!0!==e.isTexture&&(hi("WebGLRenderer: copyTextureToTexture function signature has changed."),i=arguments[0]||null,e=arguments[1],t=arguments[2],s=arguments[3]||0,n=null),null===s&&(0!==r?(hi("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),s=r,r=0):s=0);const f=e.isCompressedTexture?e.mipmaps[s]:e.image;if(null!==n)o=n.max.x-n.min.x,a=n.max.y-n.min.y,l=n.isBox3?n.max.z-n.min.z:1,c=n.min.x,h=n.min.y,d=n.isBox3?n.min.z:0;else{const t=Math.pow(2,-r);o=Math.floor(f.width*t),a=Math.floor(f.height*t),l=e.isDataArrayTexture?f.depth:e.isData3DTexture?Math.floor(f.depth*t):1,c=0,h=0,d=0}null!==i?(u=i.x,p=i.y,A=i.z):(u=0,p=0,A=0);const m=Ce.convert(t.format),g=Ce.convert(t.type);let v;t.isData3DTexture?(oe.setTexture3D(t,0),v=Me.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(oe.setTexture2DArray(t,0),v=Me.TEXTURE_2D_ARRAY):(oe.setTexture2D(t,0),v=Me.TEXTURE_2D),Me.pixelStorei(Me.UNPACK_FLIP_Y_WEBGL,t.flipY),Me.pixelStorei(Me.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Me.pixelStorei(Me.UNPACK_ALIGNMENT,t.unpackAlignment);const y=Me.getParameter(Me.UNPACK_ROW_LENGTH),E=Me.getParameter(Me.UNPACK_IMAGE_HEIGHT),x=Me.getParameter(Me.UNPACK_SKIP_PIXELS),b=Me.getParameter(Me.UNPACK_SKIP_ROWS),C=Me.getParameter(Me.UNPACK_SKIP_IMAGES);Me.pixelStorei(Me.UNPACK_ROW_LENGTH,f.width),Me.pixelStorei(Me.UNPACK_IMAGE_HEIGHT,f.height),Me.pixelStorei(Me.UNPACK_SKIP_PIXELS,c),Me.pixelStorei(Me.UNPACK_SKIP_ROWS,h),Me.pixelStorei(Me.UNPACK_SKIP_IMAGES,d);const w=e.isDataArrayTexture||e.isData3DTexture,_=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){const n=se.get(e),i=se.get(t),f=se.get(n.__renderTarget),m=se.get(i.__renderTarget);ie.bindFramebuffer(Me.READ_FRAMEBUFFER,f.__webglFramebuffer),ie.bindFramebuffer(Me.DRAW_FRAMEBUFFER,m.__webglFramebuffer);for(let n=0;n<l;n++)w&&(Me.framebufferTextureLayer(Me.READ_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,se.get(e).__webglTexture,r,d+n),Me.framebufferTextureLayer(Me.DRAW_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,se.get(t).__webglTexture,s,A+n)),Me.blitFramebuffer(c,h,o,a,u,p,o,a,Me.DEPTH_BUFFER_BIT,Me.NEAREST);ie.bindFramebuffer(Me.READ_FRAMEBUFFER,null),ie.bindFramebuffer(Me.DRAW_FRAMEBUFFER,null)}else if(0!==r||e.isRenderTargetTexture||se.has(e)){const n=se.get(e),i=se.get(t);ie.bindFramebuffer(Me.READ_FRAMEBUFFER,st),ie.bindFramebuffer(Me.DRAW_FRAMEBUFFER,ot);for(let e=0;e<l;e++)w?Me.framebufferTextureLayer(Me.READ_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,n.__webglTexture,r,d+e):Me.framebufferTexture2D(Me.READ_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,Me.TEXTURE_2D,n.__webglTexture,r),_?Me.framebufferTextureLayer(Me.DRAW_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,i.__webglTexture,s,A+e):Me.framebufferTexture2D(Me.DRAW_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,Me.TEXTURE_2D,i.__webglTexture,s),0!==r?Me.blitFramebuffer(c,h,o,a,u,p,o,a,Me.COLOR_BUFFER_BIT,Me.NEAREST):_?Me.copyTexSubImage3D(v,s,u,p,A+e,c,h,o,a):Me.copyTexSubImage2D(v,s,u,p,c,h,o,a);ie.bindFramebuffer(Me.READ_FRAMEBUFFER,null),ie.bindFramebuffer(Me.DRAW_FRAMEBUFFER,null)}else _?e.isDataTexture||e.isData3DTexture?Me.texSubImage3D(v,s,u,p,A,o,a,l,m,g,f.data):t.isCompressedArrayTexture?Me.compressedTexSubImage3D(v,s,u,p,A,o,a,l,m,f.data):Me.texSubImage3D(v,s,u,p,A,o,a,l,m,g,f):e.isDataTexture?Me.texSubImage2D(Me.TEXTURE_2D,s,u,p,o,a,m,g,f.data):e.isCompressedTexture?Me.compressedTexSubImage2D(Me.TEXTURE_2D,s,u,p,f.width,f.height,m,f.data):Me.texSubImage2D(Me.TEXTURE_2D,s,u,p,o,a,m,g,f);Me.pixelStorei(Me.UNPACK_ROW_LENGTH,y),Me.pixelStorei(Me.UNPACK_IMAGE_HEIGHT,E),Me.pixelStorei(Me.UNPACK_SKIP_PIXELS,x),Me.pixelStorei(Me.UNPACK_SKIP_ROWS,b),Me.pixelStorei(Me.UNPACK_SKIP_IMAGES,C),0===s&&t.generateMipmaps&&Me.generateMipmap(v),ie.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n=null,i=null,r=0){return!0!==e.isTexture&&(hi("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,i=arguments[1]||null,e=arguments[2],t=arguments[3],r=arguments[4]||0),hi('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(e,t,n,i,r)},this.initRenderTarget=function(e){void 0===se.get(e).__webglFramebuffer&&oe.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?oe.setTextureCube(e,0):e.isData3DTexture?oe.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?oe.setTexture2DArray(e,0):oe.setTexture2D(e,0),ie.unbindTexture()},this.resetState=function(){M=0,S=0,I=null,ie.reset(),we.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Gn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorspace=Ai._getDrawingBufferColorSpace(e),t.unpackColorSpace=Ai._getUnpackColorSpace()}}const of=new WeakMap;function af(){let e,t;function n(e,t,n,i,r,s){const o=s.num_components(),a=n.num_points()*o,l=a*r.BYTES_PER_ELEMENT,c=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,r),h=e._malloc(l);t.GetAttributeDataArrayForAllPoints(n,s,c,l,h);const d=new r(e.HEAPF32.buffer,h,a).slice();return e._free(h),{name:i,array:d,itemSize:o}}onmessage=function(i){const r=i.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":const i=r.buffer,s=r.taskConfig;t.then((e=>{const t=e.draco,o=new t.Decoder;try{const e=function(e,t,i,r){const s=r.attributeIDs,o=r.attributeTypes;let a,l;const c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)a=new e.Mesh,l=t.DecodeArrayToMesh(i,i.byteLength,a);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,l=t.DecodeArrayToPointCloud(i,i.byteLength,a)}if(!l.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in s){const l=self[o[i]];let c,d;if(r.useUniqueIDs)d=s[i],c=t.GetAttributeByUniqueId(a,d);else{if(d=t.GetAttributeId(a,e[s[i]]),-1===d)continue;c=t.GetAttribute(a,d)}const u=n(e,t,a,i,l,c);"color"===i&&(u.vertexColorSpace=r.vertexColorSpace),h.attributes.push(u)}return c===e.TRIANGULAR_MESH&&(h.index=function(e,t,n){const i=3*n.num_faces(),r=4*i,s=e._malloc(r);t.GetTrianglesUInt32Array(n,r,s);const o=new Uint32Array(e.HEAPF32.buffer,s,i).slice();return e._free(s),{array:o,itemSize:1}}(e,t,a)),e.destroy(a),h}(t,o,new Int8Array(i),s),a=e.attributes.map((e=>e.array.buffer));e.index&&a.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},a)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(o)}}))}}}function lf(e,t,n=!0){if(!t||!t.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!e.hasAttribute("position")||!e.hasAttribute("normal")||!e.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function i(e){if(e.normalized||e.isInterleavedBufferAttribute){const t=new Float32Array(e.count*e.itemSize);for(let n=0,i=0;n<e.count;n++)t[i++]=e.getX(n),t[i++]=e.getY(n),e.itemSize>2&&(t[i++]=e.getZ(n));return t}return e.array instanceof Float32Array?e.array:new Float32Array(e.array)}const r=e.index?e.toNonIndexed():e,s=t.generateTangents(i(r.attributes.position),i(r.attributes.normal),i(r.attributes.uv));if(n)for(let e=3;e<s.length;e+=4)s[e]*=-1;return r.setAttribute("tangent",new us(s,4)),e!==r&&e.copy(r),e}function cf(e,t=!1){const n=null!==e[0].index,i=new Set(Object.keys(e[0].attributes)),r=new Set(Object.keys(e[0].morphAttributes)),s={},o={},a=e[0].morphTargetsRelative,l=new Bs;let c=0;for(let h=0;h<e.length;++h){const d=e[h];let u=0;if(n!==(null!==d.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const e in d.attributes){if(!i.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+e+'" attribute exists among all geometries, or in none of them.'),null;void 0===s[e]&&(s[e]=[]),s[e].push(d.attributes[e]),u++}if(u!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const e in d.morphAttributes){if(!r.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;void 0===o[e]&&(o[e]=[]),o[e].push(d.morphAttributes[e])}if(t){let e;if(n)e=d.index.count;else{if(void 0===d.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;e=d.attributes.position.count}l.addGroup(c,e,h),c+=e}}if(n){let t=0;const n=[];for(let i=0;i<e.length;++i){const r=e[i].index;for(let e=0;e<r.count;++e)n.push(r.getX(e)+t);t+=e[i].attributes.position.count}l.setIndex(n)}for(const e in s){const t=hf(s[e]);if(!t)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" attribute."),null;l.setAttribute(e,t)}for(const e in o){const t=o[e][0].length;if(0===t)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[e]=[];for(let n=0;n<t;++n){const t=[];for(let i=0;i<o[e].length;++i)t.push(o[e][i][n]);const i=hf(t);if(!i)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" morphAttribute."),null;l.morphAttributes[e].push(i)}}return l}function hf(e){let t,n,i,r=-1,s=0;for(let o=0;o<e.length;++o){const a=e[o];if(void 0===t&&(t=a.array.constructor),t!==a.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===n&&(n=a.itemSize),n!==a.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===i&&(i=a.normalized),i!==a.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===r&&(r=a.gpuType),r!==a.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=a.count*n}const o=new t(s),a=new us(o,n,i);let l=0;for(let t=0;t<e.length;++t){const i=e[t];if(i.isInterleavedBufferAttribute){const e=l/n;for(let t=0,r=i.count;t<r;t++)for(let r=0;r<n;r++){const n=i.getComponent(t,r);a.setComponent(t+e,r,n)}}else o.set(i.array,l);l+=i.count*n}return void 0!==r&&(a.gpuType=r),a}function df(e){return e.isInstancedInterleavedBufferAttribute||e.isInterleavedBufferAttribute?pf(e):e.isInstancedBufferAttribute?(new jo).copy(e):(new us).copy(e)}function uf(e){let t,n=0,i=0;for(let r=0,s=e.length;r<s;++r){const s=e[r];if(void 0===t&&(t=s.array.constructor),t!==s.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;n+=s.array.length,i+=s.itemSize}const r=new ao(new t(n),i);let s=0;const o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let t=0,n=e.length;t<n;t++){const n=e[t],i=n.itemSize,c=n.count,h=new co(r,i,s,n.normalized);o.push(h),s+=i;for(let e=0;e<c;e++)for(let t=0;t<i;t++)h[l[t]](e,n[a[t]](e))}return o}function pf(e){const t=e.data.array.constructor,n=e.count,i=e.itemSize,r=e.normalized,s=new t(n*i);let o;o=e.isInstancedInterleavedBufferAttribute?new jo(s,i,r,e.meshPerAttribute):new us(s,i,r);for(let t=0;t<n;t++)o.setX(t,e.getX(t)),i>=2&&o.setY(t,e.getY(t)),i>=3&&o.setZ(t,e.getZ(t)),i>=4&&o.setW(t,e.getW(t));return o}function Af(e){const t=e.attributes,n=e.morphTargets,i=new Map;for(const e in t){const n=t[e];n.isInterleavedBufferAttribute&&(i.has(n)||i.set(n,pf(n)),t[e]=i.get(n))}for(const e in n){const t=n[e];t.isInterleavedBufferAttribute&&(i.has(t)||i.set(t,pf(t)),n[e]=i.get(t))}}function ff(e){let t=0;for(const n in e.attributes){const i=e.getAttribute(n);t+=i.count*i.itemSize*i.array.BYTES_PER_ELEMENT}const n=e.getIndex();return t+=n?n.count*n.itemSize*n.array.BYTES_PER_ELEMENT:0,t}function mf(e,t=1e-4){t=Math.max(t,Number.EPSILON);const n={},i=e.getIndex(),r=e.getAttribute("position"),s=i?i.count:r.count;let o=0;const a=Object.keys(e.attributes),l={},c={},h=[],d=["getX","getY","getZ","getW"],u=["setX","setY","setZ","setW"];for(let t=0,n=a.length;t<n;t++){const n=a[t],i=e.attributes[n];l[n]=new i.constructor(new i.array.constructor(i.count*i.itemSize),i.itemSize,i.normalized);const r=e.morphAttributes[n];r&&(c[n]||(c[n]=[]),r.forEach(((e,t)=>{const i=new e.array.constructor(e.count*e.itemSize);c[n][t]=new e.constructor(i,e.itemSize,e.normalized)})))}const p=.5*t,A=Math.log10(1/t),f=Math.pow(10,A),m=p*f;for(let t=0;t<s;t++){const r=i?i.getX(t):t;let s="";for(let t=0,n=a.length;t<n;t++){const n=a[t],i=e.getAttribute(n),o=i.itemSize;for(let e=0;e<o;e++)s+=~~(i[d[e]](r)*f+m)+","}if(s in n)h.push(n[s]);else{for(let t=0,n=a.length;t<n;t++){const n=a[t],i=e.getAttribute(n),s=e.morphAttributes[n],h=i.itemSize,p=l[n],A=c[n];for(let e=0;e<h;e++){const t=d[e],n=u[e];if(p[n](o,i[t](r)),s)for(let e=0,i=s.length;e<i;e++)A[e][n](o,s[e][t](r))}}n[s]=o,h.push(o),o++}}const g=e.clone();for(const t in e.attributes){const e=l[t];if(g.setAttribute(t,new e.constructor(e.array.slice(0,o*e.itemSize),e.itemSize,e.normalized)),t in c)for(let e=0;e<c[t].length;e++){const n=c[t][e];g.morphAttributes[t][e]=new n.constructor(n.array.slice(0,o*n.itemSize),n.itemSize,n.normalized)}}return g.setIndex(h),g}function gf(e,t){if(t===jt)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===qt||t===Wt){let n=e.getIndex();if(null===n){const t=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<i.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}const i=n.count-2,r=[];if(t===qt)for(let e=1;e<=i;e++)r.push(n.getX(0)),r.push(n.getX(e)),r.push(n.getX(e+1));else for(let e=0;e<i;e++)e%2==0?(r.push(n.getX(e)),r.push(n.getX(e+1)),r.push(n.getX(e+2))):(r.push(n.getX(e+2)),r.push(n.getX(e+1)),r.push(n.getX(e)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=e.clone();return s.setIndex(r),s.clearGroups(),s}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}function vf(e){const t=new Li,n=new Li,i=new Li,r=new Li,s=new Li,o=new Li,a=new Li,l=new Li,c=new Li;function h(e,h,d,u,p,A,f,m){t.fromBufferAttribute(h,p),n.fromBufferAttribute(h,A),i.fromBufferAttribute(h,f);const g=e.morphTargetInfluences;if(d&&g){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let e=0,h=d.length;e<h;e++){const h=g[e],m=d[e];0!==h&&(r.fromBufferAttribute(m,p),s.fromBufferAttribute(m,A),o.fromBufferAttribute(m,f),u?(a.addScaledVector(r,h),l.addScaledVector(s,h),c.addScaledVector(o,h)):(a.addScaledVector(r.sub(t),h),l.addScaledVector(s.sub(n),h),c.addScaledVector(o.sub(i),h)))}t.add(a),n.add(l),i.add(c)}e.isSkinnedMesh&&(e.applyBoneTransform(p,t),e.applyBoneTransform(A,n),e.applyBoneTransform(f,i)),m[3*p+0]=t.x,m[3*p+1]=t.y,m[3*p+2]=t.z,m[3*A+0]=n.x,m[3*A+1]=n.y,m[3*A+2]=n.z,m[3*f+0]=i.x,m[3*f+1]=i.y,m[3*f+2]=i.z}const d=e.geometry,u=e.material;let p,A,f;const m=d.index,g=d.attributes.position,v=d.morphAttributes.position,y=d.morphTargetsRelative,E=d.attributes.normal,x=d.morphAttributes.position,b=d.groups,C=d.drawRange;let w,_,M,S,I,B,T;const R=new Float32Array(g.count*g.itemSize),L=new Float32Array(E.count*E.itemSize);if(null!==m)if(Array.isArray(u))for(w=0,M=b.length;w<M;w++)for(I=b[w],B=Math.max(I.start,C.start),T=Math.min(I.start+I.count,C.start+C.count),_=B,S=T;_<S;_+=3)p=m.getX(_),A=m.getX(_+1),f=m.getX(_+2),h(e,g,v,y,p,A,f,R),h(e,E,x,y,p,A,f,L);else for(B=Math.max(0,C.start),T=Math.min(m.count,C.start+C.count),w=B,M=T;w<M;w+=3)p=m.getX(w),A=m.getX(w+1),f=m.getX(w+2),h(e,g,v,y,p,A,f,R),h(e,E,x,y,p,A,f,L);else if(Array.isArray(u))for(w=0,M=b.length;w<M;w++)for(I=b[w],B=Math.max(I.start,C.start),T=Math.min(I.start+I.count,C.start+C.count),_=B,S=T;_<S;_+=3)p=_,A=_+1,f=_+2,h(e,g,v,y,p,A,f,R),h(e,E,x,y,p,A,f,L);else for(B=Math.max(0,C.start),T=Math.min(g.count,C.start+C.count),w=B,M=T;w<M;w+=3)p=w,A=w+1,f=w+2,h(e,g,v,y,p,A,f,R),h(e,E,x,y,p,A,f,L);return{positionAttribute:g,normalAttribute:E,morphedPositionAttribute:new xs(R,3),morphedNormalAttribute:new xs(L,3)}}function yf(e){if(0===e.groups.length)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),e;let t=e.groups;if(t=t.sort(((e,t)=>e.materialIndex!==t.materialIndex?e.materialIndex-t.materialIndex:e.start-t.start)),null===e.getIndex()){const t=e.getAttribute("position"),n=[];for(let e=0;e<t.count;e+=3)n.push(e,e+1,e+2);e.setIndex(n)}const n=e.getIndex(),i=[];for(let e=0;e<t.length;e++){const r=t[e],s=r.start,o=s+r.count;for(let e=s;e<o;e++)i.push(n.getX(e))}e.dispose(),e.setIndex(i);let r=0;for(let e=0;e<t.length;e++){const n=t[e];n.start=r,r+=n.count}let s=t[0];e.groups=[s];for(let n=1;n<t.length;n++){const i=t[n];s.materialIndex===i.materialIndex?s.count+=i.count:(s=i,e.groups.push(s))}return e}function Ef(e,t=Math.PI/3){const n=Math.cos(t),i=100*(1+1e-10),r=[new Li,new Li,new Li],s=new Li,o=new Li,a=new Li,l=new Li;function c(e){return`${~~(e.x*i)},${~~(e.y*i)},${~~(e.z*i)}`}const h=e.index?e.toNonIndexed():e,d=h.attributes.position,u={};for(let e=0,t=d.count/3;e<t;e++){const t=3*e,n=r[0].fromBufferAttribute(d,t+0),i=r[1].fromBufferAttribute(d,t+1),a=r[2].fromBufferAttribute(d,t+2);s.subVectors(a,i),o.subVectors(n,i);const l=(new Li).crossVectors(s,o).normalize();for(let e=0;e<3;e++){const t=c(r[e]);t in u||(u[t]=[]),u[t].push(l)}}const p=new Float32Array(3*d.count),A=new us(p,3,!1);for(let e=0,t=d.count/3;e<t;e++){const t=3*e,i=r[0].fromBufferAttribute(d,t+0),h=r[1].fromBufferAttribute(d,t+1),p=r[2].fromBufferAttribute(d,t+2);s.subVectors(p,h),o.subVectors(i,h),a.crossVectors(s,o).normalize();for(let e=0;e<3;e++){const i=u[c(r[e])];l.set(0,0,0);for(let e=0,t=i.length;e<t;e++){const t=i[e];a.dot(t)>n&&l.add(t)}l.normalize(),A.setXYZ(t+e,l.x,l.y,l.z)}}return h.setAttribute("normal",A),h}function xf(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const bf="KHR_binary_glTF",Cf="KHR_draco_mesh_compression",wf="KHR_lights_punctual",_f="KHR_materials_clearcoat",Mf="KHR_materials_dispersion",Sf="KHR_materials_ior",If="KHR_materials_sheen",Bf="KHR_materials_specular",Tf="KHR_materials_transmission",Rf="KHR_materials_iridescence",Lf="KHR_materials_anisotropy",Df="KHR_materials_unlit",Pf="KHR_materials_volume",Uf="KHR_texture_basisu",Of="KHR_texture_transform",Ff="KHR_mesh_quantization",kf="KHR_materials_emissive_strength",Nf="EXT_materials_bump",Qf="EXT_texture_webp",Gf="EXT_texture_avif",zf="EXT_meshopt_compression",Hf="EXT_mesh_gpu_instancing";class Vf{constructor(e){this.parser=e,this.name=wf,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const r=t.json,s=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let o;const a=new es(16777215);void 0!==s.color&&a.setRGB(s.color[0],s.color[1],s.color[2],nn);const l=void 0!==s.range?s.range:0;switch(s.type){case"directional":o=new Bh(a),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new Mh(a),o.distance=l;break;case"spot":o=new xh(a),o.distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,o.angle=s.spot.outerConeAngle,o.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return o.position.set(0,0,0),o.decay=2,_m(o,s),void 0!==s.intensity&&(o.intensity=s.intensity),o.name=t.createUniqueName(s.name||"light_"+e),i=Promise.resolve(o),t.cache.add(n,i),i}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,i=n.json.nodes[e],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(e){return n._getNodeRef(t.cache,r,e)}))}}class jf{constructor(){this.name=Df}getMaterialType(){return rs}extendParams(e,t,n){const i=[];e.color=new es(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const t=r.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],nn),e.opacity=t[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture,tn))}return Promise.all(i)}}class Wf{constructor(e){this.parser=e,this.name=kf}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return void 0!==i&&(t.emissiveIntensity=i),Promise.resolve()}}class qf{constructor(e){this.parser=e,this.name=_f}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];if(void 0!==s.clearcoatFactor&&(t.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&r.push(n.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(r.push(n.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){const e=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new ti(e,e)}return Promise.all(r)}}class Xf{constructor(e){this.parser=e,this.name=Mf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class Yf{constructor(e){this.parser=e,this.name=Rf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.iridescenceFactor&&(t.iridescence=s.iridescenceFactor),void 0!==s.iridescenceTexture&&r.push(n.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),void 0!==s.iridescenceIor&&(t.iridescenceIOR=s.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==s.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),void 0!==s.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),void 0!==s.iridescenceThicknessTexture&&r.push(n.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class Jf{constructor(e){this.parser=e,this.name=If}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new es(0,0,0),t.sheenRoughness=0,t.sheen=1;const s=i.extensions[this.name];if(void 0!==s.sheenColorFactor){const e=s.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],nn)}return void 0!==s.sheenRoughnessFactor&&(t.sheenRoughness=s.sheenRoughnessFactor),void 0!==s.sheenColorTexture&&r.push(n.assignTexture(t,"sheenColorMap",s.sheenColorTexture,tn)),void 0!==s.sheenRoughnessTexture&&r.push(n.assignTexture(t,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(r)}}class Kf{constructor(e){this.parser=e,this.name=Tf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.transmissionFactor&&(t.transmission=s.transmissionFactor),void 0!==s.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class Zf{constructor(e){this.parser=e,this.name=Pf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];t.thickness=void 0!==s.thicknessFactor?s.thicknessFactor:0,void 0!==s.thicknessTexture&&r.push(n.assignTexture(t,"thicknessMap",s.thicknessTexture)),t.attenuationDistance=s.attenuationDistance||1/0;const o=s.attenuationColor||[1,1,1];return t.attenuationColor=(new es).setRGB(o[0],o[1],o[2],nn),Promise.all(r)}}class $f{constructor(e){this.parser=e,this.name=Sf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class em{constructor(e){this.parser=e,this.name=Bf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];t.specularIntensity=void 0!==s.specularFactor?s.specularFactor:1,void 0!==s.specularTexture&&r.push(n.assignTexture(t,"specularIntensityMap",s.specularTexture));const o=s.specularColorFactor||[1,1,1];return t.specularColor=(new es).setRGB(o[0],o[1],o[2],nn),void 0!==s.specularColorTexture&&r.push(n.assignTexture(t,"specularColorMap",s.specularColorTexture,tn)),Promise.all(r)}}class tm{constructor(e){this.parser=e,this.name=Nf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return t.bumpScale=void 0!==s.bumpFactor?s.bumpFactor:1,void 0!==s.bumpTexture&&r.push(n.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(r)}}class nm{constructor(e){this.parser=e,this.name=Lf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.anisotropyStrength&&(t.anisotropy=s.anisotropyStrength),void 0!==s.anisotropyRotation&&(t.anisotropyRotation=s.anisotropyRotation),void 0!==s.anisotropyTexture&&r.push(n.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class im{constructor(e){this.parser=e,this.name=Uf}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],s=t.options.ktx2Loader;if(!s){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,s)}}class rm{constructor(e){this.parser=e,this.name=Qf,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const s=r.extensions[t],o=i.images[s.source];let a=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(a=e)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(e,s.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class sm{constructor(e){this.parser=e,this.name=Gf,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const s=r.extensions[t],o=i.images[s.source];let a=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(a=e)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(e,s.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class om{constructor(e){this.name=zf,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(t){const n=e.byteOffset||0,i=e.byteLength||0,s=e.count,o=e.byteStride,a=new Uint8Array(t,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(s,o,a,e.mode,e.filter).then((function(e){return e.buffer})):r.ready.then((function(){const t=new ArrayBuffer(s*o);return r.decodeGltfBuffer(new Uint8Array(t),s,o,a,e.mode,e.filter),t}))}))}return null}}class am{constructor(e){this.name=Hf,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=t.meshes[n.mesh];for(const e of i.primitives)if(e.mode!==mm.TRIANGLES&&e.mode!==mm.TRIANGLE_STRIP&&e.mode!==mm.TRIANGLE_FAN&&void 0!==e.mode)return null;const r=n.extensions[this.name].attributes,s=[],o={};for(const e in r)s.push(this.parser.getDependency("accessor",r[e]).then((t=>(o[e]=t,o[e]))));return s.length<1?null:(s.push(this.parser.createNodeMesh(e)),Promise.all(s).then((e=>{const t=e.pop(),n=t.isGroup?t.children:[t],i=e[0].count,r=[];for(const e of n){const t=new lr,n=new Li,s=new Ri,a=new Li(1,1,1),l=new $o(e.geometry,e.material,i);for(let e=0;e<i;e++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&s.fromBufferAttribute(o.ROTATION,e),o.SCALE&&a.fromBufferAttribute(o.SCALE,e),l.setMatrixAt(e,t.compose(n,s,a));for(const t in o)if("_COLOR_0"===t){const e=o[t];l.instanceColor=new jo(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,o[t]);Ur.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),r.push(l)}return t.isGroup?(t.clear(),t.add(...r),t):r[0]})))}}const lm="glTF";class cm{constructor(e){this.name=bf,this.content=null,this.body=null;const t=new DataView(e,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==lm)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,r=new DataView(e,12);let s=0;for(;s<i;){const t=r.getUint32(s,!0);s+=4;const i=r.getUint32(s,!0);if(s+=4,1313821514===i){const i=new Uint8Array(e,12+s,t);this.content=n.decode(i)}else if(5130562===i){const n=12+s;this.body=e.slice(n,n+t)}s+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class hm{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Cf,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,o={},a={},l={};for(const e in s){const t=xm[e]||e.toLowerCase();o[t]=s[e]}for(const t in e.attributes){const i=xm[t]||t.toLowerCase();if(void 0!==s[t]){const r=n.accessors[e.attributes[t]],s=gm[r.componentType];l[i]=s.name,a[i]=!0===r.normalized}}return t.getDependency("bufferView",r).then((function(e){return new Promise((function(t,n){i.decodeDracoFile(e,(function(e){for(const t in e.attributes){const n=e.attributes[t],i=a[t];void 0!==i&&(n.normalized=i)}t(e)}),o,l,nn,n)}))}))}}class dm{constructor(){this.name=Of}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class um{constructor(){this.name=Ff}}class pm extends Gc{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let e=0;e!==i;e++)t[e]=n[r+e];return t}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=2*o,l=3*o,c=i-t,h=(n-t)/c,d=h*h,u=d*h,p=e*l,A=p-l,f=-2*u+3*d,m=u-d,g=1-f,v=m-d+h;for(let e=0;e!==o;e++){const t=s[A+e+o],n=s[A+e+a]*c,i=s[p+e+o],l=s[p+e]*c;r[e]=g*t+v*n+f*i+m*l}return r}}const Am=new Ri;class fm extends pm{interpolate_(e,t,n,i){const r=super.interpolate_(e,t,n,i);return Am.fromArray(r).normalize().toArray(r),r}}const mm={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},gm={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},vm={9728:xe,9729:Me,9984:be,9985:Se,9986:we,9987:Be},ym={33071:ye,33648:Ee,10497:ve},Em={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},xm={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},bm={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Cm={CUBICSPLINE:void 0,LINEAR:kt,STEP:Ft};function wm(e,t,n){for(const i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function _m(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Mm(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){const n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,i=n.length;t<i;t++)e.morphTargetDictionary[n[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Sm(e){let t;const n=e.extensions&&e.extensions[Cf];if(t=n?"draco:"+n.bufferView+":"+n.indices+":"+Im(n.attributes):e.indices+":"+Im(e.attributes)+":"+e.mode,void 0!==e.targets)for(let n=0,i=e.targets.length;n<i;n++)t+=":"+Im(e.targets[n]);return t}function Im(e){let t="";const n=Object.keys(e).sort();for(let i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function Bm(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const Tm=new lr;class Rm{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new xf,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,s=-1;if("undefined"!=typeof navigator){const e=navigator.userAgent;n=!0===/^((?!chrome|android).)*safari/i.test(e);const t=e.match(/Version\/(\d+)/);i=n&&t?parseInt(t[1],10):-1,r=e.indexOf("Firefox")>-1,s=r?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||n&&i<17||r&&s<98?this.textureLoader=new ph(this.options.manager):this.textureLoader=new zh(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ah(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){const s={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};return wm(r,s,i),_m(s,i),Promise.all(n._invokeAll((function(e){return e.afterRoot&&e.afterRoot(s)}))).then((function(){for(const e of s.scenes)e.updateMatrixWorld();e(s)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n].joints;for(let t=0,n=i.length;t<n;t++)e[i[t]].isBone=!0}for(let t=0,i=e.length;t<i;t++){const i=e[t];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(n[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),r=(e,t)=>{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[n,i]of e.children.entries())r(i,t.children[n])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":i=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":i=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne((function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)})),!i)throw new Error("Unknown type: "+e)}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map((function(t,i){return n.getDependency(e,i)}))),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[bf].body);const i=this.options;return new Promise((function(e,r){n.load(Uh.resolveURL(t.uri,i.path),e,void 0,(function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){const n=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+n)}))}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse){const e=Em[i.type],t=gm[i.componentType],n=!0===i.normalized,r=new t(i.count*e);return Promise.resolve(new us(r,e,n))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then((function(e){const r=e[0],s=Em[i.type],o=gm[i.componentType],a=o.BYTES_PER_ELEMENT,l=a*s,c=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized;let u,p;if(h&&h!==l){const e=Math.floor(c/h),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+e+":"+i.count;let l=t.cache.get(n);l||(u=new o(r,e*h,i.count*h/a),l=new ao(u,h/a),t.cache.add(n,l)),p=new co(l,s,c%h/a,d)}else u=null===r?new o(i.count*s):new o(r,c,i.count*s),p=new us(u,s,d);if(void 0!==i.sparse){const t=Em.SCALAR,n=gm[i.sparse.indices.componentType],a=i.sparse.indices.byteOffset||0,l=i.sparse.values.byteOffset||0,c=new n(e[1],a,i.sparse.count*t),h=new o(e[2],l,i.sparse.count*s);null!==r&&(p=new us(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let e=0,t=c.length;e<t;e++){const t=c[e];if(p.setX(t,h[e*s]),s>=2&&p.setY(t,h[e*s+1]),s>=3&&p.setZ(t,h[e*s+2]),s>=4&&p.setW(t,h[e*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}p.normalized=d}return p}))}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,r=t.images[i];let s=this.textureLoader;if(r.uri){const e=n.manager.getHandler(r.uri);null!==e&&(s=e)}return this.loadTextureImage(e,i,s)}loadTextureImage(e,t,n){const i=this,r=this.json,s=r.textures[e],o=r.images[t],a=(o.uri||o.bufferView)+":"+s.sampler;if(this.textureCache[a])return this.textureCache[a];const l=this.loadImageSource(t,n).then((function(t){t.flipY=!1,t.name=s.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);const n=(r.samplers||{})[s.sampler]||{};return t.magFilter=vm[n.magFilter]||Me,t.minFilter=vm[n.minFilter]||Be,t.wrapS=ym[n.wrapS]||ve,t.wrapT=ym[n.wrapT]||ve,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==xe&&t.minFilter!==Me,i.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[a]=l,l}loadImageSource(e,t){const n=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const r=n.images[e],s=self.URL||self.webkitURL;let o=r.uri||"",a=!1;if(void 0!==r.bufferView)o=this.getDependency("bufferView",r.bufferView).then((function(e){a=!0;const t=new Blob([e],{type:r.mimeType});return o=s.createObjectURL(t),o}));else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const l=Promise.resolve(o).then((function(e){return new Promise((function(n,r){let s=n;!0===t.isImageBitmapLoader&&(s=function(e){const t=new Ci(e);t.needsUpdate=!0,n(t)}),t.load(Uh.resolveURL(e,i.path),s,void 0,r)}))})).then((function(e){var t;return!0===a&&s.revokeObjectURL(o),_m(e,r),e.userData.mimeType=r.mimeType||((t=r.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":t.search(/\.ktx2($|\?)/i)>0||0===t.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e}));return this.sourceCache[e]=l,l}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then((function(s){if(!s)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((s=s.clone()).channel=n.texCoord),r.extensions[Of]){const e=void 0!==n.extensions?n.extensions[Of]:void 0;if(e){const t=r.associations.get(s);s=r.extensions[Of].extendTexture(s,e),r.associations.set(s,t)}}return void 0!==i&&(s.colorSpace=i),e[t]=s,s}))}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=void 0===t.attributes.tangent,r=void 0!==t.attributes.color,s=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new Na,is.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new _a,is.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(i||r||s){let e="ClonedMaterial:"+n.uuid+":";i&&(e+="derivative-tangents:"),r&&(e+="vertex-colors:"),s&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),r&&(t.vertexColors=!0),s&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return _c}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let s;const o={},a=[];if((r.extensions||{})[Df]){const e=i[Df];s=e.getMaterialType(),a.push(e.extendParams(o,r,t))}else{const n=r.pbrMetallicRoughness||{};if(o.color=new es(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],nn),o.opacity=e[3]}void 0!==n.baseColorTexture&&a.push(t.assignTexture(o,"map",n.baseColorTexture,tn)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(a.push(t.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),a.push(t.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),s=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),a.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)}))))}!0===r.doubleSided&&(o.side=v);const l=r.alphaMode||"OPAQUE";if("BLEND"===l?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,"MASK"===l&&(o.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&s!==rs&&(a.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new ti(1,1),void 0!==r.normalTexture.scale)){const e=r.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==r.occlusionTexture&&s!==rs&&(a.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(o.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&s!==rs){const e=r.emissiveFactor;o.emissive=(new es).setRGB(e[0],e[1],e[2],nn)}return void 0!==r.emissiveTexture&&s!==rs&&a.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,tn)),Promise.all(a).then((function(){const n=new s(o);return r.name&&(n.name=r.name),_m(n,r),t.associations.set(n,{materials:e}),r.extensions&&wm(i,n,r),n}))}createUniqueName(e){const t=vd.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(e){return n[Cf].decodePrimitive(e,t).then((function(n){return Lm(n,e,t)}))}const s=[];for(let n=0,o=e.length;n<o;n++){const o=e[n],a=Sm(o),l=i[a];if(l)s.push(l.promise);else{let e;e=o.extensions&&o.extensions[Cf]?r(o):Lm(new Bs,o,t),i[a]={primitive:o,promise:e},s.push(e)}}return Promise.all(s)}loadMesh(e){const t=this,n=this.json,i=this.extensions,r=n.meshes[e],s=r.primitives,o=[];for(let e=0,t=s.length;e<t;e++){const t=void 0===s[e].material?(void 0===(a=this.cache).DefaultMaterial&&(a.DefaultMaterial=new _c({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:m})),a.DefaultMaterial):this.getDependency("material",s[e].material);o.push(t)}var a;return o.push(t.loadGeometries(s)),Promise.all(o).then((function(n){const o=n.slice(0,n.length-1),a=n[n.length-1],l=[];for(let n=0,c=a.length;n<c;n++){const c=a[n],h=s[n];let d;const u=o[n];if(h.mode===mm.TRIANGLES||h.mode===mm.TRIANGLE_STRIP||h.mode===mm.TRIANGLE_FAN||void 0===h.mode)d=!0===r.isSkinnedMesh?new No(c,u):new Gs(c,u),!0===d.isSkinnedMesh&&d.normalizeSkinWeights(),h.mode===mm.TRIANGLE_STRIP?d.geometry=gf(d.geometry,Wt):h.mode===mm.TRIANGLE_FAN&&(d.geometry=gf(d.geometry,qt));else if(h.mode===mm.LINES)d=new Fa(c,u);else if(h.mode===mm.LINE_STRIP)d=new Da(c,u);else if(h.mode===mm.LINE_LOOP)d=new ka(c,u);else{if(h.mode!==mm.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);d=new Va(c,u)}Object.keys(d.geometry.morphAttributes).length>0&&Mm(d,r),d.name=t.createUniqueName(r.name||"mesh_"+e),_m(d,r),h.extensions&&wm(i,d,h),t.assignFinalMaterial(d),l.push(d)}for(let n=0,i=l.length;n<i;n++)t.associations.set(l[n],{meshes:e,primitives:n});if(1===l.length)return r.extensions&&wm(i,l[0],r),l[0];const c=new Wa;r.extensions&&wm(i,c,r),t.associations.set(c,{meshes:e});for(let e=0,t=l.length;e<t;e++)c.add(l[e]);return c}))}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(i)return"perspective"===n.type?t=new $s(ei.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(t=new Sh(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),_m(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],n=[];for(let e=0,i=t.joints.length;e<i;e++)n.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then((function(e){const n=e.pop(),i=e,r=[],s=[];for(let e=0,o=i.length;e<o;e++){const o=i[e];if(o){r.push(o);const t=new lr;null!==n&&t.fromArray(n.array,16*e),s.push(t)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new Vo(r,s)}))}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,s=[],o=[],a=[],l=[],c=[];for(let e=0,t=i.channels.length;e<t;e++){const t=i.channels[e],n=i.samplers[t.sampler],r=t.target,h=r.node,d=void 0!==i.parameters?i.parameters[n.input]:n.input,u=void 0!==i.parameters?i.parameters[n.output]:n.output;void 0!==r.node&&(s.push(this.getDependency("node",h)),o.push(this.getDependency("accessor",d)),a.push(this.getDependency("accessor",u)),l.push(n),c.push(r))}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(a),Promise.all(l),Promise.all(c)]).then((function(e){const t=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=[];for(let e=0,r=t.length;e<r;e++){const r=t[e],c=i[e],h=s[e],d=o[e],u=a[e];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();const p=n._createAnimationTracks(r,c,h,d,u);if(p)for(let e=0;e<p.length;e++)l.push(p[e])}return new $c(r,void 0,l)}))}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return void 0===i.mesh?null:n.getDependency("mesh",i.mesh).then((function(e){const t=n._getNodeRef(n.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,n=i.weights.length;t<n;t++)e.morphTargetInfluences[t]=i.weights[t]})),t}))}loadNode(e){const t=this,n=this.json.nodes[e],i=t._loadNodeShallow(e),r=[],s=n.children||[];for(let e=0,n=s.length;e<n;e++)r.push(t.getDependency("node",s[e]));const o=void 0===n.skin?Promise.resolve(null):t.getDependency("skin",n.skin);return Promise.all([i,Promise.all(r),o]).then((function(e){const t=e[0],n=e[1],i=e[2];null!==i&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(i,Tm)}));for(let e=0,i=n.length;e<i;e++)t.add(n[e]);return t}))}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const r=t.nodes[e],s=r.name?i.createUniqueName(r.name):"",o=[],a=i._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return a&&o.push(a),void 0!==r.camera&&o.push(i.getDependency("camera",r.camera).then((function(e){return i._getNodeRef(i.cameraCache,r.camera,e)}))),i._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){o.push(e)})),this.nodeCache[e]=Promise.all(o).then((function(t){let o;if(o=!0===r.isBone?new Qo:t.length>1?new Wa:1===t.length?t[0]:new Ur,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(r.name&&(o.userData.name=r.name,o.name=s),_m(o,r),r.extensions&&wm(n,o,r),void 0!==r.matrix){const e=new lr;e.fromArray(r.matrix),o.applyMatrix4(e)}else void 0!==r.translation&&o.position.fromArray(r.translation),void 0!==r.rotation&&o.quaternion.fromArray(r.rotation),void 0!==r.scale&&o.scale.fromArray(r.scale);return i.associations.has(o)||i.associations.set(o,{}),i.associations.get(o).nodes=e,o})),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,r=new Wa;n.name&&(r.name=i.createUniqueName(n.name)),_m(r,n),n.extensions&&wm(t,r,n);const s=n.nodes||[],o=[];for(let e=0,t=s.length;e<t;e++)o.push(i.getDependency("node",s[e]));return Promise.all(o).then((function(e){for(let t=0,n=e.length;t<n;t++)r.add(e[t]);return i.associations=(e=>{const t=new Map;for(const[e,n]of i.associations)(e instanceof is||e instanceof Ci)&&t.set(e,n);return e.traverse((e=>{const n=i.associations.get(e);null!=n&&t.set(e,n)})),t})(r),r}))}_createAnimationTracks(e,t,n,i,r){const s=[],o=e.name?e.name:e.uuid,a=[];let l;switch(bm[r.path]===bm.weights?e.traverse((function(e){e.morphTargetInfluences&&a.push(e.name?e.name:e.uuid)})):a.push(o),bm[r.path]){case bm.weights:l=Xc;break;case bm.rotation:l=Jc;break;case bm.position:case bm.scale:l=Zc;break;default:l=1===n.itemSize?Xc:Zc}const c=void 0!==i.interpolation?Cm[i.interpolation]:kt,h=this._getArrayFromAccessor(n);for(let e=0,n=a.length;e<n;e++){const n=new l(a[e]+"."+bm[r.path],t.array,h,c);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(n),s.push(n)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=Bm(t.constructor),n=new Float32Array(t.length);for(let i=0,r=t.length;i<r;i++)n[i]=t[i]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof Jc?fm:pm)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Lm(e,t,n){const i=t.attributes,r=[];function s(t,i){return n.getDependency("accessor",t).then((function(t){e.setAttribute(i,t)}))}for(const t in i){const n=xm[t]||t.toLowerCase();n in e.attributes||r.push(s(i[t],n))}if(void 0!==t.indices&&!e.index){const i=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));r.push(i)}return Ai.workingColorSpace!==nn&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ai.workingColorSpace}" not supported.`),_m(e,t),function(e,t,n){const i=t.attributes,r=new Ui;if(void 0===i.POSITION)return;{const e=n.json.accessors[i.POSITION],t=e.min,s=e.max;if(void 0===t||void 0===s)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new Li(t[0],t[1],t[2]),new Li(s[0],s[1],s[2])),e.normalized){const t=Bm(gm[e.componentType]);r.min.multiplyScalar(t),r.max.multiplyScalar(t)}}const s=t.targets;if(void 0!==s){const e=new Li,t=new Li;for(let i=0,r=s.length;i<r;i++){const r=s[i];if(void 0!==r.POSITION){const i=n.json.accessors[r.POSITION],s=i.min,o=i.max;if(void 0!==s&&void 0!==o){if(t.setX(Math.max(Math.abs(s[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(s[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(s[2]),Math.abs(o[2]))),i.normalized){const e=Bm(gm[i.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(e)}e.boundingBox=r;const o=new $i;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=o}(e,t,n),Promise.all(r).then((function(){return void 0!==t.targets?function(e,t,n){let i=!1,r=!1,s=!1;for(let e=0,n=t.length;e<n;e++){const n=t[e];if(void 0!==n.POSITION&&(i=!0),void 0!==n.NORMAL&&(r=!0),void 0!==n.COLOR_0&&(s=!0),i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(e);const o=[],a=[],l=[];for(let c=0,h=t.length;c<h;c++){const h=t[c];if(i){const t=void 0!==h.POSITION?n.getDependency("accessor",h.POSITION):e.attributes.position;o.push(t)}if(r){const t=void 0!==h.NORMAL?n.getDependency("accessor",h.NORMAL):e.attributes.normal;a.push(t)}if(s){const t=void 0!==h.COLOR_0?n.getDependency("accessor",h.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l)]).then((function(t){const n=t[0],o=t[1],a=t[2];return i&&(e.morphAttributes.position=n),r&&(e.morphAttributes.normal=o),s&&(e.morphAttributes.color=a),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}class Dm{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const n=this.workersResolve[e];if(n&&n(t),this.queue.length){const{resolve:t,msg:n,transfer:i}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(n,i)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise((n=>{const i=this._getIdleWorker();-1!==i?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=n,this.workers[i].postMessage(e,t)):this.queue.push({resolve:n,msg:e,transfer:t})}))}dispose(){this.workers.forEach((e=>e.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const Pm=9,Um=15,Om=16,Fm=22,km=37,Nm=43,Qm=76,Gm=83,zm=97,Hm=100,Vm=103,jm=109,Wm=165,qm=166,Xm=1000066e3;class Ym{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Jm{constructor(e,t,n,i){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,n),this._littleEndian=i,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t){void 0===t&&(t=0);const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}new Uint8Array([0]);const Km=[171,75,84,88,32,50,48,187,13,10,26,10];function Zm(e){return(new TextDecoder).decode(e)}var $m=n(9922).hp;let eg,tg,ng;const ig={env:{emscripten_notify_memory_growth:function(e){ng=new Uint8Array(tg.exports.memory.buffer)}}};class rg{init(){return eg||(eg="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+sg).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,ig))).then(this._init):WebAssembly.instantiate($m.from(sg,"base64"),ig).then(this._init),eg)}_init(e){tg=e.instance,ig.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!tg)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=e.byteLength,i=tg.exports.malloc(n);ng.set(e,i),t=t||Number(tg.exports.ZSTD_findDecompressedSize(i,n));const r=tg.exports.malloc(t),s=tg.exports.ZSTD_decompress(r,t,i,n),o=ng.slice(r,r+s);return tg.exports.free(i),tg.exports.free(r),o}}const sg="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",og=new WeakMap;let ag,lg=0;class cg extends rh{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new Dm,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const e=new ah(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),n=new ah(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,i]).then((([e,t])=>{const n=cg.BasisWorker.toString(),i=["/* constants */","let _EngineFormat = "+JSON.stringify(cg.EngineFormat),"let _EngineType = "+JSON.stringify(cg.EngineType),"let _TranscoderFormat = "+JSON.stringify(cg.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(cg.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i])),this.transcoderBinary=t,this.workerPool.setWorkerCreator((()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e}))})),lg>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),lg++}return this.transcoderPending}load(e,t,n,i){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new ah(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(e,(e=>{this.parse(e,t,i)}),n,i)}parse(e,t,n){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(og.has(e))return og.get(e).promise.then(t).catch(n);this._createTexture(e).then((e=>t?t(e):null)).catch(n)}_createTextureFrom(e,t){const{type:n,error:i,data:{faces:r,width:s,height:o,format:a,type:l,dfdFlags:c}}=e;if("error"===n)return Promise.reject(i);let h;if(6===t.faceCount)h=new Ka(r,a,l);else{const e=r[0].mipmaps;h=t.layerCount>1?new Ja(e,s,o,t.layerCount,a,l):new Ya(e,s,o,a,l)}return h.minFilter=1===r[0].mipmaps.length?Me:Be,h.magFilter=Me,h.generateMipmaps=!1,h.needsUpdate=!0,h.colorSpace=pg(t),h.premultiplyAlpha=!!(1&c),h}async _createTexture(e,t={}){const n=function(e){const t=new Uint8Array(e.buffer,e.byteOffset,Km.length);if(t[0]!==Km[0]||t[1]!==Km[1]||t[2]!==Km[2]||t[3]!==Km[3]||t[4]!==Km[4]||t[5]!==Km[5]||t[6]!==Km[6]||t[7]!==Km[7]||t[8]!==Km[8]||t[9]!==Km[9]||t[10]!==Km[10]||t[11]!==Km[11])throw new Error("Missing KTX 2.0 identifier.");const n=new Ym,i=17*Uint32Array.BYTES_PER_ELEMENT,r=new Jm(e,Km.length,i,!0);n.vkFormat=r._nextUint32(),n.typeSize=r._nextUint32(),n.pixelWidth=r._nextUint32(),n.pixelHeight=r._nextUint32(),n.pixelDepth=r._nextUint32(),n.layerCount=r._nextUint32(),n.faceCount=r._nextUint32();const s=r._nextUint32();n.supercompressionScheme=r._nextUint32();const o=r._nextUint32(),a=r._nextUint32(),l=r._nextUint32(),c=r._nextUint32(),h=r._nextUint64(),d=r._nextUint64(),u=new Jm(e,Km.length+i,3*s*8,!0);for(let t=0;t<s;t++)n.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+u._nextUint64(),u._nextUint64()),uncompressedByteLength:u._nextUint64()});const p=new Jm(e,o,a,!0),A={vendorId:p._skip(4)._nextUint16(),descriptorType:p._nextUint16(),versionNumber:p._nextUint16(),descriptorBlockSize:p._nextUint16(),colorModel:p._nextUint8(),colorPrimaries:p._nextUint8(),transferFunction:p._nextUint8(),flags:p._nextUint8(),texelBlockDimension:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],bytesPlane:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],samples:[]},f=(A.descriptorBlockSize/4-6)/4;for(let e=0;e<f;e++){const t={bitOffset:p._nextUint16(),bitLength:p._nextUint8(),channelType:p._nextUint8(),samplePosition:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=p._nextInt32(),t.sampleUpper=p._nextInt32()):(t.sampleLower=p._nextUint32(),t.sampleUpper=p._nextUint32()),A.samples[e]=t}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(A);const m=new Jm(e,l,c,!0);for(;m._offset<c;){const e=m._nextUint32(),t=m._scan(e),i=Zm(t);if(n.keyValue[i]=m._nextUint8Array(e-t.byteLength-1),i.match(/^ktx/i)){const e=Zm(n.keyValue[i]);n.keyValue[i]=e.substring(0,e.lastIndexOf("\0"))}m._skip(e%4?4-e%4:0)}if(d<=0)return n;const g=new Jm(e,h,d,!0),v=g._nextUint16(),y=g._nextUint16(),E=g._nextUint32(),x=g._nextUint32(),b=g._nextUint32(),C=g._nextUint32(),w=[];for(let e=0;e<s;e++)w.push({imageFlags:g._nextUint32(),rgbSliceByteOffset:g._nextUint32(),rgbSliceByteLength:g._nextUint32(),alphaSliceByteOffset:g._nextUint32(),alphaSliceByteLength:g._nextUint32()});const _=h+g._offset,M=_+E,S=M+x,I=S+b,B=new Uint8Array(e.buffer,e.byteOffset+_,E),T=new Uint8Array(e.buffer,e.byteOffset+M,x),R=new Uint8Array(e.buffer,e.byteOffset+S,b),L=new Uint8Array(e.buffer,e.byteOffset+I,C);return n.globalData={endpointCount:v,selectorCount:y,imageDescs:w,endpointsData:B,selectorsData:T,tablesData:R,extendedData:L},n}(new Uint8Array(e)),i=n.vkFormat===Xm&&167===n.dataFormatDescriptor[0].colorModel;if(0!==n.vkFormat&&(!i||this.workerConfig.astcHDRSupported))return async function(e){const{vkFormat:t}=e;if(void 0===dg[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let n;2===e.supercompressionScheme&&(ag||(ag=new Promise((async e=>{const t=new rg;await t.init(),e(t)}))),n=await ag);const i=[];for(let r=0;r<e.levels.length;r++){const s=Math.max(1,e.pixelWidth>>r),o=Math.max(1,e.pixelHeight>>r),a=e.pixelDepth?Math.max(1,e.pixelDepth>>r):0,l=e.levels[r];let c,h;if(0===e.supercompressionScheme)c=l.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");c=n.decode(l.levelData,l.uncompressedByteLength)}h=ug[t]===Fe?new Float32Array(c.buffer,c.byteOffset,c.byteLength/Float32Array.BYTES_PER_ELEMENT):ug[t]===ke?new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT):c,i.push({data:h,width:s,height:o,depth:a})}let r;if(hg.has(dg[t]))r=0===e.pixelDepth?new Go(i[0].data,e.pixelWidth,e.pixelHeight):new Bi(i[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");r=new Ya(i,e.pixelWidth,e.pixelHeight),r.minFilter=1===i.length?Me:Be,r.magFilter=Me}return r.mipmaps=i,r.type=ug[t],r.format=dg[t],r.colorSpace=pg(e),r.needsUpdate=!0,Promise.resolve(r)}(n);const r=t,s=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:r},[e]))).then((e=>this._createTextureFrom(e.data,n)));return og.set(e,{promise:s}),s}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),lg--,this}}cg.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},cg.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25},cg.EngineFormat={RGBAFormat:je,RGBA_ASTC_4x4_Format:pt,RGB_BPTC_UNSIGNED_Format:Bt,RGBA_BPTC_Format:St,RGBA_ETC2_EAC_Format:ut,RGBA_PVRTC_4BPPV1_Format:lt,RGBA_S3TC_DXT5_Format:st,RGB_ETC1_Format:ht,RGB_ETC2_Format:dt,RGB_PVRTC_4BPPV1_Format:ot,RGBA_S3TC_DXT1_Format:it},cg.EngineType={UnsignedByteType:Re,HalfFloatType:ke,FloatType:Fe},cg.BasisWorker=function(){let e,t,n;const i=_EngineFormat,r=_EngineType,s=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",(function(i){const s=i.data;switch(s.type){case"init":e=s.config,a=s.transcoderBinary,t=new Promise((e=>{n={wasmBinary:a,onRuntimeInitialized:e},BASIS(n)})).then((()=>{n.initializeBasis(),void 0===n.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}));break;case"transcode":t.then((()=>{try{const{faces:t,buffers:i,width:a,height:d,hasAlpha:u,format:p,type:A,dfdFlags:f}=function(t){const i=new n.KTX2File(new Uint8Array(t));function s(){i.close(),i.delete()}if(!i.isValid())throw s(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");let a;if(i.isUASTC())a=o.UASTC;else if(i.isETC1S())a=o.ETC1S;else{if(!i.isHDR())throw new Error("THREE.KTX2Loader: Unknown Basis encoding");a=o.UASTC_HDR}const d=i.getWidth(),u=i.getHeight(),p=i.getLayers()||1,A=i.getLevels(),f=i.getFaces(),m=i.getHasAlpha(),g=i.getDFDFlags(),{transcoderFormat:v,engineFormat:y,engineType:E}=function(t,n,i,r){const s=l[t];for(let o=0;o<s.length;o++){const a=s[o];if((!a.if||e[a.if])&&(a.basisFormat.includes(t)&&!(r&&a.transcoderFormat.length<2)&&(!a.needsPowerOfTwo||c(n)&&c(i))))return{transcoderFormat:a.transcoderFormat[r?1:0],engineFormat:a.engineFormat[r?1:0],engineType:a.engineType[0]}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}(a,d,u,m);if(!d||!u||!A)throw s(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!i.startTranscoding())throw s(),new Error("THREE.KTX2Loader: .startTranscoding failed");const x=[],b=[];for(let e=0;e<f;e++){const t=[];for(let n=0;n<A;n++){const o=[];let a,l;for(let t=0;t<p;t++){const c=i.getImageLevelInfo(n,t,e);0!==e||0!==n||0!==t||c.origWidth%4==0&&c.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),A>1?(a=c.origWidth,l=c.origHeight):(a=c.width,l=c.height);let h=new Uint8Array(i.getImageTranscodedSizeInBytes(n,t,0,v));const d=i.transcodeImage(h,n,t,e,v,0,-1,-1);if(E===r.HalfFloatType&&(h=new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!d)throw s(),new Error("THREE.KTX2Loader: .transcodeImage failed.");o.push(h)}const c=h(o);t.push({data:c,width:a,height:l}),b.push(c.buffer)}x.push({mipmaps:t,width:d,height:u,format:y,type:E})}return s(),{faces:x,buffers:b,width:d,height:u,hasAlpha:m,dfdFlags:g,format:y,type:E}}(s.buffer);self.postMessage({type:"transcode",id:s.id,data:{faces:t,width:a,height:d,hasAlpha:u,format:p,type:A,dfdFlags:f}},i)}catch(e){console.error(e),self.postMessage({type:"error",id:s.id,error:e.message})}}))}var a}));const a=[{if:"astcSupported",basisFormat:[o.UASTC],transcoderFormat:[s.ASTC_4x4,s.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],engineType:[r.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC7_M5,s.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],engineType:[r.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC1,s.BC3],engineFormat:[i.RGBA_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],engineType:[r.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1,s.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],engineType:[r.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1],engineFormat:[i.RGB_ETC1_Format],engineType:[r.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.PVRTC1_4_RGB,s.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],engineType:[r.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[o.UASTC_HDR],transcoderFormat:[s.BC6H],engineFormat:[i.RGB_BPTC_UNSIGNED_Format],engineType:[r.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.RGBA32,s.RGBA32],engineFormat:[i.RGBAFormat,i.RGBAFormat],engineType:[r.UnsignedByteType,r.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[o.UASTC_HDR],transcoderFormat:[s.RGBA_HALF],engineFormat:[i.RGBAFormat],engineType:[r.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],l={[o.ETC1S]:a.filter((e=>e.basisFormat.includes(o.ETC1S))).sort(((e,t)=>e.priorityUASTC-t.priorityUASTC)),[o.UASTC]:a.filter((e=>e.basisFormat.includes(o.UASTC))).sort(((e,t)=>e.priorityUASTC-t.priorityUASTC)),[o.UASTC_HDR]:a.filter((e=>e.basisFormat.includes(o.UASTC_HDR))).sort(((e,t)=>e.priorityHDR-t.priorityHDR))};function c(e){return e<=2||!(e&e-1)&&0!==e}function h(e){if(1===e.length)return e[0];let t=0;for(let n=0;n<e.length;n++)t+=e[n].byteLength;const n=new Uint8Array(t);let i=0;for(let t=0;t<e.length;t++){const r=e[t];n.set(r,i),i+=r.byteLength}return n}};const hg=new Set([je,Ze,Je]),dg={[jm]:je,[zm]:je,[km]:je,[Nm]:je,[Vm]:Ze,[Gm]:Ze,[Om]:Ze,[Fm]:Ze,[Hm]:Je,[Qm]:Je,[Um]:Je,[Pm]:Je,[Xm]:pt,[qm]:gt,[Wm]:gt},ug={[jm]:Fe,[zm]:ke,[km]:Re,[Nm]:Re,[Vm]:Fe,[Gm]:ke,[Om]:Re,[Fm]:Re,[Hm]:Fe,[Qm]:ke,[Um]:Re,[Pm]:Re,[Xm]:ke,[qm]:Re,[Wm]:Re};function pg(e){const t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?tn:nn:10===t.colorPrimaries?2===t.transferFunction?"display-p3":"display-p3-linear":(0===t.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),en)}const Ag={c:null,u:[new Li,new Li,new Li],e:[]},fg={c:null,u:[new Li,new Li,new Li],e:[]},mg=[[],[],[]],gg=[[],[],[]],vg=[],yg=new Li,Eg=new Li,xg=new Li,bg=new Li,Cg=new Li,wg=new Li,_g=new ni,Mg=new Ui,Sg=new lr,Ig=new lr,Bg=new ar;class Tg{constructor(e=new Li,t=new Li,n=new ni){this.center=e,this.halfSize=t,this.rotation=n}set(e,t,n){return this.center=e,this.halfSize=t,this.rotation=n,this}copy(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this}clone(){return(new this.constructor).copy(this)}getSize(e){return e.copy(this.halfSize).multiplyScalar(2)}clampPoint(e,t){const n=this.halfSize;bg.subVectors(e,this.center),this.rotation.extractBasis(yg,Eg,xg),t.copy(this.center);const i=ei.clamp(bg.dot(yg),-n.x,n.x);t.add(yg.multiplyScalar(i));const r=ei.clamp(bg.dot(Eg),-n.y,n.y);t.add(Eg.multiplyScalar(r));const s=ei.clamp(bg.dot(xg),-n.z,n.z);return t.add(xg.multiplyScalar(s)),t}containsPoint(e){return bg.subVectors(e,this.center),this.rotation.extractBasis(yg,Eg,xg),Math.abs(bg.dot(yg))<=this.halfSize.x&&Math.abs(bg.dot(Eg))<=this.halfSize.y&&Math.abs(bg.dot(xg))<=this.halfSize.z}intersectsBox3(e){return this.intersectsOBB(Rg.fromBox3(e))}intersectsSphere(e){return this.clampPoint(e.center,wg),wg.distanceToSquared(e.center)<=e.radius*e.radius}intersectsOBB(e,t=Number.EPSILON){Ag.c=this.center,Ag.e[0]=this.halfSize.x,Ag.e[1]=this.halfSize.y,Ag.e[2]=this.halfSize.z,this.rotation.extractBasis(Ag.u[0],Ag.u[1],Ag.u[2]),fg.c=e.center,fg.e[0]=e.halfSize.x,fg.e[1]=e.halfSize.y,fg.e[2]=e.halfSize.z,e.rotation.extractBasis(fg.u[0],fg.u[1],fg.u[2]);for(let e=0;e<3;e++)for(let t=0;t<3;t++)mg[e][t]=Ag.u[e].dot(fg.u[t]);bg.subVectors(fg.c,Ag.c),vg[0]=bg.dot(Ag.u[0]),vg[1]=bg.dot(Ag.u[1]),vg[2]=bg.dot(Ag.u[2]);for(let e=0;e<3;e++)for(let n=0;n<3;n++)gg[e][n]=Math.abs(mg[e][n])+t;let n,i;for(let e=0;e<3;e++)if(n=Ag.e[e],i=fg.e[0]*gg[e][0]+fg.e[1]*gg[e][1]+fg.e[2]*gg[e][2],Math.abs(vg[e])>n+i)return!1;for(let e=0;e<3;e++)if(n=Ag.e[0]*gg[0][e]+Ag.e[1]*gg[1][e]+Ag.e[2]*gg[2][e],i=fg.e[e],Math.abs(vg[0]*mg[0][e]+vg[1]*mg[1][e]+vg[2]*mg[2][e])>n+i)return!1;return n=Ag.e[1]*gg[2][0]+Ag.e[2]*gg[1][0],i=fg.e[1]*gg[0][2]+fg.e[2]*gg[0][1],!(Math.abs(vg[2]*mg[1][0]-vg[1]*mg[2][0])>n+i||(n=Ag.e[1]*gg[2][1]+Ag.e[2]*gg[1][1],i=fg.e[0]*gg[0][2]+fg.e[2]*gg[0][0],Math.abs(vg[2]*mg[1][1]-vg[1]*mg[2][1])>n+i||(n=Ag.e[1]*gg[2][2]+Ag.e[2]*gg[1][2],i=fg.e[0]*gg[0][1]+fg.e[1]*gg[0][0],Math.abs(vg[2]*mg[1][2]-vg[1]*mg[2][2])>n+i||(n=Ag.e[0]*gg[2][0]+Ag.e[2]*gg[0][0],i=fg.e[1]*gg[1][2]+fg.e[2]*gg[1][1],Math.abs(vg[0]*mg[2][0]-vg[2]*mg[0][0])>n+i||(n=Ag.e[0]*gg[2][1]+Ag.e[2]*gg[0][1],i=fg.e[0]*gg[1][2]+fg.e[2]*gg[1][0],Math.abs(vg[0]*mg[2][1]-vg[2]*mg[0][1])>n+i||(n=Ag.e[0]*gg[2][2]+Ag.e[2]*gg[0][2],i=fg.e[0]*gg[1][1]+fg.e[1]*gg[1][0],Math.abs(vg[0]*mg[2][2]-vg[2]*mg[0][2])>n+i||(n=Ag.e[0]*gg[1][0]+Ag.e[1]*gg[0][0],i=fg.e[1]*gg[2][2]+fg.e[2]*gg[2][1],Math.abs(vg[1]*mg[0][0]-vg[0]*mg[1][0])>n+i||(n=Ag.e[0]*gg[1][1]+Ag.e[1]*gg[0][1],i=fg.e[0]*gg[2][2]+fg.e[2]*gg[2][0],Math.abs(vg[1]*mg[0][1]-vg[0]*mg[1][1])>n+i||(n=Ag.e[0]*gg[1][2]+Ag.e[1]*gg[0][2],i=fg.e[0]*gg[2][1]+fg.e[1]*gg[2][0],Math.abs(vg[1]*mg[0][2]-vg[0]*mg[1][2])>n+i)))))))))}intersectsPlane(e){this.rotation.extractBasis(yg,Eg,xg);const t=this.halfSize.x*Math.abs(e.normal.dot(yg))+this.halfSize.y*Math.abs(e.normal.dot(Eg))+this.halfSize.z*Math.abs(e.normal.dot(xg)),n=e.normal.dot(this.center)-e.constant;return Math.abs(n)<=t}intersectRay(e,t){return this.getSize(Cg),Mg.setFromCenterAndSize(bg.set(0,0,0),Cg),Sg.setFromMatrix3(this.rotation),Sg.setPosition(this.center),Ig.copy(Sg).invert(),Bg.copy(e).applyMatrix4(Ig),Bg.intersectBox(Mg,t)?t.applyMatrix4(Sg):null}intersectsRay(e){return null!==this.intersectRay(e,bg)}fromBox3(e){return e.getCenter(this.center),e.getSize(this.halfSize).multiplyScalar(.5),this.rotation.identity(),this}equals(e){return e.center.equals(this.center)&&e.halfSize.equals(this.halfSize)&&e.rotation.equals(this.rotation)}applyMatrix4(e){const t=e.elements;let n=bg.set(t[0],t[1],t[2]).length();const i=bg.set(t[4],t[5],t[6]).length(),r=bg.set(t[8],t[9],t[10]).length();e.determinant()<0&&(n=-n),_g.setFromMatrix4(e);const s=1/n,o=1/i,a=1/r;return _g.elements[0]*=s,_g.elements[1]*=s,_g.elements[2]*=s,_g.elements[3]*=o,_g.elements[4]*=o,_g.elements[5]*=o,_g.elements[6]*=a,_g.elements[7]*=a,_g.elements[8]*=a,this.rotation.multiply(_g),this.halfSize.x*=n,this.halfSize.y*=i,this.halfSize.z*=r,bg.setFromMatrixPosition(e),this.center.add(bg),this}}const Rg=new Tg,Lg=/^[og]\s*(.+)?/,Dg=/^mtllib /,Pg=/^usemtl /,Ug=/^usemap /,Og=/\s+/,Fg=new Li,kg=new Li,Ng=new Li,Qg=new Li,Gg=new Li,zg=new es;function Hg(){const e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);const n=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){const n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);const i={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){const t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(i),i},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){const t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},n&&n.name&&"function"==typeof n.clone){const e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseNormalIndex:function(e,t){const n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseUVIndex:function(e,t){const n=parseInt(e,10);return 2*(n>=0?n-1:n+t/2)},addVertex:function(e,t,n){const i=this.vertices,r=this.object.geometry.vertices;r.push(i[e+0],i[e+1],i[e+2]),r.push(i[t+0],i[t+1],i[t+2]),r.push(i[n+0],i[n+1],i[n+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){const i=this.normals,r=this.object.geometry.normals;r.push(i[e+0],i[e+1],i[e+2]),r.push(i[t+0],i[t+1],i[t+2]),r.push(i[n+0],i[n+1],i[n+2])},addFaceNormal:function(e,t,n){const i=this.vertices,r=this.object.geometry.normals;Fg.fromArray(i,e),kg.fromArray(i,t),Ng.fromArray(i,n),Gg.subVectors(Ng,kg),Qg.subVectors(Fg,kg),Gg.cross(Qg),Gg.normalize(),r.push(Gg.x,Gg.y,Gg.z),r.push(Gg.x,Gg.y,Gg.z),r.push(Gg.x,Gg.y,Gg.z)},addColor:function(e,t,n){const i=this.colors,r=this.object.geometry.colors;void 0!==i[e]&&r.push(i[e+0],i[e+1],i[e+2]),void 0!==i[t]&&r.push(i[t+0],i[t+1],i[t+2]),void 0!==i[n]&&r.push(i[n+0],i[n+1],i[n+2])},addUV:function(e,t,n){const i=this.uvs,r=this.object.geometry.uvs;r.push(i[e+0],i[e+1]),r.push(i[t+0],i[t+1]),r.push(i[n+0],i[n+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,i,r,s,o,a,l){const c=this.vertices.length;let h=this.parseVertexIndex(e,c),d=this.parseVertexIndex(t,c),u=this.parseVertexIndex(n,c);if(this.addVertex(h,d,u),this.addColor(h,d,u),void 0!==o&&""!==o){const e=this.normals.length;h=this.parseNormalIndex(o,e),d=this.parseNormalIndex(a,e),u=this.parseNormalIndex(l,e),this.addNormal(h,d,u)}else this.addFaceNormal(h,d,u);if(void 0!==i&&""!==i){const e=this.uvs.length;h=this.parseUVIndex(i,e),d=this.parseUVIndex(r,e),u=this.parseUVIndex(s,e),this.addUV(h,d,u),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let n=0,i=e.length;n<i;n++){const i=this.parseVertexIndex(e[n],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const n=this.vertices.length,i=this.uvs.length;for(let t=0,i=e.length;t<i;t++)this.addVertexLine(this.parseVertexIndex(e[t],n));for(let e=0,n=t.length;e<n;e++)this.addUVLine(this.parseUVIndex(t[e],i))}};return e.startObject("",!1),e}class Vg{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:m,this.wrap=void 0!==this.options.wrap?this.options.wrap:ve}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],i={name:e,side:this.side};function r(e,n){if(i[e])return;const r=t.getTextureParams(n,i),s=t.loadTexture((o=t.baseUrl,"string"!=typeof(a=r.url)||""===a?"":/^https?:\/\//i.test(a)?a:o+a));var o,a;s.repeat.copy(r.scale),s.offset.copy(r.offset),s.wrapS=t.wrap,s.wrapT=t.wrap,"map"!==e&&"emissiveMap"!==e||(s.colorSpace=tn),i[e]=s}for(const e in n){const t=n[e];let s;if(""!==t)switch(e.toLowerCase()){case"kd":i.color=Ai.toWorkingColorSpace((new es).fromArray(t),tn);break;case"ks":i.specular=Ai.toWorkingColorSpace((new es).fromArray(t),tn);break;case"ke":i.emissive=Ai.toWorkingColorSpace((new es).fromArray(t),tn);break;case"map_kd":r("map",t);break;case"map_ks":r("specularMap",t);break;case"map_ke":r("emissiveMap",t);break;case"norm":r("normalMap",t);break;case"map_bump":case"bump":r("bumpMap",t);break;case"map_d":r("alphaMap",t),i.transparent=!0;break;case"ns":i.shininess=parseFloat(t);break;case"d":s=parseFloat(t),s<1&&(i.opacity=s,i.transparent=!0);break;case"tr":s=parseFloat(t),this.options&&this.options.invertTrProperty&&(s=1-s),s>0&&(i.opacity=1-s,i.transparent=!0)}}return this.materials[e]=new Sc(i),this.materials[e]}getTextureParams(e,t){const n={scale:new ti(1,1),offset:new ti(0,0)},i=e.split(/\s+/);let r;return r=i.indexOf("-bm"),r>=0&&(t.bumpScale=parseFloat(i[r+1]),i.splice(r,2)),r=i.indexOf("-s"),r>=0&&(n.scale.set(parseFloat(i[r+1]),parseFloat(i[r+2])),i.splice(r,4)),r=i.indexOf("-o"),r>=0&&(n.offset.set(parseFloat(i[r+1]),parseFloat(i[r+2])),i.splice(r,4)),n.url=i.join(" ").trim(),n}loadTexture(e,t,n,i,r){const s=void 0!==this.manager?this.manager:ih;let o=s.getHandler(e);null===o&&(o=new ph(s)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin);const a=o.load(e,n,i,r);return void 0!==t&&(a.mapping=t),a}}function jg(e,t){switch(t){case tn:e.convertSRGBToLinear();break;case nn:case en:break;default:console.warn("WARNING: LightProbeGenerator convertColorToLinear() encountered an unsupported color space.")}return e}var Wg={...i};Wg.DRACOLoader=class extends rh{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){const r=new ah(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,(e=>{this.parse(e,t,i)}),n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,tn,n).catch(n)}decodeDracoFile(e,t,n,i,r=nn,s=()=>{}){const o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(e,o).then(t).catch(s)}decodeGeometry(e,t){const n=JSON.stringify(t);if(of.has(e)){const t=of.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,s=e.byteLength,o=this._getWorker(r,s).then((n=>(i=n,new Promise(((n,s)=>{i._callbacks[r]={resolve:n,reject:s},i.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return o.catch((()=>!0)).then((()=>{i&&r&&this._releaseTask(i,r)})),of.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new Bs;e.index&&t.setIndex(new us(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const i=e.attributes[n],r=i.name,s=i.array,o=i.itemSize,a=new us(s,o);"color"===r&&(this._assignVertexColorSpace(a,i.vertexColorSpace),a.normalized=s instanceof Float32Array==0),t.setAttribute(r,a)}return t}_assignVertexColorSpace(e,t){if(t!==tn)return;const n=new es;for(let t=0,i=e.count;t<i;t++)n.fromBufferAttribute(e,t),Ai.toWorkingColorSpace(n,tn),e.setXYZ(t,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new ah(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise(((t,i)=>{n.load(e,t,void 0,i)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const i=af.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const n=t.data;switch(n.type){case"decode":e._callbacks[n.id].resolve(n);break;case"error":e._callbacks[n.id].reject(n);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+n.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}},Wg.GLTFLoader=class extends rh{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new qf(e)})),this.register((function(e){return new Xf(e)})),this.register((function(e){return new im(e)})),this.register((function(e){return new rm(e)})),this.register((function(e){return new sm(e)})),this.register((function(e){return new Jf(e)})),this.register((function(e){return new Kf(e)})),this.register((function(e){return new Zf(e)})),this.register((function(e){return new $f(e)})),this.register((function(e){return new Wf(e)})),this.register((function(e){return new em(e)})),this.register((function(e){return new Yf(e)})),this.register((function(e){return new nm(e)})),this.register((function(e){return new tm(e)})),this.register((function(e){return new Vf(e)})),this.register((function(e){return new om(e)})),this.register((function(e){return new am(e)}))}load(e,t,n,i){const r=this;let s;if(""!==this.resourcePath)s=this.resourcePath;else if(""!==this.path){const t=Uh.extractUrlBase(e);s=Uh.resolveURL(t,this.path)}else s=Uh.extractUrlBase(e);this.manager.itemStart(e);const o=function(t){i?i(t):console.error(t),r.manager.itemError(e),r.manager.itemEnd(e)},a=new ah(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{r.parse(n,s,(function(n){t(n),r.manager.itemEnd(e)}),o)}catch(e){o(e)}}),n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let r;const s={},o={},a=new TextDecoder;if("string"==typeof e)r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(a.decode(new Uint8Array(e,0,4))===lm){try{s[bf]=new cm(e)}catch(e){return void(i&&i(e))}r=JSON.parse(s[bf].content)}else r=JSON.parse(a.decode(e));else r=e;if(void 0===r.asset||r.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new Rm(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](l);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[t.name]=t,s[t.name]=!0}if(r.extensionsUsed)for(let e=0;e<r.extensionsUsed.length;++e){const t=r.extensionsUsed[e],n=r.extensionsRequired||[];switch(t){case Df:s[t]=new jf;break;case Cf:s[t]=new hm(r,this.dracoLoader);break;case Of:s[t]=new dm;break;case Ff:s[t]=new um;break;default:n.indexOf(t)>=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(s),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise((function(i,r){n.parse(e,t,i,r)}))}},Wg.KTX2Loader=cg,Wg.OBJLoader=class extends rh{constructor(e){super(e),this.materials=null}load(e,t,n,i){const r=this,s=new ah(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{t(r.parse(n))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}setMaterials(e){return this.materials=e,this}parse(e){const t=new Hg;-1!==e.indexOf("\r\n")&&(e=e.replace(/\r\n/g,"\n")),-1!==e.indexOf("\\\n")&&(e=e.replace(/\\\n/g,""));const n=e.split("\n");let i=[];for(let e=0,r=n.length;e<r;e++){const r=n[e].trimStart();if(0===r.length)continue;const s=r.charAt(0);if("#"!==s)if("v"===s){const e=r.split(Og);switch(e[0]){case"v":t.vertices.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),e.length>=7?(zg.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6]),tn),t.colors.push(zg.r,zg.g,zg.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case"vt":t.uvs.push(parseFloat(e[1]),parseFloat(e[2]))}}else if("f"===s){const e=r.slice(1).trim().split(Og),n=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];if(i.length>0){const e=i.split("/");n.push(e)}}const i=n[0];for(let e=1,r=n.length-1;e<r;e++){const r=n[e],s=n[e+1];t.addFace(i[0],r[0],s[0],i[1],r[1],s[1],i[2],r[2],s[2])}}else if("l"===s){const e=r.substring(1).trim().split(" ");let n=[];const i=[];if(-1===r.indexOf("/"))n=e;else for(let t=0,r=e.length;t<r;t++){const r=e[t].split("/");""!==r[0]&&n.push(r[0]),""!==r[1]&&i.push(r[1])}t.addLineGeometry(n,i)}else if("p"===s){const e=r.slice(1).trim().split(" ");t.addPointGeometry(e)}else if(null!==(i=Lg.exec(r))){const e=(" "+i[0].slice(1).trim()).slice(1);t.startObject(e)}else if(Pg.test(r))t.object.startMaterial(r.substring(7).trim(),t.materialLibraries);else if(Dg.test(r))t.materialLibraries.push(r.substring(7).trim());else if(Ug.test(r))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if("s"===s){if(i=r.split(" "),i.length>1){const e=i[1].trim().toLowerCase();t.object.smooth="0"!==e&&"off"!==e}else t.object.smooth=!0;const e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if("\0"===r)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+r+'"')}}t.finalize();const r=new Wa;if(r.materialLibraries=[].concat(t.materialLibraries),!0==!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length))for(let e=0,n=t.objects.length;e<n;e++){const n=t.objects[e],i=n.geometry,s=n.materials,o="Line"===i.type,a="Points"===i.type;let l=!1;if(0===i.vertices.length)continue;const c=new Bs;c.setAttribute("position",new xs(i.vertices,3)),i.normals.length>0&&c.setAttribute("normal",new xs(i.normals,3)),i.colors.length>0&&(l=!0,c.setAttribute("color",new xs(i.colors,3))),!0===i.hasUVIndices&&c.setAttribute("uv",new xs(i.uvs,2));const h=[];for(let e=0,n=s.length;e<n;e++){const n=s[e],i=n.name+"_"+n.smooth+"_"+l;let r=t.materials[i];if(null!==this.materials)if(r=this.materials.create(n.name),!o||!r||r instanceof _a){if(a&&r&&!(r instanceof Na)){const e=new Na({size:10,sizeAttenuation:!1});is.prototype.copy.call(e,r),e.color.copy(r.color),e.map=r.map,r=e}}else{const e=new _a;is.prototype.copy.call(e,r),e.color.copy(r.color),r=e}void 0===r&&(r=o?new _a:a?new Na({size:1,sizeAttenuation:!1}):new Sc,r.name=n.name,r.flatShading=!n.smooth,r.vertexColors=l,t.materials[i]=r),h.push(r)}let d;if(h.length>1){for(let e=0,t=s.length;e<t;e++){const t=s[e];c.addGroup(t.groupStart,t.groupCount,e)}d=o?new Fa(c,h):a?new Va(c,h):new Gs(c,h)}else d=o?new Fa(c,h[0]):a?new Va(c,h[0]):new Gs(c,h[0]);d.name=n.name,r.add(d)}else if(t.vertices.length>0){const e=new Na({size:1,sizeAttenuation:!1}),n=new Bs;n.setAttribute("position",new xs(t.vertices,3)),t.colors.length>0&&void 0!==t.colors[0]&&(n.setAttribute("color",new xs(t.colors,3)),e.vertexColors=!0);const i=new Va(n,e);r.add(i)}return r}},Wg.MTLLoader=class extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=""===this.path?Uh.extractUrlBase(e):this.path,o=new ah(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){try{t(r.parse(n,s))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){const n=e.split("\n");let i={};const r=/\s+/,s={};for(let e=0;e<n.length;e++){let t=n[e];if(t=t.trim(),0===t.length||"#"===t.charAt(0))continue;const o=t.indexOf(" ");let a=o>=0?t.substring(0,o):t;a=a.toLowerCase();let l=o>=0?t.substring(o+1):"";if(l=l.trim(),"newmtl"===a)i={name:l},s[l]=i;else if("ka"===a||"kd"===a||"ks"===a||"ke"===a){const e=l.split(r,3);i[a]=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2])]}else i[a]=l}const o=new Vg(this.resourcePath||t,this.materialOptions);return o.setCrossOrigin(this.crossOrigin),o.setManager(this.manager),o.setMaterials(s),o}},Wg.OBB=Tg,Wg.BufferGeometryUtils=r,Wg.LightProbeGenerator=class{static fromCubeTexture(e){let t=0;const n=new Li,i=new Li,r=new es,s=[0,0,0,0,0,0,0,0,0],o=new Lh,a=o.coefficients;for(let o=0;o<6;o++){const l=e.image[o],c=l.width,h=l.height,d=document.createElement("canvas");d.width=c,d.height=h;const u=d.getContext("2d");u.drawImage(l,0,0,c,h);const p=u.getImageData(0,0,c,h),A=p.data,f=p.width,m=2/f;for(let l=0,c=A.length;l<c;l+=4){r.setRGB(A[l]/255,A[l+1]/255,A[l+2]/255),jg(r,e.colorSpace);const c=l/4,h=(c%f+.5)*m-1,d=1-(Math.floor(c/f)+.5)*m;switch(o){case 0:n.set(-1,d,-h);break;case 1:n.set(1,d,h);break;case 2:n.set(-h,1,-d);break;case 3:n.set(-h,-1,d);break;case 4:n.set(-h,d,1);break;case 5:n.set(h,d,-1)}const u=n.lengthSq(),p=4/(Math.sqrt(u)*u);t+=p,i.copy(n).normalize(),Lh.getBasisAt(i,s);for(let e=0;e<9;e++)a[e].x+=s[e]*r.r*p,a[e].y+=s[e]*r.g*p,a[e].z+=s[e]*r.b*p}}const l=4*Math.PI/t;for(let e=0;e<9;e++)a[e].x*=l,a[e].y*=l,a[e].z*=l;return new Dh(o)}static async fromCubeRenderTarget(e,t){const n=e.coordinateSystem===Gn?-1:1;let i=0;const r=new Li,s=new Li,o=new es,a=[0,0,0,0,0,0,0,0,0],l=new Lh,c=l.coefficients,h=t.texture.type,d=t.width;let u;e.isWebGLRenderer&&(u=h===ke?new Uint16Array(d*d*4):new Uint8Array(d*d*4));for(let l=0;l<6;l++){e.isWebGLRenderer?await e.readRenderTargetPixelsAsync(t,0,0,d,d,u,l):u=await e.readRenderTargetPixelsAsync(t,0,0,d,d,0,l);const p=2/d;for(let e=0,A=u.length;e<A;e+=4){let A,f,m;h===ke?(A=cs.fromHalfFloat(u[e]),f=cs.fromHalfFloat(u[e+1]),m=cs.fromHalfFloat(u[e+2])):(A=u[e]/255,f=u[e+1]/255,m=u[e+2]/255),o.setRGB(A,f,m),jg(o,t.texture.colorSpace);const g=e/4,v=(1-(g%d+.5)*p)*n,y=1-(Math.floor(g/d)+.5)*p;switch(l){case 0:r.set(-1*n,y,v*n);break;case 1:r.set(1*n,y,-v*n);break;case 2:r.set(v,1,-y);break;case 3:r.set(v,-1,y);break;case 4:r.set(v,y,1);break;case 5:r.set(-v,y,-1)}const E=r.lengthSq(),x=4/(Math.sqrt(E)*E);i+=x,s.copy(r).normalize(),Lh.getBasisAt(s,a);for(let e=0;e<9;e++)c[e].x+=a[e]*o.r*x,c[e].y+=a[e]*o.g*x,c[e].z+=a[e]*o.b*x}}const p=4*Math.PI/i;for(let e=0;e<9;e++)c[e].x*=p,c[e].y*=p,c[e].z*=p;return new Dh(l)}};const qg=Wg},8330:e=>{"use strict";e.exports=JSON.parse('{"name":"aframe","version":"1.6.0","description":"A web framework for building virtual reality experiences.","homepage":"https://aframe.io/","main":"dist/aframe-master.js","scripts":{"dev":"cross-env INSPECTOR_VERSION=dev webpack serve --port 8080","dist":"node scripts/updateVersionLog.js && npm run dist:min && npm run dist:max","dist:max":"webpack --config webpack.config.js","dist:min":"webpack --config webpack.prod.config.js","docs":"markserv --dir docs --port 9001","preghpages":"node ./scripts/preghpages.js","ghpages":"ghpages -p gh-pages/","lint":"standardx -v | snazzy","lint:fix":"standardx --fix","precommit":"npm run lint","prepush":"node scripts/testOnlyCheck.js","prerelease":"node scripts/release.js 1.5.0 1.6.0","start":"npm run dev","start:https":"npm run dev -- --server-type https","test":"karma start ./tests/karma.conf.js","test:docs":"node scripts/docsLint.js","test:firefox":"npm test -- --browsers Firefox","test:chrome":"npm test -- --browsers Chrome","test:nobrowser":"NO_BROWSER=true npm test","test:node":"node --experimental-require-module ./node_modules/mocha/bin/mocha --ui tdd tests/node"},"repository":"aframevr/aframe","license":"MIT","files":["dist/*","docs/**/*","src/**/*","vendor/**/*"],"dependencies":{"buffer":"^6.0.3","debug":"^4.3.4","deep-assign":"^2.0.0","load-bmfont":"^1.2.3","super-animejs":"^3.1.0","three":"npm:super-three@0.171.0","three-bmfont-text":"dmarcos/three-bmfont-text#eed4878795be9b3e38cf6aec6b903f56acd1f695"},"devDependencies":{"@babel/core":"^7.24.0","babel-loader":"^9.1.3","babel-plugin-istanbul":"^6.1.1","chai":"^4.3.6","chai-shallow-deep-equal":"^1.4.0","chalk":"^1.1.3","cross-env":"^7.0.3","css-loader":"^7.1.2","eslint":"^8.45.0","eslint-config-semistandard":"^17.0.0","eslint-config-standard-jsx":"^11.0.0","ghpages":"0.0.8","git-rev":"^0.2.1","glob":"^8.0.3","husky":"^0.11.7","jsdom":"^24.0.0","jsdom-global":"^3.0.2","karma":"^6.4.0","karma-chai-shallow-deep-equal":"0.0.4","karma-chrome-launcher":"^3.1.1","karma-coverage":"^2.2.0","karma-env-preprocessor":"^0.1.1","karma-firefox-launcher":"^2.1.2","karma-mocha":"^2.0.1","karma-mocha-reporter":"^2.2.5","karma-sinon-chai":"^2.0.2","karma-webpack":"^5.0.0","markserv":"github:sukima/markserv#feature/fix-broken-websoketio-link","mocha":"^10.0.0","replace-in-file":"^2.5.3","shelljs":"^0.8.5","shx":"^0.2.2","sinon":"<12.0.0","sinon-chai":"^3.7.0","snazzy":"^5.0.0","standardx":"^7.0.0","style-loader":"^4.0.0","too-wordy":"ngokevin/too-wordy","webpack":"^5.91.0","webpack-cli":"^5.1.4","webpack-dev-server":"^5.0.4","write-good":"^1.0.8"},"link":true,"standardx":{"ignore":["build/**","dist/**","examples/**/shaders/*.js","**/vendor/**"]},"keywords":["3d","aframe","cardboard","components","oculus","three","three.js","rift","vive","vr","quest","meta","web-components","webvr","webxr"],"engines":{"node":">= 4.6.0","npm":">= 2.15.9"}}')}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={id:i,exports:{}};return e[i](s,s.exports,n),s.exports}return n.m=e,n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.b=document.baseURI||self.location.href,n.nc=void 0,n(4497)})())); -//# sourceMappingURL=aframe-master.min.js.map(()=>{if(AFRAME.registerGeometry("prism",{schema:{depth:{default:1,min:0},height:{default:1,min:0},width:{default:1,min:0}},init:function(t){const i=new THREE.Shape;i.moveTo(t.width/2,0),i.lineTo(0,t.height),i.lineTo(-t.width/2,0),i.lineTo(t.width/2,0);const e={steps:2,depth:t.depth,bevelEnabled:!1};this.geometry=new THREE.ExtrudeGeometry(i,e)}}),"undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("blink-controls",{schema:{button:{default:"",oneOf:["trackpad","trigger","grip","menu","thumbstick"]},startEvents:{type:"array",default:[]},endEvents:{type:"array",default:[]},cancelEvents:{type:"array",default:[]},collisionEntities:{default:""},hitEntity:{type:"selector"},cameraRig:{type:"selector",default:"#player"},teleportOrigin:{type:"selector",default:"#camera"},hitCylinderColor:{type:"color",default:"#4d93fd"},hitCylinderRadius:{default:.25,min:0},hitCylinderHeight:{default:.3,min:0},interval:{default:0},curveNumberPoints:{default:60,min:2},curveLineWidth:{default:.025},curveHitColor:{type:"color",default:"#4d93fd"},curveMissColor:{type:"color",default:"#ff0000"},curveShootingSpeed:{default:10,min:0},defaultPlaneSize:{default:100},landingNormal:{type:"vec3",default:{x:0,y:1,z:0}},landingMaxAngle:{default:"45",min:0,max:360},drawIncrementally:{default:!0},incrementalDrawMs:{default:300},missOpacity:{default:.8},hitOpacity:{default:.8},snapTurn:{default:!0},rotateOnTeleport:{default:!0}},init:function(){const t=this.data,i=this.el;let e;this.active=!1,this.obj=i.object3D,this.controllerPosition=new THREE.Vector3,this.hitEntityQuaternion=new THREE.Quaternion,this.teleportOriginQuaternion=new THREE.Quaternion,this.hitPoint=new THREE.Vector3,this.collisionObjectNormalMatrix=new THREE.Matrix3,this.collisionWorldNormal=new THREE.Vector3,this.rigWorldPosition=new THREE.Vector3,this.newRigWorldPosition=new THREE.Vector3,this.teleportEventDetail={oldPosition:this.rigWorldPosition,newPosition:this.newRigWorldPosition,hitPoint:this.hitPoint,rotationQuaternion:this.hitEntityQuaternion},this.hit=!1,this.prevCheckTime=void 0,this.referenceNormal=new THREE.Vector3,this.curveMissColor=new THREE.Color,this.curveHitColor=new THREE.Color,this.raycaster=new THREE.Raycaster,this.defaultPlane=this.createDefaultPlane(this.data.defaultPlaneSize),this.defaultCollisionMeshes=[this.defaultPlane];const n=this.teleportEntity=document.createElement("a-entity");if(n.classList.add("teleportRay"),n.setAttribute("visible",!1),i.sceneEl.appendChild(this.teleportEntity),this.onButtonDown=this.onButtonDown.bind(this),this.onButtonUp=this.onButtonUp.bind(this),this.cancel=this.cancel.bind(this),this.handleThumbstickAxis=this.handleThumbstickAxis.bind(this),this.teleportOrigin=this.data.teleportOrigin,this.cameraRig=this.data.cameraRig,this.snapturnRotation=THREE.MathUtils.degToRad(45),this.canSnapturn=!0,this.addedEvents=[],this.data.startEvents.length&&this.data.endEvents.length){for(e=0;e<this.data.startEvents.length;e++)this.addedEvents.push([this.data.startEvents[e],this.onButtonDown]),i.addEventListener(this.data.startEvents[e],this.onButtonDown);for(e=0;e<this.data.endEvents.length;e++)this.addedEvents.push([this.data.endEvents[e],this.onButtonUp]),i.addEventListener(this.data.endEvents[e],this.onButtonUp)}else t.button?(this.addedEvents.push([t.button+"down",this.onButtonDown]),this.addedEvents.push([t.button+"up",this.onButtonUp]),i.addEventListener(t.button+"down",this.onButtonDown),i.addEventListener(t.button+"up",this.onButtonUp)):this.thumbstickAxisActivation=!0;for(e=0;e<this.data.cancelEvents.length;e++)this.addedEvents.push([this.data.cancelEvents[e],this.cancel]),i.addEventListener(this.data.cancelEvents[e],this.cancel);this.addedEvents.push(["thumbstickmoved",this.handleThumbstickAxis]),i.addEventListener("thumbstickmoved",this.handleThumbstickAxis),this.queryCollisionEntities()},handleSnapturn:function(t,i){i<.5&&(this.canSnapturn=!0),this.canSnapturn&&i>.95&&(Math.abs(t-Math.PI/2)<.6?(this.cameraRig.object3D.rotateY(+this.snapturnRotation),this.canSnapturn=!1):Math.abs(t-1.5*Math.PI)<.6&&(this.cameraRig.object3D.rotateY(-this.snapturnRotation),this.canSnapturn=!1))},handleThumbstickAxis:function(t){if(void 0!==t.detail.x&&void 0!==t.detail.y){const i=Math.atan2(t.detail.x,t.detail.y)+Math.PI,e=Math.sqrt(t.detail.x**2+t.detail.y**2);this.active?(e>.95&&(this.obj.getWorldPosition(this.controllerPosition),this.controllerPosition.setComponent(1,this.hitEntity.object3D.position.y),this.hitEntity.object3D.visible=!1,this.hitEntity.object3D.lookAt(this.controllerPosition),this.hitEntity.object3D.rotateY(i),this.hitEntity.object3D.visible=!0,this.hitEntity.object3D.getWorldQuaternion(this.hitEntityQuaternion)),0===Math.abs(t.detail.x)&&0===Math.abs(t.detail.y)&&this.onButtonUp()):this.thumbstickAxisActivation&&e>.95&&(i<.5||i>5.78)?this.onButtonDown():this.data.snapTurn&&this.handleSnapturn(i,e)}},update:function(t){const i=this.data,e=AFRAME.utils.diff(i,t);this.referenceNormal.copy(i.landingNormal),this.curveMissColor.set(i.curveMissColor),this.curveHitColor.set(i.curveHitColor),(!this.line||"curveLineWidth"in e||"curveNumberPoints"in e||"type"in e)&&(this.line=this.createLine(i),this.line.material.opacity=this.data.hitOpacity,this.line.material.transparent=this.data.hitOpacity<1,this.numActivePoints=i.curveNumberPoints,this.teleportEntity.setObject3D("mesh",this.line.mesh)),i.hitEntity?this.hitEntity=i.hitEntity:(!this.hitEntity||"hitCylinderColor"in e||"hitCylinderHeight"in e||"hitCylinderRadius"in e)&&(this.hitEntity&&this.hitEntity.parentNode.removeChild(this.hitEntity),this.hitEntity=this.createHitEntity(i),this.el.sceneEl.appendChild(this.hitEntity)),this.hitEntity.setAttribute("visible",!1),i.hitEntity||this.hitEntity.lastElementChild.setAttribute("visible",i.rotateOnTeleport),"collisionEntities"in e&&this.queryCollisionEntities()},remove:function(){const t=this.el,i=this.hitEntity,e=this.teleportEntity;i&&i.parentNode.removeChild(i),e&&e.parentNode.removeChild(e),t.sceneEl.removeEventListener("child-attached",this.childAttachHandler),t.sceneEl.removeEventListener("child-detached",this.childDetachHandler);for(const[i,e]of this.addedEvents)t.removeEventListener(i,e)},tick:function(){const t=new THREE.Vector3,i=new THREE.Vector3,e=new THREE.Vector3(0,-9.8,0),n=new THREE.Vector3,s=new THREE.Vector3,o=new THREE.Quaternion,r=new THREE.Vector3,a=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,c=new THREE.Vector3;let d=0;return function(u,E){if(!this.active)return;if(this.data.drawIncrementally&&this.redrawLine&&(this.redrawLine=!1,d=0),d+=E,this.numActivePoints=this.data.curveNumberPoints*d/this.data.incrementalDrawMs,this.numActivePoints>this.data.curveNumberPoints&&(this.numActivePoints=this.data.curveNumberPoints),this.prevCheckTime&&u-this.prevCheckTime<this.data.interval)return;this.prevCheckTime=u;this.obj.matrixWorld.decompose(r,o,a);const p=h.set(0,0,-1).applyQuaternion(o).normalize();this.line.setDirection(c.copy(p)),this.obj.getWorldPosition(t),s.copy(t),this.teleportEntity.setAttribute("visible",!0),d<this.data.incrementalDrawMs?this.line.material.color.set(this.curveHitColor):this.line.material.color.set(this.curveMissColor),this.line.material.opacity=this.data.missOpacity,this.line.material.transparent=this.data.missOpacity<1,this.hitEntity.setAttribute("visible",!1),this.hit=!1,i.copy(p).multiplyScalar(this.data.curveShootingSpeed),this.lastDrawnIndex=0;const A=this.data.drawIncrementally?this.numActivePoints:this.line.numPoints;for(let o=0;o<A+1;o++){let r;r=o===Math.floor(A+1)?A/(this.line.numPoints-1):o/(this.line.numPoints-1);const a=this.parabolicCurveMaxRoot(t,i,e);r*=Math.max(1,1.5*a),this.parabolicCurve(t,i,e,r,n);const h=l.copy(n).sub(s).normalize();if(this.raycaster.far=h.length(),this.raycaster.set(s,h),this.lastDrawnPoint=n,this.lastDrawnIndex=o,this.checkMeshCollisions(o,s,n))break;s.copy(n)}for(let t=this.lastDrawnIndex+1;t<this.line.numPoints;t++)this.line.setPoint(t,this.lastDrawnPoint,this.lastDrawnPoint)}}(),queryCollisionEntities:function(){const t=this.data,i=this.el;if(!t.collisionEntities)return void(this.collisionEntities=[]);const e=[].slice.call(i.sceneEl.querySelectorAll(t.collisionEntities));this.collisionEntities=e,this.childAttachHandler=function(i){i.detail.el.matches(t.collisionEntities)&&e.push(i.detail.el)},i.sceneEl.addEventListener("child-attached",this.childAttachHandler),this.childDetachHandler=function(i){if(!i.detail.el.matches(t.collisionEntities))return;const n=e.indexOf(i.detail.el);-1!==n&&e.splice(n,1)},i.sceneEl.addEventListener("child-detached",this.childDetachHandler)},onButtonDown:function(){this.active=!0,this.redrawLine=!0},onButtonUp:function(){const t=new THREE.Vector3,i=[new THREE.Vector3,new THREE.Vector3],e=new THREE.Vector3;return function(n){if(!this.active)return;if(this.active=!1,this.hitEntity.setAttribute("visible",!1),this.teleportEntity.setAttribute("visible",!1),!this.hit)return;const s=this.data.cameraRig||this.el.sceneEl.camera.el;if(s.object3D.getWorldPosition(this.rigWorldPosition),this.newRigWorldPosition.copy(this.hitPoint),t.copy(this.newRigWorldPosition),s.object3D.parent&&s.object3D.parent.worldToLocal(t),s.setAttribute("position",t),this.data.rotateOnTeleport&&(this.teleportOriginQuaternion.setFromEuler(new THREE.Euler(0,this.teleportOrigin.object3D.rotation.y,0)),this.teleportOriginQuaternion.invert(),this.teleportOriginQuaternion.multiply(this.hitEntityQuaternion),this.cameraRig.object3D.setRotationFromQuaternion(this.teleportOriginQuaternion)),!this.data.cameraRig){const t=document.querySelectorAll("a-entity[tracked-controls]");for(let n=0;n<t.length;n++)t[n].object3D.getWorldPosition(e),i[n].copy(this.newRigWorldPosition).sub(this.rigWorldPosition).add(e),t[n].setAttribute("position",i[n])}this.el.emit("teleported",this.teleportEventDetail)}}(),cancel:function(){this.active=!1,this.hitEntity.setAttribute("visible",!1),this.teleportEntity.setAttribute("visible",!1)},checkMeshCollisions:function(t,i,e){let n;this.data.collisionEntities?(n=this.collisionEntities.map((function(t){return t.getObject3D("mesh")})).filter((function(t){return t})),n=n.length?n:this.defaultCollisionMeshes):n=this.defaultCollisionMeshes;const s=this.raycaster.intersectObjects(n,!0);if(s.length>0&&!this.hit&&this.isValidNormalsAngle(s[0].face.normal,s[0].object)){const e=s[0].point;this.line.material.color.set(this.curveHitColor),this.line.material.opacity=this.data.hitOpacity,this.line.material.transparent=this.data.hitOpacity<1,this.hitEntity.setAttribute("position",e),this.hitEntity.setAttribute("visible",!0),this.hit=!0,this.hitPoint.copy(s[0].point);for(let e=t;e<this.line.numPoints;e++)this.line.setPoint(e,i,this.hitPoint);return!0}return this.line.setPoint(t,i,e),!1},isValidNormalsAngle:function(t,i){this.collisionObjectNormalMatrix.getNormalMatrix(i.matrixWorld),this.collisionWorldNormal.copy(t).applyMatrix3(this.collisionObjectNormalMatrix).normalize();const e=this.referenceNormal.angleTo(this.collisionWorldNormal);return THREE.MathUtils.RAD2DEG*e<=this.data.landingMaxAngle},parabolicCurveScalar:function(t,i,e,n){return t+i*n+.5*e*n*n},parabolicCurve:function(t,i,e,n,s){return s.x=this.parabolicCurveScalar(t.x,i.x,e.x,n),s.y=this.parabolicCurveScalar(t.y,i.y,e.y,n),s.z=this.parabolicCurveScalar(t.z,i.z,e.z,n),s},parabolicCurveMaxRoot:function(t,i,e){return(-i.y-Math.sqrt(i.y**2-.5*e.y*4*t.y))/(1*e.y)},createLine:function(t){const i="line"===t.type?2:t.curveNumberPoints;return new AFRAME.utils.RayCurve(i,t.curveLineWidth)},createHitEntity:function(t){const i=document.createElement("a-entity");i.className="hitEntity";const e=document.createElement("a-entity");e.setAttribute("geometry",{primitive:"torus",radius:t.hitCylinderRadius,radiusTubular:.01}),e.setAttribute("rotation",{x:90,y:0,z:0}),e.setAttribute("material",{shader:"flat",color:t.hitCylinderColor,side:"double",depthTest:!1}),i.appendChild(e);const n=document.createElement("a-entity");n.setAttribute("position",{x:0,y:t.hitCylinderHeight/2,z:0}),n.setAttribute("geometry",{primitive:"cylinder",segmentsHeight:1,radius:t.hitCylinderRadius,height:t.hitCylinderHeight,openEnded:!0}),n.setAttribute("material",{shader:"flat",color:t.hitCylinderColor,opacity:.5,side:"double",src:this.cylinderTexture,transparent:!0,depthTest:!1}),i.appendChild(n);const s=document.createElement("a-entity");return s.setAttribute("position",{x:0,y:.05,z:-1.5*t.hitCylinderRadius}),s.setAttribute("rotation",{x:90,y:180,z:0}),s.setAttribute("geometry",{primitive:"prism",height:.2,width:.2,depth:.05}),s.setAttribute("material",{shader:"flat",color:t.hitCylinderColor,side:"double",transparent:!0,opacity:.6,depthTest:!1}),i.appendChild(s),i},createDefaultPlane:function(t){const i=new THREE.PlaneGeometry(100,100);i.rotateX(-Math.PI/2);const e=new THREE.MeshBasicMaterial({color:16776960});return new THREE.Mesh(i,e)},cylinderTexture:"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAQCAYAAADXnxW3AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAADJJREFUeNpEx7ENgDAAAzArK0JA6f8X9oewlcWStU1wBGdwB08wgjeYm79jc2nbYH0DAC/+CORJxO5fAAAAAElFTkSuQmCC)"}),AFRAME.utils.RayCurve=function(t,i){this.geometry=new THREE.BufferGeometry,this.vertices=new Float32Array(3*t*6),this.uvs=new Float32Array(2*t*6),this.width=i,this.geometry.setAttribute("position",new THREE.BufferAttribute(this.vertices,3).setUsage(THREE.DynamicDrawUsage)),this.material=new THREE.MeshBasicMaterial({side:THREE.DoubleSide,color:16711680}),this.mesh=new THREE.Mesh(this.geometry,this.material),this.mesh.frustumCulled=!1,this.mesh.vertices=this.vertices,this.direction=new THREE.Vector3,this.numPoints=t},AFRAME.utils.RayCurve.prototype={setDirection:function(t){const i=new THREE.Vector3(0,1,0);this.direction.copy(t).cross(i).normalize().multiplyScalar(this.width/2)},setWidth:function(t){this.width=t},setPoint:function(){const t=new THREE.Vector3,i=new THREE.Vector3,e=new THREE.Vector3,n=new THREE.Vector3;return function(s,o,r){t.copy(o).add(this.direction),i.copy(o).sub(this.direction),e.copy(r).add(this.direction),n.copy(r).sub(this.direction);let a=18*s;this.vertices[a++]=t.x,this.vertices[a++]=t.y,this.vertices[a++]=t.z,this.vertices[a++]=i.x,this.vertices[a++]=i.y,this.vertices[a++]=i.z,this.vertices[a++]=e.x,this.vertices[a++]=e.y,this.vertices[a++]=e.z,this.vertices[a++]=e.x,this.vertices[a++]=e.y,this.vertices[a++]=e.z,this.vertices[a++]=i.x,this.vertices[a++]=i.y,this.vertices[a++]=i.z,this.vertices[a++]=n.x,this.vertices[a++]=n.y,this.vertices[a++]=n.z,this.geometry.attributes.position.needsUpdate=!0}}()}})(); -//# sourceMappingURL=aframe-blink-controls.min.js.map/* +/* * v0.5.1 generated at Wed Jan 15 10:51:41 AM CET 2025 * https://xrfragment.org * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/dist/xrfragment.aframe.js b/dist/xrfragment.aframe.js index 3a62477..475b279 100644 --- a/dist/xrfragment.aframe.js +++ b/dist/xrfragment.aframe.js @@ -1,3 +1,8 @@ +/* + * v0.5.1 generated at Sun Feb 9 12:52:39 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ /* * v0.5.1 generated at Wed Jan 15 10:52:05 AM CET 2025 * https://xrfragment.org diff --git a/dist/xrfragment.js b/dist/xrfragment.js index ec9b9b8..ea2d4b7 100644 --- a/dist/xrfragment.js +++ b/dist/xrfragment.js @@ -1,3 +1,8 @@ +/* + * v0.5.1 generated at Sun Feb 9 12:52:39 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ /* * v0.5.1 generated at Wed Jan 15 10:52:05 AM CET 2025 * https://xrfragment.org diff --git a/dist/xrfragment.model-viewer.js b/dist/xrfragment.model-viewer.js index 00329c8..e0ac7a1 100644 --- a/dist/xrfragment.model-viewer.js +++ b/dist/xrfragment.model-viewer.js @@ -1,11 +1,16 @@ /* + * v0.5.1 generated at Sun Feb 9 12:52:39 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.AFRAME=e():t.AFRAME=e()}(self,(()=>(()=>{var t={8167:t=>{var e=Object.prototype.toString;t.exports=function(t){return t.BYTES_PER_ELEMENT&&"[object ArrayBuffer]"===e.call(t.buffer)||Array.isArray(t)}},5734:t=>{t.exports=function(t,e){return"number"==typeof t?t:"number"==typeof e?e:0}},7961:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),n=e[0],i=e[1];return 3*(n+i)/4-i},e.toByteArray=function(t){var e,n,s=a(t),o=s[0],l=s[1],c=new r(function(t,e,n){return 3*(e+n)/4-n}(0,o,l)),h=0,u=l>0?o-4:o;for(n=0;n<u;n+=4)e=i[t.charCodeAt(n)]<<18|i[t.charCodeAt(n+1)]<<12|i[t.charCodeAt(n+2)]<<6|i[t.charCodeAt(n+3)],c[h++]=e>>16&255,c[h++]=e>>8&255,c[h++]=255&e;return 2===l&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,c[h++]=255&e),1===l&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,c[h++]=e>>8&255,c[h++]=255&e),c},e.fromByteArray=function(t){for(var e,i=t.length,r=i%3,s=[],o=16383,a=0,c=i-r;a<c;a+=o)s.push(l(t,a,a+o>c?c:a+o));return 1===r?(e=t[i-1],s.push(n[e>>2]+n[e<<4&63]+"==")):2===r&&(e=(t[i-2]<<8)+t[i-1],s.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),s.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)n[o]=s[o],i[s.charCodeAt(o)]=o;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function l(t,e,i){for(var r,s,o=[],a=e;a<i;a+=3)r=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(n[(s=r)>>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},911:(t,e,n)=>{var i=n(9922).hp;t.exports=function(t,e){if(i.isBuffer(t)&&i.isBuffer(e)){if("function"==typeof t.equals)return t.equals(e);if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}}},9922:(t,e,n)=>{"use strict";const i=n(7961),r=n(1024),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.hp=l,e.IS=50;const o=2147483647;function a(t){if(t>o)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,l.prototype),e}function l(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return u(t)}return c(t,e,n)}function c(t,e,n){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!l.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|f(t,e);let i=a(n);const r=i.write(t,e);return r!==n&&(i=i.slice(0,r)),i}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return p(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return p(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=t.valueOf&&t.valueOf();if(null!=i&&i!==t)return l.from(i,e,n);const r=function(t){if(l.isBuffer(t)){const e=0|A(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}return void 0!==t.length?"number"!=typeof t.length||J(t.length)?a(0):d(t):"Buffer"===t.type&&Array.isArray(t.data)?d(t.data):void 0}(t);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return l.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function u(t){return h(t),a(t<0?0:0|A(t))}function d(t){const e=t.length<0?0:0|A(t.length),n=a(e);for(let i=0;i<e;i+=1)n[i]=255&t[i];return n}function p(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(i,l.prototype),i}function A(t){if(t>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function f(t,e){if(l.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;let r=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(t).length;default:if(r)return i?-1:W(t).length;e=(""+e).toLowerCase(),r=!0}}function m(t,e,n){let i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,n);case"utf8":case"utf-8":return M(this,e,n);case"ascii":return I(this,e,n);case"latin1":case"binary":return B(this,e,n);case"base64":return _(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function g(t,e,n){const i=t[e];t[e]=t[n],t[n]=i}function v(t,e,n,i,r){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof e&&(e=l.from(e,i)),l.isBuffer(e))return 0===e.length?-1:y(t,e,n,i,r);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,i,r){let s,o=1,a=t.length,l=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;o=2,a/=2,l/=2,n/=2}function c(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(r){let i=-1;for(s=n;s<a;s++)if(c(t,s)===c(e,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===l)return i*o}else-1!==i&&(s-=s-i),i=-1}else for(n+l>a&&(n=a-l),s=n;s>=0;s--){let n=!0;for(let i=0;i<l;i++)if(c(t,s+i)!==c(e,i)){n=!1;break}if(n)return s}return-1}function E(t,e,n,i){n=Number(n)||0;const r=t.length-n;i?(i=Number(i))>r&&(i=r):i=r;const s=e.length;let o;for(i>s/2&&(i=s/2),o=0;o<i;++o){const i=parseInt(e.substr(2*o,2),16);if(J(i))return o;t[n+o]=i}return o}function x(t,e,n,i){return X(W(e,t.length-n),t,n,i)}function b(t,e,n,i){return X(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,i)}function C(t,e,n,i){return X(q(e),t,n,i)}function w(t,e,n,i){return X(function(t,e){let n,i,r;const s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)n=t.charCodeAt(o),i=n>>8,r=n%256,s.push(r),s.push(i);return s}(e,t.length-n),t,n,i)}function _(t,e,n){return 0===e&&n===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,n))}function M(t,e,n){n=Math.min(t.length,n);const i=[];let r=e;for(;r<n;){const e=t[r];let s=null,o=e>239?4:e>223?3:e>191?2:1;if(r+o<=n){let n,i,a,l;switch(o){case 1:e<128&&(s=e);break;case 2:n=t[r+1],128==(192&n)&&(l=(31&e)<<6|63&n,l>127&&(s=l));break;case 3:n=t[r+1],i=t[r+2],128==(192&n)&&128==(192&i)&&(l=(15&e)<<12|(63&n)<<6|63&i,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:n=t[r+1],i=t[r+2],a=t[r+3],128==(192&n)&&128==(192&i)&&128==(192&a)&&(l=(15&e)<<18|(63&n)<<12|(63&i)<<6|63&a,l>65535&&l<1114112&&(s=l))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),r+=o}return function(t){const e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);let n="",i=0;for(;i<e;)n+=String.fromCharCode.apply(String,t.slice(i,i+=S));return n}(i)}l.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(t,e,n){return c(t,e,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(t,e,n){return function(t,e,n){return h(t),t<=0?a(t):void 0!==e?"string"==typeof n?a(t).fill(e,n):a(t).fill(e):a(t)}(t,e,n)},l.allocUnsafe=function(t){return u(t)},l.allocUnsafeSlow=function(t){return u(t)},l.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==l.prototype},l.compare=function(t,e){if(Y(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(t)||!l.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,i=e.length;for(let r=0,s=Math.min(n,i);r<s;++r)if(t[r]!==e[r]){n=t[r],i=e[r];break}return n<i?-1:i<n?1:0},l.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return l.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const i=l.allocUnsafe(e);let r=0;for(n=0;n<t.length;++n){let e=t[n];if(Y(e,Uint8Array))r+e.length>i.length?(l.isBuffer(e)||(e=l.from(e)),e.copy(i,r)):Uint8Array.prototype.set.call(i,e,r);else{if(!l.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(i,r)}r+=e.length}return i},l.byteLength=f,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)g(this,e,e+1);return this},l.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)g(this,e,e+3),g(this,e+1,e+2);return this},l.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)g(this,e,e+7),g(this,e+1,e+6),g(this,e+2,e+5),g(this,e+3,e+4);return this},l.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?M(this,0,t):m.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(t){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===l.compare(this,t)},l.prototype.inspect=function(){let t="";const n=e.IS;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},s&&(l.prototype[s]=l.prototype.inspect),l.prototype.compare=function(t,e,n,i,r){if(Y(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(this===t)return 0;let s=(r>>>=0)-(i>>>=0),o=(n>>>=0)-(e>>>=0);const a=Math.min(s,o),c=this.slice(i,r),h=t.slice(e,n);for(let t=0;t<a;++t)if(c[t]!==h[t]){s=c[t],o=h[t];break}return s<o?-1:o<s?1:0},l.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},l.prototype.indexOf=function(t,e,n){return v(this,t,e,n,!0)},l.prototype.lastIndexOf=function(t,e,n){return v(this,t,e,n,!1)},l.prototype.write=function(t,e,n,i){if(void 0===e)i="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)i=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}const r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return E(this,t,e,n);case"utf8":case"utf-8":return x(this,t,e,n);case"ascii":case"latin1":case"binary":return b(this,t,e,n);case"base64":return C(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const S=4096;function I(t,e,n){let i="";n=Math.min(t.length,n);for(let r=e;r<n;++r)i+=String.fromCharCode(127&t[r]);return i}function B(t,e,n){let i="";n=Math.min(t.length,n);for(let r=e;r<n;++r)i+=String.fromCharCode(t[r]);return i}function T(t,e,n){const i=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>i)&&(n=i);let r="";for(let i=e;i<n;++i)r+=K[t[i]];return r}function R(t,e,n){const i=t.slice(e,n);let r="";for(let t=0;t<i.length-1;t+=2)r+=String.fromCharCode(i[t]+256*i[t+1]);return r}function L(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,n,i,r,s){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||e<s)throw new RangeError('"value" argument is out of bounds');if(n+i>t.length)throw new RangeError("Index out of range")}function P(t,e,n,i,r){z(e,i,r,t,n,7);let s=Number(e&BigInt(4294967295));t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,n}function U(t,e,n,i,r){z(e,i,r,t,n,7);let s=Number(e&BigInt(4294967295));t[n+7]=s,s>>=8,t[n+6]=s,s>>=8,t[n+5]=s,s>>=8,t[n+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=o,o>>=8,t[n+2]=o,o>>=8,t[n+1]=o,o>>=8,t[n]=o,n+8}function O(t,e,n,i,r,s){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(t,e,n,i,s){return e=+e,n>>>=0,s||O(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function k(t,e,n,i,s){return e=+e,n>>>=0,s||O(t,0,n,8),r.write(t,e,n,i,52,8),n+8}l.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const i=this.subarray(t,e);return Object.setPrototypeOf(i,l.prototype),i},l.prototype.readUintLE=l.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let i=this[t],r=1,s=0;for(;++s<e&&(r*=256);)i+=this[t+s]*r;return i},l.prototype.readUintBE=l.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let i=this[t+--e],r=1;for(;e>0&&(r*=256);)i+=this[t+--e]*r;return i},l.prototype.readUint8=l.prototype.readUInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),this[t]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(t,e){return t>>>=0,e||L(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readBigUInt64LE=Z((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const i=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,r=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(i)+(BigInt(r)<<BigInt(32))})),l.prototype.readBigUInt64BE=Z((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const i=e*2**24+65536*this[++t]+256*this[++t]+this[++t],r=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(i)<<BigInt(32))+BigInt(r)})),l.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let i=this[t],r=1,s=0;for(;++s<e&&(r*=256);)i+=this[t+s]*r;return r*=128,i>=r&&(i-=Math.pow(2,8*e)),i},l.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||L(t,e,this.length);let i=e,r=1,s=this[t+--i];for(;i>0&&(r*=256);)s+=this[t+--i]*r;return r*=128,s>=r&&(s-=Math.pow(2,8*e)),s},l.prototype.readInt8=function(t,e){return t>>>=0,e||L(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(t,e){t>>>=0,e||L(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return t>>>=0,e||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readBigInt64LE=Z((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const i=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),l.prototype.readBigInt64BE=Z((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||V(t,this.length-8);const i=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(i)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),l.prototype.readFloatLE=function(t,e){return t>>>=0,e||L(t,4,this.length),r.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return t>>>=0,e||L(t,4,this.length),r.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return t>>>=0,e||L(t,8,this.length),r.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return t>>>=0,e||L(t,8,this.length),r.read(this,t,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(t,e,n,i){t=+t,e>>>=0,n>>>=0,i||D(this,t,e,n,Math.pow(2,8*n)-1,0);let r=1,s=0;for(this[e]=255&t;++s<n&&(r*=256);)this[e+s]=t/r&255;return e+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(t,e,n,i){t=+t,e>>>=0,n>>>=0,i||D(this,t,e,n,Math.pow(2,8*n)-1,0);let r=n-1,s=1;for(this[e+r]=255&t;--r>=0&&(s*=256);)this[e+r]=t/s&255;return e+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,1,255,0),this[e]=255&t,e+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},l.prototype.writeBigUInt64LE=Z((function(t,e=0){return P(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=Z((function(t,e=0){return U(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*n-1);D(this,t,e,n,i-1,-i)}let r=0,s=1,o=0;for(this[e]=255&t;++r<n&&(s*=256);)t<0&&0===o&&0!==this[e+r-1]&&(o=1),this[e+r]=(t/s|0)-o&255;return e+n},l.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e>>>=0,!i){const i=Math.pow(2,8*n-1);D(this,t,e,n,i-1,-i)}let r=n-1,s=1,o=0;for(this[e+r]=255&t;--r>=0&&(s*=256);)t<0&&0===o&&0!==this[e+r+1]&&(o=1),this[e+r]=(t/s|0)-o&255;return e+n},l.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},l.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},l.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},l.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},l.prototype.writeBigInt64LE=Z((function(t,e=0){return P(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=Z((function(t,e=0){return U(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(t,e,n){return F(this,t,e,!0,n)},l.prototype.writeFloatBE=function(t,e,n){return F(this,t,e,!1,n)},l.prototype.writeDoubleLE=function(t,e,n){return k(this,t,e,!0,n)},l.prototype.writeDoubleBE=function(t,e,n){return k(this,t,e,!1,n)},l.prototype.copy=function(t,e,n,i){if(!l.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);const r=i-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,i):Uint8Array.prototype.set.call(t,this.subarray(n,i),e),r},l.prototype.fill=function(t,e,n,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===t.length){const e=t.charCodeAt(0);("utf8"===i&&e<128||"latin1"===i)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let r;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(r=e;r<n;++r)this[r]=t;else{const s=l.isBuffer(t)?t:l.from(t,i),o=s.length;if(0===o)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(r=0;r<n-e;++r)this[r+e]=s[r%o]}return this};const N={};function Q(t,e,n){N[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function G(t){let e="",n=t.length;const i="-"===t[0]?1:0;for(;n>=i+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function z(t,e,n,i,r,s){if(t>n||t<e){const i="bigint"==typeof e?"n":"";let r;throw r=s>3?0===e||e===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${e}${i} and <= ${n}${i}`,new N.ERR_OUT_OF_RANGE("value",r,t)}!function(t,e,n){H(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||V(e,t.length-(n+1))}(i,r,s)}function H(t,e){if("number"!=typeof t)throw new N.ERR_INVALID_ARG_TYPE(e,"number",t)}function V(t,e,n){if(Math.floor(t)!==t)throw H(t,n),new N.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new N.ERR_BUFFER_OUT_OF_BOUNDS;throw new N.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}Q("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),Q("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),Q("ERR_OUT_OF_RANGE",(function(t,e,n){let i=`The value of "${t}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=G(String(n)):"bigint"==typeof n&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=G(r)),r+="n"),i+=` It must be ${e}. Received ${r}`,i}),RangeError);const j=/[^+/0-9A-Za-z-_]/g;function W(t,e){let n;e=e||1/0;const i=t.length;let r=null;const s=[];for(let o=0;o<i;++o){if(n=t.charCodeAt(o),n>55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;s.push(n)}else if(n<2048){if((e-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function q(t){return i.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(j,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function X(t,e,n,i){let r;for(r=0;r<i&&!(r+n>=e.length||r>=t.length);++r)e[r+n]=t[r];return r}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function J(t){return t!=t}const K=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const i=16*n;for(let r=0;r<16;++r)e[i+r]=t[n]+t[r]}return e}();function Z(t){return"undefined"==typeof BigInt?$:t}function $(){throw new Error("BigInt not supported")}},9089:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n="",i=void 0!==e[5];return e[4]&&(n+="@supports (".concat(e[4],") {")),e[2]&&(n+="@media ".concat(e[2]," {")),i&&(n+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),n+=t(e),i&&(n+="}"),e[2]&&(n+="}"),e[4]&&(n+="}"),n})).join("")},e.i=function(t,n,i,r,s){"string"==typeof t&&(t=[[null,t,void 0]]);var o={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(o[l]=!0)}for(var c=0;c<t.length;c++){var h=[].concat(t[c]);i&&o[h[0]]||(void 0!==s&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=s),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),e.push(h))}},e}},6492:t=>{"use strict";t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]|(%20)/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t):t}},963:t=>{"use strict";t.exports=function(t){var e=t[1],n=t[3];if(!n)return e;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),s="/*# ".concat(r," */");return[e].concat([s]).join("\n")}return[e].join("\n")}},8878:(t,e,n)=>{e.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;e.splice(1,0,n,"color: inherit");let i=0,r=0;e[0].replace(/%[a-zA-Z%]/g,(t=>{"%%"!==t&&(i++,"%c"===t&&(r=i))})),e.splice(r,0,n)},e.save=function(t){try{t?e.storage.setItem("debug",t):e.storage.removeItem("debug")}catch(t){}},e.load=function(){let t;try{t=e.storage.getItem("debug")}catch(t){}return!t&&"undefined"!=typeof process&&"env"in process&&(t=process.env.DEBUG),t},e.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let t;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(t=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(t[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},e.storage=function(){try{return localStorage}catch(t){}}(),e.destroy=(()=>{let t=!1;return()=>{t||(t=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.log=console.debug||console.log||(()=>{}),t.exports=n(8945)(e);const{formatters:i}=t.exports;i.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}},8945:(t,e,n)=>{t.exports=function(t){function e(t){let n,r,s,o=null;function a(...t){if(!a.enabled)return;const i=a,r=Number(new Date),s=r-(n||r);i.diff=s,i.prev=n,i.curr=r,n=r,t[0]=e.coerce(t[0]),"string"!=typeof t[0]&&t.unshift("%O");let o=0;t[0]=t[0].replace(/%([a-zA-Z%])/g,((n,r)=>{if("%%"===n)return"%";o++;const s=e.formatters[r];if("function"==typeof s){const e=t[o];n=s.call(i,e),t.splice(o,1),o--}return n})),e.formatArgs.call(i,t),(i.log||e.log).apply(i,t)}return a.namespace=t,a.useColors=e.useColors(),a.color=e.selectColor(t),a.extend=i,a.destroy=e.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(r!==e.namespaces&&(r=e.namespaces,s=e.enabled(t)),s),set:t=>{o=t}}),"function"==typeof e.init&&e.init(a),a}function i(t,n){const i=e(this.namespace+(void 0===n?":":n)+t);return i.log=this.log,i}function r(t,e){let n=0,i=0,r=-1,s=0;for(;n<t.length;)if(i<e.length&&(e[i]===t[n]||"*"===e[i]))"*"===e[i]?(r=i,s=n,i++):(n++,i++);else{if(-1===r)return!1;i=r+1,s++,n=s}for(;i<e.length&&"*"===e[i];)i++;return i===e.length}return e.debug=e,e.default=e,e.coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){const t=[...e.names,...e.skips.map((t=>"-"+t))].join(",");return e.enable(""),t},e.enable=function(t){e.save(t),e.namespaces=t,e.names=[],e.skips=[];const n=("string"==typeof t?t:"").trim().replace(" ",",").split(",").filter(Boolean);for(const t of n)"-"===t[0]?e.skips.push(t.slice(1)):e.names.push(t)},e.enabled=function(t){for(const n of e.skips)if(r(t,n))return!1;for(const n of e.names)if(r(t,n))return!0;return!1},e.humanize=n(9192),e.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(t).forEach((n=>{e[n]=t[n]})),e.names=[],e.skips=[],e.formatters={},e.selectColor=function(t){let n=0;for(let e=0;e<t.length;e++)n=(n<<5)-n+t.charCodeAt(e),n|=0;return e.colors[Math.abs(n)%e.colors.length]},e.enable(e.load()),e}},1124:(t,e,n)=>{"use strict";var i=n(6240),r=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function o(t,e,n){var s=e[n];if(null!=s){if(r.call(t,n)&&(void 0===t[n]||null===t[n]))throw new TypeError("Cannot convert undefined or null to object ("+n+")");r.call(t,n)&&i(s)?t[n]=a(Object(t[n]),e[n]):t[n]=s}}function a(t,e){if(t===e)return t;for(var n in e=Object(e))r.call(e,n)&&o(t,e,n);if(Object.getOwnPropertySymbols)for(var i=Object.getOwnPropertySymbols(e),a=0;a<i.length;a++)s.call(e,i[a])&&o(t,e,i[a]);return t}t.exports=function(t){t=function(t){if(null==t)throw new TypeError("Sources cannot be null or undefined");return Object(t)}(t);for(var e=1;e<arguments.length;e++)a(t,arguments[e]);return t}},8480:t=>{t.exports=function(t){switch(t){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},919:(t,e,n)=>{var i;i="undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},t.exports=i},1024:(t,e)=>{e.read=function(t,e,n,i,r){var s,o,a=8*r-i-1,l=(1<<a)-1,c=l>>1,h=-7,u=n?r-1:0,d=n?-1:1,p=t[e+u];for(u+=d,s=p&(1<<-h)-1,p>>=-h,h+=a;h>0;s=256*s+t[e+u],u+=d,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=i;h>0;o=256*o+t[e+u],u+=d,h-=8);if(0===s)s=1-c;else{if(s===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),s-=c}return(p?-1:1)*o*Math.pow(2,s-i)},e.write=function(t,e,n,i,r,s){var o,a,l,c=8*s-r-1,h=(1<<c)-1,u=h>>1,d=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,A=i?1:-1,f=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=h):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(o++,l/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(e*l-1)*Math.pow(2,r),o+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,r),o=0));r>=8;t[n+p]=255&a,p+=A,a/=256,r-=8);for(o=o<<r|a,c+=r;c>0;t[n+p]=255&o,p+=A,o/=256,c-=8);t[n+p-A]|=128*f}},2225:t=>{function e(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}t.exports=function(t){return null!=t&&(e(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&e(t.slice(0,0))}(t)||!!t._isBuffer)}},8847:t=>{t.exports=function(t){if(!t)return!1;var n=e.call(t);return"[object Function]"===n||"function"==typeof t&&"[object RegExp]"!==n||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var e=Object.prototype.toString},6240:t=>{"use strict";t.exports=function(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}},5651:(t,e,n)=>{var i=n(5406),r=n(4597),s=n(5734),o=["x","e","a","o","n","s","r","c","u","m","v","w","z"],a=["m","w"],l=["H","I","N","E","F","K","L","T","U","V","W","X","Y","Z"],c="\t".charCodeAt(0),h=" ".charCodeAt(0);function u(t){this.glyphs=[],this._measure=this.computeMetrics.bind(this),this.update(t)}function d(t){return new Function(["return function "+t+"() {"," return this._"+t,"}"].join("\n"))()}function p(t,e){if(!t.chars||0===t.chars.length)return null;var n=f(t.chars,e);return n>=0?t.chars[n]:null}function A(t,e,n){if(!t.kernings||0===t.kernings.length)return 0;for(var i=t.kernings,r=0;r<i.length;r++){var s=i[r];if(s.first===e&&s.second===n)return s.amount}return 0}function f(t,e,n){for(var i=n=n||0;i<t.length;i++)if(t[i].id===e)return i;return-1}t.exports=function(t){return new u(t)},u.prototype.update=function(t){if(t=r({measure:this._measure},t),this._opt=t,this._opt.tabSize=s(this._opt.tabSize,4),!t.font)throw new Error("must provide a valid bitmap font");var e=this.glyphs,n=t.text||"",a=t.font;this._setupSpaceGlyphs(a);var c=i.lines(n,t),h=t.width||0;e.length=0;var u=c.reduce((function(t,e){return Math.max(t,e.width,h)}),0),d=0,p=0,m=s(t.lineHeight,a.common.lineHeight),g=a.common.base,v=m-g,y=t.letterSpacing||0,E=m*c.length-v,x=function(t){return"center"===t?1:"right"===t?2:0}(this._opt.align);p-=E,this._width=u,this._height=E,this._descender=m-g,this._baseline=g,this._xHeight=function(t){for(var e=0;e<o.length;e++){var n=o[e].charCodeAt(0),i=f(t.chars,n);if(i>=0)return t.chars[i].height}return 0}(a),this._capHeight=function(t){for(var e=0;e<l.length;e++){var n=l[e].charCodeAt(0),i=f(t.chars,n);if(i>=0)return t.chars[i].height}return 0}(a),this._lineHeight=m,this._ascender=m-v-this._xHeight;var b=this;c.forEach((function(t,i){for(var r,s=t.start,o=t.end,l=t.width,c=s;c<o;c++){var h=n.charCodeAt(c),f=b.getGlyph(a,h);if(f){r&&(d+=A(a,r.id,f.id));var g=d;1===x?g+=(u-l)/2:2===x&&(g+=u-l),e.push({position:[g,p],data:f,index:c,line:i}),d+=f.xadvance+y,r=f}}p+=m,d=0})),this._linesTotal=c.length},u.prototype._setupSpaceGlyphs=function(t){if(this._fallbackSpaceGlyph=null,this._fallbackTabGlyph=null,t.chars&&0!==t.chars.length){var e=p(t,h)||function(t){for(var e=0;e<a.length;e++){var n=a[e].charCodeAt(0),i=f(t.chars,n);if(i>=0)return t.chars[i]}return 0}(t)||t.chars[0],n=this._opt.tabSize*e.xadvance;this._fallbackSpaceGlyph=e,this._fallbackTabGlyph=r(e,{x:0,y:0,xadvance:n,id:c,xoffset:0,yoffset:0,width:0,height:0})}},u.prototype.getGlyph=function(t,e){return p(t,e)||(e===c?this._fallbackTabGlyph:e===h?this._fallbackSpaceGlyph:null)},u.prototype.computeMetrics=function(t,e,n,i){var r,s=this._opt.letterSpacing||0,o=this._opt.font,a=0,l=0,c=0;if(!o.chars||0===o.chars.length)return{start:e,end:e,width:0};n=Math.min(t.length,n);for(var h=e;h<n;h++){var u,d=t.charCodeAt(h);if(u=this.getGlyph(o,d)){u.xoffset;var p=(a+=r?A(o,r.id,u.id):0)+u.xadvance+s,f=a+u.width;if(f>=i||p>=i)break;a=p,l=f,r=u}c++}return r&&(l+=r.xoffset),{start:e,end:e+c,width:l}},["width","height","descender","ascender","xHeight","baseline","capHeight","lineHeight"].forEach((function(t){Object.defineProperty(u.prototype,t,{get:d(t),configurable:!0})}))},5751:(t,e,n)=>{var i=n(9922).hp,r=n(3558),s=function(){},o=n(1476),a=n(7034),l=n(7480),c=n(573),h=n(4597),u=self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;t.exports=function(t,e){e="function"==typeof e?e:s,"string"==typeof t?t={uri:t}:t||(t={}),t.binary&&(t=function(t){if(u)return h(t,{responseType:"arraybuffer"});if(void 0===self.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var e=new self.XMLHttpRequest;return e.overrideMimeType("text/plain; charset=x-user-defined"),h({xhr:e},t)}(t)),r(t,(function(n,r,h){if(n)return e(n);if(!/^2/.test(r.statusCode))return e(new Error("http status code: "+r.statusCode));if(!h)return e(new Error("no body result"));var u,d,p=!1;if(u=h,"[object ArrayBuffer]"===Object.prototype.toString.call(u)){var A=new Uint8Array(h);h=i.from(A,"binary")}c(h)&&(p=!0,"string"==typeof h&&(h=i.from(h,"binary"))),p||(i.isBuffer(h)&&(h=h.toString(t.encoding)),h=h.trim());try{var f=r.headers["content-type"];d=p?l(h):/json/.test(f)||"{"===h.charAt(0)?JSON.parse(h):/xml/.test(f)||"<"===h.charAt(0)?a(h):o(h)}catch(t){e(new Error("error parsing font "+t.message)),e=s}e(null,d)}))}},573:(t,e,n)=>{var i=n(9922).hp,r=n(911),s=i.from([66,77,70,3]);t.exports=function(t){return"string"==typeof t?"BMF"===t.substring(0,3):t.length>4&&r(t.slice(0,4),s)}},9192:t=>{var e=1e3,n=60*e,i=60*n,r=24*i,s=7*r;function o(t,e,n,i){var r=e>=1.5*n;return Math.round(t/n)+" "+i+(r?"s":"")}t.exports=function(t,a){a=a||{};var l,c,h=typeof t;if("string"===h&&t.length>0)return function(t){if(!((t=String(t)).length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(o){var a=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return a*s;case"days":case"day":case"d":return a*r;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(t);if("number"===h&&isFinite(t))return a.long?(l=t,(c=Math.abs(l))>=r?o(l,c,r,"day"):c>=i?o(l,c,i,"hour"):c>=n?o(l,c,n,"minute"):c>=e?o(l,c,e,"second"):l+" ms"):function(t){var s=Math.abs(t);return s>=r?Math.round(t/r)+"d":s>=i?Math.round(t/i)+"h":s>=n?Math.round(t/n)+"m":s>=e?Math.round(t/e)+"s":t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},1476:t=>{function e(t,e){if(!(t=t.replace(/\t+/g," ").trim()))return null;var i=t.indexOf(" ");if(-1===i)throw new Error("no named row at line "+e);var r=t.substring(0,i);t=(t=(t=(t=t.substring(i+1)).replace(/letter=[\'\"]\S+[\'\"]/gi,"")).split("=")).map((function(t){return t.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)}));for(var s=[],o=0;o<t.length;o++){var a=t[o];0===o?s.push({key:a[0],data:""}):o===t.length-1?s[s.length-1].data=n(a[0]):(s[s.length-1].data=n(a[0]),s.push({key:a[1],data:""}))}var l={key:r,data:{}};return s.forEach((function(t){l.data[t.key]=t.data})),l}function n(t){return t&&0!==t.length?0===t.indexOf('"')||0===t.indexOf("'")?t.substring(1,t.length-1):-1!==t.indexOf(",")?function(t){return t.split(",").map((function(t){return parseInt(t,10)}))}(t):parseInt(t,10):""}t.exports=function(t){if(!t)throw new Error("no data provided");var n={pages:[],chars:[],kernings:[]},i=(t=t.toString().trim()).split(/\r\n?|\n/g);if(0===i.length)throw new Error("no data in BMFont file");for(var r=0;r<i.length;r++){var s=e(i[r],r);if(s)if("page"===s.key){if("number"!=typeof s.data.id)throw new Error("malformed file at line "+r+" -- needs page id=N");if("string"!=typeof s.data.file)throw new Error("malformed file at line "+r+' -- needs page file="path"');n.pages[s.data.id]=s.data.file}else"chars"===s.key||"kernings"===s.key||("char"===s.key?n.chars.push(s.data):"kerning"===s.key?n.kernings.push(s.data):n[s.key]=s.data)}return n}},7480:t=>{var e=[66,77,70];function n(t,e,n){if(n>e.length-1)return 0;var r=e.readUInt8(n++),s=e.readInt32LE(n);switch(n+=4,r){case 1:t.info=function(t,e){var n={};n.size=t.readInt16LE(e);var r=t.readUInt8(e+2);return n.smooth=r>>7&1,n.unicode=r>>6&1,n.italic=r>>5&1,n.bold=r>>4&1,r>>3&1&&(n.fixedHeight=1),n.charset=t.readUInt8(e+3)||"",n.stretchH=t.readUInt16LE(e+4),n.aa=t.readUInt8(e+6),n.padding=[t.readInt8(e+7),t.readInt8(e+8),t.readInt8(e+9),t.readInt8(e+10)],n.spacing=[t.readInt8(e+11),t.readInt8(e+12)],n.outline=t.readUInt8(e+13),n.face=function(t,e){return i(t,e).toString("utf8")}(t,e+14),n}(e,n);break;case 2:t.common=function(t,e){var n={};return n.lineHeight=t.readUInt16LE(e),n.base=t.readUInt16LE(e+2),n.scaleW=t.readUInt16LE(e+4),n.scaleH=t.readUInt16LE(e+6),n.pages=t.readUInt16LE(e+8),t.readUInt8(e+10),n.packed=0,n.alphaChnl=t.readUInt8(e+11),n.redChnl=t.readUInt8(e+12),n.greenChnl=t.readUInt8(e+13),n.blueChnl=t.readUInt8(e+14),n}(e,n);break;case 3:t.pages=function(t,e,n){for(var r=[],s=i(t,e),o=s.length+1,a=n/o,l=0;l<a;l++)r[l]=t.slice(e,e+s.length).toString("utf8"),e+=o;return r}(e,n,s);break;case 4:t.chars=function(t,e,n){for(var i=[],r=n/20,s=0;s<r;s++){var o={},a=20*s;o.id=t.readUInt32LE(e+0+a),o.x=t.readUInt16LE(e+4+a),o.y=t.readUInt16LE(e+6+a),o.width=t.readUInt16LE(e+8+a),o.height=t.readUInt16LE(e+10+a),o.xoffset=t.readInt16LE(e+12+a),o.yoffset=t.readInt16LE(e+14+a),o.xadvance=t.readInt16LE(e+16+a),o.page=t.readUInt8(e+18+a),o.chnl=t.readUInt8(e+19+a),i[s]=o}return i}(e,n,s);break;case 5:t.kernings=function(t,e,n){for(var i=[],r=n/10,s=0;s<r;s++){var o={},a=10*s;o.first=t.readUInt32LE(e+0+a),o.second=t.readUInt32LE(e+4+a),o.amount=t.readInt16LE(e+8+a),i[s]=o}return i}(e,n,s)}return 5+s}function i(t,e){for(var n=e;n<t.length&&0!==t[n];n++);return t.slice(e,n)}t.exports=function(t){if(t.length<6)throw new Error("invalid buffer length for BMFont");var i=e.every((function(e,n){return t.readUInt8(n)===e}));if(!i)throw new Error("BMFont missing BMF byte header");var r=3;if(t.readUInt8(r++)>3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var s={kernings:[],chars:[]},o=0;o<5;o++)r+=n(s,t,r);return s}},7034:(t,e,n)=>{var i=n(7829),r=n(1896),s={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"};function o(t){var e=function(t){for(var e=[],n=0;n<t.attributes.length;n++)e.push(t.attributes[n]);return e}(t);return e.reduce((function(t,e){var n;return t[(n=e.nodeName,s[n.toLowerCase()]||n)]=e.nodeValue,t}),{})}t.exports=function(t){t=t.toString();var e=r(t),n={pages:[],chars:[],kernings:[]};["info","common"].forEach((function(t){var r=e.getElementsByTagName(t)[0];r&&(n[t]=i(o(r)))}));var s=e.getElementsByTagName("pages")[0];if(!s)throw new Error("malformed file -- no <pages> element");for(var a=s.getElementsByTagName("page"),l=0;l<a.length;l++){var c=a[l],h=parseInt(c.getAttribute("id"),10),u=c.getAttribute("file");if(isNaN(h))throw new Error('malformed file -- page "id" attribute is NaN');if(!u)throw new Error('malformed file -- needs page "file" attribute');n.pages[parseInt(h,10)]=u}return["chars","kernings"].forEach((function(t){var r=e.getElementsByTagName(t)[0];if(r)for(var s=t.substring(0,t.length-1),a=r.getElementsByTagName(s),l=0;l<a.length;l++){var c=a[l];n[t].push(i(o(c)))}})),n}},7829:t=>{var e="chasrset";t.exports=function(t){for(var n in t=Object.assign({},t),e in t&&(t.charset=t[e],delete t[e]),t)"face"!==n&&"charset"!==n&&(t[n]="padding"===n||"spacing"===n?t[n].split(",").map((function(t){return parseInt(t,10)})):parseInt(t[n],10));return t}},3216:t=>{var e=function(t){return t.replace(/^\s+|\s+$/g,"")};t.exports=function(t){if(!t)return{};for(var n,i={},r=e(t).split("\n"),s=0;s<r.length;s++){var o=r[s],a=o.indexOf(":"),l=e(o.slice(0,a)).toLowerCase(),c=e(o.slice(a+1));void 0===i[l]?i[l]=c:(n=i[l],"[object Array]"===Object.prototype.toString.call(n)?i[l].push(c):i[l]=[i[l],c])}return i}},9035:(t,e,n)=>{var i=n(8480),r=n(8167),s=n(2225),o=[0,2,3],a=[2,1,3];t.exports=function(t,e){t&&(r(t)||s(t))||(e=t||{},t=null);for(var n="string"==typeof(e="number"==typeof e?{count:e}:e||{}).type?e.type:"uint16",l="number"==typeof e.count?e.count:1,c=e.start||0,h=!1!==e.clockwise?o:a,u=h[0],d=h[1],p=h[2],A=6*l,f=t||new(i(n))(A),m=0,g=0;m<A;m+=6,g+=4){var v=m+c;f[v+0]=g+0,f[v+1]=g+1,f[v+2]=g+2,f[v+3]=g+u,f[v+4]=g+d,f[v+5]=g+p}return f}},4433:(t,e,n)=>{var i=n(5651),r=n(9035),s=n(7106),o=n(1684);t.exports=function(t){return new a(t)};class a extends THREE.BufferGeometry{constructor(t){super(),"string"==typeof t&&(t={text:t}),this._opt=Object.assign({},t),t&&this.update(t)}update(t){if("string"==typeof t&&(t={text:t}),!(t=Object.assign({},this._opt,t)).font)throw new TypeError("must specify a { font } in options");this.layout=i(t);var e=!1!==t.flipY,n=t.font,o=n.common.scaleW,a=n.common.scaleH,l=this.layout.glyphs.filter((function(t){var e=t.data;return e.width*e.height>0}));this.visibleGlyphs=l;var c=s.positions(l),h=s.uvs(l,o,a,e),u=r([],{clockwise:!0,type:"uint16",count:l.length});if(this.setIndex(u),this.setAttribute("position",new THREE.BufferAttribute(c,2)),this.setAttribute("uv",new THREE.BufferAttribute(h,2)),!t.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(t.multipage){var d=s.pages(l);this.setAttribute("page",new THREE.BufferAttribute(d,1))}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var t=this.attributes.position.array,e=this.attributes.position.itemSize;if(!t||!e||t.length<2)return this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0);o.computeSphere(t,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var t=this.boundingBox,e=this.attributes.position.array,n=this.attributes.position.itemSize;!e||!n||e.length<2?t.makeEmpty():o.computeBox(e,t)}}},1684:t=>{var e={min:[0,0],max:[0,0]};function n(t){var n=t.length/2;e.min[0]=t[0],e.min[1]=t[1],e.max[0]=t[0],e.max[1]=t[1];for(var i=0;i<n;i++){var r=t[2*i+0],s=t[2*i+1];e.min[0]=Math.min(r,e.min[0]),e.min[1]=Math.min(s,e.min[1]),e.max[0]=Math.max(r,e.max[0]),e.max[1]=Math.max(s,e.max[1])}}t.exports.computeBox=function(t,i){n(t),i.min.set(e.min[0],e.min[1],0),i.max.set(e.max[0],e.max[1],0)},t.exports.computeSphere=function(t,i){n(t);var r=e.min[0],s=e.min[1],o=e.max[0]-r,a=e.max[1]-s,l=Math.sqrt(o*o+a*a);i.center.set(r+o/2,s+a/2,0),i.radius=l/2}},7106:t=>{t.exports.pages=function(t){var e=new Float32Array(4*t.length*1),n=0;return t.forEach((function(t){var i=t.data.page||0;e[n++]=i,e[n++]=i,e[n++]=i,e[n++]=i})),e},t.exports.uvs=function(t,e,n,i){var r=new Float32Array(4*t.length*2),s=0;return t.forEach((function(t){var o=t.data,a=o.x+o.width,l=o.y+o.height,c=o.x/e,h=o.y/n,u=a/e,d=l/n;i&&(h=(n-o.y)/n,d=(n-l)/n),r[s++]=c,r[s++]=h,r[s++]=c,r[s++]=d,r[s++]=u,r[s++]=d,r[s++]=u,r[s++]=h})),r},t.exports.positions=function(t){var e=new Float32Array(4*t.length*2),n=0;return t.forEach((function(t){var i=t.data,r=t.position[0]+i.xoffset,s=t.position[1]+i.yoffset,o=i.width,a=i.height;e[n++]=r,e[n++]=s,e[n++]=r,e[n++]=s+a,e[n++]=r+o,e[n++]=s+a,e[n++]=r+o,e[n++]=s})),e}},5406:t=>{var e=/\n/,n=/\s/;function i(t,e,n,i){var r=t.indexOf(e,n);return-1===r||r>i?i:r}function r(t){return n.test(t)}function s(t,e,n,i){return{start:e,end:e+Math.min(i,n-e)}}t.exports=function(e,n){return t.exports.lines(e,n).map((function(t){return e.substring(t.start,t.end)})).join("\n")},t.exports.lines=function(t,n){if(0===(n=n||{}).width&&"nowrap"!==n.mode)return[];t=t||"";var o="number"==typeof n.width?n.width:Number.MAX_VALUE,a=Math.max(0,n.start||0),l="number"==typeof n.end?n.end:t.length,c=n.mode,h=n.measure||s;return"pre"===c?function(t,n,i,r,s){for(var o=[],a=i,l=i;l<r&&l<n.length;l++){var c=n.charAt(l),h=e.test(c);if(h||l===r-1){var u=t(n,a,h?l:l+1,s);o.push(u),a=l+1}}return o}(h,t,a,l,o):function(t,e,n,s,o,a){var l=[],c=o;for("nowrap"===a&&(c=Number.MAX_VALUE);n<s&&n<e.length;){for(var h=i(e,"\n",n,s);n<h&&r(e.charAt(n));)n++;var u=t(e,n,h,c),d=n+(u.end-u.start),p=d+1;if(d<h){for(;d>n&&!r(e.charAt(d));)d--;if(d===n)p>n+1&&p--,d=p;else for(p=d;d>n&&r(e.charAt(d-1));)d--}if(d>=n){var A=t(e,n,d,c);l.push(A)}n=p}return l}(h,t,a,l,o,c)}},3558:(t,e,n)=>{"use strict";var i=n(919),r=n(8847),s=n(3216),o=n(4597);function a(t,e,n){var i=t;return r(e)?(n=e,"string"==typeof t&&(i={uri:t})):i=o(e,{uri:t}),i.callback=n,i}function l(t,e,n){return c(e=a(t,e,n))}function c(t){if(void 0===t.callback)throw new Error("callback argument missing");var e=!1,n=function(n,i,r){e||(e=!0,t.callback(n,i,r))};function i(){var t=void 0;if(t=h.response?h.response:h.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(h),g)try{t=JSON.parse(t)}catch(t){}return t}function r(t){return clearTimeout(u),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,n(t,v)}function o(){if(!c){var e;clearTimeout(u),e=t.useXDR&&void 0===h.status?200:1223===h.status?204:h.status;var r=v,o=null;return 0!==e?(r={body:i(),statusCode:e,method:p,headers:{},url:d,rawRequest:h},h.getAllResponseHeaders&&(r.headers=s(h.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var a,c,h=t.xhr||null;h||(h=t.cors||t.useXDR?new l.XDomainRequest:new l.XMLHttpRequest);var u,d=h.url=t.uri||t.url,p=h.method=t.method||"GET",A=t.body||t.data,f=h.headers=t.headers||{},m=!!t.sync,g=!1,v={body:void 0,headers:{},statusCode:0,method:p,url:d,rawRequest:h};if("json"in t&&!1!==t.json&&(g=!0,f.accept||f.Accept||(f.Accept="application/json"),"GET"!==p&&"HEAD"!==p&&(f["content-type"]||f["Content-Type"]||(f["Content-Type"]="application/json"),A=JSON.stringify(!0===t.json?A:t.json))),h.onreadystatechange=function(){4===h.readyState&&setTimeout(o,0)},h.onload=o,h.onerror=r,h.onprogress=function(){},h.onabort=function(){c=!0},h.ontimeout=r,h.open(p,d,!m,t.username,t.password),m||(h.withCredentials=!!t.withCredentials),!m&&t.timeout>0&&(u=setTimeout((function(){if(!c){c=!0,h.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",r(t)}}),t.timeout)),h.setRequestHeader)for(a in f)f.hasOwnProperty(a)&&h.setRequestHeader(a,f[a]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(h.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(h),h.send(A||null),h}t.exports=l,t.exports.default=l,l.XMLHttpRequest=i.XMLHttpRequest||function(){},l.XDomainRequest="withCredentials"in new l.XMLHttpRequest?l.XMLHttpRequest:i.XDomainRequest,function(t,e){for(var n=0;n<t.length;n++)e(t[n])}(["get","put","post","patch","head","delete"],(function(t){l["delete"===t?"del":t]=function(e,n,i){return(n=a(e,n,i)).method=t.toUpperCase(),c(n)}}))},1896:t=>{t.exports=void 0!==self.DOMParser?function(t){return(new self.DOMParser).parseFromString(t,"application/xml")}:void 0!==self.ActiveXObject&&new self.ActiveXObject("Microsoft.XMLDOM")?function(t){var e=new self.ActiveXObject("Microsoft.XMLDOM");return e.async="false",e.loadXML(t),e}:function(t){var e=document.createElement("div");return e.innerHTML=t,e}},4597:t=>{t.exports=function(){for(var t={},n=0;n<arguments.length;n++){var i=arguments[n];for(var r in i)e.call(i,r)&&(t[r]=i[r])}return t};var e=Object.prototype.hasOwnProperty},8132:()=>{window.aframeStats=function(t){var e=null,n=t;return{update:function(){var t;e("te").set((t=n.querySelectorAll("*"),Array.prototype.slice.call(t).filter((function(t){return t.isEntity})),t.length)),window.performance.getEntriesByName&&e("lt").set(window.performance.getEntriesByName("render-started")[0].startTime.toFixed(0))},start:function(){},end:function(){},attach:function(t){e=t},values:{te:{caption:"Entities"},lt:{caption:"Load Time"}},groups:[{caption:"A-Frame",values:["te","lt"]}],fractions:[]}}},3729:t=>{window.glStats=function(){var t=null,e=0,n=0,i=0,r=0,s=0,o=0,a=0;function l(t,e){return function(){e.apply(this,arguments),t.apply(this,arguments)}}return WebGLRenderingContext.prototype.drawArrays=l(WebGLRenderingContext.prototype.drawArrays,(function(){e++,arguments[0]==this.POINTS?o+=arguments[2]:s+=arguments[2]})),WebGLRenderingContext.prototype.drawElements=l(WebGLRenderingContext.prototype.drawElements,(function(){n++,r+=arguments[1]/3,s+=arguments[1]})),WebGLRenderingContext.prototype.useProgram=l(WebGLRenderingContext.prototype.useProgram,(function(){i++})),WebGLRenderingContext.prototype.bindTexture=l(WebGLRenderingContext.prototype.bindTexture,(function(){a++})),{update:function(){t("allcalls").set(e+n),t("drawElements").set(n),t("drawArrays").set(e),t("bindTexture").set(a),t("useProgram").set(i),t("glfaces").set(r),t("glvertices").set(s),t("glpoints").set(o)},start:function(){e=0,n=0,i=0,r=0,s=0,o=0,a=0},end:function(){},attach:function(e){t=e},values:{allcalls:{over:3e3,caption:"Calls (hook)"},drawelements:{caption:"drawElements (hook)"},drawarrays:{caption:"drawArrays (hook)"}},groups:[{caption:"WebGL",values:["allcalls","drawelements","drawarrays","useprogram","bindtexture","glfaces","glvertices","glpoints"]}],fractions:[{base:"allcalls",steps:["drawelements","drawarrays"]}]}},window.threeStats=function(t){var e=null;return{update:function(){e("renderer.info.memory.geometries").set(t.info.memory.geometries),e("renderer.info.programs").set(t.info.programs.length),e("renderer.info.memory.textures").set(t.info.memory.textures),e("renderer.info.render.calls").set(t.info.render.calls),e("renderer.info.render.triangles").set(t.info.render.triangles),e("renderer.info.render.points").set(t.info.render.points)},start:function(){},end:function(){},attach:function(t){e=t},values:{"renderer.info.memory.geometries":{caption:"Geometries"},"renderer.info.memory.textures":{caption:"Textures"},"renderer.info.programs":{caption:"Programs"},"renderer.info.render.calls":{caption:"Calls"},"renderer.info.render.triangles":{caption:"Triangles",over:1e3},"renderer.info.render.points":{caption:"Points"}},groups:[{caption:"Three.js - Memory",values:["renderer.info.memory.geometries","renderer.info.programs","renderer.info.memory.textures"]},{caption:"Three.js - Render",values:["renderer.info.render.calls","renderer.info.render.triangles","renderer.info.render.points"]}],fractions:[]}},window.BrowserStats=function(){var t=null,e=0,n=0;window.performance&&!performance.memory&&(performance.memory={usedJSHeapSize:0,totalJSHeapSize:0}),0===performance.memory.totalJSHeapSize&&console.warn("totalJSHeapSize === 0... performance.memory is only available in Chrome .");var i=Math.log(1024);function r(t){var e=Math.floor(Math.log(t)/i);return Math.round(100*t/Math.pow(1024,e))/100}return{update:function(){e=r(performance.memory.usedJSHeapSize),n=r(performance.memory.totalJSHeapSize),t("memory").set(e),t("total").set(n)},start:function(){e=0},end:function(){},attach:function(e){t=e},values:{memory:{caption:"Used Memory",average:!0,avgMs:1e3,over:22},total:{caption:"Total Memory"}},groups:[{caption:"Browser",values:["memory","total"]}],fractions:[{base:"total",steps:["memory"]}]}},t.exports={glStats:window.glStats,threeStats:window.threeStats,BrowserStats:window.BrowserStats}},282:t=>{"use strict";!function(){"performance"in window==0&&(window.performance={});var t=window.performance;if("now"in t==0){var e=Date.now();t.timing&&t.timing.navigationStart&&(e=t.timing.navigationStart),t.now=function(){return Date.now()-e}}t.mark||(t.mark=function(){}),t.measure||(t.measure=function(){})}(),window.rStats=function(t){function e(t,e){for(var n=Object.keys(t),i=0,r=n.length;i<r;i++)e(n[i])}var n=t||{},i=n.colours||["#850700","#c74900","#fcb300","#284280","#4c7c0c"],r=(n.CSSPath?n.CSSPath:"")+"rStats.css";(n.css||["https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300",r]).forEach((function(t){var e,n;e=t,(n=document.createElement("link")).href=e,n.rel="stylesheet",n.type="text/css",document.getElementsByTagName("head")[0].appendChild(n)})),n.values||(n.values={});var s,o,a=10,l={};function c(t,e,n){var i=n||{},r=document.createElement("canvas"),s=r.getContext("2d"),o=0,l=0,c=i.color?i.color:"#666666",h=document.createElement("canvas"),u=h.getContext("2d");h.width=1,h.height=20,u.fillStyle="#444444",u.fillRect(0,0,1,20),u.fillStyle=c,u.fillRect(0,a,1,a),u.fillStyle="#ffffff",u.globalAlpha=.5,u.fillRect(0,a,1,1),u.globalAlpha=1;var d=document.createElement("canvas"),p=d.getContext("2d");return d.width=1,d.height=20,p.fillStyle="#444444",p.fillRect(0,0,1,20),p.fillStyle="#b70000",p.fillRect(0,a,1,a),p.globalAlpha=.5,p.fillStyle="#ffffff",p.fillRect(0,a,1,1),p.globalAlpha=1,r.width=200,r.height=a,r.style.width=r.width+"px",r.style.height=r.height+"px",r.className="rs-canvas",t.appendChild(r),s.fillStyle="#444444",s.fillRect(0,0,r.width,r.height),{draw:function(t,e){(l+=.1*(t-l))>(o*=.99)&&(o=l),s.drawImage(r,1,0,r.width-1,r.height,0,0,r.width-1,r.height),e?s.drawImage(d,r.width-1,r.height-l*r.height/o-a):s.drawImage(h,r.width-1,r.height-l*r.height/o-a)}}}function h(t,n){var r=document.createElement("canvas"),s=r.getContext("2d");return r.width=200,r.height=a*n,r.style.width=r.width+"px",r.style.height=r.height+"px",r.className="rs-canvas",t.appendChild(r),s.fillStyle="#444444",s.fillRect(0,0,r.width,r.height),{draw:function(t){s.drawImage(r,1,0,r.width-1,r.height,0,0,r.width-1,r.height);var n=0;e(t,(function(e){var o=t[e]*r.height;s.fillStyle=i[e],s.fillRect(r.width-1,n,1,o),n+=o}))}}}function u(t,e){var i,r=t,s=0,a=0,l=0,h=0,u=performance.now(),d=0,p=document.createElement("div"),A=document.createElement("span"),f=document.createElement("div"),m=document.createTextNode(""),g=n?n.values[r.toLowerCase()]:null,v=new c(p,r,g),y=!1;function E(t){if(g&&g.average){h+=t,d++;var e=performance.now();e-u>=(g.avgMs||1e3)&&(l=h/d,h=0,u=e,d=0)}}function x(){i=performance.now(),n.userTimingAPI&&performance.mark(r+"-start"),y=!0}function b(){s=performance.now()-i,n.userTimingAPI&&(performance.mark(r+"-end"),y&&performance.measure(r,r+"-start",r+"-end")),E(s)}return A.className="rs-counter-id",A.textContent=g&&g.caption?g.caption:r,f.className="rs-counter-value",f.appendChild(m),p.appendChild(A),p.appendChild(f),e?e.div.appendChild(p):o.appendChild(p),i=performance.now(),{set:function(t){E(s=t)},start:x,tick:function(){b(),x()},end:b,frame:function(){var t=performance.now(),e=t-i;a++,e>1e3&&(s=g&&!1===g.interpolate?a:1e3*a/e,a=0,i=t,E(s))},value:function(){return s},draw:function(){var t=g&&g.average?l:s;m.nodeValue=Math.round(100*t)/100;var e=g&&(g.below&&s<g.below||g.over&&s>g.over);v.draw(s,e),p.className=e?"rs-counter-base alarm":"rs-counter-base"}}}function d(t){var i=t.toLowerCase();if(void 0===i&&(i="default"),l[i])return l[i];var r=null;n&&n.groups&&e(n.groups,(function(t){var e=n.groups[parseInt(t,10)];r||-1===e.values.indexOf(i.toLowerCase())||(r=e)}));var s=new u(i,r);return l[i]=s,s}function p(){e(n.plugins,(function(t){n.plugins[t].update()})),e(l,(function(t){l[t].draw()})),n&&n.fractions&&e(n.fractions,(function(t){var i=n.fractions[parseInt(t,10)],r=[],s=l[i.base.toLowerCase()];s&&(s=s.value(),e(n.fractions[t].steps,(function(e){var i=n.fractions[t].steps[parseInt(e,10)].toLowerCase(),o=l[i];o&&r.push(o.value()/s)}))),i.graph.draw(r)}))}return function(){if(n.plugins){n.values||(n.values={}),n.groups||(n.groups=[]),n.fractions||(n.fractions=[]);for(var t=0;t<n.plugins.length;t++)n.plugins[t].attach(d),e(n.plugins[t].values,(function(e){n.values[e]=n.plugins[t].values[e]})),n.groups=n.groups.concat(n.plugins[t].groups),n.fractions=n.fractions.concat(n.plugins[t].fractions)}else n.plugins={};(s=document.createElement("div")).className="rs-base",(o=document.createElement("div")).className="rs-container",o.style.height="auto",s.appendChild(o),document.body.appendChild(s),n&&(n.groups&&e(n.groups,(function(t){var e=n.groups[parseInt(t,10)],i=document.createElement("div");i.className="rs-group",e.div=i;var r=document.createElement("h1");r.textContent=e.caption,r.addEventListener("click",function(t){this.classList.toggle("hidden"),t.preventDefault()}.bind(i)),o.appendChild(r),o.appendChild(i)})),n.fractions&&e(n.fractions,(function(t){var r=n.fractions[parseInt(t,10)],s=document.createElement("div");s.className="rs-fraction";var l=document.createElement("div");l.className="rs-legend";var c=0;e(n.fractions[t].steps,(function(e){var r=document.createElement("p");r.textContent=n.fractions[t].steps[e],r.style.color=i[c],l.appendChild(r),c++})),s.appendChild(l),s.style.height=c*a+"px",r.div=s;var u=new h(s,c);r.graph=u,o.appendChild(s)})))}(),function(t){return t?d(t):{element:s,update:p}}},t.exports=window.rStats},2535:t=>{var e={base64:function(t,e){return"data:"+t+";base64,"+e},isMobile:function(){var t,e=!1;return t=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0),e},isIOS:function(){return/(iPad|iPhone|iPod)/g.test(navigator.userAgent)},isIFrame:function(){try{return window.self!==window.top}catch(t){return!0}},appendQueryParameter:function(t,e,n){var i=t.indexOf("?")<0?"?":"&";return t+(i+e+"=")+n},getQueryParameter:function(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))},isLandscapeMode:function(){return 90==window.orientation||-90==window.orientation}};t.exports=e},5928:(t,e,n)=>{var i,r=n(2535);t.exports=(i=navigator.userAgent||navigator.vendor||window.opera).match(/iPhone/i)||i.match(/iPod/i)?function(){var t=null;this.request=function(){t||(t=setInterval((function(){window.location.href="/",setTimeout(window.stop,0)}),15e3))},this.release=function(){t&&(clearInterval(t),t=null)}}:function(){var t=document.createElement("video");t.addEventListener("ended",(function(){t.play()})),this.request=function(){t.paused&&(t.src=r.base64("video/webm","GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4ECQoWBAhhTgGcBAAAAAAAH4xFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsggfG7AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU2LjQwLjEwMVdBjUxhdmY1Ni40MC4xMDFzpJAGSJTMbsLpDt/ySkipgX1fRImIQO1MAAAAAAAWVK5rAQAAAAAAADuuAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDmDgQEj44OEO5rKAOABAAAAAAAABrCBsLqBkB9DtnUBAAAAAAAAo+eBAKOmgQAAgKJJg0IAAV4BHsAHBIODCoAACmH2MAAAZxgz4dPSTFi5JACjloED6ACmAECSnABMQAADYAAAWi0quoCjloEH0ACmAECSnABNwAADYAAAWi0quoCjloELuACmAECSnABNgAADYAAAWi0quoCjloEPoACmAECSnABNYAADYAAAWi0quoCjloETiACmAECSnABNIAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTnghdwo5aBAAAApgBAkpwATOAAA2AAAFotKrqAo5aBA+gApgBAkpwATMAAA2AAAFotKrqAo5aBB9AApgBAkpwATIAAA2AAAFotKrqAo5aBC7gApgBAkpwATEAAA2AAAFotKrqAo5aBD6AApgDAkpwAQ2AAA2AAAFotKrqAo5aBE4gApgBAkpwATCAAA2AAAFotKrqAH0O2dQEAAAAAAACU54Iu4KOWgQAAAKYAQJKcAEvAAANgAABaLSq6gKOWgQPoAKYAQJKcAEtgAANgAABaLSq6gKOWgQfQAKYAQJKcAEsAAANgAABaLSq6gKOWgQu4AKYAQJKcAEqAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEogAANgAABaLSq6gKOWgROIAKYAQJKcAEnAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCRlCjloEAAACmAECSnABJgAADYAAAWi0quoCjloED6ACmAECSnABJIAADYAAAWi0quoCjloEH0ACmAMCSnABDYAADYAAAWi0quoCjloELuACmAECSnABI4AADYAAAWi0quoCjloEPoACmAECSnABIoAADYAAAWi0quoCjloETiACmAECSnABIYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngl3Ao5aBAAAApgBAkpwASCAAA2AAAFotKrqAo5aBA+gApgBAkpwASAAAA2AAAFotKrqAo5aBB9AApgBAkpwAR8AAA2AAAFotKrqAo5aBC7gApgBAkpwAR4AAA2AAAFotKrqAo5aBD6AApgBAkpwAR2AAA2AAAFotKrqAo5aBE4gApgBAkpwARyAAA2AAAFotKrqAH0O2dQEAAAAAAACU54J1MKOWgQAAAKYAwJKcAENgAANgAABaLSq6gKOWgQPoAKYAQJKcAEbgAANgAABaLSq6gKOWgQfQAKYAQJKcAEagAANgAABaLSq6gKOWgQu4AKYAQJKcAEaAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEZAAANgAABaLSq6gKOWgROIAKYAQJKcAEYAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCjKCjloEAAACmAECSnABF4AADYAAAWi0quoCjloED6ACmAECSnABFwAADYAAAWi0quoCjloEH0ACmAECSnABFoAADYAAAWi0quoCjloELuACmAECSnABFgAADYAAAWi0quoCjloEPoACmAMCSnABDYAADYAAAWi0quoCjloETiACmAECSnABFYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngqQQo5aBAAAApgBAkpwARUAAA2AAAFotKrqAo5aBA+gApgBAkpwARSAAA2AAAFotKrqAo5aBB9AApgBAkpwARQAAA2AAAFotKrqAo5aBC7gApgBAkpwARQAAA2AAAFotKrqAo5aBD6AApgBAkpwAROAAA2AAAFotKrqAo5aBE4gApgBAkpwARMAAA2AAAFotKrqAH0O2dQEAAAAAAACU54K7gKOWgQAAAKYAQJKcAESgAANgAABaLSq6gKOWgQPoAKYAQJKcAESAAANgAABaLSq6gKOWgQfQAKYAwJKcAENgAANgAABaLSq6gKOWgQu4AKYAQJKcAERgAANgAABaLSq6gKOWgQ+gAKYAQJKcAERAAANgAABaLSq6gKOWgROIAKYAQJKcAEQgAANgAABaLSq6gB9DtnUBAAAAAAAAlOeC0vCjloEAAACmAECSnABEIAADYAAAWi0quoCjloED6ACmAECSnABEAAADYAAAWi0quoCjloEH0ACmAECSnABD4AADYAAAWi0quoCjloELuACmAECSnABDwAADYAAAWi0quoCjloEPoACmAECSnABDoAADYAAAWi0quoCjloETiACmAECSnABDgAADYAAAWi0quoAcU7trAQAAAAAAABG7j7OBALeK94EB8YIBd/CBAw=="),t.play())},this.release=function(){t.pause(),t.src=""}}},8217:(t,e,n)=>{"use strict";n.d(e,{A:()=>E});var i=n(963),r=n.n(i),s=n(9089),o=n.n(s),a=n(6492),l=n.n(a),c=new URL(n(9169),n.b),h=new URL(n(6085),n.b),u=new URL(n(3931),n.b),d=new URL(n(7889),n.b),p=new URL(n(6517),n.b),A=o()(r()),f=l()(c),m=l()(h),g=l()(u),v=l()(d),y=l()(p);A.push([t.id,`/* .a-fullscreen means not embedded. */\nhtml.a-fullscreen {\n bottom: 0;\n left: 0;\n position: fixed;\n right: 0;\n top: 0;\n}\n\nhtml.a-fullscreen body {\n height: 100%;\n margin: 0;\n overflow: hidden;\n padding: 0;\n width: 100%;\n}\n\n/* Class is removed when doing <a-scene embedded>. */\nhtml.a-fullscreen .a-canvas {\n width: 100% !important;\n height: 100% !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n position: fixed !important;\n}\n\nhtml:not(.a-fullscreen) .a-enter-vr,\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 5px;\n bottom: 5px;\n}\n\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 60px;\n}\n\n/* In chrome mobile the user agent stylesheet set it to white */\n:-webkit-full-screen {\n background-color: transparent;\n}\n\n.a-hidden {\n display: none !important;\n}\n\n.a-canvas {\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.a-canvas.a-grab-cursor:hover {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\ncanvas.a-canvas.a-mouse-cursor-hover:hover {\n cursor: pointer;\n}\n\n.a-inspector-loader {\n background-color: #ed3160;\n position: fixed;\n left: 3px;\n top: 3px;\n padding: 6px 10px;\n color: #fff;\n text-decoration: none;\n font-size: 12px;\n font-family: Roboto,sans-serif;\n text-align: center;\n z-index: 99999;\n width: 204px;\n}\n\n/* Inspector loader animation */\n@keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n@-webkit-keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@-webkit-keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@-webkit-keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n\n.a-inspector-loader .dots span {\n animation: dots-1 2s infinite steps(1);\n -webkit-animation: dots-1 2s infinite steps(1);\n}\n\n.a-inspector-loader .dots span:first-child + span {\n animation-name: dots-2;\n -webkit-animation-name: dots-2;\n}\n\n.a-inspector-loader .dots span:first-child + span + span {\n animation-name: dots-3;\n -webkit-animation-name: dots-3;\n}\n\na-scene {\n display: block;\n position: relative;\n height: 100%;\n width: 100%;\n}\n\na-assets,\na-scene video,\na-scene img,\na-scene audio {\n display: none;\n}\n\n.a-enter-vr-modal,\n.a-orientation-modal {\n font-family: Consolas, Andale Mono, Courier New, monospace;\n}\n\n.a-enter-vr-modal a {\n border-bottom: 1px solid #fff;\n padding: 2px 0;\n text-decoration: none;\n transition: .1s color ease-in;\n}\n\n.a-enter-vr-modal a:hover {\n background-color: #fff;\n color: #111;\n padding: 2px 4px;\n position: relative;\n left: -4px;\n}\n\n.a-enter-vr,\n.a-enter-ar {\n font-family: sans-serif, monospace;\n font-size: 13px;\n width: 100%;\n font-weight: 200;\n line-height: 16px;\n position: absolute;\n right: 20px;\n bottom: 20px;\n}\n\n.a-enter-ar.xr {\n right: 90px;\n}\n\n.a-enter-vr-button,\n.a-enter-vr-modal,\n.a-enter-vr-modal a {\n color: #fff;\n user-select: none;\n outline: none;\n}\n\n.a-enter-vr-button {\n background: rgba(0, 0, 0, 0.35) url(${f}) 50% 50% no-repeat;\n}\n\n.a-enter-ar-button {\n background: rgba(0, 0, 0, 0.20) url(${m}) 50% 50% no-repeat;\n}\n\n.a-enter-vr.fullscreen .a-enter-vr-button {\n background-image: url(${g});\n}\n\n.a-enter-vr-button,\n.a-enter-ar-button {\n background-size: 90% 90%;\n border: 0;\n bottom: 0;\n cursor: pointer;\n min-width: 58px;\n min-height: 34px;\n /* 1.74418604651 */\n /*\n In order to keep the aspect ratio when resizing\n padding-top percentages are relative to the containing block's width.\n http://stackoverflow.com/questions/12121090/responsively-change-div-size-keeping-aspect-ratio\n */\n padding-right: 0;\n padding-top: 0;\n position: absolute;\n right: 0;\n transition: background-color .05s ease;\n -webkit-transition: background-color .05s ease;\n z-index: 9999;\n border-radius: 8px;\n touch-action: manipulation; /* Prevent iOS double tap zoom on the button */\n}\n\n.a-enter-ar-button {\n background-size: 100% 90%;\n border-radius: 7px;\n}\n\n.a-enter-ar-button:active,\n.a-enter-ar-button:hover,\n.a-enter-vr-button:active,\n.a-enter-vr-button:hover {\n background-color: #ef2d5e;\n}\n\n.a-enter-vr-button.resethover {\n background-color: rgba(0, 0, 0, 0.35);\n}\n\n.a-enter-vr-modal {\n background-color: #666;\n border-radius: 0;\n display: none;\n min-height: 32px;\n margin-right: 70px;\n padding: 9px;\n width: 280px;\n right: 2%;\n position: absolute;\n}\n\n.a-enter-vr-modal:after {\n border-bottom: 10px solid transparent;\n border-left: 10px solid #666;\n border-top: 10px solid transparent;\n display: inline-block;\n content: '';\n position: absolute;\n right: -5px;\n top: 5px;\n width: 0;\n height: 0;\n}\n\n.a-enter-vr-modal p,\n.a-enter-vr-modal a {\n display: inline;\n}\n\n.a-enter-vr-modal p {\n margin: 0;\n}\n\n.a-enter-vr-modal p:after {\n content: ' ';\n}\n\n.a-orientation-modal {\n background: rgba(244, 244, 244, 1) url(${v}) center no-repeat;\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-orientation-modal:after {\n color: #666;\n content: "Insert phone into Cardboard holder.";\n display: block;\n position: absolute;\n text-align: center;\n top: 70%;\n transform: translateY(-70%);\n width: 100%;\n}\n\n.a-orientation-modal button {\n background: url(${y}) no-repeat;\n border: none;\n height: 50px;\n text-indent: -9999px;\n width: 50px;\n}\n\n.a-loader-title {\n background-color: rgba(0, 0, 0, 0.6);\n font-family: sans-serif, monospace;\n text-align: center;\n font-size: 20px;\n height: 50px;\n font-weight: 300;\n line-height: 50px;\n position: absolute;\n right: 0px;\n left: 0px;\n top: 0px;\n color: white;\n}\n\n.a-modal {\n position: absolute;\n background: rgba(0, 0, 0, 0.60);\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-dialog {\n position: relative;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n z-index: 199995;\n width: 300px;\n height: 200px;\n background-size: contain;\n background-color: white;\n font-family: sans-serif, monospace;\n font-size: 20px;\n border-radius: 3px;\n padding: 6px;\n}\n\n.a-dialog-text-container {\n width: 100%;\n height: 70%;\n align-self: flex-start;\n display: flex;\n justify-content: center;\n align-content: center;\n flex-direction: column;\n}\n\n.a-dialog-text {\n display: inline-block;\n font-weight: normal;\n font-size: 14pt;\n margin: 8px;\n}\n\n.a-dialog-buttons-container {\n display: inline-flex;\n align-self: flex-end;\n width: 100%;\n height: 30%;\n}\n\n.a-dialog-button {\n cursor: pointer;\n align-self: center;\n opacity: 0.9;\n height: 80%;\n width: 50%;\n font-size: 12pt;\n margin: 4px;\n border-radius: 2px;\n text-align:center;\n border: none;\n display: inline-block;\n -webkit-transition: all 0.25s ease-in-out;\n transition: all 0.25s ease-in-out;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.20);\n user-select: none;\n}\n\n.a-dialog-permission-button:hover {\n box-shadow: 0 7px 14px rgba(0,0,0,0.20), 0 2px 2px rgba(0,0,0,0.20);\n}\n\n.a-dialog-allow-button {\n background-color: #00ceff;\n}\n\n.a-dialog-deny-button {\n background-color: #ff005b;\n}\n\n.a-dialog-ok-button {\n background-color: #00ceff;\n width: 100%;\n}\n\n.a-dom-overlay:not(.a-no-style) {\n overflow: hidden;\n position: absolute;\n pointer-events: none;\n box-sizing: border-box;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n padding: 1em;\n}\n\n.a-dom-overlay:not(.a-no-style)>* {\n pointer-events: auto;\n}\n`,"",{version:3,sources:["webpack://./src/style/aframe.css"],names:[],mappings:"AAAA,sCAAsC;AACtC;EACE,SAAS;EACT,OAAO;EACP,eAAe;EACf,QAAQ;EACR,MAAM;AACR;;AAEA;EACE,YAAY;EACZ,SAAS;EACT,gBAAgB;EAChB,UAAU;EACV,WAAW;AACb;;AAEA,oDAAoD;AACpD;EACE,sBAAsB;EACtB,uBAAuB;EACvB,iBAAiB;EACjB,kBAAkB;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,0BAA0B;AAC5B;;AAEA;;EAEE,UAAU;EACV,WAAW;AACb;;AAEA;EACE,WAAW;AACb;;AAEA,gEAAgE;AAChE;EACE,6BAA6B;AAC/B;;AAEA;EACE,wBAAwB;AAC1B;;AAEA;EACE,YAAY;EACZ,OAAO;EACP,kBAAkB;EAClB,MAAM;EACN,WAAW;AACb;;AAEA;EACE,YAAY;EACZ,iBAAiB;EACjB,oBAAoB;AACtB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,yBAAyB;EACzB,eAAe;EACf,SAAS;EACT,QAAQ;EACR,iBAAiB;EACjB,WAAW;EACX,qBAAqB;EACrB,eAAe;EACf,8BAA8B;EAC9B,kBAAkB;EAClB,cAAc;EACd,YAAY;AACd;;AAEA,+BAA+B;AAC/B,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AACrE,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AACrE,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;;AAErE;EACE,sCAAsC;EACtC,8CAA8C;AAChD;;AAEA;EACE,sBAAsB;EACtB,8BAA8B;AAChC;;AAEA;EACE,sBAAsB;EACtB,8BAA8B;AAChC;;AAEA;EACE,cAAc;EACd,kBAAkB;EAClB,YAAY;EACZ,WAAW;AACb;;AAEA;;;;EAIE,aAAa;AACf;;AAEA;;EAEE,0DAA0D;AAC5D;;AAEA;EACE,6BAA6B;EAC7B,cAAc;EACd,qBAAqB;EACrB,6BAA6B;AAC/B;;AAEA;EACE,sBAAsB;EACtB,WAAW;EACX,gBAAgB;EAChB,kBAAkB;EAClB,UAAU;AACZ;;AAEA;;EAEE,kCAAkC;EAClC,eAAe;EACf,WAAW;EACX,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EAClB,WAAW;EACX,YAAY;AACd;;AAEA;EACE,WAAW;AACb;;AAEA;;;EAGE,WAAW;EACX,iBAAiB;EACjB,aAAa;AACf;;AAEA;EACE,yFAA4qB;AAC9qB;;AAEA;EACE,yFAAkzB;AACpzB;;AAEA;EACE,yDAA2qK;AAC7qK;;AAEA;;EAEE,wBAAwB;EACxB,SAAS;EACT,SAAS;EACT,eAAe;EACf,eAAe;EACf,gBAAgB;EAChB,kBAAkB;EAClB;;;;GAIC;EACD,gBAAgB;EAChB,cAAc;EACd,kBAAkB;EAClB,QAAQ;EACR,sCAAsC;EACtC,8CAA8C;EAC9C,aAAa;EACb,kBAAkB;EAClB,0BAA0B,EAAE,8CAA8C;AAC5E;;AAEA;EACE,yBAAyB;EACzB,kBAAkB;AACpB;;AAEA;;;;EAIE,yBAAyB;AAC3B;;AAEA;EACE,qCAAqC;AACvC;;AAEA;EACE,sBAAsB;EACtB,gBAAgB;EAChB,aAAa;EACb,gBAAgB;EAChB,kBAAkB;EAClB,YAAY;EACZ,YAAY;EACZ,SAAS;EACT,kBAAkB;AACpB;;AAEA;EACE,qCAAqC;EACrC,4BAA4B;EAC5B,kCAAkC;EAClC,qBAAqB;EACrB,WAAW;EACX,kBAAkB;EAClB,WAAW;EACX,QAAQ;EACR,QAAQ;EACR,SAAS;AACX;;AAEA;;EAEE,eAAe;AACjB;;AAEA;EACE,SAAS;AACX;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,2FAAivF;EACjvF,wBAAwB;EACxB,SAAS;EACT,eAAe;EACf,gBAAgB;EAChB,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,eAAe;EACf,MAAM;EACN,gBAAgB;AAClB;;AAEA;EACE,WAAW;EACX,8CAA8C;EAC9C,cAAc;EACd,kBAAkB;EAClB,kBAAkB;EAClB,QAAQ;EACR,2BAA2B;EAC3B,WAAW;AACb;;AAEA;EACE,6DAA25B;EAC35B,YAAY;EACZ,YAAY;EACZ,oBAAoB;EACpB,WAAW;AACb;;AAEA;EACE,oCAAoC;EACpC,kCAAkC;EAClC,kBAAkB;EAClB,eAAe;EACf,YAAY;EACZ,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EAClB,UAAU;EACV,SAAS;EACT,QAAQ;EACR,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,+BAA+B;EAC/B,wBAAwB;EACxB,SAAS;EACT,eAAe;EACf,gBAAgB;EAChB,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,eAAe;EACf,MAAM;EACN,gBAAgB;AAClB;;AAEA;EACE,kBAAkB;EAClB,SAAS;EACT,QAAQ;EACR,gCAAgC;EAChC,eAAe;EACf,YAAY;EACZ,aAAa;EACb,wBAAwB;EACxB,uBAAuB;EACvB,kCAAkC;EAClC,eAAe;EACf,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,WAAW;EACX,WAAW;EACX,sBAAsB;EACtB,aAAa;EACb,uBAAuB;EACvB,qBAAqB;EACrB,sBAAsB;AACxB;;AAEA;EACE,qBAAqB;EACrB,mBAAmB;EACnB,eAAe;EACf,WAAW;AACb;;AAEA;EACE,oBAAoB;EACpB,oBAAoB;EACpB,WAAW;EACX,WAAW;AACb;;AAEA;EACE,eAAe;EACf,kBAAkB;EAClB,YAAY;EACZ,WAAW;EACX,UAAU;EACV,eAAe;EACf,WAAW;EACX,kBAAkB;EAClB,iBAAiB;EACjB,YAAY;EACZ,qBAAqB;EACrB,yCAAyC;EACzC,iCAAiC;EACjC,wEAAwE;EACxE,iBAAiB;AACnB;;AAEA;EACE,mEAAmE;AACrE;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,yBAAyB;EACzB,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,oBAAoB;EACpB,sBAAsB;EACtB,SAAS;EACT,OAAO;EACP,QAAQ;EACR,MAAM;EACN,YAAY;AACd;;AAEA;EACE,oBAAoB;AACtB",sourcesContent:["/* .a-fullscreen means not embedded. */\nhtml.a-fullscreen {\n bottom: 0;\n left: 0;\n position: fixed;\n right: 0;\n top: 0;\n}\n\nhtml.a-fullscreen body {\n height: 100%;\n margin: 0;\n overflow: hidden;\n padding: 0;\n width: 100%;\n}\n\n/* Class is removed when doing <a-scene embedded>. */\nhtml.a-fullscreen .a-canvas {\n width: 100% !important;\n height: 100% !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n position: fixed !important;\n}\n\nhtml:not(.a-fullscreen) .a-enter-vr,\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 5px;\n bottom: 5px;\n}\n\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 60px;\n}\n\n/* In chrome mobile the user agent stylesheet set it to white */\n:-webkit-full-screen {\n background-color: transparent;\n}\n\n.a-hidden {\n display: none !important;\n}\n\n.a-canvas {\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.a-canvas.a-grab-cursor:hover {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\ncanvas.a-canvas.a-mouse-cursor-hover:hover {\n cursor: pointer;\n}\n\n.a-inspector-loader {\n background-color: #ed3160;\n position: fixed;\n left: 3px;\n top: 3px;\n padding: 6px 10px;\n color: #fff;\n text-decoration: none;\n font-size: 12px;\n font-family: Roboto,sans-serif;\n text-align: center;\n z-index: 99999;\n width: 204px;\n}\n\n/* Inspector loader animation */\n@keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n@-webkit-keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@-webkit-keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@-webkit-keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n\n.a-inspector-loader .dots span {\n animation: dots-1 2s infinite steps(1);\n -webkit-animation: dots-1 2s infinite steps(1);\n}\n\n.a-inspector-loader .dots span:first-child + span {\n animation-name: dots-2;\n -webkit-animation-name: dots-2;\n}\n\n.a-inspector-loader .dots span:first-child + span + span {\n animation-name: dots-3;\n -webkit-animation-name: dots-3;\n}\n\na-scene {\n display: block;\n position: relative;\n height: 100%;\n width: 100%;\n}\n\na-assets,\na-scene video,\na-scene img,\na-scene audio {\n display: none;\n}\n\n.a-enter-vr-modal,\n.a-orientation-modal {\n font-family: Consolas, Andale Mono, Courier New, monospace;\n}\n\n.a-enter-vr-modal a {\n border-bottom: 1px solid #fff;\n padding: 2px 0;\n text-decoration: none;\n transition: .1s color ease-in;\n}\n\n.a-enter-vr-modal a:hover {\n background-color: #fff;\n color: #111;\n padding: 2px 4px;\n position: relative;\n left: -4px;\n}\n\n.a-enter-vr,\n.a-enter-ar {\n font-family: sans-serif, monospace;\n font-size: 13px;\n width: 100%;\n font-weight: 200;\n line-height: 16px;\n position: absolute;\n right: 20px;\n bottom: 20px;\n}\n\n.a-enter-ar.xr {\n right: 90px;\n}\n\n.a-enter-vr-button,\n.a-enter-vr-modal,\n.a-enter-vr-modal a {\n color: #fff;\n user-select: none;\n outline: none;\n}\n\n.a-enter-vr-button {\n background: rgba(0, 0, 0, 0.35) url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-vrmode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M68.81,21.56H64.23v8.27h4.58a4.13,4.13,0,0,0,3.1-1.09,4.2,4.2,0,0,0,1-3,4.24,4.24,0,0,0-1-3A4.05,4.05,0,0,0,68.81,21.56Z' fill='%23fff'/%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0ZM41.9,46H34L24,16h8l6,21.84,6-21.84H52Zm39.29,0H73.44L68.15,35.39H64.23V46H57V16H68.81q5.32,0,8.34,2.37a8,8,0,0,1,3,6.69,9.68,9.68,0,0,1-1.27,5.18,8.9,8.9,0,0,1-4,3.34l6.26,12.11Z' fill='%23fff'/%3E%3C/svg%3E\") 50% 50% no-repeat;\n}\n\n.a-enter-ar-button {\n background: rgba(0, 0, 0, 0.20) url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0Zm8,50a8,8,0,0,1-8,8H12a8,8,0,0,1-8-8V12a8,8,0,0,1,8-8H96a8,8,0,0,1,8,8Z' fill='%23fff'/%3E%3Cpath d='M43.35,39.82H32.51L30.45,46H23.88L35,16h5.73L52,46H45.43Zm-9.17-5h7.5L37.91,23.58Z' fill='%23fff'/%3E%3Cpath d='M68.11,35H63.18V46H57V16H68.15q5.31,0,8.2,2.37a8.18,8.18,0,0,1,2.88,6.7,9.22,9.22,0,0,1-1.33,5.12,9.09,9.09,0,0,1-4,3.26l6.49,12.26V46H73.73Zm-4.93-5h5a5.09,5.09,0,0,0,3.6-1.18,4.21,4.21,0,0,0,1.28-3.27,4.56,4.56,0,0,0-1.2-3.34A5,5,0,0,0,68.15,21h-5Z' fill='%23fff'/%3E%3C/svg%3E\") 50% 50% no-repeat;\n}\n\n.a-enter-vr.fullscreen .a-enter-vr-button {\n background-image: url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8' standalone='no'%3F%3E%3Csvg width='108' height='62' viewBox='0 0 108 62' version='1.1' id='svg320' sodipodi:docname='fullscreen-aframe.svg' xml:space='preserve' inkscape:version='1.2.1 (9c6d41e 2022-07-14)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3E%3Cdefs id='defs324' /%3E%3Csodipodi:namedview id='namedview322' pagecolor='%23ffffff' bordercolor='%23000000' borderopacity='0.25' inkscape:showpageshadow='2' inkscape:pageopacity='0.0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23d1d1d1' showgrid='false' inkscape:zoom='3.8064516' inkscape:cx='91.423729' inkscape:cy='-1.4449153' inkscape:window-width='1440' inkscape:window-height='847' inkscape:window-x='32' inkscape:window-y='25' inkscape:window-maximized='0' inkscape:current-layer='svg320' /%3E%3Ctitle id='title312'%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M96 0H12A12 12 0 0 0 0 12V50A12 12 0 0 0 12 62H96a12 12 0 0 0 12-12V12A12 12 0 0 0 96 0Zm8 50a8 8 0 0 1-8 8H12a8 8 0 0 1-8-8V12a8 8 0 0 1 8-8H96a8 8 0 0 1 8 8Z' fill='%23fff' id='path314' style='fill:%23ffffff' /%3E%3Cg id='g356' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g358' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g360' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g362' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g364' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g366' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g368' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g370' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g372' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g374' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g376' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g378' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g380' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g382' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g384' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cmetadata id='metadata561'%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=''%3E%3Cdc:title%3Eaframe-armode-noborder-reduced-tracking%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cpath d='m 98.168511 40.083649 c 0 -1.303681 -0.998788 -2.358041 -2.239389 -2.358041 -1.230088 0.0031 -2.240892 1.05436 -2.240892 2.358041 v 4.881296 l -9.041661 -9.041662 c -0.874129 -0.875631 -2.288954 -0.875631 -3.16308 0 -0.874129 0.874126 -0.874129 2.293459 0 3.167585 l 8.995101 8.992101 h -4.858767 c -1.323206 0.0031 -2.389583 1.004796 -2.389583 2.239386 0 1.237598 1.066377 2.237888 2.389583 2.237888 h 10.154599 c 1.323206 0 2.388082 -0.998789 2.392587 -2.237888 -0.0044 -0.03305 -0.009 -0.05858 -0.0134 -0.09161 0.0046 -0.04207 0.0134 -0.08712 0.0134 -0.13066 V 40.085172 h -1.52e-4' id='path596' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 23.091002 35.921781 -9.026643 9.041662 v -4.881296 c 0 -1.303681 -1.009302 -2.355037 -2.242393 -2.358041 -1.237598 0 -2.237888 1.05436 -2.237888 2.358041 l -0.0031 10.016421 c 0 0.04356 0.01211 0.08862 0.0015 0.130659 -0.0031 0.03153 -0.009 0.05709 -0.01211 0.09161 0.0031 1.239099 1.069379 2.237888 2.391085 2.237888 h 10.156101 c 1.320202 0 2.388079 -1.000291 2.388079 -2.237888 0 -1.234591 -1.067877 -2.236383 -2.388079 -2.239387 h -4.858767 l 8.995101 -8.9921 c 0.871126 -0.874127 0.871126 -2.293459 0 -3.167586 -0.875628 -0.877132 -2.291957 -0.877132 -3.169087 -1.52e-4' id='path598' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 84.649572 25.978033 9.041662 -9.041664 v 4.881298 c 0 1.299176 1.010806 2.350532 2.240891 2.355037 1.240601 0 2.23939 -1.055861 2.23939 -2.355037 V 11.798242 c 0 -0.04356 -0.009 -0.08862 -0.0134 -0.127671 0.0044 -0.03153 0.009 -0.06157 0.0134 -0.09313 -0.0044 -1.240598 -1.069379 -2.2393873 -2.391085 -2.2393873 h -10.1546 c -1.323205 0 -2.38958 0.9987893 -2.38958 2.2393873 0 1.233091 1.066375 2.237887 2.38958 2.240891 h 4.858768 l -8.995102 8.9921 c -0.874129 0.872625 -0.874129 2.288954 0 3.161578 0.874127 0.880137 2.288951 0.880137 3.16308 1.5e-4' id='path600' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 17.264988 13.822853 h 4.857265 c 1.320202 -0.0031 2.388079 -1.0078 2.388079 -2.240889 0 -1.240601 -1.067877 -2.2393893 -2.388079 -2.2393893 H 11.967654 c -1.321707 0 -2.388082 0.9987883 -2.391085 2.2393893 0.0031 0.03153 0.009 0.06157 0.01211 0.09313 -0.0031 0.03905 -0.0015 0.08262 -0.0015 0.127671 l 0.0031 10.020926 c 0 1.299176 1.00029 2.355038 2.237887 2.355038 1.233092 -0.0044 2.242393 -1.055862 2.242393 -2.355038 v -4.881295 l 9.026644 9.041661 c 0.877132 0.878635 2.293459 0.878635 3.169087 0 0.871125 -0.872624 0.871125 -2.288953 0 -3.161577 l -8.995282 -8.993616' id='path602' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3C/svg%3E\");\n}\n\n.a-enter-vr-button,\n.a-enter-ar-button {\n background-size: 90% 90%;\n border: 0;\n bottom: 0;\n cursor: pointer;\n min-width: 58px;\n min-height: 34px;\n /* 1.74418604651 */\n /*\n In order to keep the aspect ratio when resizing\n padding-top percentages are relative to the containing block's width.\n http://stackoverflow.com/questions/12121090/responsively-change-div-size-keeping-aspect-ratio\n */\n padding-right: 0;\n padding-top: 0;\n position: absolute;\n right: 0;\n transition: background-color .05s ease;\n -webkit-transition: background-color .05s ease;\n z-index: 9999;\n border-radius: 8px;\n touch-action: manipulation; /* Prevent iOS double tap zoom on the button */\n}\n\n.a-enter-ar-button {\n background-size: 100% 90%;\n border-radius: 7px;\n}\n\n.a-enter-ar-button:active,\n.a-enter-ar-button:hover,\n.a-enter-vr-button:active,\n.a-enter-vr-button:hover {\n background-color: #ef2d5e;\n}\n\n.a-enter-vr-button.resethover {\n background-color: rgba(0, 0, 0, 0.35);\n}\n\n.a-enter-vr-modal {\n background-color: #666;\n border-radius: 0;\n display: none;\n min-height: 32px;\n margin-right: 70px;\n padding: 9px;\n width: 280px;\n right: 2%;\n position: absolute;\n}\n\n.a-enter-vr-modal:after {\n border-bottom: 10px solid transparent;\n border-left: 10px solid #666;\n border-top: 10px solid transparent;\n display: inline-block;\n content: '';\n position: absolute;\n right: -5px;\n top: 5px;\n width: 0;\n height: 0;\n}\n\n.a-enter-vr-modal p,\n.a-enter-vr-modal a {\n display: inline;\n}\n\n.a-enter-vr-modal p {\n margin: 0;\n}\n\n.a-enter-vr-modal p:after {\n content: ' ';\n}\n\n.a-orientation-modal {\n background: rgba(244, 244, 244, 1) url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E) center no-repeat;\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-orientation-modal:after {\n color: #666;\n content: \"Insert phone into Cardboard holder.\";\n display: block;\n position: absolute;\n text-align: center;\n top: 70%;\n transform: translateY(-70%);\n width: 100%;\n}\n\n.a-orientation-modal button {\n background: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E) no-repeat;\n border: none;\n height: 50px;\n text-indent: -9999px;\n width: 50px;\n}\n\n.a-loader-title {\n background-color: rgba(0, 0, 0, 0.6);\n font-family: sans-serif, monospace;\n text-align: center;\n font-size: 20px;\n height: 50px;\n font-weight: 300;\n line-height: 50px;\n position: absolute;\n right: 0px;\n left: 0px;\n top: 0px;\n color: white;\n}\n\n.a-modal {\n position: absolute;\n background: rgba(0, 0, 0, 0.60);\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-dialog {\n position: relative;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n z-index: 199995;\n width: 300px;\n height: 200px;\n background-size: contain;\n background-color: white;\n font-family: sans-serif, monospace;\n font-size: 20px;\n border-radius: 3px;\n padding: 6px;\n}\n\n.a-dialog-text-container {\n width: 100%;\n height: 70%;\n align-self: flex-start;\n display: flex;\n justify-content: center;\n align-content: center;\n flex-direction: column;\n}\n\n.a-dialog-text {\n display: inline-block;\n font-weight: normal;\n font-size: 14pt;\n margin: 8px;\n}\n\n.a-dialog-buttons-container {\n display: inline-flex;\n align-self: flex-end;\n width: 100%;\n height: 30%;\n}\n\n.a-dialog-button {\n cursor: pointer;\n align-self: center;\n opacity: 0.9;\n height: 80%;\n width: 50%;\n font-size: 12pt;\n margin: 4px;\n border-radius: 2px;\n text-align:center;\n border: none;\n display: inline-block;\n -webkit-transition: all 0.25s ease-in-out;\n transition: all 0.25s ease-in-out;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.20);\n user-select: none;\n}\n\n.a-dialog-permission-button:hover {\n box-shadow: 0 7px 14px rgba(0,0,0,0.20), 0 2px 2px rgba(0,0,0,0.20);\n}\n\n.a-dialog-allow-button {\n background-color: #00ceff;\n}\n\n.a-dialog-deny-button {\n background-color: #ff005b;\n}\n\n.a-dialog-ok-button {\n background-color: #00ceff;\n width: 100%;\n}\n\n.a-dom-overlay:not(.a-no-style) {\n overflow: hidden;\n position: absolute;\n pointer-events: none;\n box-sizing: border-box;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n padding: 1em;\n}\n\n.a-dom-overlay:not(.a-no-style)>* {\n pointer-events: auto;\n}\n"],sourceRoot:""}]);const E=A},2470:(t,e,n)=>{"use strict";n.d(e,{A:()=>a});var i=n(963),r=n.n(i),s=n(9089),o=n.n(s)()(r());o.push([t.id,".rs-base {\n background-color: #333;\n color: #fafafa;\n border-radius: 0;\n font: 10px monospace;\n left: 5px;\n line-height: 1em;\n opacity: 0.85;\n overflow: hidden;\n padding: 10px;\n position: fixed;\n top: 5px;\n width: 300px;\n z-index: 10000;\n}\n\n.rs-base div.hidden {\n display: none;\n}\n\n.rs-base h1 {\n color: #fff;\n cursor: pointer;\n font-size: 1.4em;\n font-weight: 300;\n margin: 0 0 5px;\n padding: 0;\n}\n\n.rs-group {\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n -webkit-flex-direction: column-reverse;\n flex-direction: column-reverse;\n margin-bottom: 5px;\n}\n\n.rs-group:last-child {\n margin-bottom: 0;\n}\n\n.rs-counter-base {\n align-items: center;\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n height: 10px;\n -webkit-justify-content: space-between;\n justify-content: space-between;\n margin: 2px 0;\n}\n\n.rs-counter-base.alarm {\n color: #b70000;\n text-shadow: 0 0 0 #b70000,\n 0 0 1px #fff,\n 0 0 1px #fff,\n 0 0 2px #fff,\n 0 0 2px #fff,\n 0 0 3px #fff,\n 0 0 3px #fff,\n 0 0 4px #fff,\n 0 0 4px #fff;\n}\n\n.rs-counter-id {\n font-weight: 300;\n -webkit-box-ordinal-group: 0;\n -webkit-order: 0;\n order: 0;\n width: 54px;\n}\n\n.rs-counter-value {\n font-weight: 300;\n -webkit-box-ordinal-group: 1;\n -webkit-order: 1;\n order: 1;\n text-align: right;\n width: 35px;\n}\n\n.rs-canvas {\n -webkit-box-ordinal-group: 2;\n -webkit-order: 2;\n order: 2;\n}\n\n@media (min-width: 480px) {\n .rs-base {\n left: 20px;\n top: 20px;\n }\n}\n","",{version:3,sources:["webpack://./src/style/rStats.css"],names:[],mappings:"AAAA;EACE,sBAAsB;EACtB,cAAc;EACd,gBAAgB;EAChB,oBAAoB;EACpB,SAAS;EACT,gBAAgB;EAChB,aAAa;EACb,gBAAgB;EAChB,aAAa;EACb,eAAe;EACf,QAAQ;EACR,YAAY;EACZ,cAAc;AAChB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,WAAW;EACX,eAAe;EACf,gBAAgB;EAChB,gBAAgB;EAChB,eAAe;EACf,UAAU;AACZ;;AAEA;EACE,oBAAoB;EACpB,qBAAqB;EACrB,aAAa;EACb,sCAAsC;EACtC,8BAA8B;EAC9B,kBAAkB;AACpB;;AAEA;EACE,gBAAgB;AAClB;;AAEA;EACE,mBAAmB;EACnB,oBAAoB;EACpB,qBAAqB;EACrB,aAAa;EACb,YAAY;EACZ,sCAAsC;EACtC,8BAA8B;EAC9B,aAAa;AACf;;AAEA;EACE,cAAc;EACd;;;;;;;;2BAQyB;AAC3B;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;EACR,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;EACR,iBAAiB;EACjB,WAAW;AACb;;AAEA;EACE,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;AACV;;AAEA;EACE;IACE,UAAU;IACV,SAAS;EACX;AACF",sourcesContent:[".rs-base {\n background-color: #333;\n color: #fafafa;\n border-radius: 0;\n font: 10px monospace;\n left: 5px;\n line-height: 1em;\n opacity: 0.85;\n overflow: hidden;\n padding: 10px;\n position: fixed;\n top: 5px;\n width: 300px;\n z-index: 10000;\n}\n\n.rs-base div.hidden {\n display: none;\n}\n\n.rs-base h1 {\n color: #fff;\n cursor: pointer;\n font-size: 1.4em;\n font-weight: 300;\n margin: 0 0 5px;\n padding: 0;\n}\n\n.rs-group {\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n -webkit-flex-direction: column-reverse;\n flex-direction: column-reverse;\n margin-bottom: 5px;\n}\n\n.rs-group:last-child {\n margin-bottom: 0;\n}\n\n.rs-counter-base {\n align-items: center;\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n height: 10px;\n -webkit-justify-content: space-between;\n justify-content: space-between;\n margin: 2px 0;\n}\n\n.rs-counter-base.alarm {\n color: #b70000;\n text-shadow: 0 0 0 #b70000,\n 0 0 1px #fff,\n 0 0 1px #fff,\n 0 0 2px #fff,\n 0 0 2px #fff,\n 0 0 3px #fff,\n 0 0 3px #fff,\n 0 0 4px #fff,\n 0 0 4px #fff;\n}\n\n.rs-counter-id {\n font-weight: 300;\n -webkit-box-ordinal-group: 0;\n -webkit-order: 0;\n order: 0;\n width: 54px;\n}\n\n.rs-counter-value {\n font-weight: 300;\n -webkit-box-ordinal-group: 1;\n -webkit-order: 1;\n order: 1;\n text-align: right;\n width: 35px;\n}\n\n.rs-canvas {\n -webkit-box-ordinal-group: 2;\n -webkit-order: 2;\n order: 2;\n}\n\n@media (min-width: 480px) {\n .rs-base {\n left: 20px;\n top: 20px;\n }\n}\n"],sourceRoot:""}]);const a=o},7180:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>g});var i=n(5072),r=n.n(i),s=n(7825),o=n.n(s),a=n(7659),l=n.n(a),c=n(5056),h=n.n(c),u=n(540),d=n.n(u),p=n(1113),A=n.n(p),f=n(8217),m={};m.styleTagTransform=A(),m.setAttributes=h(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=d(),r()(f.A,m);const g=f.A&&f.A.locals?f.A.locals:void 0},9379:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>g});var i=n(5072),r=n.n(i),s=n(7825),o=n.n(s),a=n(7659),l=n.n(a),c=n(5056),h=n.n(c),u=n(540),d=n.n(u),p=n(1113),A=n.n(p),f=n(2470),m={};m.styleTagTransform=A(),m.setAttributes=h(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=d(),r()(f.A,m);const g=f.A&&f.A.locals?f.A.locals:void 0},5072:t=>{"use strict";var e=[];function n(t){for(var n=-1,i=0;i<e.length;i++)if(e[i].identifier===t){n=i;break}return n}function i(t,i){for(var s={},o=[],a=0;a<t.length;a++){var l=t[a],c=i.base?l[0]+i.base:l[0],h=s[c]||0,u="".concat(c," ").concat(h);s[c]=h+1;var d=n(u),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==d)e[d].references++,e[d].updater(p);else{var A=r(p,i);i.byIndex=a,e.splice(a,0,{identifier:u,updater:A,references:1})}o.push(u)}return o}function r(t,e){var n=e.domAPI(e);return n.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;n.update(t=e)}else n.remove()}}t.exports=function(t,r){var s=i(t=t||[],r=r||{});return function(t){t=t||[];for(var o=0;o<s.length;o++){var a=n(s[o]);e[a].references--}for(var l=i(t,r),c=0;c<s.length;c++){var h=n(s[c]);0===e[h].references&&(e[h].updater(),e.splice(h,1))}s=l}}},7659:t=>{"use strict";var e={};t.exports=function(t,n){var i=function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}e[t]=n}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},5056:(t,e,n)=>{"use strict";t.exports=function(t){var e=n.nc;e&&t.setAttribute("nonce",e)}},7825:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(n){!function(t,e,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,n)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},1113:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},3931:t=>{"use strict";t.exports="data:image/svg+xml,%3C%3Fxml version=%271.0%27 encoding=%27UTF-8%27 standalone=%27no%27%3F%3E%3Csvg width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27 version=%271.1%27 id=%27svg320%27 sodipodi:docname=%27fullscreen-aframe.svg%27 xml:space=%27preserve%27 inkscape:version=%271.2.1 %289c6d41e 2022-07-14%29%27 xmlns:inkscape=%27http://www.inkscape.org/namespaces/inkscape%27 xmlns:sodipodi=%27http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd%27 xmlns=%27http://www.w3.org/2000/svg%27 xmlns:svg=%27http://www.w3.org/2000/svg%27 xmlns:rdf=%27http://www.w3.org/1999/02/22-rdf-syntax-ns%23%27 xmlns:cc=%27http://creativecommons.org/ns%23%27 xmlns:dc=%27http://purl.org/dc/elements/1.1/%27%3E%3Cdefs id=%27defs324%27 /%3E%3Csodipodi:namedview id=%27namedview322%27 pagecolor=%27%23ffffff%27 bordercolor=%27%23000000%27 borderopacity=%270.25%27 inkscape:showpageshadow=%272%27 inkscape:pageopacity=%270.0%27 inkscape:pagecheckerboard=%270%27 inkscape:deskcolor=%27%23d1d1d1%27 showgrid=%27false%27 inkscape:zoom=%273.8064516%27 inkscape:cx=%2791.423729%27 inkscape:cy=%27-1.4449153%27 inkscape:window-width=%271440%27 inkscape:window-height=%27847%27 inkscape:window-x=%2732%27 inkscape:window-y=%2725%27 inkscape:window-maximized=%270%27 inkscape:current-layer=%27svg320%27 /%3E%3Ctitle id=%27title312%27%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M96 0H12A12 12 0 0 0 0 12V50A12 12 0 0 0 12 62H96a12 12 0 0 0 12-12V12A12 12 0 0 0 96 0Zm8 50a8 8 0 0 1-8 8H12a8 8 0 0 1-8-8V12a8 8 0 0 1 8-8H96a8 8 0 0 1 8 8Z%27 fill=%27%23fff%27 id=%27path314%27 style=%27fill:%23ffffff%27 /%3E%3Cg id=%27g356%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g358%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g360%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g362%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g364%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g366%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g368%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g370%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g372%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g374%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g376%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g378%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g380%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g382%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g384%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cmetadata id=%27metadata561%27%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=%27%27%3E%3Cdc:title%3Eaframe-armode-noborder-reduced-tracking%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cpath d=%27m 98.168511 40.083649 c 0 -1.303681 -0.998788 -2.358041 -2.239389 -2.358041 -1.230088 0.0031 -2.240892 1.05436 -2.240892 2.358041 v 4.881296 l -9.041661 -9.041662 c -0.874129 -0.875631 -2.288954 -0.875631 -3.16308 0 -0.874129 0.874126 -0.874129 2.293459 0 3.167585 l 8.995101 8.992101 h -4.858767 c -1.323206 0.0031 -2.389583 1.004796 -2.389583 2.239386 0 1.237598 1.066377 2.237888 2.389583 2.237888 h 10.154599 c 1.323206 0 2.388082 -0.998789 2.392587 -2.237888 -0.0044 -0.03305 -0.009 -0.05858 -0.0134 -0.09161 0.0046 -0.04207 0.0134 -0.08712 0.0134 -0.13066 V 40.085172 h -1.52e-4%27 id=%27path596%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 23.091002 35.921781 -9.026643 9.041662 v -4.881296 c 0 -1.303681 -1.009302 -2.355037 -2.242393 -2.358041 -1.237598 0 -2.237888 1.05436 -2.237888 2.358041 l -0.0031 10.016421 c 0 0.04356 0.01211 0.08862 0.0015 0.130659 -0.0031 0.03153 -0.009 0.05709 -0.01211 0.09161 0.0031 1.239099 1.069379 2.237888 2.391085 2.237888 h 10.156101 c 1.320202 0 2.388079 -1.000291 2.388079 -2.237888 0 -1.234591 -1.067877 -2.236383 -2.388079 -2.239387 h -4.858767 l 8.995101 -8.9921 c 0.871126 -0.874127 0.871126 -2.293459 0 -3.167586 -0.875628 -0.877132 -2.291957 -0.877132 -3.169087 -1.52e-4%27 id=%27path598%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 84.649572 25.978033 9.041662 -9.041664 v 4.881298 c 0 1.299176 1.010806 2.350532 2.240891 2.355037 1.240601 0 2.23939 -1.055861 2.23939 -2.355037 V 11.798242 c 0 -0.04356 -0.009 -0.08862 -0.0134 -0.127671 0.0044 -0.03153 0.009 -0.06157 0.0134 -0.09313 -0.0044 -1.240598 -1.069379 -2.2393873 -2.391085 -2.2393873 h -10.1546 c -1.323205 0 -2.38958 0.9987893 -2.38958 2.2393873 0 1.233091 1.066375 2.237887 2.38958 2.240891 h 4.858768 l -8.995102 8.9921 c -0.874129 0.872625 -0.874129 2.288954 0 3.161578 0.874127 0.880137 2.288951 0.880137 3.16308 1.5e-4%27 id=%27path600%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 17.264988 13.822853 h 4.857265 c 1.320202 -0.0031 2.388079 -1.0078 2.388079 -2.240889 0 -1.240601 -1.067877 -2.2393893 -2.388079 -2.2393893 H 11.967654 c -1.321707 0 -2.388082 0.9987883 -2.391085 2.2393893 0.0031 0.03153 0.009 0.06157 0.01211 0.09313 -0.0031 0.03905 -0.0015 0.08262 -0.0015 0.127671 l 0.0031 10.020926 c 0 1.299176 1.00029 2.355038 2.237887 2.355038 1.233092 -0.0044 2.242393 -1.055862 2.242393 -2.355038 v -4.881295 l 9.026644 9.041661 c 0.877132 0.878635 2.293459 0.878635 3.169087 0 0.871125 -0.872624 0.871125 -2.288953 0 -3.161577 l -8.995282 -8.993616%27 id=%27path602%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3C/svg%3E"},6085:t=>{"use strict";t.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27%3E%3Ctitle%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0Zm8,50a8,8,0,0,1-8,8H12a8,8,0,0,1-8-8V12a8,8,0,0,1,8-8H96a8,8,0,0,1,8,8Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M43.35,39.82H32.51L30.45,46H23.88L35,16h5.73L52,46H45.43Zm-9.17-5h7.5L37.91,23.58Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M68.11,35H63.18V46H57V16H68.15q5.31,0,8.2,2.37a8.18,8.18,0,0,1,2.88,6.7,9.22,9.22,0,0,1-1.33,5.12,9.09,9.09,0,0,1-4,3.26l6.49,12.26V46H73.73Zm-4.93-5h5a5.09,5.09,0,0,0,3.6-1.18,4.21,4.21,0,0,0,1.28-3.27,4.56,4.56,0,0,0-1.2-3.34A5,5,0,0,0,68.15,21h-5Z%27 fill=%27%23fff%27/%3E%3C/svg%3E"},9169:t=>{"use strict";t.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27%3E%3Ctitle%3Eaframe-vrmode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M68.81,21.56H64.23v8.27h4.58a4.13,4.13,0,0,0,3.1-1.09,4.2,4.2,0,0,0,1-3,4.24,4.24,0,0,0-1-3A4.05,4.05,0,0,0,68.81,21.56Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0ZM41.9,46H34L24,16h8l6,21.84,6-21.84H52Zm39.29,0H73.44L68.15,35.39H64.23V46H57V16H68.81q5.32,0,8.34,2.37a8,8,0,0,1,3,6.69,9.68,9.68,0,0,1-1.27,5.18,8.9,8.9,0,0,1-4,3.34l6.26,12.11Z%27 fill=%27%23fff%27/%3E%3C/svg%3E"},6517:t=>{"use strict";t.exports="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E"},7889:t=>{"use strict";t.exports="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E"}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var s=e[i]={id:i,exports:{}};return t[i](s,s.exports,n),s.exports}n.m=t,n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.b=document.baseURI||self.location.href,n.nc=void 0;var i={};return(()=>{"use strict";n.d(i,{default:()=>sS});var t={};n.r(t),n.d(t,{ACESFilmicToneMapping:()=>De,AddEquation:()=>Zt,AddOperation:()=>Ie,AdditiveAnimationBlendMode:()=>vi,AdditiveBlending:()=>Xt,AgXToneMapping:()=>Ue,AlphaFormat:()=>gn,AlwaysCompare:()=>nr,AlwaysDepth:()=>ye,AlwaysStencilFunc:()=>Xi,AmbientLight:()=>ld,AnimationAction:()=>Zd,AnimationClip:()=>Ru,AnimationLoader:()=>Qu,AnimationMixer:()=>tp,AnimationObjectGroup:()=>Kd,AnimationUtils:()=>vu,ArcCurve:()=>Pc,ArrayCamera:()=>Id,ArrowHelper:()=>Yp,AttachedBindMode:()=>Fe,Audio:()=>Od,AudioAnalyser:()=>zd,AudioContext:()=>bd,AudioListener:()=>Ud,AudioLoader:()=>Cd,AxesHelper:()=>Jp,BackSide:()=>Vt,BasicDepthPacking:()=>bi,BasicShadowMap:()=>Nt,BatchedMesh:()=>nc,Bone:()=>vl,BooleanKeyframeTrack:()=>wu,Box2:()=>mp,Box3:()=>cs,Box3Helper:()=>Vp,BoxGeometry:()=>ya,BoxHelper:()=>Hp,BufferAttribute:()=>zo,BufferGeometry:()=>sa,BufferGeometryLoader:()=>fd,ByteType:()=>on,Cache:()=>Du,Camera:()=>_a,CameraHelper:()=>Qp,CanvasTexture:()=>Tc,CapsuleGeometry:()=>eh,CatmullRomCurve3:()=>Qc,CineonToneMapping:()=>Le,CircleGeometry:()=>nh,ClampToEdgeWrapping:()=>We,Clock:()=>Bd,Color:()=>Bo,ColorKeyframeTrack:()=>_u,ColorManagement:()=>zr,CompressedArrayTexture:()=>Ic,CompressedCubeTexture:()=>Bc,CompressedTexture:()=>Sc,CompressedTextureLoader:()=>Gu,ConeGeometry:()=>rh,ConstantAlphaFactor:()=>me,ConstantColorFactor:()=>Ae,Controls:()=>Zp,CubeCamera:()=>Ra,CubeReflectionMapping:()=>Qe,CubeRefractionMapping:()=>Ge,CubeTexture:()=>La,CubeTextureLoader:()=>Hu,CubeUVReflectionMapping:()=>Ve,CubicBezierCurve:()=>Vc,CubicBezierCurve3:()=>jc,CubicInterpolant:()=>Eu,CullFaceBack:()=>Ot,CullFaceFront:()=>Ft,CullFaceFrontBack:()=>kt,CullFaceNone:()=>Ut,Curve:()=>Lc,CurvePath:()=>Zc,CustomBlending:()=>Kt,CustomToneMapping:()=>Pe,CylinderGeometry:()=>ih,Cylindrical:()=>pp,Data3DTexture:()=>is,DataArrayTexture:()=>es,DataTexture:()=>yl,DataTextureLoader:()=>Vu,DataUtils:()=>ko,DecrementStencilOp:()=>Fi,DecrementWrapStencilOp:()=>Ni,DefaultLoadingManager:()=>Uu,DepthFormat:()=>bn,DepthStencilFormat:()=>Cn,DepthTexture:()=>Rc,DetachedBindMode:()=>ke,DirectionalLight:()=>ad,DirectionalLightHelper:()=>Fp,DiscreteInterpolant:()=>bu,DodecahedronGeometry:()=>oh,DoubleSide:()=>jt,DstAlphaFactor:()=>ce,DstColorFactor:()=>ue,DynamicCopyUsage:()=>hr,DynamicDrawUsage:()=>rr,DynamicReadUsage:()=>ar,EdgesGeometry:()=>uh,EllipseCurve:()=>Dc,EqualCompare:()=>Ki,EqualDepth:()=>be,EqualStencilFunc:()=>Hi,EquirectangularReflectionMapping:()=>ze,EquirectangularRefractionMapping:()=>He,Euler:()=>Ws,EventDispatcher:()=>gr,ExtrudeGeometry:()=>Qh,FileLoader:()=>Nu,Float16BufferAttribute:()=>Jo,Float32BufferAttribute:()=>Ko,FloatType:()=>un,Fog:()=>ka,FogExp2:()=>Fa,FramebufferTexture:()=>Mc,FrontSide:()=>Ht,Frustum:()=>kl,GLBufferAttribute:()=>ap,GLSL1:()=>dr,GLSL3:()=>pr,GreaterCompare:()=>$i,GreaterDepth:()=>we,GreaterEqualCompare:()=>er,GreaterEqualDepth:()=>Ce,GreaterEqualStencilFunc:()=>qi,GreaterStencilFunc:()=>ji,GridHelper:()=>Lp,Group:()=>Pa,HalfFloatType:()=>dn,HemisphereLight:()=>qu,HemisphereLightHelper:()=>Rp,IcosahedronGeometry:()=>zh,ImageBitmapLoader:()=>Ed,ImageLoader:()=>zu,ImageUtils:()=>Wr,IncrementStencilOp:()=>Oi,IncrementWrapStencilOp:()=>ki,InstancedBufferAttribute:()=>Cl,InstancedBufferGeometry:()=>Ad,InstancedInterleavedBuffer:()=>op,InstancedMesh:()=>Rl,Int16BufferAttribute:()=>Wo,Int32BufferAttribute:()=>Xo,Int8BufferAttribute:()=>Ho,IntType:()=>cn,InterleavedBuffer:()=>Qa,InterleavedBufferAttribute:()=>za,Interpolant:()=>yu,InterpolateDiscrete:()=>ui,InterpolateLinear:()=>di,InterpolateSmooth:()=>pi,InvertStencilOp:()=>Qi,KeepStencilOp:()=>Pi,KeyframeTrack:()=>Cu,LOD:()=>al,LatheGeometry:()=>th,Layers:()=>qs,LessCompare:()=>Ji,LessDepth:()=>Ee,LessEqualCompare:()=>Zi,LessEqualDepth:()=>xe,LessEqualStencilFunc:()=>Vi,LessStencilFunc:()=>zi,Light:()=>Wu,LightProbe:()=>ud,Line:()=>uc,Line3:()=>yp,LineBasicMaterial:()=>ic,LineCurve:()=>Wc,LineCurve3:()=>qc,LineDashedMaterial:()=>du,LineLoop:()=>mc,LineSegments:()=>fc,LinearFilter:()=>$e,LinearInterpolant:()=>xu,LinearMipMapLinearFilter:()=>rn,LinearMipMapNearestFilter:()=>en,LinearMipmapLinearFilter:()=>nn,LinearMipmapNearestFilter:()=>tn,LinearSRGBColorSpace:()=>Ti,LinearToneMapping:()=>Te,LinearTransfer:()=>Ri,Loader:()=>Ou,LoaderUtils:()=>pd,LoadingManager:()=>Pu,LoopOnce:()=>li,LoopPingPong:()=>hi,LoopRepeat:()=>ci,LuminanceAlphaFormat:()=>xn,LuminanceFormat:()=>En,MOUSE:()=>Dt,Material:()=>Lo,MaterialLoader:()=>dd,MathUtils:()=>Ir,Matrix2:()=>Ap,Matrix3:()=>Tr,Matrix4:()=>Os,MaxEquation:()=>ne,Mesh:()=>ga,MeshBasicMaterial:()=>Do,MeshDepthMaterial:()=>cu,MeshDistanceMaterial:()=>hu,MeshLambertMaterial:()=>lu,MeshMatcapMaterial:()=>uu,MeshNormalMaterial:()=>au,MeshPhongMaterial:()=>su,MeshPhysicalMaterial:()=>ru,MeshStandardMaterial:()=>iu,MeshToonMaterial:()=>ou,MinEquation:()=>ee,MirroredRepeatWrapping:()=>qe,MixOperation:()=>Se,MultiplyBlending:()=>Jt,MultiplyOperation:()=>Me,NearestFilter:()=>Xe,NearestMipMapLinearFilter:()=>Ze,NearestMipMapNearestFilter:()=>Je,NearestMipmapLinearFilter:()=>Ke,NearestMipmapNearestFilter:()=>Ye,NeutralToneMapping:()=>Oe,NeverCompare:()=>Yi,NeverDepth:()=>ve,NeverStencilFunc:()=>Gi,NoBlending:()=>Wt,NoColorSpace:()=>Ii,NoToneMapping:()=>Be,NormalAnimationBlendMode:()=>gi,NormalBlending:()=>qt,NotEqualCompare:()=>tr,NotEqualDepth:()=>_e,NotEqualStencilFunc:()=>Wi,NumberKeyframeTrack:()=>Mu,Object3D:()=>co,ObjectLoader:()=>md,ObjectSpaceNormalMap:()=>Si,OctahedronGeometry:()=>Hh,OneFactor:()=>re,OneMinusConstantAlphaFactor:()=>ge,OneMinusConstantColorFactor:()=>fe,OneMinusDstAlphaFactor:()=>he,OneMinusDstColorFactor:()=>de,OneMinusSrcAlphaFactor:()=>le,OneMinusSrcColorFactor:()=>oe,OrthographicCamera:()=>sd,PCFShadowMap:()=>Qt,PCFSoftShadowMap:()=>Gt,PMREMGenerator:()=>_A,Path:()=>$c,PerspectiveCamera:()=>Ba,Plane:()=>Ul,PlaneGeometry:()=>Vh,PlaneHelper:()=>jp,PointLight:()=>rd,PointLightHelper:()=>Sp,Points:()=>bc,PointsMaterial:()=>gc,PolarGridHelper:()=>Dp,PolyhedronGeometry:()=>sh,PositionalAudio:()=>Gd,PropertyBinding:()=>Jd,PropertyMixer:()=>Hd,QuadraticBezierCurve:()=>Xc,QuadraticBezierCurve3:()=>Yc,Quaternion:()=>ss,QuaternionKeyframeTrack:()=>Iu,QuaternionLinearInterpolant:()=>Su,RED_GREEN_RGTC2_Format:()=>oi,RED_RGTC1_Format:()=>ri,REVISION:()=>Lt,RGBADepthPacking:()=>Ci,RGBAFormat:()=>yn,RGBAIntegerFormat:()=>Bn,RGBA_ASTC_10x10_Format:()=>Zn,RGBA_ASTC_10x5_Format:()=>Yn,RGBA_ASTC_10x6_Format:()=>Jn,RGBA_ASTC_10x8_Format:()=>Kn,RGBA_ASTC_12x10_Format:()=>$n,RGBA_ASTC_12x12_Format:()=>ti,RGBA_ASTC_4x4_Format:()=>Gn,RGBA_ASTC_5x4_Format:()=>zn,RGBA_ASTC_5x5_Format:()=>Hn,RGBA_ASTC_6x5_Format:()=>Vn,RGBA_ASTC_6x6_Format:()=>jn,RGBA_ASTC_8x5_Format:()=>Wn,RGBA_ASTC_8x6_Format:()=>qn,RGBA_ASTC_8x8_Format:()=>Xn,RGBA_BPTC_Format:()=>ei,RGBA_ETC2_EAC_Format:()=>Qn,RGBA_PVRTC_2BPPV1_Format:()=>Fn,RGBA_PVRTC_4BPPV1_Format:()=>On,RGBA_S3TC_DXT1_Format:()=>Rn,RGBA_S3TC_DXT3_Format:()=>Ln,RGBA_S3TC_DXT5_Format:()=>Dn,RGBDepthPacking:()=>wi,RGBFormat:()=>vn,RGBIntegerFormat:()=>In,RGB_BPTC_SIGNED_Format:()=>ni,RGB_BPTC_UNSIGNED_Format:()=>ii,RGB_ETC1_Format:()=>kn,RGB_ETC2_Format:()=>Nn,RGB_PVRTC_2BPPV1_Format:()=>Un,RGB_PVRTC_4BPPV1_Format:()=>Pn,RGB_S3TC_DXT1_Format:()=>Tn,RGDepthPacking:()=>_i,RGFormat:()=>Mn,RGIntegerFormat:()=>Sn,RawShaderMaterial:()=>nu,Ray:()=>Us,Raycaster:()=>cp,RectAreaLight:()=>cd,RedFormat:()=>wn,RedIntegerFormat:()=>_n,ReinhardToneMapping:()=>Re,RenderTarget:()=>$r,RenderTarget3D:()=>ep,RenderTargetArray:()=>np,RepeatWrapping:()=>je,ReplaceStencilOp:()=>Ui,ReverseSubtractEquation:()=>te,RingGeometry:()=>jh,SIGNED_RED_GREEN_RGTC2_Format:()=>ai,SIGNED_RED_RGTC1_Format:()=>si,SRGBColorSpace:()=>Bi,SRGBTransfer:()=>Li,Scene:()=>Na,ShaderChunk:()=>iA,ShaderLib:()=>sA,ShaderMaterial:()=>wa,ShadowMaterial:()=>eu,Shape:()=>dh,ShapeGeometry:()=>Wh,ShapePath:()=>Kp,ShapeUtils:()=>Fh,ShortType:()=>an,Skeleton:()=>bl,SkeletonHelper:()=>_p,SkinnedMesh:()=>gl,Source:()=>Xr,Sphere:()=>Ss,SphereGeometry:()=>qh,Spherical:()=>dp,SphericalHarmonics3:()=>hd,SplineCurve:()=>Jc,SpotLight:()=>$u,SpotLightHelper:()=>xp,Sprite:()=>il,SpriteMaterial:()=>Ha,SrcAlphaFactor:()=>ae,SrcAlphaSaturateFactor:()=>pe,SrcColorFactor:()=>se,StaticCopyUsage:()=>cr,StaticDrawUsage:()=>ir,StaticReadUsage:()=>or,StereoCamera:()=>Sd,StreamCopyUsage:()=>ur,StreamDrawUsage:()=>sr,StreamReadUsage:()=>lr,StringKeyframeTrack:()=>Bu,SubtractEquation:()=>$t,SubtractiveBlending:()=>Yt,TOUCH:()=>Pt,TangentSpaceNormalMap:()=>Mi,TetrahedronGeometry:()=>Xh,Texture:()=>Kr,TextureLoader:()=>ju,TextureUtils:()=>tA,TimestampQuery:()=>mr,TorusGeometry:()=>Yh,TorusKnotGeometry:()=>Jh,Triangle:()=>wo,TriangleFanDrawMode:()=>xi,TriangleStripDrawMode:()=>Ei,TrianglesDrawMode:()=>yi,TubeGeometry:()=>Kh,UVMapping:()=>Ne,Uint16BufferAttribute:()=>qo,Uint32BufferAttribute:()=>Yo,Uint8BufferAttribute:()=>Vo,Uint8ClampedBufferAttribute:()=>jo,Uniform:()=>ip,UniformsGroup:()=>sp,UniformsLib:()=>rA,UniformsUtils:()=>Ca,UnsignedByteType:()=>sn,UnsignedInt248Type:()=>fn,UnsignedInt5999Type:()=>mn,UnsignedIntType:()=>hn,UnsignedShort4444Type:()=>pn,UnsignedShort5551Type:()=>An,UnsignedShortType:()=>ln,VSMShadowMap:()=>zt,Vector2:()=>Br,Vector3:()=>os,Vector4:()=>Zr,VectorKeyframeTrack:()=>Tu,VideoFrameTexture:()=>_c,VideoTexture:()=>wc,WebGL3DRenderTarget:()=>rs,WebGLArrayRenderTarget:()=>ns,WebGLCoordinateSystem:()=>Ar,WebGLCubeRenderTarget:()=>Da,WebGLRenderTarget:()=>ts,WebGLRenderer:()=>Om,WebGLUtils:()=>Im,WebGPUCoordinateSystem:()=>fr,WebXRController:()=>Oa,WireframeGeometry:()=>Zh,WrapAroundEnding:()=>mi,ZeroCurvatureEnding:()=>Ai,ZeroFactor:()=>ie,ZeroSlopeEnding:()=>fi,ZeroStencilOp:()=>Di,createCanvasElement:()=>Or});var e={};n.r(e),n.d(e,{computeMikkTSpaceTangents:()=>Nm,computeMorphedAttributes:()=>Ym,deepCloneAttribute:()=>zm,deinterleaveAttribute:()=>Vm,deinterleaveGeometry:()=>jm,estimateBytesUsed:()=>Wm,interleaveAttributes:()=>Hm,mergeAttributes:()=>Gm,mergeGeometries:()=>Qm,mergeGroups:()=>Jm,mergeVertices:()=>qm,toCreasedNormals:()=>Km,toTrianglesDrawMode:()=>Xm});var r={};n.r(r),n.d(r,{checkARSupport:()=>zy,checkHeadsetConnected:()=>Gy,checkVRSupport:()=>Hy,isAppleVisionPro:()=>Yy,isBrowserEnvironment:()=>iE,isFirefoxReality:()=>$y,isIOS:()=>Jy,isIpad:()=>Xy,isLandscape:()=>nE,isMobile:()=>Wy,isMobileDeviceRequestingDesktopSite:()=>Ky,isMobileVR:()=>tE,isNodeEnvironment:()=>rE,isOculusBrowser:()=>Zy,isR7:()=>eE,isTablet:()=>qy,isWebXRAvailable:()=>ky});var s={};n.r(s),n.d(s,{clearObject:()=>lE,createPool:()=>aE,removeUnusedKeys:()=>cE});var o={};n.r(o),n.d(o,{equals:()=>mE,isCoordinate:()=>vE,isCoordinates:()=>gE,parse:()=>AE,regex:()=>dE,stringify:()=>fE,toVector3:()=>EE});var a={};n.r(a),n.d(a,{getComponentProperty:()=>CE,getComponentPropertyPath:()=>bE,setComponentProperty:()=>wE});var l={};n.r(l),n.d(l,{parseUrl:()=>TE,validateCubemapSrc:()=>BE,validateEnvMapSrc:()=>IE,validateSrc:()=>SE});var c={};n.r(c),n.d(c,{createCompatibleTexture:()=>zE,handleTextureEvents:()=>QE,isCompatibleTexture:()=>GE,setTextureProperties:()=>PE,updateDistortionMap:()=>FE,updateEnvMap:()=>NE,updateMap:()=>OE,updateMapMaterialFromData:()=>UE});var h={};n.r(h),n.d(h,{parse:()=>VE,stringify:()=>jE,toCamelCase:()=>WE});var u={};n.r(u),n.d(u,{checkControllerPresentAndSetup:()=>ZE,emitIfAxesChanged:()=>ex,findMatchingControllerWebXR:()=>tx,isControllerPresentWebXR:()=>$E,onButtonEvent:()=>nx});var d={};n.r(d),n.d(d,{bind:()=>rx,checkHeadsetConnected:()=>sx,clone:()=>Ax,coordinates:()=>o,debounce:()=>ux,debug:()=>Ly,deepEqual:()=>gx,device:()=>r,diff:()=>vx,entity:()=>a,extend:()=>dx,extendDeep:()=>px,findAllScenes:()=>wx,forceCanvasResizeSafariMobile:()=>_E,getElData:()=>xx,getUrlParameter:()=>bx,isIOS:()=>ox,isIframed:()=>Cx,isMobile:()=>ax,material:()=>c,objectPool:()=>s,shouldCaptureKeyEvent:()=>yx,split:()=>xE,splitString:()=>Ex,srcLoader:()=>l,styleParser:()=>h,throttle:()=>lx,throttleLeadingAndTrailing:()=>cx,throttleTick:()=>hx,trackedControls:()=>u});var p={};n.r(p),n.d(p,{isSingleProperty:()=>eb,parseProperties:()=>sb,parseProperty:()=>ob,process:()=>nb,processPropertyDefinition:()=>ib,stringifyProperties:()=>ab,stringifyProperty:()=>lb});var A={};n.r(A),n.d(A,{Component:()=>Cb,components:()=>cb,registerComponent:()=>_b,registrationOrderWarnings:()=>wb});var f={};n.r(f),n.d(f,{System:()=>Lb,registerSystem:()=>Db,systems:()=>Rb});var m={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},g={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},v=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective"],y={CSS:{},springs:{}};function E(t,e,n){return Math.min(Math.max(t,e),n)}function x(t,e){return t.indexOf(e)>-1}function b(t,e){return t.apply(null,e)}var C=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,w=/^rgb/,_=/^hsl/,M={arr:function(t){return Array.isArray(t)},obj:function(t){return x(Object.prototype.toString.call(t),"Object")},pth:function(t){return M.obj(t)&&t.hasOwnProperty("totalLength")},svg:function(t){return t instanceof SVGElement},inp:function(t){return t instanceof HTMLInputElement},dom:function(t){return t.nodeType||M.svg(t)},str:function(t){return"string"==typeof t},fnc:function(t){return"function"==typeof t},und:function(t){return void 0===t},hex:function(t){return C.test(t)},rgb:function(t){return w.test(t)},hsl:function(t){return _.test(t)},col:function(t){return M.hex(t)||M.rgb(t)||M.hsl(t)},key:function(t){return!m.hasOwnProperty(t)&&!g.hasOwnProperty(t)&&"targets"!==t&&"keyframes"!==t}},S=/\(([^)]+)\)/;function I(t){var e=S.exec(t);return e?e[1].split(",").map((function(t){return parseFloat(t)})):[]}function B(t,e){var n=I(t),i=E(M.und(n[0])?1:n[0],.1,100),r=E(M.und(n[1])?100:n[1],.1,100),s=E(M.und(n[2])?10:n[2],.1,100),o=E(M.und(n[3])?0:n[3],.1,100),a=Math.sqrt(r/i),l=s/(2*Math.sqrt(r*i)),c=l<1?a*Math.sqrt(1-l*l):0,h=l<1?(l*a-o)/c:-o+a;function u(t){var n=e?e*t/1e3:t;return n=l<1?Math.exp(-n*l*a)*(1*Math.cos(c*n)+h*Math.sin(c*n)):(1+h*n)*Math.exp(-n*a),0===t||1===t?t:1-n}return e?u:function(){var e=y.springs[t];if(e)return e;for(var n=1/6,i=0,r=0;;)if(1===u(i+=n)){if(++r>=16)break}else r=0;var s=i*n*1e3;return y.springs[t]=s,s}}function T(t,e){void 0===t&&(t=1),void 0===e&&(e=.5);var n=E(t,1,10),i=E(e,.1,2);return function(t){return 0===t||1===t?t:-n*Math.pow(2,10*(t-1))*Math.sin((t-1-i/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/i)}}function R(t){return void 0===t&&(t=10),function(e){return Math.round(e*t)*(1/t)}}var L=function(){var t=.1;function e(t,e){return 1-3*e+3*t}function n(t,e){return 3*e-6*t}function i(t){return 3*t}function r(t,r,s){return((e(r,s)*t+n(r,s))*t+i(r))*t}function s(t,r,s){return 3*e(r,s)*t*t+2*n(r,s)*t+i(r)}return function(e,n,i,o){if(0<=e&&e<=1&&0<=i&&i<=1){var a=new Float32Array(11);if(e!==n||i!==o)for(var l=0;l<11;++l)a[l]=r(l*t,e,i);return function(l){return e===n&&i===o||0===l||1===l?l:r(function(n){for(var o=0,l=1;10!==l&&a[l]<=n;++l)o+=t;--l;var c=o+(n-a[l])/(a[l+1]-a[l])*t,h=s(c,e,i);return h>=.001?function(t,e,n,i){for(var o=0;o<4;++o){var a=s(e,n,i);if(0===a)return e;e-=(r(e,n,i)-t)/a}return e}(n,c,e,i):0===h?c:function(t,e,n,i,s){var o,a,l=0;do{(o=r(a=e+(n-e)/2,i,s)-t)>0?n=a:e=a}while(Math.abs(o)>1e-7&&++l<10);return a}(n,o,o+t,e,i)}(l),n,o)}}}}(),D=function(){var t=["Quad","Cubic","Quart","Quint","Sine","Expo","Circ","Back","Elastic"],e={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],T],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(t,e){return function(n){return 1-T(t,e)(1-n)}}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(t,e){return function(n){return n<.5?T(t,e)(2*n)/2:1-T(t,e)(-2*n+2)/2}}]},n={linear:[.25,.25,.75,.75]};for(var i in e)for(var r=0,s=e[i].length;r<s;r++)n["ease"+i+t[r]]=e[i][r];return n}();function P(t,e){if(M.fnc(t))return t;var n=t.split("(")[0],i=D[n],r=I(t);switch(n){case"spring":return B(t,e);case"cubicBezier":return b(L,r);case"steps":return b(R,r);default:return M.fnc(i)?b(i,r):b(L,i)}}function U(t){try{return document.querySelectorAll(t)}catch(t){return}}var O=[];function F(t,e){for(var n=O,i=t.length,r=arguments.length>=2?arguments[1]:void 0,s=0;s<i;s++)if(s in t){var o=t[s];e.call(r,o,s,t)&&n.push(o)}return(O=t).length=0,n}function k(t,e){e||(e=[]);for(var n=0,i=t.length;n<i;n++){var r=t[n];Array.isArray(r)?k(r,e):e.push(r)}return e}function N(t){return M.arr(t)?t:(M.str(t)&&(t=U(t)||t),t instanceof NodeList||t instanceof HTMLCollection?[].slice.call(t):[t])}function Q(t,e){return t.some((function(t){return t===e}))}function G(t){var e={};for(var n in t)e[n]=t[n];return e}function z(t,e){var n=G(t);for(var i in t)n[i]=e.hasOwnProperty(i)?e[i]:t[i];return n}function H(t,e){var n=G(t);for(var i in e)n[i]=M.und(t[i])?e[i]:t[i];return n}var V=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g,j=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,W=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,q=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g,X=/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g;var Y=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/;function J(t){var e=Y.exec(t);if(e)return e[2]}function K(t,e){return M.fnc(t)?t(e.target,e.id,e.total):t}function Z(t,e){return t.getAttribute(e)}function $(t,e,n){if(Q([n,"deg","rad","turn"],J(e)))return e;var i=y.CSS[e+n];if(!M.und(i))return i;var r=document.createElement(t.tagName),s=t.parentNode&&t.parentNode!==document?t.parentNode:document.body;s.appendChild(r),r.style.position="absolute",r.style.width=100+n;var o=100/r.offsetWidth;s.removeChild(r);var a=o*parseFloat(e);return y.CSS[e+n]=a,a}function tt(t,e,n){if(e in t.style){var i=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=t.style[e]||getComputedStyle(t).getPropertyValue(i)||"0";return n?$(t,r,n):r}}function et(t,e){return M.dom(t)&&!M.inp(t)&&(Z(t,e)||M.svg(t)&&t[e])?"attribute":M.dom(t)&&Q(v,e)?"transform":M.dom(t)&&"transform"!==e&&tt(t,e)?"css":null!=t[e]?"object":void 0}var nt=/(\w+)\(([^)]*)\)/g;function it(t){if(M.dom(t)){for(var e,n=t.style.transform||"",i=new Map;e=nt.exec(n);)i.set(e[1],e[2]);return i}}function rt(t,e,n,i){switch(et(t,e)){case"transform":return function(t,e,n,i){var r=x(e,"scale")?1:0+function(t){return x(t,"translate")||"perspective"===t?"px":x(t,"rotate")||x(t,"skew")?"deg":void 0}(e),s=it(t).get(e)||r;return n&&(n.transforms.list.set(e,s),n.transforms.last=e),i?$(t,s,i):s}(t,e,i,n);case"css":return tt(t,e,n);case"attribute":return Z(t,e);default:return t[e]||0}}var st=/^(\*=|\+=|-=)/;function ot(t,e){var n=st.exec(t);if(!n)return t;var i=J(t)||0,r=parseFloat(e),s=parseFloat(t.replace(n[0],""));switch(n[0][0]){case"+":return r+s+i;case"-":return r-s+i;case"*":return r*s+i}}var at=/\s/g;function lt(t,e){if(M.col(t))return function(t){return M.rgb(t)?(e=t,(n=V.exec(e))?"rgba("+n[1]+",1)":e):M.hex(t)?function(t){var e=t.replace(j,(function(t,e,n,i){return e+e+n+n+i+i})),n=W.exec(e);return"rgba("+parseInt(n[1],16)+","+parseInt(n[2],16)+","+parseInt(n[3],16)+",1)"}(t):M.hsl(t)?function(t){var e,n,i,r=q.exec(t)||X.exec(t),s=parseInt(r[1],10)/360,o=parseInt(r[2],10)/100,a=parseInt(r[3],10)/100,l=r[4]||1;function c(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+(e-t)*(2/3-n)*6:t}if(0==o)e=n=i=a;else{var h=a<.5?a*(1+o):a+o-a*o,u=2*a-h;e=c(u,h,s+1/3),n=c(u,h,s),i=c(u,h,s-1/3)}return"rgba("+255*e+","+255*n+","+255*i+","+l+")"}(t):void 0;var e,n}(t);var n=J(t),i=n?t.substr(0,t.length-n.length):t;return e&&!at.test(t)?i+e:i}function ct(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ht(t){for(var e,n=t.points,i=0,r=0;r<n.numberOfItems;r++){var s=n.getItem(r);r>0&&(i+=ct(e,s)),e=s}return i}function ut(t){if(t.getTotalLength)return t.getTotalLength();switch(t.tagName.toLowerCase()){case"circle":return function(t){return 2*Math.PI*Z(t,"r")}(t);case"rect":return function(t){return 2*Z(t,"width")+2*Z(t,"height")}(t);case"line":return function(t){return ct({x:Z(t,"x1"),y:Z(t,"y1")},{x:Z(t,"x2"),y:Z(t,"y2")})}(t);case"polyline":return ht(t);case"polygon":return function(t){var e=t.points;return ht(t)+ct(e.getItem(e.numberOfItems-1),e.getItem(0))}(t)}}function dt(t,e){var n=e||{},i=n.el||function(t){for(var e=t.parentNode;M.svg(e)&&(e=e.parentNode,M.svg(e.parentNode)););return e}(t),r=i.getBoundingClientRect(),s=Z(i,"viewBox"),o=r.width,a=r.height,l=n.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:i,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function pt(t,e){function n(n){void 0===n&&(n=0);var i=e+n>=1?e+n:0;return t.el.getPointAtLength(i)}var i=dt(t.el,t.svg),r=n(),s=n(-1),o=n(1);switch(t.property){case"x":return(r.x-i.x)*i.w;case"y":return(r.y-i.y)*i.h;case"angle":return 180*Math.atan2(o.y-s.y,o.x-s.x)/Math.PI}}var At=/-?\d*\.?\d+/g;function ft(t,e){var n=lt(M.pth(t)?t.totalLength:t,e)+"";return{original:n,numbers:n.match(At)?n.match(At).map(Number):[0],strings:M.str(t)||e?n.split(At):[]}}function mt(t){return F(t?k(M.arr(t)?t.map(N):N(t)):[],(function(t,e,n){return n.indexOf(t)===e}))}function gt(t){var e=mt(t);return e.map((function(t,n){return{target:t,id:n,total:e.length,transforms:{list:it(t)}}}))}var vt=/^spring/;function yt(t,e){var n=G(e);if(vt.test(n.easing)&&(n.duration=B(n.easing)),M.arr(t)){var i=t.length;2!==i||M.obj(t[0])?M.fnc(e.duration)||(n.duration=e.duration/i):t={value:t}}var r=M.arr(t)?t:[t];return r.map((function(t,n){var i=M.obj(t)&&!M.pth(t)?t:{value:t};return M.und(i.delay)&&(i.delay=n?0:e.delay),M.und(i.endDelay)&&(i.endDelay=n===r.length-1?e.endDelay:0),i})).map((function(t){return H(t,n)}))}var Et={css:function(t,e,n){return t.style[e]=n},attribute:function(t,e,n){return t.setAttribute(e,n)},object:function(t,e,n){return t[e]=n},transform:function(t,e,n,i,r){if(i.list.set(e,n),e===i.last||r){var s="";i.list.forEach((function(t,e){s+=e+"("+t+") "})),t.style.transform=s}}};function xt(t,e){for(var n=gt(t),i=0,r=n.length;i<r;i++){var s=n[i];for(var o in e){var a=K(e[o],s),l=s.target,c=J(a),h=rt(l,o,c,s),u=ot(lt(a,c||J(h)),h),d=et(l,o);Et[d](l,o,u,s.transforms,!0)}}}function bt(t,e){return F(k(t.map((function(t){return e.map((function(e){return function(t,e){var n=et(t.target,e.name);if(n){var i=function(t,e){var n;return t.tweens.map((function(i){var r=function(t,e){var n={};for(var i in t){var r=K(t[i],e);M.arr(r)&&1===(r=r.map((function(t){return K(t,e)}))).length&&(r=r[0]),n[i]=r}return n.duration=parseFloat(n.duration),n.delay=parseFloat(n.delay),n}(i,e),s=r.value,o=M.arr(s)?s[1]:s,a=J(o),l=rt(e.target,t.name,a,e),c=n?n.to.original:l,h=M.arr(s)?s[0]:c,u=J(h)||J(l),d=a||u;return M.und(o)&&(o=c),r.from=ft(h,d),r.to=ft(ot(o,h),d),r.start=n?n.end:0,r.end=r.start+r.delay+r.duration+r.endDelay,r.easing=P(r.easing,r.duration),r.isPath=M.pth(s),r.isColor=M.col(r.from.original),r.isColor&&(r.round=1),n=r,r}))}(e,t),r=i[i.length-1];return{type:n,property:e.name,animatable:t,tweens:i,duration:r.end,delay:i[0].delay,endDelay:r.endDelay}}}(t,e)}))}))),(function(t){return!M.und(t)}))}function Ct(t,e){var n=t.length,i=function(t){return t.timelineOffset?t.timelineOffset:0},r={};return r.duration=n?Math.max.apply(Math,t.map((function(t){return i(t)+t.duration}))):e.duration,r.delay=n?Math.min.apply(Math,t.map((function(t){return i(t)+t.delay}))):e.delay,r.endDelay=n?r.duration-Math.max.apply(Math,t.map((function(t){return i(t)+t.duration-t.endDelay}))):e.endDelay,r}var wt,_t=0,Mt=[],St=[],It=function(){function t(){wt=requestAnimationFrame(e)}function e(e){var n=Mt.length;if(n){for(var i=0;i<n;){var r=Mt[i];if(r.paused){var s=Mt.indexOf(r);s>-1&&(Mt.splice(s,1),n=Mt.length)}else r.tick(e);i++}t()}else wt=cancelAnimationFrame(wt)}return t}();function Bt(t){void 0===t&&(t={});var e,n=0,i=0,r=0,s=0,o=null;function a(){return window.Promise&&new Promise((function(t){return o=t}))}var l=a(),c=function(t){var e=z(m,t),n=z(g,t),i=function(t,e){var n=[],i=e.keyframes;for(var r in i&&(e=H(function(t){for(var e=F(k(t.map((function(t){return Object.keys(t)}))),(function(t){return M.key(t)})).reduce((function(t,e){return t.indexOf(e)<0&&t.push(e),t}),[]),n={},i=function(i){var r=e[i];n[r]=t.map((function(t){var e={};for(var n in t)M.key(n)?n==r&&(e.value=t[n]):e[n]=t[n];return e}))},r=0;r<e.length;r++)i(r);return n}(i),e)),e)M.key(r)&&n.push({name:r,tweens:yt(e[r],t)});return n}(n,t),r=gt(t.targets),s=bt(r,i),o=Ct(s,n),a=_t;return _t++,H(e,{id:a,children:[],animatables:r,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}(t);function h(){c.reversed=!c.reversed;for(var t=0,n=e.length;t<n;t++)e[t].reversed=c.reversed}function u(t){return c.reversed?c.duration-t:t}function d(){n=0,i=u(c.currentTime)*(1/Bt.speed)}function p(t,e){e&&e.seek(t-e.timelineOffset)}function A(t){for(var e=0,n=c.animations,i=n.length;e<i;){var r=n[e],s=r.animatable,o=r.tweens,a=o.length-1,l=o[a];a&&(l=F(o,(function(e){return t<e.end}))[0]||l);for(var h=E(t-l.start-l.delay,0,l.duration)/l.duration,u=isNaN(h)?1:l.easing(h),d=l.to.strings,p=l.round,A=[],f=l.to.numbers.length,m=void 0,g=0;g<f;g++){var v=void 0,y=l.to.numbers[g],x=l.from.numbers[g]||0;v=l.isPath?pt(l.value,u*y):x+u*(y-x),p&&(l.isColor&&g>2||(v=Math.round(v*p)/p)),A.push(v)}var b=d.length;if(b){m=d[0];for(var C=0;C<b;C++){d[C];var w=d[C+1],_=A[C];isNaN(_)||(m+=w?_+w:_+" ")}}else m=A[0];Et[r.type](s.target,r.property,m,s.transforms),r.currentValue=m,e++}}function f(t){c[t]&&!c.passThrough&&c[t](c)}function v(t){var d=c.duration,m=c.delay,g=d-c.endDelay,v=u(t);c.progress=E(v/d*100,0,100),c.reversePlayback=v<c.currentTime,e&&function(t){if(c.reversePlayback)for(var n=s;n--;)p(t,e[n]);else for(var i=0;i<s;i++)p(t,e[i])}(v),!c.began&&c.currentTime>0&&(c.began=!0,f("begin"),f("loopBegin")),v<=m&&0!==c.currentTime&&A(0),(v>=g&&c.currentTime!==d||!d)&&A(d),v>m&&v<g?(c.changeBegan||(c.changeBegan=!0,c.changeCompleted=!1,f("changeBegin")),f("change"),A(v)):c.changeBegan&&(c.changeCompleted=!0,c.changeBegan=!1,f("changeComplete")),c.currentTime=E(v,0,d),c.began&&f("update"),t>=d&&(i=0,c.remaining&&!0!==c.remaining&&c.remaining--,c.remaining?(n=r,f("loopComplete"),f("loopBegin"),"alternate"===c.direction&&h()):(c.paused=!0,c.completed||(c.completed=!0,f("loopComplete"),f("complete"),"Promise"in window&&(o(),l=a()))))}return c.reset=function(){var t=c.direction;c.passThrough=!1,c.currentTime=0,c.progress=0,c.paused=!0,c.began=!1,c.changeBegan=!1,c.completed=!1,c.changeCompleted=!1,c.reversePlayback=!1,c.reversed="reverse"===t,c.remaining=c.loop,e=c.children;for(var n=s=e.length;n--;)c.children[n].reset();(c.reversed&&!0!==c.loop||"alternate"===t&&1===c.loop)&&c.remaining++,A(0)},c.set=function(t,e){return xt(t,e),c},c.tick=function(t){r=t,n||(n=r),v((r+(i-n))*Bt.speed)},c.seek=function(t){v(u(t))},c.pause=function(){c.paused=!0,d()},c.play=function(){c.paused&&(c.paused=!1,Mt.push(c),d(),wt||It())},c.reverse=function(){h(),d()},c.restart=function(){c.reset(),c.play()},c.finished=l,c.reset(),c.autoplay&&c.play(),c}function Tt(t,e){for(var n=e.length;n--;)Q(t,e[n].animatable.target)&&e.splice(n,1)}document.addEventListener("visibilitychange",(function(){if(document.hidden){for(var t=0,e=Mt.length;t<e;t++)activeInstance[t].pause();St=Mt.slice(0),Mt=[]}else for(var n=0,i=St.length;n<i;n++)St[n].play()})),Bt.version="3.0.0",Bt.speed=1,Bt.running=Mt,Bt.remove=function(t){for(var e=mt(t),n=Mt.length;n--;){var i=Mt[n],r=i.animations,s=i.children;Tt(e,r);for(var o=s.length;o--;){var a=s[o],l=a.animations;Tt(e,l),l.length||a.children.length||s.splice(o,1)}r.length||s.length||i.pause()}},Bt.get=rt,Bt.set=xt,Bt.convertPx=$,Bt.path=function(t,e){var n=M.str(t)?U(t)[0]:t,i=e||100;return function(t){return{property:t,el:n,svg:dt(n),totalLength:ut(n)*(i/100)}}},Bt.setDashoffset=function(t){var e=ut(t);return t.setAttribute("stroke-dasharray",e),e},Bt.stagger=function(t,e){void 0===e&&(e={});var n=e.direction||"normal",i=e.easing?P(e.easing):null,r=e.grid,s=e.axis,o=e.from||0,a="first"===o,l="center"===o,c="last"===o,h=M.arr(t),u=h?parseFloat(t[0]):parseFloat(t),d=h?parseFloat(t[1]):0,p=J(h?t[1]:t)||0,A=e.start||0+(h?u:0),f=[],m=0;return function(t,e,g){if(a&&(o=0),l&&(o=(g-1)/2),c&&(o=g-1),!f.length){for(var v=0;v<g;v++){if(r){var y=l?(r[0]-1)/2:o%r[0],E=l?(r[1]-1)/2:Math.floor(o/r[0]),x=y-v%r[0],b=E-Math.floor(v/r[0]),C=Math.sqrt(x*x+b*b);"x"===s&&(C=-x),"y"===s&&(C=-b),f.push(C)}else f.push(Math.abs(o-v));m=Math.max.apply(Math,f)}i&&(f=f.map((function(t){return i(t/m)*m}))),"reverse"===n&&(f=f.map((function(t){return s?t<0?-1*t:-t:Math.abs(m-t)})))}return A+(h?(d-u)/m:u)*(Math.round(100*f[e])/100)+p}},Bt.timeline=function(t){void 0===t&&(t={});var e=Bt(t);return e.duration=0,e.add=function(n,i){var r=Mt.indexOf(e),s=e.children;function o(t){t.passThrough=!0}r>-1&&Mt.splice(r,1);for(var a=0;a<s.length;a++)o(s[a]);var l=H(n,z(g,t));l.targets=l.targets||t.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=M.und(i)?c:ot(i,c),o(e),e.seek(l.timelineOffset);var h=Bt(l);o(h),s.push(h);var u=Ct(s,t);return e.delay=u.delay,e.endDelay=u.endDelay,e.duration=u.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e},Bt.easing=P,Bt.penner=D,Bt.random=function(t,e){return Math.floor(Math.random()*(e-t+1))+t};const Rt=Bt,Lt="173",Dt={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Pt={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Ut=0,Ot=1,Ft=2,kt=3,Nt=0,Qt=1,Gt=2,zt=3,Ht=0,Vt=1,jt=2,Wt=0,qt=1,Xt=2,Yt=3,Jt=4,Kt=5,Zt=100,$t=101,te=102,ee=103,ne=104,ie=200,re=201,se=202,oe=203,ae=204,le=205,ce=206,he=207,ue=208,de=209,pe=210,Ae=211,fe=212,me=213,ge=214,ve=0,ye=1,Ee=2,xe=3,be=4,Ce=5,we=6,_e=7,Me=0,Se=1,Ie=2,Be=0,Te=1,Re=2,Le=3,De=4,Pe=5,Ue=6,Oe=7,Fe="attached",ke="detached",Ne=300,Qe=301,Ge=302,ze=303,He=304,Ve=306,je=1e3,We=1001,qe=1002,Xe=1003,Ye=1004,Je=1004,Ke=1005,Ze=1005,$e=1006,tn=1007,en=1007,nn=1008,rn=1008,sn=1009,on=1010,an=1011,ln=1012,cn=1013,hn=1014,un=1015,dn=1016,pn=1017,An=1018,fn=1020,mn=35902,gn=1021,vn=1022,yn=1023,En=1024,xn=1025,bn=1026,Cn=1027,wn=1028,_n=1029,Mn=1030,Sn=1031,In=1032,Bn=1033,Tn=33776,Rn=33777,Ln=33778,Dn=33779,Pn=35840,Un=35841,On=35842,Fn=35843,kn=36196,Nn=37492,Qn=37496,Gn=37808,zn=37809,Hn=37810,Vn=37811,jn=37812,Wn=37813,qn=37814,Xn=37815,Yn=37816,Jn=37817,Kn=37818,Zn=37819,$n=37820,ti=37821,ei=36492,ni=36494,ii=36495,ri=36283,si=36284,oi=36285,ai=36286,li=2200,ci=2201,hi=2202,ui=2300,di=2301,pi=2302,Ai=2400,fi=2401,mi=2402,gi=2500,vi=2501,yi=0,Ei=1,xi=2,bi=3200,Ci=3201,wi=3202,_i=3203,Mi=0,Si=1,Ii="",Bi="srgb",Ti="srgb-linear",Ri="linear",Li="srgb",Di=0,Pi=7680,Ui=7681,Oi=7682,Fi=7683,ki=34055,Ni=34056,Qi=5386,Gi=512,zi=513,Hi=514,Vi=515,ji=516,Wi=517,qi=518,Xi=519,Yi=512,Ji=513,Ki=514,Zi=515,$i=516,tr=517,er=518,nr=519,ir=35044,rr=35048,sr=35040,or=35045,ar=35049,lr=35041,cr=35046,hr=35050,ur=35042,dr="100",pr="300 es",Ar=2e3,fr=2001,mr={COMPUTE:"compute",RENDER:"render"};class gr{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){const n=this._listeners;return void 0!==n&&void 0!==n[t]&&-1!==n[t].indexOf(e)}removeEventListener(t,e){const n=this._listeners;if(void 0===n)return;const i=n[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const n=e[t.type];if(void 0!==n){t.target=this;const e=n.slice(0);for(let n=0,i=e.length;n<i;n++)e[n].call(this,t);t.target=null}}}const vr=["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 yr=1234567;const Er=Math.PI/180,xr=180/Math.PI;function br(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(vr[255&t]+vr[t>>8&255]+vr[t>>16&255]+vr[t>>24&255]+"-"+vr[255&e]+vr[e>>8&255]+"-"+vr[e>>16&15|64]+vr[e>>24&255]+"-"+vr[63&n|128]+vr[n>>8&255]+"-"+vr[n>>16&255]+vr[n>>24&255]+vr[255&i]+vr[i>>8&255]+vr[i>>16&255]+vr[i>>24&255]).toLowerCase()}function Cr(t,e,n){return Math.max(e,Math.min(n,t))}function wr(t,e){return(t%e+e)%e}function _r(t,e,n){return(1-n)*t+n*e}function Mr(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Sr(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const Ir={DEG2RAD:Er,RAD2DEG:xr,generateUUID:br,clamp:Cr,euclideanModulo:wr,mapLinear:function(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)},inverseLerp:function(t,e,n){return t!==e?(n-t)/(e-t):0},lerp:_r,damp:function(t,e,n,i){return _r(t,e,1-Math.exp(-n*i))},pingpong:function(t,e=1){return e-Math.abs(wr(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&&(yr=t);let e=yr+=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*Er},radToDeg:function(t){return t*xr},isPowerOfTwo:function(t){return!(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 s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+i)/2),h=o((e+i)/2),u=s((e-i)/2),d=o((e-i)/2),p=s((i-e)/2),A=o((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*A,l*p,a*c);break;case"YXY":t.set(l*p,a*h,l*A,a*c);break;case"ZYZ":t.set(l*A,l*p,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:Sr,denormalize:Mr};class Br{constructor(t=0,e=0){Br.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,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=Cr(this.x,t.x,e.x),this.y=Cr(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=Cr(this.x,t,e),this.y=Cr(this.y,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Cr(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(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}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(Cr(n,-1,1))}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),i=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*n-s*i+t.x,this.y=r*i+s*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Tr{constructor(t,e,n,i,r,s,o,a,l){Tr.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,o,a,l)}set(t,e,n,i,r,s,o,a,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=o,c[3]=e,c[4]=r,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(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,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],u=n[2],d=n[5],p=n[8],A=i[0],f=i[3],m=i[6],g=i[1],v=i[4],y=i[7],E=i[2],x=i[5],b=i[8];return r[0]=s*A+o*g+a*E,r[3]=s*f+o*v+a*x,r[6]=s*m+o*y+a*b,r[1]=l*A+c*g+h*E,r[4]=l*f+c*v+h*x,r[7]=l*m+c*y+h*b,r[2]=u*A+d*g+p*E,r[5]=u*f+d*v+p*x,r[8]=u*m+d*y+p*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],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8];return e*s*c-e*o*l-n*r*c+n*o*a+i*r*l-i*s*a}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=c*s-o*l,u=o*a-c*r,d=l*r-s*a,p=e*h+n*u+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const A=1/p;return t[0]=h*A,t[1]=(i*l-c*n)*A,t[2]=(o*n-i*s)*A,t[3]=u*A,t[4]=(c*e-i*a)*A,t[5]=(i*r-o*e)*A,t[6]=d*A,t[7]=(n*a-l*e)*A,t[8]=(s*e-n*r)*A,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,i,r,s,o){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*s+l*o)+s+t,-i*l,i*a,-i*(-l*s+a*o)+o+e,0,0,1),this}scale(t,e){return this.premultiply(Rr.makeScale(t,e)),this}rotate(t){return this.premultiply(Rr.makeRotation(-t)),this}translate(t,e){return this.premultiply(Rr.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),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)}}const Rr=new Tr;function Lr(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const Dr={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Pr(t,e){return new Dr[t](e)}function Ur(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Or(){const t=Ur("canvas");return t.style.display="block",t}const Fr={};function kr(t){t in Fr||(Fr[t]=!0,console.warn(t))}const Nr=(new Tr).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Qr=(new Tr).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Gr(){const t={enabled:!0,workingColorSpace:Ti,spaces:{},convert:function(t,e,n){return!1!==this.enabled&&e!==n&&e&&n?(this.spaces[e].transfer===Li&&(t.r=Hr(t.r),t.g=Hr(t.g),t.b=Hr(t.b)),this.spaces[e].primaries!==this.spaces[n].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===Li&&(t.r=Vr(t.r),t.g=Vr(t.g),t.b=Vr(t.b)),t):t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return t===Ii?Ri:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,n){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[Ti]:{primaries:e,whitePoint:i,transfer:Ri,toXYZ:Nr,fromXYZ:Qr,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Bi},outputColorSpaceConfig:{drawingBufferColorSpace:Bi}},[Bi]:{primaries:e,whitePoint:i,transfer:Li,toXYZ:Nr,fromXYZ:Qr,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Bi}}}),t}const zr=Gr();function Hr(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Vr(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let jr;class Wr{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===jr&&(jr=Ur("canvas")),jr.width=t.width,jr.height=t.height;const n=jr.getContext("2d");t instanceof ImageData?n.putImageData(t,0,0):n.drawImage(t,0,0,t.width,t.height),e=jr}return 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=Ur("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t<r.length;t++)r[t]=255*Hr(r[t]/255);return n.putImageData(i,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*Hr(e[t]/255)):e[t]=Hr(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}}let qr=0;class Xr{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:qr++}),this.uuid=br(),this.data=t,this.dataReady=!0,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:""},i=this.data;if(null!==i){let t;if(Array.isArray(i)){t=[];for(let e=0,n=i.length;e<n;e++)i[e].isDataTexture?t.push(Yr(i[e].image)):t.push(Yr(i[e]))}else t=Yr(i);n.url=t}return e||(t.images[this.uuid]=n),n}}function Yr(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Wr.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 Jr=0;class Kr extends gr{constructor(t=Kr.DEFAULT_IMAGE,e=Kr.DEFAULT_MAPPING,n=We,i=We,r=$e,s=nn,o=yn,a=sn,l=Kr.DEFAULT_ANISOTROPY,c=Ii){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Jr++}),this.uuid=br(),this.name="",this.source=new Xr(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new Br(0,0),this.repeat=new Br(1,1),this.center=new Br(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Tr,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){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.channel=t.channel,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.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,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.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==Ne)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case je:t.x=t.x-Math.floor(t.x);break;case We:t.x=t.x<0?0:1;break;case qe: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 je:t.y=t.y-Math.floor(t.y);break;case We:t.y=t.y<0?0:1;break;case qe: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)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}Kr.DEFAULT_IMAGE=null,Kr.DEFAULT_MAPPING=Ne,Kr.DEFAULT_ANISOTROPY=1;class Zr{constructor(t=0,e=0,n=0,i=1){Zr.prototype.isVector4=!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){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,i=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*n+s[8]*i+s[12]*r,this.y=s[1]*e+s[5]*n+s[9]*i+s[13]*r,this.z=s[2]*e+s[6]*n+s[10]*i+s[14]*r,this.w=s[3]*e+s[7]*n+s[11]*i+s[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,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 s=.01,o=.1,a=t.elements,l=a[0],c=a[4],h=a[8],u=a[1],d=a[5],p=a[9],A=a[2],f=a[6],m=a[10];if(Math.abs(c-u)<s&&Math.abs(h-A)<s&&Math.abs(p-f)<s){if(Math.abs(c+u)<o&&Math.abs(h+A)<o&&Math.abs(p+f)<o&&Math.abs(l+d+m-3)<o)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,a=(d+1)/2,g=(m+1)/2,v=(c+u)/4,y=(h+A)/4,E=(p+f)/4;return t>a&&t>g?t<s?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(t),i=v/n,r=y/n):a>g?a<s?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(a),n=v/i,r=E/i):g<s?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(g),n=y/r,i=E/r),this.set(n,i,r,e),this}let g=Math.sqrt((f-p)*(f-p)+(h-A)*(h-A)+(u-c)*(u-c));return Math.abs(g)<.001&&(g=1),this.x=(f-p)/g,this.y=(h-A)/g,this.z=(u-c)/g,this.w=Math.acos((l+d+m-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],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=Cr(this.x,t.x,e.x),this.y=Cr(this.y,t.y,e.y),this.z=Cr(this.z,t.z,e.z),this.w=Cr(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=Cr(this.x,t,e),this.y=Cr(this.y,t,e),this.z=Cr(this.z,t,e),this.w=Cr(this.w,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Cr(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(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 $r extends gr{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Zr(0,0,t,e),this.scissorTest=!1,this.viewport=new Zr(0,0,t,e);const i={width:t,height:e,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:$e,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new Kr(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const s=n.count;for(let t=0;t<s;t++)this.textures[t]=r.clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==t&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=t,this.textures[i].image.height=e,this.textures[i].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.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,n=t.textures.length;e<n;e++)this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const e=Object.assign({},t.texture.image);return this.texture.source=new Xr(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ts extends $r{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}}class es extends Kr{constructor(t=null,e=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Xe,this.minFilter=Xe,this.wrapR=We,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class ns extends ts{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new es(null,t,e,n),this.texture.isRenderTargetTexture=!0}}class is extends Kr{constructor(t=null,e=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=Xe,this.minFilter=Xe,this.wrapR=We,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class rs extends ts{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new is(null,t,e,n),this.texture.isRenderTargetTexture=!0}}class ss{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,r,s,o){let a=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const u=r[s+0],d=r[s+1],p=r[s+2],A=r[s+3];if(0===o)return t[e+0]=a,t[e+1]=l,t[e+2]=c,void(t[e+3]=h);if(1===o)return t[e+0]=u,t[e+1]=d,t[e+2]=p,void(t[e+3]=A);if(h!==A||a!==u||l!==d||c!==p){let t=1-o;const e=a*u+l*d+c*p+h*A,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,e*n);t=Math.sin(t*s)/r,o=Math.sin(o*s)/r}const r=o*n;if(a=a*t+u*r,l=l*t+d*r,c=c*t+p*r,h=h*t+A*r,t===1-o){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,s){const o=n[i],a=n[i+1],l=n[i+2],c=n[i+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return t[e]=o*p+c*h+a*d-l*u,t[e+1]=a*p+c*u+l*h-o*d,t[e+2]=l*p+c*d+o*u-a*h,t[e+3]=c*p-o*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=!0){const n=t._x,i=t._y,r=t._z,s=t._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),u=a(n/2),d=a(i/2),p=a(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===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],s=e[1],o=e[5],a=e[9],l=e[2],c=e[6],h=e[10],u=n+o+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=(s-i)*t}else if(n>o&&n>h){const t=2*Math.sqrt(1+n-o-h);this._w=(c-a)/t,this._x=.25*t,this._y=(i+s)/t,this._z=(r+l)/t}else if(o>h){const t=2*Math.sqrt(1+o-n-h);this._w=(r-l)/t,this._x=(i+s)/t,this._y=.25*t,this._z=(a+c)/t}else{const t=2*Math.sqrt(1+h-n-o);this._w=(s-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<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(Cr(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)}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,i=t._y,r=t._z,s=t._w,o=e._x,a=e._y,l=e._z,c=e._w;return this._x=n*c+s*o+i*l-r*a,this._y=i*c+s*a+r*o-n*l,this._z=r*c+s*l+n*a-i*o,this._w=s*c-n*o-i*a-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,s=this._w;let o=s*t._w+n*t._x+i*t._y+r*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=s,this._x=n,this._y=i,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const t=1-e;return this._w=t*s+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}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-e)*c)/l,u=Math.sin(e*c)/l;return this._w=s*h+this._w*u,this._x=n*h+this._x*u,this._y=i*h+this._y*u,this._z=r*h+this._z*u,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}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._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class os{constructor(t=0,e=0,n=0){os.prototype.isVector3=!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){return 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){return 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){return 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 this.applyQuaternion(ls.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(ls.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,s=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])*s,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,s=t.y,o=t.z,a=t.w,l=2*(s*i-o*n),c=2*(o*e-r*i),h=2*(r*n-s*e);return this.x=e+a*l+s*h-o*c,this.y=n+a*c+o*l-r*h,this.z=i+a*h+r*c-s*l,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=Cr(this.x,t.x,e.x),this.y=Cr(this.y,t.y,e.y),this.z=Cr(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=Cr(this.x,t,e),this.y=Cr(this.y,t,e),this.z=Cr(this.z,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Cr(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(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){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,s=e.x,o=e.y,a=e.z;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-i*s,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 as.copy(this).projectOnVector(t),this.sub(as)}reflect(t){return this.sub(as.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(Cr(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)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}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){return 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}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const as=new os,ls=new ss;class cs{constructor(t=new os(1/0,1/0,1/0),e=new os(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(us.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(us.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=us.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const n=t.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===e&&void 0!==i&&!0!==t.isInstancedMesh)for(let e=0,n=i.count;e<n;e++)!0===t.isMesh?t.getVertexPosition(e,us):us.fromBufferAttribute(i,e),us.applyMatrix4(t.matrixWorld),this.expandByPoint(us);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),ds.copy(t.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),ds.copy(n.boundingBox)),ds.applyMatrix4(t.matrixWorld),this.union(ds)}const i=t.children;for(let t=0,n=i.length;t<n;t++)this.expandByObject(i[t],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.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 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.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,us),us.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(ys),Es.subVectors(this.max,ys),ps.subVectors(t.a,ys),As.subVectors(t.b,ys),fs.subVectors(t.c,ys),ms.subVectors(As,ps),gs.subVectors(fs,As),vs.subVectors(ps,fs);let e=[0,-ms.z,ms.y,0,-gs.z,gs.y,0,-vs.z,vs.y,ms.z,0,-ms.x,gs.z,0,-gs.x,vs.z,0,-vs.x,-ms.y,ms.x,0,-gs.y,gs.x,0,-vs.y,vs.x,0];return!!Cs(e,ps,As,fs,Es)&&(e=[1,0,0,0,1,0,0,0,1],!!Cs(e,ps,As,fs,Es)&&(xs.crossVectors(ms,gs),e=[xs.x,xs.y,xs.z],Cs(e,ps,As,fs,Es)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,us).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(us).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()||(hs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),hs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),hs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),hs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),hs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),hs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),hs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),hs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(hs)),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 hs=[new os,new os,new os,new os,new os,new os,new os,new os],us=new os,ds=new cs,ps=new os,As=new os,fs=new os,ms=new os,gs=new os,vs=new os,ys=new os,Es=new os,xs=new os,bs=new os;function Cs(t,e,n,i,r){for(let s=0,o=t.length-3;s<=o;s+=3){bs.fromArray(t,s);const o=r.x*Math.abs(bs.x)+r.y*Math.abs(bs.y)+r.z*Math.abs(bs.z),a=e.dot(bs),l=n.dot(bs),c=i.dot(bs);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const ws=new cs,_s=new os,Ms=new os;class Ss{constructor(t=new os,e=-1){this.isSphere=!0,this.center=t,this.radius=e}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):ws.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;e<r;e++)i=Math.max(i,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return 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}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;_s.subVectors(t,this.center);const e=_s.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.addScaledVector(_s,n/t),this.radius+=n}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(Ms.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(_s.copy(t.center).add(Ms)),this.expandByPoint(_s.copy(t.center).sub(Ms))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const Is=new os,Bs=new os,Ts=new os,Rs=new os,Ls=new os,Ds=new os,Ps=new os;class Us{constructor(t=new os,e=new os(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Is)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Is.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Is.copy(this.origin).addScaledVector(this.direction,e),Is.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){Bs.copy(t).add(e).multiplyScalar(.5),Ts.copy(e).sub(t).normalize(),Rs.copy(this.origin).sub(Bs);const r=.5*t.distanceTo(e),s=-this.direction.dot(Ts),o=Rs.dot(this.direction),a=-Rs.dot(Ts),l=Rs.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*a-o,u=s*o-a,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+s*u+2*o)+u*(s*h+u+2*a)+l}else u=r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u=-r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;else u<=-p?(h=Math.max(0,-(-s*r+o)),u=h>0?-r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-a),r),d=u*(u+2*a)+l):(h=Math.max(0,-(s*r+o)),u=h>0?r:Math.min(Math.max(-r,-a),r),d=-h*h+u*(u+2*a)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+o)),d=-h*h+u*(u+2*a)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(Bs).addScaledVector(Ts,u),d}intersectSphere(t,e){Is.subVectors(t.center,this.origin);const n=Is.dot(this.direction),i=Is.dot(Is)-n*n,r=t.radius*t.radius;if(i>r)return null;const s=Math.sqrt(r-i),o=n-s,a=n+s;return a<0?null:o<0?this.at(a,e):this.at(o,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,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(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,s=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),n>s||r>i?null:((r>n||isNaN(n))&&(n=r),(s<i||isNaN(i))&&(i=s),h>=0?(o=(t.min.z-u.z)*h,a=(t.max.z-u.z)*h):(o=(t.max.z-u.z)*h,a=(t.min.z-u.z)*h),n>a||o>i?null:((o>n||n!=n)&&(n=o),(a<i||i!=i)&&(i=a),i<0?null:this.at(n>=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,Is)}intersectTriangle(t,e,n,i,r){Ls.subVectors(e,t),Ds.subVectors(n,t),Ps.crossVectors(Ls,Ds);let s,o=this.direction.dot(Ps);if(o>0){if(i)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}Rs.subVectors(this.origin,t);const a=s*this.direction.dot(Ds.crossVectors(Rs,Ds));if(a<0)return null;const l=s*this.direction.dot(Ls.cross(Rs));if(l<0)return null;if(a+l>o)return null;const c=-s*Rs.dot(Ps);return c<0?null:this.at(c/o,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)}clone(){return(new this.constructor).copy(this)}}class Os{constructor(t,e,n,i,r,s,o,a,l,c,h,u,d,p,A,f){Os.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,s,o,a,l,c,h,u,d,p,A,f)}set(t,e,n,i,r,s,o,a,l,c,h,u,d,p,A,f){const m=this.elements;return m[0]=t,m[4]=e,m[8]=n,m[12]=i,m[1]=r,m[5]=s,m[9]=o,m[13]=a,m[2]=l,m[6]=c,m[10]=h,m[14]=u,m[3]=d,m[7]=p,m[11]=A,m[15]=f,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 Os).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}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),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/Fs.setFromMatrixColumn(t,0).length(),r=1/Fs.setFromMatrixColumn(t,1).length(),s=1/Fs.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]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=s*c,n=s*h,i=o*c,r=o*h;e[0]=a*c,e[4]=-a*h,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-o*a,e[2]=r-t*l,e[6]=i+n*l,e[10]=s*a}else if("YXZ"===t.order){const t=a*c,n=a*h,i=l*c,r=l*h;e[0]=t+r*o,e[4]=i*o-n,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-o,e[2]=n*o-i,e[6]=r+t*o,e[10]=s*a}else if("ZXY"===t.order){const t=a*c,n=a*h,i=l*c,r=l*h;e[0]=t-r*o,e[4]=-s*h,e[8]=i+n*o,e[1]=n+i*o,e[5]=s*c,e[9]=r-t*o,e[2]=-s*l,e[6]=o,e[10]=s*a}else if("ZYX"===t.order){const t=s*c,n=s*h,i=o*c,r=o*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]=o*a,e[10]=s*a}else if("YZX"===t.order){const t=s*a,n=s*l,i=o*a,r=o*l;e[0]=a*c,e[4]=r-t*h,e[8]=i*h+n,e[1]=h,e[5]=s*c,e[9]=-o*c,e[2]=-l*c,e[6]=n*h+i,e[10]=t-r*h}else if("XZY"===t.order){const t=s*a,n=s*l,i=o*a,r=o*l;e[0]=a*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=s*c,e[9]=n*h-i,e[2]=i*h-n,e[6]=o*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(Ns,t,Qs)}lookAt(t,e,n){const i=this.elements;return Hs.subVectors(t,e),0===Hs.lengthSq()&&(Hs.z=1),Hs.normalize(),Gs.crossVectors(n,Hs),0===Gs.lengthSq()&&(1===Math.abs(n.z)?Hs.x+=1e-4:Hs.z+=1e-4,Hs.normalize(),Gs.crossVectors(n,Hs)),Gs.normalize(),zs.crossVectors(Hs,Gs),i[0]=Gs.x,i[4]=zs.x,i[8]=Hs.x,i[1]=Gs.y,i[5]=zs.y,i[9]=Hs.y,i[2]=Gs.z,i[6]=zs.z,i[10]=Hs.z,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,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],A=n[6],f=n[10],m=n[14],g=n[3],v=n[7],y=n[11],E=n[15],x=i[0],b=i[4],C=i[8],w=i[12],_=i[1],M=i[5],S=i[9],I=i[13],B=i[2],T=i[6],R=i[10],L=i[14],D=i[3],P=i[7],U=i[11],O=i[15];return r[0]=s*x+o*_+a*B+l*D,r[4]=s*b+o*M+a*T+l*P,r[8]=s*C+o*S+a*R+l*U,r[12]=s*w+o*I+a*L+l*O,r[1]=c*x+h*_+u*B+d*D,r[5]=c*b+h*M+u*T+d*P,r[9]=c*C+h*S+u*R+d*U,r[13]=c*w+h*I+u*L+d*O,r[2]=p*x+A*_+f*B+m*D,r[6]=p*b+A*M+f*T+m*P,r[10]=p*C+A*S+f*R+m*U,r[14]=p*w+A*I+f*L+m*O,r[3]=g*x+v*_+y*B+E*D,r[7]=g*b+v*M+y*T+E*P,r[11]=g*C+v*S+y*R+E*U,r[15]=g*w+v*I+y*L+E*O,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],s=t[1],o=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*o*u+n*l*u+i*o*d-n*a*d)+t[7]*(+e*a*d-e*l*u+r*s*u-i*s*d+i*l*c-r*a*c)+t[11]*(+e*l*h-e*o*d-r*s*h+n*s*d+r*o*c-n*l*c)+t[15]*(-i*o*c-e*a*h+e*o*u+i*s*h-n*s*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}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],s=t[4],o=t[5],a=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],A=t[13],f=t[14],m=t[15],g=h*f*l-A*u*l+A*a*d-o*f*d-h*a*m+o*u*m,v=p*u*l-c*f*l-p*a*d+s*f*d+c*a*m-s*u*m,y=c*A*l-p*h*l+p*o*d-s*A*d-c*o*m+s*h*m,E=p*h*a-c*A*a-p*o*u+s*A*u+c*o*f-s*h*f,x=e*g+n*v+i*y+r*E;if(0===x)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/x;return t[0]=g*b,t[1]=(A*u*r-h*f*r-A*i*d+n*f*d+h*i*m-n*u*m)*b,t[2]=(o*f*r-A*a*r+A*i*l-n*f*l-o*i*m+n*a*m)*b,t[3]=(h*a*r-o*u*r-h*i*l+n*u*l+o*i*d-n*a*d)*b,t[4]=v*b,t[5]=(c*f*r-p*u*r+p*i*d-e*f*d-c*i*m+e*u*m)*b,t[6]=(p*a*r-s*f*r-p*i*l+e*f*l+s*i*m-e*a*m)*b,t[7]=(s*u*r-c*a*r+c*i*l-e*u*l-s*i*d+e*a*d)*b,t[8]=y*b,t[9]=(p*h*r-c*A*r-p*n*d+e*A*d+c*n*m-e*h*m)*b,t[10]=(s*A*r-p*o*r+p*n*l-e*A*l-s*n*m+e*o*m)*b,t[11]=(c*o*r-s*h*r-c*n*l+e*h*l+s*n*d-e*o*d)*b,t[12]=E*b,t[13]=(c*A*i-p*h*i+p*n*u-e*A*u-c*n*f+e*h*f)*b,t[14]=(p*o*i-s*A*i-p*n*a+e*A*a+s*n*f-e*o*f)*b,t[15]=(s*h*i-c*o*i+c*n*a-e*h*a-s*n*u+e*o*u)*b,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 t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):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,s=t.x,o=t.y,a=t.z,l=r*s,c=r*o;return this.set(l*s+n,l*o-i*a,l*a+i*o,0,l*o+i*a,c*o+n,c*a-i*s,0,l*a-i*o,c*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(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,i,r,s){return this.set(1,n,r,0,t,1,s,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,s=e._y,o=e._z,a=e._w,l=r+r,c=s+s,h=o+o,u=r*l,d=r*c,p=r*h,A=s*c,f=s*h,m=o*h,g=a*l,v=a*c,y=a*h,E=n.x,x=n.y,b=n.z;return i[0]=(1-(A+m))*E,i[1]=(d+y)*E,i[2]=(p-v)*E,i[3]=0,i[4]=(d-y)*x,i[5]=(1-(u+m))*x,i[6]=(f+g)*x,i[7]=0,i[8]=(p+v)*b,i[9]=(f-g)*b,i[10]=(1-(u+A))*b,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=Fs.set(i[0],i[1],i[2]).length();const s=Fs.set(i[4],i[5],i[6]).length(),o=Fs.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],ks.copy(this);const a=1/r,l=1/s,c=1/o;return ks.elements[0]*=a,ks.elements[1]*=a,ks.elements[2]*=a,ks.elements[4]*=l,ks.elements[5]*=l,ks.elements[6]*=l,ks.elements[8]*=c,ks.elements[9]*=c,ks.elements[10]*=c,e.setFromRotationMatrix(ks),n.x=r,n.y=s,n.z=o,this}makePerspective(t,e,n,i,r,s,o=Ar){const a=this.elements,l=2*r/(e-t),c=2*r/(n-i),h=(e+t)/(e-t),u=(n+i)/(n-i);let d,p;if(o===Ar)d=-(s+r)/(s-r),p=-2*s*r/(s-r);else{if(o!==fr)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);d=-s/(s-r),p=-s*r/(s-r)}return a[0]=l,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=c,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(t,e,n,i,r,s,o=Ar){const a=this.elements,l=1/(e-t),c=1/(n-i),h=1/(s-r),u=(e+t)*l,d=(n+i)*c;let p,A;if(o===Ar)p=(s+r)*h,A=-2*h;else{if(o!==fr)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);p=r*h,A=-1*h}return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=A,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[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 Fs=new os,ks=new Os,Ns=new os(0,0,0),Qs=new os(1,1,1),Gs=new os,zs=new os,Hs=new os,Vs=new Os,js=new ss;class Ws{constructor(t=0,e=0,n=0,i=Ws.DEFAULT_ORDER){this.isEuler=!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=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,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=this._order,n=!0){const i=t.elements,r=i[0],s=i[4],o=i[8],a=i[1],l=i[5],c=i[9],h=i[2],u=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(Cr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Cr(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,d),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Cr(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-Cr(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Cr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,d));break;case"XZY":this._z=Math.asin(-Cr(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return Vs.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Vs,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return js.setFromEuler(this),this.setFromQuaternion(js,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}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ws.DEFAULT_ORDER="XYZ";class qs{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return!!(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let Xs=0;const Ys=new os,Js=new ss,Ks=new Os,Zs=new os,$s=new os,to=new os,eo=new ss,no=new os(1,0,0),io=new os(0,1,0),ro=new os(0,0,1),so={type:"added"},oo={type:"removed"},ao={type:"childadded",child:null},lo={type:"childremoved",child:null};class co extends gr{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Xs++}),this.uuid=br(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=co.DEFAULT_UP.clone();const t=new os,e=new Ws,n=new ss,i=new os(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Os},normalMatrix:{value:new Tr}}),this.matrix=new Os,this.matrixWorld=new Os,this.matrixAutoUpdate=co.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=co.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new qs,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Js.setFromAxisAngle(t,e),this.quaternion.multiply(Js),this}rotateOnWorldAxis(t,e){return Js.setFromAxisAngle(t,e),this.quaternion.premultiply(Js),this}rotateX(t){return this.rotateOnAxis(no,t)}rotateY(t){return this.rotateOnAxis(io,t)}rotateZ(t){return this.rotateOnAxis(ro,t)}translateOnAxis(t,e){return Ys.copy(t).applyQuaternion(this.quaternion),this.position.add(Ys.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(no,t)}translateY(t){return this.translateOnAxis(io,t)}translateZ(t){return this.translateOnAxis(ro,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Ks.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?Zs.copy(t):Zs.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),$s.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Ks.lookAt($s,Zs,this.up):Ks.lookAt(Zs,$s,this.up),this.quaternion.setFromRotationMatrix(Ks),i&&(Ks.extractRotation(i.matrixWorld),Js.setFromRotationMatrix(Ks),this.quaternion.premultiply(Js.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(so),ao.child=t,this.dispatchEvent(ao),ao.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(oo),lo.child=t,this.dispatchEvent(lo),lo.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Ks.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Ks.multiply(t.parent.matrixWorld)),t.applyMatrix4(Ks),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(so),ao.child=t,this.dispatchEvent(ao),ao.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);const i=this.children;for(let r=0,s=i.length;r<s;r++)i[r].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose($s,t,to),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose($s,eo,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].updateMatrixWorld(t)}updateWorldMatrix(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++)t[e].updateWorldMatrix(!1,!0)}}toJSON(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map((t=>({boxInitialized:t.boxInitialized,boxMin:t.box.min.toArray(),boxMax:t.box.max.toArray(),sphereInitialized:t.sphereInitialized,sphereRadius:t.sphere.radius,sphereCenter:t.sphere.center.toArray()}))),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(t),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e<i;e++){const i=n[e];r(t.shapes,i)}else r(t.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,i=this.material.length;n<i;n++)e.push(r(t.materials,this.material[n]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];i.animations.push(r(t.animations,n))}}if(e){const e=s(t.geometries),i=s(t.materials),r=s(t.textures),o=s(t.images),a=s(t.shapes),l=s(t.skeletons),c=s(t.animations),h=s(t.nodes);e.length>0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(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.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,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.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}}co.DEFAULT_UP=new os(0,1,0),co.DEFAULT_MATRIX_AUTO_UPDATE=!0,co.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ho=new os,uo=new os,po=new os,Ao=new os,fo=new os,mo=new os,go=new os,vo=new os,yo=new os,Eo=new os,xo=new Zr,bo=new Zr,Co=new Zr;class wo{constructor(t=new os,e=new os,n=new os){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),ho.subVectors(t,e),i.cross(ho);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){ho.subVectors(i,e),uo.subVectors(n,e),po.subVectors(t,e);const s=ho.dot(ho),o=ho.dot(uo),a=ho.dot(po),l=uo.dot(uo),c=uo.dot(po),h=s*l-o*o;if(0===h)return r.set(0,0,0),null;const u=1/h,d=(l*a-o*c)*u,p=(s*c-o*a)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return null!==this.getBarycoord(t,e,n,i,Ao)&&Ao.x>=0&&Ao.y>=0&&Ao.x+Ao.y<=1}static getInterpolation(t,e,n,i,r,s,o,a){return null===this.getBarycoord(t,e,n,i,Ao)?(a.x=0,a.y=0,"z"in a&&(a.z=0),"w"in a&&(a.w=0),null):(a.setScalar(0),a.addScaledVector(r,Ao.x),a.addScaledVector(s,Ao.y),a.addScaledVector(o,Ao.z),a)}static getInterpolatedAttribute(t,e,n,i,r,s){return xo.setScalar(0),bo.setScalar(0),Co.setScalar(0),xo.fromBufferAttribute(t,e),bo.fromBufferAttribute(t,n),Co.fromBufferAttribute(t,i),s.setScalar(0),s.addScaledVector(xo,r.x),s.addScaledVector(bo,r.y),s.addScaledVector(Co,r.z),s}static isFrontFacing(t,e,n,i){return ho.subVectors(n,e),uo.subVectors(t,e),ho.cross(uo).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}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(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 ho.subVectors(this.c,this.b),uo.subVectors(this.a,this.b),.5*ho.cross(uo).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return wo.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return wo.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,r){return wo.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return wo.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return wo.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let s,o;fo.subVectors(i,n),mo.subVectors(r,n),vo.subVectors(t,n);const a=fo.dot(vo),l=mo.dot(vo);if(a<=0&&l<=0)return e.copy(n);yo.subVectors(t,i);const c=fo.dot(yo),h=mo.dot(yo);if(c>=0&&h<=c)return e.copy(i);const u=a*h-c*l;if(u<=0&&a>=0&&c<=0)return s=a/(a-c),e.copy(n).addScaledVector(fo,s);Eo.subVectors(t,r);const d=fo.dot(Eo),p=mo.dot(Eo);if(p>=0&&d<=p)return e.copy(r);const A=d*l-a*p;if(A<=0&&l>=0&&p<=0)return o=l/(l-p),e.copy(n).addScaledVector(mo,o);const f=c*p-d*h;if(f<=0&&h-c>=0&&d-p>=0)return go.subVectors(r,i),o=(h-c)/(h-c+(d-p)),e.copy(i).addScaledVector(go,o);const m=1/(f+A+u);return s=A*m,o=u*m,e.copy(n).addScaledVector(fo,s).addScaledVector(mo,o)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const _o={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},Mo={h:0,s:0,l:0},So={h:0,s:0,l:0};function Io(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}class Bo{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(void 0===e&&void 0===n){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Bi){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,zr.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i=zr.workingColorSpace){return this.r=t,this.g=e,this.b=n,zr.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i=zr.workingColorSpace){if(t=wr(t,1),e=Cr(e,0,1),n=Cr(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=Io(r,i,t+1/3),this.g=Io(r,i,t),this.b=Io(r,i,t-1/3)}return zr.toWorkingColorSpace(this,i),this}setStyle(t,e=Bi){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const s=i[1],o=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(n,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Bi){const n=_o[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=Hr(t.r),this.g=Hr(t.g),this.b=Hr(t.b),this}copyLinearToSRGB(t){return this.r=Vr(t.r),this.g=Vr(t.g),this.b=Vr(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Bi){return zr.fromWorkingColorSpace(To.copy(this),t),65536*Math.round(Cr(255*To.r,0,255))+256*Math.round(Cr(255*To.g,0,255))+Math.round(Cr(255*To.b,0,255))}getHexString(t=Bi){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=zr.workingColorSpace){zr.fromWorkingColorSpace(To.copy(this),e);const n=To.r,i=To.g,r=To.b,s=Math.max(n,i,r),o=Math.min(n,i,r);let a,l;const c=(o+s)/2;if(o===s)a=0,l=0;else{const t=s-o;switch(l=c<=.5?t/(s+o):t/(2-s-o),s){case n:a=(i-r)/t+(i<r?6:0);break;case i:a=(r-n)/t+2;break;case r:a=(n-i)/t+4}a/=6}return t.h=a,t.s=l,t.l=c,t}getRGB(t,e=zr.workingColorSpace){return zr.fromWorkingColorSpace(To.copy(this),e),t.r=To.r,t.g=To.g,t.b=To.b,t}getStyle(t=Bi){zr.fromWorkingColorSpace(To.copy(this),t);const e=To.r,n=To.g,i=To.b;return t!==Bi?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(t,e,n){return this.getHSL(Mo),this.setHSL(Mo.h+t,Mo.s+e,Mo.l+n)}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(Mo),t.getHSL(So);const n=_r(Mo.h,So.h,e),i=_r(Mo.s,So.s,e),r=_r(Mo.l,So.l,e);return this.setHSL(n,i,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,n=this.g,i=this.b,r=t.elements;return this.r=r[0]*e+r[3]*n+r[6]*i,this.g=r[1]*e+r[4]*n+r[7]*i,this.b=r[2]*e+r[5]*n+r[8]*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}}const To=new Bo;Bo.NAMES=_o;let Ro=0;class Lo extends gr{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ro++}),this.uuid=br(),this.name="",this.type="Material",this.blending=qt,this.side=Ht,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=ae,this.blendDst=le,this.blendEquation=Zt,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Bo(0,0,0),this.blendAlpha=0,this.depthFunc=xe,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Xi,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Pi,this.stencilZFail=Pi,this.stencilZPass=Pi,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),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(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==qt&&(n.blending=this.blending),this.side!==Ht&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==ae&&(n.blendSrc=this.blendSrc),this.blendDst!==le&&(n.blendDst=this.blendDst),this.blendEquation!==Zt&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==xe&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Xi&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Pi&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Pi&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Pi&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),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=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(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(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,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.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,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.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Do extends Lo{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Bo(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ws,this.combine=Me,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(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.envMapRotation.copy(t.envMapRotation),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.fog=t.fog,this}}const Po=Uo();function Uo(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),i=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(i[t]=0,i[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(i[t]=1024>>-e-14,i[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(i[t]=e+15<<10,i[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(i[t]=31744,i[256|t]=64512,r[t]=24,r[256|t]=24):(i[t]=31744,i[256|t]=64512,r[t]=13,r[256|t]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,n=0;for(;!(8388608&e);)e<<=1,n-=8388608;e&=-8388609,n+=947912704,s[t]=e|n}for(let t=1024;t<2048;++t)s[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)o[t]=t<<23;o[31]=1199570944,o[32]=2147483648;for(let t=33;t<63;++t)o[t]=2147483648+(t-32<<23);o[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(a[t]=1024);return{floatView:e,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function Oo(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Cr(t,-65504,65504),Po.floatView[0]=t;const e=Po.uint32View[0],n=e>>23&511;return Po.baseTable[n]+((8388607&e)>>Po.shiftTable[n])}function Fo(t){const e=t>>10;return Po.uint32View[0]=Po.mantissaTable[Po.offsetTable[e]+(1023&t)]+Po.exponentTable[e],Po.floatView[0]}const ko={toHalfFloat:Oo,fromHalfFloat:Fo},No=new os,Qo=new Br;let Go=0;class zo{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Go++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=n,this.usage=ir,this.updateRanges=[],this.gpuType=un,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(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.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)Qo.fromBufferAttribute(this,e),Qo.applyMatrix3(t),this.setXY(e,Qo.x,Qo.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)No.fromBufferAttribute(this,e),No.applyMatrix3(t),this.setXYZ(e,No.x,No.y,No.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)No.fromBufferAttribute(this,e),No.applyMatrix4(t),this.setXYZ(e,No.x,No.y,No.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)No.fromBufferAttribute(this,e),No.applyNormalMatrix(t),this.setXYZ(e,No.x,No.y,No.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)No.fromBufferAttribute(this,e),No.transformDirection(t),this.setXYZ(e,No.x,No.y,No.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=Mr(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=Sr(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Mr(e,this.array)),e}setX(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Mr(e,this.array)),e}setY(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Mr(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Mr(e,this.array)),e}setW(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array),r=Sr(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==ir&&(t.usage=this.usage),t}}class Ho extends zo{constructor(t,e,n){super(new Int8Array(t),e,n)}}class Vo extends zo{constructor(t,e,n){super(new Uint8Array(t),e,n)}}class jo extends zo{constructor(t,e,n){super(new Uint8ClampedArray(t),e,n)}}class Wo extends zo{constructor(t,e,n){super(new Int16Array(t),e,n)}}class qo extends zo{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Xo extends zo{constructor(t,e,n){super(new Int32Array(t),e,n)}}class Yo extends zo{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class Jo extends zo{constructor(t,e,n){super(new Uint16Array(t),e,n),this.isFloat16BufferAttribute=!0}getX(t){let e=Fo(this.array[t*this.itemSize]);return this.normalized&&(e=Mr(e,this.array)),e}setX(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize]=Oo(e),this}getY(t){let e=Fo(this.array[t*this.itemSize+1]);return this.normalized&&(e=Mr(e,this.array)),e}setY(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+1]=Oo(e),this}getZ(t){let e=Fo(this.array[t*this.itemSize+2]);return this.normalized&&(e=Mr(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+2]=Oo(e),this}getW(t){let e=Fo(this.array[t*this.itemSize+3]);return this.normalized&&(e=Mr(e,this.array)),e}setW(t,e){return this.normalized&&(e=Sr(e,this.array)),this.array[t*this.itemSize+3]=Oo(e),this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array)),this.array[t+0]=Oo(e),this.array[t+1]=Oo(n),this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array)),this.array[t+0]=Oo(e),this.array[t+1]=Oo(n),this.array[t+2]=Oo(i),this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array),r=Sr(r,this.array)),this.array[t+0]=Oo(e),this.array[t+1]=Oo(n),this.array[t+2]=Oo(i),this.array[t+3]=Oo(r),this}}class Ko extends zo{constructor(t,e,n){super(new Float32Array(t),e,n)}}let Zo=0;const $o=new Os,ta=new co,ea=new os,na=new cs,ia=new cs,ra=new os;class sa extends gr{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Zo++}),this.uuid=br(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=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(t){return Array.isArray(t)?this.index=new(Lr(t)?Yo:qo)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(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 Tr).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}applyQuaternion(t){return $o.makeRotationFromQuaternion(t),this.applyMatrix4($o),this}rotateX(t){return $o.makeRotationX(t),this.applyMatrix4($o),this}rotateY(t){return $o.makeRotationY(t),this.applyMatrix4($o),this}rotateZ(t){return $o.makeRotationZ(t),this.applyMatrix4($o),this}translate(t,e,n){return $o.makeTranslation(t,e,n),this.applyMatrix4($o),this}scale(t,e,n){return $o.makeScale(t,e,n),this.applyMatrix4($o),this}lookAt(t){return ta.lookAt(t),ta.updateMatrix(),this.applyMatrix4(ta.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ea).negate(),this.translate(ea.x,ea.y,ea.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];e.push(i.x,i.y,i.z||0)}this.setAttribute("position",new Ko(e,3))}else{const n=Math.min(t.length,e.count);for(let i=0;i<n;i++){const n=t[i];e.setXYZ(i,n.x,n.y,n.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new cs);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.",this),void this.boundingBox.set(new os(-1/0,-1/0,-1/0),new os(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];na.setFromBufferAttribute(n),this.morphTargetsRelative?(ra.addVectors(this.boundingBox.min,na.min),this.boundingBox.expandByPoint(ra),ra.addVectors(this.boundingBox.max,na.max),this.boundingBox.expandByPoint(ra)):(this.boundingBox.expandByPoint(na.min),this.boundingBox.expandByPoint(na.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Ss);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new os,1/0);if(t){const n=this.boundingSphere.center;if(na.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];ia.setFromBufferAttribute(n),this.morphTargetsRelative?(ra.addVectors(na.min,ia.min),na.expandByPoint(ra),ra.addVectors(na.max,ia.max),na.expandByPoint(ra)):(na.expandByPoint(ia.min),na.expandByPoint(ia.max))}na.getCenter(n);let i=0;for(let e=0,r=t.count;e<r;e++)ra.fromBufferAttribute(t,e),i=Math.max(i,n.distanceToSquared(ra));if(e)for(let r=0,s=e.length;r<s;r++){const s=e[r],o=this.morphTargetsRelative;for(let e=0,r=s.count;e<r;e++)ra.fromBufferAttribute(s,e),o&&(ea.fromBufferAttribute(t,e),ra.add(ea)),i=Math.max(i,n.distanceToSquared(ra))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=e.position,i=e.normal,r=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new zo(new Float32Array(4*n.count),4));const s=this.getAttribute("tangent"),o=[],a=[];for(let t=0;t<n.count;t++)o[t]=new os,a[t]=new os;const l=new os,c=new os,h=new os,u=new Br,d=new Br,p=new Br,A=new os,f=new os;function m(t,e,i){l.fromBufferAttribute(n,t),c.fromBufferAttribute(n,e),h.fromBufferAttribute(n,i),u.fromBufferAttribute(r,t),d.fromBufferAttribute(r,e),p.fromBufferAttribute(r,i),c.sub(l),h.sub(l),d.sub(u),p.sub(u);const s=1/(d.x*p.y-p.x*d.y);isFinite(s)&&(A.copy(c).multiplyScalar(p.y).addScaledVector(h,-d.y).multiplyScalar(s),f.copy(h).multiplyScalar(d.x).addScaledVector(c,-p.x).multiplyScalar(s),o[t].add(A),o[e].add(A),o[i].add(A),a[t].add(f),a[e].add(f),a[i].add(f))}let g=this.groups;0===g.length&&(g=[{start:0,count:t.count}]);for(let e=0,n=g.length;e<n;++e){const n=g[e],i=n.start;for(let e=i,r=i+n.count;e<r;e+=3)m(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const v=new os,y=new os,E=new os,x=new os;function b(t){E.fromBufferAttribute(i,t),x.copy(E);const e=o[t];v.copy(e),v.sub(E.multiplyScalar(E.dot(e))).normalize(),y.crossVectors(x,e);const n=y.dot(a[t])<0?-1:1;s.setXYZW(t,v.x,v.y,v.z,n)}for(let e=0,n=g.length;e<n;++e){const n=g[e],i=n.start;for(let e=i,r=i+n.count;e<r;e+=3)b(t.getX(e+0)),b(t.getX(e+1)),b(t.getX(e+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new zo(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const i=new os,r=new os,s=new os,o=new os,a=new os,l=new os,c=new os,h=new os;if(t)for(let u=0,d=t.count;u<d;u+=3){const d=t.getX(u+0),p=t.getX(u+1),A=t.getX(u+2);i.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),s.fromBufferAttribute(e,A),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),o.fromBufferAttribute(n,d),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,A),o.add(c),a.add(c),l.add(c),n.setXYZ(d,o.x,o.y,o.z),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(A,l.x,l.y,l.z)}else for(let t=0,o=e.count;t<o;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),s.fromBufferAttribute(e,t+2),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),n.setXYZ(t+0,c.x,c.y,c.z),n.setXYZ(t+1,c.x,c.y,c.z),n.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)ra.fromBufferAttribute(t,e),ra.normalize(),t.setXYZ(e,ra.x,ra.y,ra.z)}toNonIndexed(){function t(t,e){const n=t.array,i=t.itemSize,r=t.normalized,s=new n.constructor(e.length*i);let o=0,a=0;for(let r=0,l=e.length;r<l;r++){o=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*i;for(let t=0;t<i;t++)s[a++]=n[o++]}return new zo(s,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new sa,n=this.index.array,i=this.attributes;for(const r in i){const s=t(i[r],n);e.setAttribute(r,s)}const r=this.morphAttributes;for(const i in r){const s=[],o=r[i];for(let e=0,i=o.length;e<i;e++){const i=t(o[e],n);s.push(i)}e.morphAttributes[i]=s}e.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let t=0,n=s.length;t<n;t++){const n=s[t];e.addGroup(n.start,n.count,n.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(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];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],s=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];s.push(i.toJSON(t.data))}s.length>0&&(i[e]=s,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(t.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),t}clone(){return(new this.constructor).copy(this)}copy(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;t<r;t++)n.push(i[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const s=t.groups;for(let t=0,e=s.length;t<e;t++){const e=s[t];this.addGroup(e.start,e.count,e.materialIndex)}const o=t.boundingBox;null!==o&&(this.boundingBox=o.clone());const a=t.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const oa=new Os,aa=new Us,la=new Ss,ca=new os,ha=new os,ua=new os,da=new os,pa=new os,Aa=new os,fa=new os,ma=new os;class ga extends co{constructor(t=new sa,e=new Do){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;e.fromBufferAttribute(i,t);const o=this.morphTargetInfluences;if(r&&o){Aa.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=o[n],a=r[n];0!==i&&(pa.fromBufferAttribute(a,t),s?Aa.addScaledVector(pa,i):Aa.addScaledVector(pa.sub(e),i))}e.add(Aa)}return e}raycast(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),la.copy(n.boundingSphere),la.applyMatrix4(r),aa.copy(t.ray).recast(t.near),!1===la.containsPoint(aa.origin)){if(null===aa.intersectSphere(la,ca))return;if(aa.origin.distanceToSquared(ca)>(t.far-t.near)**2)return}oa.copy(r).invert(),aa.copy(t.ray).applyMatrix4(oa),null!==n.boundingBox&&!1===aa.intersectsBox(n.boundingBox)||this._computeIntersections(t,e,aa)}}_computeIntersections(t,e,n){let i;const r=this.geometry,s=this.material,o=r.index,a=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==o)if(Array.isArray(s))for(let r=0,a=u.length;r<a;r++){const a=u[r],p=s[a.materialIndex];for(let r=Math.max(a.start,d.start),s=Math.min(o.count,Math.min(a.start+a.count,d.start+d.count));r<s;r+=3)i=va(this,p,t,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=a.materialIndex,e.push(i))}else for(let r=Math.max(0,d.start),a=Math.min(o.count,d.start+d.count);r<a;r+=3)i=va(this,s,t,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),e.push(i));else if(void 0!==a)if(Array.isArray(s))for(let r=0,o=u.length;r<o;r++){const o=u[r],p=s[o.materialIndex];for(let r=Math.max(o.start,d.start),s=Math.min(a.count,Math.min(o.start+o.count,d.start+d.count));r<s;r+=3)i=va(this,p,t,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,e.push(i))}else for(let r=Math.max(0,d.start),o=Math.min(a.count,d.start+d.count);r<o;r+=3)i=va(this,s,t,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),e.push(i))}}function va(t,e,n,i,r,s,o,a,l,c){t.getVertexPosition(a,ha),t.getVertexPosition(l,ua),t.getVertexPosition(c,da);const h=function(t,e,n,i,r,s,o,a){let l;if(l=e.side===Vt?i.intersectTriangle(o,s,r,!0,a):i.intersectTriangle(r,s,o,e.side===Ht,a),null===l)return null;ma.copy(a),ma.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(ma);return c<n.near||c>n.far?null:{distance:c,point:ma.clone(),object:t}}(t,e,n,i,ha,ua,da,fa);if(h){const t=new os;wo.getBarycoord(fa,ha,ua,da,t),r&&(h.uv=wo.getInterpolatedAttribute(r,a,l,c,t,new Br)),s&&(h.uv1=wo.getInterpolatedAttribute(s,a,l,c,t,new Br)),o&&(h.normal=wo.getInterpolatedAttribute(o,a,l,c,t,new os),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const e={a,b:l,c,normal:new os,materialIndex:0};wo.getNormal(ha,ua,da,e.normal),h.face=e,h.barycoord=t}return h}class ya extends sa{constructor(t=1,e=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const a=[],l=[],c=[],h=[];let u=0,d=0;function p(t,e,n,i,r,s,p,A,f,m,g){const v=s/f,y=p/m,E=s/2,x=p/2,b=A/2,C=f+1,w=m+1;let _=0,M=0;const S=new os;for(let s=0;s<w;s++){const o=s*y-x;for(let a=0;a<C;a++){const u=a*v-E;S[t]=u*i,S[e]=o*r,S[n]=b,l.push(S.x,S.y,S.z),S[t]=0,S[e]=0,S[n]=A>0?1:-1,c.push(S.x,S.y,S.z),h.push(a/f),h.push(1-s/m),_+=1}}for(let t=0;t<m;t++)for(let e=0;e<f;e++){const n=u+e+C*t,i=u+e+C*(t+1),r=u+(e+1)+C*(t+1),s=u+(e+1)+C*t;a.push(n,i,s),a.push(i,r,s),M+=6}o.addGroup(d,M,g),d+=M,u+=_}p("z","y","x",-1,-1,n,e,t,s,r,0),p("z","y","x",1,-1,n,e,-t,s,r,1),p("x","z","y",1,1,t,n,e,i,s,2),p("x","z","y",1,-1,t,n,-e,i,s,3),p("x","y","z",1,-1,t,e,n,i,r,4),p("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(a),this.setAttribute("position",new Ko(l,3)),this.setAttribute("normal",new Ko(c,3)),this.setAttribute("uv",new Ko(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ya(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function Ea(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function xa(t){const e={};for(let n=0;n<t.length;n++){const i=Ea(t[n]);for(const t in i)e[t]=i[t]}return e}function ba(t){const e=t.getRenderTarget();return null===e?t.outputColorSpace:!0===e.isXRRenderTarget?e.texture.colorSpace:zr.workingColorSpace}const Ca={clone:Ea,merge:xa};class wa extends Lo{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ea(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?e.uniforms[n]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[n]={type:"m4",value:i.toArray()}:e.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;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}}class _a extends co{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Os,this.projectionMatrix=new Os,this.projectionMatrixInverse=new Os,this.coordinateSystem=Ar}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const Ma=new os,Sa=new Br,Ia=new Br;class Ba extends _a{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(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(t){const e=.5*this.getFilmHeight()/t;this.fov=2*xr*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*Er*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*xr*Math.atan(Math.tan(.5*Er*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){Ma.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Ma.x,Ma.y).multiplyScalar(-t/Ma.z),Ma.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Ma.x,Ma.y).multiplyScalar(-t/Ma.z)}getViewSize(t,e){return this.getViewBounds(t,Sa,Ia),e.subVectors(Ia,Sa)}setViewOffset(t,e,n,i,r,s){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=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*Er*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,o=s.fullHeight;r+=s.offsetX*i/t,e-=s.offsetY*n/o,i*=s.width/t,n*=s.height/o}const o=this.filmOffset;0!==o&&(r+=t*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(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 Ta=-90;class Ra extends co{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Ba(Ta,1,t,e);i.layers=this.layers,this.add(i);const r=new Ba(Ta,1,t,e);r.layers=this.layers,this.add(r);const s=new Ba(Ta,1,t,e);s.layers=this.layers,this.add(s);const o=new Ba(Ta,1,t,e);o.layers=this.layers,this.add(o);const a=new Ba(Ta,1,t,e);a.layers=this.layers,this.add(a);const l=new Ba(Ta,1,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,i,r,s,o,a]=e;for(const t of e)this.remove(t);if(t===Ar)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),a.up.set(0,1,0),a.lookAt(0,0,-1);else{if(t!==fr)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),a.up.set(0,-1,0),a.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,s,o,a,l,c]=this.children,h=t.getRenderTarget(),u=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const A=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,i),t.render(e,r),t.setRenderTarget(n,1,i),t.render(e,s),t.setRenderTarget(n,2,i),t.render(e,o),t.setRenderTarget(n,3,i),t.render(e,a),t.setRenderTarget(n,4,i),t.render(e,l),n.texture.generateMipmaps=A,t.setRenderTarget(n,5,i),t.render(e,c),t.setRenderTarget(h,u,d),t.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class La extends Kr{constructor(t,e,n,i,r,s,o,a,l,c){super(t=void 0!==t?t:[],e=void 0!==e?e:Qe,n,i,r,s,o,a,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class Da extends ts{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new La(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:$e}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,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\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",s=new ya(5,5,5),o=new wa({name:"CubemapFromEquirect",uniforms:Ea(n),vertexShader:i,fragmentShader:r,side:Vt,blending:Wt});o.uniforms.tEquirect.value=e;const a=new ga(s,o),l=e.minFilter;return e.minFilter===nn&&(e.minFilter=$e),new Ra(1,10,this).update(t,a),e.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(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)}}class Pa extends co{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Ua={type:"move"};class Oa{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Pa,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Pa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new os,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new os),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Pa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new os,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new os),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(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(t,e,n){let i=null,r=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(l&&t.hand){s=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n),r=this._getHandJoint(l,i);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=i.position.distanceTo(r.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else 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),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));null!==o&&(i=e.getPose(t.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(Ua)))}return null!==o&&(o.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const n=new Pa;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}class Fa{constructor(t,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new Bo(t),this.density=e}clone(){return new Fa(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class ka{constructor(t,e=1,n=1e3){this.isFog=!0,this.name="",this.color=new Bo(t),this.near=e,this.far=n}clone(){return new ka(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Na extends co{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ws,this.environmentIntensity=1,this.environmentRotation=new Ws,this.overrideMaterial=null,"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()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class Qa{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=ir,this.updateRanges=[],this.version=0,this.uuid=br()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,n){t*=this.stride,n*=e.stride;for(let i=0,r=this.stride;i<r;i++)this.array[t+i]=e.array[n+i];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=br()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(e,this.stride);return n.setUsage(this.usage),n}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=br()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Ga=new os;class za{constructor(t,e,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,n=this.data.count;e<n;e++)Ga.fromBufferAttribute(this,e),Ga.applyMatrix4(t),this.setXYZ(e,Ga.x,Ga.y,Ga.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Ga.fromBufferAttribute(this,e),Ga.applyNormalMatrix(t),this.setXYZ(e,Ga.x,Ga.y,Ga.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Ga.fromBufferAttribute(this,e),Ga.transformDirection(t),this.setXYZ(e,Ga.x,Ga.y,Ga.z);return this}getComponent(t,e){let n=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(n=Mr(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=Sr(n,this.array)),this.data.array[t*this.data.stride+this.offset+e]=n,this}setX(t,e){return this.normalized&&(e=Sr(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=Sr(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=Sr(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=Sr(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Mr(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Mr(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Mr(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Mr(e,this.array)),e}setXY(t,e,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this}setXYZ(t,e,n,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=Sr(e,this.array),n=Sr(n,this.array),i=Sr(i,this.array),r=Sr(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=n,this.data.array[t+2]=i,this.data.array[t+3]=r,this}clone(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return new zo(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new za(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const n=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[n+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class Ha extends Lo{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new Bo(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}let Va;const ja=new os,Wa=new os,qa=new os,Xa=new Br,Ya=new Br,Ja=new Os,Ka=new os,Za=new os,$a=new os,tl=new Br,el=new Br,nl=new Br;class il extends co{constructor(t=new Ha){if(super(),this.isSprite=!0,this.type="Sprite",void 0===Va){Va=new sa;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),e=new Qa(t,5);Va.setIndex([0,1,2,0,2,3]),Va.setAttribute("position",new za(e,3,0,!1)),Va.setAttribute("uv",new za(e,2,3,!1))}this.geometry=Va,this.material=t,this.center=new Br(.5,.5)}raycast(t,e){null===t.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Wa.setFromMatrixScale(this.matrixWorld),Ja.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),qa.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Wa.multiplyScalar(-qa.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const s=this.center;rl(Ka.set(-.5,-.5,0),qa,s,Wa,i,r),rl(Za.set(.5,-.5,0),qa,s,Wa,i,r),rl($a.set(.5,.5,0),qa,s,Wa,i,r),tl.set(0,0),el.set(1,0),nl.set(1,1);let o=t.ray.intersectTriangle(Ka,Za,$a,!1,ja);if(null===o&&(rl(Za.set(-.5,.5,0),qa,s,Wa,i,r),el.set(0,1),o=t.ray.intersectTriangle(Ka,$a,Za,!1,ja),null===o))return;const a=t.ray.origin.distanceTo(ja);a<t.near||a>t.far||e.push({distance:a,point:ja.clone(),uv:wo.getInterpolation(ja,Ka,Za,$a,tl,el,nl,new Br),face:null,object:this})}copy(t,e){return super.copy(t,e),void 0!==t.center&&this.center.copy(t.center),this.material=t.material,this}}function rl(t,e,n,i,r,s){Xa.subVectors(t,n).addScalar(.5).multiply(i),void 0!==r?(Ya.x=s*Xa.x-r*Xa.y,Ya.y=r*Xa.x+s*Xa.y):Ya.copy(Xa),t.copy(e),t.x+=Ya.x,t.y+=Ya.y,t.applyMatrix4(Ja)}const sl=new os,ol=new os;class al extends co{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const e=t.levels;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.addLevel(n.object.clone(),n.distance,n.hysteresis)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,e=0,n=0){e=Math.abs(e);const i=this.levels;let r;for(r=0;r<i.length&&!(e<i[r].distance);r++);return i.splice(r,0,{distance:e,hysteresis:n,object:t}),this.add(t),this}removeLevel(t){const e=this.levels;for(let n=0;n<e.length;n++)if(e[n].distance===t){const t=e.splice(n,1);return this.remove(t[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const e=this.levels;if(e.length>0){let n,i;for(n=1,i=e.length;n<i;n++){let i=e[n].distance;if(e[n].object.visible&&(i-=i*e[n].hysteresis),t<i)break}return e[n-1].object}return null}raycast(t,e){if(this.levels.length>0){sl.setFromMatrixPosition(this.matrixWorld);const n=t.ray.origin.distanceTo(sl);this.getObjectForDistance(n).raycast(t,e)}}update(t){const e=this.levels;if(e.length>1){sl.setFromMatrixPosition(t.matrixWorld),ol.setFromMatrixPosition(this.matrixWorld);const n=sl.distanceTo(ol)/t.zoom;let i,r;for(e[0].object.visible=!0,i=1,r=e.length;i<r;i++){let t=e[i].distance;if(e[i].object.visible&&(t-=t*e[i].hysteresis),!(n>=t))break;e[i-1].object.visible=!1,e[i].object.visible=!0}for(this._currentLevel=i-1;i<r;i++)e[i].object.visible=!1}}toJSON(t){const e=super.toJSON(t);!1===this.autoUpdate&&(e.object.autoUpdate=!1),e.object.levels=[];const n=this.levels;for(let t=0,i=n.length;t<i;t++){const i=n[t];e.object.levels.push({object:i.object.uuid,distance:i.distance,hysteresis:i.hysteresis})}return e}}const ll=new os,cl=new Zr,hl=new Zr,ul=new os,dl=new Os,pl=new os,Al=new Ss,fl=new Os,ml=new Us;class gl extends ga{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Fe,this.bindMatrix=new Os,this.bindMatrixInverse=new Os,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new cs),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,pl),this.boundingBox.expandByPoint(pl)}computeBoundingSphere(){const t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new Ss),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,pl),this.boundingSphere.expandByPoint(pl)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),Al.copy(this.boundingSphere),Al.applyMatrix4(i),!1!==t.ray.intersectsSphere(Al)&&(fl.copy(i).invert(),ml.copy(t.ray).applyMatrix4(fl),null!==this.boundingBox&&!1===ml.intersectsBox(this.boundingBox)||this._computeIntersections(t,e,ml)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Zr,e=this.geometry.attributes.skinWeight;for(let n=0,i=e.count;n<i;n++){t.fromBufferAttribute(e,n);const i=1/t.manhattanLength();i!==1/0?t.multiplyScalar(i):t.set(1,0,0,0),e.setXYZW(n,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===Fe?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===ke?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const n=this.skeleton,i=this.geometry;cl.fromBufferAttribute(i.attributes.skinIndex,t),hl.fromBufferAttribute(i.attributes.skinWeight,t),ll.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const i=hl.getComponent(t);if(0!==i){const r=cl.getComponent(t);dl.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),e.addScaledVector(ul.copy(ll).applyMatrix4(dl),i)}}return e.applyMatrix4(this.bindMatrixInverse)}}class vl extends co{constructor(){super(),this.isBone=!0,this.type="Bone"}}class yl extends Kr{constructor(t=null,e=1,n=1,i,r,s,o,a,l=Xe,c=Xe,h,u){super(null,s,o,a,l,c,i,r,h,u),this.isDataTexture=!0,this.image={data:t,width:e,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const El=new Os,xl=new Os;class bl{constructor(t=[],e=[]){this.uuid=br(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new Os)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new Os;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=t.length;i<r;i++){const r=t[i]?t[i].matrixWorld:xl;El.multiplyMatrices(r,e[i]),El.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new bl(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const n=new yl(e,t,t,yn,un);return n.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=n,this}getBoneByName(t){for(let e=0,n=this.bones.length;e<n;e++){const n=this.bones[e];if(n.name===t)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let n=0,i=t.bones.length;n<i;n++){const i=t.bones[n];let r=e[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new vl),this.bones.push(r),this.boneInverses.push((new Os).fromArray(t.boneInverses[n]))}return this.init(),this}toJSON(){const t={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,n=this.boneInverses;for(let i=0,r=e.length;i<r;i++){const r=e[i];t.bones.push(r.uuid);const s=n[i];t.boneInverses.push(s.toArray())}return t}}class Cl extends zo{constructor(t,e,n,i=1){super(t,e,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const wl=new Os,_l=new Os,Ml=[],Sl=new cs,Il=new Os,Bl=new ga,Tl=new Ss;class Rl extends ga{constructor(t,e,n){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new Cl(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let t=0;t<n;t++)this.setMatrixAt(t,Il)}computeBoundingBox(){const t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new cs),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,wl),Sl.copy(t.boundingBox).applyMatrix4(wl),this.boundingBox.union(Sl)}computeBoundingSphere(){const t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new Ss),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<e;n++)this.getMatrixAt(n,wl),Tl.copy(t.boundingSphere).applyMatrix4(wl),this.boundingSphere.union(Tl)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.morphTexture&&(this.morphTexture=t.morphTexture.clone()),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){const n=e.morphTargetInfluences,i=this.morphTexture.source.data.data,r=t*(n.length+1)+1;for(let t=0;t<n.length;t++)n[t]=i[r+t]}raycast(t,e){const n=this.matrixWorld,i=this.count;if(Bl.geometry=this.geometry,Bl.material=this.material,void 0!==Bl.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Tl.copy(this.boundingSphere),Tl.applyMatrix4(n),!1!==t.ray.intersectsSphere(Tl)))for(let r=0;r<i;r++){this.getMatrixAt(r,wl),_l.multiplyMatrices(n,wl),Bl.matrixWorld=_l,Bl.raycast(t,Ml);for(let t=0,n=Ml.length;t<n;t++){const n=Ml[t];n.instanceId=r,n.object=this,e.push(n)}Ml.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new Cl(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}setMorphAt(t,e){const n=e.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new yl(new Float32Array(i*this.count),i,this.count,wn,un));const r=this.morphTexture.source.data.data;let s=0;for(let t=0;t<n.length;t++)s+=n[t];const o=this.geometry.morphTargetsRelative?1:1-s,a=i*t;r[a]=o,r.set(n,a+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}}const Ll=new os,Dl=new os,Pl=new Tr;class Ul{constructor(t=new os(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=Ll.subVectors(n,e).cross(Dl.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(Ll),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)}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 t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||Pl.getNormalMatrix(t),i=this.coplanarPoint(Ll).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}clone(){return(new this.constructor).copy(this)}}const Ol=new Ss,Fl=new os;class kl{constructor(t=new Ul,e=new Ul,n=new Ul,i=new Ul,r=new Ul,s=new Ul){this.planes=[t,e,n,i,r,s]}set(t,e,n,i,r,s){const o=this.planes;return o[0].copy(t),o[1].copy(e),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=Ar){const n=this.planes,i=t.elements,r=i[0],s=i[1],o=i[2],a=i[3],l=i[4],c=i[5],h=i[6],u=i[7],d=i[8],p=i[9],A=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];if(n[0].setComponents(a-r,u-l,f-d,y-m).normalize(),n[1].setComponents(a+r,u+l,f+d,y+m).normalize(),n[2].setComponents(a+s,u+c,f+p,y+g).normalize(),n[3].setComponents(a-s,u-c,f-p,y-g).normalize(),n[4].setComponents(a-o,u-h,f-A,y-v).normalize(),e===Ar)n[5].setComponents(a+o,u+h,f+A,y+v).normalize();else{if(e!==fr)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);n[5].setComponents(o,h,A,v).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),Ol.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),Ol.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Ol)}intersectsSprite(t){return Ol.center.set(0,0,0),Ol.radius=.7071067811865476,Ol.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ol)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++)if(e[t].distanceToPoint(n)<i)return!1;return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(Fl.x=i.normal.x>0?t.max.x:t.min.x,Fl.y=i.normal.y>0?t.max.y:t.min.y,Fl.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Fl)<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}clone(){return(new this.constructor).copy(this)}}function Nl(t,e){return t-e}function Ql(t,e){return t.z-e.z}function Gl(t,e){return e.z-t.z}class zl{constructor(){this.index=0,this.pool=[],this.list=[]}push(t,e,n,i){const r=this.pool,s=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const o=r[this.index];s.push(o),this.index++,o.start=t,o.count=e,o.z=n,o.index=i}reset(){this.list.length=0,this.index=0}}const Hl=new Os,Vl=new Bo(1,1,1),jl=new kl,Wl=new cs,ql=new Ss,Xl=new os,Yl=new os,Jl=new os,Kl=new zl,Zl=new ga,$l=[];function tc(t,e,n=0){const i=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const r=t.count;for(let s=0;s<r;s++)for(let r=0;r<i;r++)e.setComponent(s+n,r,t.getComponent(s,r))}else e.array.set(t.array,n*i);e.needsUpdate=!0}function ec(t,e){if(t.constructor!==e.constructor){const n=Math.min(t.length,e.length);for(let i=0;i<n;i++)e[i]=t[i]}else{const n=Math.min(t.length,e.length);e.set(new t.constructor(t.buffer,0,n))}}class nc extends ga{get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}constructor(t,e,n=2*e,i){super(new sa,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=t,this._maxVertexCount=e,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(t),this._multiDrawStarts=new Int32Array(t),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let t=Math.sqrt(4*this._maxInstanceCount);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4),n=new yl(e,t,t,yn,un);this._matricesTexture=n}_initIndirectTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);const e=new Uint32Array(t*t),n=new yl(e,t,t,_n,hn);this._indirectTexture=n}_initColorsTexture(){let t=Math.sqrt(this._maxInstanceCount);t=Math.ceil(t);const e=new Float32Array(t*t*4).fill(1),n=new yl(e,t,t,yn,un);n.colorSpace=zr.workingColorSpace,this._colorsTexture=n}_initializeGeometry(t){const e=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(!1===this._geometryInitialized){for(const i in t.attributes){const r=t.getAttribute(i),{array:s,itemSize:o,normalized:a}=r,l=new s.constructor(n*o),c=new zo(l,o,a);e.setAttribute(i,c)}if(null!==t.getIndex()){const t=n>65535?new Uint32Array(i):new Uint16Array(i);e.setIndex(new zo(t,1))}this._geometryInitialized=!0}}_validateGeometry(t){const e=this.geometry;if(Boolean(t.getIndex())!==Boolean(e.getIndex()))throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in e.attributes){if(!t.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=t.getAttribute(n),r=e.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(t){const e=this._instanceInfo;if(t<0||t>=e.length||!1===e[t].active)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${t}. Instance is either out of range or has been deleted.`)}validateGeometryId(t){const e=this._geometryInfo;if(t<0||t>=e.length||!1===e[t].active)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${t}. Geometry is either out of range or has been deleted.`)}setCustomSort(t){return this.customSort=t,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new cs);const t=this.boundingBox,e=this._instanceInfo;t.makeEmpty();for(let n=0,i=e.length;n<i;n++){if(!1===e[n].active)continue;const i=e[n].geometryIndex;this.getMatrixAt(n,Hl),this.getBoundingBoxAt(i,Wl).applyMatrix4(Hl),t.union(Wl)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new Ss);const t=this.boundingSphere,e=this._instanceInfo;t.makeEmpty();for(let n=0,i=e.length;n<i;n++){if(!1===e[n].active)continue;const i=e[n].geometryIndex;this.getMatrixAt(n,Hl),this.getBoundingSphereAt(i,ql).applyMatrix4(Hl),t.union(ql)}}addInstance(t){if(this._instanceInfo.length>=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const e={visible:!0,active:!0,geometryIndex:t};let n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Nl),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=e):(n=this._instanceInfo.length,this._instanceInfo.push(e));const i=this._matricesTexture;Hl.identity().toArray(i.image.data,16*n),i.needsUpdate=!0;const r=this._colorsTexture;return r&&(Vl.toArray(r.image.data,4*n),r.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(t,e=-1,n=-1){this._initializeGeometry(t),this._validateGeometry(t);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=-1===e?t.getAttribute("position").count:e;const s=t.getIndex();if(null!==s&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=-1===n?s.count:n),-1!==i.indexStart&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let o;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Nl),o=this._availableGeometryIds.shift(),r[o]=i):(o=this._geometryCount,this._geometryCount++,r.push(i)),this.setGeometryAt(o,t),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,o}setGeometryAt(t,e){if(t>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const n=this.geometry,i=null!==n.getIndex(),r=n.getIndex(),s=e.getIndex(),o=this._geometryInfo[t];if(i&&s.count>o.reservedIndexCount||e.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const a=o.vertexStart,l=o.reservedVertexCount;o.vertexCount=e.getAttribute("position").count;for(const t in n.attributes){const i=e.getAttribute(t),r=n.getAttribute(t);tc(i,r,a);const s=i.itemSize;for(let t=i.count,e=l;t<e;t++){const e=a+t;for(let t=0;t<s;t++)r.setComponent(e,t,0)}r.needsUpdate=!0,r.addUpdateRange(a*s,l*s)}if(i){const t=o.indexStart,n=o.reservedIndexCount;o.indexCount=e.getIndex().count;for(let e=0;e<s.count;e++)r.setX(t+e,a+s.getX(e));for(let e=s.count,i=n;e<i;e++)r.setX(t+e,a);r.needsUpdate=!0,r.addUpdateRange(t,o.reservedIndexCount)}return o.start=i?o.indexStart:o.vertexStart,o.count=i?o.indexCount:o.vertexCount,o.boundingBox=null,null!==e.boundingBox&&(o.boundingBox=e.boundingBox.clone()),o.boundingSphere=null,null!==e.boundingSphere&&(o.boundingSphere=e.boundingSphere.clone()),this._visibilityChanged=!0,t}deleteGeometry(t){const e=this._geometryInfo;if(t>=e.length||!1===e[t].active)return this;const n=this._instanceInfo;for(let e=0,i=n.length;e<i;e++)n[e].active&&n[e].geometryIndex===t&&this.deleteInstance(e);return e[t].active=!1,this._availableGeometryIds.push(t),this._visibilityChanged=!0,this}deleteInstance(t){return this.validateInstanceId(t),this._instanceInfo[t].active=!1,this._availableInstanceIds.push(t),this._visibilityChanged=!0,this}optimize(){let t=0,e=0;const n=this._geometryInfo,i=n.map(((t,e)=>e)).sort(((t,e)=>n[t].vertexStart-n[e].vertexStart)),r=this.geometry;for(let s=0,o=n.length;s<o;s++){const o=i[s],a=n[o];if(!1!==a.active){if(null!==r.index){if(a.indexStart!==e){const{indexStart:n,vertexStart:i,reservedIndexCount:s}=a,o=r.index,l=o.array,c=t-i;for(let t=n;t<n+s;t++)l[t]=l[t]+c;o.array.copyWithin(e,n,n+s),o.addUpdateRange(e,s),a.indexStart=e}e+=a.reservedIndexCount}if(a.vertexStart!==t){const{vertexStart:e,reservedVertexCount:n}=a,i=r.attributes;for(const r in i){const s=i[r],{array:o,itemSize:a}=s;o.copyWithin(t*a,e*a,(e+n)*a),s.addUpdateRange(t*a,n*a)}a.vertexStart=t}t+=a.reservedVertexCount,a.start=r.index?a.indexStart:a.vertexStart,this._nextIndexStart=r.index?a.indexStart+a.reservedIndexCount:0,this._nextVertexStart=a.vertexStart+a.reservedVertexCount}}return this}getBoundingBoxAt(t,e){if(t>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[t];if(null===i.boundingBox){const t=new cs,e=n.index,r=n.attributes.position;for(let n=i.start,s=i.start+i.count;n<s;n++){let i=n;e&&(i=e.getX(i)),t.expandByPoint(Xl.fromBufferAttribute(r,i))}i.boundingBox=t}return e.copy(i.boundingBox),e}getBoundingSphereAt(t,e){if(t>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[t];if(null===i.boundingSphere){const e=new Ss;this.getBoundingBoxAt(t,Wl),Wl.getCenter(e.center);const r=n.index,s=n.attributes.position;let o=0;for(let t=i.start,n=i.start+i.count;t<n;t++){let n=t;r&&(n=r.getX(n)),Xl.fromBufferAttribute(s,n),o=Math.max(o,e.center.distanceToSquared(Xl))}e.radius=Math.sqrt(o),i.boundingSphere=e}return e.copy(i.boundingSphere),e}setMatrixAt(t,e){this.validateInstanceId(t);const n=this._matricesTexture,i=this._matricesTexture.image.data;return e.toArray(i,16*t),n.needsUpdate=!0,this}getMatrixAt(t,e){return this.validateInstanceId(t),e.fromArray(this._matricesTexture.image.data,16*t)}setColorAt(t,e){return this.validateInstanceId(t),null===this._colorsTexture&&this._initColorsTexture(),e.toArray(this._colorsTexture.image.data,4*t),this._colorsTexture.needsUpdate=!0,this}getColorAt(t,e){return this.validateInstanceId(t),e.fromArray(this._colorsTexture.image.data,4*t)}setVisibleAt(t,e){return this.validateInstanceId(t),this._instanceInfo[t].visible===e||(this._instanceInfo[t].visible=e,this._visibilityChanged=!0),this}getVisibleAt(t){return this.validateInstanceId(t),this._instanceInfo[t].visible}setGeometryIdAt(t,e){return this.validateInstanceId(t),this.validateGeometryId(e),this._instanceInfo[t].geometryIndex=e,this}getGeometryIdAt(t){return this.validateInstanceId(t),this._instanceInfo[t].geometryIndex}getGeometryRangeAt(t,e={}){this.validateGeometryId(t);const n=this._geometryInfo[t];return e.vertexStart=n.vertexStart,e.vertexCount=n.vertexCount,e.reservedVertexCount=n.reservedVertexCount,e.indexStart=n.indexStart,e.indexCount=n.indexCount,e.reservedIndexCount=n.reservedIndexCount,e.start=n.start,e.count=n.count,e}setInstanceCount(t){const e=this._availableInstanceIds,n=this._instanceInfo;for(e.sort(Nl);e[e.length-1]===n.length;)n.pop(),e.pop();if(t<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${t} are being used. Cannot shrink instance count.`);const i=new Int32Array(t),r=new Int32Array(t);ec(this._multiDrawCounts,i),ec(this._multiDrawStarts,r),this._multiDrawCounts=i,this._multiDrawStarts=r,this._maxInstanceCount=t;const s=this._indirectTexture,o=this._matricesTexture,a=this._colorsTexture;s.dispose(),this._initIndirectTexture(),ec(s.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),ec(o.image.data,this._matricesTexture.image.data),a&&(a.dispose(),this._initColorsTexture(),ec(a.image.data,this._colorsTexture.image.data))}setGeometrySize(t,e){const n=[...this._geometryInfo].filter((t=>t.active));if(Math.max(...n.map((t=>t.vertexStart+t.reservedVertexCount)))>t)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map((t=>t.indexStart+t.reservedIndexCount)))>e)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);const i=this.geometry;i.dispose(),this._maxVertexCount=t,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new sa,this._initializeGeometry(i));const r=this.geometry;i.index&&ec(i.index.array,r.index.array);for(const t in i.attributes)ec(i.attributes[t].array,r.attributes[t].array)}raycast(t,e){const n=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,s=this.geometry;Zl.material=this.material,Zl.geometry.index=s.index,Zl.geometry.attributes=s.attributes,null===Zl.geometry.boundingBox&&(Zl.geometry.boundingBox=new cs),null===Zl.geometry.boundingSphere&&(Zl.geometry.boundingSphere=new Ss);for(let s=0,o=n.length;s<o;s++){if(!n[s].visible||!n[s].active)continue;const o=n[s].geometryIndex,a=i[o];Zl.geometry.setDrawRange(a.start,a.count),this.getMatrixAt(s,Zl.matrixWorld).premultiply(r),this.getBoundingBoxAt(o,Zl.geometry.boundingBox),this.getBoundingSphereAt(o,Zl.geometry.boundingSphere),Zl.raycast(t,$l);for(let t=0,n=$l.length;t<n;t++){const n=$l[t];n.object=this,n.batchId=s,e.push(n)}$l.length=0}Zl.material=null,Zl.geometry.index=null,Zl.geometry.attributes={},Zl.geometry.setDrawRange(0,1/0)}copy(t){return super.copy(t),this.geometry=t.geometry.clone(),this.perObjectFrustumCulled=t.perObjectFrustumCulled,this.sortObjects=t.sortObjects,this.boundingBox=null!==t.boundingBox?t.boundingBox.clone():null,this.boundingSphere=null!==t.boundingSphere?t.boundingSphere.clone():null,this._geometryInfo=t._geometryInfo.map((t=>({...t,boundingBox:null!==t.boundingBox?t.boundingBox.clone():null,boundingSphere:null!==t.boundingSphere?t.boundingSphere.clone():null}))),this._instanceInfo=t._instanceInfo.map((t=>({...t}))),this._maxInstanceCount=t._maxInstanceCount,this._maxVertexCount=t._maxVertexCount,this._maxIndexCount=t._maxIndexCount,this._geometryInitialized=t._geometryInitialized,this._geometryCount=t._geometryCount,this._multiDrawCounts=t._multiDrawCounts.slice(),this._multiDrawStarts=t._multiDrawStarts.slice(),this._matricesTexture=t._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=t._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(t,e,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const s=i.getIndex(),o=null===s?1:s.array.BYTES_PER_ELEMENT,a=this._instanceInfo,l=this._multiDrawStarts,c=this._multiDrawCounts,h=this._geometryInfo,u=this.perObjectFrustumCulled,d=this._indirectTexture,p=d.image.data;u&&(Hl.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),jl.setFromProjectionMatrix(Hl,t.coordinateSystem));let A=0;if(this.sortObjects){Hl.copy(this.matrixWorld).invert(),Xl.setFromMatrixPosition(n.matrixWorld).applyMatrix4(Hl),Yl.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(Hl);for(let t=0,e=a.length;t<e;t++)if(a[t].visible&&a[t].active){const e=a[t].geometryIndex;this.getMatrixAt(t,Hl),this.getBoundingSphereAt(e,ql).applyMatrix4(Hl);let n=!1;if(u&&(n=!jl.intersectsSphere(ql)),!n){const n=h[e],i=Jl.subVectors(ql.center,Xl).dot(Yl);Kl.push(n.start,n.count,i,t)}}const t=Kl.list,e=this.customSort;null===e?t.sort(r.transparent?Gl:Ql):e.call(this,t,n);for(let e=0,n=t.length;e<n;e++){const n=t[e];l[A]=n.start*o,c[A]=n.count,p[A]=n.index,A++}Kl.reset()}else for(let t=0,e=a.length;t<e;t++)if(a[t].visible&&a[t].active){const e=a[t].geometryIndex;let n=!1;if(u&&(this.getMatrixAt(t,Hl),this.getBoundingSphereAt(e,ql).applyMatrix4(Hl),n=!jl.intersectsSphere(ql)),!n){const n=h[e];l[A]=n.start*o,c[A]=n.count,p[A]=t,A++}}d.needsUpdate=!0,this._multiDrawCount=A,this._visibilityChanged=!1}onBeforeShadow(t,e,n,i,r,s){this.onBeforeRender(t,null,i,r,s)}}class ic extends Lo{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Bo(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const rc=new os,sc=new os,oc=new Os,ac=new Us,lc=new Ss,cc=new os,hc=new os;class uc extends co{constructor(t=new sa,e=new ic){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[0];for(let t=1,i=e.count;t<i;t++)rc.fromBufferAttribute(e,t-1),sc.fromBufferAttribute(e,t),n[t]=n[t-1],n[t]+=rc.distanceTo(sc);t.setAttribute("lineDistance",new Ko(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Line.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),lc.copy(n.boundingSphere),lc.applyMatrix4(i),lc.radius+=r,!1===t.ray.intersectsSphere(lc))return;oc.copy(i).invert(),ac.copy(t.ray).applyMatrix4(oc);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,l=this.isLineSegments?2:1,c=n.index,h=n.attributes.position;if(null!==c){const n=Math.max(0,s.start),i=Math.min(c.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=c.getX(r),i=c.getX(r+1),s=dc(this,t,ac,a,n,i,r);s&&e.push(s)}if(this.isLineLoop){const r=c.getX(i-1),s=c.getX(n),o=dc(this,t,ac,a,r,s,i-1);o&&e.push(o)}}else{const n=Math.max(0,s.start),i=Math.min(h.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=dc(this,t,ac,a,r,r+1,r);n&&e.push(n)}if(this.isLineLoop){const r=dc(this,t,ac,a,i-1,n,i-1);r&&e.push(r)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function dc(t,e,n,i,r,s,o){const a=t.geometry.attributes.position;if(rc.fromBufferAttribute(a,r),sc.fromBufferAttribute(a,s),n.distanceSqToSegment(rc,sc,cc,hc)>i)return;cc.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(cc);return l<e.near||l>e.far?void 0:{distance:l,point:hc.clone().applyMatrix4(t.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:t}}const pc=new os,Ac=new os;class fc extends uc{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,n=[];for(let t=0,i=e.count;t<i;t+=2)pc.fromBufferAttribute(e,t),Ac.fromBufferAttribute(e,t+1),n[t]=0===t?0:n[t-1],n[t+1]=n[t]+pc.distanceTo(Ac);t.setAttribute("lineDistance",new Ko(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class mc extends uc{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class gc extends Lo{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Bo(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const vc=new Os,yc=new Us,Ec=new Ss,xc=new os;class bc extends co{constructor(t=new sa,e=new gc){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){const n=this.geometry,i=this.matrixWorld,r=t.params.Points.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ec.copy(n.boundingSphere),Ec.applyMatrix4(i),Ec.radius+=r,!1===t.ray.intersectsSphere(Ec))return;vc.copy(i).invert(),yc.copy(t.ray).applyMatrix4(vc);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,l=n.index,c=n.attributes.position;if(null!==l)for(let n=Math.max(0,s.start),r=Math.min(l.count,s.start+s.count);n<r;n++){const r=l.getX(n);xc.fromBufferAttribute(c,r),Cc(xc,r,a,i,t,e,this)}else for(let n=Math.max(0,s.start),r=Math.min(c.count,s.start+s.count);n<r;n++)xc.fromBufferAttribute(c,n),Cc(xc,n,a,i,t,e,this)}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function Cc(t,e,n,i,r,s,o){const a=yc.distanceSqToPoint(t);if(a<n){const n=new os;yc.closestPointToPoint(t,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class wc extends Kr{constructor(t,e,n,i,r,s,o,a,l){super(t,e,n,i,r,s,o,a,l),this.isVideoTexture=!0,this.minFilter=void 0!==s?s:$e,this.magFilter=void 0!==r?r:$e,this.generateMipmaps=!1;const c=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback((function e(){c.needsUpdate=!0,t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1=="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class _c extends wc{constructor(t,e,n,i,r,s,o,a){super({},t,e,n,i,r,s,o,a),this.isVideoFrameTexture=!0}update(){}clone(){return(new this.constructor).copy(this)}setFrame(t){this.image=t,this.needsUpdate=!0}}class Mc extends Kr{constructor(t,e){super({width:t,height:e}),this.isFramebufferTexture=!0,this.magFilter=Xe,this.minFilter=Xe,this.generateMipmaps=!1,this.needsUpdate=!0}}class Sc extends Kr{constructor(t,e,n,i,r,s,o,a,l,c,h,u){super(null,s,o,a,l,c,i,r,h,u),this.isCompressedTexture=!0,this.image={width:e,height:n},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class Ic extends Sc{constructor(t,e,n,i,r,s){super(t,e,n,r,s),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=We,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class Bc extends Sc{constructor(t,e,n){super(void 0,t[0].width,t[0].height,e,n,Qe),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class Tc extends Kr{constructor(t,e,n,i,r,s,o,a,l){super(t,e,n,i,r,s,o,a,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Rc extends Kr{constructor(t,e,n,i,r,s,o,a,l,c=bn){if(c!==bn&&c!==Cn)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===bn&&(n=hn),void 0===n&&c===Cn&&(n=fn),super(null,i,r,s,o,a,c,n,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=void 0!==o?o:Xe,this.minFilter=void 0!==a?a:Xe,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class Lc{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,e){const n=this.getUtoTmapping(t);return this.getPoint(n,e)}getPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return e}getSpacedPoints(t=5){const e=[];for(let n=0;n<=t;n++)e.push(this.getPointAt(n/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(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 s=1;s<=t;s++)n=this.getPoint(s/t),r+=n.distanceTo(i),e.push(r),i=n;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e){const n=this.getLengths();let i=0;const r=n.length;let s;s=e||t*n[r-1];let o,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),o=n[i]-s,o<0)a=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(t,e){const n=1e-4;let i=t-n,r=t+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),o=this.getPoint(r),a=e||(s.isVector2?new Br:new os);return a.copy(o).sub(s).normalize(),a}getTangentAt(t,e){const n=this.getUtoTmapping(t);return this.getTangent(n,e)}computeFrenetFrames(t,e){const n=new os,i=[],r=[],s=[],o=new os,a=new Os;for(let e=0;e<=t;e++){const n=e/t;i[e]=this.getTangentAt(n,new os)}r[0]=new os,s[0]=new os;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),u=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),u<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),s[0].crossVectors(i[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),s[e]=s[e-1].clone(),o.crossVectors(i[e-1],i[e]),o.length()>Number.EPSILON){o.normalize();const t=Math.acos(Cr(i[e-1].dot(i[e]),-1,1));r[e].applyMatrix4(a.makeRotationAxis(o,t))}s[e].crossVectors(i[e],r[e])}if(!0===e){let e=Math.acos(Cr(r[0].dot(r[t]),-1,1));e/=t,i[0].dot(o.crossVectors(r[0],r[t]))>0&&(e=-e);for(let n=1;n<=t;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],e*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class Dc extends Lc{constructor(t=0,e=0,n=1,i=1,r=0,s=2*Math.PI,o=!1,a=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(t,e=new Br){const n=e,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=s?0:i),!0!==this.aClockwise||s||(r===i?r=-i:r-=i);const o=this.aStartAngle+t*r;let a=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),n=a-this.aX,i=l-this.aY;a=n*t-i*e+this.aX,l=n*e+i*t+this.aY}return n.set(a,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}class Pc extends Dc{constructor(t,e,n,i,r,s){super(t,e,n,n,i,r,s),this.isArcCurve=!0,this.type="ArcCurve"}}function Uc(){let t=0,e=0,n=0,i=0;function r(r,s,o,a){t=r,e=o,n=-3*r+3*s-2*o-a,i=2*r-2*s+o+a}return{initCatmullRom:function(t,e,n,i,s){r(e,n,s*(n-t),s*(i-e))},initNonuniformCatmullRom:function(t,e,n,i,s,o,a){let l=(e-t)/s-(n-t)/(s+o)+(n-e)/o,c=(n-e)/o-(i-e)/(o+a)+(i-n)/a;l*=o,c*=o,r(e,n,l,c)},calc:function(r){const s=r*r;return t+e*r+n*s+i*(s*r)}}}const Oc=new os,Fc=new Uc,kc=new Uc,Nc=new Uc;class Qc extends Lc{constructor(t=[],e=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=n,this.tension=i}getPoint(t,e=new os){const n=e,i=this.points,r=i.length,s=(r-(this.closed?0:1))*t;let o,a,l=Math.floor(s),c=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?o=i[(l-1)%r]:(Oc.subVectors(i[0],i[1]).add(i[0]),o=Oc);const h=i[l%r],u=i[(l+1)%r];if(this.closed||l+2<r?a=i[(l+2)%r]:(Oc.subVectors(i[r-1],i[r-2]).add(i[r-1]),a=Oc),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(o.distanceToSquared(h),t),n=Math.pow(h.distanceToSquared(u),t),i=Math.pow(u.distanceToSquared(a),t);n<1e-4&&(n=1),e<1e-4&&(e=n),i<1e-4&&(i=n),Fc.initNonuniformCatmullRom(o.x,h.x,u.x,a.x,e,n,i),kc.initNonuniformCatmullRom(o.y,h.y,u.y,a.y,e,n,i),Nc.initNonuniformCatmullRom(o.z,h.z,u.z,a.z,e,n,i)}else"catmullrom"===this.curveType&&(Fc.initCatmullRom(o.x,h.x,u.x,a.x,this.tension),kc.initCatmullRom(o.y,h.y,u.y,a.y,this.tension),Nc.initCatmullRom(o.z,h.z,u.z,a.z,this.tension));return n.set(Fc.calc(c),kc.calc(c),Nc.calc(c)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new os).fromArray(n))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Gc(t,e,n,i,r){const s=.5*(i-e),o=.5*(r-n),a=t*t;return(2*n-2*i+s+o)*(t*a)+(-3*n+3*i-2*s-o)*a+s*t+n}function zc(t,e,n,i){return function(t,e){const n=1-t;return n*n*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,n)+function(t,e){return t*t*e}(t,i)}function Hc(t,e,n,i,r){return function(t,e){const n=1-t;return n*n*n*e}(t,e)+function(t,e){const n=1-t;return 3*n*n*t*e}(t,n)+function(t,e){return 3*(1-t)*t*t*e}(t,i)+function(t,e){return t*t*t*e}(t,r)}class Vc extends Lc{constructor(t=new Br,e=new Br,n=new Br,i=new Br){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new Br){const n=e,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(Hc(t,i.x,r.x,s.x,o.x),Hc(t,i.y,r.y,s.y,o.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class jc extends Lc{constructor(t=new os,e=new os,n=new os,i=new os){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=n,this.v3=i}getPoint(t,e=new os){const n=e,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(Hc(t,i.x,r.x,s.x,o.x),Hc(t,i.y,r.y,s.y,o.y),Hc(t,i.z,r.z,s.z,o.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class Wc extends Lc{constructor(t=new Br,e=new Br){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new Br){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new Br){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class qc extends Lc{constructor(t=new os,e=new os){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new os){const n=e;return 1===t?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(t).add(this.v1)),n}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new os){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Xc extends Lc{constructor(t=new Br,e=new Br,n=new Br){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new Br){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(zc(t,i.x,r.x,s.x),zc(t,i.y,r.y,s.y)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Yc extends Lc{constructor(t=new os,e=new os,n=new os){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=n}getPoint(t,e=new os){const n=e,i=this.v0,r=this.v1,s=this.v2;return n.set(zc(t,i.x,r.x,s.x),zc(t,i.y,r.y,s.y),zc(t,i.z,r.z,s.z)),n}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class Jc extends Lc{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new Br){const n=e,i=this.points,r=(i.length-1)*t,s=Math.floor(r),o=r-s,a=i[0===s?s:s-1],l=i[s],c=i[s>i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(Gc(o,a.x,l.x,c.x,h.x),Gc(o,a.y,l.y,c.y,h.y)),n}copy(t){super.copy(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,n=this.points.length;e<n;e++){const n=this.points[e];t.points.push(n.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,n=t.points.length;e<n;e++){const n=t.points[e];this.points.push((new Br).fromArray(n))}return this}}var Kc=Object.freeze({__proto__:null,ArcCurve:Pc,CatmullRomCurve3:Qc,CubicBezierCurve:Vc,CubicBezierCurve3:jc,EllipseCurve:Dc,LineCurve:Wc,LineCurve3:qc,QuadraticBezierCurve:Xc,QuadraticBezierCurve3:Yc,SplineCurve:Jc});class Zc extends Lc{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const n=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new Kc[n](e,t))}return this}getPoint(t,e){const n=t*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const t=i[r]-n,s=this.curves[r],o=s.getLength(),a=0===o?0:1-t/o;return s.getPointAt(a,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.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 t=[];let e=0;for(let n=0,i=this.curves.length;n<i;n++)e+=this.curves[n].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let n=0;n<=t;n++)e.push(this.getPoint(n/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const s=r[i],o=s.isEllipseCurve?2*t:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?t*s.points.length:t,a=s.getPoints(o);for(let t=0;t<a.length;t++){const i=a[t];n&&n.equals(i)||(e.push(i),n=i)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push(n.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,n=this.curves.length;e<n;e++){const n=this.curves[e];t.curves.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,n=t.curves.length;e<n;e++){const n=t.curves[e];this.curves.push((new Kc[n.type]).fromJSON(n))}return this}}class $c extends Zc{constructor(t){super(),this.type="Path",this.currentPoint=new Br,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,n=t.length;e<n;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const n=new Wc(this.currentPoint.clone(),new Br(t,e));return this.curves.push(n),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,n,i){const r=new Xc(this.currentPoint.clone(),new Br(t,e),new Br(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(t,e,n,i,r,s){const o=new Vc(this.currentPoint.clone(),new Br(t,e),new Br(n,i),new Br(r,s));return this.curves.push(o),this.currentPoint.set(r,s),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),n=new Jc(e);return this.curves.push(n),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,n,i,r,s){const o=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(t+o,e+a,n,i,r,s),this}absarc(t,e,n,i,r,s){return this.absellipse(t,e,n,n,i,r,s),this}ellipse(t,e,n,i,r,s,o,a){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,n,i,r,s,o,a),this}absellipse(t,e,n,i,r,s,o,a){const l=new Dc(t,e,n,i,r,s,o,a);if(this.curves.length>0){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(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class th extends sa{constructor(t=[new Br(0,-.5),new Br(.5,0),new Br(0,.5)],e=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:e,phiStart:n,phiLength:i},e=Math.floor(e),i=Cr(i,0,2*Math.PI);const r=[],s=[],o=[],a=[],l=[],c=1/e,h=new os,u=new Br,d=new os,p=new os,A=new os;let f=0,m=0;for(let e=0;e<=t.length-1;e++)switch(e){case 0:f=t[e+1].x-t[e].x,m=t[e+1].y-t[e].y,d.x=1*m,d.y=-f,d.z=0*m,A.copy(d),d.normalize(),a.push(d.x,d.y,d.z);break;case t.length-1:a.push(A.x,A.y,A.z);break;default:f=t[e+1].x-t[e].x,m=t[e+1].y-t[e].y,d.x=1*m,d.y=-f,d.z=0*m,p.copy(d),d.x+=A.x,d.y+=A.y,d.z+=A.z,d.normalize(),a.push(d.x,d.y,d.z),A.copy(p)}for(let r=0;r<=e;r++){const d=n+r*c*i,p=Math.sin(d),A=Math.cos(d);for(let n=0;n<=t.length-1;n++){h.x=t[n].x*p,h.y=t[n].y,h.z=t[n].x*A,s.push(h.x,h.y,h.z),u.x=r/e,u.y=n/(t.length-1),o.push(u.x,u.y);const i=a[3*n+0]*p,c=a[3*n+1],d=a[3*n+0]*A;l.push(i,c,d)}}for(let n=0;n<e;n++)for(let e=0;e<t.length-1;e++){const i=e+n*t.length,s=i,o=i+t.length,a=i+t.length+1,l=i+1;r.push(s,o,l),r.push(a,l,o)}this.setIndex(r),this.setAttribute("position",new Ko(s,3)),this.setAttribute("uv",new Ko(o,2)),this.setAttribute("normal",new Ko(l,3))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new th(t.points,t.segments,t.phiStart,t.phiLength)}}class eh extends th{constructor(t=1,e=1,n=4,i=8){const r=new $c;r.absarc(0,-e/2,t,1.5*Math.PI,0),r.absarc(0,e/2,t,0,.5*Math.PI),super(r.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:t,length:e,capSegments:n,radialSegments:i}}static fromJSON(t){return new eh(t.radius,t.length,t.capSegments,t.radialSegments)}}class nh extends sa{constructor(t=1,e=32,n=0,i=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:e,thetaStart:n,thetaLength:i},e=Math.max(3,e);const r=[],s=[],o=[],a=[],l=new os,c=new Br;s.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let r=0,h=3;r<=e;r++,h+=3){const u=n+r/e*i;l.x=t*Math.cos(u),l.y=t*Math.sin(u),s.push(l.x,l.y,l.z),o.push(0,0,1),c.x=(s[h]/t+1)/2,c.y=(s[h+1]/t+1)/2,a.push(c.x,c.y)}for(let t=1;t<=e;t++)r.push(t,t+1,0);this.setIndex(r),this.setAttribute("position",new Ko(s,3)),this.setAttribute("normal",new Ko(o,3)),this.setAttribute("uv",new Ko(a,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new nh(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class ih extends sa{constructor(t=1,e=1,n=1,i=32,r=1,s=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:e,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a};const l=this;i=Math.floor(i),r=Math.floor(r);const c=[],h=[],u=[],d=[];let p=0;const A=[],f=n/2;let m=0;function g(n){const r=p,s=new Br,A=new os;let g=0;const v=!0===n?t:e,y=!0===n?1:-1;for(let t=1;t<=i;t++)h.push(0,f*y,0),u.push(0,y,0),d.push(.5,.5),p++;const E=p;for(let t=0;t<=i;t++){const e=t/i*a+o,n=Math.cos(e),r=Math.sin(e);A.x=v*r,A.y=f*y,A.z=v*n,h.push(A.x,A.y,A.z),u.push(0,y,0),s.x=.5*n+.5,s.y=.5*r*y+.5,d.push(s.x,s.y),p++}for(let t=0;t<i;t++){const e=r+t,i=E+t;!0===n?c.push(i,i+1,e):c.push(i+1,i,e),g+=3}l.addGroup(m,g,!0===n?1:2),m+=g}!function(){const s=new os,g=new os;let v=0;const y=(e-t)/n;for(let l=0;l<=r;l++){const c=[],m=l/r,v=m*(e-t)+t;for(let t=0;t<=i;t++){const e=t/i,r=e*a+o,l=Math.sin(r),A=Math.cos(r);g.x=v*l,g.y=-m*n+f,g.z=v*A,h.push(g.x,g.y,g.z),s.set(l,y,A).normalize(),u.push(s.x,s.y,s.z),d.push(e,1-m),c.push(p++)}A.push(c)}for(let n=0;n<i;n++)for(let i=0;i<r;i++){const s=A[i][n],o=A[i+1][n],a=A[i+1][n+1],l=A[i][n+1];(t>0||0!==i)&&(c.push(s,o,l),v+=3),(e>0||i!==r-1)&&(c.push(o,a,l),v+=3)}l.addGroup(m,v,0),m+=v}(),!1===s&&(t>0&&g(!0),e>0&&g(!1)),this.setIndex(c),this.setAttribute("position",new Ko(h,3)),this.setAttribute("normal",new Ko(u,3)),this.setAttribute("uv",new Ko(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new ih(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class rh extends ih{constructor(t=1,e=1,n=32,i=1,r=!1,s=0,o=2*Math.PI){super(0,t,e,n,i,r,s,o),this.type="ConeGeometry",this.parameters={radius:t,height:e,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:o}}static fromJSON(t){return new rh(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class sh extends sa{constructor(t=[],e=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:e,radius:n,detail:i};const r=[],s=[];function o(t,e,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const o=t.clone().lerp(n,i/r),a=e.clone().lerp(n,i/r),l=r-i;for(let t=0;t<=l;t++)s[i][t]=0===t&&i===r?o:o.clone().lerp(a,t/l)}for(let t=0;t<r;t++)for(let e=0;e<2*(r-t)-1;e++){const n=Math.floor(e/2);e%2==0?(a(s[t][n+1]),a(s[t+1][n]),a(s[t][n])):(a(s[t][n+1]),a(s[t+1][n+1]),a(s[t+1][n]))}}function a(t){r.push(t.x,t.y,t.z)}function l(e,n){const i=3*e;n.x=t[i+0],n.y=t[i+1],n.z=t[i+2]}function c(t,e,n,i){i<0&&1===t.x&&(s[e]=t.x-1),0===n.x&&0===n.z&&(s[e]=i/2/Math.PI+.5)}function h(t){return Math.atan2(t.z,-t.x)}!function(t){const n=new os,i=new os,r=new os;for(let s=0;s<e.length;s+=3)l(e[s+0],n),l(e[s+1],i),l(e[s+2],r),o(n,i,r,t)}(i),function(t){const e=new os;for(let n=0;n<r.length;n+=3)e.x=r[n+0],e.y=r[n+1],e.z=r[n+2],e.normalize().multiplyScalar(t),r[n+0]=e.x,r[n+1]=e.y,r[n+2]=e.z}(n),function(){const t=new os;for(let n=0;n<r.length;n+=3){t.x=r[n+0],t.y=r[n+1],t.z=r[n+2];const i=h(t)/2/Math.PI+.5,o=(e=t,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+.5);s.push(i,1-o)}var e;(function(){const t=new os,e=new os,n=new os,i=new os,o=new Br,a=new Br,l=new Br;for(let u=0,d=0;u<r.length;u+=9,d+=6){t.set(r[u+0],r[u+1],r[u+2]),e.set(r[u+3],r[u+4],r[u+5]),n.set(r[u+6],r[u+7],r[u+8]),o.set(s[d+0],s[d+1]),a.set(s[d+2],s[d+3]),l.set(s[d+4],s[d+5]),i.copy(t).add(e).add(n).divideScalar(3);const p=h(i);c(o,d+0,t,p),c(a,d+2,e,p),c(l,d+4,n,p)}})(),function(){for(let t=0;t<s.length;t+=6){const e=s[t+0],n=s[t+2],i=s[t+4],r=Math.max(e,n,i),o=Math.min(e,n,i);r>.9&&o<.1&&(e<.2&&(s[t+0]+=1),n<.2&&(s[t+2]+=1),i<.2&&(s[t+4]+=1))}}()}(),this.setAttribute("position",new Ko(r,3)),this.setAttribute("normal",new Ko(r.slice(),3)),this.setAttribute("uv",new Ko(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new sh(t.vertices,t.indices,t.radius,t.details)}}class oh extends sh{constructor(t=1,e=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],t,e),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new oh(t.radius,t.detail)}}const ah=new os,lh=new os,ch=new os,hh=new wo;class uh extends sa{constructor(t=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:t,thresholdAngle:e},null!==t){const n=4,i=Math.pow(10,n),r=Math.cos(Er*e),s=t.getIndex(),o=t.getAttribute("position"),a=s?s.count:o.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),u={},d=[];for(let t=0;t<a;t+=3){s?(l[0]=s.getX(t),l[1]=s.getX(t+1),l[2]=s.getX(t+2)):(l[0]=t,l[1]=t+1,l[2]=t+2);const{a:e,b:n,c:a}=hh;if(e.fromBufferAttribute(o,l[0]),n.fromBufferAttribute(o,l[1]),a.fromBufferAttribute(o,l[2]),hh.getNormal(ch),h[0]=`${Math.round(e.x*i)},${Math.round(e.y*i)},${Math.round(e.z*i)}`,h[1]=`${Math.round(n.x*i)},${Math.round(n.y*i)},${Math.round(n.z*i)}`,h[2]=`${Math.round(a.x*i)},${Math.round(a.y*i)},${Math.round(a.z*i)}`,h[0]!==h[1]&&h[1]!==h[2]&&h[2]!==h[0])for(let t=0;t<3;t++){const e=(t+1)%3,n=h[t],i=h[e],s=hh[c[t]],o=hh[c[e]],a=`${n}_${i}`,p=`${i}_${n}`;p in u&&u[p]?(ch.dot(u[p].normal)<=r&&(d.push(s.x,s.y,s.z),d.push(o.x,o.y,o.z)),u[p]=null):a in u||(u[a]={index0:l[t],index1:l[e],normal:ch.clone()})}}for(const t in u)if(u[t]){const{index0:e,index1:n}=u[t];ah.fromBufferAttribute(o,e),lh.fromBufferAttribute(o,n),d.push(ah.x,ah.y,ah.z),d.push(lh.x,lh.y,lh.z)}this.setAttribute("position",new Ko(d,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}class dh extends $c{constructor(t){super(t),this.uuid=br(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let n=0,i=this.holes.length;n<i;n++)e[n]=this.holes[n].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push(n.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,n=this.holes.length;e<n;e++){const n=this.holes[e];t.holes.push(n.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,n=t.holes.length;e<n;e++){const n=t.holes[e];this.holes.push((new $c).fromJSON(n))}return this}}function ph(t,e,n,i,r){let s,o;if(r===function(t,e,n,i){let r=0;for(let s=e,o=n-i;s<n;s+=i)r+=(t[o]-t[s])*(t[s+1]+t[o+1]),o=s;return r}(t,e,n,i)>0)for(s=e;s<n;s+=i)o=Ph(s,t[s],t[s+1],o);else for(s=n-i;s>=e;s-=i)o=Ph(s,t[s],t[s+1],o);return o&&Ih(o,o.next)&&(Uh(o),o=o.next),o}function Ah(t,e){if(!t)return t;e||(e=t);let n,i=t;do{if(n=!1,i.steiner||!Ih(i,i.next)&&0!==Sh(i.prev,i,i.next))i=i.next;else{if(Uh(i),i=e=i.prev,i===i.next)break;n=!0}}while(n||i!==e);return e}function fh(t,e,n,i,r,s,o){if(!t)return;!o&&s&&function(t,e,n,i){let r=t;do{0===r.z&&(r.z=Ch(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,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,i=n,a=0,e=0;e<c&&(a++,i=i.nextZ,i);e++);for(l=c;a>0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(o>1)}(r)}(t,i,r,s);let a,l,c=t;for(;t.prev!==t.next;)if(a=t.prev,l=t.next,s?gh(t,i,r,s):mh(t))e.push(a.i/n|0),e.push(t.i/n|0),e.push(l.i/n|0),Uh(t),t=l.next,c=l.next;else if((t=l)===c){o?1===o?fh(t=vh(Ah(t),e,n),e,n,i,r,s,2):2===o&&yh(t,e,n,i,r,s):fh(Ah(t),e,n,i,r,s,1);break}}function mh(t){const e=t.prev,n=t,i=t.next;if(Sh(e,n,i)>=0)return!1;const r=e.x,s=n.x,o=i.x,a=e.y,l=n.y,c=i.y,h=r<s?r<o?r:o:s<o?s:o,u=a<l?a<c?a:c:l<c?l:c,d=r>s?r>o?r:o:s>o?s:o,p=a>l?a>c?a:c:l>c?l:c;let A=i.next;for(;A!==e;){if(A.x>=h&&A.x<=d&&A.y>=u&&A.y<=p&&_h(r,a,s,l,o,c,A.x,A.y)&&Sh(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function gh(t,e,n,i){const r=t.prev,s=t,o=t.next;if(Sh(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,h=r.y,u=s.y,d=o.y,p=a<l?a<c?a:c:l<c?l:c,A=h<u?h<d?h:d:u<d?u:d,f=a>l?a>c?a:c:l>c?l:c,m=h>u?h>d?h:d:u>d?u:d,g=Ch(p,A,e,n,i),v=Ch(f,m,e,n,i);let y=t.prevZ,E=t.nextZ;for(;y&&y.z>=g&&E&&E.z<=v;){if(y.x>=p&&y.x<=f&&y.y>=A&&y.y<=m&&y!==r&&y!==o&&_h(a,h,l,u,c,d,y.x,y.y)&&Sh(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,E.x>=p&&E.x<=f&&E.y>=A&&E.y<=m&&E!==r&&E!==o&&_h(a,h,l,u,c,d,E.x,E.y)&&Sh(E.prev,E,E.next)>=0)return!1;E=E.nextZ}for(;y&&y.z>=g;){if(y.x>=p&&y.x<=f&&y.y>=A&&y.y<=m&&y!==r&&y!==o&&_h(a,h,l,u,c,d,y.x,y.y)&&Sh(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;E&&E.z<=v;){if(E.x>=p&&E.x<=f&&E.y>=A&&E.y<=m&&E!==r&&E!==o&&_h(a,h,l,u,c,d,E.x,E.y)&&Sh(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function vh(t,e,n){let i=t;do{const r=i.prev,s=i.next.next;!Ih(r,s)&&Bh(r,i,i.next,s)&&Lh(r,s)&&Lh(s,r)&&(e.push(r.i/n|0),e.push(i.i/n|0),e.push(s.i/n|0),Uh(i),Uh(i.next),i=t=s),i=i.next}while(i!==t);return Ah(i)}function yh(t,e,n,i,r,s){let o=t;do{let t=o.next.next;for(;t!==o.prev;){if(o.i!==t.i&&Mh(o,t)){let a=Dh(o,t);return o=Ah(o,o.next),a=Ah(a,a.next),fh(o,e,n,i,r,s,0),void fh(a,e,n,i,r,s,0)}t=t.next}o=o.next}while(o!==t)}function Eh(t,e){return t.x-e.x}function xh(t,e){const n=function(t,e){let n,i=e,r=-1/0;const s=t.x,o=t.y;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){const t=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=s&&t>r&&(r=t,n=i.x<i.next.x?i:i.next,t===s))return n}i=i.next}while(i!==e);if(!n)return null;const a=n,l=n.x,c=n.y;let h,u=1/0;i=n;do{s>=i.x&&i.x>=l&&s!==i.x&&_h(o<c?s:r,o,l,c,o<c?r:s,o,i.x,i.y)&&(h=Math.abs(o-i.y)/(s-i.x),Lh(i,t)&&(h<u||h===u&&(i.x>n.x||i.x===n.x&&bh(n,i)))&&(n=i,u=h)),i=i.next}while(i!==a);return n}(t,e);if(!n)return e;const i=Dh(n,t);return Ah(i,i.next),Ah(n,n.next)}function bh(t,e){return Sh(t.prev,t,e.prev)<0&&Sh(e.next,t,t.next)<0}function Ch(t,e,n,i,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function wh(t){let 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 _h(t,e,n,i,r,s,o,a){return(r-o)*(e-a)>=(t-o)*(s-a)&&(t-o)*(i-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(r-o)*(i-a)}function Mh(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&&Bh(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Lh(t,e)&&Lh(e,t)&&function(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,s=(t.y+e.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!==t);return i}(t,e)&&(Sh(t.prev,t,e.prev)||Sh(t,e.prev,e))||Ih(t,e)&&Sh(t.prev,t,t.next)>0&&Sh(e.prev,e,e.next)>0)}function Sh(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Ih(t,e){return t.x===e.x&&t.y===e.y}function Bh(t,e,n,i){const r=Rh(Sh(t,e,n)),s=Rh(Sh(t,e,i)),o=Rh(Sh(n,i,t)),a=Rh(Sh(n,i,e));return r!==s&&o!==a||!(0!==r||!Th(t,n,e))||!(0!==s||!Th(t,i,e))||!(0!==o||!Th(n,t,i))||!(0!==a||!Th(n,e,i))}function Th(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 Rh(t){return t>0?1:t<0?-1:0}function Lh(t,e){return Sh(t.prev,t,t.next)<0?Sh(t,e,t.next)>=0&&Sh(t,t.prev,e)>=0:Sh(t,e,t.prev)<0||Sh(t,t.next,e)<0}function Dh(t,e){const n=new Oh(t.i,t.x,t.y),i=new Oh(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function Ph(t,e,n,i){const r=new Oh(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 Uh(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 Oh(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}class Fh{static area(t){const e=t.length;let n=0;for(let i=e-1,r=0;r<e;i=r++)n+=t[i].x*t[r].y-t[r].x*t[i].y;return.5*n}static isClockWise(t){return Fh.area(t)<0}static triangulateShape(t,e){const n=[],i=[],r=[];kh(t),Nh(n,t);let s=t.length;e.forEach(kh);for(let t=0;t<e.length;t++)i.push(s),s+=e[t].length,Nh(n,e[t]);const o=function(t,e,n=2){const i=e&&e.length,r=i?e[0]*n:t.length;let s=ph(t,0,r,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,h,u,d,p;if(i&&(s=function(t,e,n,i){const r=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:t.length,c=ph(t,a,l,i,!1),c===c.next&&(c.steiner=!0),r.push(wh(c));for(r.sort(Eh),s=0;s<r.length;s++)n=xh(r[s],n);return n}(t,e,s,n)),t.length>80*n){a=c=t[0],l=h=t[1];for(let e=n;e<r;e+=n)u=t[e],d=t[e+1],u<a&&(a=u),d<l&&(l=d),u>c&&(c=u),d>h&&(h=d);p=Math.max(c-a,h-l),p=0!==p?32767/p:0}return fh(s,o,n,a,l,p,0),o}(n,i);for(let t=0;t<o.length;t+=3)r.push(o.slice(t,t+3));return r}}function kh(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function Nh(t,e){for(let n=0;n<e.length;n++)t.push(e[n].x),t.push(e[n].y)}class Qh extends sa{constructor(t=new dh([new Br(.5,.5),new Br(-.5,.5),new Br(-.5,-.5),new Br(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:e},t=Array.isArray(t)?t:[t];const n=this,i=[],r=[];for(let e=0,n=t.length;e<n;e++)s(t[e]);function s(t){const s=[],o=void 0!==e.curveSegments?e.curveSegments:12,a=void 0!==e.steps?e.steps:1,l=void 0!==e.depth?e.depth:1;let c=void 0===e.bevelEnabled||e.bevelEnabled,h=void 0!==e.bevelThickness?e.bevelThickness:.2,u=void 0!==e.bevelSize?e.bevelSize:h-.1,d=void 0!==e.bevelOffset?e.bevelOffset:0,p=void 0!==e.bevelSegments?e.bevelSegments:3;const A=e.extrudePath,f=void 0!==e.UVGenerator?e.UVGenerator:Gh;let m,g,v,y,E,x=!1;A&&(m=A.getSpacedPoints(a),x=!0,c=!1,g=A.computeFrenetFrames(a,!1),v=new os,y=new os,E=new os),c||(p=0,h=0,u=0,d=0);const b=t.extractPoints(o);let C=b.shape;const w=b.holes;if(!Fh.isClockWise(C)){C=C.reverse();for(let t=0,e=w.length;t<e;t++){const e=w[t];Fh.isClockWise(e)&&(w[t]=e.reverse())}}const _=Fh.triangulateShape(C,w),M=C;for(let t=0,e=w.length;t<e;t++){const e=w[t];C=C.concat(e)}function S(t,e,n){return e||console.error("THREE.ExtrudeGeometry: vec does not exist"),t.clone().addScaledVector(e,n)}const I=C.length,B=_.length;function T(t,e,n){let i,r,s;const o=t.x-e.x,a=t.y-e.y,l=n.x-t.x,c=n.y-t.y,h=o*o+a*a,u=o*c-a*l;if(Math.abs(u)>Number.EPSILON){const u=Math.sqrt(h),d=Math.sqrt(l*l+c*c),p=e.x-a/u,A=e.y+o/u,f=((n.x-c/d-p)*c-(n.y+l/d-A)*l)/(o*c-a*l);i=p+o*f-t.x,r=A+a*f-t.y;const m=i*i+r*r;if(m<=2)return new Br(i,r);s=Math.sqrt(m/2)}else{let t=!1;o>Number.EPSILON?l>Number.EPSILON&&(t=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(t=!0):Math.sign(a)===Math.sign(c)&&(t=!0),t?(i=-a,r=o,s=Math.sqrt(h)):(i=o,r=a,s=Math.sqrt(h/2))}return new Br(i/s,r/s)}const R=[];for(let t=0,e=M.length,n=e-1,i=t+1;t<e;t++,n++,i++)n===e&&(n=0),i===e&&(i=0),R[t]=T(M[t],M[n],M[i]);const L=[];let D,P=R.concat();for(let t=0,e=w.length;t<e;t++){const e=w[t];D=[];for(let t=0,n=e.length,i=n-1,r=t+1;t<n;t++,i++,r++)i===n&&(i=0),r===n&&(r=0),D[t]=T(e[t],e[i],e[r]);L.push(D),P=P.concat(D)}for(let t=0;t<p;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=M.length;t<e;t++){const e=S(M[t],R[t],i);F(e.x,e.y,-n)}for(let t=0,e=w.length;t<e;t++){const e=w[t];D=L[t];for(let t=0,r=e.length;t<r;t++){const r=S(e[t],D[t],i);F(r.x,r.y,-n)}}}const U=u+d;for(let t=0;t<I;t++){const e=c?S(C[t],P[t],U):C[t];x?(y.copy(g.normals[0]).multiplyScalar(e.x),v.copy(g.binormals[0]).multiplyScalar(e.y),E.copy(m[0]).add(y).add(v),F(E.x,E.y,E.z)):F(e.x,e.y,0)}for(let t=1;t<=a;t++)for(let e=0;e<I;e++){const n=c?S(C[e],P[e],U):C[e];x?(y.copy(g.normals[t]).multiplyScalar(n.x),v.copy(g.binormals[t]).multiplyScalar(n.y),E.copy(m[t]).add(y).add(v),F(E.x,E.y,E.z)):F(n.x,n.y,l/a*t)}for(let t=p-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=M.length;t<e;t++){const e=S(M[t],R[t],i);F(e.x,e.y,l+n)}for(let t=0,e=w.length;t<e;t++){const e=w[t];D=L[t];for(let t=0,r=e.length;t<r;t++){const r=S(e[t],D[t],i);x?F(r.x,r.y+m[a-1].y,m[a-1].x+n):F(r.x,r.y,l+n)}}}function O(t,e){let n=t.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=t.length-1);for(let t=0,n=a+2*p;t<n;t++){const n=I*t,s=I*(t+1);N(e+i+n,e+r+n,e+r+s,e+i+s)}}}function F(t,e,n){s.push(t),s.push(e),s.push(n)}function k(t,e,r){Q(t),Q(e),Q(r);const s=i.length/3,o=f.generateTopUV(n,i,s-3,s-2,s-1);G(o[0]),G(o[1]),G(o[2])}function N(t,e,r,s){Q(t),Q(e),Q(s),Q(e),Q(r),Q(s);const o=i.length/3,a=f.generateSideWallUV(n,i,o-6,o-3,o-2,o-1);G(a[0]),G(a[1]),G(a[3]),G(a[1]),G(a[2]),G(a[3])}function Q(t){i.push(s[3*t+0]),i.push(s[3*t+1]),i.push(s[3*t+2])}function G(t){r.push(t.x),r.push(t.y)}!function(){const t=i.length/3;if(c){let t=0,e=I*t;for(let t=0;t<B;t++){const n=_[t];k(n[2]+e,n[1]+e,n[0]+e)}t=a+2*p,e=I*t;for(let t=0;t<B;t++){const n=_[t];k(n[0]+e,n[1]+e,n[2]+e)}}else{for(let t=0;t<B;t++){const e=_[t];k(e[2],e[1],e[0])}for(let t=0;t<B;t++){const e=_[t];k(e[0]+I*a,e[1]+I*a,e[2]+I*a)}}n.addGroup(t,i.length/3-t,0)}(),function(){const t=i.length/3;let e=0;O(M,e),e+=M.length;for(let t=0,n=w.length;t<n;t++){const n=w[t];O(n,e),e+=n.length}n.addGroup(t,i.length/3-t,1)}()}this.setAttribute("position",new Ko(i,3)),this.setAttribute("uv",new Ko(r,2)),this.computeVertexNormals()}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e,n){if(n.shapes=[],Array.isArray(t))for(let e=0,i=t.length;e<i;e++){const i=t[e];n.shapes.push(i.uuid)}else n.shapes.push(t.uuid);return n.options=Object.assign({},e),void 0!==e.extrudePath&&(n.options.extrudePath=e.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}const i=t.options.extrudePath;return void 0!==i&&(t.options.extrudePath=(new Kc[i.type]).fromJSON(i)),new Qh(n,t.options)}}const Gh={generateTopUV:function(t,e,n,i,r){const s=e[3*n],o=e[3*n+1],a=e[3*i],l=e[3*i+1],c=e[3*r],h=e[3*r+1];return[new Br(s,o),new Br(a,l),new Br(c,h)]},generateSideWallUV:function(t,e,n,i,r,s){const o=e[3*n],a=e[3*n+1],l=e[3*n+2],c=e[3*i],h=e[3*i+1],u=e[3*i+2],d=e[3*r],p=e[3*r+1],A=e[3*r+2],f=e[3*s],m=e[3*s+1],g=e[3*s+2];return Math.abs(a-h)<Math.abs(o-c)?[new Br(o,1-l),new Br(c,1-u),new Br(d,1-A),new Br(f,1-g)]:[new Br(a,1-l),new Br(h,1-u),new Br(p,1-A),new Br(m,1-g)]}};class zh extends sh{constructor(t=1,e=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,e),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new zh(t.radius,t.detail)}}class Hh extends sh{constructor(t=1,e=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,e),this.type="OctahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Hh(t.radius,t.detail)}}class Vh extends sa{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const r=t/2,s=e/2,o=Math.floor(n),a=Math.floor(i),l=o+1,c=a+1,h=t/o,u=e/a,d=[],p=[],A=[],f=[];for(let t=0;t<c;t++){const e=t*u-s;for(let n=0;n<l;n++){const i=n*h-r;p.push(i,-e,0),A.push(0,0,1),f.push(n/o),f.push(1-t/a)}}for(let t=0;t<a;t++)for(let e=0;e<o;e++){const n=e+l*t,i=e+l*(t+1),r=e+1+l*(t+1),s=e+1+l*t;d.push(n,i,s),d.push(i,r,s)}this.setIndex(d),this.setAttribute("position",new Ko(p,3)),this.setAttribute("normal",new Ko(A,3)),this.setAttribute("uv",new Ko(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Vh(t.width,t.height,t.widthSegments,t.heightSegments)}}class jh extends sa{constructor(t=.5,e=1,n=32,i=1,r=0,s=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:e,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:s},n=Math.max(3,n);const o=[],a=[],l=[],c=[];let h=t;const u=(e-t)/(i=Math.max(1,i)),d=new os,p=new Br;for(let t=0;t<=i;t++){for(let t=0;t<=n;t++){const i=r+t/n*s;d.x=h*Math.cos(i),d.y=h*Math.sin(i),a.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/e+1)/2,p.y=(d.y/e+1)/2,c.push(p.x,p.y)}h+=u}for(let t=0;t<i;t++){const e=t*(n+1);for(let t=0;t<n;t++){const i=t+e,r=i,s=i+n+1,a=i+n+2,l=i+1;o.push(r,s,l),o.push(s,a,l)}}this.setIndex(o),this.setAttribute("position",new Ko(a,3)),this.setAttribute("normal",new Ko(l,3)),this.setAttribute("uv",new Ko(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new jh(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class Wh extends sa{constructor(t=new dh([new Br(0,.5),new Br(-.5,-.5),new Br(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const n=[],i=[],r=[],s=[];let o=0,a=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(o,a,e),o+=a,a=0;function l(t){const o=i.length/3,l=t.extractPoints(e);let c=l.shape;const h=l.holes;!1===Fh.isClockWise(c)&&(c=c.reverse());for(let t=0,e=h.length;t<e;t++){const e=h[t];!0===Fh.isClockWise(e)&&(h[t]=e.reverse())}const u=Fh.triangulateShape(c,h);for(let t=0,e=h.length;t<e;t++){const e=h[t];c=c.concat(e)}for(let t=0,e=c.length;t<e;t++){const e=c[t];i.push(e.x,e.y,0),r.push(0,0,1),s.push(e.x,e.y)}for(let t=0,e=u.length;t<e;t++){const e=u[t],i=e[0]+o,r=e[1]+o,s=e[2]+o;n.push(i,r,s),a+=3}}this.setIndex(n),this.setAttribute("position",new Ko(i,3)),this.setAttribute("normal",new Ko(r,3)),this.setAttribute("uv",new Ko(s,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let n=0,i=t.length;n<i;n++){const i=t[n];e.shapes.push(i.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const n=[];for(let i=0,r=t.shapes.length;i<r;i++){const r=e[t.shapes[i]];n.push(r)}return new Wh(n,t.curveSegments)}}class qh extends sa{constructor(t=1,e=32,n=16,i=0,r=2*Math.PI,s=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:n,phiStart:i,phiLength:r,thetaStart:s,thetaLength:o},e=Math.max(3,Math.floor(e)),n=Math.max(2,Math.floor(n));const a=Math.min(s+o,Math.PI);let l=0;const c=[],h=new os,u=new os,d=[],p=[],A=[],f=[];for(let d=0;d<=n;d++){const m=[],g=d/n;let v=0;0===d&&0===s?v=.5/e:d===n&&a===Math.PI&&(v=-.5/e);for(let n=0;n<=e;n++){const a=n/e;h.x=-t*Math.cos(i+a*r)*Math.sin(s+g*o),h.y=t*Math.cos(s+g*o),h.z=t*Math.sin(i+a*r)*Math.sin(s+g*o),p.push(h.x,h.y,h.z),u.copy(h).normalize(),A.push(u.x,u.y,u.z),f.push(a+v,1-g),m.push(l++)}c.push(m)}for(let t=0;t<n;t++)for(let i=0;i<e;i++){const e=c[t][i+1],r=c[t][i],o=c[t+1][i],l=c[t+1][i+1];(0!==t||s>0)&&d.push(e,r,l),(t!==n-1||a<Math.PI)&&d.push(r,o,l)}this.setIndex(d),this.setAttribute("position",new Ko(p,3)),this.setAttribute("normal",new Ko(A,3)),this.setAttribute("uv",new Ko(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new qh(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class Xh extends sh{constructor(t=1,e=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,e),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:e}}static fromJSON(t){return new Xh(t.radius,t.detail)}}class Yh extends sa{constructor(t=1,e=.4,n=12,i=48,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:e,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const s=[],o=[],a=[],l=[],c=new os,h=new os,u=new os;for(let s=0;s<=n;s++)for(let d=0;d<=i;d++){const p=d/i*r,A=s/n*Math.PI*2;h.x=(t+e*Math.cos(A))*Math.cos(p),h.y=(t+e*Math.cos(A))*Math.sin(p),h.z=e*Math.sin(A),o.push(h.x,h.y,h.z),c.x=t*Math.cos(p),c.y=t*Math.sin(p),u.subVectors(h,c).normalize(),a.push(u.x,u.y,u.z),l.push(d/i),l.push(s/n)}for(let t=1;t<=n;t++)for(let e=1;e<=i;e++){const n=(i+1)*t+e-1,r=(i+1)*(t-1)+e-1,o=(i+1)*(t-1)+e,a=(i+1)*t+e;s.push(n,r,a),s.push(r,o,a)}this.setIndex(s),this.setAttribute("position",new Ko(o,3)),this.setAttribute("normal",new Ko(a,3)),this.setAttribute("uv",new Ko(l,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Yh(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class Jh extends sa{constructor(t=1,e=.4,n=64,i=8,r=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:e,tubularSegments:n,radialSegments:i,p:r,q:s},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],l=[],c=[],h=new os,u=new os,d=new os,p=new os,A=new os,f=new os,m=new os;for(let o=0;o<=n;++o){const v=o/n*r*Math.PI*2;g(v,r,s,t,d),g(v+.01,r,s,t,p),f.subVectors(p,d),m.addVectors(p,d),A.crossVectors(f,m),m.crossVectors(A,f),A.normalize(),m.normalize();for(let t=0;t<=i;++t){const r=t/i*Math.PI*2,s=-e*Math.cos(r),p=e*Math.sin(r);h.x=d.x+(s*m.x+p*A.x),h.y=d.y+(s*m.y+p*A.y),h.z=d.z+(s*m.z+p*A.z),a.push(h.x,h.y,h.z),u.subVectors(h,d).normalize(),l.push(u.x,u.y,u.z),c.push(o/n),c.push(t/i)}}for(let t=1;t<=n;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),s=(i+1)*t+e,a=(i+1)*(t-1)+e;o.push(n,r,a),o.push(r,s,a)}function g(t,e,n,i,r){const s=Math.cos(t),o=Math.sin(t),a=n/e*t,l=Math.cos(a);r.x=i*(2+l)*.5*s,r.y=i*(2+l)*o*.5,r.z=i*Math.sin(a)*.5}this.setIndex(o),this.setAttribute("position",new Ko(a,3)),this.setAttribute("normal",new Ko(l,3)),this.setAttribute("uv",new Ko(c,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Jh(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class Kh extends sa{constructor(t=new Yc(new os(-1,-1,0),new os(-1,1,0),new os(1,1,0)),e=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:e,radius:n,radialSegments:i,closed:r};const s=t.computeFrenetFrames(e,r);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;const o=new os,a=new os,l=new Br;let c=new os;const h=[],u=[],d=[],p=[];function A(r){c=t.getPointAt(r/e,c);const l=s.normals[r],d=s.binormals[r];for(let t=0;t<=i;t++){const e=t/i*Math.PI*2,r=Math.sin(e),s=-Math.cos(e);a.x=s*l.x+r*d.x,a.y=s*l.y+r*d.y,a.z=s*l.z+r*d.z,a.normalize(),u.push(a.x,a.y,a.z),o.x=c.x+n*a.x,o.y=c.y+n*a.y,o.z=c.z+n*a.z,h.push(o.x,o.y,o.z)}}!function(){for(let t=0;t<e;t++)A(t);A(!1===r?e:0),function(){for(let t=0;t<=e;t++)for(let n=0;n<=i;n++)l.x=t/e,l.y=n/i,d.push(l.x,l.y)}(),function(){for(let t=1;t<=e;t++)for(let e=1;e<=i;e++){const n=(i+1)*(t-1)+(e-1),r=(i+1)*t+(e-1),s=(i+1)*t+e,o=(i+1)*(t-1)+e;p.push(n,r,o),p.push(r,s,o)}}()}(),this.setIndex(p),this.setAttribute("position",new Ko(h,3)),this.setAttribute("normal",new Ko(u,3)),this.setAttribute("uv",new Ko(d,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new Kh((new Kc[t.path.type]).fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class Zh extends sa{constructor(t=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:t},null!==t){const e=[],n=new Set,i=new os,r=new os;if(null!==t.index){const s=t.attributes.position,o=t.index;let a=t.groups;0===a.length&&(a=[{start:0,count:o.count,materialIndex:0}]);for(let t=0,l=a.length;t<l;++t){const l=a[t],c=l.start;for(let t=c,a=c+l.count;t<a;t+=3)for(let a=0;a<3;a++){const l=o.getX(t+a),c=o.getX(t+(a+1)%3);i.fromBufferAttribute(s,l),r.fromBufferAttribute(s,c),!0===$h(i,r,n)&&(e.push(i.x,i.y,i.z),e.push(r.x,r.y,r.z))}}}else{const s=t.attributes.position;for(let t=0,o=s.count/3;t<o;t++)for(let o=0;o<3;o++){const a=3*t+o,l=3*t+(o+1)%3;i.fromBufferAttribute(s,a),r.fromBufferAttribute(s,l),!0===$h(i,r,n)&&(e.push(i.x,i.y,i.z),e.push(r.x,r.y,r.z))}}this.setAttribute("position",new Ko(e,3))}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}}function $h(t,e,n){const i=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`;return!0!==n.has(i)&&!0!==n.has(r)&&(n.add(i),n.add(r),!0)}var tu=Object.freeze({__proto__:null,BoxGeometry:ya,CapsuleGeometry:eh,CircleGeometry:nh,ConeGeometry:rh,CylinderGeometry:ih,DodecahedronGeometry:oh,EdgesGeometry:uh,ExtrudeGeometry:Qh,IcosahedronGeometry:zh,LatheGeometry:th,OctahedronGeometry:Hh,PlaneGeometry:Vh,PolyhedronGeometry:sh,RingGeometry:jh,ShapeGeometry:Wh,SphereGeometry:qh,TetrahedronGeometry:Xh,TorusGeometry:Yh,TorusKnotGeometry:Jh,TubeGeometry:Kh,WireframeGeometry:Zh});class eu extends Lo{constructor(t){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new Bo(0),this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.fog=t.fog,this}}class nu extends wa{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class iu extends Lo{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Bo(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Bo(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ws,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ru extends iu{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Br(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Cr(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Bo(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Bo(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Bo(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class su extends Lo{constructor(t){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Bo(16777215),this.specular=new Bo(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Bo(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ws,this.combine=Me,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),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.flatShading=t.flatShading,this.fog=t.fog,this}}class ou extends Lo{constructor(t){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Bo(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Bo(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}class au extends Lo{constructor(t){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.flatShading=t.flatShading,this}}class lu extends Lo{constructor(t){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Bo(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Bo(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ws,this.combine=Me,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(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.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),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.flatShading=t.flatShading,this.fog=t.fog,this}}class cu extends Lo{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=bi,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,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}}class hu extends Lo{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}class uu extends Lo{constructor(t){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Bo(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mi,this.normalScale=new Br(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.flatShading=t.flatShading,this.fog=t.fog,this}}class du extends ic{constructor(t){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}function pu(t,e,n){return!t||!n&&t.constructor===e?t:"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t)}function Au(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function fu(t){const e=t.length,n=new Array(e);for(let t=0;t!==e;++t)n[t]=t;return n.sort((function(e,n){return t[e]-t[n]})),n}function mu(t,e,n){const i=t.length,r=new t.constructor(i);for(let s=0,o=0;o!==i;++s){const i=n[s]*e;for(let n=0;n!==e;++n)r[o++]=t[i+n]}return r}function gu(t,e,n,i){let r=1,s=t[0];for(;void 0!==s&&void 0===s[i];)s=t[r++];if(void 0===s)return;let o=s[i];if(void 0!==o)if(Array.isArray(o))do{o=s[i],void 0!==o&&(e.push(s.time),n.push.apply(n,o)),s=t[r++]}while(void 0!==s);else if(void 0!==o.toArray)do{o=s[i],void 0!==o&&(e.push(s.time),o.toArray(n,n.length)),s=t[r++]}while(void 0!==s);else do{o=s[i],void 0!==o&&(e.push(s.time),n.push(o)),s=t[r++]}while(void 0!==s)}const vu={convertArray:pu,isTypedArray:Au,getKeyframeOrder:fu,sortedArray:mu,flattenJSON:gu,subclip:function(t,e,n,i,r=30){const s=t.clone();s.name=e;const o=[];for(let t=0;t<s.tracks.length;++t){const e=s.tracks[t],a=e.getValueSize(),l=[],c=[];for(let t=0;t<e.times.length;++t){const s=e.times[t]*r;if(!(s<n||s>=i)){l.push(e.times[t]);for(let n=0;n<a;++n)c.push(e.values[t*a+n])}}0!==l.length&&(e.times=pu(l,e.times.constructor),e.values=pu(c,e.values.constructor),o.push(e))}s.tracks=o;let a=1/0;for(let t=0;t<s.tracks.length;++t)a>s.tracks[t].times[0]&&(a=s.tracks[t].times[0]);for(let t=0;t<s.tracks.length;++t)s.tracks[t].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(t,e=0,n=t,i=30){i<=0&&(i=30);const r=n.tracks.length,s=e/i;for(let e=0;e<r;++e){const i=n.tracks[e],r=i.ValueTypeName;if("bool"===r||"string"===r)continue;const o=t.tracks.find((function(t){return t.name===i.name&&t.ValueTypeName===r}));if(void 0===o)continue;let a=0;const l=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let c=0;const h=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=h/3);const u=i.times.length-1;let d;if(s<=i.times[0]){const t=a,e=l-a;d=i.values.slice(t,e)}else if(s>=i.times[u]){const t=u*l+a,e=t+l-a;d=i.values.slice(t,e)}else{const t=i.createInterpolant(),e=a,n=l-a;t.evaluate(s),d=t.resultBuffer.slice(e,n)}"quaternion"===r&&(new ss).fromArray(d).normalize().conjugate().toArray(d);const p=o.times.length;for(let t=0;t<p;++t){const e=t*h+c;if("quaternion"===r)ss.multiplyQuaternionsFlat(o.values,e,d,0,o.values,e);else{const t=h-2*c;for(let n=0;n<t;++n)o.values[e+n]-=d[n]}}}return t.blendMode=vi,t}};class yu{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let s;n:{i:if(!(t<i)){for(let s=n+2;;){if(void 0===i){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===s)break;if(r=i,i=e[++n],t<i)break e}s=e.length;break n}if(t>=r)break t;{const o=e[1];t<o&&(n=2,r=o);for(let s=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===s)break;if(i=r,r=e[--n-1],t>=r)break e}s=n,n=0}}for(;n<s;){const i=n+s>>>1;t<e[i]?s=i:n=i+1}if(i=e[n],r=e[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let t=0;t!==i;++t)e[t]=n[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Eu extends yu{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Ai,endingEnd:Ai}}intervalChanged_(t,e,n){const i=this.parameterPositions;let r=t-2,s=t+1,o=i[r],a=i[s];if(void 0===o)switch(this.getSettings_().endingStart){case fi:r=t,o=2*e-n;break;case mi:r=i.length-2,o=e+i[r]-i[r+1];break;default:r=t,o=n}if(void 0===a)switch(this.getSettings_().endingEnd){case fi:s=t,a=2*n-e;break;case mi:s=1,a=n+i[1]-i[0];break;default:s=t-1,a=e}const l=.5*(n-e),c=this.valueSize;this._weightPrev=l/(e-o),this._weightNext=l/(a-n),this._offsetPrev=r*c,this._offsetNext=s*c}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),A=p*p,f=A*p,m=-u*f+2*u*A-u*p,g=(1+u)*f+(-1.5-2*u)*A+(-.5+u)*p+1,v=(-1-d)*f+(1.5+d)*A+.5*p,y=d*f-d*A;for(let t=0;t!==o;++t)r[t]=m*s[c+t]+g*s[l+t]+v*s[a+t]+y*s[h+t];return r}}class xu extends yu{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=t*o,l=a-o,c=(n-e)/(i-e),h=1-c;for(let t=0;t!==o;++t)r[t]=s[l+t]*h+s[a+t]*c;return r}}class bu extends yu{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class Cu{constructor(t,e,n,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=pu(e,this.TimeBufferType),this.values=pu(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:pu(t.times,Array),values:pu(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new bu(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new xu(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Eu(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case ui:e=this.InterpolantFactoryMethodDiscrete;break;case di:e=this.InterpolantFactoryMethodLinear;break;case pi:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ui;case this.InterpolantFactoryMethodLinear:return di;case this.InterpolantFactoryMethodSmooth:return pi}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){const n=this.times,i=n.length;let r=0,s=i-1;for(;r!==i&&n[r]<t;)++r;for(;-1!==s&&n[s]>e;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(r*t,s*t)}return this}validate(){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 s=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!==s&&s>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,s),t=!1;break}s=i}if(void 0!==i&&Au(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(){const t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===pi,r=t.length-1;let s=1;for(let o=1;o<r;++o){let r=!1;const a=t[o];if(a!==t[o+1]&&(1!==o||a!==t[0]))if(i)r=!0;else{const t=o*n,i=t-n,s=t+n;for(let o=0;o!==n;++o){const n=e[t+o];if(n!==e[i+o]||n!==e[s+o]){r=!0;break}}}if(r){if(o!==s){t[s]=t[o];const i=o*n,r=s*n;for(let t=0;t!==n;++t)e[r+t]=e[i+t]}++s}}if(r>0){t[s]=t[r];for(let t=r*n,i=s*n,o=0;o!==n;++o)e[i+o]=e[t+o];++s}return s!==t.length?(this.times=t.slice(0,s),this.values=e.slice(0,s*n)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}Cu.prototype.TimeBufferType=Float32Array,Cu.prototype.ValueBufferType=Float32Array,Cu.prototype.DefaultInterpolation=di;class wu extends Cu{constructor(t,e,n){super(t,e,n)}}wu.prototype.ValueTypeName="bool",wu.prototype.ValueBufferType=Array,wu.prototype.DefaultInterpolation=ui,wu.prototype.InterpolantFactoryMethodLinear=void 0,wu.prototype.InterpolantFactoryMethodSmooth=void 0;class _u extends Cu{}_u.prototype.ValueTypeName="color";class Mu extends Cu{}Mu.prototype.ValueTypeName="number";class Su extends yu{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-e)/(i-e);let l=t*o;for(let t=l+o;l!==t;l+=4)ss.slerpFlat(r,0,s,l-o,s,l,a);return r}}class Iu extends Cu{InterpolantFactoryMethodLinear(t){return new Su(this.times,this.values,this.getValueSize(),t)}}Iu.prototype.ValueTypeName="quaternion",Iu.prototype.InterpolantFactoryMethodSmooth=void 0;class Bu extends Cu{constructor(t,e,n){super(t,e,n)}}Bu.prototype.ValueTypeName="string",Bu.prototype.ValueBufferType=Array,Bu.prototype.DefaultInterpolation=ui,Bu.prototype.InterpolantFactoryMethodLinear=void 0,Bu.prototype.InterpolantFactoryMethodSmooth=void 0;class Tu extends Cu{}Tu.prototype.ValueTypeName="vector";class Ru{constructor(t="",e=-1,n=[],i=gi){this.name=t,this.tracks=n,this.duration=e,this.blendMode=i,this.uuid=br(),this.duration<0&&this.resetDuration()}static parse(t){const e=[],n=t.tracks,i=1/(t.fps||1);for(let t=0,r=n.length;t!==r;++t)e.push(Lu(n[t]).scale(i));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r}static toJSON(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(Cu.toJSON(n[t]));return i}static CreateFromMorphTargetSequence(t,e,n,i){const r=e.length,s=[];for(let t=0;t<r;t++){let o=[],a=[];o.push((t+r-1)%r,t,(t+1)%r),a.push(0,1,0);const l=fu(o);o=mu(o,1,l),a=mu(a,1,l),i||0!==o[0]||(o.push(r),a.push(a[0])),s.push(new Mu(".morphTargetInfluences["+e[t].name+"]",o,a).scale(1/n))}return new this(t,-1,s)}static findByName(t,e){let n=t;if(!Array.isArray(t)){const e=t;n=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<n.length;t++)if(n[t].name===e)return n[t];return null}static CreateClipsFromMorphTargetSequences(t,e,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,n=t.length;e<n;e++){const n=t[e],s=n.name.match(r);if(s&&s.length>1){const t=s[1];let e=i[t];e||(i[t]=e=[]),e.push(n)}}const s=[];for(const t in i)s.push(this.CreateFromMorphTargetSequence(t,i[t],e,n));return s}static parseAnimation(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 s=[],o=[];gu(n,s,o,i),0!==s.length&&r.push(new t(e,s,o))}},i=[],r=t.name||"default",s=t.fps||30,o=t.blendMode;let a=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let n=0;n<r[e].morphTargets.length;n++)t[r[e].morphTargets[n]]=-1;for(const n in t){const t=[],s=[];for(let i=0;i!==r[e].morphTargets.length;++i){const i=r[e];t.push(i.time),s.push(i.morphTarget===n?1:0)}i.push(new Mu(".morphTargetInfluence["+n+"]",t,s))}a=t.length*s}else{const s=".bones["+e[t].name+"]";n(Tu,s+".position",r,"pos",i),n(Iu,s+".quaternion",r,"rot",i),n(Tu,s+".scale",r,"scl",i)}}return 0===i.length?null:new this(r,a,i,o)}resetDuration(){let t=0;for(let e=0,n=this.tracks.length;e!==n;++e){const n=this.tracks[e];t=Math.max(t,n.times[n.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function Lu(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Mu;case"vector":case"vector2":case"vector3":case"vector4":return Tu;case"color":return _u;case"quaternion":return Iu;case"bool":case"boolean":return wu;case"string":return Bu}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],n=[];gu(t.keys,e,n,"value"),t.times=e,t.values=n}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Du={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class Pu{constructor(t,e,n){const i=this;let r,s=!1,o=0,a=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){a++,!1===s&&void 0!==i.onStart&&i.onStart(t,o,a),s=!0},this.itemEnd=function(t){o++,void 0!==i.onProgress&&i.onProgress(t,o,a),o===a&&(s=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e<n;e+=2){const n=l[e],i=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return i}return null}}}const Uu=new Pu;class Ou{constructor(t){this.manager=void 0!==t?t:Uu,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(i,r){n.load(t,i,e,r)}))}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}Ou.DEFAULT_MATERIAL_NAME="__DEFAULT";const Fu={};class ku extends Error{constructor(t,e){super(t),this.response=e}}class Nu extends Ou{constructor(t){super(t)}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=Du.get(t);if(void 0!==r)return this.manager.itemStart(t),setTimeout((()=>{e&&e(r),this.manager.itemEnd(t)}),0),r;if(void 0!==Fu[t])return void Fu[t].push({onLoad:e,onProgress:n,onError:i});Fu[t]=[],Fu[t].push({onLoad:e,onProgress:n,onError:i});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(s).then((e=>{if(200===e.status||0===e.status){if(0===e.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const n=Fu[t],i=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),s=r?parseInt(r):0,o=0!==s;let a=0;const l=new ReadableStream({start(t){!function e(){i.read().then((({done:i,value:r})=>{if(i)t.close();else{a+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:s});for(let t=0,e=n.length;t<e;t++){const e=n[t];e.onProgress&&e.onProgress(i)}t.enqueue(r),e()}}),(e=>{t.error(e)}))}()}});return new Response(l)}throw new ku(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)})).then((t=>{switch(a){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then((t=>(new DOMParser).parseFromString(t,o)));case"json":return t.json();default:if(void 0===o)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(o),n=e&&e[1]?e[1].toLowerCase():void 0,i=new TextDecoder(n);return t.arrayBuffer().then((t=>i.decode(t)))}}})).then((e=>{Du.add(t,e);const n=Fu[t];delete Fu[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onLoad&&i.onLoad(e)}})).catch((e=>{const n=Fu[t];if(void 0===n)throw this.manager.itemError(t),e;delete Fu[t];for(let t=0,i=n.length;t<i;t++){const i=n[t];i.onError&&i.onError(e)}this.manager.itemError(t)})).finally((()=>{this.manager.itemEnd(t)})),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class Qu extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Nu(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=[];for(let n=0;n<t.length;n++){const i=Ru.parse(t[n]);e.push(i)}return e}}class Gu extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=[],o=new Sc,a=new Nu(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(r.withCredentials);let l=0;function c(c){a.load(t[c],(function(t){const n=r.parse(t,!0);s[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(o.minFilter=$e),o.image=s,o.format=n.format,o.needsUpdate=!0,e&&e(o))}),n,i)}if(Array.isArray(t))for(let e=0,n=t.length;e<n;++e)c(e);else a.load(t,(function(t){const n=r.parse(t,!0);if(n.isCubemap){const t=n.mipmaps.length/n.mipmapCount;for(let e=0;e<t;e++){s[e]={mipmaps:[]};for(let t=0;t<n.mipmapCount;t++)s[e].mipmaps.push(n.mipmaps[e*n.mipmapCount+t]),s[e].format=n.format,s[e].width=n.width,s[e].height=n.height}o.image=s}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=$e),o.format=n.format,o.needsUpdate=!0,e&&e(o)}),n,i);return o}}class zu extends Ou{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Du.get(t);if(void 0!==s)return r.manager.itemStart(t),setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s;const o=Ur("img");function a(){c(),Du.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){c(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){o.removeEventListener("load",a,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",a,!1),o.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(t),o.src=t,o}}class Hu extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=new La;r.colorSpace=Bi;const s=new zu(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let o=0;function a(n){s.load(t[n],(function(t){r.images[n]=t,o++,6===o&&(r.needsUpdate=!0,e&&e(r))}),void 0,i)}for(let e=0;e<t.length;++e)a(e);return r}}class Vu extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new yl,o=new Nu(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(t,(function(t){let n;try{n=r.parse(t)}catch(t){if(void 0===i)return void console.error(t);i(t)}void 0!==n.image?s.image=n.image:void 0!==n.data&&(s.image.width=n.width,s.image.height=n.height,s.image.data=n.data),s.wrapS=void 0!==n.wrapS?n.wrapS:We,s.wrapT=void 0!==n.wrapT?n.wrapT:We,s.magFilter=void 0!==n.magFilter?n.magFilter:$e,s.minFilter=void 0!==n.minFilter?n.minFilter:$e,s.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(s.colorSpace=n.colorSpace),void 0!==n.flipY&&(s.flipY=n.flipY),void 0!==n.format&&(s.format=n.format),void 0!==n.type&&(s.type=n.type),void 0!==n.mipmaps&&(s.mipmaps=n.mipmaps,s.minFilter=nn),1===n.mipmapCount&&(s.minFilter=$e),void 0!==n.generateMipmaps&&(s.generateMipmaps=n.generateMipmaps),s.needsUpdate=!0,e&&e(s,n)}),n,i),s}}class ju extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=new Kr,s=new zu(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}class Wu extends co{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Bo(t),this.intensity=e}dispose(){}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,void 0!==this.groundColor&&(e.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(e.object.distance=this.distance),void 0!==this.angle&&(e.object.angle=this.angle),void 0!==this.decay&&(e.object.decay=this.decay),void 0!==this.penumbra&&(e.object.penumbra=this.penumbra),void 0!==this.shadow&&(e.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(e.object.target=this.target.uuid),e}}class qu extends Wu{constructor(t,e,n){super(t,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(co.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Bo(e)}copy(t,e){return super.copy(t,e),this.groundColor.copy(t.groundColor),this}}const Xu=new Os,Yu=new os,Ju=new os;class Ku{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Br(512,512),this.map=null,this.mapPass=null,this.matrix=new Os,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new kl,this._frameExtents=new Br(1,1),this._viewportCount=1,this._viewports=[new Zr(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,n=this.matrix;Yu.setFromMatrixPosition(t.matrixWorld),e.position.copy(Yu),Ju.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Ju),e.updateMatrixWorld(),Xu.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Xu),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(Xu)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 1!==this.intensity&&(t.intensity=this.intensity),0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Zu extends Ku{constructor(){super(new Ba(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(t){const e=this.camera,n=2*xr*t.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=t.distance||e.far;n===e.fov&&i===e.aspect&&r===e.far||(e.fov=n,e.aspect=i,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class $u extends Wu{constructor(t,e,n=0,i=Math.PI/3,r=0,s=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(co.DEFAULT_UP),this.updateMatrix(),this.target=new co,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new Zu}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}const td=new Os,ed=new os,nd=new os;class id extends Ku{constructor(){super(new Ba(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Br(4,2),this._viewportCount=6,this._viewports=[new Zr(2,1,1,1),new Zr(0,1,1,1),new Zr(3,1,1,1),new Zr(1,1,1,1),new Zr(3,0,1,1),new Zr(1,0,1,1)],this._cubeDirections=[new os(1,0,0),new os(-1,0,0),new os(0,0,1),new os(0,0,-1),new os(0,1,0),new os(0,-1,0)],this._cubeUps=[new os(0,1,0),new os(0,1,0),new os(0,1,0),new os(0,1,0),new os(0,0,1),new os(0,0,-1)]}updateMatrices(t,e=0){const n=this.camera,i=this.matrix,r=t.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),ed.setFromMatrixPosition(t.matrixWorld),n.position.copy(ed),nd.copy(n.position),nd.add(this._cubeDirections[e]),n.up.copy(this._cubeUps[e]),n.lookAt(nd),n.updateMatrixWorld(),i.makeTranslation(-ed.x,-ed.y,-ed.z),td.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(td)}}class rd extends Wu{constructor(t,e,n=0,i=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new id}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}class sd extends _a{constructor(t=-1,e=1,n=1,i=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,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=t,this.view.fullHeight=e,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 t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,s=n+t,o=i+e,a=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,o-=e*this.view.offsetY,a=o-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}class od extends Ku{constructor(){super(new sd(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class ad extends Wu{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(co.DEFAULT_UP),this.updateMatrix(),this.target=new co,this.shadow=new od}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}class ld extends Wu{constructor(t,e){super(t,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class cd extends Wu{constructor(t,e,n=10,i=10){super(t,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(t){this.intensity=t/(this.width*this.height*Math.PI)}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const e=super.toJSON(t);return e.object.width=this.width,e.object.height=this.height,e}}class hd{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new os)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.282095),e.addScaledVector(s[1],.488603*i),e.addScaledVector(s[2],.488603*r),e.addScaledVector(s[3],.488603*n),e.addScaledVector(s[4],n*i*1.092548),e.addScaledVector(s[5],i*r*1.092548),e.addScaledVector(s[6],.315392*(3*r*r-1)),e.addScaledVector(s[7],n*r*1.092548),e.addScaledVector(s[8],.546274*(n*n-i*i)),e}getIrradianceAt(t,e){const n=t.x,i=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.886227),e.addScaledVector(s[1],1.023328*i),e.addScaledVector(s[2],1.023328*r),e.addScaledVector(s[3],1.023328*n),e.addScaledVector(s[4],.858086*n*i),e.addScaledVector(s[5],.858086*i*r),e.addScaledVector(s[6],.743125*r*r-.247708),e.addScaledVector(s[7],.858086*n*r),e.addScaledVector(s[8],.429043*(n*n-i*i)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(t.coefficients[n],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let n=0;n<9;n++)this.coefficients[n].lerp(t.coefficients[n],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(t,e+3*i);return this}toArray(t=[],e=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(t,e+3*i);return t}static getBasisAt(t,e){const n=t.x,i=t.y,r=t.z;e[0]=.282095,e[1]=.488603*i,e[2]=.488603*r,e[3]=.488603*n,e[4]=1.092548*n*i,e[5]=1.092548*i*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*n*r,e[8]=.546274*(n*n-i*i)}}class ud extends Wu{constructor(t=new hd,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class dd extends Ou{constructor(t){super(t),this.textures={}}load(t,e,n,i){const r=this,s=new Nu(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e=this.textures;function n(t){return void 0===e[t]&&console.warn("THREE.MaterialLoader: Undefined texture",t),e[t]}const i=this.createMaterialFromType(t.type);if(void 0!==t.uuid&&(i.uuid=t.uuid),void 0!==t.name&&(i.name=t.name),void 0!==t.color&&void 0!==i.color&&i.color.setHex(t.color),void 0!==t.roughness&&(i.roughness=t.roughness),void 0!==t.metalness&&(i.metalness=t.metalness),void 0!==t.sheen&&(i.sheen=t.sheen),void 0!==t.sheenColor&&(i.sheenColor=(new Bo).setHex(t.sheenColor)),void 0!==t.sheenRoughness&&(i.sheenRoughness=t.sheenRoughness),void 0!==t.emissive&&void 0!==i.emissive&&i.emissive.setHex(t.emissive),void 0!==t.specular&&void 0!==i.specular&&i.specular.setHex(t.specular),void 0!==t.specularIntensity&&(i.specularIntensity=t.specularIntensity),void 0!==t.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(t.specularColor),void 0!==t.shininess&&(i.shininess=t.shininess),void 0!==t.clearcoat&&(i.clearcoat=t.clearcoat),void 0!==t.clearcoatRoughness&&(i.clearcoatRoughness=t.clearcoatRoughness),void 0!==t.dispersion&&(i.dispersion=t.dispersion),void 0!==t.iridescence&&(i.iridescence=t.iridescence),void 0!==t.iridescenceIOR&&(i.iridescenceIOR=t.iridescenceIOR),void 0!==t.iridescenceThicknessRange&&(i.iridescenceThicknessRange=t.iridescenceThicknessRange),void 0!==t.transmission&&(i.transmission=t.transmission),void 0!==t.thickness&&(i.thickness=t.thickness),void 0!==t.attenuationDistance&&(i.attenuationDistance=t.attenuationDistance),void 0!==t.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(t.attenuationColor),void 0!==t.anisotropy&&(i.anisotropy=t.anisotropy),void 0!==t.anisotropyRotation&&(i.anisotropyRotation=t.anisotropyRotation),void 0!==t.fog&&(i.fog=t.fog),void 0!==t.flatShading&&(i.flatShading=t.flatShading),void 0!==t.blending&&(i.blending=t.blending),void 0!==t.combine&&(i.combine=t.combine),void 0!==t.side&&(i.side=t.side),void 0!==t.shadowSide&&(i.shadowSide=t.shadowSide),void 0!==t.opacity&&(i.opacity=t.opacity),void 0!==t.transparent&&(i.transparent=t.transparent),void 0!==t.alphaTest&&(i.alphaTest=t.alphaTest),void 0!==t.alphaHash&&(i.alphaHash=t.alphaHash),void 0!==t.depthFunc&&(i.depthFunc=t.depthFunc),void 0!==t.depthTest&&(i.depthTest=t.depthTest),void 0!==t.depthWrite&&(i.depthWrite=t.depthWrite),void 0!==t.colorWrite&&(i.colorWrite=t.colorWrite),void 0!==t.blendSrc&&(i.blendSrc=t.blendSrc),void 0!==t.blendDst&&(i.blendDst=t.blendDst),void 0!==t.blendEquation&&(i.blendEquation=t.blendEquation),void 0!==t.blendSrcAlpha&&(i.blendSrcAlpha=t.blendSrcAlpha),void 0!==t.blendDstAlpha&&(i.blendDstAlpha=t.blendDstAlpha),void 0!==t.blendEquationAlpha&&(i.blendEquationAlpha=t.blendEquationAlpha),void 0!==t.blendColor&&void 0!==i.blendColor&&i.blendColor.setHex(t.blendColor),void 0!==t.blendAlpha&&(i.blendAlpha=t.blendAlpha),void 0!==t.stencilWriteMask&&(i.stencilWriteMask=t.stencilWriteMask),void 0!==t.stencilFunc&&(i.stencilFunc=t.stencilFunc),void 0!==t.stencilRef&&(i.stencilRef=t.stencilRef),void 0!==t.stencilFuncMask&&(i.stencilFuncMask=t.stencilFuncMask),void 0!==t.stencilFail&&(i.stencilFail=t.stencilFail),void 0!==t.stencilZFail&&(i.stencilZFail=t.stencilZFail),void 0!==t.stencilZPass&&(i.stencilZPass=t.stencilZPass),void 0!==t.stencilWrite&&(i.stencilWrite=t.stencilWrite),void 0!==t.wireframe&&(i.wireframe=t.wireframe),void 0!==t.wireframeLinewidth&&(i.wireframeLinewidth=t.wireframeLinewidth),void 0!==t.wireframeLinecap&&(i.wireframeLinecap=t.wireframeLinecap),void 0!==t.wireframeLinejoin&&(i.wireframeLinejoin=t.wireframeLinejoin),void 0!==t.rotation&&(i.rotation=t.rotation),void 0!==t.linewidth&&(i.linewidth=t.linewidth),void 0!==t.dashSize&&(i.dashSize=t.dashSize),void 0!==t.gapSize&&(i.gapSize=t.gapSize),void 0!==t.scale&&(i.scale=t.scale),void 0!==t.polygonOffset&&(i.polygonOffset=t.polygonOffset),void 0!==t.polygonOffsetFactor&&(i.polygonOffsetFactor=t.polygonOffsetFactor),void 0!==t.polygonOffsetUnits&&(i.polygonOffsetUnits=t.polygonOffsetUnits),void 0!==t.dithering&&(i.dithering=t.dithering),void 0!==t.alphaToCoverage&&(i.alphaToCoverage=t.alphaToCoverage),void 0!==t.premultipliedAlpha&&(i.premultipliedAlpha=t.premultipliedAlpha),void 0!==t.forceSinglePass&&(i.forceSinglePass=t.forceSinglePass),void 0!==t.visible&&(i.visible=t.visible),void 0!==t.toneMapped&&(i.toneMapped=t.toneMapped),void 0!==t.userData&&(i.userData=t.userData),void 0!==t.vertexColors&&("number"==typeof t.vertexColors?i.vertexColors=t.vertexColors>0: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 Bo).setHex(r.value);break;case"v2":i.uniforms[e].value=(new Br).fromArray(r.value);break;case"v3":i.uniforms[e].value=(new os).fromArray(r.value);break;case"v4":i.uniforms[e].value=(new Zr).fromArray(r.value);break;case"m3":i.uniforms[e].value=(new Tr).fromArray(r.value);break;case"m4":i.uniforms[e].value=(new Os).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.glslVersion&&(i.glslVersion=t.glslVersion),void 0!==t.extensions)for(const e in t.extensions)i.extensions[e]=t.extensions[e];if(void 0!==t.lights&&(i.lights=t.lights),void 0!==t.clipping&&(i.clipping=t.clipping),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 Br).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.specularIntensityMap&&(i.specularIntensityMap=n(t.specularIntensityMap)),void 0!==t.specularColorMap&&(i.specularColorMap=n(t.specularColorMap)),void 0!==t.envMap&&(i.envMap=n(t.envMap)),void 0!==t.envMapRotation&&i.envMapRotation.fromArray(t.envMapRotation),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 Br).fromArray(t.clearcoatNormalScale)),void 0!==t.iridescenceMap&&(i.iridescenceMap=n(t.iridescenceMap)),void 0!==t.iridescenceThicknessMap&&(i.iridescenceThicknessMap=n(t.iridescenceThicknessMap)),void 0!==t.transmissionMap&&(i.transmissionMap=n(t.transmissionMap)),void 0!==t.thicknessMap&&(i.thicknessMap=n(t.thicknessMap)),void 0!==t.anisotropyMap&&(i.anisotropyMap=n(t.anisotropyMap)),void 0!==t.sheenColorMap&&(i.sheenColorMap=n(t.sheenColorMap)),void 0!==t.sheenRoughnessMap&&(i.sheenRoughnessMap=n(t.sheenRoughnessMap)),i}setTextures(t){return this.textures=t,this}createMaterialFromType(t){return dd.createMaterialFromType(t)}static createMaterialFromType(t){return new{ShadowMaterial:eu,SpriteMaterial:Ha,RawShaderMaterial:nu,ShaderMaterial:wa,PointsMaterial:gc,MeshPhysicalMaterial:ru,MeshStandardMaterial:iu,MeshPhongMaterial:su,MeshToonMaterial:ou,MeshNormalMaterial:au,MeshLambertMaterial:lu,MeshDepthMaterial:cu,MeshDistanceMaterial:hu,MeshBasicMaterial:Do,MeshMatcapMaterial:uu,LineDashedMaterial:du,LineBasicMaterial:ic,Material:Lo}[t]}}class pd{static decodeText(t){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);let e="";for(let n=0,i=t.length;n<i;n++)e+=String.fromCharCode(t[n]);try{return decodeURIComponent(escape(e))}catch(t){return e}}static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}class Ad extends sa{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}toJSON(){const t=super.toJSON();return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}class fd extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Nu(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(t,(function(n){try{e(r.parse(JSON.parse(n)))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}parse(t){const e={},n={};function i(t,i){if(void 0!==e[i])return e[i];const r=t.interleavedBuffers[i],s=function(t,e){if(void 0!==n[e])return n[e];const i=t.arrayBuffers[e],r=new Uint32Array(i).buffer;return n[e]=r,r}(t,r.buffer),o=Pr(r.type,s),a=new Qa(o,r.stride);return a.uuid=r.uuid,e[i]=a,a}const r=t.isInstancedBufferGeometry?new Ad:new sa,s=t.data.index;if(void 0!==s){const t=Pr(s.type,s.array);r.setIndex(new zo(t,1))}const o=t.data.attributes;for(const e in o){const n=o[e];let s;if(n.isInterleavedBufferAttribute){const e=i(t.data,n.data);s=new za(e,n.itemSize,n.offset,n.normalized)}else{const t=Pr(n.type,n.array);s=new(n.isInstancedBufferAttribute?Cl:zo)(t,n.itemSize,n.normalized)}void 0!==n.name&&(s.name=n.name),void 0!==n.usage&&s.setUsage(n.usage),r.setAttribute(e,s)}const a=t.data.morphAttributes;if(a)for(const e in a){const n=a[e],s=[];for(let e=0,r=n.length;e<r;e++){const r=n[e];let o;if(r.isInterleavedBufferAttribute){const e=i(t.data,r.data);o=new za(e,r.itemSize,r.offset,r.normalized)}else{const t=Pr(r.type,r.array);o=new zo(t,r.itemSize,r.normalized)}void 0!==r.name&&(o.name=r.name),s.push(o)}r.morphAttributes[e]=s}t.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);const l=t.data.groups||t.data.drawcalls||t.data.offsets;if(void 0!==l)for(let t=0,e=l.length;t!==e;++t){const e=l[t];r.addGroup(e.start,e.count,e.materialIndex)}const c=t.data.boundingSphere;if(void 0!==c){const t=new os;void 0!==c.center&&t.fromArray(c.center),r.boundingSphere=new Ss(t,c.radius)}return t.name&&(r.name=t.name),t.userData&&(r.userData=t.userData),r}}class md extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=""===this.path?pd.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||s;const o=new Nu(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){let s=null;try{s=JSON.parse(n)}catch(e){return void 0!==i&&i(e),void console.error("THREE:ObjectLoader: Can't parse "+t+".",e.message)}const o=s.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())return void 0!==i&&i(new Error("THREE.ObjectLoader: Can't load "+t)),void console.error("THREE.ObjectLoader: Can't load "+t);r.parse(s,e)}),n,i)}async loadAsync(t,e){const n=""===this.path?pd.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||n;const i=new Nu(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);const r=await i.loadAsync(t,e),s=JSON.parse(r),o=s.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(s)}parse(t,e){const n=this.parseAnimations(t.animations),i=this.parseShapes(t.shapes),r=this.parseGeometries(t.geometries,i),s=this.parseImages(t.images,(function(){void 0!==e&&e(l)})),o=this.parseTextures(t.textures,s),a=this.parseMaterials(t.materials,o),l=this.parseObject(t.object,r,a,o,n),c=this.parseSkeletons(t.skeletons,l);if(this.bindSkeletons(l,c),this.bindLightTargets(l),void 0!==e){let t=!1;for(const e in s)if(s[e].data instanceof HTMLImageElement){t=!0;break}!1===t&&e(l)}return l}async parseAsync(t){const e=this.parseAnimations(t.animations),n=this.parseShapes(t.shapes),i=this.parseGeometries(t.geometries,n),r=await this.parseImagesAsync(t.images),s=this.parseTextures(t.textures,r),o=this.parseMaterials(t.materials,s),a=this.parseObject(t.object,i,o,s,e),l=this.parseSkeletons(t.skeletons,a);return this.bindSkeletons(a,l),this.bindLightTargets(a),a}parseShapes(t){const e={};if(void 0!==t)for(let n=0,i=t.length;n<i;n++){const i=(new dh).fromJSON(t[n]);e[i.uuid]=i}return e}parseSkeletons(t,e){const n={},i={};if(e.traverse((function(t){t.isBone&&(i[t.uuid]=t)})),void 0!==t)for(let e=0,r=t.length;e<r;e++){const r=(new bl).fromJSON(t[e],i);n[r.uuid]=r}return n}parseGeometries(t,e){const n={};if(void 0!==t){const i=new fd;for(let r=0,s=t.length;r<s;r++){let s;const o=t[r];switch(o.type){case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(o);break;case"Geometry":"THREE"in window&&"LegacyJSONLoader"in THREE?s=(new THREE.LegacyJSONLoader).parse(o,this.resourcePath).geometry:console.error('THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".');break;default:o.type in tu?s=tu[o.type].fromJSON(o,e):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${o.type}"`)}s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.userData&&(s.userData=o.userData),n[o.uuid]=s}}return n}parseMaterials(t,e){const n={},i={};if(void 0!==t){const r=new dd;r.setTextures(e);for(let e=0,s=t.length;e<s;e++){const s=t[e];void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i}parseAnimations(t){const e={};if(void 0!==t)for(let n=0;n<t.length;n++){const i=t[n],r=Ru.parse(i);e[r.uuid]=r}return e}parseImages(t,e){const n=this,i={};let r;function s(t){if("string"==typeof t){const e=t;return function(t){return n.manager.itemStart(t),r.load(t,(function(){n.manager.itemEnd(t)}),void 0,(function(){n.manager.itemError(t),n.manager.itemEnd(t)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(e)?e:n.resourcePath+e)}return t.data?{data:Pr(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){const n=new Pu(e);r=new zu(n),r.setCrossOrigin(this.crossOrigin);for(let e=0,n=t.length;e<n;e++){const n=t[e],r=n.url;if(Array.isArray(r)){const t=[];for(let e=0,n=r.length;e<n;e++){const n=s(r[e]);null!==n&&(n instanceof HTMLImageElement?t.push(n):t.push(new yl(n.data,n.width,n.height)))}i[n.uuid]=new Xr(t)}else{const t=s(n.url);i[n.uuid]=new Xr(t)}}}return i}async parseImagesAsync(t){const e=this,n={};let i;async function r(t){if("string"==typeof t){const n=t,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:e.resourcePath+n;return await i.loadAsync(r)}return t.data?{data:Pr(t.type,t.data),width:t.width,height:t.height}:null}if(void 0!==t&&t.length>0){i=new zu(this.manager),i.setCrossOrigin(this.crossOrigin);for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.url;if(Array.isArray(s)){const t=[];for(let e=0,n=s.length;e<n;e++){const n=s[e],i=await r(n);null!==i&&(i instanceof HTMLImageElement?t.push(i):t.push(new yl(i.data,i.width,i.height)))}n[i.uuid]=new Xr(t)}else{const t=await r(i.url);n[i.uuid]=new Xr(t)}}}return n}parseTextures(t,e){function n(t,e){return"number"==typeof t?t:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",t),e[t])}const i={};if(void 0!==t)for(let r=0,s=t.length;r<s;r++){const s=t[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===e[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);const o=e[s.image],a=o.data;let l;Array.isArray(a)?(l=new La,6===a.length&&(l.needsUpdate=!0)):(l=a&&a.data?new yl:new Kr,a&&(l.needsUpdate=!0)),l.source=o,l.uuid=s.uuid,void 0!==s.name&&(l.name=s.name),void 0!==s.mapping&&(l.mapping=n(s.mapping,gd)),void 0!==s.channel&&(l.channel=s.channel),void 0!==s.offset&&l.offset.fromArray(s.offset),void 0!==s.repeat&&l.repeat.fromArray(s.repeat),void 0!==s.center&&l.center.fromArray(s.center),void 0!==s.rotation&&(l.rotation=s.rotation),void 0!==s.wrap&&(l.wrapS=n(s.wrap[0],vd),l.wrapT=n(s.wrap[1],vd)),void 0!==s.format&&(l.format=s.format),void 0!==s.internalFormat&&(l.internalFormat=s.internalFormat),void 0!==s.type&&(l.type=s.type),void 0!==s.colorSpace&&(l.colorSpace=s.colorSpace),void 0!==s.minFilter&&(l.minFilter=n(s.minFilter,yd)),void 0!==s.magFilter&&(l.magFilter=n(s.magFilter,yd)),void 0!==s.anisotropy&&(l.anisotropy=s.anisotropy),void 0!==s.flipY&&(l.flipY=s.flipY),void 0!==s.generateMipmaps&&(l.generateMipmaps=s.generateMipmaps),void 0!==s.premultiplyAlpha&&(l.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(l.unpackAlignment=s.unpackAlignment),void 0!==s.compareFunction&&(l.compareFunction=s.compareFunction),void 0!==s.userData&&(l.userData=s.userData),i[s.uuid]=l}return i}parseObject(t,e,n,i,r){let s,o,a;function l(t){return void 0===e[t]&&console.warn("THREE.ObjectLoader: Undefined geometry",t),e[t]}function c(t){if(void 0!==t){if(Array.isArray(t)){const e=[];for(let i=0,r=t.length;i<r;i++){const r=t[i];void 0===n[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),e.push(n[r])}return e}return void 0===n[t]&&console.warn("THREE.ObjectLoader: Undefined material",t),n[t]}}function h(t){return void 0===i[t]&&console.warn("THREE.ObjectLoader: Undefined texture",t),i[t]}switch(t.type){case"Scene":s=new Na,void 0!==t.background&&(Number.isInteger(t.background)?s.background=new Bo(t.background):s.background=h(t.background)),void 0!==t.environment&&(s.environment=h(t.environment)),void 0!==t.fog&&("Fog"===t.fog.type?s.fog=new ka(t.fog.color,t.fog.near,t.fog.far):"FogExp2"===t.fog.type&&(s.fog=new Fa(t.fog.color,t.fog.density)),""!==t.fog.name&&(s.fog.name=t.fog.name)),void 0!==t.backgroundBlurriness&&(s.backgroundBlurriness=t.backgroundBlurriness),void 0!==t.backgroundIntensity&&(s.backgroundIntensity=t.backgroundIntensity),void 0!==t.backgroundRotation&&s.backgroundRotation.fromArray(t.backgroundRotation),void 0!==t.environmentIntensity&&(s.environmentIntensity=t.environmentIntensity),void 0!==t.environmentRotation&&s.environmentRotation.fromArray(t.environmentRotation);break;case"PerspectiveCamera":s=new Ba(t.fov,t.aspect,t.near,t.far),void 0!==t.focus&&(s.focus=t.focus),void 0!==t.zoom&&(s.zoom=t.zoom),void 0!==t.filmGauge&&(s.filmGauge=t.filmGauge),void 0!==t.filmOffset&&(s.filmOffset=t.filmOffset),void 0!==t.view&&(s.view=Object.assign({},t.view));break;case"OrthographicCamera":s=new sd(t.left,t.right,t.top,t.bottom,t.near,t.far),void 0!==t.zoom&&(s.zoom=t.zoom),void 0!==t.view&&(s.view=Object.assign({},t.view));break;case"AmbientLight":s=new ld(t.color,t.intensity);break;case"DirectionalLight":s=new ad(t.color,t.intensity),s.target=t.target||"";break;case"PointLight":s=new rd(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":s=new cd(t.color,t.intensity,t.width,t.height);break;case"SpotLight":s=new $u(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay),s.target=t.target||"";break;case"HemisphereLight":s=new qu(t.color,t.groundColor,t.intensity);break;case"LightProbe":s=(new ud).fromJSON(t);break;case"SkinnedMesh":o=l(t.geometry),a=c(t.material),s=new gl(o,a),void 0!==t.bindMode&&(s.bindMode=t.bindMode),void 0!==t.bindMatrix&&s.bindMatrix.fromArray(t.bindMatrix),void 0!==t.skeleton&&(s.skeleton=t.skeleton);break;case"Mesh":o=l(t.geometry),a=c(t.material),s=new ga(o,a);break;case"InstancedMesh":o=l(t.geometry),a=c(t.material);const e=t.count,n=t.instanceMatrix,i=t.instanceColor;s=new Rl(o,a,e),s.instanceMatrix=new Cl(new Float32Array(n.array),16),void 0!==i&&(s.instanceColor=new Cl(new Float32Array(i.array),i.itemSize));break;case"BatchedMesh":o=l(t.geometry),a=c(t.material),s=new nc(t.maxInstanceCount,t.maxVertexCount,t.maxIndexCount,a),s.geometry=o,s.perObjectFrustumCulled=t.perObjectFrustumCulled,s.sortObjects=t.sortObjects,s._drawRanges=t.drawRanges,s._reservedRanges=t.reservedRanges,s._visibility=t.visibility,s._active=t.active,s._bounds=t.bounds.map((t=>{const e=new cs;e.min.fromArray(t.boxMin),e.max.fromArray(t.boxMax);const n=new Ss;return n.radius=t.sphereRadius,n.center.fromArray(t.sphereCenter),{boxInitialized:t.boxInitialized,box:e,sphereInitialized:t.sphereInitialized,sphere:n}})),s._maxInstanceCount=t.maxInstanceCount,s._maxVertexCount=t.maxVertexCount,s._maxIndexCount=t.maxIndexCount,s._geometryInitialized=t.geometryInitialized,s._geometryCount=t.geometryCount,s._matricesTexture=h(t.matricesTexture.uuid),void 0!==t.colorsTexture&&(s._colorsTexture=h(t.colorsTexture.uuid));break;case"LOD":s=new al;break;case"Line":s=new uc(l(t.geometry),c(t.material));break;case"LineLoop":s=new mc(l(t.geometry),c(t.material));break;case"LineSegments":s=new fc(l(t.geometry),c(t.material));break;case"PointCloud":case"Points":s=new bc(l(t.geometry),c(t.material));break;case"Sprite":s=new il(c(t.material));break;case"Group":s=new Pa;break;case"Bone":s=new vl;break;default:s=new co}if(s.uuid=t.uuid,void 0!==t.name&&(s.name=t.name),void 0!==t.matrix?(s.matrix.fromArray(t.matrix),void 0!==t.matrixAutoUpdate&&(s.matrixAutoUpdate=t.matrixAutoUpdate),s.matrixAutoUpdate&&s.matrix.decompose(s.position,s.quaternion,s.scale)):(void 0!==t.position&&s.position.fromArray(t.position),void 0!==t.rotation&&s.rotation.fromArray(t.rotation),void 0!==t.quaternion&&s.quaternion.fromArray(t.quaternion),void 0!==t.scale&&s.scale.fromArray(t.scale)),void 0!==t.up&&s.up.fromArray(t.up),void 0!==t.castShadow&&(s.castShadow=t.castShadow),void 0!==t.receiveShadow&&(s.receiveShadow=t.receiveShadow),t.shadow&&(void 0!==t.shadow.intensity&&(s.shadow.intensity=t.shadow.intensity),void 0!==t.shadow.bias&&(s.shadow.bias=t.shadow.bias),void 0!==t.shadow.normalBias&&(s.shadow.normalBias=t.shadow.normalBias),void 0!==t.shadow.radius&&(s.shadow.radius=t.shadow.radius),void 0!==t.shadow.mapSize&&s.shadow.mapSize.fromArray(t.shadow.mapSize),void 0!==t.shadow.camera&&(s.shadow.camera=this.parseObject(t.shadow.camera))),void 0!==t.visible&&(s.visible=t.visible),void 0!==t.frustumCulled&&(s.frustumCulled=t.frustumCulled),void 0!==t.renderOrder&&(s.renderOrder=t.renderOrder),void 0!==t.userData&&(s.userData=t.userData),void 0!==t.layers&&(s.layers.mask=t.layers),void 0!==t.children){const o=t.children;for(let t=0;t<o.length;t++)s.add(this.parseObject(o[t],e,n,i,r))}if(void 0!==t.animations){const e=t.animations;for(let t=0;t<e.length;t++){const n=e[t];s.animations.push(r[n])}}if("LOD"===t.type){void 0!==t.autoUpdate&&(s.autoUpdate=t.autoUpdate);const e=t.levels;for(let t=0;t<e.length;t++){const n=e[t],i=s.getObjectByProperty("uuid",n.object);void 0!==i&&s.addLevel(i,n.distance,n.hysteresis)}}return s}bindSkeletons(t,e){0!==Object.keys(e).length&&t.traverse((function(t){if(!0===t.isSkinnedMesh&&void 0!==t.skeleton){const n=e[t.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",t.skeleton):t.bind(n,t.bindMatrix)}}))}bindLightTargets(t){t.traverse((function(e){if(e.isDirectionalLight||e.isSpotLight){const n=e.target,i=t.getObjectByProperty("uuid",n);e.target=void 0!==i?i:new co}}))}}const gd={UVMapping:Ne,CubeReflectionMapping:Qe,CubeRefractionMapping:Ge,EquirectangularReflectionMapping:ze,EquirectangularRefractionMapping:He,CubeUVReflectionMapping:Ve},vd={RepeatWrapping:je,ClampToEdgeWrapping:We,MirroredRepeatWrapping:qe},yd={NearestFilter:Xe,NearestMipmapNearestFilter:Ye,NearestMipmapLinearFilter:Ke,LinearFilter:$e,LinearMipmapNearestFilter:tn,LinearMipmapLinearFilter:nn};class Ed extends Ou{constructor(t){super(t),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,e,n,i){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Du.get(t);if(void 0!==s)return r.manager.itemStart(t),s.then?void s.then((n=>{e&&e(n),r.manager.itemEnd(t)})).catch((t=>{i&&i(t)})):(setTimeout((function(){e&&e(s),r.manager.itemEnd(t)}),0),s);const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader;const a=fetch(t,o).then((function(t){return t.blob()})).then((function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){return Du.add(t,n),e&&e(n),r.manager.itemEnd(t),n})).catch((function(e){i&&i(e),Du.remove(t),r.manager.itemError(t),r.manager.itemEnd(t)}));Du.add(t,a),r.manager.itemStart(t)}}let xd;class bd{static getContext(){return void 0===xd&&(xd=new(window.AudioContext||window.webkitAudioContext)),xd}static setContext(t){xd=t}}class Cd extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=new Nu(this.manager);function o(e){i?i(e):console.error(e),r.manager.itemError(t)}s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(t){try{const n=t.slice(0);bd.getContext().decodeAudioData(n,(function(t){e(t)})).catch(o)}catch(t){o(t)}}),n,i)}}const wd=new Os,_d=new Os,Md=new Os;class Sd{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ba,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ba,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const e=this._cache;if(e.focus!==t.focus||e.fov!==t.fov||e.aspect!==t.aspect*this.aspect||e.near!==t.near||e.far!==t.far||e.zoom!==t.zoom||e.eyeSep!==this.eyeSep){e.focus=t.focus,e.fov=t.fov,e.aspect=t.aspect*this.aspect,e.near=t.near,e.far=t.far,e.zoom=t.zoom,e.eyeSep=this.eyeSep,Md.copy(t.projectionMatrix);const n=e.eyeSep/2,i=n*e.near/e.focus,r=e.near*Math.tan(Er*e.fov*.5)/e.zoom;let s,o;_d.elements[12]=-n,wd.elements[12]=n,s=-r*e.aspect+i,o=r*e.aspect+i,Md.elements[0]=2*e.near/(o-s),Md.elements[8]=(o+s)/(o-s),this.cameraL.projectionMatrix.copy(Md),s=-r*e.aspect-i,o=r*e.aspect-i,Md.elements[0]=2*e.near/(o-s),Md.elements[8]=(o+s)/(o-s),this.cameraR.projectionMatrix.copy(Md)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(_d),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(wd)}}class Id extends Ba{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t,this.index=0}}class Bd{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Td(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=Td();t=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=t}return t}}function Td(){return performance.now()}const Rd=new os,Ld=new ss,Dd=new os,Pd=new os;class Ud extends co{constructor(){super(),this.type="AudioListener",this.context=bd.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Bd}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const e=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Rd,Ld,Dd),Pd.set(0,0,-1).applyQuaternion(Ld),e.positionX){const t=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(Rd.x,t),e.positionY.linearRampToValueAtTime(Rd.y,t),e.positionZ.linearRampToValueAtTime(Rd.z,t),e.forwardX.linearRampToValueAtTime(Pd.x,t),e.forwardY.linearRampToValueAtTime(Pd.y,t),e.forwardZ.linearRampToValueAtTime(Pd.z,t),e.upX.linearRampToValueAtTime(n.x,t),e.upY.linearRampToValueAtTime(n.y,t),e.upZ.linearRampToValueAtTime(n.z,t)}else e.setPosition(Rd.x,Rd.y,Rd.z),e.setOrientation(Pd.x,Pd.y,Pd.z,n.x,n.y,n.z)}}class Od extends co{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(t=0){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+t),this.source.onended=null),this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,e=this.filters.length;t<e;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(t){return t||(t=[]),!0===this._connected?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){return this.detune=t,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(!1!==this.hasPlaybackControl)return this.playbackRate=t,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(!1!==this.hasPlaybackControl)return this.loop=t,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}copy(t,e){return super.copy(t,e),"buffer"!==t.sourceType?(console.warn("THREE.Audio: Audio source type cannot be copied."),this):(this.autoplay=t.autoplay,this.buffer=t.buffer,this.detune=t.detune,this.loop=t.loop,this.loopStart=t.loopStart,this.loopEnd=t.loopEnd,this.offset=t.offset,this.duration=t.duration,this.playbackRate=t.playbackRate,this.hasPlaybackControl=t.hasPlaybackControl,this.sourceType=t.sourceType,this.filters=t.filters.slice(),this)}clone(t){return new this.constructor(this.listener).copy(this,t)}}const Fd=new os,kd=new ss,Nd=new os,Qd=new os;class Gd extends Od{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,e,n){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=n,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(Fd,kd,Nd),Qd.set(0,0,1).applyQuaternion(kd);const e=this.panner;if(e.positionX){const t=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(Fd.x,t),e.positionY.linearRampToValueAtTime(Fd.y,t),e.positionZ.linearRampToValueAtTime(Fd.z,t),e.orientationX.linearRampToValueAtTime(Qd.x,t),e.orientationY.linearRampToValueAtTime(Qd.y,t),e.orientationZ.linearRampToValueAtTime(Qd.z,t)}else e.setPosition(Fd.x,Fd.y,Fd.z),e.setOrientation(Qd.x,Qd.y,Qd.z)}}class zd{constructor(t,e=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const e=this.getFrequencyData();for(let n=0;n<e.length;n++)t+=e[n];return t/e.length}}class Hd{constructor(t,e,n){let i,r,s;switch(this.binding=t,this.valueSize=n,e){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const n=this.buffer,i=this.valueSize,r=t*i+i;let s=this.cumulativeWeight;if(0===s){for(let t=0;t!==i;++t)n[r+t]=n[t];s=e}else{s+=e;const t=e/s;this._mixBufferRegion(n,r,0,t,i)}this.cumulativeWeight=s}accumulateAdditive(t){const e=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,i,0,t,n),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,n=this.buffer,i=t*e+e,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(n,i,t,1-r,e)}s>0&&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]){o.setValue(n,i);break}}saveOriginalState(){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(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let n=t;n<e;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[e+n]=this.buffer[t+n]}_select(t,e,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)t[e+i]=t[n+i]}_slerp(t,e,n,i){ss.slerpFlat(t,e,t,e,t,n,i)}_slerpAdditive(t,e,n,i,r){const s=this._workIndex*r;ss.multiplyQuaternionsFlat(t,s,t,e,t,n),ss.slerpFlat(t,e,t,e,t,s,i)}_lerp(t,e,n,i,r){const s=1-i;for(let o=0;o!==r;++o){const r=e+o;t[r]=t[r]*s+t[n+o]*i}}_lerpAdditive(t,e,n,i,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[n+s]*i}}}const Vd="\\[\\]\\.:\\/",jd=new RegExp("["+Vd+"]","g"),Wd="[^"+Vd+"]",qd="[^"+Vd.replace("\\.","")+"]",Xd=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Wd)+/(WCOD+)?/.source.replace("WCOD",qd)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Wd)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Wd)+"$"),Yd=["material","materials","bones","map"];class Jd{constructor(t,e,n){this.path=e,this.parsedPath=n||Jd.parseTrackName(e),this.node=Jd.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new Jd.Composite(t,e,n):new Jd(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(jd,"")}static parseTrackName(t){const e=Xd.exec(t);if(null===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!==Yd.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}static findNode(t,e){if(void 0===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<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const s=n(r.children);if(s)return s}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=Jd.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(n){let i=e.objectIndex;switch(n){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==i){if(void 0===t[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[i]}}const s=t[i];if(void 0===s){const n=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",t)}let o=this.Versioning.None;this.targetObject=t,!0===t.isMaterial?o=this.Versioning.NeedsUpdate:!0===t.isObject3D&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(a=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Jd.Composite=class{constructor(t,e,n){const i=n||Jd.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},Jd.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Jd.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Jd.prototype.GetterByBindingType=[Jd.prototype._getValue_direct,Jd.prototype._getValue_array,Jd.prototype._getValue_arrayElement,Jd.prototype._getValue_toArray],Jd.prototype.SetterByBindingTypeAndVersioning=[[Jd.prototype._setValue_direct,Jd.prototype._setValue_direct_setNeedsUpdate,Jd.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Jd.prototype._setValue_array,Jd.prototype._setValue_array_setNeedsUpdate,Jd.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Jd.prototype._setValue_arrayElement,Jd.prototype._setValue_arrayElement_setNeedsUpdate,Jd.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Jd.prototype._setValue_fromArray,Jd.prototype._setValue_fromArray_setNeedsUpdate,Jd.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Kd{constructor(){this.isAnimationObjectGroup=!0,this.uuid=br(),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}}}add(){const t=this._objects,e=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,s=r.length;let o,a=t.length,l=this.nCachedObjects_;for(let c=0,h=arguments.length;c!==h;++c){const h=arguments[c],u=h.uuid;let d=e[u];if(void 0===d){d=a++,e[u]=d,t.push(h);for(let t=0,e=s;t!==e;++t)r[t].push(new Jd(h,n[t],i[t]))}else if(d<l){o=t[d];const a=--l,c=t[a];e[c.uuid]=d,t[d]=c,e[u]=a,t[a]=h;for(let t=0,e=s;t!==e;++t){const e=r[t],s=e[a];let o=e[d];e[d]=s,void 0===o&&(o=new Jd(h,n[t],i[t])),e[a]=o}}else t[d]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let s=0,o=arguments.length;s!==o;++s){const o=arguments[s],a=o.uuid,l=e[a];if(void 0!==l&&l>=r){const s=r++,c=t[s];e[c.uuid]=l,t[l]=c,e[a]=s,t[s]=o;for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[s],r=e[l];e[l]=i,e[s]=r}}}this.nCachedObjects_=r}uncache(){const t=this._objects,e=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=t.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=e[a];if(void 0!==l)if(delete e[a],l<r){const o=--r,a=t[o],c=--s,h=t[c];e[a.uuid]=l,t[l]=a,e[h.uuid]=o,t[o]=h,t.pop();for(let t=0,e=i;t!==e;++t){const e=n[t],i=e[o],r=e[c];e[l]=i,e[o]=r,e.pop()}}else{const r=--s,o=t[r];r>0&&(e[o.uuid]=l),t[l]=o,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_(t,e){const n=this._bindingsIndicesByPath;let i=n[t];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[t]=i,s.push(t),o.push(e),r.push(h);for(let n=c,i=a.length;n!==i;++n){const i=a[n];h[n]=new Jd(i,t,e)}return h}unsubscribe_(t){const e=this._bindingsIndicesByPath,n=e[t];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];e[t[o]]=n,s[n]=a,s.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}class Zd{constructor(t,e,n=null,i=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=n,this.blendMode=i;const r=e.tracks,s=r.length,o=new Array(s),a={endingStart:Ai,endingEnd:Ai};for(let t=0;t!==s;++t){const e=r[t].createInterpolant(null);o[t]=e,e.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=ci,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,s=n/i;t.warp(1,r,e),this.warp(s,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,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,a[1]=r+n,l[0]=t/s,l[1]=e/s,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;i<0||0===n?e=0:(this._startTime=null,e=n*i)}e*=this._updateTimeScale(t);const s=this._updateTime(e),o=this._updateWeight(t);if(o>0){const t=this._interpolants,e=this._propertyBindings;if(this.blendMode===vi)for(let n=0,i=t.length;n!==i;++n)t[n].evaluate(s),e[n].accumulateAdditive(o);else for(let n=0,r=t.length;n!==r;++n)t[n].evaluate(s),e[n].accumulate(i,o)}}_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 s=n===hi;if(0===t)return-1===r||!s||1&~r?i:e-i;if(n===li){-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,s)):this._setEndings(0===this.repetitions,!0,s)),i>=e||i<0){const n=Math.floor(i/e);i-=e*n,r+=Math.abs(n);const o=this.repetitions-r;if(o<=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===o){const e=t<0;this._setEndings(e,!e,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&~r))return e-i}return i}_setEndings(t,e,n){const i=this._interpolantSettings;n?(i.endingStart=fi,i.endingEnd=fi):(i.endingStart=t?this.zeroSlopeAtStart?fi:Ai:mi,i.endingEnd=e?this.zeroSlopeAtEnd?fi:Ai:mi)}_scheduleFading(t,e,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=e,o[1]=r+t,a[1]=n,this}}const $d=new Float32Array(1);class tp extends gr{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,e){const n=t._localRoot||this._root,i=t._clip.tracks,r=i.length,s=t._propertyBindings,o=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)++h.referenceCount,s[t]=h;else{if(h=s[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(Jd.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),s[t]=h}o[t].resultBuffer=h.buffer}}_activateAction(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(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(){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(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,n){const i=this._actions,r=this._actionsByClip;let s=r[e];if(void 0===s)s={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=s;else{const e=s.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=i.length,i.push(t),s.actionByRoot[n]=t}_removeInactiveAction(t){const e=this._actions,n=e[e.length-1],i=t._cacheIndex;n._cacheIndex=i,e[i]=n,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,s=this._actionsByClip,o=s[r],a=o.knownActions,l=a[a.length-1],c=t._byClipCacheIndex;l._byClipCacheIndex=c,a[c]=l,a.pop(),t._byClipCacheIndex=null,delete o.actionByRoot[(t._localRoot||this._root).uuid],0===a.length&&delete s[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,n=e.length;t!==n;++t){const n=e[t];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(t){const e=this._actions,n=t._cacheIndex,i=this._nActiveActions++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackAction(t){const e=this._actions,n=t._cacheIndex,i=--this._nActiveActions,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_addInactiveBinding(t,e,n){const i=this._bindingsByRootAndName,r=this._bindings;let s=i[e];void 0===s&&(s={},i[e]=s),s[n]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,n=t.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,o=s[i],a=e[e.length-1],l=t._cacheIndex;a._cacheIndex=l,e[l]=a,e.pop(),delete o[r],0===Object.keys(o).length&&delete s[i]}_lendBinding(t){const e=this._bindings,n=t._cacheIndex,i=this._nActiveBindings++,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_takeBackBinding(t){const e=this._bindings,n=t._cacheIndex,i=--this._nActiveBindings,r=e[i];t._cacheIndex=i,e[i]=t,r._cacheIndex=n,e[n]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let n=t[e];return void 0===n&&(n=new xu(new Float32Array(2),new Float32Array(2),1,$d),n.__cacheIndex=e,t[e]=n),n}_takeBackControlInterpolant(t){const e=this._controlInterpolants,n=t.__cacheIndex,i=--this._nActiveControlInterpolants,r=e[i];t.__cacheIndex=i,e[i]=t,r.__cacheIndex=n,e[n]=r}clipAction(t,e,n){const i=e||this._root,r=i.uuid;let s="string"==typeof t?Ru.findByName(i,t):t;const o=null!==s?s.uuid:t,a=this._actionsByClip[o];let l=null;if(void 0===n&&(n=null!==s?s.blendMode:gi),void 0!==a){const t=a.actionByRoot[r];if(void 0!==t&&t.blendMode===n)return t;l=a.knownActions[0],null===s&&(s=l._clip)}if(null===s)return null;const c=new Zd(this,s,e,n);return this._bindAction(c,l),this._addInactiveAction(c,o,r),c}existingAction(t,e){const n=e||this._root,i=n.uuid,r="string"==typeof t?Ru.findByName(n,t):t,s=r?r.uuid:t,o=this._actionsByClip[s];return void 0!==o&&o.actionByRoot[i]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,n=this._nActiveActions,i=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let o=0;o!==n;++o)e[o]._update(i,t,r,s);const o=this._bindings,a=this._nActiveBindings;for(let t=0;t!==a;++t)o[t].apply(s);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,n=t.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const t=r.knownActions;for(let n=0,i=t.length;n!==i;++n){const i=t[n];this._deactivateAction(i);const r=i._cacheIndex,s=e[e.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,s._cacheIndex=r,e[r]=s,e.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(t){const e=t.uuid,n=this._actionsByClip;for(const t in n){const i=n[t].actionByRoot[e];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}const i=this._bindingsByRootAndName[e];if(void 0!==i)for(const t in i){const e=i[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const n=this.existingAction(t,e);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class ep extends $r{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new is(null,t,e,n),this.texture.isRenderTargetTexture=!0}}class np extends $r{constructor(t=1,e=1,n=1,i={}){super(t,e,i),this.isRenderTargetArray=!0,this.depth=n,this.texture=new es(null,t,e,n),this.texture.isRenderTargetTexture=!0}}class ip{constructor(t){this.value=t}clone(){return new ip(void 0===this.value.clone?this.value:this.value.clone())}}let rp=0;class sp extends gr{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:rp++}),this.name="",this.usage=ir,this.uniforms=[]}add(t){return this.uniforms.push(t),this}remove(t){const e=this.uniforms.indexOf(t);return-1!==e&&this.uniforms.splice(e,1),this}setName(t){return this.name=t,this}setUsage(t){return this.usage=t,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(t){this.name=t.name,this.usage=t.usage;const e=t.uniforms;this.uniforms.length=0;for(let t=0,n=e.length;t<n;t++){const n=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0;t<n.length;t++)this.uniforms.push(n[t].clone())}return this}clone(){return(new this.constructor).copy(this)}}class op extends Qa{constructor(t,e,n=1){super(t,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const e=super.clone(t);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(t){const e=super.toJSON(t);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}class ap{constructor(t,e,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=t,this.type=e,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(t){!0===t&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,e){return this.type=t,this.elementSize=e,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}const lp=new Os;class cp{constructor(t,e,n=0,i=1/0){this.ray=new Us(t,e),this.near=n,this.far=i,this.camera=null,this.layers=new qs,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):console.error("THREE.Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return lp.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(lp),this}intersectObject(t,e=!0,n=[]){return up(t,this,n,e),n.sort(hp),n}intersectObjects(t,e=!0,n=[]){for(let i=0,r=t.length;i<r;i++)up(t[i],this,n,e);return n.sort(hp),n}}function hp(t,e){return t.distance-e.distance}function up(t,e,n,i){let r=!0;if(t.layers.test(e.layers)&&!1===t.raycast(e,n)&&(r=!1),!0===r&&!0===i){const i=t.children;for(let t=0,r=i.length;t<r;t++)up(i[t],e,n,!0)}}class dp{constructor(t=1,e=0,n=0){return this.radius=t,this.phi=e,this.theta=n,this}set(t,e,n){return this.radius=t,this.phi=e,this.theta=n,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=Cr(this.phi,t,Math.PI-t),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+e*e+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,n),this.phi=Math.acos(Cr(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class pp{constructor(t=1,e=0,n=0){return this.radius=t,this.theta=e,this.y=n,this}set(t,e,n){return this.radius=t,this.theta=e,this.y=n,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,n){return this.radius=Math.sqrt(t*t+n*n),this.theta=Math.atan2(t,n),this.y=e,this}clone(){return(new this.constructor).copy(this)}}class Ap{constructor(t,e,n,i){Ap.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==t&&this.set(t,e,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(t,e=0){for(let n=0;n<4;n++)this.elements[n]=t[n+e];return this}set(t,e,n,i){const r=this.elements;return r[0]=t,r[2]=e,r[1]=n,r[3]=i,this}}const fp=new Br;class mp{constructor(t=new Br(1/0,1/0),e=new Br(-1/0,-1/0)){this.isBox2=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=fp.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.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 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.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,fp).distanceTo(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}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 gp=new os,vp=new os;class yp{constructor(t=new os,e=new os){this.start=t,this.end=e}set(t,e){return this.start.copy(t),this.end.copy(e),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,e){return this.delta(e).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,e){gp.subVectors(t,this.start),vp.subVectors(this.end,this.start);const n=vp.dot(vp);let i=vp.dot(gp)/n;return e&&(i=Cr(i,0,1)),i}closestPointToPoint(t,e,n){const i=this.closestPointToPointParameter(t,e);return 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)}clone(){return(new this.constructor).copy(this)}}const Ep=new os;class xp extends co{constructor(t,e){super(),this.light=t,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const n=new sa,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<n;t++,e++){const r=t/n*Math.PI*2,s=e/n*Math.PI*2;i.push(Math.cos(r),Math.sin(r),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new Ko(i,3));const r=new ic({fog:!1,toneMapped:!1});this.cone=new fc(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const t=this.light.distance?this.light.distance:1e3,e=t*Math.tan(this.light.angle);this.cone.scale.set(e,e,t),Ep.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Ep),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const bp=new os,Cp=new Os,wp=new Os;class _p extends fc{constructor(t){const e=Mp(t),n=new sa,i=[],r=[],s=new Bo(0,0,1),o=new Bo(0,1,0);for(let t=0;t<e.length;t++){const n=e[t];n.parent&&n.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(s.r,s.g,s.b),r.push(o.r,o.g,o.b))}n.setAttribute("position",new Ko(i,3)),n.setAttribute("color",new Ko(r,3)),super(n,new ic({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=t,this.bones=e,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const e=this.bones,n=this.geometry,i=n.getAttribute("position");wp.copy(this.root.matrixWorld).invert();for(let t=0,n=0;t<e.length;t++){const r=e[t];r.parent&&r.parent.isBone&&(Cp.multiplyMatrices(wp,r.matrixWorld),bp.setFromMatrixPosition(Cp),i.setXYZ(n,bp.x,bp.y,bp.z),Cp.multiplyMatrices(wp,r.parent.matrixWorld),bp.setFromMatrixPosition(Cp),i.setXYZ(n+1,bp.x,bp.y,bp.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Mp(t){const e=[];!0===t.isBone&&e.push(t);for(let n=0;n<t.children.length;n++)e.push.apply(e,Mp(t.children[n]));return e}class Sp extends ga{constructor(t,e,n){super(new qh(e,4,2),new Do({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Ip=new os,Bp=new Bo,Tp=new Bo;class Rp extends co{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new Hh(e);i.rotateY(.5*Math.PI),this.material=new Do({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),s=new Float32Array(3*r.count);i.setAttribute("color",new zo(s,3)),this.add(new ga(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const e=t.geometry.getAttribute("color");Bp.copy(this.light.color),Tp.copy(this.light.groundColor);for(let t=0,n=e.count;t<n;t++){const i=t<n/2?Bp:Tp;e.setXYZ(t,i.r,i.g,i.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),t.lookAt(Ip.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Lp extends fc{constructor(t=10,e=10,n=4473924,i=8947848){n=new Bo(n),i=new Bo(i);const r=e/2,s=t/e,o=t/2,a=[],l=[];for(let t=0,c=0,h=-o;t<=e;t++,h+=s){a.push(-o,0,h,o,0,h),a.push(h,0,-o,h,0,o);const e=t===r?n:i;e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3,e.toArray(l,c),c+=3}const c=new sa;c.setAttribute("position",new Ko(a,3)),c.setAttribute("color",new Ko(l,3)),super(c,new ic({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class Dp extends fc{constructor(t=10,e=16,n=8,i=64,r=4473924,s=8947848){r=new Bo(r),s=new Bo(s);const o=[],a=[];if(e>1)for(let n=0;n<e;n++){const i=n/e*(2*Math.PI),l=Math.sin(i)*t,c=Math.cos(i)*t;o.push(0,0,0),o.push(l,0,c);const h=1&n?r:s;a.push(h.r,h.g,h.b),a.push(h.r,h.g,h.b)}for(let e=0;e<n;e++){const l=1&e?r:s,c=t-t/n*e;for(let t=0;t<i;t++){let e=t/i*(2*Math.PI),n=Math.sin(e)*c,r=Math.cos(e)*c;o.push(n,0,r),a.push(l.r,l.g,l.b),e=(t+1)/i*(2*Math.PI),n=Math.sin(e)*c,r=Math.cos(e)*c,o.push(n,0,r),a.push(l.r,l.g,l.b)}}const l=new sa;l.setAttribute("position",new Ko(o,3)),l.setAttribute("color",new Ko(a,3)),super(l,new ic({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const Pp=new os,Up=new os,Op=new os;class Fp extends co{constructor(t,e,n){super(),this.light=t,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",void 0===e&&(e=1);let i=new sa;i.setAttribute("position",new Ko([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const r=new ic({fog:!1,toneMapped:!1});this.lightPlane=new uc(i,r),this.add(this.lightPlane),i=new sa,i.setAttribute("position",new Ko([0,0,0,0,0,1],3)),this.targetLine=new uc(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),Pp.setFromMatrixPosition(this.light.matrixWorld),Up.setFromMatrixPosition(this.light.target.matrixWorld),Op.subVectors(Up,Pp),this.lightPlane.lookAt(Up),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(Up),this.targetLine.scale.z=Op.length()}}const kp=new os,Np=new _a;class Qp extends fc{constructor(t){const e=new sa,n=new ic({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={};function o(t,e){a(t),a(e)}function a(t){i.push(0,0,0),r.push(0,0,0),void 0===s[t]&&(s[t]=[]),s[t].push(i.length/3-1)}o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4"),e.setAttribute("position",new Ko(i,3)),e.setAttribute("color",new Ko(r,3)),super(e,n),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update();const l=new Bo(16755200),c=new Bo(16711680),h=new Bo(43775),u=new Bo(16777215),d=new Bo(3355443);this.setColors(l,c,h,u,d)}setColors(t,e,n,i,r){const s=this.geometry.getAttribute("color");s.setXYZ(0,t.r,t.g,t.b),s.setXYZ(1,t.r,t.g,t.b),s.setXYZ(2,t.r,t.g,t.b),s.setXYZ(3,t.r,t.g,t.b),s.setXYZ(4,t.r,t.g,t.b),s.setXYZ(5,t.r,t.g,t.b),s.setXYZ(6,t.r,t.g,t.b),s.setXYZ(7,t.r,t.g,t.b),s.setXYZ(8,t.r,t.g,t.b),s.setXYZ(9,t.r,t.g,t.b),s.setXYZ(10,t.r,t.g,t.b),s.setXYZ(11,t.r,t.g,t.b),s.setXYZ(12,t.r,t.g,t.b),s.setXYZ(13,t.r,t.g,t.b),s.setXYZ(14,t.r,t.g,t.b),s.setXYZ(15,t.r,t.g,t.b),s.setXYZ(16,t.r,t.g,t.b),s.setXYZ(17,t.r,t.g,t.b),s.setXYZ(18,t.r,t.g,t.b),s.setXYZ(19,t.r,t.g,t.b),s.setXYZ(20,t.r,t.g,t.b),s.setXYZ(21,t.r,t.g,t.b),s.setXYZ(22,t.r,t.g,t.b),s.setXYZ(23,t.r,t.g,t.b),s.setXYZ(24,e.r,e.g,e.b),s.setXYZ(25,e.r,e.g,e.b),s.setXYZ(26,e.r,e.g,e.b),s.setXYZ(27,e.r,e.g,e.b),s.setXYZ(28,e.r,e.g,e.b),s.setXYZ(29,e.r,e.g,e.b),s.setXYZ(30,e.r,e.g,e.b),s.setXYZ(31,e.r,e.g,e.b),s.setXYZ(32,n.r,n.g,n.b),s.setXYZ(33,n.r,n.g,n.b),s.setXYZ(34,n.r,n.g,n.b),s.setXYZ(35,n.r,n.g,n.b),s.setXYZ(36,n.r,n.g,n.b),s.setXYZ(37,n.r,n.g,n.b),s.setXYZ(38,i.r,i.g,i.b),s.setXYZ(39,i.r,i.g,i.b),s.setXYZ(40,r.r,r.g,r.b),s.setXYZ(41,r.r,r.g,r.b),s.setXYZ(42,r.r,r.g,r.b),s.setXYZ(43,r.r,r.g,r.b),s.setXYZ(44,r.r,r.g,r.b),s.setXYZ(45,r.r,r.g,r.b),s.setXYZ(46,r.r,r.g,r.b),s.setXYZ(47,r.r,r.g,r.b),s.setXYZ(48,r.r,r.g,r.b),s.setXYZ(49,r.r,r.g,r.b),s.needsUpdate=!0}update(){const t=this.geometry,e=this.pointMap;Np.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse);const n=this.camera.coordinateSystem===Ar?-1:0;Gp("c",e,t,Np,0,0,n),Gp("t",e,t,Np,0,0,1),Gp("n1",e,t,Np,-1,-1,n),Gp("n2",e,t,Np,1,-1,n),Gp("n3",e,t,Np,-1,1,n),Gp("n4",e,t,Np,1,1,n),Gp("f1",e,t,Np,-1,-1,1),Gp("f2",e,t,Np,1,-1,1),Gp("f3",e,t,Np,-1,1,1),Gp("f4",e,t,Np,1,1,1),Gp("u1",e,t,Np,.7,1.1,n),Gp("u2",e,t,Np,-.7,1.1,n),Gp("u3",e,t,Np,0,2,n),Gp("cf1",e,t,Np,-1,0,1),Gp("cf2",e,t,Np,1,0,1),Gp("cf3",e,t,Np,0,-1,1),Gp("cf4",e,t,Np,0,1,1),Gp("cn1",e,t,Np,-1,0,n),Gp("cn2",e,t,Np,1,0,n),Gp("cn3",e,t,Np,0,-1,n),Gp("cn4",e,t,Np,0,1,n),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function Gp(t,e,n,i,r,s,o){kp.set(r,s,o).unproject(i);const a=e[t];if(void 0!==a){const t=n.getAttribute("position");for(let e=0,n=a.length;e<n;e++)t.setXYZ(a[e],kp.x,kp.y,kp.z)}}const zp=new cs;class Hp extends fc{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new sa;r.setIndex(new zo(n,1)),r.setAttribute("position",new zo(i,3)),super(r,new ic({color:e,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(void 0!==t&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&zp.setFromObject(this.object),zp.isEmpty())return;const e=zp.min,n=zp.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=e.x,r[4]=n.y,r[5]=n.z,r[6]=e.x,r[7]=e.y,r[8]=n.z,r[9]=n.x,r[10]=e.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=e.z,r[15]=e.x,r[16]=n.y,r[17]=e.z,r[18]=e.x,r[19]=e.y,r[20]=e.z,r[21]=n.x,r[22]=e.y,r[23]=e.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t,e){return super.copy(t,e),this.object=t.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Vp extends fc{constructor(t,e=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new sa;i.setIndex(new zo(n,1)),i.setAttribute("position",new Ko([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new ic({color:e,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}dispose(){this.geometry.dispose(),this.material.dispose()}}class jp extends uc{constructor(t,e=1,n=16776960){const i=n,r=new sa;r.setAttribute("position",new Ko([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),r.computeBoundingSphere(),super(r,new ic({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=e;const s=new sa;s.setAttribute("position",new Ko([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),this.add(new ga(s,new Do({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(t)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const Wp=new os;let qp,Xp;class Yp extends co{constructor(t=new os(0,0,1),e=new os(0,0,0),n=1,i=16776960,r=.2*n,s=.2*r){super(),this.type="ArrowHelper",void 0===qp&&(qp=new sa,qp.setAttribute("position",new Ko([0,0,0,0,1,0],3)),Xp=new ih(0,.5,1,5,1),Xp.translate(0,-.5,0)),this.position.copy(e),this.line=new uc(qp,new ic({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ga(Xp,new Do({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(n,r,s)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{Wp.set(t.z,0,-t.x).normalize();const e=Math.acos(t.y);this.quaternion.setFromAxisAngle(Wp,e)}}setLength(t,e=.2*t,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}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class Jp extends fc{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 sa;n.setAttribute("position",new Ko(e,3)),n.setAttribute("color",new Ko([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new ic({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,e,n){const i=new Bo,r=this.geometry.attributes.color.array;return i.set(t),i.toArray(r,0),i.toArray(r,3),i.set(e),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class Kp{constructor(){this.type="ShapePath",this.color=new Bo,this.subPaths=[],this.currentPath=null}moveTo(t,e){return this.currentPath=new $c,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,e),this}lineTo(t,e){return this.currentPath.lineTo(t,e),this}quadraticCurveTo(t,e,n,i){return this.currentPath.quadraticCurveTo(t,e,n,i),this}bezierCurveTo(t,e,n,i,r,s){return this.currentPath.bezierCurveTo(t,e,n,i,r,s),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t){function e(t,e){const n=e.length;let i=!1;for(let r=n-1,s=0;s<n;r=s++){let n=e[r],o=e[s],a=o.x-n.x,l=o.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=e[s],a=-a,o=e[r],l=-l),t.y<n.y||t.y>o.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(o.x<=t.x&&t.x<=n.x||n.x<=t.x&&t.x<=o.x)return!0}}return i}const n=Fh.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,s,o;const a=[];if(1===i.length)return s=i[0],o=new dh,o.curves=s.curves,a.push(o),a;let l=!n(i[0].getPoints());l=t?!l:l;const c=[],h=[];let u,d,p=[],A=0;h[A]=void 0,p[A]=[];for(let e=0,o=i.length;e<o;e++)s=i[e],u=s.getPoints(),r=n(u),r=t?!r:r,r?(!l&&h[A]&&A++,h[A]={s:new dh,p:u},h[A].s.curves=s.curves,l&&A++,p[A]=[]):p[A].push({h:s,p:u[0]});if(!h[0])return function(t){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n],r=new dh;r.curves=i.curves,e.push(r)}return e}(i);if(h.length>1){let t=!1,n=0;for(let t=0,e=h.length;t<e;t++)c[t]=[];for(let i=0,r=h.length;i<r;i++){const r=p[i];for(let s=0;s<r.length;s++){const o=r[s];let a=!0;for(let r=0;r<h.length;r++)e(o.p,h[r].p)&&(i!==r&&n++,a?(a=!1,c[r].push(o)):t=!0);a&&c[i].push(o)}}n>0&&!1===t&&(p=c)}for(let t=0,e=h.length;t<e;t++){o=h[t].s,a.push(o),d=p[t];for(let t=0,e=d.length;t<e;t++)o.holes.push(d[t].h)}return a}}class Zp extends gr{constructor(t,e=null){super(),this.object=t,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}function $p(t,e,n,i){const r=function(t){switch(t){case sn:case on:return{byteLength:1,components:1};case ln:case an:case dn:return{byteLength:2,components:1};case pn:case An:return{byteLength:2,components:4};case hn:case cn:case un:return{byteLength:4,components:1};case mn:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}(i);switch(n){case gn:case En:return t*e;case xn:return t*e*2;case wn:case _n:return t*e/r.components*r.byteLength;case Mn:case Sn:return t*e*2/r.components*r.byteLength;case vn:return t*e*3/r.components*r.byteLength;case yn:case Bn:return t*e*4/r.components*r.byteLength;case Tn:case Rn:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Ln:case Dn:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Un:case Fn:return Math.max(t,16)*Math.max(e,8)/4;case Pn:case On:return Math.max(t,8)*Math.max(e,8)/2;case kn:case Nn:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Qn:case Gn:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case zn:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case Hn:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case Vn:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case jn:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case Wn:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case qn:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case Xn:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case Yn:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case Jn:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case Kn:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case Zn:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case $n:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case ti:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case ei:case ni:case ii:return Math.ceil(t/4)*Math.ceil(e/4)*16;case ri:case si:return Math.ceil(t/4)*Math.ceil(e/4)*8;case oi:case ai:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}const tA={contain:function(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t},cover:function(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t},fill:function(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t},getByteLength:$p};function eA(){let t=null,e=!1,n=null,i=null;function r(e,s){n(e,s),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 nA(t){const e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=e.get(n);i&&(t.deleteBuffer(i.buffer),e.delete(n))},update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const t=e.get(n);return void((!t||t.version<n.version)&&e.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}const r=e.get(n);if(void 0===r)e.set(n,function(e,n){const i=e.array,r=e.usage,s=i.byteLength,o=t.createBuffer();let a;if(t.bindBuffer(n,o),t.bufferData(n,i,r),e.onUploadCallback(),i instanceof Float32Array)a=t.FLOAT;else if(i instanceof Uint16Array)a=e.isFloat16BufferAttribute?t.HALF_FLOAT:t.UNSIGNED_SHORT;else if(i instanceof Int16Array)a=t.SHORT;else if(i instanceof Uint32Array)a=t.UNSIGNED_INT;else if(i instanceof Int32Array)a=t.INT;else if(i instanceof Int8Array)a=t.BYTE;else if(i instanceof Uint8Array)a=t.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);a=t.UNSIGNED_BYTE}return{buffer:o,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version,size:s}}(n,i));else if(r.version<n.version){if(r.size!==n.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(e,n,i){const r=n.array,s=n.updateRanges;if(t.bindBuffer(i,e),0===s.length)t.bufferSubData(i,0,r);else{s.sort(((t,e)=>t.start-e.start));let e=0;for(let t=1;t<s.length;t++){const n=s[e],i=s[t];i.start<=n.start+n.count+1?n.count=Math.max(n.count,i.start+i.count-n.start):(++e,s[e]=i)}s.length=e+1;for(let e=0,n=s.length;e<n;e++){const n=s[e];t.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Lt}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Lt);const iA={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_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 ) || defined( USE_BATCHING_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\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( 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 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in 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( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\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 shadowIntensity;\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\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 shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, 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.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},rA={common:{diffuse:{value:new Bo(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Tr},alphaMap:{value:null},alphaMapTransform:{value:new Tr},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Tr}},envmap:{envMap:{value:null},envMapRotation:{value:new Tr},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Tr}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Tr}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Tr},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Tr},normalScale:{value:new Br(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Tr},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Tr}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Tr}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Tr}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Bo(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 Bo(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Tr},alphaTest:{value:0},uvTransform:{value:new Tr}},sprite:{diffuse:{value:new Bo(16777215)},opacity:{value:1},center:{value:new Br(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Tr},alphaMap:{value:null},alphaMapTransform:{value:new Tr},alphaTest:{value:0}}},sA={basic:{uniforms:xa([rA.common,rA.specularmap,rA.envmap,rA.aomap,rA.lightmap,rA.fog]),vertexShader:iA.meshbasic_vert,fragmentShader:iA.meshbasic_frag},lambert:{uniforms:xa([rA.common,rA.specularmap,rA.envmap,rA.aomap,rA.lightmap,rA.emissivemap,rA.bumpmap,rA.normalmap,rA.displacementmap,rA.fog,rA.lights,{emissive:{value:new Bo(0)}}]),vertexShader:iA.meshlambert_vert,fragmentShader:iA.meshlambert_frag},phong:{uniforms:xa([rA.common,rA.specularmap,rA.envmap,rA.aomap,rA.lightmap,rA.emissivemap,rA.bumpmap,rA.normalmap,rA.displacementmap,rA.fog,rA.lights,{emissive:{value:new Bo(0)},specular:{value:new Bo(1118481)},shininess:{value:30}}]),vertexShader:iA.meshphong_vert,fragmentShader:iA.meshphong_frag},standard:{uniforms:xa([rA.common,rA.envmap,rA.aomap,rA.lightmap,rA.emissivemap,rA.bumpmap,rA.normalmap,rA.displacementmap,rA.roughnessmap,rA.metalnessmap,rA.fog,rA.lights,{emissive:{value:new Bo(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:iA.meshphysical_vert,fragmentShader:iA.meshphysical_frag},toon:{uniforms:xa([rA.common,rA.aomap,rA.lightmap,rA.emissivemap,rA.bumpmap,rA.normalmap,rA.displacementmap,rA.gradientmap,rA.fog,rA.lights,{emissive:{value:new Bo(0)}}]),vertexShader:iA.meshtoon_vert,fragmentShader:iA.meshtoon_frag},matcap:{uniforms:xa([rA.common,rA.bumpmap,rA.normalmap,rA.displacementmap,rA.fog,{matcap:{value:null}}]),vertexShader:iA.meshmatcap_vert,fragmentShader:iA.meshmatcap_frag},points:{uniforms:xa([rA.points,rA.fog]),vertexShader:iA.points_vert,fragmentShader:iA.points_frag},dashed:{uniforms:xa([rA.common,rA.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:iA.linedashed_vert,fragmentShader:iA.linedashed_frag},depth:{uniforms:xa([rA.common,rA.displacementmap]),vertexShader:iA.depth_vert,fragmentShader:iA.depth_frag},normal:{uniforms:xa([rA.common,rA.bumpmap,rA.normalmap,rA.displacementmap,{opacity:{value:1}}]),vertexShader:iA.meshnormal_vert,fragmentShader:iA.meshnormal_frag},sprite:{uniforms:xa([rA.sprite,rA.fog]),vertexShader:iA.sprite_vert,fragmentShader:iA.sprite_frag},background:{uniforms:{uvTransform:{value:new Tr},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:iA.background_vert,fragmentShader:iA.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Tr}},vertexShader:iA.backgroundCube_vert,fragmentShader:iA.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:iA.cube_vert,fragmentShader:iA.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:iA.equirect_vert,fragmentShader:iA.equirect_frag},distanceRGBA:{uniforms:xa([rA.common,rA.displacementmap,{referencePosition:{value:new os},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:iA.distanceRGBA_vert,fragmentShader:iA.distanceRGBA_frag},shadow:{uniforms:xa([rA.lights,rA.fog,{color:{value:new Bo(0)},opacity:{value:1}}]),vertexShader:iA.shadow_vert,fragmentShader:iA.shadow_frag}};sA.physical={uniforms:xa([sA.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Tr},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Tr},clearcoatNormalScale:{value:new Br(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Tr},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Tr},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Tr},sheen:{value:0},sheenColor:{value:new Bo(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Tr},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Tr},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Tr},transmissionSamplerSize:{value:new Br},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Tr},attenuationDistance:{value:0},attenuationColor:{value:new Bo(0)},specularColor:{value:new Bo(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Tr},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Tr},anisotropyVector:{value:new Br},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Tr}}]),vertexShader:iA.meshphysical_vert,fragmentShader:iA.meshphysical_frag};const oA={r:0,b:0,g:0},aA=new Ws,lA=new Os;function cA(t,e,n,i,r,s,o){const a=new Bo(0);let l,c,h=!0===s?0:1,u=null,d=0,p=null;function A(t){let i=!0===t.isScene?t.background:null;return i&&i.isTexture&&(i=(t.backgroundBlurriness>0?n:e).get(i)),i}function f(e,n){e.getRGB(oA,ba(t)),i.buffers.color.setClear(oA.r,oA.g,oA.b,n,o)}return{getClearColor:function(){return a},setClearColor:function(t,e=1){a.set(t),h=e,f(a,h)},getClearAlpha:function(){return h},setClearAlpha:function(t){h=t,f(a,h)},render:function(e){let n=!1;const r=A(e);null===r?f(a,h):r&&r.isColor&&(f(r,1),n=!0);const s=t.xr.getEnvironmentBlendMode();"additive"===s?i.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===s&&i.buffers.color.setClear(0,0,0,0,o),(t.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))},addToRenderList:function(e,n){const i=A(n);i&&(i.isCubeTexture||i.mapping===Ve)?(void 0===c&&(c=new ga(new ya(1e4,1e4,1e4),new wa({name:"BackgroundCubeMaterial",uniforms:Ea(sA.backgroundCube.uniforms),vertexShader:sA.backgroundCube.vertexShader,fragmentShader:sA.backgroundCube.fragmentShader,side:Vt,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),aA.copy(n.backgroundRotation),aA.x*=-1,aA.y*=-1,aA.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(aA.y*=-1,aA.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(lA.makeRotationFromEuler(aA)),c.material.toneMapped=zr.getTransfer(i.colorSpace)!==Li,u===i&&d===i.version&&p===t.toneMapping||(c.material.needsUpdate=!0,u=i,d=i.version,p=t.toneMapping),c.layers.enableAll(),e.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new ga(new Vh(2,2),new wa({name:"BackgroundMaterial",uniforms:Ea(sA.background.uniforms),vertexShader:sA.background.vertexShader,fragmentShader:sA.background.fragmentShader,side:Ht,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=zr.getTransfer(i.colorSpace)!==Li,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),u===i&&d===i.version&&p===t.toneMapping||(l.material.needsUpdate=!0,u=i,d=i.version,p=t.toneMapping),l.layers.enableAll(),e.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==c&&(c.geometry.dispose(),c.material.dispose(),c=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function hA(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=c(null);let s=r,o=!1;function a(e){return t.bindVertexArray(e)}function l(e){return t.deleteVertexArray(e)}function c(t){const e=[],i=[],r=[];for(let t=0;t<n;t++)e[t]=0,i[t]=0,r[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:r,object:t,attributes:{},index:null}}function h(){const t=s.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function u(t){d(t,0)}function d(e,n){const i=s.newAttributes,r=s.enabledAttributes,o=s.attributeDivisors;i[e]=1,0===r[e]&&(t.enableVertexAttribArray(e),r[e]=1),o[e]!==n&&(t.vertexAttribDivisor(e,n),o[e]=n)}function p(){const e=s.newAttributes,n=s.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function A(e,n,i,r,s,o,a){!0===a?t.vertexAttribIPointer(e,n,i,s,o):t.vertexAttribPointer(e,n,i,r,s,o)}function f(){m(),o=!0,s!==r&&(s=r,a(s.object))}function m(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,f,m){let g=!1;const v=function(e,n,r){const s=!0===r.wireframe;let o=i[e.id];void 0===o&&(o={},i[e.id]=o);let a=o[n.id];void 0===a&&(a={},o[n.id]=a);let l=a[s];return void 0===l&&(l=c(t.createVertexArray()),a[s]=l),l}(f,l,r);s!==v&&(s=v,a(s.object)),g=function(t,e,n,i){const r=s.attributes,o=e.attributes;let a=0;const l=n.getAttributes();for(const e in l)if(l[e].location>=0){const n=r[e];let i=o[e];if(void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;a++}return s.attributesNum!==a||s.index!==i}(n,f,l,m),g&&function(t,e,n,i){const r={},o=e.attributes;let a=0;const l=n.getAttributes();for(const e in l)if(l[e].location>=0){let n=o[e];void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[e]=i,a++}s.attributes=r,s.attributesNum=a,s.index=i}(n,f,l,m),null!==m&&e.update(m,t.ELEMENT_ARRAY_BUFFER),(g||o)&&(o=!1,function(n,i,r,s){h();const o=s.attributes,a=r.getAttributes(),l=i.defaultAttributeValues;for(const i in a){const r=a[i];if(r.location>=0){let a=o[i];if(void 0===a&&("instanceMatrix"===i&&n.instanceMatrix&&(a=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(a=n.instanceColor)),void 0!==a){const i=a.normalized,o=a.itemSize,l=e.get(a);if(void 0===l)continue;const c=l.buffer,h=l.type,p=l.bytesPerElement,f=h===t.INT||h===t.UNSIGNED_INT||a.gpuType===cn;if(a.isInterleavedBufferAttribute){const e=a.data,l=e.stride,m=a.offset;if(e.isInstancedInterleavedBuffer){for(let t=0;t<r.locationSize;t++)d(r.location+t,e.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=e.meshPerAttribute*e.count)}else for(let t=0;t<r.locationSize;t++)u(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<r.locationSize;t++)A(r.location+t,o/r.locationSize,h,i,l*p,(m+o/r.locationSize*t)*p,f)}else{if(a.isInstancedBufferAttribute){for(let t=0;t<r.locationSize;t++)d(r.location+t,a.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let t=0;t<r.locationSize;t++)u(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<r.locationSize;t++)A(r.location+t,o/r.locationSize,h,i,o*p,o/r.locationSize*t*p,f)}}else if(void 0!==l){const e=l[i];if(void 0!==e)switch(e.length){case 2:t.vertexAttrib2fv(r.location,e);break;case 3:t.vertexAttrib3fv(r.location,e);break;case 4:t.vertexAttrib4fv(r.location,e);break;default:t.vertexAttrib1fv(r.location,e)}}}}p()}(n,r,l,f),null!==m&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(m).buffer))},reset:f,resetDefaultState:m,dispose:function(){f();for(const t in i){const e=i[t];for(const t in e){const n=e[t];for(const t in n)l(n[t].object),delete n[t];delete e[t]}delete i[t]}},releaseStatesOfGeometry:function(t){if(void 0===i[t.id])return;const e=i[t.id];for(const t in e){const n=e[t];for(const t in n)l(n[t].object),delete n[t];delete e[t]}delete i[t.id]},releaseStatesOfProgram:function(t){for(const e in i){const n=i[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)l(r[t].object),delete r[t];delete n[t.id]}},initAttributes:h,enableAttribute:u,disableUnusedAttributes:p}}function uA(t,e,n){let i;function r(e,r,s){0!==s&&(t.drawArraysInstanced(i,e,r,s),n.update(r,i,s))}this.setMode=function(t){i=t},this.render=function(e,r){t.drawArrays(i,e,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(t,r,s){if(0===s)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,t,0,r,0,s);let o=0;for(let t=0;t<s;t++)o+=r[t];n.update(o,i,1)},this.renderMultiDrawInstances=function(t,s,o,a){if(0===o)return;const l=e.get("WEBGL_multi_draw");if(null===l)for(let e=0;e<t.length;e++)r(t[e],s[e],a[e]);else{l.multiDrawArraysInstancedWEBGL(i,t,0,s,0,a,0,o);let e=0;for(let t=0;t<o;t++)e+=s[t]*a[t];n.update(e,i,1)}}}function dA(t,e,n,i){let r;function s(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==n.precision?n.precision:"highp";const a=s(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=!0===n.logarithmicDepthBuffer,c=!0===n.reverseDepthBuffer&&e.has("EXT_clip_control"),h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),u=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:s,textureFormatReadable:function(e){return e===yn||i.convert(e)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===dn&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(n!==sn&&i.convert(n)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==un&&!r)},precision:o,logarithmicDepthBuffer:l,reverseDepthBuffer:c,maxTextures:h,maxVertexTextures:u,maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxCubemapSize:t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:t.getParameter(t.MAX_VERTEX_ATTRIBS),maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:t.getParameter(t.MAX_VARYING_VECTORS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:u>0,maxSamples:t.getParameter(t.MAX_SAMPLES)}}function pA(t){const e=this;let n=null,i=0,r=!1,s=!1;const o=new Ul,a=new Tr,l={value:null,needsUpdate:!1};function c(t,n,i,r){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const e=i+4*s,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,n=i;e!==s;++e,n+=4)o.copy(t[e]).applyMatrix4(r,a),o.normal.toArray(c,n),c[n+3]=o.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=s,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){const n=0!==t.length||e||0!==i||r;return r=e,i=t.length,n},this.beginShadows=function(){s=!0,c(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(t,e){n=c(t,e,0)},this.setState=function(o,a,h){const u=o.clippingPlanes,d=o.clipIntersection,p=o.clipShadows,A=t.get(o);if(!r||null===u||0===u.length||s&&!p)s?c(null):(l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0);else{const t=s?0:i,e=4*t;let r=A.clippingState||null;l.value=r,r=c(u,a,e,h);for(let t=0;t!==e;++t)r[t]=n[t];A.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function AA(t){let e=new WeakMap;function n(t,e){return e===ze?t.mapping=Qe:e===He&&(t.mapping=Ge),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping;if(s===ze||s===He){if(e.has(r))return n(e.get(r).texture,r.mapping);{const s=r.image;if(s&&s.height>0){const o=new Da(s.height);return o.fromEquirectangularTexture(t,r),e.set(r,o),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}const fA=[.125,.215,.35,.446,.526,.582],mA=new sd,gA=new Bo;let vA=null,yA=0,EA=0,xA=!1;const bA=(1+Math.sqrt(5))/2,CA=1/bA,wA=[new os(-bA,CA,0),new os(bA,CA,0),new os(-CA,0,bA),new os(CA,0,bA),new os(0,bA,-CA),new os(0,bA,CA),new os(-1,1,-1),new os(1,1,-1),new os(-1,1,1),new os(1,1,1)];class _A{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100){vA=this._renderer.getRenderTarget(),yA=this._renderer.getActiveCubeFace(),EA=this._renderer.getActiveMipmapLevel(),xA=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(t,n,i,r),e>0&&this._blur(r,0,0,e),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=BA(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=IA(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(vA,yA,EA),this._renderer.xr.enabled=xA,t.scissorTest=!1,SA(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===Qe||t.mapping===Ge?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),vA=this._renderer.getRenderTarget(),yA=this._renderer.getActiveCubeFace(),EA=this._renderer.getActiveMipmapLevel(),xA=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:$e,minFilter:$e,generateMipmaps:!1,type:dn,format:yn,colorSpace:Ti,depthBuffer:!1},i=MA(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=MA(t,e,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],n=[],i=[];let r=t;const s=t-4+1+fA.length;for(let o=0;o<s;o++){const s=Math.pow(2,r);n.push(s);let a=1/s;o>t-4?a=fA[o-t+4-1]:0===o&&(a=0),i.push(a);const l=1/(s-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,A=3,f=2,m=1,g=new Float32Array(A*p*d),v=new Float32Array(f*p*d),y=new Float32Array(m*p*d);for(let t=0;t<d;t++){const e=t%3*2/3-1,n=t>2?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,A*p*t),v.set(u,f*p*t);const r=[t,t,t,t,t,t];y.set(r,m*p*t)}const E=new sa;E.setAttribute("position",new zo(g,A)),E.setAttribute("uv",new zo(v,f)),E.setAttribute("faceIndex",new zo(y,m)),e.push(E),r>4&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(t,e,n){const i=new Float32Array(20),r=new os(0,1,0);return new wa({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:Wt,depthTest:!1,depthWrite:!1})}(i,t,e)}return i}_compileMaterial(t){const e=new ga(this._lodPlanes[0],t);this._renderer.compile(e,mA)}_sceneToCubeUV(t,e,n,i){const r=new Ba(90,1,e,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,c=a.toneMapping;a.getClearColor(gA),a.toneMapping=Be,a.autoClear=!1;const h=new Do({name:"PMREM.Background",side:Vt,depthWrite:!1,depthTest:!1}),u=new ga(new ya,h);let d=!1;const p=t.background;p?p.isColor&&(h.color.copy(p),t.background=null,d=!0):(h.color.copy(gA),d=!0);for(let e=0;e<6;e++){const n=e%3;0===n?(r.up.set(0,s[e],0),r.lookAt(o[e],0,0)):1===n?(r.up.set(0,0,s[e]),r.lookAt(0,o[e],0)):(r.up.set(0,s[e],0),r.lookAt(0,0,o[e]));const l=this._cubeSize;SA(i,n*l,e>2?l:0,l,l),a.setRenderTarget(i),d&&a.render(u,r),a.render(t,r)}u.geometry.dispose(),u.material.dispose(),a.toneMapping=c,a.autoClear=l,t.background=p}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===Qe||t.mapping===Ge;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=BA()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=IA());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new ga(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const o=this._cubeSize;SA(e,0,0,3*o,2*o),n.setRenderTarget(e),n.render(s,mA)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const i=this._lodPlanes.length;for(let e=1;e<i;e++){const n=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),r=wA[(i-e-1)%wA.length];this._blur(t,e-1,e,n,r)}e.autoClear=n}_blur(t,e,n,i,r){const s=this._pingPongRenderTarget;this._halfBlur(t,s,e,n,i,"latitudinal",r),this._halfBlur(s,t,n,n,i,"longitudinal",r)}_halfBlur(t,e,n,i,r,s,o){const a=this._renderer,l=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new ga(this._lodPlanes[i],l),h=l.uniforms,u=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/d,A=isFinite(r)?1+Math.floor(3*p):20;A>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${A} samples when the maximum is set to 20`);const f=[];let m=0;for(let t=0;t<20;++t){const e=t/p,n=Math.exp(-e*e/2);f.push(n),0===t?m+=n:t<A&&(m+=2*n)}for(let t=0;t<f.length;t++)f[t]=f[t]/m;h.envMap.value=t.texture,h.samples.value=A,h.weights.value=f,h.latitudinal.value="latitudinal"===s,o&&(h.poleAxis.value=o);const{_lodMax:g}=this;h.dTheta.value=d,h.mipInt.value=g-n;const v=this._sizeLods[i];SA(e,3*v*(i>g-4?i-g+4:0),4*(this._cubeSize-v),3*v,2*v),a.setRenderTarget(e),a.render(c,mA)}}function MA(t,e,n){const i=new ts(t,e,n);return i.texture.mapping=Ve,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function SA(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function IA(){return new wa({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:Wt,depthTest:!1,depthWrite:!1})}function BA(){return new wa({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:Wt,depthTest:!1,depthWrite:!1})}function TA(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,o=s===ze||s===He,a=s===Qe||s===Ge;if(o||a){let s=e.get(r);const l=void 0!==s?s.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new _A(t)),s=o?n.fromEquirectangular(r,s):n.fromCubemap(r,s),s.texture.pmremVersion=r.pmremVersion,e.set(r,s),s.texture;if(void 0!==s)return s.texture;{const l=r.image;return o&&l&&l.height>0||a&&l&&function(t){let e=0;for(let n=0;n<6;n++)void 0!==t[n]&&e++;return 6===e}(l)?(null===n&&(n=new _A(t)),s=o?n.fromEquirectangular(r):n.fromCubemap(r),s.texture.pmremVersion=r.pmremVersion,e.set(r,s),r.addEventListener("dispose",i),s.texture):null}}}return r},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function RA(t){const e={};function n(n){if(void 0!==e[n])return 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,i}return{has:function(t){return null!==n(t)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(t){const e=n(t);return null===e&&kr("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function LA(t,e,n,i){const r={},s=new WeakMap;function o(t){const a=t.target;null!==a.index&&e.remove(a.index);for(const t in a.attributes)e.remove(a.attributes[t]);a.removeEventListener("dispose",o),delete r[a.id];const l=s.get(a);l&&(e.remove(l),s.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(t){const n=[],i=t.index,r=t.attributes.position;let o=0;if(null!==i){const t=i.array;o=i.version;for(let e=0,i=t.length;e<i;e+=3){const i=t[e+0],r=t[e+1],s=t[e+2];n.push(i,r,r,s,s,i)}}else{if(void 0===r)return;{const t=r.array;o=r.version;for(let e=0,i=t.length/3-1;e<i;e+=3){const t=e+0,i=e+1,r=e+2;n.push(t,i,i,r,r,t)}}}const a=new(Lr(n)?Yo:qo)(n,1);a.version=o;const l=s.get(t);l&&e.remove(l),s.set(t,a)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",o),r[e.id]=!0,n.memory.geometries++),e},update:function(n){const i=n.attributes;for(const n in i)e.update(i[n],t.ARRAY_BUFFER)},getWireframeAttribute:function(t){const e=s.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&a(t)}else a(t);return s.get(t)}}}function DA(t,e,n){let i,r,s;function o(e,o,a){0!==a&&(t.drawElementsInstanced(i,o,r,e*s,a),n.update(o,i,a))}this.setMode=function(t){i=t},this.setIndex=function(t){r=t.type,s=t.bytesPerElement},this.render=function(e,o){t.drawElements(i,o,r,e*s),n.update(o,i,1)},this.renderInstances=o,this.renderMultiDraw=function(t,s,o){if(0===o)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,s,0,r,t,0,o);let a=0;for(let t=0;t<o;t++)a+=s[t];n.update(a,i,1)},this.renderMultiDrawInstances=function(t,a,l,c){if(0===l)return;const h=e.get("WEBGL_multi_draw");if(null===h)for(let e=0;e<t.length;e++)o(t[e]/s,a[e],c[e]);else{h.multiDrawElementsInstancedWEBGL(i,a,0,r,t,0,c,0,l);let e=0;for(let t=0;t<l;t++)e+=a[t]*c[t];n.update(e,i,1)}}}function PA(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(n,i,r){switch(e.calls++,i){case t.TRIANGLES:e.triangles+=r*(n/3);break;case t.LINES:e.lines+=r*(n/2);break;case t.LINE_STRIP:e.lines+=r*(n-1);break;case t.LINE_LOOP:e.lines+=r*n;break;case t.POINTS:e.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function UA(t,e,n){const i=new WeakMap,r=new Zr;return{update:function(s,o,a){const l=s.morphTargetInfluences,c=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=void 0!==c?c.length:0;let u=i.get(o);if(void 0===u||u.count!==h){void 0!==u&&u.texture.dispose();const d=void 0!==o.morphAttributes.position,p=void 0!==o.morphAttributes.normal,A=void 0!==o.morphAttributes.color,f=o.morphAttributes.position||[],m=o.morphAttributes.normal||[],g=o.morphAttributes.color||[];let v=0;!0===d&&(v=1),!0===p&&(v=2),!0===A&&(v=3);let y=o.attributes.position.count*v,E=1;y>e.maxTextureSize&&(E=Math.ceil(y/e.maxTextureSize),y=e.maxTextureSize);const x=new Float32Array(y*E*4*h),b=new es(x,y,E,h);b.type=un,b.needsUpdate=!0;const C=4*v;for(let _=0;_<h;_++){const M=f[_],S=m[_],I=g[_],B=y*E*4*_;for(let T=0;T<M.count;T++){const R=T*C;!0===d&&(r.fromBufferAttribute(M,T),x[B+R+0]=r.x,x[B+R+1]=r.y,x[B+R+2]=r.z,x[B+R+3]=0),!0===p&&(r.fromBufferAttribute(S,T),x[B+R+4]=r.x,x[B+R+5]=r.y,x[B+R+6]=r.z,x[B+R+7]=0),!0===A&&(r.fromBufferAttribute(I,T),x[B+R+8]=r.x,x[B+R+9]=r.y,x[B+R+10]=r.z,x[B+R+11]=4===I.itemSize?r.w:1)}}function w(){b.dispose(),i.delete(o),o.removeEventListener("dispose",w)}u={count:h,texture:b,size:new Br(y,E)},i.set(o,u),o.addEventListener("dispose",w)}if(!0===s.isInstancedMesh&&null!==s.morphTexture)a.getUniforms().setValue(t,"morphTexture",s.morphTexture,n);else{let L=0;for(let P=0;P<l.length;P++)L+=l[P];const D=o.morphTargetsRelative?1:1-L;a.getUniforms().setValue(t,"morphTargetBaseInfluence",D),a.getUniforms().setValue(t,"morphTargetInfluences",l)}a.getUniforms().setValue(t,"morphTargetsTexture",u.texture,n),a.getUniforms().setValue(t,"morphTargetsTextureSize",u.size)}}}class OA{constructor(t,e,n){if(this.renderer=t,this.DEFAULT_NUMVIEWS=2,this.maxNumViews=0,this.gl=n,this.extensions=e,this.available=this.extensions.has("OCULUS_multiview"),this.available){const t=this.extensions.get("OCULUS_multiview");this.maxNumViews=this.gl.getParameter(t.MAX_VIEWS_OVR),this.mat4=[],this.mat3=[],this.cameraArray=[];for(var i=0;i<this.maxNumViews;i++)this.mat4[i]=new Os,this.mat3[i]=new Tr}}getCameraArray(t){return t.isArrayCamera?t.cameras:(this.cameraArray[0]=t,this.cameraArray)}updateCameraProjectionMatricesUniform(t,e){for(var n=this.getCameraArray(t),i=0;i<n.length;i++)this.mat4[i].copy(n[i].projectionMatrix);e.setValue(this.gl,"projectionMatrices",this.mat4)}updateCameraViewMatricesUniform(t,e){for(var n=this.getCameraArray(t),i=0;i<n.length;i++)this.mat4[i].copy(n[i].matrixWorldInverse);e.setValue(this.gl,"viewMatrices",this.mat4)}updateObjectMatricesUniforms(t,e,n){for(var i=this.getCameraArray(e),r=0;r<i.length;r++)this.mat4[r].multiplyMatrices(i[r].matrixWorldInverse,t.matrixWorld),this.mat3[r].getNormalMatrix(this.mat4[r]);n.setValue(this.gl,"modelViewMatrices",this.mat4),n.setValue(this.gl,"normalMatrices",this.mat3)}}function FA(t,e,n,i){let r=new WeakMap;function s(t){const e=t.target;e.removeEventListener("dispose",s),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(o){const a=i.render.frame,l=o.geometry,c=e.get(o,l);if(r.get(c)!==a&&(e.update(c),r.set(c,a)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",s)&&o.addEventListener("dispose",s),r.get(o)!==a&&(n.update(o.instanceMatrix,t.ARRAY_BUFFER),null!==o.instanceColor&&n.update(o.instanceColor,t.ARRAY_BUFFER),r.set(o,a))),o.isSkinnedMesh){const t=o.skeleton;r.get(t)!==a&&(t.update(),r.set(t,a))}return c},dispose:function(){r=new WeakMap}}}const kA=new Kr,NA=new Rc(1,1),QA=new es,GA=new is,zA=new La,HA=[],VA=[],jA=new Float32Array(16),WA=new Float32Array(9),qA=new Float32Array(4);function XA(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let s=HA[r];if(void 0===s&&(s=new Float32Array(r),HA[r]=s),0!==e){i.toArray(s,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(s,r)}return s}function YA(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function JA(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function KA(t,e){let n=VA[e];void 0===n&&(n=new Int32Array(e),VA[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function ZA(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function $A(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(YA(n,e))return;t.uniform2fv(this.addr,e),JA(n,e)}}function tf(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(YA(n,e))return;t.uniform3fv(this.addr,e),JA(n,e)}}function ef(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(YA(n,e))return;t.uniform4fv(this.addr,e),JA(n,e)}}function nf(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(YA(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),JA(n,e)}else{if(YA(n,i))return;qA.set(i),t.uniformMatrix2fv(this.addr,!1,qA),JA(n,i)}}function rf(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(YA(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),JA(n,e)}else{if(YA(n,i))return;WA.set(i),t.uniformMatrix3fv(this.addr,!1,WA),JA(n,i)}}function sf(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(YA(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),JA(n,e)}else{if(YA(n,i))return;jA.set(i),t.uniformMatrix4fv(this.addr,!1,jA),JA(n,i)}}function of(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function af(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(YA(n,e))return;t.uniform2iv(this.addr,e),JA(n,e)}}function lf(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(YA(n,e))return;t.uniform3iv(this.addr,e),JA(n,e)}}function cf(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(YA(n,e))return;t.uniform4iv(this.addr,e),JA(n,e)}}function hf(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function uf(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(YA(n,e))return;t.uniform2uiv(this.addr,e),JA(n,e)}}function df(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(YA(n,e))return;t.uniform3uiv(this.addr,e),JA(n,e)}}function pf(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(YA(n,e))return;t.uniform4uiv(this.addr,e),JA(n,e)}}function Af(t,e,n){const i=this.cache,r=n.allocateTextureUnit();let s;i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),this.type===t.SAMPLER_2D_SHADOW?(NA.compareFunction=Zi,s=NA):s=kA,n.setTexture2D(e||s,r)}function ff(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||GA,r)}function mf(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||zA,r)}function gf(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||QA,r)}function vf(t,e){t.uniform1fv(this.addr,e)}function yf(t,e){const n=XA(e,this.size,2);t.uniform2fv(this.addr,n)}function Ef(t,e){const n=XA(e,this.size,3);t.uniform3fv(this.addr,n)}function xf(t,e){const n=XA(e,this.size,4);t.uniform4fv(this.addr,n)}function bf(t,e){const n=XA(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function Cf(t,e){const n=XA(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function wf(t,e){const n=XA(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function _f(t,e){t.uniform1iv(this.addr,e)}function Mf(t,e){t.uniform2iv(this.addr,e)}function Sf(t,e){t.uniform3iv(this.addr,e)}function If(t,e){t.uniform4iv(this.addr,e)}function Bf(t,e){t.uniform1uiv(this.addr,e)}function Tf(t,e){t.uniform2uiv(this.addr,e)}function Rf(t,e){t.uniform3uiv(this.addr,e)}function Lf(t,e){t.uniform4uiv(this.addr,e)}function Df(t,e,n){const i=this.cache,r=e.length,s=KA(n,r);YA(i,s)||(t.uniform1iv(this.addr,s),JA(i,s));for(let t=0;t!==r;++t)n.setTexture2D(e[t]||kA,s[t])}function Pf(t,e,n){const i=this.cache,r=e.length,s=KA(n,r);YA(i,s)||(t.uniform1iv(this.addr,s),JA(i,s));for(let t=0;t!==r;++t)n.setTexture3D(e[t]||GA,s[t])}function Uf(t,e,n){const i=this.cache,r=e.length,s=KA(n,r);YA(i,s)||(t.uniform1iv(this.addr,s),JA(i,s));for(let t=0;t!==r;++t)n.setTextureCube(e[t]||zA,s[t])}function Of(t,e,n){const i=this.cache,r=e.length,s=KA(n,r);YA(i,s)||(t.uniform1iv(this.addr,s),JA(i,s));for(let t=0;t!==r;++t)n.setTexture2DArray(e[t]||QA,s[t])}class Ff{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=function(t){switch(t){case 5126:return ZA;case 35664:return $A;case 35665:return tf;case 35666:return ef;case 35674:return nf;case 35675:return rf;case 35676:return sf;case 5124:case 35670:return of;case 35667:case 35671:return af;case 35668:case 35672:return lf;case 35669:case 35673:return cf;case 5125:return hf;case 36294:return uf;case 36295:return df;case 36296:return pf;case 35678:case 36198:case 36298:case 36306:case 35682:return Af;case 35679:case 36299:case 36307:return ff;case 35680:case 36300:case 36308:case 36293:return mf;case 36289:case 36303:case 36311:case 36292:return gf}}(e.type)}}class kf{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return vf;case 35664:return yf;case 35665:return Ef;case 35666:return xf;case 35674:return bf;case 35675:return Cf;case 35676:return wf;case 5124:case 35670:return _f;case 35667:case 35671:return Mf;case 35668:case 35672:return Sf;case 35669:case 35673:return If;case 5125:return Bf;case 36294:return Tf;case 36295:return Rf;case 36296:return Lf;case 35678:case 36198:case 36298:case 36306:case 35682:return Df;case 35679:case 36299:case 36307:return Pf;case 35680:case 36300:case 36308:case 36293:return Uf;case 36289:case 36303:case 36311:case 36292:return Of}}(e.type)}}class Nf{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){const i=this.seq;for(let r=0,s=i.length;r!==s;++r){const s=i[r];s.setValue(t,e[s.id],n)}}}const Qf=/(\w+)(\])?(\[|\.)?/g;function Gf(t,e){t.seq.push(e),t.map[e.id]=e}function zf(t,e,n){const i=t.name,r=i.length;for(Qf.lastIndex=0;;){const s=Qf.exec(i),o=Qf.lastIndex;let a=s[1];const l="]"===s[2],c=s[3];if(l&&(a|=0),void 0===c||"["===c&&o+2===r){Gf(n,void 0===c?new Ff(a,t,e):new kf(a,t,e));break}{let t=n.map[a];void 0===t&&(t=new Nf(a),Gf(n,t)),n=t}}}class Hf{constructor(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=t.getActiveUniform(e,i);zf(n,t.getUniformLocation(e,n.name),this)}}setValue(t,e,n,i){const r=this.map[e];void 0!==r&&r.setValue(t,n,i)}setOptional(t,e,n){const i=e[n];void 0!==i&&this.setValue(t,n,i)}static upload(t,e,n,i){for(let r=0,s=e.length;r!==s;++r){const s=e[r],o=n[s.id];!1!==o.needsUpdate&&s.setValue(t,o.value,i)}}static seqWithValue(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const r=t[i];r.id in e&&n.push(r)}return n}}function Vf(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}let jf=0;const Wf=new Tr;function qf(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();if(i&&""===r)return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const i=parseInt(s[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(t,e){const n=t.split("\n"),i=[],r=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let t=r;t<s;t++){const r=t+1;i.push(`${r===e?">":" "} ${r}: ${n[t]}`)}return i.join("\n")}(t.getShaderSource(e),i)}return r}function Xf(t,e){const n=function(t){zr._getMatrix(Wf,zr.workingColorSpace,t);const e=`mat3( ${Wf.elements.map((t=>t.toFixed(4)))} )`;switch(zr.getTransfer(t)){case Ri:return[e,"LinearTransferOETF"];case Li:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}(e);return[`vec4 ${t}( vec4 value ) {`,`\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join("\n")}function Yf(t,e){let n;switch(e){case Te:n="Linear";break;case Re:n="Reinhard";break;case Le:n="Cineon";break;case De:n="ACESFilmic";break;case Ue:n="AgX";break;case Oe:n="Neutral";break;case Pe:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const Jf=new os;function Kf(t){return""!==t}function Zf(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function $f(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const tm=/^[ \t]*#include +<([\w\d./]+)>/gm;function em(t){return t.replace(tm,im)}const nm=new Map;function im(t,e){let n=iA[e];if(void 0===n){const t=nm.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");n=iA[t],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,t)}return em(n)}const rm=/#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 sm(t){return t.replace(rm,om)}function om(t,e,n,i){let r="";for(let t=parseInt(e);t<parseInt(n);t++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function am(t){let e=`precision ${t.precision} float;\n\tprecision ${t.precision} int;\n\tprecision ${t.precision} sampler2D;\n\tprecision ${t.precision} samplerCube;\n\tprecision ${t.precision} sampler3D;\n\tprecision ${t.precision} sampler2DArray;\n\tprecision ${t.precision} sampler2DShadow;\n\tprecision ${t.precision} samplerCubeShadow;\n\tprecision ${t.precision} sampler2DArrayShadow;\n\tprecision ${t.precision} isampler2D;\n\tprecision ${t.precision} isampler3D;\n\tprecision ${t.precision} isamplerCube;\n\tprecision ${t.precision} isampler2DArray;\n\tprecision ${t.precision} usampler2D;\n\tprecision ${t.precision} usampler3D;\n\tprecision ${t.precision} usamplerCube;\n\tprecision ${t.precision} usampler2DArray;\n\t`;return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function lm(t,e,n,i){const r=t.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===Qt?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===Gt?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===zt&&(e="SHADOWMAP_TYPE_VSM"),e}(n),c=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case Qe:case Ge:e="ENVMAP_TYPE_CUBE";break;case Ve:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),h=function(t){let e="ENVMAP_MODE_REFLECTION";return t.envMap&&t.envMapMode===Ge&&(e="ENVMAP_MODE_REFRACTION"),e}(n),u=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case Me:e="ENVMAP_BLENDING_MULTIPLY";break;case Se:e="ENVMAP_BLENDING_MIX";break;case Ie:e="ENVMAP_BLENDING_ADD"}return e}(n),d=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),p=function(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Kf).join("\n")}(n),A=function(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(s),f=r.createProgram();let m,g,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";const y=n.numMultiviewViews;n.isRawShaderMaterial?(m=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A].filter(Kf).join("\n"),m.length>0&&(m+="\n"),g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A].filter(Kf).join("\n"),g.length>0&&(g+="\n")):(m=[am(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",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.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Kf).join("\n"),g=[am(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,A,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",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 "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",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.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Be?"#define TONE_MAPPING":"",n.toneMapping!==Be?iA.tonemapping_pars_fragment:"",n.toneMapping!==Be?Yf("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",iA.colorspace_pars_fragment,Xf("linearToOutputTexel",n.outputColorSpace),(zr.getLuminanceCoefficients(Jf),["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${Jf.x.toFixed(4)}, ${Jf.y.toFixed(4)}, ${Jf.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(Kf).join("\n")),o=em(o),o=Zf(o,n),o=$f(o,n),a=em(a),a=Zf(a,n),a=$f(a,n),o=sm(o),a=sm(a),!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,g=["#define varying in",n.glslVersion===pr?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===pr?"":"#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"+g,y>0&&(m=["#extension GL_OVR_multiview : require","layout(num_views = "+y+") in;","#define VIEW_ID gl_ViewID_OVR"].join("\n")+"\n"+m,m=m.replace(["uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;"].join("\n"),["uniform mat4 modelViewMatrices["+y+"];","uniform mat4 projectionMatrices["+y+"];","uniform mat4 viewMatrices["+y+"];","uniform mat3 normalMatrices["+y+"];","#define modelViewMatrix modelViewMatrices[VIEW_ID]","#define projectionMatrix projectionMatrices[VIEW_ID]","#define viewMatrix viewMatrices[VIEW_ID]","#define normalMatrix normalMatrices[VIEW_ID]"].join("\n")),g=["#extension GL_OVR_multiview : require","#define VIEW_ID gl_ViewID_OVR"].join("\n")+"\n"+g,g=g.replace("uniform mat4 viewMatrix;",["uniform mat4 viewMatrices["+y+"];","#define viewMatrix viewMatrices[VIEW_ID]"].join("\n"))));const E=v+m+o,x=v+g+a,b=Vf(r,r.VERTEX_SHADER,E),C=Vf(r,r.FRAGMENT_SHADER,x);function w(e){if(t.debug.checkShaderErrors){const n=r.getProgramInfoLog(f).trim(),i=r.getShaderInfoLog(b).trim(),s=r.getShaderInfoLog(C).trim();let o=!0,a=!0;if(!1===r.getProgramParameter(f,r.LINK_STATUS))if(o=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(r,f,b,C);else{const t=qf(r,b,"vertex"),i=qf(r,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(f,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+e.name+"\nMaterial Type: "+e.type+"\n\nProgram Info Log: "+n+"\n"+t+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==s||(a=!1);a&&(e.diagnostics={runnable:o,programLog:n,vertexShader:{log:i,prefix:m},fragmentShader:{log:s,prefix:g}})}r.deleteShader(b),r.deleteShader(C),_=new Hf(r,f),M=function(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=t.getActiveAttrib(e,r),s=i.name;let o=1;i.type===t.FLOAT_MAT2&&(o=2),i.type===t.FLOAT_MAT3&&(o=3),i.type===t.FLOAT_MAT4&&(o=4),n[s]={type:i.type,location:t.getAttribLocation(e,s),locationSize:o}}return n}(r,f)}let _,M;r.attachShader(f,b),r.attachShader(f,C),void 0!==n.index0AttributeName?r.bindAttribLocation(f,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(f,0,"position"),r.linkProgram(f),this.getUniforms=function(){return void 0===_&&w(this),_},this.getAttributes=function(){return void 0===M&&w(this),M};let S=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===S&&(S=r.getProgramParameter(f,37297)),S},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(f),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=jf++,this.cacheKey=e,this.usedTimes=1,this.program=f,this.vertexShader=b,this.fragmentShader=C,this.numMultiviewViews=y,this}let cm=0;class hm{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),s=this._getShaderCacheForMaterial(t);return!1===s.has(i)&&(s.add(i),i.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return void 0===n&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return void 0===n&&(n=new um(t),e.set(t,n)),n}}class um{constructor(t){this.id=cm++,this.code=t,this.usedTimes=0}}function dm(t,e,n,i,r,s,o){const a=new qs,l=new hm,c=new Set,h=[],u=r.logarithmicDepthBuffer,d=r.vertexTextures;let p=r.precision;const A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function f(t){return c.add(t),0===t?"uv":`uv${t}`}return{getParameters:function(s,a,h,m,g){const v=m.fog,y=g.geometry,E=s.isMeshStandardMaterial?m.environment:null,x=(s.isMeshStandardMaterial?n:e).get(s.envMap||E),b=x&&x.mapping===Ve?x.image.height:null,C=A[s.type];null!==s.precision&&(p=r.getMaxPrecision(s.precision),p!==s.precision&&console.warn("THREE.WebGLProgram.getParameters:",s.precision,"not supported, using",p,"instead."));const w=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,_=void 0!==w?w.length:0;let M,S,I,B,T=0;if(void 0!==y.morphAttributes.position&&(T=1),void 0!==y.morphAttributes.normal&&(T=2),void 0!==y.morphAttributes.color&&(T=3),C){const t=sA[C];M=t.vertexShader,S=t.fragmentShader}else M=s.vertexShader,S=s.fragmentShader,l.update(s),I=l.getVertexShaderID(s),B=l.getFragmentShaderID(s);const R=t.getRenderTarget(),L=t.state.buffers.depth.getReversed(),D=R&&R.isWebGLMultiviewRenderTarget?R.numViews:0,P=!0===g.isInstancedMesh,U=!0===g.isBatchedMesh,O=!!s.map,F=!!s.matcap,k=!!x,N=!!s.aoMap,Q=!!s.lightMap,G=!!s.bumpMap,z=!!s.normalMap,H=!!s.displacementMap,V=!!s.emissiveMap,j=!!s.metalnessMap,W=!!s.roughnessMap,q=s.anisotropy>0,X=s.clearcoat>0,Y=s.dispersion>0,J=s.iridescence>0,K=s.sheen>0,Z=s.transmission>0,$=q&&!!s.anisotropyMap,tt=X&&!!s.clearcoatMap,et=X&&!!s.clearcoatNormalMap,nt=X&&!!s.clearcoatRoughnessMap,it=J&&!!s.iridescenceMap,rt=J&&!!s.iridescenceThicknessMap,st=K&&!!s.sheenColorMap,ot=K&&!!s.sheenRoughnessMap,at=!!s.specularMap,lt=!!s.specularColorMap,ct=!!s.specularIntensityMap,ht=Z&&!!s.transmissionMap,ut=Z&&!!s.thicknessMap,dt=!!s.gradientMap,pt=!!s.alphaMap,At=s.alphaTest>0,ft=!!s.alphaHash,mt=!!s.extensions;let gt=Be;s.toneMapped&&(null!==R&&!0!==R.isXRRenderTarget||(gt=t.toneMapping));const vt={shaderID:C,shaderType:s.type,shaderName:s.name,vertexShader:M,fragmentShader:S,defines:s.defines,customVertexShaderID:I,customFragmentShaderID:B,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,batching:U,batchingColor:U&&null!==g._colorsTexture,instancing:P,instancingColor:P&&null!==g.instanceColor,instancingMorph:P&&null!==g.morphTexture,supportsVertexTextures:d,numMultiviewViews:D,outputColorSpace:null===R?t.outputColorSpace:!0===R.isXRRenderTarget?R.texture.colorSpace:Ti,alphaToCoverage:!!s.alphaToCoverage,map:O,matcap:F,envMap:k,envMapMode:k&&x.mapping,envMapCubeUVHeight:b,aoMap:N,lightMap:Q,bumpMap:G,normalMap:z,displacementMap:d&&H,emissiveMap:V,normalMapObjectSpace:z&&s.normalMapType===Si,normalMapTangentSpace:z&&s.normalMapType===Mi,metalnessMap:j,roughnessMap:W,anisotropy:q,anisotropyMap:$,clearcoat:X,clearcoatMap:tt,clearcoatNormalMap:et,clearcoatRoughnessMap:nt,dispersion:Y,iridescence:J,iridescenceMap:it,iridescenceThicknessMap:rt,sheen:K,sheenColorMap:st,sheenRoughnessMap:ot,specularMap:at,specularColorMap:lt,specularIntensityMap:ct,transmission:Z,transmissionMap:ht,thicknessMap:ut,gradientMap:dt,opaque:!1===s.transparent&&s.blending===qt&&!1===s.alphaToCoverage,alphaMap:pt,alphaTest:At,alphaHash:ft,combine:s.combine,mapUv:O&&f(s.map.channel),aoMapUv:N&&f(s.aoMap.channel),lightMapUv:Q&&f(s.lightMap.channel),bumpMapUv:G&&f(s.bumpMap.channel),normalMapUv:z&&f(s.normalMap.channel),displacementMapUv:H&&f(s.displacementMap.channel),emissiveMapUv:V&&f(s.emissiveMap.channel),metalnessMapUv:j&&f(s.metalnessMap.channel),roughnessMapUv:W&&f(s.roughnessMap.channel),anisotropyMapUv:$&&f(s.anisotropyMap.channel),clearcoatMapUv:tt&&f(s.clearcoatMap.channel),clearcoatNormalMapUv:et&&f(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:nt&&f(s.clearcoatRoughnessMap.channel),iridescenceMapUv:it&&f(s.iridescenceMap.channel),iridescenceThicknessMapUv:rt&&f(s.iridescenceThicknessMap.channel),sheenColorMapUv:st&&f(s.sheenColorMap.channel),sheenRoughnessMapUv:ot&&f(s.sheenRoughnessMap.channel),specularMapUv:at&&f(s.specularMap.channel),specularColorMapUv:lt&&f(s.specularColorMap.channel),specularIntensityMapUv:ct&&f(s.specularIntensityMap.channel),transmissionMapUv:ht&&f(s.transmissionMap.channel),thicknessMapUv:ut&&f(s.thicknessMap.channel),alphaMapUv:pt&&f(s.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(z||q),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,pointsUvs:!0===g.isPoints&&!!y.attributes.uv&&(O||pt),fog:!!v,useFog:!0===s.fog,fogExp2:!!v&&v.isFogExp2,flatShading:!0===s.flatShading,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:u,reverseDepthBuffer:L,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:_,morphTextureStride:T,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numSpotLightMaps:a.spotLightMap.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numSpotLightShadowsWithMaps:a.numSpotLightShadowsWithMaps,numLightProbes:a.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:s.dithering,shadowMapEnabled:t.shadowMap.enabled&&h.length>0,shadowMapType:t.shadowMap.type,toneMapping:gt,decodeVideoTexture:O&&!0===s.map.isVideoTexture&&zr.getTransfer(s.map.colorSpace)===Li,decodeVideoTextureEmissive:V&&!0===s.emissiveMap.isVideoTexture&&zr.getTransfer(s.emissiveMap.colorSpace)===Li,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===jt,flipSided:s.side===Vt,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionClipCullDistance:mt&&!0===s.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(mt&&!0===s.extensions.multiDraw||U)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:s.customProgramCacheKey()};return vt.vertexUv1s=c.has(1),vt.vertexUv2s=c.has(2),vt.vertexUv3s=c.has(3),c.clear(),vt},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(n,e),function(t,e){a.disableAll(),e.supportsVertexTextures&&a.enable(0),e.instancing&&a.enable(1),e.instancingColor&&a.enable(2),e.instancingMorph&&a.enable(3),e.matcap&&a.enable(4),e.envMap&&a.enable(5),e.normalMapObjectSpace&&a.enable(6),e.normalMapTangentSpace&&a.enable(7),e.clearcoat&&a.enable(8),e.iridescence&&a.enable(9),e.alphaTest&&a.enable(10),e.vertexColors&&a.enable(11),e.vertexAlphas&&a.enable(12),e.vertexUv1s&&a.enable(13),e.vertexUv2s&&a.enable(14),e.vertexUv3s&&a.enable(15),e.vertexTangents&&a.enable(16),e.anisotropy&&a.enable(17),e.alphaHash&&a.enable(18),e.batching&&a.enable(19),e.dispersion&&a.enable(20),e.batchingColor&&a.enable(21),t.push(a.mask),a.disableAll(),e.fog&&a.enable(0),e.useFog&&a.enable(1),e.flatShading&&a.enable(2),e.logarithmicDepthBuffer&&a.enable(3),e.reverseDepthBuffer&&a.enable(4),e.skinning&&a.enable(5),e.morphTargets&&a.enable(6),e.morphNormals&&a.enable(7),e.morphColors&&a.enable(8),e.premultipliedAlpha&&a.enable(9),e.shadowMapEnabled&&a.enable(10),e.doubleSided&&a.enable(11),e.flipSided&&a.enable(12),e.useDepthPacking&&a.enable(13),e.dithering&&a.enable(14),e.transmission&&a.enable(15),e.sheen&&a.enable(16),e.opaque&&a.enable(17),e.pointsUvs&&a.enable(18),e.decodeVideoTexture&&a.enable(19),e.decodeVideoTextureEmissive&&a.enable(20),e.alphaToCoverage&&a.enable(21),e.numMultiviewViews&&a.enable(21),t.push(a.mask)}(n,e),n.push(t.outputColorSpace)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=A[t.type];let n;if(e){const t=sA[e];n=Ca.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=h.length;t<e;t++){const e=h[t];if(e.cacheKey===n){i=e,++i.usedTimes;break}}return void 0===i&&(i=new lm(t,n,e,s),h.push(i)),i},releaseProgram:function(t){if(0==--t.usedTimes){const e=h.indexOf(t);h[e]=h[h.length-1],h.pop(),t.destroy()}},releaseShaderCache:function(t){l.remove(t)},programs:h,dispose:function(){l.dispose()}}}function pm(){let t=new WeakMap;return{has:function(e){return t.has(e)},get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function Am(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function fm(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function mm(){const t=[];let e=0;const n=[],i=[],r=[];function s(n,i,r,s,o,a){let l=t[e];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:s,renderOrder:n.renderOrder,z:o,group:a},t[e]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=s,l.renderOrder=n.renderOrder,l.z=o,l.group=a),e++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){e=0,n.length=0,i.length=0,r.length=0},push:function(t,e,o,a,l,c){const h=s(t,e,o,a,l,c);o.transmission>0?i.push(h):!0===o.transparent?r.push(h):n.push(h)},unshift:function(t,e,o,a,l,c){const h=s(t,e,o,a,l,c);o.transmission>0?i.unshift(h):!0===o.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=e,i=t.length;n<i;n++){const e=t[n];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){n.length>1&&n.sort(t||Am),i.length>1&&i.sort(e||fm),r.length>1&&r.sort(e||fm)}}}function gm(){let t=new WeakMap;return{get:function(e,n){const i=t.get(e);let r;return void 0===i?(r=new mm,t.set(e,[r])):n>=i.length?(r=new mm,i.push(r)):r=i[n],r},dispose:function(){t=new WeakMap}}}function vm(){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 os,color:new Bo};break;case"SpotLight":n={position:new os,direction:new os,color:new Bo,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new os,color:new Bo,distance:0,decay:0};break;case"HemisphereLight":n={direction:new os,skyColor:new Bo,groundColor:new Bo};break;case"RectAreaLight":n={color:new Bo,position:new os,halfWidth:new os,halfHeight:new os}}return t[e.id]=n,n}}}let ym=0;function Em(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function xm(t){const e=new vm,n=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={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Br};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Br,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)i.probe.push(new os);const r=new os,s=new Os,o=new Os;return{setup:function(r){let s=0,o=0,a=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let l=0,c=0,h=0,u=0,d=0,p=0,A=0,f=0,m=0,g=0,v=0;r.sort(Em);for(let t=0,y=r.length;t<y;t++){const y=r[t],E=y.color,x=y.intensity,b=y.distance,C=y.shadow&&y.shadow.map?y.shadow.map.texture:null;if(y.isAmbientLight)s+=E.r*x,o+=E.g*x,a+=E.b*x;else if(y.isLightProbe){for(let t=0;t<9;t++)i.probe[t].addScaledVector(y.sh.coefficients[t],x);v++}else if(y.isDirectionalLight){const t=e.get(y);if(t.color.copy(y.color).multiplyScalar(y.intensity),y.castShadow){const t=y.shadow,e=n.get(y);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,i.directionalShadow[l]=e,i.directionalShadowMap[l]=C,i.directionalShadowMatrix[l]=y.shadow.matrix,p++}i.directional[l]=t,l++}else if(y.isSpotLight){const t=e.get(y);t.position.setFromMatrixPosition(y.matrixWorld),t.color.copy(E).multiplyScalar(x),t.distance=b,t.coneCos=Math.cos(y.angle),t.penumbraCos=Math.cos(y.angle*(1-y.penumbra)),t.decay=y.decay,i.spot[h]=t;const r=y.shadow;if(y.map&&(i.spotLightMap[m]=y.map,m++,r.updateMatrices(y),y.castShadow&&g++),i.spotLightMatrix[h]=r.matrix,y.castShadow){const t=n.get(y);t.shadowIntensity=r.intensity,t.shadowBias=r.bias,t.shadowNormalBias=r.normalBias,t.shadowRadius=r.radius,t.shadowMapSize=r.mapSize,i.spotShadow[h]=t,i.spotShadowMap[h]=C,f++}h++}else if(y.isRectAreaLight){const t=e.get(y);t.color.copy(E).multiplyScalar(x),t.halfWidth.set(.5*y.width,0,0),t.halfHeight.set(0,.5*y.height,0),i.rectArea[u]=t,u++}else if(y.isPointLight){const t=e.get(y);if(t.color.copy(y.color).multiplyScalar(y.intensity),t.distance=y.distance,t.decay=y.decay,y.castShadow){const t=y.shadow,e=n.get(y);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,e.shadowCameraNear=t.camera.near,e.shadowCameraFar=t.camera.far,i.pointShadow[c]=e,i.pointShadowMap[c]=C,i.pointShadowMatrix[c]=y.shadow.matrix,A++}i.point[c]=t,c++}else if(y.isHemisphereLight){const t=e.get(y);t.skyColor.copy(y.color).multiplyScalar(x),t.groundColor.copy(y.groundColor).multiplyScalar(x),i.hemi[d]=t,d++}}u>0&&(!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=rA.LTC_FLOAT_1,i.rectAreaLTC2=rA.LTC_FLOAT_2):(i.rectAreaLTC1=rA.LTC_HALF_1,i.rectAreaLTC2=rA.LTC_HALF_2)),i.ambient[0]=s,i.ambient[1]=o,i.ambient[2]=a;const y=i.hash;y.directionalLength===l&&y.pointLength===c&&y.spotLength===h&&y.rectAreaLength===u&&y.hemiLength===d&&y.numDirectionalShadows===p&&y.numPointShadows===A&&y.numSpotShadows===f&&y.numSpotMaps===m&&y.numLightProbes===v||(i.directional.length=l,i.spot.length=h,i.rectArea.length=u,i.point.length=c,i.hemi.length=d,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=A,i.pointShadowMap.length=A,i.spotShadow.length=f,i.spotShadowMap.length=f,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=A,i.spotLightMatrix.length=f+m-g,i.spotLightMap.length=m,i.numSpotLightShadowsWithMaps=g,i.numLightProbes=v,y.directionalLength=l,y.pointLength=c,y.spotLength=h,y.rectAreaLength=u,y.hemiLength=d,y.numDirectionalShadows=p,y.numPointShadows=A,y.numSpotShadows=f,y.numSpotMaps=m,y.numLightProbes=v,i.version=ym++)},setupView:function(t,e){let n=0,a=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=i.directional[n];t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(u),n++}else if(d.isSpotLight){const t=i.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(u),l++}else if(d.isRectAreaLight){const t=i.rectArea[c];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),o.identity(),s.copy(d.matrixWorld),s.premultiply(u),o.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(o),t.halfHeight.applyMatrix4(o),c++}else if(d.isPointLight){const t=i.point[a];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),a++}else if(d.isHemisphereLight){const t=i.hemi[h];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(u),h++}}},state:i}}function bm(t){const e=new xm(t),n=[],i=[],r={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:function(t){r.camera=t,n.length=0,i.length=0},state:r,setupLights:function(){e.setup(n)},setupLightsView:function(t){e.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){i.push(t)}}}function Cm(t){let e=new WeakMap;return{get:function(n,i=0){const r=e.get(n);let s;return void 0===r?(s=new bm(t),e.set(n,[s])):i>=r.length?(s=new bm(t),r.push(s)):s=r[i],s},dispose:function(){e=new WeakMap}}}function wm(t,e,n){let i=new kl;const r=new Br,s=new Br,o=new Zr,a=new cu({depthPacking:Ci}),l=new hu,c={},h=n.maxTextureSize,u={[Ht]:Vt,[Vt]:Ht,[jt]:jt},d=new wa({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Br},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const A=new sa;A.setAttribute("position",new zo(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const f=new ga(A,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Qt;let g=this.type;function v(n,i){const s=e.update(f);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new ts(r.x,r.y)),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,s,d,f,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,s,p,f,null)}function y(e,n,i,r){let s=null;const o=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==o)s=o;else if(s=!0===i.isPointLight?l:a,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const t=s.uuid,e=n.uuid;let i=c[t];void 0===i&&(i={},c[t]=i);let r=i[e];void 0===r&&(r=s.clone(),i[e]=r,n.addEventListener("dispose",x)),s=r}return s.visible=n.visible,s.wireframe=n.wireframe,s.side=r===zt?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:u[n.side],s.alphaMap=n.alphaMap,s.alphaTest=n.alphaTest,s.map=n.map,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.displacementMap=n.displacementMap,s.displacementScale=n.displacementScale,s.displacementBias=n.displacementBias,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===i.isPointLight&&!0===s.isMeshDistanceMaterial&&(t.properties.get(s).light=i),s}function E(n,r,s,o,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===zt)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=e.update(n),l=n.material;if(Array.isArray(l)){const e=i.groups;for(let c=0,h=e.length;c<h;c++){const h=e[c],u=l[h.materialIndex];if(u&&u.visible){const e=y(n,u,o,a);n.onBeforeShadow(t,n,r,s,i,e,h),t.renderBufferDirect(s,null,i,e,n,h),n.onAfterShadow(t,n,r,s,i,e,h)}}}else if(l.visible){const e=y(n,l,o,a);n.onBeforeShadow(t,n,r,s,i,e,null),t.renderBufferDirect(s,null,i,e,n,null),n.onAfterShadow(t,n,r,s,i,e,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)E(l[t],r,s,o,a)}function x(t){t.target.removeEventListener("dispose",x);for(const e in c){const n=c[e],i=t.target.uuid;i in n&&(n[i].dispose(),delete n[i])}}this.render=function(e,n,a){if(!1===m.enabled)return;if(!1===m.autoUpdate&&!1===m.needsUpdate)return;if(0===e.length)return;const l=t.getRenderTarget(),c=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),d=t.state;d.setBlending(Wt),d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);const p=g!==zt&&this.type===zt,A=g===zt&&this.type!==zt;for(let l=0,c=e.length;l<c;l++){const c=e[l],u=c.shadow;if(void 0===u){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;r.copy(u.mapSize);const f=u.getFrameExtents();if(r.multiply(f),s.copy(u.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/f.x),r.x=s.x*f.x,u.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/f.y),r.y=s.y*f.y,u.mapSize.y=s.y)),null===u.map||!0===p||!0===A){const t=this.type!==zt?{minFilter:Xe,magFilter:Xe}:{};null!==u.map&&u.map.dispose(),u.map=new ts(r.x,r.y,t),u.map.texture.name=c.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const m=u.getViewportCount();for(let t=0;t<m;t++){const e=u.getViewport(t);o.set(s.x*e.x,s.y*e.y,s.x*e.z,s.y*e.w),d.viewport(o),u.updateMatrices(c,t),i=u.getFrustum(),E(n,a,u.camera,c,this.type)}!0!==u.isPointLightShadow&&this.type===zt&&v(u,a),u.needsUpdate=!1}g=this.type,m.needsUpdate=!1,t.setRenderTarget(l,c,u)}}const _m={[ve]:ye,[Ee]:we,[be]:_e,[xe]:Ce,[ye]:ve,[we]:Ee,[_e]:be,[Ce]:xe};function Mm(t,e){const n=new function(){let e=!1;const n=new Zr;let i=null;const r=new Zr(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,s,o,a){!0===a&&(e*=o,i*=o,s*=o),n.set(e,i,s,o),!1===r.equals(n)&&(t.clearColor(e,i,s,o),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},i=new function(){let n=!1,i=!1,r=null,s=null,o=null;return{setReversed:function(t){if(i!==t){const t=e.get("EXT_clip_control");i?t.clipControlEXT(t.LOWER_LEFT_EXT,t.ZERO_TO_ONE_EXT):t.clipControlEXT(t.LOWER_LEFT_EXT,t.NEGATIVE_ONE_TO_ONE_EXT);const n=o;o=null,this.setClear(n)}i=t},getReversed:function(){return i},setTest:function(e){e?Q(t.DEPTH_TEST):G(t.DEPTH_TEST)},setMask:function(e){r===e||n||(t.depthMask(e),r=e)},setFunc:function(e){if(i&&(e=_m[e]),s!==e){switch(e){case ve:t.depthFunc(t.NEVER);break;case ye:t.depthFunc(t.ALWAYS);break;case Ee:t.depthFunc(t.LESS);break;case xe:t.depthFunc(t.LEQUAL);break;case be:t.depthFunc(t.EQUAL);break;case Ce:t.depthFunc(t.GEQUAL);break;case we:t.depthFunc(t.GREATER);break;case _e:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}s=e}},setLocked:function(t){n=t},setClear:function(e){o!==e&&(i&&(e=1-e),t.clearDepth(e),o=e)},reset:function(){n=!1,r=null,s=null,o=null,i=!1}}},r=new function(){let e=!1,n=null,i=null,r=null,s=null,o=null,a=null,l=null,c=null;return{setTest:function(n){e||(n?Q(t.STENCIL_TEST):G(t.STENCIL_TEST))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,o){i===e&&r===n&&s===o||(t.stencilFunc(e,n,o),i=e,r=n,s=o)},setOp:function(e,n,i){o===e&&a===n&&l===i||(t.stencilOp(e,n,i),o=e,a=n,l=i)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,i=null,r=null,s=null,o=null,a=null,l=null,c=null}}},s=new WeakMap,o=new WeakMap;let a={},l={},c=new WeakMap,h=[],u=null,d=!1,p=null,A=null,f=null,m=null,g=null,v=null,y=null,E=new Bo(0,0,0),x=0,b=!1,C=null,w=null,_=null,M=null,S=null;const I=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let B=!1,T=0;const R=t.getParameter(t.VERSION);-1!==R.indexOf("WebGL")?(T=parseFloat(/^WebGL (\d)/.exec(R)[1]),B=T>=1):-1!==R.indexOf("OpenGL ES")&&(T=parseFloat(/^OpenGL ES (\d)/.exec(R)[1]),B=T>=2);let L=null,D={};const P=t.getParameter(t.SCISSOR_BOX),U=t.getParameter(t.VIEWPORT),O=(new Zr).fromArray(P),F=(new Zr).fromArray(U);function k(e,n,i,r){const s=new Uint8Array(4),o=t.createTexture();t.bindTexture(e,o),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let o=0;o<i;o++)e===t.TEXTURE_3D||e===t.TEXTURE_2D_ARRAY?t.texImage3D(n,0,t.RGBA,1,1,r,0,t.RGBA,t.UNSIGNED_BYTE,s):t.texImage2D(n+o,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,s);return o}const N={};function Q(e){!0!==a[e]&&(t.enable(e),a[e]=!0)}function G(e){!1!==a[e]&&(t.disable(e),a[e]=!1)}N[t.TEXTURE_2D]=k(t.TEXTURE_2D,t.TEXTURE_2D,1),N[t.TEXTURE_CUBE_MAP]=k(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),N[t.TEXTURE_2D_ARRAY]=k(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),N[t.TEXTURE_3D]=k(t.TEXTURE_3D,t.TEXTURE_3D,1,1),n.setClear(0,0,0,1),i.setClear(1),r.setClear(0),Q(t.DEPTH_TEST),i.setFunc(xe),j(!1),W(Ot),Q(t.CULL_FACE),V(Wt);const z={[Zt]:t.FUNC_ADD,[$t]:t.FUNC_SUBTRACT,[te]:t.FUNC_REVERSE_SUBTRACT};z[ee]=t.MIN,z[ne]=t.MAX;const H={[ie]:t.ZERO,[re]:t.ONE,[se]:t.SRC_COLOR,[ae]:t.SRC_ALPHA,[pe]:t.SRC_ALPHA_SATURATE,[ue]:t.DST_COLOR,[ce]:t.DST_ALPHA,[oe]:t.ONE_MINUS_SRC_COLOR,[le]:t.ONE_MINUS_SRC_ALPHA,[de]:t.ONE_MINUS_DST_COLOR,[he]:t.ONE_MINUS_DST_ALPHA,[Ae]:t.CONSTANT_COLOR,[fe]:t.ONE_MINUS_CONSTANT_COLOR,[me]:t.CONSTANT_ALPHA,[ge]:t.ONE_MINUS_CONSTANT_ALPHA};function V(e,n,i,r,s,o,a,l,c,h){if(e!==Wt){if(!1===d&&(Q(t.BLEND),d=!0),e===Kt)s=s||n,o=o||i,a=a||r,n===A&&s===g||(t.blendEquationSeparate(z[n],z[s]),A=n,g=s),i===f&&r===m&&o===v&&a===y||(t.blendFuncSeparate(H[i],H[r],H[o],H[a]),f=i,m=r,v=o,y=a),!1!==l.equals(E)&&c===x||(t.blendColor(l.r,l.g,l.b,c),E.copy(l),x=c),p=e,b=!1;else if(e!==p||h!==b){if(A===Zt&&g===Zt||(t.blendEquation(t.FUNC_ADD),A=Zt,g=Zt),h)switch(e){case qt:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Xt:t.blendFunc(t.ONE,t.ONE);break;case Yt:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Jt:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case qt:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case Xt:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case Yt:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case Jt:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}f=null,m=null,v=null,y=null,E.set(0,0,0),x=0,p=e,b=h}}else!0===d&&(G(t.BLEND),d=!1)}function j(e){C!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),C=e)}function W(e){e!==Ut?(Q(t.CULL_FACE),e!==w&&(e===Ot?t.cullFace(t.BACK):e===Ft?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):G(t.CULL_FACE),w=e}function q(e,n,i){e?(Q(t.POLYGON_OFFSET_FILL),M===n&&S===i||(t.polygonOffset(n,i),M=n,S=i)):G(t.POLYGON_OFFSET_FILL)}return{buffers:{color:n,depth:i,stencil:r},enable:Q,disable:G,bindFramebuffer:function(e,n){return l[e]!==n&&(t.bindFramebuffer(e,n),l[e]=n,e===t.DRAW_FRAMEBUFFER&&(l[t.FRAMEBUFFER]=n),e===t.FRAMEBUFFER&&(l[t.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(e,n){let i=h,r=!1;if(e){i=c.get(n),void 0===i&&(i=[],c.set(n,i));const s=e.textures;if(i.length!==s.length||i[0]!==t.COLOR_ATTACHMENT0){for(let e=0,n=s.length;e<n;e++)i[e]=t.COLOR_ATTACHMENT0+e;i.length=s.length,r=!0}}else i[0]!==t.BACK&&(i[0]=t.BACK,r=!0);r&&t.drawBuffers(i)},useProgram:function(e){return u!==e&&(t.useProgram(e),u=e,!0)},setBlending:V,setMaterial:function(e,s){e.side===jt?G(t.CULL_FACE):Q(t.CULL_FACE);let o=e.side===Vt;s&&(o=!o),j(o),e.blending===qt&&!1===e.transparent?V(Wt):V(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.blendColor,e.blendAlpha,e.premultipliedAlpha),i.setFunc(e.depthFunc),i.setTest(e.depthTest),i.setMask(e.depthWrite),n.setMask(e.colorWrite);const a=e.stencilWrite;r.setTest(a),a&&(r.setMask(e.stencilWriteMask),r.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),r.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),q(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?Q(t.SAMPLE_ALPHA_TO_COVERAGE):G(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:j,setCullFace:W,setLineWidth:function(e){e!==_&&(B&&t.lineWidth(e),_=e)},setPolygonOffset:q,setScissorTest:function(e){e?Q(t.SCISSOR_TEST):G(t.SCISSOR_TEST)},activeTexture:function(e){void 0===e&&(e=t.TEXTURE0+I-1),L!==e&&(t.activeTexture(e),L=e)},bindTexture:function(e,n,i){void 0===i&&(i=null===L?t.TEXTURE0+I-1:L);let r=D[i];void 0===r&&(r={type:void 0,texture:void 0},D[i]=r),r.type===e&&r.texture===n||(L!==i&&(t.activeTexture(i),L=i),t.bindTexture(e,n||N[e]),r.type=e,r.texture=n)},unbindTexture:function(){const e=D[L];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexImage3D:function(){try{t.compressedTexImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},updateUBOMapping:function(e,n){let i=o.get(n);void 0===i&&(i=new WeakMap,o.set(n,i));let r=i.get(e);void 0===r&&(r=t.getUniformBlockIndex(n,e.name),i.set(e,r))},uniformBlockBinding:function(e,n){const i=o.get(n).get(e);s.get(n)!==i&&(t.uniformBlockBinding(n,i,e.__bindingPointIndex),s.set(n,i))},texStorage2D:function(){try{t.texStorage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D.apply(t,arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===O.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),O.copy(e))},viewport:function(e){!1===F.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),F.copy(e))},reset:function(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),i.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),a={},L=null,D={},l={},c=new WeakMap,h=[],u=null,d=!1,p=null,A=null,f=null,m=null,g=null,v=null,y=null,E=new Bo(0,0,0),x=0,b=!1,C=null,w=null,_=null,M=null,S=null,O.set(0,0,t.canvas.width,t.canvas.height),F.set(0,0,t.canvas.width,t.canvas.height),n.reset(),i.reset(),r.reset()}}}function Sm(t,e,n,i,r,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=e.has("OCULUS_multiview")?e.get("OCULUS_multiview"):null,h=new Br,u=new WeakMap;let d;const p=new WeakMap;let A=[],f=!1,m=!1;try{m="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function g(t,e){return m?new OffscreenCanvas(t,e):Ur("canvas")}function v(t,e,n){let i=1;const r=W(t);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&t instanceof VideoFrame){const n=Math.floor(i*r.width),s=Math.floor(i*r.height);void 0===d&&(d=g(n,s));const o=e?g(n,s):d;return o.width=n,o.height=s,o.getContext("2d").drawImage(t,0,0,n,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+s+")."),o}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),t}return t}function y(t){return t.generateMipmaps}function E(e){t.generateMipmap(e)}function x(e){return e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:e.isWebGL3DRenderTarget?t.TEXTURE_3D:e.isWebGLArrayRenderTarget||e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function b(n,i,r,s,o=!1){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 a=i;if(i===t.RED&&(r===t.FLOAT&&(a=t.R32F),r===t.HALF_FLOAT&&(a=t.R16F),r===t.UNSIGNED_BYTE&&(a=t.R8)),i===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(a=t.R8UI),r===t.UNSIGNED_SHORT&&(a=t.R16UI),r===t.UNSIGNED_INT&&(a=t.R32UI),r===t.BYTE&&(a=t.R8I),r===t.SHORT&&(a=t.R16I),r===t.INT&&(a=t.R32I)),i===t.RG&&(r===t.FLOAT&&(a=t.RG32F),r===t.HALF_FLOAT&&(a=t.RG16F),r===t.UNSIGNED_BYTE&&(a=t.RG8)),i===t.RG_INTEGER&&(r===t.UNSIGNED_BYTE&&(a=t.RG8UI),r===t.UNSIGNED_SHORT&&(a=t.RG16UI),r===t.UNSIGNED_INT&&(a=t.RG32UI),r===t.BYTE&&(a=t.RG8I),r===t.SHORT&&(a=t.RG16I),r===t.INT&&(a=t.RG32I)),i===t.RGB_INTEGER&&(r===t.UNSIGNED_BYTE&&(a=t.RGB8UI),r===t.UNSIGNED_SHORT&&(a=t.RGB16UI),r===t.UNSIGNED_INT&&(a=t.RGB32UI),r===t.BYTE&&(a=t.RGB8I),r===t.SHORT&&(a=t.RGB16I),r===t.INT&&(a=t.RGB32I)),i===t.RGBA_INTEGER&&(r===t.UNSIGNED_BYTE&&(a=t.RGBA8UI),r===t.UNSIGNED_SHORT&&(a=t.RGBA16UI),r===t.UNSIGNED_INT&&(a=t.RGBA32UI),r===t.BYTE&&(a=t.RGBA8I),r===t.SHORT&&(a=t.RGBA16I),r===t.INT&&(a=t.RGBA32I)),i===t.RGB&&r===t.UNSIGNED_INT_5_9_9_9_REV&&(a=t.RGB9_E5),i===t.RGBA){const e=o?Ri:zr.getTransfer(s);r===t.FLOAT&&(a=t.RGBA32F),r===t.HALF_FLOAT&&(a=t.RGBA16F),r===t.UNSIGNED_BYTE&&(a=e===Li?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(a=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(a=t.RGB5_A1)}return a!==t.R16F&&a!==t.R32F&&a!==t.RG16F&&a!==t.RG32F&&a!==t.RGBA16F&&a!==t.RGBA32F||e.get("EXT_color_buffer_float"),a}function C(e,n){let i;return e?null===n||n===hn||n===fn?i=t.DEPTH24_STENCIL8:n===un?i=t.DEPTH32F_STENCIL8:n===ln&&(i=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===hn||n===fn?i=t.DEPTH_COMPONENT24:n===un?i=t.DEPTH_COMPONENT32F:n===ln&&(i=t.DEPTH_COMPONENT16),i}function w(t,e){return!0===y(t)||t.isFramebufferTexture&&t.minFilter!==Xe&&t.minFilter!==$e?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function _(t){const e=t.target;e.removeEventListener("dispose",_),function(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=p.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&S(t),0===Object.keys(r).length&&p.delete(n)}i.remove(t)}(e),e.isVideoTexture&&u.delete(e)}function M(e){const n=e.target;n.removeEventListener("dispose",M),function(e){const n=i.get(e);if(e.depthTexture&&(e.depthTexture.dispose(),i.remove(e.depthTexture)),e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++){if(Array.isArray(n.__webglFramebuffer[e]))for(let i=0;i<n.__webglFramebuffer[e].length;i++)t.deleteFramebuffer(n.__webglFramebuffer[e][i]);else t.deleteFramebuffer(n.__webglFramebuffer[e]);n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[e])}else{if(Array.isArray(n.__webglFramebuffer))for(let e=0;e<n.__webglFramebuffer.length;e++)t.deleteFramebuffer(n.__webglFramebuffer[e]);else t.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&t.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let e=0;e<n.__webglColorRenderbuffer.length;e++)n.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(n.__webglColorRenderbuffer[e]);n.__webglDepthRenderbuffer&&t.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=e.textures;for(let e=0,n=r.length;e<n;e++){const n=i.get(r[e]);n.__webglTexture&&(t.deleteTexture(n.__webglTexture),o.memory.textures--),i.remove(r[e])}i.remove(e)}(n)}function S(e){const n=i.get(e);t.deleteTexture(n.__webglTexture);const r=e.source;delete p.get(r)[n.__cacheKey],o.memory.textures--}let I=0;function B(e,r){const s=i.get(e);if(e.isVideoTexture&&function(t){const e=o.render.frame;u.get(t)!==e&&(u.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&s.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===t.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else if(O(s,e,r))return}n.bindTexture(t.TEXTURE_2D,s.__webglTexture,t.TEXTURE0+r)}function T(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?O(s,e,r):n.bindTexture(t.TEXTURE_2D_ARRAY,s.__webglTexture,t.TEXTURE0+r)}const R={[je]:t.REPEAT,[We]:t.CLAMP_TO_EDGE,[qe]:t.MIRRORED_REPEAT},L={[Xe]:t.NEAREST,[Ye]:t.NEAREST_MIPMAP_NEAREST,[Ke]:t.NEAREST_MIPMAP_LINEAR,[$e]:t.LINEAR,[tn]:t.LINEAR_MIPMAP_NEAREST,[nn]:t.LINEAR_MIPMAP_LINEAR},D={[Yi]:t.NEVER,[nr]:t.ALWAYS,[Ji]:t.LESS,[Zi]:t.LEQUAL,[Ki]:t.EQUAL,[er]:t.GEQUAL,[$i]:t.GREATER,[tr]:t.NOTEQUAL};function P(n,s){if(s.type!==un||!1!==e.has("OES_texture_float_linear")||s.magFilter!==$e&&s.magFilter!==tn&&s.magFilter!==Ke&&s.magFilter!==nn&&s.minFilter!==$e&&s.minFilter!==tn&&s.minFilter!==Ke&&s.minFilter!==nn||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(n,t.TEXTURE_WRAP_S,R[s.wrapS]),t.texParameteri(n,t.TEXTURE_WRAP_T,R[s.wrapT]),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,R[s.wrapR]),t.texParameteri(n,t.TEXTURE_MAG_FILTER,L[s.magFilter]),t.texParameteri(n,t.TEXTURE_MIN_FILTER,L[s.minFilter]),s.compareFunction&&(t.texParameteri(n,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(n,t.TEXTURE_COMPARE_FUNC,D[s.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){if(s.magFilter===Xe)return;if(s.minFilter!==Ke&&s.minFilter!==nn)return;if(s.type===un&&!1===e.has("OES_texture_float_linear"))return;if(s.anisotropy>1||i.get(s).__currentAnisotropy){const o=e.get("EXT_texture_filter_anisotropic");t.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy}}}function U(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",_));const r=n.source;let s=p.get(r);void 0===s&&(s={},p.set(r,s));const a=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(n);if(a!==e.__cacheKey){void 0===s[a]&&(s[a]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,i=!0),s[a].usedTimes++;const r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&S(n)),e.__cacheKey=a,e.__webglTexture=s[a].texture}return i}function O(e,o,a){if(f)return o.isPendingDeferredUpload||(o.isPendingDeferredUpload=!0,A.push({textureProperties:e,texture:o,slot:a})),!1;let l=t.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),o.isData3DTexture&&(l=t.TEXTURE_3D);const c=U(e,o),h=o.source;n.bindTexture(l,e.__webglTexture,t.TEXTURE0+a);const u=i.get(h);if(h.version!==u.__version||!0===c){n.activeTexture(t.TEXTURE0+a);const e=zr.getPrimaries(zr.workingColorSpace),i=o.colorSpace===Ii?null:zr.getPrimaries(o.colorSpace),d=o.colorSpace===Ii||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,o.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,o.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=v(o.image,!1,r.maxTextureSize);p=j(o,p);const A=s.convert(o.format,o.colorSpace),f=s.convert(o.type);let m,g=b(o.internalFormat,A,f,o.colorSpace,o.isVideoTexture);P(l,o);const x=o.mipmaps,_=!0!==o.isVideoTexture,M=void 0===u.__version||!0===c,S=h.dataReady,I=w(o,p);if(o.isDepthTexture)g=C(o.format===Cn,o.type),M&&(_?n.texStorage2D(t.TEXTURE_2D,1,g,p.width,p.height):n.texImage2D(t.TEXTURE_2D,0,g,p.width,p.height,0,A,f,null));else if(o.isDataTexture)if(x.length>0){_&&M&&n.texStorage2D(t.TEXTURE_2D,I,g,x[0].width,x[0].height);for(let e=0,i=x.length;e<i;e++)m=x[e],_?S&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,m.width,m.height,A,f,m.data):n.texImage2D(t.TEXTURE_2D,e,g,m.width,m.height,0,A,f,m.data);o.generateMipmaps=!1}else _?(M&&n.texStorage2D(t.TEXTURE_2D,I,g,p.width,p.height),S&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,p.width,p.height,A,f,p.data)):n.texImage2D(t.TEXTURE_2D,0,g,p.width,p.height,0,A,f,p.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){_&&M&&n.texStorage3D(t.TEXTURE_2D_ARRAY,I,g,x[0].width,x[0].height,p.depth);for(let e=0,i=x.length;e<i;e++)if(m=x[e],o.format!==yn)if(null!==A)if(_){if(S)if(o.layerUpdates.size>0){const i=$p(m.width,m.height,o.format,o.type);for(const r of o.layerUpdates){const s=m.data.subarray(r*i/m.data.BYTES_PER_ELEMENT,(r+1)*i/m.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,r,m.width,m.height,1,A,s)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,m.width,m.height,p.depth,A,m.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,e,g,m.width,m.height,p.depth,0,m.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else _?S&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,m.width,m.height,p.depth,A,f,m.data):n.texImage3D(t.TEXTURE_2D_ARRAY,e,g,m.width,m.height,p.depth,0,A,f,m.data)}else{_&&M&&n.texStorage2D(t.TEXTURE_2D,I,g,x[0].width,x[0].height);for(let e=0,i=x.length;e<i;e++)m=x[e],o.format!==yn?null!==A?_?S&&n.compressedTexSubImage2D(t.TEXTURE_2D,e,0,0,m.width,m.height,A,m.data):n.compressedTexImage2D(t.TEXTURE_2D,e,g,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_?S&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,m.width,m.height,A,f,m.data):n.texImage2D(t.TEXTURE_2D,e,g,m.width,m.height,0,A,f,m.data)}else if(o.isDataArrayTexture)if(_){if(M&&n.texStorage3D(t.TEXTURE_2D_ARRAY,I,g,p.width,p.height,p.depth),S)if(o.layerUpdates.size>0){const e=$p(p.width,p.height,o.format,o.type);for(const i of o.layerUpdates){const r=p.data.subarray(i*e/p.data.BYTES_PER_ELEMENT,(i+1)*e/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,i,p.width,p.height,1,A,f,r)}o.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,A,f,p.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,g,p.width,p.height,p.depth,0,A,f,p.data);else if(o.isData3DTexture)_?(M&&n.texStorage3D(t.TEXTURE_3D,I,g,p.width,p.height,p.depth),S&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,A,f,p.data)):n.texImage3D(t.TEXTURE_3D,0,g,p.width,p.height,p.depth,0,A,f,p.data);else if(o.isFramebufferTexture){if(M)if(_)n.texStorage2D(t.TEXTURE_2D,I,g,p.width,p.height);else{let e=p.width,i=p.height;for(let r=0;r<I;r++)n.texImage2D(t.TEXTURE_2D,r,g,e,i,0,A,f,null),e>>=1,i>>=1}}else if(x.length>0){if(_&&M){const e=W(x[0]);n.texStorage2D(t.TEXTURE_2D,I,g,e.width,e.height)}for(let e=0,i=x.length;e<i;e++)m=x[e],_?S&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,A,f,m):n.texImage2D(t.TEXTURE_2D,e,g,A,f,m);o.generateMipmaps=!1}else if(_){if(M){const e=W(p);n.texStorage2D(t.TEXTURE_2D,I,g,e.width,e.height)}S&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,A,f,p)}else n.texImage2D(t.TEXTURE_2D,0,g,A,f,p);y(o)&&E(l),u.__version=h.version,o.onUpdate&&o.onUpdate(o)}return e.__version=o.version,!0}function F(e,r,o,l,h,u){const d=s.convert(o.format,o.colorSpace),p=s.convert(o.type),A=b(o.internalFormat,d,p,o.colorSpace),f=i.get(r),m=i.get(o);if(m.__renderTarget=r,!f.__hasExternalTextures){const e=Math.max(1,r.width>>u),i=Math.max(1,r.height>>u);!0===r.isWebGLMultiviewRenderTarget?n.texStorage3D(t.TEXTURE_2D_ARRAY,0,A,r.width,r.height,r.numViews):h===t.TEXTURE_3D||h===t.TEXTURE_2D_ARRAY?n.texImage3D(h,u,A,e,i,r.depth,0,d,p,null):n.texImage2D(h,u,A,e,i,0,d,p,null)}n.bindFramebuffer(t.FRAMEBUFFER,e);const g=V(r);!0===r.isWebGLMultiviewRenderTarget?g?c.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,m.__webglTexture,0,H(r),0,r.numViews):c.framebufferTextureMultiviewOVR(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,m.__webglTexture,0,0,r.numViews):(h===t.TEXTURE_2D||h>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&h<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&(g?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,l,h,m.__webglTexture,0,H(r)):t.framebufferTexture2D(t.FRAMEBUFFER,l,h,m.__webglTexture,u)),n.bindFramebuffer(t.FRAMEBUFFER,null)}function k(e,n,r){if(t.bindRenderbuffer(t.RENDERBUFFER,e),!0===n.isWebGLMultiviewRenderTarget){const e=V(n),r=n.numViews,s=n.depthTexture;let o=t.DEPTH_COMPONENT24,a=t.DEPTH_ATTACHMENT;s&&s.isDepthTexture&&(s.type===un?o=t.DEPTH_COMPONENT32F:s.type===fn&&(o=t.DEPTH24_STENCIL8,a=t.DEPTH_STENCIL_ATTACHMENT));let l=i.get(n.depthTexture).__webglTexture;void 0===l&&(l=t.createTexture(),t.bindTexture(t.TEXTURE_2D_ARRAY,l),t.texStorage3D(t.TEXTURE_2D_ARRAY,1,o,n.width,n.height,r)),e?c.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,a,l,0,H(n),0,r):c.framebufferTextureMultiviewOVR(t.FRAMEBUFFER,a,l,0,0,r)}else if(n.depthBuffer){const i=n.depthTexture,s=i&&i.isDepthTexture?i.type:null,o=C(n.stencilBuffer,s),l=n.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,c=H(n);V(n)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,c,o,n.width,n.height):r?t.renderbufferStorageMultisample(t.RENDERBUFFER,c,o,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,o,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,l,t.RENDERBUFFER,e)}else{const e=n.textures;for(let i=0;i<e.length;i++){const o=e[i],l=s.convert(o.format,o.colorSpace),c=s.convert(o.type),h=b(o.internalFormat,l,c,o.colorSpace),u=H(n);r&&!1===V(n)?t.renderbufferStorageMultisample(t.RENDERBUFFER,u,h,n.width,n.height):V(n)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,u,h,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,h,n.width,n.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function N(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const s=i.get(r.depthTexture);s.__renderTarget=r,s.__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),1!=r.depthTexture.image.depth?T(r.depthTexture,0):B(r.depthTexture,0);const o=s.__webglTexture,l=H(r);if(!0===r.isWebGLMultiviewRenderTarget){const e=V(r),n=r.numViews;if(r.depthTexture.format===bn)e?c.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,o,0,l,0,n):c.framebufferTextureMultiviewOVR(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,o,0,0,n);else{if(r.depthTexture.format!==Cn)throw new Error("Unknown depthTexture format");e?c.framebufferTextureMultisampleMultiviewOVR(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,o,0,l,0,n):c.framebufferTextureMultiviewOVR(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,o,0,0,n)}}else if(r.depthTexture.format===bn)V(r)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,o,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,o,0);else{if(r.depthTexture.format!==Cn)throw new Error("Unknown depthTexture format");V(r)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,o,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,o,0)}}function Q(e){const r=i.get(e),s=!0===e.isWebGLCubeRenderTarget;if(r.__boundDepthTexture!==e.depthTexture){const t=e.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),t){const e=()=>{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,t.removeEventListener("dispose",e)};t.addEventListener("dispose",e),r.__depthDisposeCallback=e}r.__boundDepthTexture=t}if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(s)throw new Error("target.depthTexture not supported in Cube render targets");N(r.__webglFramebuffer,e)}else if(s){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[i]),void 0===r.__webglDepthbuffer[i])r.__webglDepthbuffer[i]=t.createRenderbuffer(),k(r.__webglDepthbuffer[i],e,!1);else{const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,s=r.__webglDepthbuffer[i];t.bindRenderbuffer(t.RENDERBUFFER,s),t.framebufferRenderbuffer(t.FRAMEBUFFER,n,t.RENDERBUFFER,s)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=t.createRenderbuffer(),k(r.__webglDepthbuffer,e,!1);else{const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,i=r.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,i),t.framebufferRenderbuffer(t.FRAMEBUFFER,n,t.RENDERBUFFER,i)}n.bindFramebuffer(t.FRAMEBUFFER,null)}const G=[],z=[];function H(t){return Math.min(r.maxSamples,t.samples)}function V(t){const n=i.get(t);return t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function j(t,e){const n=t.colorSpace,i=t.format,r=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||n!==Ti&&n!==Ii&&(zr.getTransfer(n)===Li?i===yn&&r===sn||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),e}function W(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?(h.width=t.naturalWidth||t.width,h.height=t.naturalHeight||t.height):"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?(h.width=t.displayWidth,h.height=t.displayHeight):(h.width=t.width,h.height=t.height),h}this.allocateTextureUnit=function(){const t=I;return t>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+r.maxTextures),I+=1,t},this.resetTextureUnits=function(){I=0},this.setTexture2D=B,this.setTexture2DArray=T,this.setTexture3D=function(e,r){const s=i.get(e);e.version>0&&s.__version!==e.version?O(s,e,r):n.bindTexture(t.TEXTURE_3D,s.__webglTexture,t.TEXTURE0+r)},this.setTextureCube=function(e,o){const a=i.get(e);e.version>0&&a.__version!==e.version?function(e,o,a){if(6!==o.image.length)return;const l=U(e,o),c=o.source;n.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+a);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(t.TEXTURE0+a);const e=zr.getPrimaries(zr.workingColorSpace),i=o.colorSpace===Ii?null:zr.getPrimaries(o.colorSpace),u=o.colorSpace===Ii||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,o.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,o.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);const d=o.isCompressedTexture||o.image[0].isCompressedTexture,p=o.image[0]&&o.image[0].isDataTexture,A=[];for(let t=0;t<6;t++)A[t]=d||p?p?o.image[t].image:o.image[t]:v(o.image[t],!0,r.maxCubemapSize),A[t]=j(o,A[t]);const f=A[0],m=s.convert(o.format,o.colorSpace),g=s.convert(o.type),x=b(o.internalFormat,m,g,o.colorSpace),C=!0!==o.isVideoTexture,_=void 0===h.__version||!0===l,M=c.dataReady;let S,I=w(o,f);if(P(t.TEXTURE_CUBE_MAP,o),d){C&&_&&n.texStorage2D(t.TEXTURE_CUBE_MAP,I,x,f.width,f.height);for(let e=0;e<6;e++){S=A[e].mipmaps;for(let i=0;i<S.length;i++){const r=S[i];o.format!==yn?null!==m?C?M&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,0,0,r.width,r.height,m,r.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,x,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):C?M&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,0,0,r.width,r.height,m,g,r.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,x,r.width,r.height,0,m,g,r.data)}}}else{if(S=o.mipmaps,C&&_){S.length>0&&I++;const e=W(A[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,I,x,e.width,e.height)}for(let e=0;e<6;e++)if(p){C?M&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,A[e].width,A[e].height,m,g,A[e].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,x,A[e].width,A[e].height,0,m,g,A[e].data);for(let i=0;i<S.length;i++){const r=S[i].image[e].image;C?M&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,0,0,r.width,r.height,m,g,r.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,x,r.width,r.height,0,m,g,r.data)}}else{C?M&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,m,g,A[e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,x,m,g,A[e]);for(let i=0;i<S.length;i++){const r=S[i];C?M&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,0,0,m,g,r.image[e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,x,m,g,r.image[e])}}}y(o)&&E(t.TEXTURE_CUBE_MAP),h.__version=c.version,o.onUpdate&&o.onUpdate(o)}e.__version=o.version}(a,e,o):n.bindTexture(t.TEXTURE_CUBE_MAP,a.__webglTexture,t.TEXTURE0+o)},this.rebindTextures=function(e,n,r){const s=i.get(e);void 0!==n&&F(s.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==r&&Q(e)},this.uploadTexture=O,this.setupRenderTarget=function(e){const r=e.texture,a=i.get(e),l=i.get(r);e.addEventListener("dispose",M);const c=e.textures,h=!0===e.isWebGLCubeRenderTarget,u=c.length>1;if(u||(void 0===l.__webglTexture&&(l.__webglTexture=t.createTexture()),l.__version=r.version,o.memory.textures++),h){a.__webglFramebuffer=[];for(let e=0;e<6;e++)if(r.mipmaps&&r.mipmaps.length>0){a.__webglFramebuffer[e]=[];for(let n=0;n<r.mipmaps.length;n++)a.__webglFramebuffer[e][n]=t.createFramebuffer()}else a.__webglFramebuffer[e]=t.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){a.__webglFramebuffer=[];for(let e=0;e<r.mipmaps.length;e++)a.__webglFramebuffer[e]=t.createFramebuffer()}else a.__webglFramebuffer=t.createFramebuffer();if(u)for(let e=0,n=c.length;e<n;e++){const n=i.get(c[e]);void 0===n.__webglTexture&&(n.__webglTexture=t.createTexture(),o.memory.textures++)}if(e.samples>0&&!1===V(e)){a.__webglMultisampledFramebuffer=t.createFramebuffer(),a.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,a.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const i=c[n];a.__webglColorRenderbuffer[n]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,a.__webglColorRenderbuffer[n]);const r=s.convert(i.format,i.colorSpace),o=s.convert(i.type),l=b(i.internalFormat,r,o,i.colorSpace,!0===e.isXRRenderTarget),h=H(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,h,l,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+n,t.RENDERBUFFER,a.__webglColorRenderbuffer[n])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(a.__webglDepthRenderbuffer=t.createRenderbuffer(),k(a.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(h){n.bindTexture(t.TEXTURE_CUBE_MAP,l.__webglTexture),P(t.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)F(a.__webglFramebuffer[n][i],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else F(a.__webglFramebuffer[n],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);y(r)&&E(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(u){for(let r=0,s=c.length;r<s;r++){const s=c[r],o=i.get(s);n.bindTexture(t.TEXTURE_2D,o.__webglTexture),P(t.TEXTURE_2D,s),F(a.__webglFramebuffer,e,s,t.COLOR_ATTACHMENT0+r,t.TEXTURE_2D,0),y(s)&&E(t.TEXTURE_2D)}n.unbindTexture()}else{let i=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(i=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),!0===e.isWebGLMultiviewRenderTarget&&(i=t.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),P(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)F(a.__webglFramebuffer[n],e,r,t.COLOR_ATTACHMENT0,i,n);else F(a.__webglFramebuffer,e,r,t.COLOR_ATTACHMENT0,i,0);y(r)&&E(i),n.unbindTexture()}(e.depthBuffer||!0===e.isWebGLMultiviewRenderTarget)&&this.setupDepthRenderbuffer(e)},this.updateRenderTargetMipmap=function(t){const e=t.textures;for(let r=0,s=e.length;r<s;r++){const s=e[r];if(y(s)){const e=x(t),r=i.get(s).__webglTexture;n.bindTexture(e,r),E(e),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.samples>0)if(!1===V(e)){const r=e.textures,s=e.width,o=e.height;let a=t.COLOR_BUFFER_BIT;const c=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,h=i.get(e),u=r.length>1;if(u)for(let e=0;e<r.length;e++)n.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let n=0;n<r.length;n++){if(e.resolveDepthBuffer&&(e.depthBuffer&&(a|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&e.resolveStencilBuffer&&(a|=t.STENCIL_BUFFER_BIT)),u){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,h.__webglColorRenderbuffer[n]);const e=i.get(r[n]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}t.blitFramebuffer(0,0,s,o,0,0,s,o,a,t.NEAREST),!0===l&&(G.length=0,z.length=0,G.push(t.COLOR_ATTACHMENT0+n),e.depthBuffer&&!1===e.resolveDepthBuffer&&(G.push(c),z.push(c),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,z)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,G))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),u)for(let e=0;e<r.length;e++){n.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,h.__webglColorRenderbuffer[e]);const s=i.get(r[e]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,s,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(e.depthBuffer&&!1===e.resolveDepthBuffer&&l){const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[n])}},this.setupDepthTexture=N,this.setupDepthRenderbuffer=Q,this.setupFrameBufferTexture=F,this.useMultisampledRTT=V,this.runDeferredUploads=function(){const t=f;f=!1;for(const t of A)O(t.textureProperties,t.texture,t.slot),t.texture.isPendingDeferredUpload=!1;A=[],f=t},this.setDeferTextureUploads=function(t){f=t}}function Im(t,e){return{convert:function(n,i=Ii){let r;const s=zr.getTransfer(i);if(n===sn)return t.UNSIGNED_BYTE;if(n===pn)return t.UNSIGNED_SHORT_4_4_4_4;if(n===An)return t.UNSIGNED_SHORT_5_5_5_1;if(n===mn)return t.UNSIGNED_INT_5_9_9_9_REV;if(n===on)return t.BYTE;if(n===an)return t.SHORT;if(n===ln)return t.UNSIGNED_SHORT;if(n===cn)return t.INT;if(n===hn)return t.UNSIGNED_INT;if(n===un)return t.FLOAT;if(n===dn)return t.HALF_FLOAT;if(n===gn)return t.ALPHA;if(n===vn)return t.RGB;if(n===yn)return t.RGBA;if(n===En)return t.LUMINANCE;if(n===xn)return t.LUMINANCE_ALPHA;if(n===bn)return t.DEPTH_COMPONENT;if(n===Cn)return t.DEPTH_STENCIL;if(n===wn)return t.RED;if(n===_n)return t.RED_INTEGER;if(n===Mn)return t.RG;if(n===Sn)return t.RG_INTEGER;if(n===Bn)return t.RGBA_INTEGER;if(n===Tn||n===Rn||n===Ln||n===Dn)if(s===Li){if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===Tn)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Rn)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===Ln)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Dn)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=e.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===Tn)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Rn)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===Ln)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Dn)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===Pn||n===Un||n===On||n===Fn){if(r=e.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===Pn)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Un)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===On)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Fn)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===kn||n===Nn||n===Qn){if(r=e.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===kn||n===Nn)return s===Li?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Qn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===Gn||n===zn||n===Hn||n===Vn||n===jn||n===Wn||n===qn||n===Xn||n===Yn||n===Jn||n===Kn||n===Zn||n===$n||n===ti){if(r=e.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===Gn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===zn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Hn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Vn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===jn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Wn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===qn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Xn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Yn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Jn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Kn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Zn)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===$n)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===ti)return s===Li?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===ei||n===ni||n===ii){if(r=e.get("EXT_texture_compression_bptc"),null===r)return null;if(n===ei)return s===Li?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===ni)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===ii)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===ri||n===si||n===oi||n===ai){if(r=e.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===ei)return r.COMPRESSED_RED_RGTC1_EXT;if(n===si)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===oi)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===ai)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===fn?t.UNSIGNED_INT_24_8:void 0!==t[n]?t[n]:null}}}class Bm extends ts{constructor(t,e,n,i={}){super(t,e,i),this.depthBuffer=!1,this.stencilBuffer=!1,this.numViews=n}copy(t){return super.copy(t),this.numViews=t.numViews,this}}Bm.prototype.isWebGLMultiviewRenderTarget=!0;class Tm{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(null===this.texture){const i=new Kr;t.properties.get(i).__webglTexture=e.texture,e.depthNear===n.depthNear&&e.depthFar===n.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(t){if(null!==this.texture&&null===this.mesh){const e=t.cameras[0].viewport,n=new wa({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new ga(new Vh(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Rm extends gr{constructor(t,e,n,i){super();const r=this;let s=null,o=1;var a=null;let l=null,c="local-floor",h=1,u=null,d=null;var p=[];let A=null,f=null,m=null,g=null;const v=new Tm,y=e.getContextAttributes();let E=null,x=null;const b=[],C=[],w=new Br;let _=null;const M=new Ba;M.viewport=new Zr;const S=new Ba;S.viewport=new Zr;const I=[M,S],B=new Id;let T=null,R=null;function L(t){const e=C.indexOf(t.inputSource);if(-1===e)return;const n=b[e];void 0!==n&&(n.update(t.inputSource,t.frame,u||l),n.dispatchEvent({type:t.type,data:t.inputSource}))}function D(){s.removeEventListener("select",L),s.removeEventListener("selectstart",L),s.removeEventListener("selectend",L),s.removeEventListener("squeeze",L),s.removeEventListener("squeezestart",L),s.removeEventListener("squeezeend",L),s.removeEventListener("end",D),s.removeEventListener("inputsourceschange",P);for(let t=0;t<b.length;t++){const e=C[t];null!==e&&(C[t]=null,b[t].disconnect(e))}T=null,R=null,v.reset(),t.setRenderTarget(E),m=null,f=null,A=null,s=null,x=null,N.stop(),r.isPresenting=!1,t.setPixelRatio(_),t.setSize(w.width,w.height,!1),r.dispatchEvent({type:"sessionend"})}function P(t){for(let e=0;e<t.removed.length;e++){const n=t.removed[e],i=C.indexOf(n);i>=0&&(C[i]=null,b[i].disconnect(n))}for(let e=0;e<t.added.length;e++){const n=t.added[e];let i=C.indexOf(n);if(-1===i){for(let t=0;t<b.length;t++){if(t>=C.length){C.push(n),i=t;break}if(null===C[t]){C[t]=n,i=t;break}}if(-1===i)break}const r=b[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.layersEnabled=!1,this.enabled=!1,this.isPresenting=!1,this.isMultiview=!1,this.getCameraPose=function(){return d},this.getController=function(t){let e=b[t];return void 0===e&&(e=new Oa,b[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=b[t];return void 0===e&&(e=new Oa,b[t]=e),e.getGripSpace()},this.getHand=function(t){let e=b[t];return void 0===e&&(e=new Oa,b[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){o=t,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){c=t,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return u||l},this.setReferenceSpace=function(t){u=t},this.getBaseLayer=function(){return null!==f?f:m},this.getBinding=function(){return A},this.getRenderTarget=function(){return x},this.getFrame=function(){return g},this.getSession=function(){return s},this.setSession=async function(a){if(s=a,null!==s){if(E=t.getRenderTarget(),s.addEventListener("select",L),s.addEventListener("selectstart",L),s.addEventListener("selectend",L),s.addEventListener("squeeze",L),s.addEventListener("squeezestart",L),s.addEventListener("squeezeend",L),s.addEventListener("end",D),s.addEventListener("inputsourceschange",P),!0!==y.xrCompatible&&await e.makeXRCompatible(),_=t.getPixelRatio(),t.getSize(w),"undefined"!=typeof XRWebGLBinding&&"createProjectionLayer"in XRWebGLBinding.prototype){let a=null,l=null,c=null;y.depth&&(c=y.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,a=y.stencil?Cn:bn,l=y.stencil?fn:hn),r.isMultiview=i&&n.has("OCULUS_multiview");const h={colorFormat:e.RGBA8,depthFormat:c,scaleFactor:o};r.isMultiview&&(h.textureType="texture-array"),A=new XRWebGLBinding(s,e),f=A.createProjectionLayer(h),s.updateRenderState({layers:[f]}),t.setPixelRatio(1),t.setSize(f.textureWidth,f.textureHeight,!1);const u={format:yn,type:sn,depthTexture:new Rc(f.textureWidth,f.textureHeight,l,void 0,void 0,void 0,void 0,void 0,void 0,a),stencilBuffer:y.stencil,colorSpace:t.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:!1===f.ignoreDepthValues};if(r.isMultiview){const t=n.get("OCULUS_multiview");this.maxNumViews=e.getParameter(t.MAX_VIEWS_OVR),x=new Bm(f.textureWidth,f.textureHeight,2,u)}else x=new ts(f.textureWidth,f.textureHeight,u)}else{const n={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:o};m=new XRWebGLLayer(s,e,n),s.updateRenderState({baseLayer:m}),t.setPixelRatio(1),t.setSize(m.framebufferWidth,m.framebufferHeight,!1),x=new ts(m.framebufferWidth,m.framebufferHeight,{format:yn,type:sn,colorSpace:t.outputColorSpace,stencilBuffer:y.stencil})}x.isXRRenderTarget=!0,this.setFoveation(h),u=null,l=await s.requestReferenceSpace(c),N.setContext(s),N.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==s)return s.environmentBlendMode},this.addLayer=function(t){window.XRWebGLBinding&&this.layersEnabled&&s&&(p.push(t),this.updateLayers())},this.removeLayer=function(t){p.splice(p.indexOf(t),1),window.XRWebGLBinding&&this.layersEnabled&&s&&this.updateLayers()},this.updateLayers=function(){var t=p.map((function(t){return t}));t.unshift(s.renderState.layers[0]),s.updateRenderState({layers:t})},this.getDepthTexture=function(){return v.getDepthTexture()};const U=new os,O=new os;function F(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.setPoseTarget=function(t){void 0!==t&&(a=t)},this.updateCamera=function(t){if(null===s)return;let e=t.near,n=t.far;null!==v.texture&&(v.depthNear>0&&(e=v.depthNear),v.depthFar>0&&(n=v.depthFar)),B.near=S.near=M.near=e,B.far=S.far=M.far=n,T===B.near&&R===B.far||(s.updateRenderState({depthNear:B.near,depthFar:B.far}),T=B.near,R=B.far),M.layers.mask=2|t.layers.mask,S.layers.mask=4|t.layers.mask,B.layers.mask=M.layers.mask|S.layers.mask;const i=B.cameras;var r=a||t;const o=r.parent;F(B,o);for(let t=0;t<i.length;t++)F(i[t],o);2===i.length?function(t,e,n){U.setFromMatrixPosition(e.matrixWorld),O.setFromMatrixPosition(n.matrixWorld);const i=U.distanceTo(O),r=e.projectionMatrix.elements,s=n.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(s[8]+1)/s[0],d=o*h,p=o*u,A=i/(-h+u),f=A*-h;if(e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(f),t.translateZ(A),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert(),-1===r[10])t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{const e=o+A,n=a+A,r=d-f,s=p+(i-f),h=l*a/n*e,u=c*a/n*e;t.projectionMatrix.makePerspective(r,s,h,u,e,n),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}}(B,M,S):B.projectionMatrix.copy(M.projectionMatrix),function(t,e,n){e.matrixWorld.decompose(e.position,e.quaternion,e.scale),null===n.parent?n.matrix.copy(e.matrixWorld):(n.matrix.copy(n.parent.matrixWorld),n.matrix.invert(),n.matrix.multiply(e.matrixWorld)),n.matrix.decompose(n.position,n.quaternion,n.scale),n.updateMatrixWorld(!0),t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*xr*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,B,r)},this.getCamera=function(){return B},this.getFoveation=function(){if(null!==f||null!==m)return h},this.setFoveation=function(t){h=t,null!==f&&(f.fixedFoveation=t),null!==m&&void 0!==m.fixedFoveation&&(m.fixedFoveation=t)},this.hasDepthSensing=function(){return null!==v.texture},this.getDepthSensingMesh=function(){return v.getMesh(B)};let k=null;const N=new eA;N.setAnimationLoop((function(e,n){if(d=n.getViewerPose(u||l),g=n,null!==d){const e=d.views;null!==m&&(t.setRenderTargetFramebuffer(x,m.framebuffer),t.setRenderTarget(x));let n=!1;e.length!==B.cameras.length&&(B.cameras.length=0,n=!0);for(let i=0;i<e.length;i++){const r=e[i];let s=null;if(null!==m)s=m.getViewport(r);else{const e=A.getViewSubImage(f,r);s=e.viewport,0===i&&(t.setRenderTargetTextures(x,e.colorTexture,f.ignoreDepthValues?void 0:e.depthStencilTexture),t.setRenderTarget(x))}let o=I[i];void 0===o&&(o=new Ba,o.layers.enable(i),o.viewport=new Zr,I[i]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(s.x,s.y,s.width,s.height),0===i&&(B.matrix.copy(o.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),!0===n&&B.cameras.push(o)}const i=s.enabledFeatures;if(i&&i.includes("depth-sensing")&&"gpu-optimized"==s.depthUsage&&A){const n=A.getDepthInformation(e[0]);n&&n.isValid&&n.texture&&v.init(t,n,s.renderState)}}for(let t=0;t<b.length;t++){const e=C[t],i=b[t];null!==e&&void 0!==i&&i.update(e,n,u||l)}k&&k(e,n),n.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:n}),g=null})),this.setAnimationLoop=function(t){k=t},this.dispose=function(){}}}const Lm=new Ws,Dm=new Os;function Pm(t,e){function n(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function i(t,i){t.opacity.value=i.opacity,i.color&&t.diffuse.value.copy(i.color),i.emissive&&t.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(t.map.value=i.map,n(i.map,t.mapTransform)),i.alphaMap&&(t.alphaMap.value=i.alphaMap,n(i.alphaMap,t.alphaMapTransform)),i.bumpMap&&(t.bumpMap.value=i.bumpMap,n(i.bumpMap,t.bumpMapTransform),t.bumpScale.value=i.bumpScale,i.side===Vt&&(t.bumpScale.value*=-1)),i.normalMap&&(t.normalMap.value=i.normalMap,n(i.normalMap,t.normalMapTransform),t.normalScale.value.copy(i.normalScale),i.side===Vt&&t.normalScale.value.negate()),i.displacementMap&&(t.displacementMap.value=i.displacementMap,n(i.displacementMap,t.displacementMapTransform),t.displacementScale.value=i.displacementScale,t.displacementBias.value=i.displacementBias),i.emissiveMap&&(t.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,t.emissiveMapTransform)),i.specularMap&&(t.specularMap.value=i.specularMap,n(i.specularMap,t.specularMapTransform)),i.alphaTest>0&&(t.alphaTest.value=i.alphaTest);const r=e.get(i),s=r.envMap,o=r.envMapRotation;s&&(t.envMap.value=s,Lm.copy(o),Lm.x*=-1,Lm.y*=-1,Lm.z*=-1,s.isCubeTexture&&!1===s.isRenderTargetTexture&&(Lm.y*=-1,Lm.z*=-1),t.envMapRotation.value.setFromMatrix4(Dm.makeRotationFromEuler(Lm)),t.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,t.reflectivity.value=i.reflectivity,t.ior.value=i.ior,t.refractionRatio.value=i.refractionRatio),i.lightMap&&(t.lightMap.value=i.lightMap,t.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,t.lightMapTransform)),i.aoMap&&(t.aoMap.value=i.aoMap,t.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,t.aoMapTransform))}return{refreshFogUniforms:function(e,n){n.color.getRGB(e.fogColor.value,ba(t)),n.isFog?(e.fogNear.value=n.near,e.fogFar.value=n.far):n.isFogExp2&&(e.fogDensity.value=n.density)},refreshMaterialUniforms:function(t,r,s,o,a){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(t,r):r.isMeshToonMaterial?(i(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(i(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(i(t,r),function(t,e){t.metalness.value=e.metalness,e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap,n(e.metalnessMap,t.metalnessMapTransform)),t.roughness.value=e.roughness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap,n(e.roughnessMap,t.roughnessMapTransform)),e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,n(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,n(e.sheenRoughnessMap,t.sheenRoughnessMapTransform))),e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,n(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,n(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,n(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),e.side===Vt&&t.clearcoatNormalScale.value.negate())),e.dispersion>0&&(t.dispersion.value=e.dispersion),e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,n(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,n(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform))),e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,n(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,n(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor)),e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,n(e.anisotropyMap,t.anisotropyMapTransform))),t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,n(e.specularColorMap,t.specularColorMapTransform)),e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,n(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r,a)):r.isMeshMatcapMaterial?(i(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?i(t,r):r.isMeshDistanceMaterial?(i(t,r),function(t,n){const i=e.get(n).light;t.referencePosition.value.setFromMatrixPosition(i.matrixWorld),t.nearDistance.value=i.shadow.camera.near,t.farDistance.value=i.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?i(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,i,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*r,e.map&&(t.map.value=e.map,n(e.map,t.uvTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,s,o):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform)),e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform)),e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Um(t,e,n,i){let r={},s={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(t,e,n,i){const r=t.value,s=e+"_"+n;if(void 0===i[s])return i[s]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const t=i[s];if("number"==typeof r||"boolean"==typeof r){if(t!==r)return i[s]=r,!0}else if(!1===t.equals(r))return t.copy(r),!0}return!1}function c(t){const e={boundary:0,storage:0};return"number"==typeof t||"boolean"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),e}function h(e){const n=e.target;n.removeEventListener("dispose",h);const i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),t.deleteBuffer(r[n.id]),delete r[n.id],delete s[n.id]}return{bind:function(t,e){const n=e.program;i.uniformBlockBinding(t,n)},update:function(n,u){let d=r[n.id];void 0===d&&(function(t){const e=t.uniforms;let n=0;for(let t=0,i=e.length;t<i;t++){const i=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0,e=i.length;t<e;t++){const e=i[t],r=Array.isArray(e.value)?e.value:[e.value];for(let t=0,i=r.length;t<i;t++){const i=c(r[t]),s=n%16,o=s%i.boundary,a=s+o;n+=o,0!==a&&16-a<i.storage&&(n+=16-a),e.__data=new Float32Array(i.storage/Float32Array.BYTES_PER_ELEMENT),e.__offset=n,n+=i.storage}}}const i=n%16;i>0&&(n+=16-i),t.__size=n,t.__cache={}}(n),d=function(e){const n=function(){for(let t=0;t<a;t++)if(-1===o.indexOf(t))return o.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=n;const i=t.createBuffer(),r=e.__size,s=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,i),t.bufferData(t.UNIFORM_BUFFER,r,s),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=d,n.addEventListener("dispose",h));const p=u.program;i.updateUBOMapping(n,p);const A=e.render.frame;s[n.id]!==A&&(function(e){const n=r[e.id],i=e.uniforms,s=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,n);for(let e=0,n=i.length;e<n;e++){const n=Array.isArray(i[e])?i[e]:[i[e]];for(let i=0,r=n.length;i<r;i++){const r=n[i];if(!0===l(r,e,i,s)){const e=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let s=0;s<n.length;s++){const o=n[s],a=c(o);"number"==typeof o||"boolean"==typeof o?(r.__data[0]=o,t.bufferSubData(t.UNIFORM_BUFFER,e+i,r.__data)):o.isMatrix3?(r.__data[0]=o.elements[0],r.__data[1]=o.elements[1],r.__data[2]=o.elements[2],r.__data[3]=0,r.__data[4]=o.elements[3],r.__data[5]=o.elements[4],r.__data[6]=o.elements[5],r.__data[7]=0,r.__data[8]=o.elements[6],r.__data[9]=o.elements[7],r.__data[10]=o.elements[8],r.__data[11]=0):(o.toArray(r.__data,i),i+=a.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,e,r.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(n),s[n.id]=A)},dispose:function(){for(const e in r)t.deleteBuffer(r[e]);o=[],r={},s={}}}}class Om{constructor(t={}){const{canvas:e=Or(),context:n=null,depth:i=!0,stencil:r=!1,alpha:s=!1,antialias:o=!1,premultipliedAlpha:a=!0,preserveDrawingBuffer:l=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:h=!1,reverseDepthBuffer:u=!1,multiviewStereo:d=!1}=t;let p;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=s;const A=new Uint32Array(4),f=new Int32Array(4);let m=null,g=null;const v=[],y=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Bi,this.toneMapping=Be,this.toneMappingExposure=1;const E=this;let x=!1,b=0,C=0,w=null,_=-1,M=null;const S=new Zr,I=new Zr;let B=null;const T=new Bo(0);let R=0,L=e.width,D=e.height,P=1,U=null,O=null;const F=new Zr(0,0,L,D),k=new Zr(0,0,L,D);let N=!1;const Q=new kl;let G=!1,z=!1;this.transmissionResolutionScale=1;const H=new Os,V=new Os,j=new os,W=new Zr,q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let X=!1;function Y(){return null===w?P:1}let J,K,Z,$,tt,et,nt,it,rt,st,ot,at,lt,ct,ht,ut,dt,pt,At,ft,mt,gt,vt,yt,Et,xt=n;function bt(t,n){return e.getContext(t,n)}try{const t={alpha:!0,depth:i,stencil:r,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Lt}`),e.addEventListener("webglcontextlost",_t,!1),e.addEventListener("webglcontextrestored",Mt,!1),e.addEventListener("webglcontextcreationerror",St,!1),null===xt){const e="webgl2";if(xt=bt(e,t),null===xt)throw bt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function Ct(){J=new RA(xt),J.init(),vt=new Im(xt,J),K=new dA(xt,J,t,vt),Z=new Mm(xt,J),K.reverseDepthBuffer&&u&&Z.buffers.depth.setReversed(!0),$=new PA(xt),tt=new pm,et=new Sm(xt,J,Z,tt,K,vt,$),nt=new AA(E),it=new TA(E),rt=new nA(xt),yt=new hA(xt,rt),st=new LA(xt,rt,$,yt),ot=new FA(xt,st,rt,$),ft=new UA(xt,K,et),ut=new pA(tt),at=new dm(E,nt,it,J,K,yt,ut),lt=new Pm(E,tt),ct=new gm,ht=new Cm(J),At=new cA(E,nt,it,Z,ot,p,a),pt=new OA(E,J,xt),dt=new wm(E,ot,K),Et=new Um(xt,$,K,Z),mt=new uA(xt,J,$),gt=new DA(xt,J,$),$.programs=at.programs,E.capabilities=K,E.extensions=J,E.properties=tt,E.renderLists=ct,E.shadowMap=dt,E.state=Z,E.info=$}Ct();const wt=new Rm(E,xt);function _t(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),x=!0}function Mt(){console.log("THREE.WebGLRenderer: Context Restored."),x=!1;const t=$.autoReset,e=dt.enabled,n=dt.autoUpdate,i=dt.needsUpdate,r=dt.type;Ct(),$.autoReset=t,dt.enabled=e,dt.autoUpdate=n,dt.needsUpdate=i,dt.type=r}function St(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function It(t){const e=t.target;e.removeEventListener("dispose",It),function(t){(function(t){const e=tt.get(t).programs;void 0!==e&&(e.forEach((function(t){at.releaseProgram(t)})),t.isShaderMaterial&&at.releaseShaderCache(t))})(t),tt.remove(t)}(e)}function Bt(t,e,n){!0===t.transparent&&t.side===jt&&!1===t.forceSinglePass?(t.side=Vt,t.needsUpdate=!0,Qt(t,e,n),t.side=Ht,t.needsUpdate=!0,Qt(t,e,n),t.side=jt):Qt(t,e,n)}this.xr=wt,this.getContext=function(){return xt},this.getContextAttributes=function(){return xt.getContextAttributes()},this.forceContextLoss=function(){const t=J.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=J.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(t){void 0!==t&&(P=t,this.setSize(L,D,!1))},this.getSize=function(t){return t.set(L,D)},this.setSize=function(t,n,i=!0){wt.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(L=t,D=n,e.width=Math.floor(t*P),e.height=Math.floor(n*P),!0===i&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(L*P,D*P).floor()},this.setDrawingBufferSize=function(t,n,i){L=t,D=n,P=i,e.width=Math.floor(t*i),e.height=Math.floor(n*i),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(S)},this.getViewport=function(t){return t.copy(F)},this.setViewport=function(t,e,n,i){t.isVector4?F.set(t.x,t.y,t.z,t.w):F.set(t,e,n,i),Z.viewport(S.copy(F).multiplyScalar(P).round())},this.getScissor=function(t){return t.copy(k)},this.setScissor=function(t,e,n,i){t.isVector4?k.set(t.x,t.y,t.z,t.w):k.set(t,e,n,i),Z.scissor(I.copy(k).multiplyScalar(P).round())},this.getScissorTest=function(){return N},this.setScissorTest=function(t){Z.setScissorTest(N=t)},this.setOpaqueSort=function(t){U=t},this.setTransparentSort=function(t){O=t},this.getClearColor=function(t){return t.copy(At.getClearColor())},this.setClearColor=function(){At.setClearColor.apply(At,arguments)},this.getClearAlpha=function(){return At.getClearAlpha()},this.setClearAlpha=function(){At.setClearAlpha.apply(At,arguments)},this.clear=function(t=!0,e=!0,n=!0){let i=0;if(t){let t=!1;if(null!==w){const e=w.texture.format;t=e===Bn||e===Sn||e===_n}if(t){const t=w.texture.type,e=t===sn||t===hn||t===ln||t===fn||t===pn||t===An,n=At.getClearColor(),i=At.getClearAlpha(),r=n.r,s=n.g,o=n.b;e?(A[0]=r,A[1]=s,A[2]=o,A[3]=i,xt.clearBufferuiv(xt.COLOR,0,A)):(f[0]=r,f[1]=s,f[2]=o,f[3]=i,xt.clearBufferiv(xt.COLOR,0,f))}else i|=xt.COLOR_BUFFER_BIT}e&&(i|=xt.DEPTH_BUFFER_BIT),n&&(i|=xt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),xt.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",_t,!1),e.removeEventListener("webglcontextrestored",Mt,!1),e.removeEventListener("webglcontextcreationerror",St,!1),At.dispose(),ct.dispose(),ht.dispose(),tt.dispose(),nt.dispose(),it.dispose(),ot.dispose(),yt.dispose(),Et.dispose(),at.dispose(),wt.dispose(),wt.removeEventListener("sessionstart",Rt),wt.removeEventListener("sessionend",Dt),Pt.stop()},this.renderBufferDirect=function(t,e,n,i,r,s){null===e&&(e=q);const o=r.isMesh&&r.matrixWorld.determinant()<0,a=function(t,e,n,i,r){!0!==e.isScene&&(e=q),et.resetTextureUnits();const s=e.fog,o=i.isMeshStandardMaterial?e.environment:null,a=null===w?E.outputColorSpace:!0===w.isXRRenderTarget?w.texture.colorSpace:Ti,l=(i.isMeshStandardMaterial?it:nt).get(i.envMap||o),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),u=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let A=Be;i.toneMapped&&(null!==w&&!0!==w.isXRRenderTarget||(A=E.toneMapping));const f=w&&w.isWebGLMultiviewRenderTarget?w.numViews:0,m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==m?m.length:0,y=tt.get(i),x=g.state.lights;if(!0===G&&(!0===z||t!==M)){const e=t===M&&i.id===_;ut.setState(i,t,e)}let b=!1;i.version===y.__version?y.needsLights&&y.lightsStateVersion!==x.state.version||y.outputColorSpace!==a||r.isBatchedMesh&&!1===y.batching?b=!0:r.isBatchedMesh||!0!==y.batching?r.isBatchedMesh&&!0===y.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===y.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===y.instancing?b=!0:r.isInstancedMesh||!0!==y.instancing?r.isSkinnedMesh&&!1===y.skinning?b=!0:r.isSkinnedMesh||!0!==y.skinning?r.isInstancedMesh&&!0===y.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===y.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===y.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===y.instancingMorph&&null!==r.morphTexture||y.envMap!==l||!0===i.fog&&y.fog!==s?b=!0:void 0===y.numClippingPlanes||y.numClippingPlanes===ut.numPlanes&&y.numIntersection===ut.numIntersection?(y.vertexAlphas!==c||y.vertexTangents!==h||y.morphTargets!==u||y.morphNormals!==d||y.morphColors!==p||y.toneMapping!==A||y.morphTargetsCount!==v||y.numMultiviewViews!==f)&&(b=!0):b=!0:b=!0:b=!0:b=!0:(b=!0,y.__version=i.version);let C=y.currentProgram;!0===b&&(C=Qt(i,e,r));let S=!1,I=!1,B=!1;const T=C.getUniforms(),R=y.uniforms;if(Z.useProgram(C.program)&&(S=!0,I=!0,B=!0),i.id!==_&&(_=i.id,I=!0),S||M!==t){C.numMultiviewViews>0?(pt.updateCameraProjectionMatricesUniform(t,T),pt.updateCameraViewMatricesUniform(t,T)):(Z.buffers.depth.getReversed()?(H.copy(t.projectionMatrix),function(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}(H),function(t){const e=t.elements;-1===e[11]?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=1-e[14])}(H),T.setValue(xt,"projectionMatrix",H)):T.setValue(xt,"projectionMatrix",t.projectionMatrix),T.setValue(xt,"viewMatrix",t.matrixWorldInverse));const e=T.map.cameraPosition;void 0!==e&&e.setValue(xt,j.setFromMatrixPosition(t.matrixWorld)),K.logarithmicDepthBuffer&&T.setValue(xt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&T.setValue(xt,"isOrthographic",!0===t.isOrthographicCamera),M!==t&&(M=t,I=!0,B=!0)}if(r.isSkinnedMesh){T.setOptional(xt,r,"bindMatrix"),T.setOptional(xt,r,"bindMatrixInverse");const t=r.skeleton;t&&(null===t.boneTexture&&t.computeBoneTexture(),T.setValue(xt,"boneTexture",t.boneTexture,et))}r.isBatchedMesh&&(T.setOptional(xt,r,"batchingTexture"),T.setValue(xt,"batchingTexture",r._matricesTexture,et),T.setOptional(xt,r,"batchingIdTexture"),T.setValue(xt,"batchingIdTexture",r._indirectTexture,et),T.setOptional(xt,r,"batchingColorTexture"),null!==r._colorsTexture&&T.setValue(xt,"batchingColorTexture",r._colorsTexture,et));const L=n.morphAttributes;var U,O;if(void 0===L.position&&void 0===L.normal&&void 0===L.color||ft.update(r,n,C),(I||y.receiveShadow!==r.receiveShadow)&&(y.receiveShadow=r.receiveShadow,T.setValue(xt,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(R.envMap.value=l,R.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==e.environment&&(R.envMapIntensity.value=e.environmentIntensity),I&&(T.setValue(xt,"toneMappingExposure",E.toneMappingExposure),y.needsLights&&(O=B,(U=R).ambientLightColor.needsUpdate=O,U.lightProbe.needsUpdate=O,U.directionalLights.needsUpdate=O,U.directionalLightShadows.needsUpdate=O,U.pointLights.needsUpdate=O,U.pointLightShadows.needsUpdate=O,U.spotLights.needsUpdate=O,U.spotLightShadows.needsUpdate=O,U.rectAreaLights.needsUpdate=O,U.hemisphereLights.needsUpdate=O),s&&!0===i.fog&<.refreshFogUniforms(R,s),lt.refreshMaterialUniforms(R,i,P,D,g.state.transmissionRenderTarget[t.id]),Hf.upload(xt,Gt(y),R,et)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(Hf.upload(xt,Gt(y),R,et),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&T.setValue(xt,"center",r.center),C.numMultiviewViews>0?pt.updateObjectMatricesUniforms(r,t,T):(T.setValue(xt,"modelViewMatrix",r.modelViewMatrix),T.setValue(xt,"normalMatrix",r.normalMatrix)),T.setValue(xt,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const t=i.uniformsGroups;for(let e=0,n=t.length;e<n;e++){const n=t[e];Et.update(n,C),Et.bind(n,C)}}return C}(t,e,n,i,r);Z.setMaterial(i,o);let l=n.index,c=1;if(!0===i.wireframe){if(l=st.getWireframeAttribute(n),void 0===l)return;c=2}const h=n.drawRange,u=n.attributes.position;let d=h.start*c,p=(h.start+h.count)*c;null!==s&&(d=Math.max(d,s.start*c),p=Math.min(p,(s.start+s.count)*c)),null!==l?(d=Math.max(d,0),p=Math.min(p,l.count)):null!=u&&(d=Math.max(d,0),p=Math.min(p,u.count));const A=p-d;if(A<0||A===1/0)return;let f;yt.setup(r,i,a,n,l);let m=mt;if(null!==l&&(f=rt.get(l),m=gt,m.setIndex(f)),r.isMesh)!0===i.wireframe?(Z.setLineWidth(i.wireframeLinewidth*Y()),m.setMode(xt.LINES)):m.setMode(xt.TRIANGLES);else if(r.isLine){let t=i.linewidth;void 0===t&&(t=1),Z.setLineWidth(t*Y()),r.isLineSegments?m.setMode(xt.LINES):r.isLineLoop?m.setMode(xt.LINE_LOOP):m.setMode(xt.LINE_STRIP)}else r.isPoints?m.setMode(xt.POINTS):r.isSprite&&m.setMode(xt.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)m.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(J.get("WEBGL_multi_draw"))m.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const t=r._multiDrawStarts,e=r._multiDrawCounts,n=r._multiDrawCount,s=l?rt.get(l).bytesPerElement:1,o=tt.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)o.setValue(xt,"_gl_DrawID",i),m.render(t[i]/s,e[i])}else if(r.isInstancedMesh)m.renderInstances(d,A,r.count);else if(n.isInstancedBufferGeometry){const t=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,e=Math.min(n.instanceCount,t);m.renderInstances(d,A,e)}else m.render(d,A)},this.compile=function(t,e,n=null){null===n&&(n=t),g=ht.get(n),g.init(e),y.push(g),n.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(g.pushLight(t),t.castShadow&&g.pushShadow(t))})),t!==n&&t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(g.pushLight(t),t.castShadow&&g.pushShadow(t))})),g.setupLights();const i=new Set;return t.traverse((function(t){if(!(t.isMesh||t.isPoints||t.isLine||t.isSprite))return;const e=t.material;if(e)if(Array.isArray(e))for(let r=0;r<e.length;r++){const s=e[r];Bt(s,n,t),i.add(s)}else Bt(e,n,t),i.add(e)})),y.pop(),g=null,i},this.compileAsync=function(t,e,n=null){const i=this.compile(t,e,n);return new Promise((e=>{function n(){i.forEach((function(t){tt.get(t).currentProgram.isReady()&&i.delete(t)})),0!==i.size?setTimeout(n,10):e(t)}null!==J.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};let Tt=null;function Rt(){Pt.stop()}function Dt(){Pt.start()}const Pt=new eA;function Ut(t,e,n,i){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)g.pushLight(t),t.castShadow&&g.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||Q.intersectsSprite(t)){i&&W.setFromMatrixPosition(t.matrixWorld).applyMatrix4(V);const e=ot.update(t),r=t.material;r.visible&&m.push(t,e,r,n,W.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||Q.intersectsObject(t))){const e=ot.update(t),r=t.material;if(i&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),W.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),W.copy(e.boundingSphere.center)),W.applyMatrix4(t.matrixWorld).applyMatrix4(V)),Array.isArray(r)){const i=e.groups;for(let s=0,o=i.length;s<o;s++){const o=i[s],a=r[o.materialIndex];a&&a.visible&&m.push(t,e,a,n,W.z,o)}}else r.visible&&m.push(t,e,r,n,W.z,null)}const r=t.children;for(let t=0,s=r.length;t<s;t++)Ut(r[t],e,n,i)}function Ot(t,e,n,i){const r=t.opaque,s=t.transmissive,o=t.transparent;g.setupLightsView(n),!0===G&&ut.setGlobalState(E.clippingPlanes,n),i&&Z.viewport(S.copy(i)),r.length>0&&kt(r,e,n),s.length>0&&kt(s,e,n),o.length>0&&kt(o,e,n),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Ft(t,e,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===g.state.transmissionRenderTarget[i.id]&&(g.state.transmissionRenderTarget[i.id]=new ts(1,1,{generateMipmaps:!0,type:J.has("EXT_color_buffer_half_float")||J.has("EXT_color_buffer_float")?dn:sn,minFilter:nn,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:zr.workingColorSpace}));const s=g.state.transmissionRenderTarget[i.id],o=i.viewport||S;s.setSize(o.z*E.transmissionResolutionScale,o.w*E.transmissionResolutionScale);const a=E.getRenderTarget();E.setRenderTarget(s),E.getClearColor(T),R=E.getClearAlpha(),R<1&&E.setClearColor(16777215,.5),E.clear(),X&&At.render(n);const l=E.toneMapping;E.toneMapping=Be;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),g.setupLightsView(i),!0===G&&ut.setGlobalState(E.clippingPlanes,i),kt(t,n,i),et.updateMultisampleRenderTarget(s),et.updateRenderTargetMipmap(s),!1===J.has("WEBGL_multisampled_render_to_texture")){let t=!1;for(let r=0,s=e.length;r<s;r++){const s=e[r],o=s.object,a=s.geometry,l=s.material,c=s.group;if(l.side===jt&&o.layers.test(i.layers)){const e=l.side;l.side=Vt,l.needsUpdate=!0,Nt(o,n,i,a,l,c),l.side=e,l.needsUpdate=!0,t=!0}}!0===t&&(et.updateMultisampleRenderTarget(s),et.updateRenderTargetMipmap(s))}E.setRenderTarget(a),E.setClearColor(T,R),void 0!==c&&(i.viewport=c),E.toneMapping=l}function kt(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r<s;r++){const s=t[r],o=s.object,a=s.geometry,l=null===i?s.material:i,c=s.group;o.layers.test(n.layers)&&Nt(o,e,n,a,l,c)}}function Nt(t,e,n,i,r,s){t.onBeforeRender(E,e,n,i,r,s),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(E,e,n,i,t,s),!0===r.transparent&&r.side===jt&&!1===r.forceSinglePass?(r.side=Vt,r.needsUpdate=!0,E.renderBufferDirect(n,e,i,r,t,s),r.side=Ht,r.needsUpdate=!0,E.renderBufferDirect(n,e,i,r,t,s),r.side=jt):E.renderBufferDirect(n,e,i,r,t,s),t.onAfterRender(E,e,n,i,r,s)}function Qt(t,e,n){!0!==e.isScene&&(e=q);const i=tt.get(t),r=g.state.lights,s=g.state.shadowsArray,o=r.state.version,a=at.getParameters(t,r.state,s,e,n),l=at.getProgramCacheKey(a);let c=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=(t.isMeshStandardMaterial?it:nt).get(t.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===t.envMap?e.environmentRotation:t.envMapRotation,void 0===c&&(t.addEventListener("dispose",It),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===o)return zt(t,a),h}else a.uniforms=at.getUniforms(t),t.onBeforeCompile(a,E),h=at.acquireProgram(a,l),c.set(l,h),i.uniforms=a.uniforms;const u=i.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(u.clippingPlanes=ut.uniform),zt(t,a),i.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),i.lightsStateVersion=o,i.needsLights&&(u.ambientLightColor.value=r.state.ambient,u.lightProbe.value=r.state.probe,u.directionalLights.value=r.state.directional,u.directionalLightShadows.value=r.state.directionalShadow,u.spotLights.value=r.state.spot,u.spotLightShadows.value=r.state.spotShadow,u.rectAreaLights.value=r.state.rectArea,u.ltc_1.value=r.state.rectAreaLTC1,u.ltc_2.value=r.state.rectAreaLTC2,u.pointLights.value=r.state.point,u.pointLightShadows.value=r.state.pointShadow,u.hemisphereLights.value=r.state.hemi,u.directionalShadowMap.value=r.state.directionalShadowMap,u.directionalShadowMatrix.value=r.state.directionalShadowMatrix,u.spotShadowMap.value=r.state.spotShadowMap,u.spotLightMatrix.value=r.state.spotLightMatrix,u.spotLightMap.value=r.state.spotLightMap,u.pointShadowMap.value=r.state.pointShadowMap,u.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=h,i.uniformsList=null,h}function Gt(t){if(null===t.uniformsList){const e=t.currentProgram.getUniforms();t.uniformsList=Hf.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function zt(t,e){const n=tt.get(t);n.outputColorSpace=e.outputColorSpace,n.batching=e.batching,n.batchingColor=e.batchingColor,n.instancing=e.instancing,n.instancingColor=e.instancingColor,n.instancingMorph=e.instancingMorph,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphColors=e.morphColors,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents,n.toneMapping=e.toneMapping,n.numMultiviewViews=e.numMultiviewViews}var Wt;Pt.setAnimationLoop((function(t){Tt&&Tt(t)})),"undefined"!=typeof self&&Pt.setContext(self),this.setAnimationLoop=function(t){Tt=t,wt.setAnimationLoop(t),null===t?Pt.stop():Pt.start()},wt.addEventListener("sessionstart",Rt),wt.addEventListener("sessionend",Dt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===x)return;if(!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===wt.enabled&&!0===wt.isPresenting&&(!0===wt.cameraAutoUpdate&&wt.updateCamera(e),e=wt.getCamera()),!0===t.isScene&&t.onBeforeRender(E,t,e,w),g=ht.get(t,y.length),g.init(e),y.push(g),V.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),Q.setFromProjectionMatrix(V),z=this.localClippingEnabled,G=ut.init(this.clippingPlanes,z),m=ct.get(t,v.length),m.init(),v.push(m),!0===wt.enabled&&!0===wt.isPresenting){const t=E.xr.getDepthSensingMesh();null!==t&&Ut(t,e,-1/0,E.sortObjects)}Ut(t,e,0,E.sortObjects),m.finish(),!0===E.sortObjects&&m.sort(U,O),X=!1===wt.enabled||!1===wt.isPresenting||!1===wt.hasDepthSensing(),X&&At.addToRenderList(m,t),this.info.render.frame++,!0===G&&ut.beginShadows();const n=g.state.shadowsArray;dt.render(n,t,e),!0===G&&ut.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=m.opaque,r=m.transmissive;if(g.setupLights(),e.isArrayCamera){const n=e.cameras;if(r.length>0)for(let e=0,s=n.length;e<s;e++)Ft(i,r,t,n[e]);if(X&&At.render(t),wt.enabled&&wt.isMultiview)et.setDeferTextureUploads(!0),Ot(m,t,e,e.cameras[0].viewport);else for(let e=0,i=n.length;e<i;e++){const i=n[e];Ot(m,t,i,i.viewport)}}else r.length>0&&Ft(i,r,t,e),X&&At.render(t),Ot(m,t,e);null!==w&&0===C&&(et.updateMultisampleRenderTarget(w),et.updateRenderTargetMipmap(w)),!0===t.isScene&&t.onAfterRender(E,t,e),yt.resetDefaultState(),_=-1,M=null,y.pop(),y.length>0?(g=y[y.length-1],!0===G&&ut.setGlobalState(E.clippingPlanes,g.state.camera)):g=null,v.pop(),m=v.length>0?v[v.length-1]:null},this.setTexture2D=(Wt=!1,function(t,e){t&&t.isWebGLRenderTarget&&(Wt||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),Wt=!0),t=t.texture),et.setTexture2D(t,e)}),this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return C},this.getRenderTarget=function(){return w},this.setRenderTargetTextures=function(t,e,n){tt.get(t.texture).__webglTexture=e,tt.get(t.depthTexture).__webglTexture=n;const i=tt.get(t);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||w&&w.isWebGLMultiviewRenderTarget||!0===J.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(t,e){const n=tt.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e};const qt=xt.createFramebuffer();this.setRenderTarget=function(t,e=0,n=0){null===t&&this.xr.isPresenting&&(t=this.xr.getRenderTarget()),w=t,b=e,C=n;let i=!0,r=null,s=!1,o=!1;if(t){const a=tt.get(t);if(void 0!==a.__useDefaultFramebuffer)Z.bindFramebuffer(xt.FRAMEBUFFER,null),i=!1;else if(void 0===a.__webglFramebuffer)et.setupRenderTarget(t);else if(a.__hasExternalTextures)et.rebindTextures(t,tt.get(t.texture).__webglTexture,tt.get(t.depthTexture).__webglTexture);else if(t.depthBuffer){const e=t.depthTexture;if(a.__boundDepthTexture!==e){if(null!==e&&tt.has(e)&&(t.width!==e.image.width||t.height!==e.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");et.setupDepthRenderbuffer(t)}}const l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);const c=tt.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=Array.isArray(c[e])?c[e][n]:c[e],s=!0):r=t.samples>0&&!1===et.useMultisampledRTT(t)?tt.get(t).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,S.copy(t.viewport),I.copy(t.scissor),B=t.scissorTest}else S.copy(F).multiplyScalar(P).floor(),I.copy(k).multiplyScalar(P).floor(),B=N;if(0!==n&&(r=qt),Z.bindFramebuffer(xt.FRAMEBUFFER,r)&&i&&Z.drawBuffers(t,r),Z.viewport(S),Z.scissor(I),Z.setScissorTest(B),s){const i=tt.get(t.texture);xt.framebufferTexture2D(xt.FRAMEBUFFER,xt.COLOR_ATTACHMENT0,xt.TEXTURE_CUBE_MAP_POSITIVE_X+e,i.__webglTexture,n)}else if(o){const i=tt.get(t.texture),r=e;xt.framebufferTextureLayer(xt.FRAMEBUFFER,xt.COLOR_ATTACHMENT0,i.__webglTexture,n,r)}else if(null!==t&&0!==n){const e=tt.get(t.texture);xt.framebufferTexture2D(xt.FRAMEBUFFER,xt.COLOR_ATTACHMENT0,xt.TEXTURE_2D,e.__webglTexture,n)}_=-1},this.readRenderTargetPixels=function(t,e,n,i,r,s,o){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=tt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){Z.bindFramebuffer(xt.FRAMEBUFFER,a);try{const o=t.texture,a=o.format,l=o.type;if(!K.textureFormatReadable(a))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!K.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&xt.readPixels(e,n,i,r,vt.convert(a),vt.convert(l),s)}finally{const t=null!==w?tt.get(w).__webglFramebuffer:null;Z.bindFramebuffer(xt.FRAMEBUFFER,t)}}},this.readRenderTargetPixelsAsync=async function(t,e,n,i,r,s,o){if(!t||!t.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=tt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){const o=t.texture,l=o.format,c=o.type;if(!K.textureFormatReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!K.textureTypeReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r){Z.bindFramebuffer(xt.FRAMEBUFFER,a);const t=xt.createBuffer();xt.bindBuffer(xt.PIXEL_PACK_BUFFER,t),xt.bufferData(xt.PIXEL_PACK_BUFFER,s.byteLength,xt.STREAM_READ),xt.readPixels(e,n,i,r,vt.convert(l),vt.convert(c),0);const o=null!==w?tt.get(w).__webglFramebuffer:null;Z.bindFramebuffer(xt.FRAMEBUFFER,o);const h=xt.fenceSync(xt.SYNC_GPU_COMMANDS_COMPLETE,0);return xt.flush(),await function(t,e){return new Promise((function(n,i){setTimeout((function r(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:i();break;case t.TIMEOUT_EXPIRED:setTimeout(r,4);break;default:n()}}),4)}))}(xt,h),xt.bindBuffer(xt.PIXEL_PACK_BUFFER,t),xt.getBufferSubData(xt.PIXEL_PACK_BUFFER,0,s),xt.deleteBuffer(t),xt.deleteSync(h),s}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(t,e=null,n=0){!0!==t.isTexture&&(kr("WebGLRenderer: copyFramebufferToTexture function signature has changed."),e=arguments[0]||null,t=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),s=Math.floor(t.image.height*i),o=null!==e?e.x:0,a=null!==e?e.y:0;et.setTexture2D(t,0),xt.copyTexSubImage2D(xt.TEXTURE_2D,n,0,0,o,a,r,s),Z.unbindTexture()};const Xt=xt.createFramebuffer(),Yt=xt.createFramebuffer();this.copyTextureToTexture=function(t,e,n=null,i=null,r=0,s=null){let o,a,l,c,h,u,d,p,A;!0!==t.isTexture&&(kr("WebGLRenderer: copyTextureToTexture function signature has changed."),i=arguments[0]||null,t=arguments[1],e=arguments[2],s=arguments[3]||0,n=null),null===s&&(0!==r?(kr("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),s=r,r=0):s=0);const f=t.isCompressedTexture?t.mipmaps[s]:t.image;if(null!==n)o=n.max.x-n.min.x,a=n.max.y-n.min.y,l=n.isBox3?n.max.z-n.min.z:1,c=n.min.x,h=n.min.y,u=n.isBox3?n.min.z:0;else{const e=Math.pow(2,-r);o=Math.floor(f.width*e),a=Math.floor(f.height*e),l=t.isDataArrayTexture?f.depth:t.isData3DTexture?Math.floor(f.depth*e):1,c=0,h=0,u=0}null!==i?(d=i.x,p=i.y,A=i.z):(d=0,p=0,A=0);const m=vt.convert(e.format),g=vt.convert(e.type);let v;e.isData3DTexture?(et.setTexture3D(e,0),v=xt.TEXTURE_3D):e.isDataArrayTexture||e.isCompressedArrayTexture?(et.setTexture2DArray(e,0),v=xt.TEXTURE_2D_ARRAY):(et.setTexture2D(e,0),v=xt.TEXTURE_2D),xt.pixelStorei(xt.UNPACK_FLIP_Y_WEBGL,e.flipY),xt.pixelStorei(xt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),xt.pixelStorei(xt.UNPACK_ALIGNMENT,e.unpackAlignment);const y=xt.getParameter(xt.UNPACK_ROW_LENGTH),E=xt.getParameter(xt.UNPACK_IMAGE_HEIGHT),x=xt.getParameter(xt.UNPACK_SKIP_PIXELS),b=xt.getParameter(xt.UNPACK_SKIP_ROWS),C=xt.getParameter(xt.UNPACK_SKIP_IMAGES);xt.pixelStorei(xt.UNPACK_ROW_LENGTH,f.width),xt.pixelStorei(xt.UNPACK_IMAGE_HEIGHT,f.height),xt.pixelStorei(xt.UNPACK_SKIP_PIXELS,c),xt.pixelStorei(xt.UNPACK_SKIP_ROWS,h),xt.pixelStorei(xt.UNPACK_SKIP_IMAGES,u);const w=t.isDataArrayTexture||t.isData3DTexture,_=e.isDataArrayTexture||e.isData3DTexture;if(t.isDepthTexture){const n=tt.get(t),i=tt.get(e),f=tt.get(n.__renderTarget),m=tt.get(i.__renderTarget);Z.bindFramebuffer(xt.READ_FRAMEBUFFER,f.__webglFramebuffer),Z.bindFramebuffer(xt.DRAW_FRAMEBUFFER,m.__webglFramebuffer);for(let n=0;n<l;n++)w&&(xt.framebufferTextureLayer(xt.READ_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,tt.get(t).__webglTexture,r,u+n),xt.framebufferTextureLayer(xt.DRAW_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,tt.get(e).__webglTexture,s,A+n)),xt.blitFramebuffer(c,h,o,a,d,p,o,a,xt.DEPTH_BUFFER_BIT,xt.NEAREST);Z.bindFramebuffer(xt.READ_FRAMEBUFFER,null),Z.bindFramebuffer(xt.DRAW_FRAMEBUFFER,null)}else if(0!==r||t.isRenderTargetTexture||tt.has(t)){const n=tt.get(t),i=tt.get(e);Z.bindFramebuffer(xt.READ_FRAMEBUFFER,Xt),Z.bindFramebuffer(xt.DRAW_FRAMEBUFFER,Yt);for(let t=0;t<l;t++)w?xt.framebufferTextureLayer(xt.READ_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,n.__webglTexture,r,u+t):xt.framebufferTexture2D(xt.READ_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,xt.TEXTURE_2D,n.__webglTexture,r),_?xt.framebufferTextureLayer(xt.DRAW_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,i.__webglTexture,s,A+t):xt.framebufferTexture2D(xt.DRAW_FRAMEBUFFER,xt.COLOR_ATTACHMENT0,xt.TEXTURE_2D,i.__webglTexture,s),0!==r?xt.blitFramebuffer(c,h,o,a,d,p,o,a,xt.COLOR_BUFFER_BIT,xt.NEAREST):_?xt.copyTexSubImage3D(v,s,d,p,A+t,c,h,o,a):xt.copyTexSubImage2D(v,s,d,p,c,h,o,a);Z.bindFramebuffer(xt.READ_FRAMEBUFFER,null),Z.bindFramebuffer(xt.DRAW_FRAMEBUFFER,null)}else _?t.isDataTexture||t.isData3DTexture?xt.texSubImage3D(v,s,d,p,A,o,a,l,m,g,f.data):e.isCompressedArrayTexture?xt.compressedTexSubImage3D(v,s,d,p,A,o,a,l,m,f.data):xt.texSubImage3D(v,s,d,p,A,o,a,l,m,g,f):t.isDataTexture?xt.texSubImage2D(xt.TEXTURE_2D,s,d,p,o,a,m,g,f.data):t.isCompressedTexture?xt.compressedTexSubImage2D(xt.TEXTURE_2D,s,d,p,f.width,f.height,m,f.data):xt.texSubImage2D(xt.TEXTURE_2D,s,d,p,o,a,m,g,f);xt.pixelStorei(xt.UNPACK_ROW_LENGTH,y),xt.pixelStorei(xt.UNPACK_IMAGE_HEIGHT,E),xt.pixelStorei(xt.UNPACK_SKIP_PIXELS,x),xt.pixelStorei(xt.UNPACK_SKIP_ROWS,b),xt.pixelStorei(xt.UNPACK_SKIP_IMAGES,C),0===s&&e.generateMipmaps&&xt.generateMipmap(v),Z.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n=null,i=null,r=0){return!0!==t.isTexture&&(kr("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,i=arguments[1]||null,t=arguments[2],e=arguments[3],r=arguments[4]||0),kr('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(t,e,n,i,r)},this.initRenderTarget=function(t){void 0===tt.get(t).__webglFramebuffer&&et.setupRenderTarget(t)},this.initTexture=function(t){t.isCubeTexture?et.setTextureCube(t,0):t.isData3DTexture?et.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?et.setTexture2DArray(t,0):et.setTexture2D(t,0),Z.unbindTexture()},this.resetState=function(){b=0,C=0,w=null,Z.reset(),yt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ar}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorspace=zr._getDrawingBufferColorSpace(t),e.unpackColorSpace=zr._getUnpackColorSpace()}}const Fm=new WeakMap;function km(){let t,e;function n(t,e,n,i,r,s){const o=s.num_components(),a=n.num_points()*o,l=a*r.BYTES_PER_ELEMENT,c=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32}}(t,r),h=t._malloc(l);e.GetAttributeDataArrayForAllPoints(n,s,c,l,h);const u=new r(t.HEAPF32.buffer,h,a).slice();return t._free(h),{name:i,array:u,itemSize:o}}onmessage=function(i){const r=i.data;switch(r.type){case"init":t=r.decoderConfig,e=new Promise((function(e){t.onModuleLoaded=function(t){e({draco:t})},DracoDecoderModule(t)}));break;case"decode":const i=r.buffer,s=r.taskConfig;e.then((t=>{const e=t.draco,o=new e.Decoder;try{const t=function(t,e,i,r){const s=r.attributeIDs,o=r.attributeTypes;let a,l;const c=e.GetEncodedGeometryType(i);if(c===t.TRIANGULAR_MESH)a=new t.Mesh,l=e.DecodeArrayToMesh(i,i.byteLength,a);else{if(c!==t.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new t.PointCloud,l=e.DecodeArrayToPointCloud(i,i.byteLength,a)}if(!l.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in s){const l=self[o[i]];let c,u;if(r.useUniqueIDs)u=s[i],c=e.GetAttributeByUniqueId(a,u);else{if(u=e.GetAttributeId(a,t[s[i]]),-1===u)continue;c=e.GetAttribute(a,u)}const d=n(t,e,a,i,l,c);"color"===i&&(d.vertexColorSpace=r.vertexColorSpace),h.attributes.push(d)}return c===t.TRIANGULAR_MESH&&(h.index=function(t,e,n){const i=3*n.num_faces(),r=4*i,s=t._malloc(r);e.GetTrianglesUInt32Array(n,r,s);const o=new Uint32Array(t.HEAPF32.buffer,s,i).slice();return t._free(s),{array:o,itemSize:1}}(t,e,a)),t.destroy(a),h}(e,o,new Int8Array(i),s),a=t.attributes.map((t=>t.array.buffer));t.index&&a.push(t.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:t},a)}catch(t){console.error(t),self.postMessage({type:"error",id:r.id,error:t.message})}finally{e.destroy(o)}}))}}}function Nm(t,e,n=!0){if(!e||!e.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!t.hasAttribute("position")||!t.hasAttribute("normal")||!t.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function i(t){if(t.normalized||t.isInterleavedBufferAttribute){const e=new Float32Array(t.count*t.itemSize);for(let n=0,i=0;n<t.count;n++)e[i++]=t.getX(n),e[i++]=t.getY(n),t.itemSize>2&&(e[i++]=t.getZ(n));return e}return t.array instanceof Float32Array?t.array:new Float32Array(t.array)}const r=t.index?t.toNonIndexed():t,s=e.generateTangents(i(r.attributes.position),i(r.attributes.normal),i(r.attributes.uv));if(n)for(let t=3;t<s.length;t+=4)s[t]*=-1;return r.setAttribute("tangent",new zo(s,4)),t!==r&&t.copy(r),t}function Qm(t,e=!1){const n=null!==t[0].index,i=new Set(Object.keys(t[0].attributes)),r=new Set(Object.keys(t[0].morphAttributes)),s={},o={},a=t[0].morphTargetsRelative,l=new sa;let c=0;for(let h=0;h<t.length;++h){const u=t[h];let d=0;if(n!==(null!==u.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const t in u.attributes){if(!i.has(t))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+t+'" attribute exists among all geometries, or in none of them.'),null;void 0===s[t]&&(s[t]=[]),s[t].push(u.attributes[t]),d++}if(d!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const t in u.morphAttributes){if(!r.has(t))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;void 0===o[t]&&(o[t]=[]),o[t].push(u.morphAttributes[t])}if(e){let t;if(n)t=u.index.count;else{if(void 0===u.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;t=u.attributes.position.count}l.addGroup(c,t,h),c+=t}}if(n){let e=0;const n=[];for(let i=0;i<t.length;++i){const r=t[i].index;for(let t=0;t<r.count;++t)n.push(r.getX(t)+e);e+=t[i].attributes.position.count}l.setIndex(n)}for(const t in s){const e=Gm(s[t]);if(!e)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+t+" attribute."),null;l.setAttribute(t,e)}for(const t in o){const e=o[t][0].length;if(0===e)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[t]=[];for(let n=0;n<e;++n){const e=[];for(let i=0;i<o[t].length;++i)e.push(o[t][i][n]);const i=Gm(e);if(!i)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+t+" morphAttribute."),null;l.morphAttributes[t].push(i)}}return l}function Gm(t){let e,n,i,r=-1,s=0;for(let o=0;o<t.length;++o){const a=t[o];if(void 0===e&&(e=a.array.constructor),e!==a.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===n&&(n=a.itemSize),n!==a.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===i&&(i=a.normalized),i!==a.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===r&&(r=a.gpuType),r!==a.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=a.count*n}const o=new e(s),a=new zo(o,n,i);let l=0;for(let e=0;e<t.length;++e){const i=t[e];if(i.isInterleavedBufferAttribute){const t=l/n;for(let e=0,r=i.count;e<r;e++)for(let r=0;r<n;r++){const n=i.getComponent(e,r);a.setComponent(e+t,r,n)}}else o.set(i.array,l);l+=i.count*n}return void 0!==r&&(a.gpuType=r),a}function zm(t){return t.isInstancedInterleavedBufferAttribute||t.isInterleavedBufferAttribute?Vm(t):t.isInstancedBufferAttribute?(new Cl).copy(t):(new zo).copy(t)}function Hm(t){let e,n=0,i=0;for(let r=0,s=t.length;r<s;++r){const s=t[r];if(void 0===e&&(e=s.array.constructor),e!==s.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;n+=s.array.length,i+=s.itemSize}const r=new Qa(new e(n),i);let s=0;const o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let e=0,n=t.length;e<n;e++){const n=t[e],i=n.itemSize,c=n.count,h=new za(r,i,s,n.normalized);o.push(h),s+=i;for(let t=0;t<c;t++)for(let e=0;e<i;e++)h[l[e]](t,n[a[e]](t))}return o}function Vm(t){const e=t.data.array.constructor,n=t.count,i=t.itemSize,r=t.normalized,s=new e(n*i);let o;o=t.isInstancedInterleavedBufferAttribute?new Cl(s,i,r,t.meshPerAttribute):new zo(s,i,r);for(let e=0;e<n;e++)o.setX(e,t.getX(e)),i>=2&&o.setY(e,t.getY(e)),i>=3&&o.setZ(e,t.getZ(e)),i>=4&&o.setW(e,t.getW(e));return o}function jm(t){const e=t.attributes,n=t.morphTargets,i=new Map;for(const t in e){const n=e[t];n.isInterleavedBufferAttribute&&(i.has(n)||i.set(n,Vm(n)),e[t]=i.get(n))}for(const t in n){const e=n[t];e.isInterleavedBufferAttribute&&(i.has(e)||i.set(e,Vm(e)),n[t]=i.get(e))}}function Wm(t){let e=0;for(const n in t.attributes){const i=t.getAttribute(n);e+=i.count*i.itemSize*i.array.BYTES_PER_ELEMENT}const n=t.getIndex();return e+=n?n.count*n.itemSize*n.array.BYTES_PER_ELEMENT:0,e}function qm(t,e=1e-4){e=Math.max(e,Number.EPSILON);const n={},i=t.getIndex(),r=t.getAttribute("position"),s=i?i.count:r.count;let o=0;const a=Object.keys(t.attributes),l={},c={},h=[],u=["getX","getY","getZ","getW"],d=["setX","setY","setZ","setW"];for(let e=0,n=a.length;e<n;e++){const n=a[e],i=t.attributes[n];l[n]=new i.constructor(new i.array.constructor(i.count*i.itemSize),i.itemSize,i.normalized);const r=t.morphAttributes[n];r&&(c[n]||(c[n]=[]),r.forEach(((t,e)=>{const i=new t.array.constructor(t.count*t.itemSize);c[n][e]=new t.constructor(i,t.itemSize,t.normalized)})))}const p=.5*e,A=Math.log10(1/e),f=Math.pow(10,A),m=p*f;for(let e=0;e<s;e++){const r=i?i.getX(e):e;let s="";for(let e=0,n=a.length;e<n;e++){const n=a[e],i=t.getAttribute(n),o=i.itemSize;for(let t=0;t<o;t++)s+=~~(i[u[t]](r)*f+m)+","}if(s in n)h.push(n[s]);else{for(let e=0,n=a.length;e<n;e++){const n=a[e],i=t.getAttribute(n),s=t.morphAttributes[n],h=i.itemSize,p=l[n],A=c[n];for(let t=0;t<h;t++){const e=u[t],n=d[t];if(p[n](o,i[e](r)),s)for(let t=0,i=s.length;t<i;t++)A[t][n](o,s[t][e](r))}}n[s]=o,h.push(o),o++}}const g=t.clone();for(const e in t.attributes){const t=l[e];if(g.setAttribute(e,new t.constructor(t.array.slice(0,o*t.itemSize),t.itemSize,t.normalized)),e in c)for(let t=0;t<c[e].length;t++){const n=c[e][t];g.morphAttributes[e][t]=new n.constructor(n.array.slice(0,o*n.itemSize),n.itemSize,n.normalized)}}return g.setIndex(h),g}function Xm(t,e){if(e===yi)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===xi||e===Ei){let n=t.getIndex();if(null===n){const e=[],i=t.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(let t=0;t<i.count;t++)e.push(t);t.setIndex(e),n=t.getIndex()}const i=n.count-2,r=[];if(e===xi)for(let t=1;t<=i;t++)r.push(n.getX(0)),r.push(n.getX(t)),r.push(n.getX(t+1));else for(let t=0;t<i;t++)t%2==0?(r.push(n.getX(t)),r.push(n.getX(t+1)),r.push(n.getX(t+2))):(r.push(n.getX(t+2)),r.push(n.getX(t+1)),r.push(n.getX(t)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=t.clone();return s.setIndex(r),s.clearGroups(),s}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t}function Ym(t){const e=new os,n=new os,i=new os,r=new os,s=new os,o=new os,a=new os,l=new os,c=new os;function h(t,h,u,d,p,A,f,m){e.fromBufferAttribute(h,p),n.fromBufferAttribute(h,A),i.fromBufferAttribute(h,f);const g=t.morphTargetInfluences;if(u&&g){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let t=0,h=u.length;t<h;t++){const h=g[t],m=u[t];0!==h&&(r.fromBufferAttribute(m,p),s.fromBufferAttribute(m,A),o.fromBufferAttribute(m,f),d?(a.addScaledVector(r,h),l.addScaledVector(s,h),c.addScaledVector(o,h)):(a.addScaledVector(r.sub(e),h),l.addScaledVector(s.sub(n),h),c.addScaledVector(o.sub(i),h)))}e.add(a),n.add(l),i.add(c)}t.isSkinnedMesh&&(t.applyBoneTransform(p,e),t.applyBoneTransform(A,n),t.applyBoneTransform(f,i)),m[3*p+0]=e.x,m[3*p+1]=e.y,m[3*p+2]=e.z,m[3*A+0]=n.x,m[3*A+1]=n.y,m[3*A+2]=n.z,m[3*f+0]=i.x,m[3*f+1]=i.y,m[3*f+2]=i.z}const u=t.geometry,d=t.material;let p,A,f;const m=u.index,g=u.attributes.position,v=u.morphAttributes.position,y=u.morphTargetsRelative,E=u.attributes.normal,x=u.morphAttributes.position,b=u.groups,C=u.drawRange;let w,_,M,S,I,B,T;const R=new Float32Array(g.count*g.itemSize),L=new Float32Array(E.count*E.itemSize);if(null!==m)if(Array.isArray(d))for(w=0,M=b.length;w<M;w++)for(I=b[w],B=Math.max(I.start,C.start),T=Math.min(I.start+I.count,C.start+C.count),_=B,S=T;_<S;_+=3)p=m.getX(_),A=m.getX(_+1),f=m.getX(_+2),h(t,g,v,y,p,A,f,R),h(t,E,x,y,p,A,f,L);else for(B=Math.max(0,C.start),T=Math.min(m.count,C.start+C.count),w=B,M=T;w<M;w+=3)p=m.getX(w),A=m.getX(w+1),f=m.getX(w+2),h(t,g,v,y,p,A,f,R),h(t,E,x,y,p,A,f,L);else if(Array.isArray(d))for(w=0,M=b.length;w<M;w++)for(I=b[w],B=Math.max(I.start,C.start),T=Math.min(I.start+I.count,C.start+C.count),_=B,S=T;_<S;_+=3)p=_,A=_+1,f=_+2,h(t,g,v,y,p,A,f,R),h(t,E,x,y,p,A,f,L);else for(B=Math.max(0,C.start),T=Math.min(g.count,C.start+C.count),w=B,M=T;w<M;w+=3)p=w,A=w+1,f=w+2,h(t,g,v,y,p,A,f,R),h(t,E,x,y,p,A,f,L);return{positionAttribute:g,normalAttribute:E,morphedPositionAttribute:new Ko(R,3),morphedNormalAttribute:new Ko(L,3)}}function Jm(t){if(0===t.groups.length)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),t;let e=t.groups;if(e=e.sort(((t,e)=>t.materialIndex!==e.materialIndex?t.materialIndex-e.materialIndex:t.start-e.start)),null===t.getIndex()){const e=t.getAttribute("position"),n=[];for(let t=0;t<e.count;t+=3)n.push(t,t+1,t+2);t.setIndex(n)}const n=t.getIndex(),i=[];for(let t=0;t<e.length;t++){const r=e[t],s=r.start,o=s+r.count;for(let t=s;t<o;t++)i.push(n.getX(t))}t.dispose(),t.setIndex(i);let r=0;for(let t=0;t<e.length;t++){const n=e[t];n.start=r,r+=n.count}let s=e[0];t.groups=[s];for(let n=1;n<e.length;n++){const i=e[n];s.materialIndex===i.materialIndex?s.count+=i.count:(s=i,t.groups.push(s))}return t}function Km(t,e=Math.PI/3){const n=Math.cos(e),i=100*(1+1e-10),r=[new os,new os,new os],s=new os,o=new os,a=new os,l=new os;function c(t){return`${~~(t.x*i)},${~~(t.y*i)},${~~(t.z*i)}`}const h=t.index?t.toNonIndexed():t,u=h.attributes.position,d={};for(let t=0,e=u.count/3;t<e;t++){const e=3*t,n=r[0].fromBufferAttribute(u,e+0),i=r[1].fromBufferAttribute(u,e+1),a=r[2].fromBufferAttribute(u,e+2);s.subVectors(a,i),o.subVectors(n,i);const l=(new os).crossVectors(s,o).normalize();for(let t=0;t<3;t++){const e=c(r[t]);e in d||(d[e]=[]),d[e].push(l)}}const p=new Float32Array(3*u.count),A=new zo(p,3,!1);for(let t=0,e=u.count/3;t<e;t++){const e=3*t,i=r[0].fromBufferAttribute(u,e+0),h=r[1].fromBufferAttribute(u,e+1),p=r[2].fromBufferAttribute(u,e+2);s.subVectors(p,h),o.subVectors(i,h),a.crossVectors(s,o).normalize();for(let t=0;t<3;t++){const i=d[c(r[t])];l.set(0,0,0);for(let t=0,e=i.length;t<e;t++){const e=i[t];a.dot(e)>n&&l.add(e)}l.normalize(),A.setXYZ(e+t,l.x,l.y,l.z)}}return h.setAttribute("normal",A),h}function Zm(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const $m="KHR_binary_glTF",tg="KHR_draco_mesh_compression",eg="KHR_lights_punctual",ng="KHR_materials_clearcoat",ig="KHR_materials_dispersion",rg="KHR_materials_ior",sg="KHR_materials_sheen",og="KHR_materials_specular",ag="KHR_materials_transmission",lg="KHR_materials_iridescence",cg="KHR_materials_anisotropy",hg="KHR_materials_unlit",ug="KHR_materials_volume",dg="KHR_texture_basisu",pg="KHR_texture_transform",Ag="KHR_mesh_quantization",fg="KHR_materials_emissive_strength",mg="EXT_materials_bump",gg="EXT_texture_webp",vg="EXT_texture_avif",yg="EXT_meshopt_compression",Eg="EXT_mesh_gpu_instancing";class xg{constructor(t){this.parser=t,this.name=eg,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let n=0,i=e.length;n<i;n++){const i=e[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&t._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(t){const e=this.parser,n="light:"+t;let i=e.cache.get(n);if(i)return i;const r=e.json,s=((r.extensions&&r.extensions[this.name]||{}).lights||[])[t];let o;const a=new Bo(16777215);void 0!==s.color&&a.setRGB(s.color[0],s.color[1],s.color[2],Ti);const l=void 0!==s.range?s.range:0;switch(s.type){case"directional":o=new ad(a),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new rd(a),o.distance=l;break;case"spot":o=new $u(a),o.distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,o.angle=s.spot.outerConeAngle,o.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return o.position.set(0,0,0),iv(o,s),void 0!==s.intensity&&(o.intensity=s.intensity),o.name=e.createUniqueName(s.name||"light_"+t),i=Promise.resolve(o),e.cache.add(n,i),i}getDependency(t,e){if("light"===t)return this._loadLight(e)}createNodeAttachment(t){const e=this,n=this.parser,i=n.json.nodes[t],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(t){return n._getNodeRef(e.cache,r,t)}))}}class bg{constructor(){this.name=hg}getMaterialType(){return Do}extendParams(t,e,n){const i=[];t.color=new Bo(1,1,1),t.opacity=1;const r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;t.color.setRGB(e[0],e[1],e[2],Ti),t.opacity=e[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(t,"map",r.baseColorTexture,Bi))}return Promise.all(i)}}class Cg{constructor(t){this.parser=t,this.name=fg}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return void 0!==i&&(e.emissiveIntensity=i),Promise.resolve()}}class wg{constructor(t){this.parser=t,this.name=ng}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];if(void 0!==s.clearcoatFactor&&(e.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&r.push(n.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&r.push(n.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(r.push(n.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){const t=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new Br(t,t)}return Promise.all(r)}}class _g{constructor(t){this.parser=t,this.name=ig}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return e.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class Mg{constructor(t){this.parser=t,this.name=lg}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.iridescenceFactor&&(e.iridescence=s.iridescenceFactor),void 0!==s.iridescenceTexture&&r.push(n.assignTexture(e,"iridescenceMap",s.iridescenceTexture)),void 0!==s.iridescenceIor&&(e.iridescenceIOR=s.iridescenceIor),void 0===e.iridescenceThicknessRange&&(e.iridescenceThicknessRange=[100,400]),void 0!==s.iridescenceThicknessMinimum&&(e.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),void 0!==s.iridescenceThicknessMaximum&&(e.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),void 0!==s.iridescenceThicknessTexture&&r.push(n.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class Sg{constructor(t){this.parser=t,this.name=sg}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];e.sheenColor=new Bo(0,0,0),e.sheenRoughness=0,e.sheen=1;const s=i.extensions[this.name];if(void 0!==s.sheenColorFactor){const t=s.sheenColorFactor;e.sheenColor.setRGB(t[0],t[1],t[2],Ti)}return void 0!==s.sheenRoughnessFactor&&(e.sheenRoughness=s.sheenRoughnessFactor),void 0!==s.sheenColorTexture&&r.push(n.assignTexture(e,"sheenColorMap",s.sheenColorTexture,Bi)),void 0!==s.sheenRoughnessTexture&&r.push(n.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(r)}}class Ig{constructor(t){this.parser=t,this.name=ag}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.transmissionFactor&&(e.transmission=s.transmissionFactor),void 0!==s.transmissionTexture&&r.push(n.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class Bg{constructor(t){this.parser=t,this.name=ug}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];e.thickness=void 0!==s.thicknessFactor?s.thicknessFactor:0,void 0!==s.thicknessTexture&&r.push(n.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const o=s.attenuationColor||[1,1,1];return e.attenuationColor=(new Bo).setRGB(o[0],o[1],o[2],Ti),Promise.all(r)}}class Tg{constructor(t){this.parser=t,this.name=rg}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return e.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class Rg{constructor(t){this.parser=t,this.name=og}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];e.specularIntensity=void 0!==s.specularFactor?s.specularFactor:1,void 0!==s.specularTexture&&r.push(n.assignTexture(e,"specularIntensityMap",s.specularTexture));const o=s.specularColorFactor||[1,1,1];return e.specularColor=(new Bo).setRGB(o[0],o[1],o[2],Ti),void 0!==s.specularColorTexture&&r.push(n.assignTexture(e,"specularColorMap",s.specularColorTexture,Bi)),Promise.all(r)}}class Lg{constructor(t){this.parser=t,this.name=mg}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return e.bumpScale=void 0!==s.bumpFactor?s.bumpFactor:1,void 0!==s.bumpTexture&&r.push(n.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(r)}}class Dg{constructor(t){this.parser=t,this.name=cg}getMaterialType(t){const e=this.parser.json.materials[t];return e.extensions&&e.extensions[this.name]?ru:null}extendMaterialParams(t,e){const n=this.parser,i=n.json.materials[t];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.anisotropyStrength&&(e.anisotropy=s.anisotropyStrength),void 0!==s.anisotropyRotation&&(e.anisotropyRotation=s.anisotropyRotation),void 0!==s.anisotropyTexture&&r.push(n.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class Pg{constructor(t){this.parser=t,this.name=dg}loadTexture(t){const e=this.parser,n=e.json,i=n.textures[t];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],s=e.options.ktx2Loader;if(!s){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,s)}}class Ug{constructor(t){this.parser=t,this.name=gg,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,i=n.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],o=i.images[s.source];let a=n.textureLoader;if(o.uri){const t=n.options.manager.getHandler(o.uri);null!==t&&(a=t)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(t,s.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class Og{constructor(t){this.parser=t,this.name=vg,this.isSupported=null}loadTexture(t){const e=this.name,n=this.parser,i=n.json,r=i.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],o=i.images[s.source];let a=n.textureLoader;if(o.uri){const t=n.options.manager.getHandler(o.uri);null!==t&&(a=t)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(t,s.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(t)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(1===e.height)}}))),this.isSupported}}class Fg{constructor(t){this.name=yg,this.parser=t}loadBufferView(t){const e=this.parser.json,n=e.bufferViews[t];if(n.extensions&&n.extensions[this.name]){const t=n.extensions[this.name],i=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(e){const n=t.byteOffset||0,i=t.byteLength||0,s=t.count,o=t.byteStride,a=new Uint8Array(e,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(s,o,a,t.mode,t.filter).then((function(t){return t.buffer})):r.ready.then((function(){const e=new ArrayBuffer(s*o);return r.decodeGltfBuffer(new Uint8Array(e),s,o,a,t.mode,t.filter),e}))}))}return null}}class kg{constructor(t){this.name=Eg,this.parser=t}createNodeMesh(t){const e=this.parser.json,n=e.nodes[t];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=e.meshes[n.mesh];for(const t of i.primitives)if(t.mode!==qg.TRIANGLES&&t.mode!==qg.TRIANGLE_STRIP&&t.mode!==qg.TRIANGLE_FAN&&void 0!==t.mode)return null;const r=n.extensions[this.name].attributes,s=[],o={};for(const t in r)s.push(this.parser.getDependency("accessor",r[t]).then((e=>(o[t]=e,o[t]))));return s.length<1?null:(s.push(this.parser.createNodeMesh(t)),Promise.all(s).then((t=>{const e=t.pop(),n=e.isGroup?e.children:[e],i=t[0].count,r=[];for(const t of n){const e=new Os,n=new os,s=new ss,a=new os(1,1,1),l=new Rl(t.geometry,t.material,i);for(let t=0;t<i;t++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,t),o.ROTATION&&s.fromBufferAttribute(o.ROTATION,t),o.SCALE&&a.fromBufferAttribute(o.SCALE,t),l.setMatrixAt(t,e.compose(n,s,a));for(const e in o)if("_COLOR_0"===e){const t=o[e];l.instanceColor=new Cl(t.array,t.itemSize,t.normalized)}else"TRANSLATION"!==e&&"ROTATION"!==e&&"SCALE"!==e&&t.geometry.setAttribute(e,o[e]);co.prototype.copy.call(l,t),this.parser.assignFinalMaterial(l),r.push(l)}return e.isGroup?(e.clear(),e.add(...r),e):r[0]})))}}const Ng="glTF";class Qg{constructor(t){this.name=$m,this.content=null,this.body=null;const e=new DataView(t,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Ng)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,r=new DataView(t,12);let s=0;for(;s<i;){const e=r.getUint32(s,!0);s+=4;const i=r.getUint32(s,!0);if(s+=4,1313821514===i){const i=new Uint8Array(t,12+s,e);this.content=n.decode(i)}else if(5130562===i){const n=12+s;this.body=t.slice(n,n+e)}s+=e}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Gg{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=tg,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const n=this.json,i=this.dracoLoader,r=t.extensions[this.name].bufferView,s=t.extensions[this.name].attributes,o={},a={},l={};for(const t in s){const e=Zg[t]||t.toLowerCase();o[e]=s[t]}for(const e in t.attributes){const i=Zg[e]||e.toLowerCase();if(void 0!==s[e]){const r=n.accessors[t.attributes[e]],s=Xg[r.componentType];l[i]=s.name,a[i]=!0===r.normalized}}return e.getDependency("bufferView",r).then((function(t){return new Promise((function(e,n){i.decodeDracoFile(t,(function(t){for(const e in t.attributes){const n=t.attributes[e],i=a[e];void 0!==i&&(n.normalized=i)}e(t)}),o,l,Ti,n)}))}))}}class zg{constructor(){this.name=pg}extendTexture(t,e){return void 0!==e.texCoord&&e.texCoord!==t.channel||void 0!==e.offset||void 0!==e.rotation||void 0!==e.scale?(t=t.clone(),void 0!==e.texCoord&&(t.channel=e.texCoord),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0,t):t}}class Hg{constructor(){this.name=Ag}}class Vg extends yu{constructor(t,e,n,i){super(t,e,n,i)}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i*3+i;for(let t=0;t!==i;t++)e[t]=n[r+t];return e}interpolate_(t,e,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=2*o,l=3*o,c=i-e,h=(n-e)/c,u=h*h,d=u*h,p=t*l,A=p-l,f=-2*d+3*u,m=d-u,g=1-f,v=m-u+h;for(let t=0;t!==o;t++){const e=s[A+t+o],n=s[A+t+a]*c,i=s[p+t+o],l=s[p+t]*c;r[t]=g*e+v*n+f*i+m*l}return r}}const jg=new ss;class Wg extends Vg{interpolate_(t,e,n,i){const r=super.interpolate_(t,e,n,i);return jg.fromArray(r).normalize().toArray(r),r}}const qg={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Xg={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Yg={9728:Xe,9729:$e,9984:Ye,9985:tn,9986:Ke,9987:nn},Jg={33071:We,33648:qe,10497:je},Kg={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Zg={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},$g={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},tv={CUBICSPLINE:void 0,LINEAR:di,STEP:ui};function ev(t){return void 0===t.DefaultMaterial&&(t.DefaultMaterial=new iu({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Ht})),t.DefaultMaterial}function nv(t,e,n){for(const i in n.extensions)void 0===t[i]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=n.extensions[i])}function iv(t,e){void 0!==e.extras&&("object"==typeof e.extras?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function rv(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(let n=0,i=e.weights.length;n<i;n++)t.morphTargetInfluences[n]=e.weights[n];if(e.extras&&Array.isArray(e.extras.targetNames)){const n=e.extras.targetNames;if(t.morphTargetInfluences.length===n.length){t.morphTargetDictionary={};for(let e=0,i=n.length;e<i;e++)t.morphTargetDictionary[n[e]]=e}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function sv(t){let e;const n=t.extensions&&t.extensions[tg];if(e=n?"draco:"+n.bufferView+":"+n.indices+":"+ov(n.attributes):t.indices+":"+ov(t.attributes)+":"+t.mode,void 0!==t.targets)for(let n=0,i=t.targets.length;n<i;n++)e+=":"+ov(t.targets[n]);return e}function ov(t){let e="";const n=Object.keys(t).sort();for(let i=0,r=n.length;i<r;i++)e+=n[i]+":"+t[n[i]]+";";return e}function av(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const lv=new Os;class cv{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new Zm,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,s=-1;if("undefined"!=typeof navigator){const t=navigator.userAgent;n=!0===/^((?!chrome|android).)*safari/i.test(t);const e=t.match(/Version\/(\d+)/);i=n&&e?parseInt(e[1],10):-1,r=t.indexOf("Firefox")>-1,s=r?t.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||n&&i<17||r&&s<98?this.textureLoader=new ju(this.options.manager):this.textureLoader=new Ed(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Nu(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(t){return t._markDefs&&t._markDefs()})),Promise.all(this._invokeAll((function(t){return t.beforeRoot&&t.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(e){const s={scene:e[0][i.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:i.asset,parser:n,userData:{}};return nv(r,s,i),iv(s,i),Promise.all(n._invokeAll((function(t){return t.afterRoot&&t.afterRoot(s)}))).then((function(){for(const t of s.scenes)t.updateMatrixWorld();t(s)}))})).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=e.length;n<i;n++){const i=e[n].joints;for(let e=0,n=i.length;e<n;e++)t[i[e]].isBone=!0}for(let e=0,i=t.length;e<i;e++){const i=t[e];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(n[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,n){if(t.refs[e]<=1)return n;const i=n.clone(),r=(t,e)=>{const n=this.associations.get(t);null!=n&&this.associations.set(e,n);for(const[n,i]of t.children.entries())r(i,e.children[n])};return r(n,i),i.name+="_instance_"+t.uses[e]++,i}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let n=0;n<e.length;n++){const i=t(e[n]);if(i)return i}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const n=[];for(let i=0;i<e.length;i++){const r=t(e[i]);r&&n.push(r)}return n}getDependency(t,e){const n=t+":"+e;let i=this.cache.get(n);if(!i){switch(t){case"scene":i=this.loadScene(e);break;case"node":i=this._invokeOne((function(t){return t.loadNode&&t.loadNode(e)}));break;case"mesh":i=this._invokeOne((function(t){return t.loadMesh&&t.loadMesh(e)}));break;case"accessor":i=this.loadAccessor(e);break;case"bufferView":i=this._invokeOne((function(t){return t.loadBufferView&&t.loadBufferView(e)}));break;case"buffer":i=this.loadBuffer(e);break;case"material":i=this._invokeOne((function(t){return t.loadMaterial&&t.loadMaterial(e)}));break;case"texture":i=this._invokeOne((function(t){return t.loadTexture&&t.loadTexture(e)}));break;case"skin":i=this.loadSkin(e);break;case"animation":i=this._invokeOne((function(t){return t.loadAnimation&&t.loadAnimation(e)}));break;case"camera":i=this.loadCamera(e);break;default:if(i=this._invokeOne((function(n){return n!=this&&n.getDependency&&n.getDependency(t,e)})),!i)throw new Error("Unknown type: "+t)}this.cache.add(n,i)}return i}getDependencies(t){let e=this.cache.get(t);if(!e){const n=this,i=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(i.map((function(e,i){return n.getDependency(t,i)}))),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],n=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[$m].body);const i=this.options;return new Promise((function(t,r){n.load(pd.resolveURL(e.uri,i.path),t,void 0,(function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))}))}))}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then((function(t){const n=e.byteLength||0,i=e.byteOffset||0;return t.slice(i,i+n)}))}loadAccessor(t){const e=this,n=this.json,i=this.json.accessors[t];if(void 0===i.bufferView&&void 0===i.sparse){const t=Kg[i.type],e=Xg[i.componentType],n=!0===i.normalized,r=new e(i.count*t);return Promise.resolve(new zo(r,t,n))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then((function(t){const r=t[0],s=Kg[i.type],o=Xg[i.componentType],a=o.BYTES_PER_ELEMENT,l=a*s,c=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,u=!0===i.normalized;let d,p;if(h&&h!==l){const t=Math.floor(c/h),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+t+":"+i.count;let l=e.cache.get(n);l||(d=new o(r,t*h,i.count*h/a),l=new Qa(d,h/a),e.cache.add(n,l)),p=new za(l,s,c%h/a,u)}else d=null===r?new o(i.count*s):new o(r,c,i.count*s),p=new zo(d,s,u);if(void 0!==i.sparse){const e=Kg.SCALAR,n=Xg[i.sparse.indices.componentType],a=i.sparse.indices.byteOffset||0,l=i.sparse.values.byteOffset||0,c=new n(t[1],a,i.sparse.count*e),h=new o(t[2],l,i.sparse.count*s);null!==r&&(p=new zo(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let t=0,e=c.length;t<e;t++){const e=c[t];if(p.setX(e,h[t*s]),s>=2&&p.setY(e,h[t*s+1]),s>=3&&p.setZ(e,h[t*s+2]),s>=4&&p.setW(e,h[t*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}p.normalized=u}return p}))}loadTexture(t){const e=this.json,n=this.options,i=e.textures[t].source,r=e.images[i];let s=this.textureLoader;if(r.uri){const t=n.manager.getHandler(r.uri);null!==t&&(s=t)}return this.loadTextureImage(t,i,s)}loadTextureImage(t,e,n){const i=this,r=this.json,s=r.textures[t],o=r.images[e],a=(o.uri||o.bufferView)+":"+s.sampler;if(this.textureCache[a])return this.textureCache[a];const l=this.loadImageSource(e,n).then((function(e){e.flipY=!1,e.name=s.name||o.name||"",""===e.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(e.name=o.uri);const n=(r.samplers||{})[s.sampler]||{};return e.magFilter=Yg[n.magFilter]||$e,e.minFilter=Yg[n.minFilter]||nn,e.wrapS=Jg[n.wrapS]||je,e.wrapT=Jg[n.wrapT]||je,e.generateMipmaps=!e.isCompressedTexture&&e.minFilter!==Xe&&e.minFilter!==$e,i.associations.set(e,{textures:t}),e})).catch((function(){return null}));return this.textureCache[a]=l,l}loadImageSource(t,e){const n=this.json,i=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then((t=>t.clone()));const r=n.images[t],s=self.URL||self.webkitURL;let o=r.uri||"",a=!1;if(void 0!==r.bufferView)o=this.getDependency("bufferView",r.bufferView).then((function(t){a=!0;const e=new Blob([t],{type:r.mimeType});return o=s.createObjectURL(e),o}));else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const l=Promise.resolve(o).then((function(t){return new Promise((function(n,r){let s=n;!0===e.isImageBitmapLoader&&(s=function(t){const e=new Kr(t);e.needsUpdate=!0,n(e)}),e.load(pd.resolveURL(t,i.path),s,void 0,r)}))})).then((function(t){var e;return!0===a&&s.revokeObjectURL(o),iv(t,r),t.userData.mimeType=r.mimeType||((e=r.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":e.search(/\.ktx2($|\?)/i)>0||0===e.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),t})).catch((function(t){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),t}));return this.sourceCache[t]=l,l}assignTexture(t,e,n,i){const r=this;return this.getDependency("texture",n.index).then((function(s){if(!s)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((s=s.clone()).channel=n.texCoord),r.extensions[pg]){const t=void 0!==n.extensions?n.extensions[pg]:void 0;if(t){const e=r.associations.get(s);s=r.extensions[pg].extendTexture(s,t),r.associations.set(s,e)}}return void 0!==i&&(s.colorSpace=i),t[e]=s,s}))}assignFinalMaterial(t){const e=t.geometry;let n=t.material;const i=void 0===e.attributes.tangent,r=void 0!==e.attributes.color,s=void 0===e.attributes.normal;if(t.isPoints){const t="PointsMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new gc,Lo.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,e.sizeAttenuation=!1,this.cache.add(t,e)),n=e}else if(t.isLine){const t="LineBasicMaterial:"+n.uuid;let e=this.cache.get(t);e||(e=new ic,Lo.prototype.copy.call(e,n),e.color.copy(n.color),e.map=n.map,this.cache.add(t,e)),n=e}if(i||r||s){let t="ClonedMaterial:"+n.uuid+":";i&&(t+="derivative-tangents:"),r&&(t+="vertex-colors:"),s&&(t+="flat-shading:");let e=this.cache.get(t);e||(e=n.clone(),r&&(e.vertexColors=!0),s&&(e.flatShading=!0),i&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(n))),n=e}t.material=n}getMaterialType(){return iu}loadMaterial(t){const e=this,n=this.json,i=this.extensions,r=n.materials[t];let s;const o={},a=[];if((r.extensions||{})[hg]){const t=i[hg];s=t.getMaterialType(),a.push(t.extendParams(o,r,e))}else{const n=r.pbrMetallicRoughness||{};if(o.color=new Bo(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){const t=n.baseColorFactor;o.color.setRGB(t[0],t[1],t[2],Ti),o.opacity=t[3]}void 0!==n.baseColorTexture&&a.push(e.assignTexture(o,"map",n.baseColorTexture,Bi)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(a.push(e.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),a.push(e.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),s=this._invokeOne((function(e){return e.getMaterialType&&e.getMaterialType(t)})),a.push(Promise.all(this._invokeAll((function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,o)}))))}!0===r.doubleSided&&(o.side=jt);const l=r.alphaMode||"OPAQUE";if("BLEND"===l?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,"MASK"===l&&(o.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&s!==Do&&(a.push(e.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new Br(1,1),void 0!==r.normalTexture.scale)){const t=r.normalTexture.scale;o.normalScale.set(t,t)}if(void 0!==r.occlusionTexture&&s!==Do&&(a.push(e.assignTexture(o,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(o.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&s!==Do){const t=r.emissiveFactor;o.emissive=(new Bo).setRGB(t[0],t[1],t[2],Ti)}return void 0!==r.emissiveTexture&&s!==Do&&a.push(e.assignTexture(o,"emissiveMap",r.emissiveTexture,Bi)),Promise.all(a).then((function(){const n=new s(o);return r.name&&(n.name=r.name),iv(n,r),e.associations.set(n,{materials:t}),r.extensions&&nv(i,n,r),n}))}createUniqueName(t){const e=Jd.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,n=this.extensions,i=this.primitiveCache;function r(t){return n[tg].decodePrimitive(t,e).then((function(n){return hv(n,t,e)}))}const s=[];for(let n=0,o=t.length;n<o;n++){const o=t[n],a=sv(o),l=i[a];if(l)s.push(l.promise);else{let t;t=o.extensions&&o.extensions[tg]?r(o):hv(new sa,o,e),i[a]={primitive:o,promise:t},s.push(t)}}return Promise.all(s)}loadMesh(t){const e=this,n=this.json,i=this.extensions,r=n.meshes[t],s=r.primitives,o=[];for(let t=0,e=s.length;t<e;t++){const e=void 0===s[t].material?ev(this.cache):this.getDependency("material",s[t].material);o.push(e)}return o.push(e.loadGeometries(s)),Promise.all(o).then((function(n){const o=n.slice(0,n.length-1),a=n[n.length-1],l=[];for(let n=0,c=a.length;n<c;n++){const c=a[n],h=s[n];let u;const d=o[n];if(h.mode===qg.TRIANGLES||h.mode===qg.TRIANGLE_STRIP||h.mode===qg.TRIANGLE_FAN||void 0===h.mode)u=!0===r.isSkinnedMesh?new gl(c,d):new ga(c,d),!0===u.isSkinnedMesh&&u.normalizeSkinWeights(),h.mode===qg.TRIANGLE_STRIP?u.geometry=Xm(u.geometry,Ei):h.mode===qg.TRIANGLE_FAN&&(u.geometry=Xm(u.geometry,xi));else if(h.mode===qg.LINES)u=new fc(c,d);else if(h.mode===qg.LINE_STRIP)u=new uc(c,d);else if(h.mode===qg.LINE_LOOP)u=new mc(c,d);else{if(h.mode!==qg.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);u=new bc(c,d)}Object.keys(u.geometry.morphAttributes).length>0&&rv(u,r),u.name=e.createUniqueName(r.name||"mesh_"+t),iv(u,r),h.extensions&&nv(i,u,h),e.assignFinalMaterial(u),l.push(u)}for(let n=0,i=l.length;n<i;n++)e.associations.set(l[n],{meshes:t,primitives:n});if(1===l.length)return r.extensions&&nv(i,l[0],r),l[0];const c=new Pa;r.extensions&&nv(i,c,r),e.associations.set(c,{meshes:t});for(let t=0,e=l.length;t<e;t++)c.add(l[t]);return c}))}loadCamera(t){let e;const n=this.json.cameras[t],i=n[n.type];if(i)return"perspective"===n.type?e=new Ba(Ir.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(e=new sd(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(e.name=this.createUniqueName(n.name)),iv(e,n),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(t){const e=this.json.skins[t],n=[];for(let t=0,i=e.joints.length;t<i;t++)n.push(this._loadNodeShallow(e.joints[t]));return void 0!==e.inverseBindMatrices?n.push(this.getDependency("accessor",e.inverseBindMatrices)):n.push(null),Promise.all(n).then((function(t){const n=t.pop(),i=t,r=[],s=[];for(let t=0,o=i.length;t<o;t++){const o=i[t];if(o){r.push(o);const e=new Os;null!==n&&e.fromArray(n.array,16*t),s.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[t])}return new bl(r,s)}))}loadAnimation(t){const e=this.json,n=this,i=e.animations[t],r=i.name?i.name:"animation_"+t,s=[],o=[],a=[],l=[],c=[];for(let t=0,e=i.channels.length;t<e;t++){const e=i.channels[t],n=i.samplers[e.sampler],r=e.target,h=r.node,u=void 0!==i.parameters?i.parameters[n.input]:n.input,d=void 0!==i.parameters?i.parameters[n.output]:n.output;void 0!==r.node&&(s.push(this.getDependency("node",h)),o.push(this.getDependency("accessor",u)),a.push(this.getDependency("accessor",d)),l.push(n),c.push(r))}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(a),Promise.all(l),Promise.all(c)]).then((function(t){const e=t[0],i=t[1],s=t[2],o=t[3],a=t[4],l=[];for(let t=0,r=e.length;t<r;t++){const r=e[t],c=i[t],h=s[t],u=o[t],d=a[t];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();const p=n._createAnimationTracks(r,c,h,u,d);if(p)for(let t=0;t<p.length;t++)l.push(p[t])}return new Ru(r,void 0,l)}))}createNodeMesh(t){const e=this.json,n=this,i=e.nodes[t];return void 0===i.mesh?null:n.getDependency("mesh",i.mesh).then((function(t){const e=n._getNodeRef(n.meshCache,i.mesh,t);return void 0!==i.weights&&e.traverse((function(t){if(t.isMesh)for(let e=0,n=i.weights.length;e<n;e++)t.morphTargetInfluences[e]=i.weights[e]})),e}))}loadNode(t){const e=this,n=this.json.nodes[t],i=e._loadNodeShallow(t),r=[],s=n.children||[];for(let t=0,n=s.length;t<n;t++)r.push(e.getDependency("node",s[t]));const o=void 0===n.skin?Promise.resolve(null):e.getDependency("skin",n.skin);return Promise.all([i,Promise.all(r),o]).then((function(t){const e=t[0],n=t[1],i=t[2];null!==i&&e.traverse((function(t){t.isSkinnedMesh&&t.bind(i,lv)}));for(let t=0,i=n.length;t<i;t++)e.add(n[t]);return e}))}_loadNodeShallow(t){const e=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[t])return this.nodeCache[t];const r=e.nodes[t],s=r.name?i.createUniqueName(r.name):"",o=[],a=i._invokeOne((function(e){return e.createNodeMesh&&e.createNodeMesh(t)}));return a&&o.push(a),void 0!==r.camera&&o.push(i.getDependency("camera",r.camera).then((function(t){return i._getNodeRef(i.cameraCache,r.camera,t)}))),i._invokeAll((function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)})).forEach((function(t){o.push(t)})),this.nodeCache[t]=Promise.all(o).then((function(e){let o;if(o=!0===r.isBone?new vl:e.length>1?new Pa:1===e.length?e[0]:new co,o!==e[0])for(let t=0,n=e.length;t<n;t++)o.add(e[t]);if(r.name&&(o.userData.name=r.name,o.name=s),iv(o,r),r.extensions&&nv(n,o,r),void 0!==r.matrix){const t=new Os;t.fromArray(r.matrix),o.applyMatrix4(t)}else void 0!==r.translation&&o.position.fromArray(r.translation),void 0!==r.rotation&&o.quaternion.fromArray(r.rotation),void 0!==r.scale&&o.scale.fromArray(r.scale);return i.associations.has(o)||i.associations.set(o,{}),i.associations.get(o).nodes=t,o})),this.nodeCache[t]}loadScene(t){const e=this.extensions,n=this.json.scenes[t],i=this,r=new Pa;n.name&&(r.name=i.createUniqueName(n.name)),iv(r,n),n.extensions&&nv(e,r,n);const s=n.nodes||[],o=[];for(let t=0,e=s.length;t<e;t++)o.push(i.getDependency("node",s[t]));return Promise.all(o).then((function(t){for(let e=0,n=t.length;e<n;e++)r.add(t[e]);return i.associations=(t=>{const e=new Map;for(const[t,n]of i.associations)(t instanceof Lo||t instanceof Kr)&&e.set(t,n);return t.traverse((t=>{const n=i.associations.get(t);null!=n&&e.set(t,n)})),e})(r),r}))}_createAnimationTracks(t,e,n,i,r){const s=[],o=t.name?t.name:t.uuid,a=[];let l;switch($g[r.path]===$g.weights?t.traverse((function(t){t.morphTargetInfluences&&a.push(t.name?t.name:t.uuid)})):a.push(o),$g[r.path]){case $g.weights:l=Mu;break;case $g.rotation:l=Iu;break;case $g.position:case $g.scale:l=Tu;break;default:l=1===n.itemSize?Mu:Tu}const c=void 0!==i.interpolation?tv[i.interpolation]:di,h=this._getArrayFromAccessor(n);for(let t=0,n=a.length;t<n;t++){const n=new l(a[t]+"."+$g[r.path],e.array,h,c);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(n),s.push(n)}return s}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const t=av(e.constructor),n=new Float32Array(e.length);for(let i=0,r=e.length;i<r;i++)n[i]=e[i]*t;e=n}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(t){return new(this instanceof Iu?Wg:Vg)(this.times,this.values,this.getValueSize()/3,t)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function hv(t,e,n){const i=e.attributes,r=[];function s(e,i){return n.getDependency("accessor",e).then((function(e){t.setAttribute(i,e)}))}for(const e in i){const n=Zg[e]||e.toLowerCase();n in t.attributes||r.push(s(i[e],n))}if(void 0!==e.indices&&!t.index){const i=n.getDependency("accessor",e.indices).then((function(e){t.setIndex(e)}));r.push(i)}return zr.workingColorSpace!==Ti&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${zr.workingColorSpace}" not supported.`),iv(t,e),function(t,e,n){const i=e.attributes,r=new cs;if(void 0===i.POSITION)return;{const t=n.json.accessors[i.POSITION],e=t.min,s=t.max;if(void 0===e||void 0===s)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new os(e[0],e[1],e[2]),new os(s[0],s[1],s[2])),t.normalized){const e=av(Xg[t.componentType]);r.min.multiplyScalar(e),r.max.multiplyScalar(e)}}const s=e.targets;if(void 0!==s){const t=new os,e=new os;for(let i=0,r=s.length;i<r;i++){const r=s[i];if(void 0!==r.POSITION){const i=n.json.accessors[r.POSITION],s=i.min,o=i.max;if(void 0!==s&&void 0!==o){if(e.setX(Math.max(Math.abs(s[0]),Math.abs(o[0]))),e.setY(Math.max(Math.abs(s[1]),Math.abs(o[1]))),e.setZ(Math.max(Math.abs(s[2]),Math.abs(o[2]))),i.normalized){const t=av(Xg[i.componentType]);e.multiplyScalar(t)}t.max(e)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(t)}t.boundingBox=r;const o=new Ss;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,t.boundingSphere=o}(t,e,n),Promise.all(r).then((function(){return void 0!==e.targets?function(t,e,n){let i=!1,r=!1,s=!1;for(let t=0,n=e.length;t<n;t++){const n=e[t];if(void 0!==n.POSITION&&(i=!0),void 0!==n.NORMAL&&(r=!0),void 0!==n.COLOR_0&&(s=!0),i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(t);const o=[],a=[],l=[];for(let c=0,h=e.length;c<h;c++){const h=e[c];if(i){const e=void 0!==h.POSITION?n.getDependency("accessor",h.POSITION):t.attributes.position;o.push(e)}if(r){const e=void 0!==h.NORMAL?n.getDependency("accessor",h.NORMAL):t.attributes.normal;a.push(e)}if(s){const e=void 0!==h.COLOR_0?n.getDependency("accessor",h.COLOR_0):t.attributes.color;l.push(e)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l)]).then((function(e){const n=e[0],o=e[1],a=e[2];return i&&(t.morphAttributes.position=n),r&&(t.morphAttributes.normal=o),s&&(t.morphAttributes.color=a),t.morphTargetsRelative=!0,t}))}(t,e.targets,n):t}))}class uv{constructor(t=4){this.pool=t,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(t){if(!this.workers[t]){const e=this.workerCreator();e.addEventListener("message",this._onMessage.bind(this,t)),this.workers[t]=e}}_getIdleWorker(){for(let t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1}_onMessage(t,e){const n=this.workersResolve[t];if(n&&n(e),this.queue.length){const{resolve:e,msg:n,transfer:i}=this.queue.shift();this.workersResolve[t]=e,this.workers[t].postMessage(n,i)}else this.workerStatus^=1<<t}setWorkerCreator(t){this.workerCreator=t}setWorkerLimit(t){this.pool=t}postMessage(t,e){return new Promise((n=>{const i=this._getIdleWorker();-1!==i?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=n,this.workers[i].postMessage(t,e)):this.queue.push({resolve:n,msg:t,transfer:e})}))}dispose(){this.workers.forEach((t=>t.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const dv=9,pv=15,Av=16,fv=22,mv=37,gv=43,vv=76,yv=83,Ev=97,xv=100,bv=103,Cv=109,wv=165,_v=166,Mv=1000066e3;class Sv{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Iv{constructor(t,e,n,i){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(t.buffer,t.byteOffset+e,n),this._littleEndian=i,this._offset=0}_nextUint8(){const t=this._dataView.getUint8(this._offset);return this._offset+=1,t}_nextUint16(){const t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}_nextUint32(){const t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint64(){const t=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,t}_nextInt32(){const t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint8Array(t){const e=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,t);return this._offset+=t,e}_skip(t){return this._offset+=t,this}_scan(t,e){void 0===e&&(e=0);const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==e&&i<t;)i++,this._offset++;return i<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}new Uint8Array([0]);const Bv=[171,75,84,88,32,50,48,187,13,10,26,10];function Tv(t){return(new TextDecoder).decode(t)}var Rv=n(9922).hp;let Lv,Dv,Pv;const Uv={env:{emscripten_notify_memory_growth:function(t){Pv=new Uint8Array(Dv.exports.memory.buffer)}}};class Ov{init(){return Lv||(Lv="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Fv).then((t=>t.arrayBuffer())).then((t=>WebAssembly.instantiate(t,Uv))).then(this._init):WebAssembly.instantiate(Rv.from(Fv,"base64"),Uv).then(this._init),Lv)}_init(t){Dv=t.instance,Uv.env.emscripten_notify_memory_growth(0)}decode(t,e=0){if(!Dv)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=t.byteLength,i=Dv.exports.malloc(n);Pv.set(t,i),e=e||Number(Dv.exports.ZSTD_findDecompressedSize(i,n));const r=Dv.exports.malloc(e),s=Dv.exports.ZSTD_decompress(r,e,i,n),o=Pv.slice(r,r+s);return Dv.exports.free(i),Dv.exports.free(r),o}}const Fv="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",kv=new WeakMap;let Nv,Qv=0;class Gv extends Ou{constructor(t){super(t),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new uv,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(t){return this.transcoderPath=t,this}setWorkerLimit(t){return this.workerPool.setWorkerLimit(t),this}async detectSupportAsync(t){return this.workerConfig={astcSupported:await t.hasFeatureAsync("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:await t.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await t.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await t.hasFeatureAsync("texture-compression-bc"),bptcSupported:await t.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await t.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(t){return!0===t.isWebGPURenderer?this.workerConfig={astcSupported:t.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:t.hasFeature("texture-compression-etc1"),etc2Supported:t.hasFeature("texture-compression-etc2"),dxtSupported:t.hasFeature("texture-compression-bc"),bptcSupported:t.hasFeature("texture-compression-bptc"),pvrtcSupported:t.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:t.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:t.extensions.has("WEBGL_compressed_texture_astc")&&t.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:t.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:t.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:t.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:t.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:t.extensions.has("WEBGL_compressed_texture_pvrtc")||t.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const t=new Nu(this.manager);t.setPath(this.transcoderPath),t.setWithCredentials(this.withCredentials);const e=t.loadAsync("basis_transcoder.js"),n=new Nu(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([e,i]).then((([t,e])=>{const n=Gv.BasisWorker.toString(),i=["/* constants */","let _EngineFormat = "+JSON.stringify(Gv.EngineFormat),"let _EngineType = "+JSON.stringify(Gv.EngineType),"let _TranscoderFormat = "+JSON.stringify(Gv.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Gv.BasisFormat),"/* basis_transcoder.js */",t,"/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i])),this.transcoderBinary=e,this.workerPool.setWorkerCreator((()=>{const t=new Worker(this.workerSourceURL),e=this.transcoderBinary.slice(0);return t.postMessage({type:"init",config:this.workerConfig,transcoderBinary:e},[e]),t}))})),Qv>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Qv++}return this.transcoderPending}load(t,e,n,i){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new Nu(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(t,(t=>{this.parse(t,e,i)}),n,i)}parse(t,e,n){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(kv.has(t))return kv.get(t).promise.then(e).catch(n);this._createTexture(t).then((t=>e?e(t):null)).catch(n)}_createTextureFrom(t,e){const{type:n,error:i,data:{faces:r,width:s,height:o,format:a,type:l,dfdFlags:c}}=t;if("error"===n)return Promise.reject(i);let h;if(6===e.faceCount)h=new Bc(r,a,l);else{const t=r[0].mipmaps;h=e.layerCount>1?new Ic(t,s,o,e.layerCount,a,l):new Sc(t,s,o,a,l)}return h.minFilter=1===r[0].mipmaps.length?$e:nn,h.magFilter=$e,h.generateMipmaps=!1,h.needsUpdate=!0,h.colorSpace=jv(e),h.premultiplyAlpha=!!(1&c),h}async _createTexture(t,e={}){const n=function(t){const e=new Uint8Array(t.buffer,t.byteOffset,Bv.length);if(e[0]!==Bv[0]||e[1]!==Bv[1]||e[2]!==Bv[2]||e[3]!==Bv[3]||e[4]!==Bv[4]||e[5]!==Bv[5]||e[6]!==Bv[6]||e[7]!==Bv[7]||e[8]!==Bv[8]||e[9]!==Bv[9]||e[10]!==Bv[10]||e[11]!==Bv[11])throw new Error("Missing KTX 2.0 identifier.");const n=new Sv,i=17*Uint32Array.BYTES_PER_ELEMENT,r=new Iv(t,Bv.length,i,!0);n.vkFormat=r._nextUint32(),n.typeSize=r._nextUint32(),n.pixelWidth=r._nextUint32(),n.pixelHeight=r._nextUint32(),n.pixelDepth=r._nextUint32(),n.layerCount=r._nextUint32(),n.faceCount=r._nextUint32();const s=r._nextUint32();n.supercompressionScheme=r._nextUint32();const o=r._nextUint32(),a=r._nextUint32(),l=r._nextUint32(),c=r._nextUint32(),h=r._nextUint64(),u=r._nextUint64(),d=new Iv(t,Bv.length+i,3*s*8,!0);for(let e=0;e<s;e++)n.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});const p=new Iv(t,o,a,!0),A={vendorId:p._skip(4)._nextUint16(),descriptorType:p._nextUint16(),versionNumber:p._nextUint16(),descriptorBlockSize:p._nextUint16(),colorModel:p._nextUint8(),colorPrimaries:p._nextUint8(),transferFunction:p._nextUint8(),flags:p._nextUint8(),texelBlockDimension:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],bytesPlane:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],samples:[]},f=(A.descriptorBlockSize/4-6)/4;for(let t=0;t<f;t++){const e={bitOffset:p._nextUint16(),bitLength:p._nextUint8(),channelType:p._nextUint8(),samplePosition:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&e.channelType?(e.sampleLower=p._nextInt32(),e.sampleUpper=p._nextInt32()):(e.sampleLower=p._nextUint32(),e.sampleUpper=p._nextUint32()),A.samples[t]=e}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(A);const m=new Iv(t,l,c,!0);for(;m._offset<c;){const t=m._nextUint32(),e=m._scan(t),i=Tv(e);if(n.keyValue[i]=m._nextUint8Array(t-e.byteLength-1),i.match(/^ktx/i)){const t=Tv(n.keyValue[i]);n.keyValue[i]=t.substring(0,t.lastIndexOf("\0"))}m._skip(t%4?4-t%4:0)}if(u<=0)return n;const g=new Iv(t,h,u,!0),v=g._nextUint16(),y=g._nextUint16(),E=g._nextUint32(),x=g._nextUint32(),b=g._nextUint32(),C=g._nextUint32(),w=[];for(let t=0;t<s;t++)w.push({imageFlags:g._nextUint32(),rgbSliceByteOffset:g._nextUint32(),rgbSliceByteLength:g._nextUint32(),alphaSliceByteOffset:g._nextUint32(),alphaSliceByteLength:g._nextUint32()});const _=h+g._offset,M=_+E,S=M+x,I=S+b,B=new Uint8Array(t.buffer,t.byteOffset+_,E),T=new Uint8Array(t.buffer,t.byteOffset+M,x),R=new Uint8Array(t.buffer,t.byteOffset+S,b),L=new Uint8Array(t.buffer,t.byteOffset+I,C);return n.globalData={endpointCount:v,selectorCount:y,imageDescs:w,endpointsData:B,selectorsData:T,tablesData:R,extendedData:L},n}(new Uint8Array(t)),i=n.vkFormat===Mv&&167===n.dataFormatDescriptor[0].colorModel;if(0!==n.vkFormat&&(!i||this.workerConfig.astcHDRSupported))return async function(t){const{vkFormat:e}=t;if(void 0===Hv[e])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let n;2===t.supercompressionScheme&&(Nv||(Nv=new Promise((async t=>{const e=new Ov;await e.init(),t(e)}))),n=await Nv);const i=[];for(let r=0;r<t.levels.length;r++){const s=Math.max(1,t.pixelWidth>>r),o=Math.max(1,t.pixelHeight>>r),a=t.pixelDepth?Math.max(1,t.pixelDepth>>r):0,l=t.levels[r];let c,h;if(0===t.supercompressionScheme)c=l.levelData;else{if(2!==t.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");c=n.decode(l.levelData,l.uncompressedByteLength)}h=Vv[e]===un?new Float32Array(c.buffer,c.byteOffset,c.byteLength/Float32Array.BYTES_PER_ELEMENT):Vv[e]===dn?new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT):c,i.push({data:h,width:s,height:o,depth:a})}let r;if(zv.has(Hv[e]))r=0===t.pixelDepth?new yl(i[0].data,t.pixelWidth,t.pixelHeight):new is(i[0].data,t.pixelWidth,t.pixelHeight,t.pixelDepth);else{if(t.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");r=new Sc(i,t.pixelWidth,t.pixelHeight),r.minFilter=1===i.length?$e:nn,r.magFilter=$e}return r.mipmaps=i,r.type=Vv[e],r.format=Hv[e],r.colorSpace=jv(t),r.needsUpdate=!0,Promise.resolve(r)}(n);const r=e,s=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:t,taskConfig:r},[t]))).then((t=>this._createTextureFrom(t.data,n)));return kv.set(t,{promise:s}),s}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Qv--,this}}Gv.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},Gv.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25},Gv.EngineFormat={RGBAFormat:yn,RGBA_ASTC_4x4_Format:Gn,RGB_BPTC_UNSIGNED_Format:ii,RGBA_BPTC_Format:ei,RGBA_ETC2_EAC_Format:Qn,RGBA_PVRTC_4BPPV1_Format:On,RGBA_S3TC_DXT5_Format:Dn,RGB_ETC1_Format:kn,RGB_ETC2_Format:Nn,RGB_PVRTC_4BPPV1_Format:Pn,RGBA_S3TC_DXT1_Format:Rn},Gv.EngineType={UnsignedByteType:sn,HalfFloatType:dn,FloatType:un},Gv.BasisWorker=function(){let t,e,n;const i=_EngineFormat,r=_EngineType,s=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",(function(i){const s=i.data;switch(s.type){case"init":t=s.config,a=s.transcoderBinary,e=new Promise((t=>{n={wasmBinary:a,onRuntimeInitialized:t},BASIS(n)})).then((()=>{n.initializeBasis(),void 0===n.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}));break;case"transcode":e.then((()=>{try{const{faces:e,buffers:i,width:a,height:u,hasAlpha:d,format:p,type:A,dfdFlags:f}=function(e){const i=new n.KTX2File(new Uint8Array(e));function s(){i.close(),i.delete()}if(!i.isValid())throw s(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");let a;if(i.isUASTC())a=o.UASTC;else if(i.isETC1S())a=o.ETC1S;else{if(!i.isHDR())throw new Error("THREE.KTX2Loader: Unknown Basis encoding");a=o.UASTC_HDR}const u=i.getWidth(),d=i.getHeight(),p=i.getLayers()||1,A=i.getLevels(),f=i.getFaces(),m=i.getHasAlpha(),g=i.getDFDFlags(),{transcoderFormat:v,engineFormat:y,engineType:E}=function(e,n,i,r){const s=l[e];for(let o=0;o<s.length;o++){const a=s[o];if((!a.if||t[a.if])&&(a.basisFormat.includes(e)&&!(r&&a.transcoderFormat.length<2)&&(!a.needsPowerOfTwo||c(n)&&c(i))))return{transcoderFormat:a.transcoderFormat[r?1:0],engineFormat:a.engineFormat[r?1:0],engineType:a.engineType[0]}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}(a,u,d,m);if(!u||!d||!A)throw s(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!i.startTranscoding())throw s(),new Error("THREE.KTX2Loader: .startTranscoding failed");const x=[],b=[];for(let t=0;t<f;t++){const e=[];for(let n=0;n<A;n++){const o=[];let a,l;for(let e=0;e<p;e++){const c=i.getImageLevelInfo(n,e,t);0!==t||0!==n||0!==e||c.origWidth%4==0&&c.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),A>1?(a=c.origWidth,l=c.origHeight):(a=c.width,l=c.height);let h=new Uint8Array(i.getImageTranscodedSizeInBytes(n,e,0,v));const u=i.transcodeImage(h,n,e,t,v,0,-1,-1);if(E===r.HalfFloatType&&(h=new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!u)throw s(),new Error("THREE.KTX2Loader: .transcodeImage failed.");o.push(h)}const c=h(o);e.push({data:c,width:a,height:l}),b.push(c.buffer)}x.push({mipmaps:e,width:u,height:d,format:y,type:E})}return s(),{faces:x,buffers:b,width:u,height:d,hasAlpha:m,dfdFlags:g,format:y,type:E}}(s.buffer);self.postMessage({type:"transcode",id:s.id,data:{faces:e,width:a,height:u,hasAlpha:d,format:p,type:A,dfdFlags:f}},i)}catch(t){console.error(t),self.postMessage({type:"error",id:s.id,error:t.message})}}))}var a}));const a=[{if:"astcSupported",basisFormat:[o.UASTC],transcoderFormat:[s.ASTC_4x4,s.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],engineType:[r.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC7_M5,s.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],engineType:[r.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC1,s.BC3],engineFormat:[i.RGBA_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],engineType:[r.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1,s.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],engineType:[r.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1],engineFormat:[i.RGB_ETC1_Format],engineType:[r.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.PVRTC1_4_RGB,s.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],engineType:[r.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[o.UASTC_HDR],transcoderFormat:[s.BC6H],engineFormat:[i.RGB_BPTC_UNSIGNED_Format],engineType:[r.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.RGBA32,s.RGBA32],engineFormat:[i.RGBAFormat,i.RGBAFormat],engineType:[r.UnsignedByteType,r.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[o.UASTC_HDR],transcoderFormat:[s.RGBA_HALF],engineFormat:[i.RGBAFormat],engineType:[r.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],l={[o.ETC1S]:a.filter((t=>t.basisFormat.includes(o.ETC1S))).sort(((t,e)=>t.priorityUASTC-e.priorityUASTC)),[o.UASTC]:a.filter((t=>t.basisFormat.includes(o.UASTC))).sort(((t,e)=>t.priorityUASTC-e.priorityUASTC)),[o.UASTC_HDR]:a.filter((t=>t.basisFormat.includes(o.UASTC_HDR))).sort(((t,e)=>t.priorityHDR-e.priorityHDR))};function c(t){return t<=2||!(t&t-1)&&0!==t}function h(t){if(1===t.length)return t[0];let e=0;for(let n=0;n<t.length;n++)e+=t[n].byteLength;const n=new Uint8Array(e);let i=0;for(let e=0;e<t.length;e++){const r=t[e];n.set(r,i),i+=r.byteLength}return n}};const zv=new Set([yn,Mn,wn]),Hv={[Cv]:yn,[Ev]:yn,[mv]:yn,[gv]:yn,[bv]:Mn,[yv]:Mn,[Av]:Mn,[fv]:Mn,[xv]:wn,[vv]:wn,[pv]:wn,[dv]:wn,[Mv]:Gn,[_v]:jn,[wv]:jn},Vv={[Cv]:un,[Ev]:dn,[mv]:sn,[gv]:sn,[bv]:un,[yv]:dn,[Av]:sn,[fv]:sn,[xv]:un,[vv]:dn,[pv]:sn,[dv]:sn,[Mv]:dn,[_v]:sn,[wv]:sn};function jv(t){const e=t.dataFormatDescriptor[0];return 1===e.colorPrimaries?2===e.transferFunction?Bi:Ti:10===e.colorPrimaries?2===e.transferFunction?"display-p3":"display-p3-linear":(0===e.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),Ii)}const Wv={c:null,u:[new os,new os,new os],e:[]},qv={c:null,u:[new os,new os,new os],e:[]},Xv=[[],[],[]],Yv=[[],[],[]],Jv=[],Kv=new os,Zv=new os,$v=new os,ty=new os,ey=new os,ny=new os,iy=new Tr,ry=new cs,sy=new Os,oy=new Os,ay=new Us;class ly{constructor(t=new os,e=new os,n=new Tr){this.center=t,this.halfSize=e,this.rotation=n}set(t,e,n){return this.center=t,this.halfSize=e,this.rotation=n,this}copy(t){return this.center.copy(t.center),this.halfSize.copy(t.halfSize),this.rotation.copy(t.rotation),this}clone(){return(new this.constructor).copy(this)}getSize(t){return t.copy(this.halfSize).multiplyScalar(2)}clampPoint(t,e){const n=this.halfSize;ty.subVectors(t,this.center),this.rotation.extractBasis(Kv,Zv,$v),e.copy(this.center);const i=Ir.clamp(ty.dot(Kv),-n.x,n.x);e.add(Kv.multiplyScalar(i));const r=Ir.clamp(ty.dot(Zv),-n.y,n.y);e.add(Zv.multiplyScalar(r));const s=Ir.clamp(ty.dot($v),-n.z,n.z);return e.add($v.multiplyScalar(s)),e}containsPoint(t){return ty.subVectors(t,this.center),this.rotation.extractBasis(Kv,Zv,$v),Math.abs(ty.dot(Kv))<=this.halfSize.x&&Math.abs(ty.dot(Zv))<=this.halfSize.y&&Math.abs(ty.dot($v))<=this.halfSize.z}intersectsBox3(t){return this.intersectsOBB(cy.fromBox3(t))}intersectsSphere(t){return this.clampPoint(t.center,ny),ny.distanceToSquared(t.center)<=t.radius*t.radius}intersectsOBB(t,e=Number.EPSILON){Wv.c=this.center,Wv.e[0]=this.halfSize.x,Wv.e[1]=this.halfSize.y,Wv.e[2]=this.halfSize.z,this.rotation.extractBasis(Wv.u[0],Wv.u[1],Wv.u[2]),qv.c=t.center,qv.e[0]=t.halfSize.x,qv.e[1]=t.halfSize.y,qv.e[2]=t.halfSize.z,t.rotation.extractBasis(qv.u[0],qv.u[1],qv.u[2]);for(let t=0;t<3;t++)for(let e=0;e<3;e++)Xv[t][e]=Wv.u[t].dot(qv.u[e]);ty.subVectors(qv.c,Wv.c),Jv[0]=ty.dot(Wv.u[0]),Jv[1]=ty.dot(Wv.u[1]),Jv[2]=ty.dot(Wv.u[2]);for(let t=0;t<3;t++)for(let n=0;n<3;n++)Yv[t][n]=Math.abs(Xv[t][n])+e;let n,i;for(let t=0;t<3;t++)if(n=Wv.e[t],i=qv.e[0]*Yv[t][0]+qv.e[1]*Yv[t][1]+qv.e[2]*Yv[t][2],Math.abs(Jv[t])>n+i)return!1;for(let t=0;t<3;t++)if(n=Wv.e[0]*Yv[0][t]+Wv.e[1]*Yv[1][t]+Wv.e[2]*Yv[2][t],i=qv.e[t],Math.abs(Jv[0]*Xv[0][t]+Jv[1]*Xv[1][t]+Jv[2]*Xv[2][t])>n+i)return!1;return n=Wv.e[1]*Yv[2][0]+Wv.e[2]*Yv[1][0],i=qv.e[1]*Yv[0][2]+qv.e[2]*Yv[0][1],!(Math.abs(Jv[2]*Xv[1][0]-Jv[1]*Xv[2][0])>n+i||(n=Wv.e[1]*Yv[2][1]+Wv.e[2]*Yv[1][1],i=qv.e[0]*Yv[0][2]+qv.e[2]*Yv[0][0],Math.abs(Jv[2]*Xv[1][1]-Jv[1]*Xv[2][1])>n+i||(n=Wv.e[1]*Yv[2][2]+Wv.e[2]*Yv[1][2],i=qv.e[0]*Yv[0][1]+qv.e[1]*Yv[0][0],Math.abs(Jv[2]*Xv[1][2]-Jv[1]*Xv[2][2])>n+i||(n=Wv.e[0]*Yv[2][0]+Wv.e[2]*Yv[0][0],i=qv.e[1]*Yv[1][2]+qv.e[2]*Yv[1][1],Math.abs(Jv[0]*Xv[2][0]-Jv[2]*Xv[0][0])>n+i||(n=Wv.e[0]*Yv[2][1]+Wv.e[2]*Yv[0][1],i=qv.e[0]*Yv[1][2]+qv.e[2]*Yv[1][0],Math.abs(Jv[0]*Xv[2][1]-Jv[2]*Xv[0][1])>n+i||(n=Wv.e[0]*Yv[2][2]+Wv.e[2]*Yv[0][2],i=qv.e[0]*Yv[1][1]+qv.e[1]*Yv[1][0],Math.abs(Jv[0]*Xv[2][2]-Jv[2]*Xv[0][2])>n+i||(n=Wv.e[0]*Yv[1][0]+Wv.e[1]*Yv[0][0],i=qv.e[1]*Yv[2][2]+qv.e[2]*Yv[2][1],Math.abs(Jv[1]*Xv[0][0]-Jv[0]*Xv[1][0])>n+i||(n=Wv.e[0]*Yv[1][1]+Wv.e[1]*Yv[0][1],i=qv.e[0]*Yv[2][2]+qv.e[2]*Yv[2][0],Math.abs(Jv[1]*Xv[0][1]-Jv[0]*Xv[1][1])>n+i||(n=Wv.e[0]*Yv[1][2]+Wv.e[1]*Yv[0][2],i=qv.e[0]*Yv[2][1]+qv.e[1]*Yv[2][0],Math.abs(Jv[1]*Xv[0][2]-Jv[0]*Xv[1][2])>n+i)))))))))}intersectsPlane(t){this.rotation.extractBasis(Kv,Zv,$v);const e=this.halfSize.x*Math.abs(t.normal.dot(Kv))+this.halfSize.y*Math.abs(t.normal.dot(Zv))+this.halfSize.z*Math.abs(t.normal.dot($v)),n=t.normal.dot(this.center)-t.constant;return Math.abs(n)<=e}intersectRay(t,e){return this.getSize(ey),ry.setFromCenterAndSize(ty.set(0,0,0),ey),sy.setFromMatrix3(this.rotation),sy.setPosition(this.center),oy.copy(sy).invert(),ay.copy(t).applyMatrix4(oy),ay.intersectBox(ry,e)?e.applyMatrix4(sy):null}intersectsRay(t){return null!==this.intersectRay(t,ty)}fromBox3(t){return t.getCenter(this.center),t.getSize(this.halfSize).multiplyScalar(.5),this.rotation.identity(),this}equals(t){return t.center.equals(this.center)&&t.halfSize.equals(this.halfSize)&&t.rotation.equals(this.rotation)}applyMatrix4(t){const e=t.elements;let n=ty.set(e[0],e[1],e[2]).length();const i=ty.set(e[4],e[5],e[6]).length(),r=ty.set(e[8],e[9],e[10]).length();t.determinant()<0&&(n=-n),iy.setFromMatrix4(t);const s=1/n,o=1/i,a=1/r;return iy.elements[0]*=s,iy.elements[1]*=s,iy.elements[2]*=s,iy.elements[3]*=o,iy.elements[4]*=o,iy.elements[5]*=o,iy.elements[6]*=a,iy.elements[7]*=a,iy.elements[8]*=a,this.rotation.multiply(iy),this.halfSize.x*=n,this.halfSize.y*=i,this.halfSize.z*=r,ty.setFromMatrixPosition(t),this.center.add(ty),this}}const cy=new ly,hy=/^[og]\s*(.+)?/,uy=/^mtllib /,dy=/^usemtl /,py=/^usemap /,Ay=/\s+/,fy=new os,my=new os,gy=new os,vy=new os,yy=new os,Ey=new Bo;function xy(){const t={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(t,e){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=t,void(this.object.fromDeclaration=!1!==e);const n=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:t||"",fromDeclaration:!1!==e,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(t,e){const n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);const i={index:this.materials.length,name:t||"",mtllib:Array.isArray(e)&&e.length>0?e[e.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(t){const e={index:"number"==typeof t?t:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return e.clone=this.clone.bind(e),e}};return this.materials.push(i),i},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(t){const e=this.currentMaterial();if(e&&-1===e.groupEnd&&(e.groupEnd=this.geometry.vertices.length/3,e.groupCount=e.groupEnd-e.groupStart,e.inherited=!1),t&&this.materials.length>1)for(let t=this.materials.length-1;t>=0;t--)this.materials[t].groupCount<=0&&this.materials.splice(t,1);return t&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),e}},n&&n.name&&"function"==typeof n.clone){const t=n.clone(0);t.inherited=!0,this.object.materials.push(t)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(t,e){const n=parseInt(t,10);return 3*(n>=0?n-1:n+e/3)},parseNormalIndex:function(t,e){const n=parseInt(t,10);return 3*(n>=0?n-1:n+e/3)},parseUVIndex:function(t,e){const n=parseInt(t,10);return 2*(n>=0?n-1:n+e/2)},addVertex:function(t,e,n){const i=this.vertices,r=this.object.geometry.vertices;r.push(i[t+0],i[t+1],i[t+2]),r.push(i[e+0],i[e+1],i[e+2]),r.push(i[n+0],i[n+1],i[n+2])},addVertexPoint:function(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addVertexLine:function(t){const e=this.vertices;this.object.geometry.vertices.push(e[t+0],e[t+1],e[t+2])},addNormal:function(t,e,n){const i=this.normals,r=this.object.geometry.normals;r.push(i[t+0],i[t+1],i[t+2]),r.push(i[e+0],i[e+1],i[e+2]),r.push(i[n+0],i[n+1],i[n+2])},addFaceNormal:function(t,e,n){const i=this.vertices,r=this.object.geometry.normals;fy.fromArray(i,t),my.fromArray(i,e),gy.fromArray(i,n),yy.subVectors(gy,my),vy.subVectors(fy,my),yy.cross(vy),yy.normalize(),r.push(yy.x,yy.y,yy.z),r.push(yy.x,yy.y,yy.z),r.push(yy.x,yy.y,yy.z)},addColor:function(t,e,n){const i=this.colors,r=this.object.geometry.colors;void 0!==i[t]&&r.push(i[t+0],i[t+1],i[t+2]),void 0!==i[e]&&r.push(i[e+0],i[e+1],i[e+2]),void 0!==i[n]&&r.push(i[n+0],i[n+1],i[n+2])},addUV:function(t,e,n){const i=this.uvs,r=this.object.geometry.uvs;r.push(i[t+0],i[t+1]),r.push(i[e+0],i[e+1]),r.push(i[n+0],i[n+1])},addDefaultUV:function(){const t=this.object.geometry.uvs;t.push(0,0),t.push(0,0),t.push(0,0)},addUVLine:function(t){const e=this.uvs;this.object.geometry.uvs.push(e[t+0],e[t+1])},addFace:function(t,e,n,i,r,s,o,a,l){const c=this.vertices.length;let h=this.parseVertexIndex(t,c),u=this.parseVertexIndex(e,c),d=this.parseVertexIndex(n,c);if(this.addVertex(h,u,d),this.addColor(h,u,d),void 0!==o&&""!==o){const t=this.normals.length;h=this.parseNormalIndex(o,t),u=this.parseNormalIndex(a,t),d=this.parseNormalIndex(l,t),this.addNormal(h,u,d)}else this.addFaceNormal(h,u,d);if(void 0!==i&&""!==i){const t=this.uvs.length;h=this.parseUVIndex(i,t),u=this.parseUVIndex(r,t),d=this.parseUVIndex(s,t),this.addUV(h,u,d),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(t){this.object.geometry.type="Points";const e=this.vertices.length;for(let n=0,i=t.length;n<i;n++){const i=this.parseVertexIndex(t[n],e);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(t,e){this.object.geometry.type="Line";const n=this.vertices.length,i=this.uvs.length;for(let e=0,i=t.length;e<i;e++)this.addVertexLine(this.parseVertexIndex(t[e],n));for(let t=0,n=e.length;t<n;t++)this.addUVLine(this.parseUVIndex(e[t],i))}};return t.startObject("",!1),t}class by{constructor(t="",e={}){this.baseUrl=t,this.options=e,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=void 0!==this.options.side?this.options.side:Ht,this.wrap=void 0!==this.options.wrap?this.options.wrap:je}setCrossOrigin(t){return this.crossOrigin=t,this}setManager(t){this.manager=t}setMaterials(t){this.materialsInfo=this.convert(t),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(t){if(!this.options)return t;const e={};for(const n in t){const i=t[n],r={};e[n]=r;for(const t in i){let e=!0,n=i[t];const s=t.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]&&(e=!1)}e&&(r[s]=n)}}return e}preload(){for(const t in this.materialsInfo)this.create(t)}getIndex(t){return this.nameLookup[t]}getAsArray(){let t=0;for(const e in this.materialsInfo)this.materialsArray[t]=this.create(e),this.nameLookup[e]=t,t++;return this.materialsArray}create(t){return void 0===this.materials[t]&&this.createMaterial_(t),this.materials[t]}createMaterial_(t){const e=this,n=this.materialsInfo[t],i={name:t,side:this.side};function r(t,n){if(i[t])return;const r=e.getTextureParams(n,i),s=e.loadTexture((o=e.baseUrl,"string"!=typeof(a=r.url)||""===a?"":/^https?:\/\//i.test(a)?a:o+a));var o,a;s.repeat.copy(r.scale),s.offset.copy(r.offset),s.wrapS=e.wrap,s.wrapT=e.wrap,"map"!==t&&"emissiveMap"!==t||(s.colorSpace=Bi),i[t]=s}for(const t in n){const e=n[t];let s;if(""!==e)switch(t.toLowerCase()){case"kd":i.color=zr.toWorkingColorSpace((new Bo).fromArray(e),Bi);break;case"ks":i.specular=zr.toWorkingColorSpace((new Bo).fromArray(e),Bi);break;case"ke":i.emissive=zr.toWorkingColorSpace((new Bo).fromArray(e),Bi);break;case"map_kd":r("map",e);break;case"map_ks":r("specularMap",e);break;case"map_ke":r("emissiveMap",e);break;case"norm":r("normalMap",e);break;case"map_bump":case"bump":r("bumpMap",e);break;case"map_d":r("alphaMap",e),i.transparent=!0;break;case"ns":i.shininess=parseFloat(e);break;case"d":s=parseFloat(e),s<1&&(i.opacity=s,i.transparent=!0);break;case"tr":s=parseFloat(e),this.options&&this.options.invertTrProperty&&(s=1-s),s>0&&(i.opacity=1-s,i.transparent=!0)}}return this.materials[t]=new su(i),this.materials[t]}getTextureParams(t,e){const n={scale:new Br(1,1),offset:new Br(0,0)},i=t.split(/\s+/);let r;return r=i.indexOf("-bm"),r>=0&&(e.bumpScale=parseFloat(i[r+1]),i.splice(r,2)),r=i.indexOf("-s"),r>=0&&(n.scale.set(parseFloat(i[r+1]),parseFloat(i[r+2])),i.splice(r,4)),r=i.indexOf("-o"),r>=0&&(n.offset.set(parseFloat(i[r+1]),parseFloat(i[r+2])),i.splice(r,4)),n.url=i.join(" ").trim(),n}loadTexture(t,e,n,i,r){const s=void 0!==this.manager?this.manager:Uu;let o=s.getHandler(t);null===o&&(o=new ju(s)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin);const a=o.load(t,n,i,r);return void 0!==e&&(a.mapping=e),a}}function Cy(t,e){switch(e){case Bi:t.convertSRGBToLinear();break;case Ti:case Ii:break;default:console.warn("WARNING: LightProbeGenerator convertColorToLinear() encountered an unsupported color space.")}return t}var wy=globalThis.THREE={...t};wy.DRACOLoader=class extends Ou{constructor(t){super(t),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,n,i){const r=new Nu(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,(t=>{this.parse(t,e,i)}),n,i)}parse(t,e,n=()=>{}){this.decodeDracoFile(t,e,null,null,Bi,n).catch(n)}decodeDracoFile(t,e,n,i,r=Ti,s=()=>{}){const o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(t,o).then(e).catch(s)}decodeGeometry(t,e){const n=JSON.stringify(e);if(Fm.has(t)){const e=Fm.get(t);if(e.key===n)return e.promise;if(0===t.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,s=t.byteLength,o=this._getWorker(r,s).then((n=>(i=n,new Promise(((n,s)=>{i._callbacks[r]={resolve:n,reject:s},i.postMessage({type:"decode",id:r,taskConfig:e,buffer:t},[t])}))))).then((t=>this._createGeometry(t.geometry)));return o.catch((()=>!0)).then((()=>{i&&r&&this._releaseTask(i,r)})),Fm.set(t,{key:n,promise:o}),o}_createGeometry(t){const e=new sa;t.index&&e.setIndex(new zo(t.index.array,1));for(let n=0;n<t.attributes.length;n++){const i=t.attributes[n],r=i.name,s=i.array,o=i.itemSize,a=new zo(s,o);"color"===r&&(this._assignVertexColorSpace(a,i.vertexColorSpace),a.normalized=s instanceof Float32Array==0),e.setAttribute(r,a)}return e}_assignVertexColorSpace(t,e){if(e!==Bi)return;const n=new Bo;for(let e=0,i=t.count;e<i;e++)n.fromBufferAttribute(t,e),zr.toWorkingColorSpace(n,Bi),t.setXYZ(e,n.r,n.g,n.b)}_loadLibrary(t,e){const n=new Nu(this.manager);return n.setPath(this.decoderPath),n.setResponseType(e),n.setWithCredentials(this.withCredentials),new Promise(((e,i)=>{n.load(t,e,void 0,i)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const t="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,e=[];return t?e.push(this._loadLibrary("draco_decoder.js","text")):(e.push(this._loadLibrary("draco_wasm_wrapper.js","text")),e.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(e).then((e=>{const n=e[0];t||(this.decoderConfig.wasmBinary=e[1]);const i=km.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))})),this.decoderPending}_getWorker(t,e){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const t=new Worker(this.workerSourceURL);t._callbacks={},t._taskCosts={},t._taskLoad=0,t.postMessage({type:"init",decoderConfig:this.decoderConfig}),t.onmessage=function(e){const n=e.data;switch(n.type){case"decode":t._callbacks[n.id].resolve(n);break;case"error":t._callbacks[n.id].reject(n);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+n.type+'"')}},this.workerPool.push(t)}else this.workerPool.sort((function(t,e){return t._taskLoad>e._taskLoad?-1:1}));const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[t]=e,n._taskLoad+=e,n}))}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map((t=>t._taskLoad)))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}},wy.GLTFLoader=class extends Ou{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(t){return new wg(t)})),this.register((function(t){return new _g(t)})),this.register((function(t){return new Pg(t)})),this.register((function(t){return new Ug(t)})),this.register((function(t){return new Og(t)})),this.register((function(t){return new Sg(t)})),this.register((function(t){return new Ig(t)})),this.register((function(t){return new Bg(t)})),this.register((function(t){return new Tg(t)})),this.register((function(t){return new Cg(t)})),this.register((function(t){return new Rg(t)})),this.register((function(t){return new Mg(t)})),this.register((function(t){return new Dg(t)})),this.register((function(t){return new Lg(t)})),this.register((function(t){return new xg(t)})),this.register((function(t){return new Fg(t)})),this.register((function(t){return new kg(t)}))}load(t,e,n,i){const r=this;let s;if(""!==this.resourcePath)s=this.resourcePath;else if(""!==this.path){const e=pd.extractUrlBase(t);s=pd.resolveURL(e,this.path)}else s=pd.extractUrlBase(t);this.manager.itemStart(t);const o=function(e){i?i(e):console.error(e),r.manager.itemError(t),r.manager.itemEnd(t)},a=new Nu(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(t,(function(n){try{r.parse(n,s,(function(n){e(n),r.manager.itemEnd(t)}),o)}catch(t){o(t)}}),n,o)}setDRACOLoader(t){return this.dracoLoader=t,this}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,n,i){let r;const s={},o={},a=new TextDecoder;if("string"==typeof t)r=JSON.parse(t);else if(t instanceof ArrayBuffer)if(a.decode(new Uint8Array(t,0,4))===Ng){try{s[$m]=new Qg(t)}catch(t){return void(i&&i(t))}r=JSON.parse(s[$m].content)}else r=JSON.parse(a.decode(t));else r=t;if(void 0===r.asset||r.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new cv(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let t=0;t<this.pluginCallbacks.length;t++){const e=this.pluginCallbacks[t](l);e.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[e.name]=e,s[e.name]=!0}if(r.extensionsUsed)for(let t=0;t<r.extensionsUsed.length;++t){const e=r.extensionsUsed[t],n=r.extensionsRequired||[];switch(e){case hg:s[e]=new bg;break;case tg:s[e]=new Gg(r,this.dracoLoader);break;case pg:s[e]=new zg;break;case Ag:s[e]=new Hg;break;default:n.indexOf(e)>=0&&void 0===o[e]&&console.warn('THREE.GLTFLoader: Unknown extension "'+e+'".')}}l.setExtensions(s),l.setPlugins(o),l.parse(n,i)}parseAsync(t,e){const n=this;return new Promise((function(i,r){n.parse(t,e,i,r)}))}},wy.KTX2Loader=Gv,wy.OBJLoader=class extends Ou{constructor(t){super(t),this.materials=null}load(t,e,n,i){const r=this,s=new Nu(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(t,(function(n){try{e(r.parse(n))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}setMaterials(t){return this.materials=t,this}parse(t){const e=new xy;-1!==t.indexOf("\r\n")&&(t=t.replace(/\r\n/g,"\n")),-1!==t.indexOf("\\\n")&&(t=t.replace(/\\\n/g,""));const n=t.split("\n");let i=[];for(let t=0,r=n.length;t<r;t++){const r=n[t].trimStart();if(0===r.length)continue;const s=r.charAt(0);if("#"!==s)if("v"===s){const t=r.split(Ay);switch(t[0]){case"v":e.vertices.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3])),t.length>=7?(Ey.setRGB(parseFloat(t[4]),parseFloat(t[5]),parseFloat(t[6]),Bi),e.colors.push(Ey.r,Ey.g,Ey.b)):e.colors.push(void 0,void 0,void 0);break;case"vn":e.normals.push(parseFloat(t[1]),parseFloat(t[2]),parseFloat(t[3]));break;case"vt":e.uvs.push(parseFloat(t[1]),parseFloat(t[2]))}}else if("f"===s){const t=r.slice(1).trim().split(Ay),n=[];for(let e=0,i=t.length;e<i;e++){const i=t[e];if(i.length>0){const t=i.split("/");n.push(t)}}const i=n[0];for(let t=1,r=n.length-1;t<r;t++){const r=n[t],s=n[t+1];e.addFace(i[0],r[0],s[0],i[1],r[1],s[1],i[2],r[2],s[2])}}else if("l"===s){const t=r.substring(1).trim().split(" ");let n=[];const i=[];if(-1===r.indexOf("/"))n=t;else for(let e=0,r=t.length;e<r;e++){const r=t[e].split("/");""!==r[0]&&n.push(r[0]),""!==r[1]&&i.push(r[1])}e.addLineGeometry(n,i)}else if("p"===s){const t=r.slice(1).trim().split(" ");e.addPointGeometry(t)}else if(null!==(i=hy.exec(r))){const t=(" "+i[0].slice(1).trim()).slice(1);e.startObject(t)}else if(dy.test(r))e.object.startMaterial(r.substring(7).trim(),e.materialLibraries);else if(uy.test(r))e.materialLibraries.push(r.substring(7).trim());else if(py.test(r))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if("s"===s){if(i=r.split(" "),i.length>1){const t=i[1].trim().toLowerCase();e.object.smooth="0"!==t&&"off"!==t}else e.object.smooth=!0;const t=e.object.currentMaterial();t&&(t.smooth=e.object.smooth)}else{if("\0"===r)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+r+'"')}}e.finalize();const r=new Pa;if(r.materialLibraries=[].concat(e.materialLibraries),!0==!(1===e.objects.length&&0===e.objects[0].geometry.vertices.length))for(let t=0,n=e.objects.length;t<n;t++){const n=e.objects[t],i=n.geometry,s=n.materials,o="Line"===i.type,a="Points"===i.type;let l=!1;if(0===i.vertices.length)continue;const c=new sa;c.setAttribute("position",new Ko(i.vertices,3)),i.normals.length>0&&c.setAttribute("normal",new Ko(i.normals,3)),i.colors.length>0&&(l=!0,c.setAttribute("color",new Ko(i.colors,3))),!0===i.hasUVIndices&&c.setAttribute("uv",new Ko(i.uvs,2));const h=[];for(let t=0,n=s.length;t<n;t++){const n=s[t],i=n.name+"_"+n.smooth+"_"+l;let r=e.materials[i];if(null!==this.materials)if(r=this.materials.create(n.name),!o||!r||r instanceof ic){if(a&&r&&!(r instanceof gc)){const t=new gc({size:10,sizeAttenuation:!1});Lo.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,r=t}}else{const t=new ic;Lo.prototype.copy.call(t,r),t.color.copy(r.color),r=t}void 0===r&&(r=o?new ic:a?new gc({size:1,sizeAttenuation:!1}):new su,r.name=n.name,r.flatShading=!n.smooth,r.vertexColors=l,e.materials[i]=r),h.push(r)}let u;if(h.length>1){for(let t=0,e=s.length;t<e;t++){const e=s[t];c.addGroup(e.groupStart,e.groupCount,t)}u=o?new fc(c,h):a?new bc(c,h):new ga(c,h)}else u=o?new fc(c,h[0]):a?new bc(c,h[0]):new ga(c,h[0]);u.name=n.name,r.add(u)}else if(e.vertices.length>0){const t=new gc({size:1,sizeAttenuation:!1}),n=new sa;n.setAttribute("position",new Ko(e.vertices,3)),e.colors.length>0&&void 0!==e.colors[0]&&(n.setAttribute("color",new Ko(e.colors,3)),t.vertexColors=!0);const i=new bc(n,t);r.add(i)}return r}},wy.MTLLoader=class extends Ou{constructor(t){super(t)}load(t,e,n,i){const r=this,s=""===this.path?pd.extractUrlBase(t):this.path,o=new Nu(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,(function(n){try{e(r.parse(n,s))}catch(e){i?i(e):console.error(e),r.manager.itemError(t)}}),n,i)}setMaterialOptions(t){return this.materialOptions=t,this}parse(t,e){const n=t.split("\n");let i={};const r=/\s+/,s={};for(let t=0;t<n.length;t++){let e=n[t];if(e=e.trim(),0===e.length||"#"===e.charAt(0))continue;const o=e.indexOf(" ");let a=o>=0?e.substring(0,o):e;a=a.toLowerCase();let l=o>=0?e.substring(o+1):"";if(l=l.trim(),"newmtl"===a)i={name:l},s[l]=i;else if("ka"===a||"kd"===a||"ks"===a||"ke"===a){const t=l.split(r,3);i[a]=[parseFloat(t[0]),parseFloat(t[1]),parseFloat(t[2])]}else i[a]=l}const o=new by(this.resourcePath||e,this.materialOptions);return o.setCrossOrigin(this.crossOrigin),o.setManager(this.manager),o.setMaterials(s),o}},wy.OBB=ly,wy.BufferGeometryUtils=e,wy.LightProbeGenerator=class{static fromCubeTexture(t){let e=0;const n=new os,i=new os,r=new Bo,s=[0,0,0,0,0,0,0,0,0],o=new hd,a=o.coefficients;for(let o=0;o<6;o++){const l=t.image[o],c=l.width,h=l.height,u=document.createElement("canvas");u.width=c,u.height=h;const d=u.getContext("2d");d.drawImage(l,0,0,c,h);const p=d.getImageData(0,0,c,h),A=p.data,f=p.width,m=2/f;for(let l=0,c=A.length;l<c;l+=4){r.setRGB(A[l]/255,A[l+1]/255,A[l+2]/255),Cy(r,t.colorSpace);const c=l/4,h=(c%f+.5)*m-1,u=1-(Math.floor(c/f)+.5)*m;switch(o){case 0:n.set(-1,u,-h);break;case 1:n.set(1,u,h);break;case 2:n.set(-h,1,-u);break;case 3:n.set(-h,-1,u);break;case 4:n.set(-h,u,1);break;case 5:n.set(h,u,-1)}const d=n.lengthSq(),p=4/(Math.sqrt(d)*d);e+=p,i.copy(n).normalize(),hd.getBasisAt(i,s);for(let t=0;t<9;t++)a[t].x+=s[t]*r.r*p,a[t].y+=s[t]*r.g*p,a[t].z+=s[t]*r.b*p}}const l=4*Math.PI/e;for(let t=0;t<9;t++)a[t].x*=l,a[t].y*=l,a[t].z*=l;return new ud(o)}static async fromCubeRenderTarget(t,e){const n=t.coordinateSystem===Ar?-1:1;let i=0;const r=new os,s=new os,o=new Bo,a=[0,0,0,0,0,0,0,0,0],l=new hd,c=l.coefficients,h=e.texture.type,u=e.width;let d;t.isWebGLRenderer&&(d=h===dn?new Uint16Array(u*u*4):new Uint8Array(u*u*4));for(let l=0;l<6;l++){t.isWebGLRenderer?await t.readRenderTargetPixelsAsync(e,0,0,u,u,d,l):d=await t.readRenderTargetPixelsAsync(e,0,0,u,u,0,l);const p=2/u;for(let t=0,A=d.length;t<A;t+=4){let A,f,m;h===dn?(A=ko.fromHalfFloat(d[t]),f=ko.fromHalfFloat(d[t+1]),m=ko.fromHalfFloat(d[t+2])):(A=d[t]/255,f=d[t+1]/255,m=d[t+2]/255),o.setRGB(A,f,m),Cy(o,e.texture.colorSpace);const g=t/4,v=(1-(g%u+.5)*p)*n,y=1-(Math.floor(g/u)+.5)*p;switch(l){case 0:r.set(-1*n,y,v*n);break;case 1:r.set(1*n,y,-v*n);break;case 2:r.set(v,1,-y);break;case 3:r.set(v,-1,y);break;case 4:r.set(v,y,1);break;case 5:r.set(-v,y,-1)}const E=r.lengthSq(),x=4/(Math.sqrt(E)*E);i+=x,s.copy(r).normalize(),hd.getBasisAt(s,a);for(let t=0;t<9;t++)c[t].x+=a[t]*o.r*x,c[t].y+=a[t]*o.g*x,c[t].z+=a[t]*o.b*x}}const p=4*Math.PI/i;for(let t=0;t<9;t++)c[t].x*=p,c[t].y*=p,c[t].z*=p;return new ud(l)}},wy.DeviceOrientationControls=function(t){var e=this;this.object=t,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0,this.alphaOffset=0;var n,i,r,s,o=function(t){e.deviceOrientation=t},a=function(){e.screenOrientation=window.orientation||0},l=(n=new THREE.Vector3(0,0,1),i=new THREE.Euler,r=new THREE.Quaternion,s=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),function(t,e,o,a,l){i.set(o,e,-a,"YXZ"),t.setFromEuler(i),t.multiply(s),t.multiply(r.setFromAxisAngle(n,-l))});this.connect=function(){a(),window.addEventListener("orientationchange",a,!1),window.addEventListener("deviceorientation",o,!1),e.enabled=!0},this.disconnect=function(){window.removeEventListener("orientationchange",a,!1),window.removeEventListener("deviceorientation",o,!1),e.enabled=!1},this.update=function(){if(!1!==e.enabled){var t=e.deviceOrientation;if(t){var n=t.alpha?THREE.MathUtils.degToRad(t.alpha)+e.alphaOffset:0,i=t.beta?THREE.MathUtils.degToRad(t.beta):0,r=t.gamma?THREE.MathUtils.degToRad(t.gamma):0,s=e.screenOrientation?THREE.MathUtils.degToRad(e.screenOrientation):0;l(e.object.quaternion,n,i,r,s)}}},this.dispose=function(){e.disconnect()},this.connect()},wy.Cache.enabled=!0;const _y=wy;var My=window.AFRAME_CDN_ROOT||"https://cdn.aframe.io/",Sy="aframe-injected",Iy=n(8878),By=n.n(Iy),Ty={colors:{debug:"gray",error:"red",info:"gray",warn:"orange"}};By().formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" "),this.useColors){var e;this.color=(e=function(t){var e=t.split(":");return e[e.length-1]}(this.namespace),Ty.colors&&Ty.colors[e]||null);var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var i=0,r=0;t[0].replace(/%[a-zA-Z%]/g,(function(t){"%%"!==t&&(i++,"%c"===t&&(r=i))})),t.splice(r,0,n)}};var Ry=function(){try{return window.localStorage}catch(t){}}();Ry&&(parseInt(Ry.logs,10)||"true"===Ry.logs)?By().enable("*"):By().enable("*:error,*:info,*:warn");const Ly=By();var Dy=n(1124),Py=n.n(Dy),Uy=Ly("device:error"),Oy=!1,Fy=!1,ky=void 0!==navigator.xr;if(ky){var Ny=function(){var t=document.querySelector("a-scene");t?t.hasLoaded?t.components["xr-mode-ui"].updateEnterInterfaces():t.addEventListener("loaded",Ny):window.addEventListener("DOMContentLoaded",Ny)},Qy=function(t){Uy("WebXR session support error: "+t.message)};navigator.xr.isSessionSupported?(navigator.xr.isSessionSupported("immersive-vr").then((function(t){Oy=t,Ny()})).catch(Qy),navigator.xr.isSessionSupported("immersive-ar").then((function(t){Fy=t,Ny()})).catch((function(){}))):navigator.xr.supportsSession?(navigator.xr.supportsSession("immersive-vr").then((function(){Oy=!0,Ny()})).catch(Qy),navigator.xr.supportsSession("immersive-ar").then((function(){Fy=!0,Ny()})).catch((function(){}))):Uy("WebXR has neither isSessionSupported or supportsSession?!")}function Gy(){return Oy||Fy}function zy(){return Fy}function Hy(){return Oy}var Vy,jy,Wy=(Vy=!1,jy=window.navigator.userAgent||window.navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(jy)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(jy.substr(0,4)))&&(Vy=!0),(Jy()||qy()||eE())&&(Vy=!0),tE()&&(Vy=!1),function(){return Vy});function qy(t){var e=t||window.navigator.userAgent;return/Nexus (7|9)|xoom|sch-i800|playbook|tablet|kindle/i.test(e)||Xy()}function Xy(t,e,n){var i=t||window.navigator.userAgent,r=e||window.navigator.platform,s=n||window.navigator.maxTouchPoints||0;return("iPad"===r||"MacIntel"===r)&&s>0&&/Macintosh|Intel|iPad|ipad/i.test(i)&&!window.MSStream}function Yy(){var t=navigator.userAgent.includes("Macintosh"),e=5===navigator.maxTouchPoints;return t&&e&&ky}function Jy(){return/iPad|iPhone|iPod/.test(window.navigator.platform)}function Ky(){return!Wy()&&!tE()&&void 0!==window.orientation}function Zy(){return/(OculusBrowser)/i.test(window.navigator.userAgent)}function $y(){return/(Mobile VR)/i.test(window.navigator.userAgent)}function tE(){return Zy()||$y()||Yy()}function eE(){return/R7 Build/.test(window.navigator.userAgent)}function nE(){var t=window.orientation;return eE()&&(t+=90),90===t||-90===t}var iE="undefined"==typeof process,rE=!iE,sE=Object.freeze(Object.create(null));function oE(){return{}}function aE(t){var e=[],n=null;function i(i){var r,s;if((i=void 0===i?e.length:i)>0&&null==n&&(n=0),i>0)for(r=e.length,e.length+=Number(i),s=r;s<e.length;s++)e[s]=t();return e.length}return t=t||oE,{grow:i,pool:e,recycle:function(t){t instanceof Object&&(null!==n&&-1!==n?e[--n]=t:e[e.length]=t)},size:function(){return e.length},use:function(){var t;return null!==n&&n!==e.length||i(e.length||5),t=e[n],e[n++]=sE,lE(t),t}}}function lE(t){var e;if(t&&t.constructor===Object)for(e in t)t[e]=void 0}function cE(t,e){var n;if(t&&t.constructor===Object)for(n in t)n in e||delete t[n]}var hE=Ly("utils:coordinates:warn"),uE=["x","y","z","w"],dE=/^\s*((-?\d*\.{0,1}\d+(e-?\d+)?)\s+){2,3}(-?\d*\.{0,1}\d+(e-?\d+)?)\s*$/,pE=/\s+/g;function AE(t,e,n){var i,r,s,o,a,l,c,h,u=n&&"object"==typeof n?n:{};if(t&&t instanceof Object)return a=void 0===t.x?e&&e.x:t.x,l=void 0===t.y?e&&e.y:t.y,c=void 0===t.z?e&&e.z:t.z,h=void 0===t.w?e&&e.w:t.w,null!=a&&(u.x=yE(a)),null!=l&&(u.y=yE(l)),null!=c&&(u.z=yE(c)),null!=h&&(u.w=yE(h)),u;if(null==t)return"object"==typeof e?Object.assign(u,e):e;for(i=t.trim().split(pE),o=0;o<uE.length;o++)if(s=uE[o],i[o])u[s]=parseFloat(i[o],10);else{if(void 0===(r=e&&e[s]))continue;u[s]=yE(r)}return u}function fE(t){var e;return"object"!=typeof t?t:(e=t.x+" "+t.y,null!=t.z&&(e+=" "+t.z),null!=t.w&&(e+=" "+t.w),e)}function mE(t,e){return"object"!=typeof t||"object"!=typeof e?t===e:t.x===e.x&&t.y===e.y&&t.z===e.z&&t.w===e.w}function gE(t){return dE.test(t)}function vE(t){return hE("`AFRAME.utils.isCoordinate` has been renamed to `AFRAME.utils.isCoordinates`"),gE(t)}function yE(t){return null!=t&&t.constructor===String?parseFloat(t,10):t}function EE(t){return new THREE.Vector3(t.x,t.y,t.z)}var xE=function(){var t={};return function(e,n){return n in t||(t[n]={}),e in t[n]||(t[n][e]=e.split(n)),t[n][e]}}();function bE(t,e){var n=xE(t,e=e||".");return 1===n.length?n[0]:n}function CE(t,e,n){var i;return n=n||".",-1!==e.indexOf(n)?(i=bE(e,n)).constructor===String?t.getAttribute(i):t.getAttribute(i[0])[i[1]]:t.getAttribute(e)}function wE(t,e,n,i){var r;i=i||".",-1===e.indexOf(i)?t.setAttribute(e,n):(r=bE(e,i)).constructor===String?t.setAttribute(r,n):t.setAttribute(r[0],r[1],n)}function _E(t){var e=t.style.width,n=t.style.height;t.style.width=parseInt(e,10)+1+"px",t.style.height=parseInt(n,10)+1+"px",setTimeout((function(){t.style.width=e,t.style.height=n}),200)}var ME=Ly("utils:src-loader:warn");function SE(t,e,n){!function(t,e){var n;t.tagName?e("IMG"===t.tagName):((n=new XMLHttpRequest).open("HEAD",t),n.addEventListener("load",(function(i){var r;n.status>=200&&n.status<300?null==(r=n.getResponseHeader("Content-Type"))?RE(t,e):r.startsWith("image")?e(!0):e(!1):RE(t,e),n.abort()})),n.send())}(t,(function(i){i?e(t):n(t)}))}function IE(t,e,n){var i,r,s,o="",a=[];if("string"==typeof t){for(r=0;r<5;r++)o+="(url\\((?:[^\\)]+)\\),\\s*)";function l(t){a.push(t),6===a.length&&e(a)}if(o+="(url\\((?:[^\\)]+)\\)\\s*)",s=t.match(new RegExp(o))){for(r=1;r<7;r++)SE(TE(s[r]),l);return}if(!t.startsWith("#"))return void SE(TE(t)||t,n)}if(i=t.tagName?t:function(t){try{var e=document.querySelector(t);return e||ME('No element was found matching the selector: "%s"',t),e}catch(e){return void ME('"%s" is not a valid selector',t)}}(t))return"A-CUBEMAP"===i.tagName&&i.srcs?e(i.srcs):"IMG"===i.tagName?n(i):void ME('Selector "%s" does not point to <a-cubemap> or <img>',t)}function BE(t,e){return IE(t,e,(function(){ME("Expected cubemap but got image")}))}function TE(t){var e=t.match(/url\((.+)\)/);if(e)return e[1]}function RE(t,e){var n=new Image;n.addEventListener("load",(function(){e(!0)})),n.addEventListener("error",(function(){e(!1)})),n.src=t}var LE=Ly("utils:material:warn"),DE=new Set(["emissiveMap","envMap","map","specularMap"]);function PE(t,e){var n=e.offset||{x:0,y:0},i=e.repeat||{x:1,y:1},r=e.npot||!1,s=e.anisotropy||_y.Texture.DEFAULT_ANISOTROPY,o=t.wrapS,a=t.wrapT,l=t.magFilter,c=t.minFilter;r&&(o=_y.ClampToEdgeWrapping,a=_y.ClampToEdgeWrapping,l=_y.LinearFilter,c=_y.LinearFilter),1===i.x&&1===i.y||(o=_y.RepeatWrapping,a=_y.RepeatWrapping),t.offset.set(n.x,n.y),t.repeat.set(i.x,i.y),t.wrapS===o&&t.wrapT===a&&t.magFilter===l&&t.minFilter===c&&t.anisotropy===s||(t.wrapS=o,t.wrapT=a,t.magFilter=l,t.minFilter=c,t.anisotropy=s,t.needsUpdate=!0)}function UE(t,e,n,i){var r=n.el,s=n.material,o=r.sceneEl.systems.renderer,a=i[e];if(n.materialSrcs||(n.materialSrcs={}),!a)return delete n.materialSrcs[t],void l(null);function l(e){s[t]!==e&&(s[t]&&s[t].dispose(),s[t]=e,s.needsUpdate=!0,QE(r,e))}a===n.materialSrcs[t]&&s[t]?PE(s[t],i):(n.materialSrcs[t]=a,a instanceof _y.Texture?l(a):r.sceneEl.systems.material.loadTextureSource(a,(function(e){if(n.materialSrcs[t]===a){var r=s[t];!r||null!==e&&GE(r,e)||(r=null),!r&&e&&(r=zE(e)),r&&(r.source!==e&&(r.source=e,r.needsUpdate=!0),DE.has(t)&&o.applyColorCorrection(r),PE(r,i)),l(r)}})))}function OE(t,e){return UE("map","src",t,e)}function FE(t,e,n){var i=t;"ambientOcclusion"===t&&(i="ao");var r={};return r.src=n[t+"Map"],r.offset=n[t+"TextureOffset"],r.repeat=n[t+"TextureRepeat"],r.wrap=n[t+"TextureWrap"],UE(i+"Map","src",e,r)}var kE={};function NE(t,e){var n=t.material,i=t.el,r="envMap",s=e.envMap,o=e.sphericalEnvMap,a=e.refract;if(o&&(s=o,LE("`sphericalEnvMap` property is deprecated, using spherical map as equirectangular map instead. Use `envMap` property with a CubeMap or Equirectangular image instead.")),t.materialSrcs||(t.materialSrcs={}),!s)return delete t.materialSrcs[r],n.envMap=null,void(n.needsUpdate=!0);function l(e){t.materialSrcs[r]===s&&(n.envMap=e,n.needsUpdate=!0,QE(i,e))}t.materialSrcs[r]=s,kE[s]?kE[s].then(l):kE[s]=new Promise((function(t){IE(s,(function(e){i.sceneEl.systems.material.loadCubeMapTexture(e,(function(e){e.mapping=a?_y.CubeRefractionMapping:_y.CubeReflectionMapping,l(e),t(e)}))}),(function(e){i.sceneEl.systems.material.loadTexture(e,{src:e},(function(e){e.mapping=a?_y.EquirectangularRefractionMapping:_y.EquirectangularReflectionMapping,l(e),t(e)}))}))}))}function QE(t,e){function n(){t.emit("materialvideoloadeddata",{src:e.image,texture:e})}function i(){t.emit("materialvideoended",{src:e.image,texture:e})}e&&(t.emit("materialtextureloaded",{src:e.image,texture:e}),e.image&&"VIDEO"===e.image.tagName&&(e.image.addEventListener("loadeddata",n),e.image.addEventListener("ended",i),e.addEventListener("dispose",(function(){e.image.removeEventListener("loadeddata",n),e.image.removeEventListener("ended",i)}))))}function GE(t,e){return t.source===e&&(e.data instanceof HTMLCanvasElement?t.isCanvasTexture:e.data instanceof HTMLVideoElement?t.isVideoTexture:t.isTexture&&!t.isCanvasTexture&&!t.isVideoTexture)}function zE(t){var e;return(e=t.data instanceof HTMLCanvasElement?new _y.CanvasTexture:t.data instanceof HTMLVideoElement?new _y.VideoTexture(t.data):new _y.Texture).source=t,e.needsUpdate=!0,e}var HE=/-([a-z])/g;function VE(t,e){var n;return"string"!=typeof t?t:(n=function(t,e){var n,i,r,s,o,a;for(e=e||{},n=YE(t),i=0;i<n.length;i++)(r=n[i])&&(s=r.indexOf(":"),o=r.substr(0,s).trim(),a=r.substr(s+1).trim(),e[WE(o)]=a);return e}(t,e),n[""]?t:n)}function jE(t){return"string"==typeof t?t:function(t){var e,n=0,i=0,r="";for(e in t)n++;for(e in t)r+=e+": "+t[e],i<n-1&&(r+="; "),i++;return r}(t)}function WE(t){return t.replace(HE,JE)}var qE,XE,YE=(qE=[],XE=/url\([^)]+$/,function(t){var e,n="",i=0;for(qE.length=0;i<t.length;)-1===(e=t.indexOf(";",i))&&(e=t.length),n+=t.substring(i,e),XE.test(n)?(n+=";",i=e+1):(qE.push(n.trim()),n="",i=e+1);return qE});function JE(t){return t[1].toUpperCase()}var KE=["x","y","z","w"];function ZE(t,e,n){var i,r,s=t.el;if((r=!!(i=$E(t,e,n)))===t.controllerPresent)return r;t.controllerPresent=r,r?(t.addEventListeners(),t.injectTrackedControls(i),s.emit("controllerconnected",{name:t.name,component:t})):(t.removeEventListeners(),s.emit("controllerdisconnected",{name:t.name,component:t}))}function $E(t,e,n){var i,r=t.el.sceneEl,s=r&&r.systems["tracked-controls"];return!!s&&!(!(i=s.controllers)||!i.length)&&tx(i,e,n.hand,n.index,n.iterateControllerProfiles,n.handTracking)}function tx(t,e,n,i,r,s){var o,a,l,c,h=!1;for(o=0;o<t.length;o++){if(c=(l=t[o]).profiles,s)h=l.hand;else if(r)for(a=0;a<c.length&&!(h=c[a].startsWith(e));a++);else h=c.length>0&&c[0].startsWith(e);if(h)if("right"===l.handedness||"left"===l.handedness){if(l.handedness===n)return t[o]}else if(o===i)return t[o]}}function ex(t,e,n){var i,r,s,o,a;for(r in e){for(i=e[r],s=!1,a=0;a<i.length;a++)n.detail.changed[i[a]]&&(s=!0);if(s){for(o={},a=0;a<i.length;a++)o[KE[a]]=n.detail.axis[i[a]];t.el.emit(r+"moved",o)}}}function nx(t,e,n,i){var r=(i?n.mapping[i]:n.mapping).buttons[t];n.el.emit(r+e),n.updateModel&&n.updateModel(r,e)}var ix=Ly("utils:warn");function rx(t){return t.bind.apply(t,Array.prototype.slice.call(arguments,1))}function sx(){return ix("`utils.checkHeadsetConnected` has moved to `utils.device.checkHeadsetConnected`"),Gy()}function ox(){return ix("`utils.isIOS` has moved to `utils.device.isIOS`"),Jy()}function ax(){return ix("`utils.isMobile has moved to `utils.device.isMobile`"),Wy(arguments)}function lx(t,e,n){var i;return n&&(t=t.bind(n)),function(){var n=Date.now();(void 0===i||(void 0===i?e:n-i)>=e)&&(i=n,t.apply(null,arguments))}}function cx(t,e,n){var i,r,s;n&&(t=t.bind(n));var o=function(){i=Date.now(),t.apply(this,s),r=void 0};return function(){var n=Date.now(),a=void 0===i?e:n-i;a>=e?(clearTimeout(r),r=void 0,i=n,t.apply(null,arguments)):(r=r||setTimeout(o,e-a),s=arguments)}}function hx(t,e,n){var i;return n&&(t=t.bind(n)),function(n,r){var s=void 0===i?r:n-i;(void 0===i||s>=e)&&(i=n,t(n,s))}}function ux(t,e,n){var i;return function(){var r=this,s=arguments,o=n&&!i;clearTimeout(i),i=setTimeout((function(){i=null,n||t.apply(r,s)}),e),o&&t.apply(r,s)}}var dx=Object.assign,px=Py();function Ax(t){return JSON.parse(JSON.stringify(t))}var fx,mx,gx=(fx=aE((function(){return[]})),function(t,e){var n,i,r,s,o,a;if(void 0===t||void 0===e||null===t||null===e||!(t&&e&&t.constructor===Object&&e.constructor===Object||t.constructor===Array&&e.constructor===Array))return t===e;for(n in i=fx.use(),r=fx.use(),i.length=0,r.length=0,t)i.push(n);for(n in e)r.push(n);if(i.length!==r.length)return fx.recycle(i),fx.recycle(r),!1;for(s=0;s<i.length;++s)if(o=t[i[s]],a=e[i[s]],"object"==typeof o||"object"==typeof a||Array.isArray(o)&&Array.isArray(a)){if(o===a)continue;if(!gx(o,a))return fx.recycle(i),fx.recycle(r),!1}else if(o!==a)return fx.recycle(i),fx.recycle(r),!1;return fx.recycle(i),fx.recycle(r),!0}),vx=(mx=[],function(t,e,n){var i,r,s,o,a,l,c;for(a in o=n||{},mx.length=0,t)mx.push(a);if(!e)return o;for(s in e)-1===mx.indexOf(s)&&mx.push(s);for(l=0;l<mx.length;l++)i=t[a=mx[l]],r=e[a],((c=i&&r&&i.constructor===Object&&r.constructor===Object)&&!gx(i,r)||!c&&i!==r)&&(o[a]=r);return o});function yx(t){return!t.metaKey&&document.activeElement===document.body}function Ex(t,e){void 0===e&&(e=" ");var n=new RegExp(e,"g");return(t=(t||"").replace(n,e)).split(e)}function xx(t,e){e=e||{};var n={};return Object.keys(e).forEach((function(e){t.hasAttribute(e)&&(n[e]=t.getAttribute(e))})),n}function bx(t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var e=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(location.search);return null===e?"":decodeURIComponent(e[1].replace(/\+/g," "))}function Cx(){return window.top!==window.self}function wx(t){for(var e=[],n=t.getElementsByTagName("*"),i=0,r=n.length;i<r;i++)n[i].isScene&&e.push(n[i]);return e}var _x,Mx=[Ix({name:"viewport",content:"width=device-width,initial-scale=1,maximum-scale=1,shrink-to-fit=no,user-scalable=no,minimal-ui,viewport-fit=cover"}),Ix({name:"mobile-web-app-capable",content:"yes"}),Ix({name:"theme-color",content:"black"})],Sx=[Ix({name:"apple-mobile-web-app-capable",content:"yes"}),Ix({name:"apple-mobile-web-app-status-bar-style",content:"black"}),(_x={rel:"apple-touch-icon",href:"https://aframe.io/images/aframe-logo-152.png"},{tagName:"link",attributes:_x,exists:function(){return document.querySelector('link[rel="'+_x.rel+'"]')}})];function Ix(t){return{tagName:"meta",attributes:t,exists:function(){return document.querySelector('meta[name="'+t.name+'"]')}}}var Bx,Tx,Rx,Lx=n(5928),Dx=n.n(Lx),Px=h,Ux="loading-screen";function Ox(t){var e=Bx.hasAttribute("embedded"),n=Rx(Bx.canvas,e,Bx.maxCanvasSize,Bx.is("vr-mode"));t.aspect=n.width/n.height,t.updateProjectionMatrix(),Bx.renderer.setSize(n.width,n.height,!1)}const Fx=[];var kx=By()("core:propertyTypes:warn"),Nx={},Qx=/[,> .[\]:]/,Gx=/url\((.+)\)/;function zx(t,e,n,i,r,s){if(t in Nx)throw new Error("Property type "+t+" is already registered.");Nx[t]={default:e,parse:n||Wx,stringify:i||qx,equals:r||Xx,isCacheable:!1!==s}}function Hx(t,e){if(!Array.isArray(t)||!Array.isArray(e))return t===e;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function Vx(t){var e,n;return"string"!=typeof t?t:(n=t.match(Gx))?n[1]:"#"===t.charAt(0)?(e=document.getElementById(t.substring(1)))?"CANVAS"===e.tagName||"VIDEO"===e.tagName||"IMG"===e.tagName?e:e.getAttribute("src"):void kx('"'+t+'" asset not found.'):t}function jx(t){return t.getAttribute?t.getAttribute("id")?"#"+t.getAttribute("id"):t.getAttribute("src"):qx(t)}function Wx(t){return t}function qx(t){return null===t?"null":t.toString()}function Xx(t,e){return t===e}function Yx(t){return parseInt(t,10)}function Jx(t,e,n){return AE(t,e,n)}function Kx(t,e){if(null===t)return!0;if("object"!=typeof t)return!1;if(Object.keys(t).length!==e)return!1;var n=t.x,i=t.y,r=t.z,s=t.w;return!("number"!=typeof n||"number"!=typeof i||e>2&&"number"!=typeof r||e>3&&"number"!=typeof s)}zx("audio","",Vx,jx),zx("array",[],(function(t){return Array.isArray(t)?t:t&&"string"==typeof t?t.split(",").map((function(t){return t.trim()})):[]}),(function(t){return t.join(", ")}),Hx),zx("asset","",Vx,jx),zx("boolean",!1,(function(t){return"false"!==t&&!1!==t})),zx("color","#FFF"),zx("int",0,Yx),zx("number",0,(function(t){return parseFloat(t,10)})),zx("map","",Vx,jx),zx("model","",Vx,jx),zx("selector",null,(function(t){return t?"string"!=typeof t?t:"#"!==t[0]||Qx.test(t)?document.querySelector(t):document.getElementById(t.substring(1)):null}),(function(t){return t.getAttribute?"#"+t.getAttribute("id"):qx(t)}),Xx,!1),zx("selectorAll",null,(function(t){return t?"string"!=typeof t?t:Array.prototype.slice.call(document.querySelectorAll(t),0):null}),(function(t){return t instanceof Array?t.map((function(t){return"#"+t.getAttribute("id")})).join(", "):qx(t)}),Hx,!1),zx("src","",(function(t){return kx("`src` property type is deprecated. Use `asset` instead."),Vx(t)}),jx),zx("string",""),zx("time",0,Yx),zx("vec2",{x:0,y:0},Jx,fE,mE),zx("vec3",{x:0,y:0,z:0},Jx,fE,mE),zx("vec4",{x:0,y:0,z:0,w:1},Jx,fE,mE);var Zx=function(t,e){return("audio"!==t||"string"==typeof e)&&!("array"===t&&!Array.isArray(e))&&("asset"!==t||"string"==typeof e)&&("boolean"!==t||"boolean"==typeof e)&&("color"!==t||"string"==typeof e)&&("int"!==t||"number"==typeof e)&&("number"!==t||"number"==typeof e)&&("map"!==t||"string"==typeof e)&&("model"!==t||"string"==typeof e)&&("selector"!==t||"string"==typeof e||null===e)&&("selectorAll"!==t||"string"==typeof e||null===e)&&("src"!==t||"string"==typeof e)&&("string"!==t||"string"==typeof e)&&("time"!==t||"number"==typeof e)&&("vec2"===t?Kx(e,2):"vec3"===t?Kx(e,3):"vec4"!==t||Kx(e,4))},$x=Nx,tb=Ly("core:schema:warn");function eb(t){return"type"in t?"string"==typeof t.type:"default"in t}function nb(t,e){var n;if(eb(t))return ib(t,e);for(n in t)t[n]=ib(t[n],e);return t}function ib(t,e){var n,i,r=t.default,s=t.type;return t.type?"bool"===t.type?s="boolean":"float"===t.type&&(s="number"):s=void 0===r||"boolean"!=typeof r&&"number"!=typeof r?Array.isArray(r)?"array":"string":typeof r,(i=$x[s])||tb("Unknown property type for component `"+e+"`: "+s),n=!!t.parse,t.parse=t.parse||i.parse,t.stringify=t.stringify||i.stringify,t.equals=t.equals||i.equals,t.isCacheable=!0===t.isCacheable||i.isCacheable,t.type=s,"default"in t?n||Zx(s,r)||tb("Default value `"+r+"` does not match type `"+s+"` in component `"+e+"`"):t.default=i.default,t}var rb,sb=(rb=[],function(t,e,n,i,r){var s,o,a,l;for(o in rb.length=0,n?t:e)n&&void 0===t[o]||rb.push(o);if(null===t||"object"!=typeof t)return t;for(o in t)void 0===t[o]||e[o]||r||tb("Unknown property `"+o+"` for component/system `"+i+"`.");for(s=0;s<rb.length;s++){if(a=e[o=rb[s]],l=t[o],!e[o])return;t[o]=ob(l,a)}return t});function ob(t,e,n){return null!=t&&""!==t||(t=e.default,Array.isArray(t)&&(t=t.slice())),e.parse(t,e.default,n)}function ab(t,e){var n,i,r,s,o={};for(n in t)i=e[n],"object"==typeof(s=r=t[n])&&(s=lb(r,i),i||tb("Unknown component property: "+n)),void 0!==s&&(o[n]=s);return o}function lb(t,e){return"object"!=typeof t?t:e&&null!==t?e.stringify(t):JSON.stringify(t)}var cb={},hb=ob,ub=nb,db=eb,pb=ab,Ab=lb,fb=h,mb=Ly("core:component:warn"),gb=document.currentScript,vb=new RegExp("[A-Z]+"),yb={},Eb=Object.freeze({}),xb=[],bb={get:function(t,e){return t.getComputedPropertyValue(e)},set:function(t,e,n){return e in t.schema?t.recomputeProperty(e,n):void 0!==n&&t.handleUnknownProperty(e,n),!0}},Cb=function(t,e,n){var i=this;if(this.sceneOnly&&!t.isScene)throw new Error("Component `"+this.name+"` can only be applied to <a-scene>");if(n&&!this.multiple)throw new Error("Trying to initialize multiple components of type `"+this.name+"`. There can only be one component of this type per entity.");this.el=t,this.id=n,this.attrName=this.name+(n?"__"+n:""),this.evtDetail={id:this.id,name:this.name},this.initialized=!1,this.el.components[this.attrName]=this,this.objectPool=yb[this.name];var r=this.events;this.events={},function(t,e){var n;for(n in e)t.events[n]=e[n].bind(t)}(this,r),this.attrValue=void 0,this.isObjectBased?(this.data=this.objectPool.use(),cE(this.data,this.schema),this.oldData=this.objectPool.use(),cE(this.oldData,this.schema),this.attrValueProxy=new Proxy(this,bb)):(this.data=void 0,this.oldData=void 0,this.attrValueProxy=void 0),this.deferUnknownPropertyWarnings=!!this.updateSchema,this.throttledEmitComponentChanged=cx((function(){t.emit("componentchanged",i.evtDetail,!1)}),200),this.updateProperties(e,!0)};Cb.prototype={schema:{},init:function(){},events:{},update:function(t){},updateSchema:void 0,tick:void 0,tock:void 0,play:function(){},pause:function(){},remove:function(){},stringify:function(t){var e=this.schema;return"string"==typeof t?t:this.isSingleProperty?Ab(t,e):(t=pb(t,e),fb.stringify(t))},flushToDOM:function(t){var e=t?this.data:this.attrValue;null!=e&&window.HTMLElement.prototype.setAttribute.call(this.el,this.attrName,this.stringify(e))},updateProperties:function(t,e){var n=this.el;this.updateData(t,e),(n.hasLoaded||n.isLoading)&&(this.initialized?this.callUpdateHandler():this.initComponent())},initComponent:function(){var t,e=this.el;e.initializingComponents[this.name]||(e.initializingComponents[this.name]=!0,this.init(),this.initialized=!0,delete e.initializingComponents[this.name],t=this.isObjectBased?Eb:void 0,this.dataChanged=!1,this.storeOldData(),this.update(t),e.isPlaying&&this.play(),e.emit("componentinitialized",this.evtDetail,!1))},updateData:function(t,e){this.isSingleProperty?this.recomputeProperty(void 0,t):(e?(lE(this.attrValue),this.recomputeData(t),this.schemaChangeRequired=!!this.updateSchema):"string"==typeof t?fb.parse(t,this.attrValueProxy):dx(this.attrValueProxy,t),this.updateSchemaIfNeeded(t))},updateSchemaIfNeeded:function(t){if(this.schemaChangeRequired&&this.updateSchema)for(var e in xb.length=0,this.updateSchema(this.data),cE(this.data,this.schema),this.recomputeData(t),this.schemaChangeRequired=!1,this.attrValue)void 0!==this.attrValue[e]&&-1===xb.indexOf(e)&&(e in this.schema||mb("Unknown property `"+e+"` for component `"+this.name+"`."));for(var n=0;n<xb.length;n++)mb("Unknown property `"+xb[n]+"` for component `"+this.name+"`.");xb.length=0},callUpdateHandler:function(){if(this.isPositionRotationScale||this.dataChanged){this.dataChanged=!1;var t=this.oldData;this.oldDataInUse=!0,this.update(t),t!==this.oldData&&this.objectPool.recycle(t),this.oldDataInUse=!1,this.storeOldData(),this.throttledEmitComponentChanged()}},handleMixinUpdate:function(){this.recomputeData(),this.updateSchemaIfNeeded(),this.callUpdateHandler()},resetProperty:function(t){(this.isSingleProperty||t in this.schema)&&(t?this.attrValue[t]=void 0:(this.isObjectBased&&this.objectPool.recycle(this.attrValue),this.attrValue=void 0),this.recomputeProperty(t,void 0),this.updateSchemaIfNeeded(),this.callUpdateHandler())},extendSchema:function(t){var e;e=dx({},cb[this.name].schema),dx(e,t),this.schema=ub(e),this.el.emit("schemachanged",this.evtDetail)},getComputedPropertyValue:function(t){var e=this.el.mixinEls,n=this.attrValue&&t?this.attrValue[t]:this.attrValue;if(void 0!==n)return n;for(var i=e.length-1;i>=0;i--){var r=e[i].getAttribute(this.attrName);if(null!==r&&(!t||t in r))return t?r[t]:r}return t?this.schema[t].default:this.schema.default},recomputeProperty:function(t,e){var n=t?this.schema[t]:this.schema;if(null!=e){void 0===this.attrValue&&this.isObjectBased&&(this.attrValue=this.objectPool.use());var i=t?this.attrValue[t]:this.attrValue;"string"==typeof(i=n.isCacheable?hb(e,n,i):e)&&(i=""===e?void 0:e),t?this.attrValue[t]=i:this.attrValue=i}this.oldDataInUse&&(this.oldData=this.objectPool.use(),cE(this.oldData,this.schema),this.storeOldData(),this.oldDataInUse=!1);var r=t?this.oldData[t]:this.oldData,s=t?this.data[t]:this.data,o=hb(this.getComputedPropertyValue(t),n,s);return"array"!==n.type||t||(o=Ax(o)),n.equals(o,r)||(this.dataChanged=!0,n.schemaChange&&(this.schemaChangeRequired=!0)),t?this.data[t]=o:this.data=o,o},handleUnknownProperty:function(t,e){void 0===this.attrValue&&(this.attrValue=this.objectPool.use()),this.attrValue[t]=e,this.deferUnknownPropertyWarnings?xb.push(t):this.silenceUnknownPropertyWarnings||mb("Unknown property `"+t+"` for component `"+this.name+"`.")},storeOldData:function(){var t;if(this.isObjectBased)if(this.isSingleProperty)this.oldData=hb(this.data,this.schema,this.oldData);else for(t in this.schema)void 0!==this.data[t]&&(this.data[t]&&"object"==typeof this.data[t]?this.oldData[t]=hb(this.data[t],this.schema[t],this.oldData[t]):this.oldData[t]=this.data[t]);else this.oldData=this.data},recomputeData:function(t){var e;if(this.isSingleProperty)this.recomputeProperty(void 0,t);else{for(e in this.schema)this.attrValueProxy[e]=void 0;t&&"object"==typeof t?dx(this.attrValueProxy,t):"string"==typeof t&&fb.parse(t,this.attrValueProxy)}},eventsAttach:function(){var t;for(t in this.eventsDetach(),this.events)this.el.addEventListener(t,this.events[t])},eventsDetach:function(){var t;for(t in this.events)this.el.removeEventListener(t,this.events[t])},destroy:function(){this.objectPool.recycle(this.attrValue),this.objectPool.recycle(this.data),this.objectPool.recycle(this.oldData),this.attrValue=this.data=this.oldData=this.attrValueProxy=void 0}};var wb={};function _b(t,e){var n,i,r,s,o,a={};if(document.currentScript&&document.currentScript!==gb&&Fx.forEach((function(e){e.hasLoaded||document.currentScript.compareDocumentPosition(e)!==Node.DOCUMENT_POSITION_FOLLOWING&&(mb("The component `"+t+"` was registered in a <script> tag after the scene. Component <script> tags in an HTML file should be declared *before* the scene such that the component is available to entities during scene initialization."),window.debug&&(wb[t]=!0))})),!0===vb.test(t)&&mb("The component name `"+t+"` contains uppercase characters, but HTML will ignore the capitalization of attribute names. Change the name to be lowercase: `"+t.toLowerCase()+"`"),-1!==t.indexOf("__"))throw new Error("The component name `"+t+"` is not allowed. The sequence __ (double underscore) is reserved to specify an id for multiple components of the same type");if(Object.keys(e).forEach((function(t){a[t]={value:e[t],writable:!0}})),cb[t])throw new Error("The component `"+t+"` has been already registered. Check that you are not loading two versions of the same component or two different components of the same name.");((n=function(t,e,n){Cb.call(this,t,e,n)}).prototype=Object.create(Cb.prototype,a)).name=t,n.prototype.isPositionRotationScale="position"===t||"rotation"===t||"scale"===t,n.prototype.constructor=n,n.prototype.system=f&&Rb[t],n.prototype.play=(s=n.prototype.play,function(){var t=this.el.sceneEl,e=this.el.isPlaying&&!this.isPlaying;this.initialized&&e&&(s.call(this),this.isPlaying=!0,this.eventsAttach(),Mb(this)&&t.addBehavior(this))}),n.prototype.pause=(o=n.prototype.pause,function(){var t=this.el.sceneEl;this.isPlaying&&(o.call(this),this.isPlaying=!1,this.eventsDetach(),Mb(this)&&t.removeBehavior(this))}),i=dx(ub(n.prototype.schema,n.prototype.name)),n.prototype.isSingleProperty=r=db(n.prototype.schema),n.prototype.isObjectBased=!r||r&&(Sb(i.default)||Sb(hb(void 0,i))),yb[t]=aE(),cb[t]={Component:n,dependencies:n.prototype.dependencies,before:n.prototype.before,after:n.prototype.after,isSingleProperty:n.prototype.isSingleProperty,isObjectBased:n.prototype.isObjectBased,multiple:n.prototype.multiple,sceneOnly:n.prototype.sceneOnly,name:t,schema:i,stringify:n.prototype.stringify};for(var l=0;l<Fx.length;l++)Fx[l].emit("componentregistered",{name:t},!1);return n}function Mb(t){return t.tick||t.tock}function Sb(t){return t&&t.constructor===Object&&!(t instanceof window.HTMLElement)}var Ib=!1;function Bb(){Ib||(Ib=!0,setTimeout((function(){document.dispatchEvent(new CustomEvent("aframeready"))})))}var Tb=h,Rb={},Lb=function(t){var e=A&&cb[this.name];this.el=t,this.sceneEl=t,e&&(e.Component.prototype.system=this),this.buildData(),this.init(),this.update({})};function Db(t,e){var n,i,r={},s=wx(document);if(Object.keys(e).forEach((function(t){r[t]={value:e[t],writable:!0}})),Rb[t])throw new Error("The system `"+t+"` has been already registered. Check that you are not loading two versions of the same system or two different systems of the same name.");if(i=function(t){Lb.call(this,t)},(i.prototype=Object.create(Lb.prototype,r)).name=t,i.prototype.constructor=i,i.prototype.schema=dx(nb(i.prototype.schema)),Rb[t]=i,Ib)for(n=0;n<s.length;n++)s[n].initSystem(t)}Lb.prototype={schema:{},init:function(){},update:function(t){},updateProperties:function(t){var e=this.data;0!==Object.keys(this.schema).length&&(this.buildData(t),this.update(e))},buildData:function(t){var e=this.schema;0!==Object.keys(e).length&&(t=t||window.HTMLElement.prototype.getAttribute.call(this.sceneEl,this.name),eb(e)?this.data=ob(t,e):this.data=sb(Tb.parse(t)||{},e,!1,this.name))},tick:void 0,tock:void 0,play:function(){},pause:function(){}};var Pb=Ly("core:a-node:warn"),Ub={"a-scene":!0,"a-assets":!0,"a-assets-items":!0,"a-cubemap":!0,"a-mixin":!0,"a-node":!0,"a-entity":!0};function Ob(t){return t.tagName.toLowerCase()in Ub||t.isNode}class Fb extends HTMLElement{constructor(){super(),this.computedMixinStr="",this.hasLoaded=!1,this.isNode=!0,this.mixinEls=[]}connectedCallback(){Ib?this.doConnectedCallback():document.addEventListener("aframeready",this.connectedCallback.bind(this))}doConnectedCallback(){var t;this.sceneEl=this.closestScene(),this.sceneEl||Pb("You are attempting to attach <"+this.tagName+"> outside of an A-Frame scene. Append this element to `<a-scene>` instead."),this.hasLoaded=!1,this.emit("nodeready",void 0,!1),this.isMixin||(t=this.getAttribute("mixin"))&&this.updateMixins(t)}attributeChangedCallback(t,e,n){n!==this.computedMixinStr&&("mixin"!==t||this.isMixin||this.updateMixins(n,e))}closestScene(){for(var t=this;t&&!t.isScene;)t=t.parentElement;return t}closest(t){for(var e=this.matches||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector,n=this;n&&!e.call(n,t);)n=n.parentElement;return n}disconnectedCallback(){this.hasLoaded=!1}load(t,e){var n,i=this;this.hasLoaded||(e=e||Ob,n=this.getChildren().filter(e).map((function(t){return new Promise((function(e,n){if(t.hasLoaded)return e();t.addEventListener("loaded",e),t.addEventListener("error",n)}))})),Promise.allSettled(n).then((function(e){e.forEach((function(t){"rejected"===t.status&&Pb("Rendering scene with errors on node: ",t.reason.target)})),i.isLoading=!0,i.setupMutationObserver(),t&&t(),i.isLoading=!1,i.hasLoaded=!0,i.emit("loaded-private",void 0,!1),i.emit("loaded",void 0,!1)})))}setupMutationObserver(){var t=this;new MutationObserver((function(e){var n;for(n=0;n<e.length;n++)if("attributes"===e[n].type){var i=e[n].attributeName,r=window.HTMLElement.prototype.getAttribute.call(t,i),s=e[n].oldValue;t.attributeChangedCallback(i,s,r)}})).observe(this,{attributes:!0,attributeOldValue:!0})}getChildren(){return Array.prototype.slice.call(this.children,0)}updateMixins(t,e){var n,i,r,s=Fb.newMixinIdArray,o=Fb.oldMixinIdArray,a=Fb.mixinIds;for(s.length=0,o.length=0,i=t?xE(t.trim(),/\s+/):s,r=e?xE(e.trim(),/\s+/):o,a.newMixinIds=i,a.oldMixinIds=r,n=0;n<r.length;n++)-1===i.indexOf(r[n])&&this.unregisterMixin(r[n]);for(this.computedMixinStr="",this.mixinEls.length=0,n=0;n<i.length;n++)this.registerMixin(i[n]);return this.computedMixinStr&&(this.computedMixinStr=this.computedMixinStr.trim(),window.HTMLElement.prototype.setAttribute.call(this,"mixin",this.computedMixinStr)),0===i.length&&window.HTMLElement.prototype.removeAttribute.call(this,"mixin"),a}registerMixin(t){var e,n,i,r=document.getElementById(t);if(r){if(i=r.getAttribute("mixin"))for(e=xE(i.trim(),/\s+/),n=0;n<e.length;n++)this.registerMixin(e[n]);this.computedMixinStr=this.computedMixinStr+" "+r.id,this.mixinEls.push(r)}else Pb("No mixin was found with id `%s`",t)}setAttribute(t,e){"mixin"===t&&this.updateMixins(e),window.HTMLElement.prototype.setAttribute.call(this,t,e)}unregisterMixin(t){var e,n=this.mixinEls;for(e=0;e<n.length;++e)if(t===n[e].id){n.splice(e,1);break}}emit(t,e,n,i){var r=Fb.evtData;void 0===n&&(n=!0),r.bubbles=!!n,r.detail=e,i&&(r=dx({},i,r)),this.dispatchEvent(new CustomEvent(t,r))}}Fb.evtData={},Fb.newMixinIdArray=[],Fb.oldMixinIdArray=[],Fb.mixinIds={},customElements.define("a-node",Fb);var kb=Ly("core:a-entity:debug"),Nb=Ly("core:a-entity:warn"),Qb="__",Gb=["position","rotation","scale","visible"],zb={once:!0};class Hb extends Fb{constructor(){super(),this.components={},this.initializingComponents={},this.componentsToUpdate={},this.isEntity=!0,this.isPlaying=!1,this.object3D=new _y.Group,this.object3D.rotation.order="YXZ",this.object3D.el=this,this.object3DMap={},this.parentEl=null,this.rotationObj={},this.states=[]}attributeChangedCallback(t,e,n){var i=this.components[t];super.attributeChangedCallback(),i&&i.justInitialized&&""===n?delete i.justInitialized:(i||null!==n)&&this.setEntityAttribute(t,e,n)}doConnectedCallback(){var t,e,n=this;super.doConnectedCallback(),e=this.sceneEl,this.addToParent(),this.isScene||(e?!(t=e.querySelector("a-assets"))||t.hasLoaded?this.load():t.addEventListener("loaded",(function(){n.load()})):this.load())}disconnectedCallback(){var t;if(this.parentEl){for(t in this.components)this.removeComponent(t,!1);this.isScene||(this.removeFromParent(),super.disconnectedCallback(),this.object3D.el=null)}}getObject3D(t){return this.object3DMap[t]}setObject3D(t,e){var n,i=this;if(!(e instanceof _y.Object3D))throw new Error("`Entity.setObject3D` was called with an object that was not an instance of THREE.Object3D.");(n=this.getObject3D(t))&&this.object3D.remove(n),e.el=this,e.children.length&&e.traverse((function(t){t.el=i})),this.object3D.add(e),this.object3DMap[t]=e,this.emit("object3dset",{object:e,type:t})}removeObject3D(t){var e=this.getObject3D(t);e?(this.object3D.remove(e),delete this.object3DMap[t],this.emit("object3dremove",{type:t})):Nb("Tried to remove `Object3D` of type:",t,"which was not defined.")}getOrCreateObject3D(t,e){var n=this.getObject3D(t);return!n&&e&&(n=new e,this.setObject3D(t,n)),Nb("`getOrCreateObject3D` has been deprecated. Use `setObject3D()` and `object3dset` event instead."),n}add(t){if(!t.object3D)throw new Error("Trying to add an element that doesn't have an `object3D`");this.object3D.add(t.object3D),this.emit("child-attached",{el:t})}addToParent(){var t=this.parentEl=this.parentNode;t&&t.add&&!this.attachedToParent&&(t.add(this),this.attachedToParent=!0)}removeFromParent(){var t=this.parentEl;this.parentEl.remove(this),this.attachedToParent=!1,this.parentEl=null,t.emit("child-detached",{el:this})}load(){var t=this;!this.hasLoaded&&this.parentEl&&super.load.call(this,(function(){t.parentEl&&(t.updateComponents(),(t.isScene||t.parentEl.isPlaying)&&t.play())}))}remove(t){t?this.object3D.remove(t.object3D):this.parentNode.removeChild(this)}getChildEntities(){for(var t=this.children,e=[],n=0;n<t.length;n++){var i=t[n];i instanceof Hb&&e.push(i)}return e}initComponent(t,e,n){var i,r,s,o;o=(s=xE(t,Qb))[0],r=s.length>2?s.slice(1).join("__"):s[1],cb[o]&&(Vb(this,t)||void 0!==e||n)&&(t in this.components||(this.initComponentDependencies(o),i=new cb[o].Component(this,e,r),this.isPlaying&&i.play(),this.hasAttribute(t)||(i.justInitialized=!0,window.HTMLElement.prototype.setAttribute.call(this,t,"")),kb("Component initialized: %s",t)))}initComponentDependencies(t){var e,n;if(cb[t]&&(e=cb[t].dependencies))for(n=0;n<e.length;n++)this.initComponent(e[n],window.HTMLElement.prototype.getAttribute.call(this,e[n])||void 0,!0)}removeComponent(t,e){var n;(n=this.components[t])&&(n.initialized?(n.pause(),n.remove(),e&&(n.destroy(),delete this.components[t],this.hasAttribute(t)&&window.HTMLElement.prototype.removeAttribute.call(this,t)),this.emit("componentremoved",n.evtDetail,!1)):this.addEventListener("componentinitialized",(function n(i){i.detail.name===t&&(this.removeComponent(t,e),this.removeEventListener("componentinitialized",n))})))}updateComponents(){var t,e,n,i,r,s,o=this.componentsToUpdate;if(this.hasLoaded||this.isLoading){for(n=0;n<this.mixinEls.length;n++)for(i in this.mixinEls[n].componentCache)jb(i)&&(o[i]=!0);if(this.getExtraComponents)for(i in e=this.getExtraComponents())jb(i)&&(o[i]=!0);for(n=0;n<this.attributes.length;++n)i=this.attributes[n].name,-1===Gb.indexOf(i)&&jb(i)&&(o[i]=!0);for(n=0;n<Gb.length;n++)i=Gb[n],this.hasAttribute(i)&&this.updateComponent(i,this.getDOMAttribute(i));for(i in o)r=this.getDOMAttribute(i),t=(s=e&&e[i])?s.constructor===Object?dx(s,VE(r||{})):r||s:r,this.updateComponent(i,t),delete o[i]}}updateComponent(t,e,n){var i=this.components[t];if(i)return null!==e||Vb(this,t)?void i.updateProperties(e,n):void this.removeComponent(t,!0);this.initComponent(t,e,!1)}removeAttribute(t,e){var n=this.components[t];n&&void 0===e&&this.removeComponent(t,!0),n&&void 0!==e?n.resetProperty(e):("mixin"===t&&this.mixinUpdate(""),window.HTMLElement.prototype.removeAttribute.call(this,t))}play(){var t,e,n;if(!this.isPlaying&&(this.hasLoaded||this.isLoading)){for(n in this.isPlaying=!0,this.components)this.components[n].play();for(t=this.getChildEntities(),e=0;e<t.length;e++)t[e].play();this.emit("play")}}pause(){var t,e,n;if(this.isPlaying){for(n in this.isPlaying=!1,this.components)this.components[n].pause();for(t=this.getChildEntities(),e=0;e<t.length;e++)t[e].pause();this.emit("pause")}}setEntityAttribute(t,e,n){if(cb[t]||this.components[t])this.updateComponent(t,n);else if("mixin"===t){if(n===this.computedMixinStr)return;this.mixinUpdate(n,e)}}mixinUpdate(t,e,n){var i,r,s,o,a=Hb.componentsUpdated,l=this;if(n||(e=e||this.getAttribute("mixin")),this.hasLoaded){for(s=this.updateMixins(t,e),a.length=0,o=0;o<this.mixinEls.length;o++)for(i in this.mixinEls[o].componentCache)-1===a.indexOf(i)&&(this.components[i]?this.components[i].handleMixinUpdate():this.initComponent(i,null),a.push(i));for(o=0;o<s.oldMixinIds.length;o++)if(r=document.getElementById(s.oldMixinIds[o]))for(i in r.componentCache)-1===a.indexOf(i)&&this.components[i]&&(this.getDOMAttribute(i)?this.components[i].handleMixinUpdate():this.removeComponent(i,!0))}else this.addEventListener("loaded-private",(function(){l.mixinUpdate(t,e,!0)}),zb)}setAttribute(t,e,n){var i,r,s,o,a,l=Hb.singlePropUpdate;if(s=(o=t.indexOf(Qb))>0?t.substring(0,o):t,!cb[s])return"mixin"===t&&this.mixinUpdate(e),void super.setAttribute.call(this,t,e);if(!this.components[t]&&this.hasAttribute(t)&&this.updateComponent(t,window.HTMLElement.prototype.getAttribute.call(this,t)),void 0!==n&&"string"==typeof e&&e.length>0&&"string"==typeof VE(e)){for(a in l)delete l[a];(i=l)[e]=n,r=!1}else i=e,r=!0===n;this.updateComponent(t,i,r),this.sceneEl&&this.sceneEl.getAttribute("debug")&&this.components[t].flushToDOM()}flushToDOM(t){var e,n,i,r=this.components,s=this.children;for(i in r)r[i].flushToDOM();if(t)for(n=0;n<s.length;++n)(e=s[n]).flushToDOM&&e.flushToDOM(t)}getAttribute(t){var e,n,i,r,s;return"position"===t?this.object3D.position:"rotation"===t?(n=this,i=_y.MathUtils.radToDeg,r=n.object3D.rotation,(s=n.rotationObj).x=i(r.x),s.y=i(r.y),s.z=i(r.z),s):"scale"===t?this.object3D.scale:"visible"===t?this.object3D.visible:(e=this.components[t])?e.data:window.HTMLElement.prototype.getAttribute.call(this,t)}getDOMAttribute(t){var e=this.components[t];return e?e.attrValue:window.HTMLElement.prototype.getAttribute.call(this,t)}addState(t){this.is(t)||(this.states.push(t),this.emit("stateadded",t))}removeState(t){var e=this.states.indexOf(t);-1!==e&&(this.states.splice(e,1),this.emit("stateremoved",t))}is(t){return-1!==this.states.indexOf(t)}inspect(){this.sceneEl.components.inspector.openInspector(this)}destroy(){var t;if(this.parentNode)Nb("Entity can only be destroyed if detached from scenegraph.");else for(t in this.components)this.components[t].destroy()}}function Vb(t,e){return!(!t.components[e]||!t.components[e].attrValue)||function(t,e){var n,i=!1;for(n=0;n<e.length&&!(i=e[n].hasAttribute(t));++n);return i}(e,t.mixinEls)}function jb(t){return-1!==t.indexOf(Qb)&&(t=xE(t,Qb)[0]),!!cb[t]}function Wb(t){if(t.data&&"vr"===t.data.type)switch(t.data.data){case"enter":this.enterVR();break;case"exit":this.exitVR()}}Hb.componentsUpdated=[],Hb.singlePropUpdate={},customElements.define("a-entity",Hb),Jy()&&window.addEventListener("orientationchange",(function(){document.documentElement.style.height="initial",setTimeout((function(){document.documentElement.style.height="100%",setTimeout((function(){window.scrollTo(0,1)}),500)}),500)}));var qb=Ly("core:a-scene:warn"),Xb=Jy(),Yb=Wy(),Jb=ky;class Kb extends Hb{constructor(){var t;super(),(t=this).clock=new _y.Clock,t.isIOS=Xb,t.isMobile=Yb,t.hasWebXR=Jb,t.isAR=!1,t.isScene=!0,t.object3D=new _y.Scene,t.object3D.onAfterRender=function(e,n,i){t.isPlaying&&t.tock(t.time,t.delta,i)},t.resize=t.resize.bind(t),t.render=t.render.bind(t),t.systems={},t.systemNames=[],t.time=t.delta=0,t.usedOfferSession=!1,t.componentOrder=[],t.behaviors={},t.hasLoaded=!1,t.isPlaying=!1,t.originalHTML=t.innerHTML}addFullScreenStyles(){document.documentElement.classList.add("a-fullscreen")}removeFullScreenStyles(){document.documentElement.classList.remove("a-fullscreen")}doConnectedCallback(){var t=this,e=this.hasAttribute("embedded");this.setAttribute("inspector",""),this.setAttribute("keyboard-shortcuts",""),this.setAttribute("screenshot",""),this.setAttribute("xr-mode-ui",""),this.setAttribute("device-orientation-permission-ui",""),super.doConnectedCallback(),function(t){var e;function n(){document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||t.exitVR(),document.activeElement.blur(),document.body.focus()}(e=document.createElement("canvas")).classList.add("a-canvas"),e.dataset.aframeCanvas=!0,t.appendChild(e),document.addEventListener("fullscreenchange",n),document.addEventListener("mozfullscreenchange",n),document.addEventListener("webkitfullscreenchange",n),document.addEventListener("MSFullscreenChange",n),e.addEventListener("touchmove",(function(t){t.preventDefault()}),{passive:!1}),t.canvas=e,t.emit("render-target-loaded",{target:e}),setTimeout(t.resize.bind(t),0)}(this),this.setupRenderer(),function(t,e){Rx=e;var n,i,r,s,o,a,l,c,h,u,d=(Bx=t).hasAttribute(Ux)?Px.parse(Bx.getAttribute(Ux)):void 0,p=d&&d.dotsColor||"white",A=d&&d.backgroundColor||"#24CAFF";(void 0===d||"true"===d.enabled||void 0===d.enabled)&&(n=new THREE.Scene,i=new THREE.SphereGeometry(.2,36,18,0,2*Math.PI,0,Math.PI),r=new THREE.MeshBasicMaterial({color:p}),s=new THREE.Mesh(i,r),o=s.clone(),a=s.clone(),l=new THREE.PerspectiveCamera(80,window.innerWidth/window.innerHeight,5e-4,1e4),c=new THREE.Clock,h=0,u=function(){Bx.renderer.render(n,l),h=c.getElapsedTime()%4,s.visible=h>=1,o.visible=h>=2,a.visible=h>=3},n.background=new THREE.Color(A),n.add(l),s.position.set(-1,0,-15),o.position.set(0,0,-15),a.position.set(1,0,-15),l.add(s),l.add(o),l.add(a),(Tx=document.createElement("div")).className="a-loader-title",Tx.innerHTML=document.title,Tx.style.display="none",Tx.setAttribute(Sy,""),Bx.appendChild(Tx),setTimeout((function(){Bx.hasLoaded||(Ox(l),Tx.style.display="block",window.addEventListener("resize",(function(){Ox(l)})),Bx.renderer.setAnimationLoop(u))}),200))}(this,tC),this.resize(),e||this.addFullScreenStyles(),Cx()&&window.addEventListener("message",Wb.bind(this)),function(t){var e,n=document.head,i=n.querySelector("script"),r=[];return Mx.forEach(s),t.isIOS&&Sx.forEach(s),r;function s(t){t&&!t.exists()&&(e=function(t){if(t&&t.tagName){var e=document.createElement(t.tagName);return e.setAttribute(Sy,""),dx(e,t.attributes)}}(t),e&&(i?i.parentNode.insertBefore(e,i):n.appendChild(e),r.push(e)))}}(this),function(t){if(t.isMobile){var e=t.wakelock=new(Dx());t.addEventListener("enter-vr",(function(){e.request()})),t.addEventListener("exit-vr",(function(){e.release()}))}}(this),this.enterVRBound=function(){t.enterVR()},this.exitVRBound=function(){t.exitVR()},window.addEventListener("sessionend",this.resize),this.addEventListener("cameraready",(function(){t.attachedCallbackPostCamera()})),this.initSystems(),this.componentOrder=Zb(cb,this.componentOrder),this.addEventListener("componentregistered",(function(){t.componentOrder=Zb(cb,t.componentOrder)})),this.hasWebXR&&navigator.xr&&navigator.xr.addEventListener&&navigator.xr.addEventListener("sessiongranted",(function(){t.enterVR()}))}attachedCallbackPostCamera(){var t=this;window.addEventListener("load",void 0),window.addEventListener("resize",(function(){t.isIOS?setTimeout(t.resize,100):t.resize()})),this.play(),Fx.push(this)}initSystems(){var t;for(t in this.initSystem("camera"),Rb)"camera"!==t&&this.initSystem(t)}initSystem(t){this.systems[t]||(this.systems[t]=new Rb[t](this),this.systemNames.push(t))}disconnectedCallback(){var t=Fx.indexOf(this);super.disconnectedCallback(),Fx.splice(t,1),window.removeEventListener("sessionend",this.resize),this.removeFullScreenStyles(),this.renderer.dispose()}addBehavior(t){var e,n,i=this.behaviors[t.name];for(n in i||(i=this.behaviors[t.name]={tick:{inUse:!1,array:[],markedForRemoval:[]},tock:{inUse:!1,array:[],markedForRemoval:[]}}),i)if(t[n]){if((e=i[n]).inUse){var r=e.markedForRemoval.indexOf(t);-1!==r&&e.markedForRemoval.splice(r,1)}-1===e.array.indexOf(t)&&e.array.push(t)}}getPointerLockElement(){return document.pointerLockElement}checkHeadsetConnected(){return Gy()}enterAR(){var t;if(!this.hasWebXR)throw t="Failed to enter AR mode, WebXR not supported.",new Error(t);if(!zy())throw t="Failed to enter AR, WebXR immersive-ar mode not supported in your browser or device.",new Error(t);return this.enterVR(!0)}enterVR(t,e){var n,i=this,r=i.renderer.xr;if(e&&(!navigator.xr||!navigator.xr.offerSession))return Promise.resolve("OfferSession is not supported.");if(i.usedOfferSession&&e)return Promise.resolve("OfferSession was already called.");if(this.is("vr-mode"))return Promise.resolve("Already in VR.");if(this.checkHeadsetConnected()||this.isMobile){var s=i.getAttribute("renderer");if(r.enabled=!0,this.hasWebXR){this.xrSession&&this.xrSession.removeEventListener("end",this.exitVRBound);var o=this.sceneEl.systems.webxr.sessionReferenceSpaceType;r.setReferenceSpaceType(o);var a=t?"immersive-ar":"immersive-vr";return n=this.sceneEl.systems.webxr.sessionConfiguration,new Promise((function(t,o){var c=e?navigator.xr.offerSession.bind(navigator.xr):navigator.xr.requestSession.bind(navigator.xr);i.usedOfferSession|=e,c(a,n).then((function(o){e&&(i.usedOfferSession=!1),r.layersEnabled=-1!==n.requiredFeatures.indexOf("layers"),r.setSession(o).then((function(){r.setFoveation(s.foveationLevel),i.xrSession=o,i.systems.renderer.setWebXRFrameRate(o),o.addEventListener("end",i.exitVRBound),l(t)}))}),(function(t){o(new Error("Failed to enter "+("immersive-ar"===a?"AR":"VR")+" mode (`requestSession`)",{cause:t}))}))}))}throw new Error("Failed to enter "+(t?"AR":"VR")+" no WebXR")}return l(),Promise.resolve();function l(e){var n;t?i.addState("ar-mode"):i.addState("vr-mode"),i.emit("enter-vr",{target:i}),!i.hasWebXR&&i.isMobile&&screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape"),i.addFullScreenStyles(),i.isMobile||i.checkHeadsetConnected()||((n=i.canvas).requestFullscreen||n.webkitRequestFullscreen||n.mozRequestFullScreen||n.msRequestFullscreen).apply(n,[{navigationUI:"hide"}]),i.resize(),e&&e()}}exitVR(){var t=this,e=this.renderer.xr;if(!this.is("vr-mode")&&!this.is("ar-mode"))return Promise.resolve("Not in immersive mode.");if(this.checkHeadsetConnected()||this.isMobile){if(e.enabled=!1,!this.hasWebXR)throw Error("Failed to exit VR - no WebXR");this.xrSession.removeEventListener("end",this.exitVRBound),this.xrSession.end().then((function(){}),(function(){})),this.xrSession=void 0}else(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen());return t.removeState("vr-mode"),t.removeState("ar-mode"),t.isMobile&&screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),t.hasAttribute("embedded")&&t.removeFullScreenStyles(),t.resize(),t.isIOS&&_E(t.canvas),t.renderer.setPixelRatio(window.devicePixelRatio),t.emit("exit-vr",{target:t}),Promise.resolve()}getAttribute(t){var e=this.systems[t];return e?e.data:Hb.prototype.getAttribute.call(this,t)}getDOMAttribute(t){var e=this.systems[t];return e?e.data:Hb.prototype.getDOMAttribute.call(this,t)}setAttribute(t,e,n){if(Rb[t]){Fb.prototype.setAttribute.call(this,t,e);var i=this.systems[t];i&&i.updateProperties(e)}else Hb.prototype.setAttribute.call(this,t,e,n)}removeBehavior(t){var e,n,i,r=this.behaviors[t.name];for(n in r)t[n]&&-1!==(i=(e=r[n]).array.indexOf(t))&&(e.inUse?-1===e.markedForRemoval.indexOf(t)&&e.markedForRemoval.push(t):(e.array[i]=e.array[e.array.length-1],e.array.pop()))}resize(){var t,e,n=this.camera,i=this.canvas,r=this.renderer.xr.isPresenting;t=this.renderer.xr.enabled&&r,!n||!i||this.is("vr-mode")&&(this.isMobile||t)||(e=tC(i,this.getAttribute("embedded")&&!this.is("vr-mode"),this.maxCanvasSize,this.is("vr-mode")),n.aspect=e.width/e.height,n.updateProjectionMatrix(),this.renderer.setSize(e.width,e.height,!1),this.emit("rendererresize",null,!1))}setupRenderer(){var t,e,n,i=this;n={alpha:!0,antialias:!Yb,canvas:this.canvas,logarithmicDepthBuffer:!1,powerPreference:"high-performance"},this.maxCanvasSize={height:-1,width:-1},this.hasAttribute("renderer")&&((e=VE(this.getAttribute("renderer"))).precision&&(n.precision=e.precision+"p"),e.antialias&&"auto"!==e.antialias&&(n.antialias="true"===e.antialias),e.logarithmicDepthBuffer&&"auto"!==e.logarithmicDepthBuffer&&(n.logarithmicDepthBuffer="true"===e.logarithmicDepthBuffer),e.alpha&&(n.alpha="true"===e.alpha),e.stencil&&(n.stencil="true"===e.stencil),e.multiviewStereo&&(n.multiviewStereo="true"===e.multiviewStereo),this.maxCanvasSize={width:e.maxCanvasWidth?parseInt(e.maxCanvasWidth):this.maxCanvasSize.width,height:e.maxCanvasHeight?parseInt(e.maxCanvasHeight):this.maxCanvasSize.height}),(t=this.renderer=new _y.WebGLRenderer(n)).setPixelRatio(window.devicePixelRatio),this.camera&&t.xr.setPoseTarget(this.camera.el.object3D),this.addEventListener("camera-set-active",(function(){t.xr.setPoseTarget(i.camera.el.object3D)}))}play(){var t=this,e=this;this.renderStarted?Hb.prototype.play.call(this):(this.addEventListener("loaded",(function(){var t=this.renderer;Hb.prototype.play.call(this),e.renderStarted||(e.resize(),e.renderer&&(window.performance&&window.performance.mark("render-started"),window.removeEventListener("resize",Ox),Tx&&(Tx.style.display="none"),t.setAnimationLoop(this.render),e.renderStarted=!0,e.emit("renderstart")))})),setTimeout((function(){Hb.prototype.load.call(t)})))}updateComponent(t){t in Rb||Hb.prototype.updateComponent.apply(this,arguments)}tick(t,e){var n,i=this.systems;for(this.callComponentBehaviors("tick",t,e),n=0;n<this.systemNames.length;n++)i[this.systemNames[n]].tick&&i[this.systemNames[n]].tick(t,e)}tock(t,e,n){var i,r=this.systems;for(this.callComponentBehaviors("tock",t,e),i=0;i<this.systemNames.length;i++)r[this.systemNames[i]].tock&&r[this.systemNames[i]].tock(t,e,n)}render(t,e){var n=this.renderer;this.frame=e,this.delta=1e3*this.clock.getDelta(),this.time=1e3*this.clock.elapsedTime,this.isPlaying&&this.tick(this.time,this.delta);var i=null;this.is("ar-mode")&&(i=this.object3D.background,this.object3D.background=null),n.render(this.object3D,this.camera),i&&(this.object3D.background=i)}callComponentBehaviors(t,e,n){for(var i,r=0;r<this.componentOrder.length;r++){var s=this.behaviors[this.componentOrder[r]];if(s){var o=s[t];for(o.inUse=!0,i=0;i<o.array.length;i++)o.array[i].isPlaying&&o.array[i][t](e,n);for(o.inUse=!1,i=0;i<o.markedForRemoval.length;i++)this.removeBehavior(o.markedForRemoval[i]);o.markedForRemoval.length=0}}}}function Zb(t,e){var n,i,r={},s=e||[];for(i in s.length=0,t){var o=t[i];if(void 0!==o){var a=o.before?o.before.slice(0):[],l=o.after?o.after.slice(0):[];r[i]={before:a,after:l,visited:!1,done:!1}}}for(i in r)for(n=0;n<r[i].before.length;n++){var c=r[i].before[n];c in r?r[c].after.push(i):qb("Invalid ordering constraint, no component named `"+c+"` referenced by `"+i+"`")}function h(t){if(t in r&&!r[t].done)if(r[t].visited)qb("Cycle detected, ignoring one or more before/after constraints. The resulting order might be incorrect");else{r[t].visited=!0;for(var e=0;e<r[t].after.length;e++){var n=r[t].after[e];n in r||qb("Invalid before/after constraint, no component named `"+n+"` referenced in `"+t+"`"),h(n)}r[t].done=!0,s.push(t)}}for(i in r)r[i].done||h(i);return s}function $b(t,e){var n,i=window.devicePixelRatio;return!e||-1===e.width&&-1===e.height||t.width*i<e.width&&t.height*i<e.height||(n=t.width/t.height,t.width*i>e.width&&-1!==e.width&&(t.width=Math.round(e.width/i),t.height=Math.round(e.width/n/i)),t.height*i>e.height&&-1!==e.height&&(t.height=Math.round(e.height/i),t.width=Math.round(e.height*n/i))),t}function tC(t,e,n,i){return t.parentElement?e?$b({height:t.parentElement.offsetHeight,width:t.parentElement.offsetWidth},n):function(t,e){var n;return n={height:document.body.offsetHeight,width:document.body.offsetWidth},e?n:$b(n,t)}(n,i):{height:0,width:0}}customElements.define("a-scene",Kb);var eC=nb,nC={},iC=[],rC=function(){};function sC(t,e){var n,i={};if(Object.keys(e).forEach((function(t){i[t]={value:e[t],writable:!0}})),nC[t])throw new Error("The geometry `"+t+"` has been already registered");return((n=function(){rC.call(this)}).prototype=Object.create(rC.prototype,i)).name=t,n.prototype.constructor=n,nC[t]={Geometry:n,schema:eC(n.prototype.schema)},iC.push(t),n}rC.prototype={schema:{},init:function(t){return this.geometry=new _y.BufferGeometry,this.geometry},update:function(t){}};var oC=Ly,aC=wE,lC=oC("extras:primitives:debug"),cC=oC("extras:primitives:warn"),hC=oC("extras:primitives:error"),uC={};function dC(t,e){if(t=t.toLowerCase(),!Ub[t]){Ub[t]=!0,lC("Registering <%s>",t),e.defaultAttributes&&cC("The 'defaultAttributes' object is deprecated. Use 'defaultComponents' instead.");var n=e.mappings||{},i=class extends Hb{constructor(){super(),this.defaultComponentsFromPrimitive=e.defaultComponents||e.defaultAttributes||{},this.deprecated=e.deprecated||null,this.deprecatedMappings=e.deprecatedMappings||{},this.mappings=n,e.deprecated&&console.warn(e.deprecated),this.resolveMappingCollisions()}resolveMappingCollisions(){var t=this.mappings,e=this;Object.keys(t).forEach((function(n){var i;n!==n.toLowerCase()&&cC("Mapping keys should be specified in lower case. The mapping key "+n+" may not be recognized"),cb[n]&&(i=t[n].replace(".","-"),t[i]=t[n],delete t[n],console.warn("The primitive "+e.tagName.toLowerCase()+" has a mapping collision. The attribute "+n+" has the same name as a registered component and has been renamed to "+i))}))}getExtraComponents(){var t,e,n,i,r,s=this;for(e=Ax(this.defaultComponentsFromPrimitive),(r=this.getAttribute("mixin"))&&(r=xE(r.trim(),/\s+/)).forEach((function(t){var n,r,c=document.getElementById(t);if(c){var h=c.rawAttributeCache,u=c.componentCache;for(var d in h){if(i=s.mappings[d])return void pC(i,h[d],e);d in u&&(e[d]=(n=e[d],r=u[d],o(n)?a(r):o(r)?a(n):l(n)&&l(r)?px(n,r):a(r)))}}})),n=0;n<this.attributes.length;n++)t=this.attributes[n],(i=this.mappings[t.name])&&pC(i,t.value,e);return e;function o(t){return void 0===t}function a(t){return l(t)?px({},t):t}function l(t){return null!==t&&t.constructor===Object}}attributeChangedCallback(t,e,n){var i=this.mappings[t];t in this.deprecatedMappings&&console.warn(this.deprecatedMappings[t]),t&&i?aC(this,i,n):super.attributeChangedCallback(t,e,n)}};return customElements.define(t,i),i.mappings=n,uC[t]=i,i}hC("Trying to register primitive "+t+" that has been already previously registered")}function pC(t,e,n){var i=bE(t);i.constructor===Array?(n[i[0]]=n[i[0]]||{},n[i[0]][i[1]]=e.trim()):n[i]=e.trim()}var AC={},fC=[],mC={array:"v3",color:"v3",int:"i",number:"f",map:"t",time:"f",vec2:"v2",vec3:"v3",vec4:"v4"},gC=function(){};function vC(t,e){var n,i={};if(Object.keys(e).forEach((function(t){i[t]={value:e[t],writable:!0}})),AC[t])throw new Error("The shader "+t+" has already been registered");return((n=function(){gC.call(this)}).prototype=Object.create(gC.prototype,i)).name=t,n.prototype.constructor=n,AC[t]={Shader:n,schema:nb(n.prototype.schema)},fC.push(t),n}gC.prototype={schema:{},vertexShader:"void main() {gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);}",fragmentShader:"void main() {gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);}",init:function(t){return this.uniforms=this.initUniforms(),this.material=new(this.raw?_y.RawShaderMaterial:_y.ShaderMaterial)({uniforms:this.uniforms,glslVersion:this.raw||this.glsl3?_y.GLSL3:null,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader}),this.material},initUniforms:function(){var t,e,n=this.schema,i={};for(t in n)"uniform"===n[t].is&&(e=mC[n[t].type],i[t]={type:e,value:void 0});return i},update:function(t){var e,n,i=this.schema,r=this.uniforms;for(e in t)if(i[e]&&"uniform"===i[e].is)if("map"!==i[e].type)r[e].value=this.parseValue(i[e].type,t[e]),r[e].needsUpdate=!0;else{if(!r[e]||r[e].value===t[e])continue;n="_texture_"+e,this.setMapOnTextureLoad(r,e,n),UE(n,e,this,t)}},parseValue:function(t,e){var n;switch(t){case"vec2":return new _y.Vector2(e.x,e.y);case"vec3":return new _y.Vector3(e.x,e.y,e.z);case"vec4":return new _y.Vector4(e.x,e.y,e.z,e.w);case"color":return n=new _y.Color(e),new _y.Vector3(n.r,n.g,n.b);default:return e}},setMapOnTextureLoad:function(t,e,n){var i=this;this.el.addEventListener("materialtextureloaded",(function(){t[e].value=i.material[n],t[e].needsUpdate=!0}))}};var yC=new _y.FileLoader,EC=Ly("core:a-assets:warn");function xC(t){if(t.hasAttribute("autoplay")||"auto"===t.getAttribute("preload"))return new Promise((function(e,n){if(4===t.readyState)return e();if(t.error)return n();function i(){for(var n=0,i=0;i<t.buffered.length;i++)n+=t.buffered.end(i)-t.buffered.start(i);n>=t.duration&&("VIDEO"===t.tagName&&_y.Cache.add(t.getAttribute("src"),t),e())}t.addEventListener("loadeddata",i,!1),t.addEventListener("progress",i,!1),t.addEventListener("error",n,!1)}))}function bC(t){var e=function(t){var e,n,i;if(t.hasAttribute("crossorigin"))return t;if(null!==(e=t.getAttribute("src"))){if(-1===e.indexOf("://"))return t;if((i=(n=e).indexOf("://")>-1?n.split("/")[2]:n.split("/")[0]).substring(0,i.indexOf(":"))===window.location.host)return t}return EC('Cross-origin element (e.g., <img>) was requested without `crossorigin` set. A-Frame will re-request the asset with `crossorigin` attribute set. Please set `crossorigin` on the element (e.g., <img crossorigin="anonymous">)',e),t.crossOrigin="anonymous",t.cloneNode(!0)}(t);return e.tagName&&"video"===e.tagName.toLowerCase()&&(e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline","")),e!==t&&(t.parentNode.appendChild(e),t.parentNode.removeChild(t)),e}customElements.define("a-assets",class extends Fb{constructor(){super(),this.isAssets=!0,this.fileLoader=yC,this.timeout=null}doConnectedCallback(){var t,e,n,i,r,s,o=this,a=[];if(super.doConnectedCallback(),!this.parentNode.isScene)throw new Error("<a-assets> must be a child of a <a-scene>.");for(r=this.querySelectorAll("img"),t=0;t<r.length;t++)i=bC(r[t]),a.push(new Promise((function(e,n){_y.Cache.add(r[t].getAttribute("src"),i),i.complete?e():(i.onload=e,i.onerror=n)})));for(n=this.querySelectorAll("audio, video"),t=0;t<n.length;t++)(e=bC(n[t])).src||e.srcObject||EC("Audio/video asset has neither `src` nor `srcObject` attributes."),a.push(xC(e));this.getChildren().forEach((function(t){t.isAssetItem&&t.hasAttribute("src")&&a.push(new Promise((function(e,n){if(t.hasLoaded)return e();t.addEventListener("loaded",e),t.addEventListener("error",n)})))})),Promise.allSettled(a).then((function(){null!==o.timeout&&o.load()})),s=parseInt(this.getAttribute("timeout"),10)||3e3,this.timeout=setTimeout((function(){o.hasLoaded||(EC("Asset loading timed out in",s,"ms"),o.timeout=null,o.emit("timeout"),o.load())}),s)}disconnectedCallback(){super.disconnectedCallback(),this.timeout&&clearTimeout(this.timeout)}load(){super.load.call(this,null,(function(){return!1}))}}),customElements.define("a-asset-item",class extends Fb{constructor(){super(),this.data=null,this.isAssetItem=!0}connectedCallback(){var t=this,e=this.getAttribute("src");yC.setResponseType(this.getAttribute("response-type")||function(t){var e=function(t){var e=document.createElement("a");e.href=t;var n=e.search.replace(/^\?/,""),i=t.replace(n,"").replace("?","");return i.substring(i.lastIndexOf("/")+1)}(t),n=e.lastIndexOf(".");return n>=0&&".glb"===e.slice(n,t.search(/\?|#|$/))?"arraybuffer":"text"}(e)),yC.load(e,(function(e){t.data=e,Fb.prototype.load.call(t)}),(function(e){t.emit("progress",{loadedBytes:e.loaded,totalBytes:e.total,xhr:e})}),(function(e){t.emit("error",{xhr:e},!1)}))}});var CC=Ly("core:cubemap:warn");class wC extends HTMLElement{constructor(t){return super(t)}onReadyStateChange(){"complete"===document.readyState&&this.doConnectedCallback()}connectedCallback(){"complete"===document.readyState?wC.prototype.doConnectedCallback.call(this):document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){this.srcs=this.validate()}validate(){var t,e=this.querySelectorAll("[src]"),n=[];if(6===e.length){for(t=0;t<e.length;t++)"IMG"===e[t].tagName?n.push(e[t]):n.push(e[t].getAttribute("src"));return n}CC("<a-cubemap> did not contain exactly six elements each with a `src` attribute.")}}customElements.define("a-cubemap",wC),customElements.define("a-mixin",class extends Fb{constructor(){super(),this.componentCache={},this.rawAttributeCache={},this.isMixin=!0}doConnectedCallback(){super.doConnectedCallback(),this.sceneEl=this.closestScene(),this.id=this.getAttribute("id"),this.cacheAttributes(),this.updateEntities(),this.load()}attributeChangedCallback(t,e,n){super.attributeChangedCallback(),this.cacheAttribute(t,n),this.updateEntities()}setAttribute(t,e){window.HTMLElement.prototype.setAttribute.call(this,t,e),this.cacheAttribute(t,e)}cacheAttribute(t,e){var n,i;i=xE(t,"__")[0],n=cb[i],void 0===e&&(e=window.HTMLElement.prototype.getAttribute.call(this,t)),this.rawAttributeCache[t]=e,n&&(this.componentCache[t]=this.parseComponentAttrValue(n,e))}parseComponentAttrValue(t,e){var n;return"string"!=typeof e?e:(t.isSingleProperty?"string"==typeof(n=t.schema.parse(e))&&(n=e):n=VE(e),n)}getAttribute(t){return this.componentCache[t]||window.HTMLElement.prototype.getAttribute.call(this,t)}cacheAttributes(){var t,e,n=this.attributes;for(e=0;e<n.length;e++)t=n[e].name,this.cacheAttribute(t)}updateEntities(){var t,e,n;if(this.sceneEl)for(e=this.sceneEl.querySelectorAll("[mixin~="+this.id+"]"),n=0;n<e.length;n++)(t=e[n]).hasLoaded&&!t.isMixin&&t.mixinUpdate(this.id)}});const _C="1.6.0";var MC=new _y.Color,SC=new _y.Color,IC=CE,BC=wE,TC={},RC="color",LC="rotation",DC="components";function PC(t){t.x=_y.MathUtils.degToRad(t.x),t.y=_y.MathUtils.degToRad(t.y),t.z=_y.MathUtils.degToRad(t.z)}function UC(t,e,n){var i;for(i=0;i<e.length;i++)t.addEventListener(e[i],n)}function OC(t,e,n){var i;for(i=0;i<e.length;i++)t.removeEventListener(e[i],n)}function FC(t,e){var n,i,r;for(i=NC(e),r=t,n=0;n<i.length;n++)r=r[i[n]];if(void 0===r)throw console.log(t),new Error("[animation] property ("+e+") could not be found");return r}function kC(t,e,n,i){var r,s,o,a;for(e.startsWith("object3D.rotation")&&(n=_y.MathUtils.degToRad(n)),s=NC(e),a=t,r=0;r<s.length-1;r++)a=a[s[r]];o=s[s.length-1],i!==RC?a[o]=n:"r"in a[o]?(a[o].r=n.r,a[o].g=n.g,a[o].b=n.b):(a[o].x=n.r,a[o].y=n.g,a[o].z=n.b)}function NC(t){return t in TC||(TC[t]=t.split(".")),TC[t]}function QC(t){return t.isRawProperty||t.property.startsWith(DC)||t.property.startsWith("object3D")}_b("animation",{schema:{autoplay:{default:!0},delay:{default:0},dir:{default:""},dur:{default:1e3},easing:{default:"easeInQuad"},elasticity:{default:400},enabled:{default:!0},from:{default:""},loop:{default:0,parse:function(t){return!0===t||"true"===t||!1!==t&&"false"!==t&&parseInt(t,10)}},property:{default:""},startEvents:{type:"array"},pauseEvents:{type:"array"},resumeEvents:{type:"array"},round:{default:!1},to:{default:""},type:{default:""},isRawProperty:{default:!1}},multiple:!0,init:function(){var t=this;this.eventDetail={name:this.attrName},this.time=0,this.animation=null,this.animationIsPlaying=!1,this.onStartEvent=this.onStartEvent.bind(this),this.beginAnimation=this.beginAnimation.bind(this),this.pauseAnimation=this.pauseAnimation.bind(this),this.resumeAnimation=this.resumeAnimation.bind(this),this.fromColor={},this.toColor={},this.targets={},this.targetsArray=[],this.updateConfigForDefault=this.updateConfigForDefault.bind(this),this.updateConfigForRawColor=this.updateConfigForRawColor.bind(this),this.config={complete:function(){t.animationIsPlaying=!1,t.el.emit("animationcomplete",t.eventDetail,!1),t.id&&t.el.emit("animationcomplete__"+t.id,t.eventDetail,!1)}}},update:function(t){var e=this.config,n=this.data;this.animationIsPlaying=!1,this.data.enabled&&n.property&&(e.autoplay=!1,e.direction=n.dir,e.duration=n.dur,e.easing=n.easing,e.elasticity=n.elasticity,e.loop=n.loop,e.round=n.round,this.createAndStartAnimation())},tick:function(t,e){this.animationIsPlaying&&(this.time+=e,this.animation.tick(this.time))},remove:function(){this.pauseAnimation(),this.removeEventListeners()},pause:function(){this.paused=!0,this.pausedWasPlaying=this.animationIsPlaying,this.pauseAnimation(),this.removeEventListeners()},play:function(){this.paused&&(this.paused=!1,this.addEventListeners(),this.pausedWasPlaying&&(this.resumeAnimation(),this.pausedWasPlaying=!1))},createAndStartAnimation:function(){var t=this.data;this.updateConfig(),this.animationIsPlaying=!1,this.animation=Rt(this.config),this.animation.began=!0,this.removeEventListeners(),this.addEventListeners(),!t.autoplay||t.startEvents&&t.startEvents.length||(t.delay?setTimeout(this.beginAnimation,t.delay):this.beginAnimation())},beginAnimation:function(){this.updateConfig(),this.animation.began=!0,this.time=0,this.animationIsPlaying=!0,this.stopRelatedAnimations(),this.el.emit("animationbegin",this.eventDetail,!1)},pauseAnimation:function(){this.animationIsPlaying=!1},resumeAnimation:function(){this.animationIsPlaying=!0},onStartEvent:function(){this.data.enabled&&(this.updateConfig(),this.animation&&this.animation.pause(),this.animation=Rt(this.config),this.data.delay?setTimeout(this.beginAnimation,this.data.delay):this.beginAnimation())},updateConfigForRawColor:function(){var t,e,n,i=this.config,r=this.data,s=this.el;if(!this.waitComponentInitRawProperty(this.updateConfigForRawColor)){for(e in t=""===r.from?FC(s,r.property):r.from,n=r.to,this.setColorConfig(t,n),t=this.fromColor,n=this.toColor,this.targetsArray.length=0,this.targetsArray.push(t),i.targets=this.targetsArray,n)i[e]=n[e];var o;i.update=(o={},function(t){var e;(e=t.animatables[0].target).r===o.r&&e.g===o.g&&e.b===o.b||kC(s,r.property,e,r.type)})}},updateConfigForDefault:function(){var t,e,n,i,r=this.config,s=this.data,o=this.el;this.waitComponentInitRawProperty(this.updateConfigForDefault)||(t=""===s.from?QC(s)?FC(o,s.property):IC(o,s.property):s.from,n=s.to,isNaN(t||n)?(t=t?t.toString():t,n=n?n.toString():n):(t=parseFloat(t),n=parseFloat(n)),(e="true"===s.to||"false"===s.to||!0===s.to||!1===s.to)&&(t="true"===s.from||!0===s.from?1:0,n="true"===s.to||!0===s.to?1:0),this.targets.aframeProperty=t,r.targets=this.targets,r.aframeProperty=n,r.update=function(t){var n;(n=t.animatables[0].target.aframeProperty)!==i&&(i=n,e&&(n=n>=1),QC(s)?kC(o,s.property,n,s.type):BC(o,s.property,n))})},updateConfigForVector:function(){var t,e,n,i,r=this.config,s=this.data,o=this.el,a=NC(s.property),l="object3D"===a[0]?a[1]:a[0];for(t in e=""!==s.from?AE(s.from):IC(o,l),n=AE(s.to),l===LC&&(PC(e),PC(n)),this.targetsArray.length=0,this.targetsArray.push(e),r.targets=this.targetsArray,n)r[t]=n[t];r.update="position"!==l&&l!==LC&&"scale"!==l?function(){var t={};return function(e){var n=e.animatables[0].target;n.x===t.x&&n.y===t.y&&n.z===t.z||(t.x=n.x,t.y=n.y,t.z=n.z,BC(o,s.property,n))}}():(i={},function(t){var e=t.animatables[0].target;e.x===i.x&&e.y===i.y&&e.z===i.z||(i.x=e.x,i.y=e.y,i.z=e.z,o.object3D[l].set(e.x,e.y,e.z))})},updateConfig:function(){var t;t=function(t,e){var n,i,r,s;return"object3D"!==(r=e.split("."))[0]||r[2]||"position"!==r[1]&&"rotation"!==r[1]&&"scale"!==r[1]?(i=r[0],s=r[1],(n=t.components[i]||cb[i])?s&&!n.schema[s]?null:s?n.schema[s].type:n.schema.type:null):"vec3"}(this.el,this.data.property),QC(this.data)&&this.data.type===RC?this.updateConfigForRawColor():"vec2"===t||"vec3"===t||"vec4"===t?this.updateConfigForVector():this.updateConfigForDefault()},waitComponentInitRawProperty:function(t){var e,n=this.data,i=this.el,r=this;return""===n.from&&!!n.property.startsWith(DC)&&(e=NC(n.property)[1],!i.components[e]&&(i.addEventListener("componentinitialized",(function n(s){s.detail.name===e&&(t(),r.animation=Rt(r.config),i.removeEventListener("componentinitialized",n))})),!0))},stopRelatedAnimations:function(){var t,e;for(e in this.el.components)t=this.el.components[e],e!==this.attrName&&"animation"===t.name&&t.animationIsPlaying&&t.data.property===this.data.property&&(t.animationIsPlaying=!1)},addEventListeners:function(){var t=this.data,e=this.el;UC(e,t.startEvents,this.onStartEvent),UC(e,t.pauseEvents,this.pauseAnimation),UC(e,t.resumeEvents,this.resumeAnimation)},removeEventListeners:function(){var t=this.data,e=this.el;OC(e,t.startEvents,this.onStartEvent),OC(e,t.pauseEvents,this.pauseAnimation),OC(e,t.resumeEvents,this.resumeAnimation)},setColorConfig:function(t,e){MC.set(t),SC.set(e),t=this.fromColor,e=this.toColor,t.r=MC.r,t.g=MC.g,t.b=MC.b,e.r=SC.r,e.g=SC.g,e.b=SC.b}});var GC=Ly("components:anchored:warn");_b("anchored",{schema:{persistent:{default:!1}},init:function(){var t=this.el.sceneEl.getAttribute("webxr"),e=t.optionalFeatures;-1===e.indexOf("anchors")&&(e.push("anchors"),this.el.sceneEl.setAttribute("webxr",t)),this.auxQuaternion=new THREE.Quaternion,this.onEnterVR=this.onEnterVR.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR)},onEnterVR:function(){this.anchor=void 0,this.requestPersistentAnchorPending=this.data.persistent,this.requestAnchorPending=!this.data.persistent},tick:function(){var t,e,n,i=this.el.sceneEl,r=i.renderer.xr,s=this.el.object3D;(i.is("ar-mode")||i.is("vr-mode"))&&(!this.anchor&&this.requestPersistentAnchorPending&&this.restorePersistentAnchor(),!this.anchor&&this.requestAnchorPending&&this.createAnchor(),this.anchor&&(t=i.frame,e=r.getReferenceSpace(),n=t.getPose(this.anchor.anchorSpace,e),s.position.copy(n.transform.position),s.quaternion.copy(n.transform.orientation)))},createAnchor:async function(t,e){var n,i,r,s,o=this.el.sceneEl,a=o.renderer.xr,l=this.el.object3D;t=t||l.position,e=e||this.auxQuaternion.setFromEuler(l.rotation),function(t){var e=t.renderer.xr.getSession();return e&&e.restorePersistentAnchor}(o)?(this.anchor&&this.deleteAnchor(),n=o.frame,i=a.getReferenceSpace(),r=new XRRigidTransform({x:t.x,y:t.y,z:t.z},{x:e.x,y:e.y,z:e.z,w:e.w}),this.requestAnchorPending=!1,s=await n.createAnchor(r,i),this.data.persistent&&(this.el.id?(this.persistentHandle=await s.requestPersistentHandle(),localStorage.setItem(this.el.id,this.persistentHandle)):GC("The anchor won't be persisted because the entity has no assigned id.")),o.object3D.attach(this.el.object3D),this.anchor=s):GC("This browser doesn't support the WebXR anchors module")},restorePersistentAnchor:async function(){var t,e=this.el.sceneEl.renderer.xr.getSession(),n=e.persistentAnchors;if(this.requestPersistentAnchorPending=!1,!this.el.id)return GC("The entity associated to the persistent anchor cannot be retrieved because it doesn't have an assigned id."),void(this.requestAnchorPending=!0);if(n){t=localStorage.getItem(this.el.id);for(var i=0;i<n.length;++i)if(t===n[i]){this.anchor=await e.restorePersistentAnchor(n[i]),this.anchor&&(this.persistentHandle=n[i]);break}this.anchor||(this.requestAnchorPending=!0)}else this.requestPersistentAnchorPending=!0},deleteAnchor:function(){var t,e=this.anchor;e&&(t=this.el.sceneEl.renderer.xr.getSession(),e.delete(),this.el.sceneEl.object3D.add(this.el.object3D),this.persistentHandle&&t.deletePersistentAnchor(this.persistentHandle),this.anchor=void 0)}}),_b("camera",{schema:{active:{default:!0},far:{default:1e4},fov:{default:80,min:0},near:{default:.005,min:0},spectator:{default:!1},zoom:{default:1,min:0}},init:function(){var t,e=this.el;t=this.camera=new _y.PerspectiveCamera,e.setObject3D("camera",t)},update:function(t){var e=this.data,n=this.camera;n.aspect=e.aspect||window.innerWidth/window.innerHeight,n.far=e.far,n.fov=e.fov,n.near=e.near,n.zoom=e.zoom,n.updateProjectionMatrix(),this.updateActiveCamera(t),this.updateSpectatorCamera(t)},updateActiveCamera:function(t){var e=this.data,n=this.el,i=this.system;t&&t.active===e.active||e.spectator||(e.active&&i.activeCameraEl!==n?i.setActiveCamera(n):e.active||i.activeCameraEl!==n||i.disableActiveCamera())},updateSpectatorCamera:function(t){var e=this.data,n=this.el,i=this.system;t&&t.spectator===e.spectator||(e.spectator&&i.spectatorCameraEl!==n?i.setSpectatorCamera(n):e.spectator||i.spectatorCameraEl!==n||i.disableSpectatorCamera())},remove:function(){this.el.removeObject3D("camera")}});var zC,HC,VC,jC,WC="click",qC="mouseup",XC="cursor-fusing",YC="cursor-hovering",JC="cursor-hovered",KC={DOWN:["mousedown","touchstart"],UP:["mouseup","touchend"]},ZC={DOWN:["selectstart"],UP:["selectend"]},$C="a-mouse-cursor-hover",tw=(_b("cursor",{dependencies:["raycaster"],schema:{downEvents:{default:[]},fuse:{default:Wy()},fuseTimeout:{default:1500,min:0},mouseCursorStylesEnabled:{default:!0},upEvents:{default:[]},rayOrigin:{default:"entity",oneOf:["mouse","entity","xrselect"]}},after:["tracked-controls"],multiple:!0,init:function(){var t=this;this.fuseTimeout=void 0,this.cursorDownEl=null,this.intersectedEl=null,this.canvasBounds=document.body.getBoundingClientRect(),this.isCursorDown=!1,this.activeXRInput=null,this.updateCanvasBounds=ux((function(){t.canvasBounds=t.el.sceneEl.canvas.getBoundingClientRect()}),500),this.eventDetail={},this.intersectedEventDetail={cursorEl:this.el},this.onCursorDown=this.onCursorDown.bind(this),this.onCursorUp=this.onCursorUp.bind(this),this.onIntersection=this.onIntersection.bind(this),this.onIntersectionCleared=this.onIntersectionCleared.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onEnterVR=this.onEnterVR.bind(this)},update:function(t){var e=this.data.rayOrigin;e!==t.rayOrigin&&("entity"===e&&this.resetRaycaster(),this.updateMouseEventListeners(),"xrselect"!==e&&"entity"!==e||this.addWebXREventListeners(),"xrselect"!==t.rayOrigin&&"entity"!==t.rayOrigin||this.removeWebXREventListeners())},tick:function(){var t=this.el.sceneEl.frame,e=this.activeXRInput;"xrselect"===this.data.rayOrigin&&t&&e&&this.onMouseMove({frame:t,inputSource:e,type:"fakeselectevent"})},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){var t=this.el;t.removeState(YC),t.removeState(XC),clearTimeout(this.fuseTimeout),this.intersectedEl&&this.intersectedEl.removeState(JC),this.removeEventListeners()},addEventListeners:function(){var t,e=this.data,n=this.el,i=this;function r(){t=n.sceneEl.canvas,e.downEvents.length||e.upEvents.length||(KC.DOWN.forEach((function(e){t.addEventListener(e,i.onCursorDown,{passive:!1})})),KC.UP.forEach((function(e){t.addEventListener(e,i.onCursorUp,{passive:!1})})))}(t=n.sceneEl.canvas)?r():n.sceneEl.addEventListener("render-target-loaded",r),e.downEvents.forEach((function(t){n.addEventListener(t,i.onCursorDown)})),e.upEvents.forEach((function(t){n.addEventListener(t,i.onCursorUp)})),n.addEventListener("raycaster-intersection",this.onIntersection),n.addEventListener("raycaster-closest-entity-changed",this.onIntersection),n.addEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),n.sceneEl.addEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.addEventListener("enter-vr",this.onEnterVR),window.addEventListener("resize",this.updateCanvasBounds),window.addEventListener("scroll",this.updateCanvasBounds),this.updateMouseEventListeners()},removeEventListeners:function(){var t,e=this.data,n=this.el,i=this;!(t=n.sceneEl.canvas)||e.downEvents.length||e.upEvents.length||(KC.DOWN.forEach((function(e){t.removeEventListener(e,i.onCursorDown)})),KC.UP.forEach((function(e){t.removeEventListener(e,i.onCursorUp)}))),e.downEvents.forEach((function(t){n.removeEventListener(t,i.onCursorDown)})),e.upEvents.forEach((function(t){n.removeEventListener(t,i.onCursorUp)})),n.removeEventListener("raycaster-intersection",this.onIntersection),n.removeEventListener("raycaster-closest-entity-changed",this.onIntersection),n.removeEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),t.removeEventListener("mousemove",this.onMouseMove),t.removeEventListener("touchstart",this.onMouseMove),t.removeEventListener("touchmove",this.onMouseMove),n.sceneEl.removeEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.removeEventListener("enter-vr",this.onEnterVR),window.removeEventListener("resize",this.updateCanvasBounds),window.removeEventListener("scroll",this.updateCanvasBounds),this.removeWebXREventListeners()},updateMouseEventListeners:function(){var t,e=this.el;(t=e.sceneEl.canvas).removeEventListener("mousemove",this.onMouseMove),t.removeEventListener("touchmove",this.onMouseMove),e.setAttribute("raycaster","useWorldCoordinates",!1),"mouse"===this.data.rayOrigin&&(t.addEventListener("mousemove",this.onMouseMove),t.addEventListener("touchmove",this.onMouseMove,{passive:!1}),e.setAttribute("raycaster","useWorldCoordinates",!0),this.updateCanvasBounds())},resetRaycaster:function(){this.el.setAttribute("raycaster",{direction:(new THREE.Vector3).set(0,0,-1),origin:new THREE.Vector3})},addWebXREventListeners:function(){var t=this,e=this.el.sceneEl.xrSession;e&&(ZC.DOWN.forEach((function(n){e.addEventListener(n,t.onCursorDown)})),ZC.UP.forEach((function(n){e.addEventListener(n,t.onCursorUp)})))},removeWebXREventListeners:function(){var t=this,e=this.el.sceneEl.xrSession;e&&(ZC.DOWN.forEach((function(n){e.removeEventListener(n,t.onCursorDown)})),ZC.UP.forEach((function(n){e.removeEventListener(n,t.onCursorUp)})))},onMouseMove:(zC=new THREE.Vector3,HC=new THREE.Vector2,VC=new THREE.Vector3,jC={origin:VC,direction:zC},function(t){var e,n,i,r,s,o,a,l,c,h=this.canvasBounds,u=this.el.sceneEl.camera;u.parent.updateMatrixWorld(),n=(i="touchmove"===t.type||"touchstart"===t.type?t.touches.item(0):t).clientX-h.left,r=i.clientY-h.top,HC.x=n/h.width*2-1,HC.y=-r/h.height*2+1,"xrselect"!==this.data.rayOrigin||"selectstart"!==t.type&&"fakeselectevent"!==t.type?"fakeselectout"===t.type?(zC.set(0,1,0),VC.set(0,9999,0)):u&&u.isPerspectiveCamera?(VC.setFromMatrixPosition(u.matrixWorld),zC.set(HC.x,HC.y,.5).unproject(u).sub(VC).normalize()):u&&u.isOrthographicCamera?(VC.set(HC.x,HC.y,(u.near+u.far)/(u.near-u.far)).unproject(u),zC.set(0,0,-1).transformDirection(u.matrixWorld)):console.error("AFRAME.Raycaster: Unsupported camera type: "+u.type):(s=t.frame,o=t.inputSource,a=this.el.sceneEl.renderer.xr.getReferenceSpace(),(l=s.getPose(o.targetRaySpace,a))&&(c=l.transform,zC.set(0,0,-1),zC.applyQuaternion(c.orientation),VC.copy(c.position),(e=u.el.object3D.parent).localToWorld(VC),zC.transformDirection(e.matrixWorld))),this.el.setAttribute("raycaster",jC),"touchmove"===t.type&&t.preventDefault()}),onCursorDown:function(t){this.isCursorDown=!0,"mouse"===this.data.rayOrigin&&"touchstart"===t.type&&(this.onMouseMove(t),this.el.components.raycaster.checkIntersections(),t.preventDefault()),"xrselect"===this.data.rayOrigin&&"selectstart"===t.type&&(this.activeXRInput=t.inputSource,this.onMouseMove(t),this.el.components.raycaster.checkIntersections(),this.el.components.raycaster.intersectedEls.length&&void 0!==this.el.sceneEl.components["ar-hit-test"]&&this.el.sceneEl.getAttribute("ar-hit-test").enabled&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!1),this.reenableARHitTest=!0)),this.twoWayEmit("mousedown",t),this.cursorDownEl=this.intersectedEl},onCursorUp:function(t){if(this.isCursorDown&&("xrselect"!==this.data.rayOrigin||this.activeXRInput===t.inputSource)){this.isCursorDown=!1;var e=this.data;this.twoWayEmit(qC,t),!0===this.reenableARHitTest&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!0),this.reenableARHitTest=void 0),this.cursorDownEl&&this.cursorDownEl!==this.intersectedEl&&(this.intersectedEventDetail.intersection=null,this.cursorDownEl.emit(qC,this.intersectedEventDetail)),e.fuse&&"mouse"!==e.rayOrigin&&"xrselect"!==e.rayOrigin||!this.intersectedEl||this.cursorDownEl!==this.intersectedEl||this.twoWayEmit(WC,t),"xrselect"===e.rayOrigin&&this.onMouseMove({type:"fakeselectout"}),this.activeXRInput=null,this.cursorDownEl=null,"touchend"===t.type&&t.preventDefault()}},onIntersection:function(t){var e,n,i,r,s=this.el;n=t.detail.els[0]===s?1:0,r=t.detail.intersections[n],(i=t.detail.els[n])&&this.intersectedEl!==i&&(this.intersectedEl&&(e=this.el.components.raycaster.getIntersection(this.intersectedEl))&&e.distance<=r.distance||(this.clearCurrentIntersection(!0),this.setIntersection(i,r)))},onIntersectionCleared:function(t){-1!==t.detail.clearedEls.indexOf(this.intersectedEl)&&this.clearCurrentIntersection()},onEnterVR:function(){var t=this.data.rayOrigin;this.clearCurrentIntersection(!0),"xrselect"!==t&&"entity"!==t||this.addWebXREventListeners()},setIntersection:function(t,e){var n=this.el,i=this.data,r=this;this.intersectedEl!==t&&(this.intersectedEl=t,n.addState(YC),t.addState(JC),this.twoWayEmit("mouseenter"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.add($C),0!==i.fuseTimeout&&i.fuse&&"xrselect"!==i.rayOrigin&&"mouse"!==i.rayOrigin&&(n.addState(XC),this.twoWayEmit("fusing"),this.fuseTimeout=setTimeout((function(){n.removeState(XC),r.twoWayEmit(WC)}),i.fuseTimeout)))},clearCurrentIntersection:function(t){var e,n,i=this.el;this.intersectedEl&&(this.intersectedEl.removeState(JC),i.removeState(YC),i.removeState(XC),this.twoWayEmit("mouseleave"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.remove($C),this.intersectedEl=null,clearTimeout(this.fuseTimeout),!0!==t&&0!==(n=this.el.components.raycaster.intersections).length&&(e=n[n[0].object.el===i?1:0])&&this.setIntersection(e.object.el,e))},twoWayEmit:function(t,e){var n,i=this.el,r=this.intersectedEl;function s(t,n){e instanceof MouseEvent?t.mouseEvent=e:"undefined"!=typeof TouchEvent&&e instanceof TouchEvent&&(t.touchEvent=e)}n=this.el.components.raycaster.getIntersection(r),this.eventDetail.intersectedEl=r,this.eventDetail.intersection=n,s(this.eventDetail),i.emit(t,this.eventDetail),r&&(this.intersectedEventDetail.intersection=n,s(this.intersectedEventDetail),r.emit(t,this.intersectedEventDetail))}}),new _y.BufferGeometry),ew=(_b("geometry",{schema:{buffer:{default:!0},primitive:{default:"box",oneOf:iC,schemaChange:!0},skipCache:{default:!1}},init:function(){this.geometry=null},update:function(t){var e,n=this.data,i=this.el,r=this.system;this.geometry&&(r.unuseGeometry(t),this.geometry=null),this.geometry=r.getOrCreateGeometry(n),(e=i.getObject3D("mesh"))?e.geometry=this.geometry:((e=new _y.Mesh).geometry=this.geometry,this.el.getAttribute("material")||(e.material=new _y.MeshStandardMaterial({color:16777215*Math.random(),metalness:0,roughness:.5})),i.setObject3D("mesh",e))},remove:function(){this.system.unuseGeometry(this.data),this.el.getObject3D("mesh").geometry=tw,this.geometry=null},updateSchema:function(t){var e=this.oldData&&this.oldData.primitive,n=t.primitive,i=nC[n]&&nC[n].schema;if(!i)throw new Error("Unknown geometry schema `"+n+"`");e&&e===n||this.extendSchema(i)}}),"generic"),nw=(_b("generic-tracked-controller-controls",{schema:{hand:{default:""},defaultModel:{default:!0},defaultModelColor:{default:"gray"},disabled:{default:!1}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick"]},bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.wasControllerConnected=!1,this.bindMethods(),this.el.addEventListener("controllerconnected",(function(e){e.detail.name!==t.name&&(t.wasControllerConnected=!0,t.removeEventListeners(),t.removeControllersUpdateListener())}))},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data,e=t.hand?t.hand:void 0;ZE(this,ew,{hand:e,iterateControllerProfiles:!0})},play:function(){this.wasControllerConnected||(this.checkIfControllerPresent(),this.addControllersUpdateListener())},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;this.el.components["tracked-controls"]?this.removeEventListeners():(t.setAttribute("tracked-controls",{hand:e.hand,idPrefix:ew,iterateControllerProfiles:!0}),this.data.defaultModel&&this.initDefaultModel())},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.wasControllerConnected&&this.checkIfControllerPresent()},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},initDefaultModel:function(){var t=this.modelEl=document.createElement("a-entity");t.setAttribute("geometry",{primitive:"sphere",radius:.03}),t.setAttribute("material",{color:this.data.color}),this.el.appendChild(t),this.el.emit("controllermodelready",{name:"generic-tracked-controller-controls",model:this.modelEl,rayOrigin:{origin:{x:0,y:0,z:-.01},direction:{x:0,y:0,z:-1}}})}}),Ly("components:gltf-model:warn"));_b("gltf-model",{schema:{type:"model"},init:function(){var t=this,e=this.system.getDRACOLoader(),n=this.system.getMeshoptDecoder(),i=this.system.getKTX2Loader();this.model=null,this.loader=new _y.GLTFLoader,e&&this.loader.setDRACOLoader(e),this.ready=n?n.then((function(e){t.loader.setMeshoptDecoder(e)})):Promise.resolve(),i&&this.loader.setKTX2Loader(i)},update:function(){var t=this,e=this.el,n=this.data;n&&(this.remove(),this.ready.then((function(){t.loader.load(n,(function(n){t.model=n.scene||n.scenes[0],t.model.animations=n.animations,e.setObject3D("mesh",t.model),e.emit("model-loaded",{format:"gltf",model:t.model})}),void 0,(function(t){var i=t&&t.message?t.message:"Failed to load glTF model";nw(i),e.emit("model-error",{format:"gltf",src:n})}))})))},remove:function(){this.model&&this.el.removeObject3D("mesh")}}),_b("grabbable",{init:function(){this.el.setAttribute("obb-collider","centerModel: true")}});var iw,rw=My+"controllers/oculus-hands/v4/left.glb",sw=My+"controllers/oculus-hands/v4/right.glb",ow=["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"];_b("hand-tracking-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},modelStyle:{default:"mesh",oneOf:["dots","mesh"]},modelColor:{default:"white"},modelOpacity:{default:1}},after:["tracked-controls"],bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this)},addEventListeners:function(){this.el.addEventListener("model-loaded",this.onModelLoaded);for(var t=0;t<this.jointEls.length;++t)this.jointEls[t].object3D.visible=!0},removeEventListeners:function(){this.el.removeEventListener("model-loaded",this.onModelLoaded);for(var t=0;t<this.jointEls.length;++t)this.jointEls[t].object3D.visible=!1},init:function(){var t=this.el.sceneEl,e=t.getAttribute("webxr"),n=e.optionalFeatures;-1===n.indexOf("hand-tracking")&&(n.push("hand-tracking"),t.setAttribute("webxr",e)),this.wristObject3D=new THREE.Object3D,this.el.sceneEl.object3D.add(this.wristObject3D),this.onModelLoaded=this.onModelLoaded.bind(this),this.onChildAttached=this.onChildAttached.bind(this),this.jointEls=[],this.controllerPresent=!1,this.isPinched=!1,this.pinchEventDetail={position:new THREE.Vector3,wristRotation:new THREE.Quaternion},this.indexTipPosition=new THREE.Vector3,this.hasPoses=!1,this.jointPoses=new Float32Array(16*ow.length),this.jointRadii=new Float32Array(ow.length),this.bindMethods(),this.updateReferenceSpace=this.updateReferenceSpace.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.updateReferenceSpace),this.el.sceneEl.addEventListener("exit-vr",this.updateReferenceSpace),this.el.addEventListener("child-attached",this.onChildAttached),this.wristObject3D.visible=!1},onChildAttached:function(t){this.addChildEntity(t.detail.el)},update:function(){this.updateModelMaterial()},updateModelMaterial:function(){var t=this.jointEls,e=this.skinnedMesh,n=!(1===this.data.modelOpacity);e&&(this.skinnedMesh.material.color.set(this.data.modelColor),this.skinnedMesh.material.transparent=n,this.skinnedMesh.material.opacity=this.data.modelOpacity);for(var i=0;i<t.length;i++)t[i].setAttribute("material",{color:this.data.modelColor,transparent:n,opacity:this.data.modelOpacity})},updateReferenceSpace:function(){var t=this,e=this.el.sceneEl.xrSession;if(this.referenceSpace=void 0,e){var n=t.el.sceneEl.systems.webxr.sessionReferenceSpaceType;e.requestReferenceSpace(n).then((function(e){t.referenceSpace=e})).catch((function(e){throw t.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(n,"tracked-controls-webxr uses reference space "+n),e}))}},checkIfControllerPresent:function(){var t=this.data;ZE(this,"",{hand:t.hand?t.hand:void 0,iterateControllerProfiles:!0,handTracking:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},tick:function(){var t=this.el.sceneEl,e=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller,n=t.frame,i=this.el.components["tracked-controls"],r=this.referenceSpace;e&&n&&r&&i&&(this.hasPoses=!1,e.hand&&(this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),this.hasPoses=n.fillPoses(e.hand.values(),r,this.jointPoses)&&n.fillJointRadii(e.hand.values(),this.jointRadii),this.updateHandModel(),this.detectGesture(),this.updateWristObject()))},updateWristObject:(iw=new THREE.Matrix4,function(){var t=this.wristObject3D;t&&this.hasPoses&&(iw.fromArray(this.jointPoses,0),t.position.setFromMatrixPosition(iw),t.quaternion.setFromRotationMatrix(iw))}),updateHandModel:function(){this.wristObject3D.visible=!0,this.el.object3D.visible=!0,"dots"===this.data.modelStyle&&this.updateHandDotsModel(),"mesh"===this.data.modelStyle&&this.updateHandMeshModel()},getBone:function(t){for(var e=this.bones,n=0;n<e.length;n++)if(e[n].name===t)return e[n];return null},updateHandMeshModel:function(){var t=new THREE.Matrix4;return function(){var e=0,n=this.jointPoses,i=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller;if(i&&this.mesh&&(this.mesh.visible=!1,this.hasPoses))for(var r of i.hand.values()){var s=this.getBone(r.jointName);null!=s&&(this.mesh.visible=!0,t.fromArray(n,16*e),s.position.setFromMatrixPosition(t),s.quaternion.setFromRotationMatrix(t)),e++}}}(),updateHandDotsModel:function(){for(var t,e,n=this.jointPoses,i=this.jointRadii,r=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller,s=0;s<r.hand.size;s++)e=(t=this.jointEls[s]).object3D,t.object3D.visible=this.hasPoses,this.hasPoses&&(e.matrix.fromArray(n,16*s),e.matrix.decompose(e.position,e.rotation,e.scale),t.setAttribute("scale",{x:i[s],y:i[s],z:i[s]}))},detectGesture:function(){this.detectPinch()},detectPinch:function(){var t=new THREE.Vector3,e=new THREE.Matrix4;return function(){var n=this.indexTipPosition,i=this.pinchEventDetail;if(this.hasPoses){t.setFromMatrixPosition(e.fromArray(this.jointPoses,64)),n.setFromMatrixPosition(e.fromArray(this.jointPoses,144)),i.wristRotation.setFromRotationMatrix(e.fromArray(this.jointPoses,0));var r=n.distanceTo(t);r<.015&&!1===this.isPinched&&(this.isPinched=!0,i.position.copy(n).add(t).multiplyScalar(.5),this.el.emit("pinchstarted",i)),r>.02&&!0===this.isPinched&&(this.isPinched=!1,i.position.copy(n).add(t).multiplyScalar(.5),this.el.emit("pinchended",i)),this.isPinched&&(i.position.copy(n).add(t).multiplyScalar(.5),this.el.emit("pinchmoved",i))}}}(),pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{id:"",hand:e.hand,iterateControllerProfiles:!0,handTrackingEnabled:!0}),this.mesh?this.mesh!==t.getObject3D("mesh")&&t.setObject3D("mesh",this.mesh):this.initDefaultModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){var t,e=this.el;this.checkIfControllerPresent(),t=e.components["tracked-controls"]&&e.components["tracked-controls"].controller,this.mesh&&t&&t.hand&&t.hand instanceof XRHand&&e.setObject3D("mesh",this.mesh)},initDefaultModel:function(){var t=this.data;"dots"===t.modelStyle&&this.initDotsModel(),"mesh"===t.modelStyle&&this.initMeshHandModel(),this.el.object3D.visible=!0,this.wristObject3D.visible=!0},initDotsModel:function(){if(0===this.jointEls.length){for(var t=0;t<ow.length;++t){var e=this.jointEl=document.createElement("a-entity");e.setAttribute("geometry",{primitive:"sphere",radius:1}),e.object3D.visible=!1,this.el.appendChild(e),this.jointEls.push(e)}this.updateModelMaterial()}},initMeshHandModel:function(){var t="left"===this.data.hand?rw:sw;this.el.setAttribute("gltf-model",t)},onModelLoaded:function(){var t=this.mesh=this.el.getObject3D("mesh").children[0],e=this.skinnedMesh=t.getObjectByProperty("type","SkinnedMesh");this.skinnedMesh&&(this.bones=e.skeleton.bones,this.el.removeObject3D("mesh"),t.position.set(0,0,0),t.rotation.set(0,0,0),e.frustumCulled=!1,e.material=new THREE.MeshStandardMaterial,this.updateModelMaterial(),this.setupChildrenEntities(),this.el.setObject3D("mesh",t))},setupChildrenEntities:function(){for(var t=this.el.children,e=0;e<t.length;++e)t[e]instanceof Hb&&this.addChildEntity(t[e])},addChildEntity:function(t){t instanceof Hb&&this.wristObject3D.add(t.object3D)}}),_b("hand-tracking-grab-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},color:{type:"color",default:"white"},hoverColor:{type:"color",default:"#538df1"},hoverEnabled:{default:!1}},init:function(){var t,e=this.el,n=this.data;t="right"===n.hand?"components.hand-tracking-controls.bones.3":"components.hand-tracking-controls.bones.21",e.setAttribute("hand-tracking-controls",{hand:n.hand}),e.setAttribute("obb-collider",{trackedObject3D:t,size:.04}),this.auxMatrix=new _y.Matrix4,this.onCollisionStarted=this.onCollisionStarted.bind(this),this.el.addEventListener("obbcollisionstarted",this.onCollisionStarted),this.onCollisionEnded=this.onCollisionEnded.bind(this),this.el.addEventListener("obbcollisionended",this.onCollisionEnded),this.onPinchStarted=this.onPinchStarted.bind(this),this.el.addEventListener("pinchstarted",this.onPinchStarted),this.onPinchEnded=this.onPinchEnded.bind(this),this.el.addEventListener("pinchended",this.onPinchEnded)},transferEntityOwnership:function(){for(var t,e=this.el.sceneEl.querySelectorAll("[hand-tracking-grab-controls]"),n=0;n<e.length;++n)(t=e[n].components["hand-tracking-grab-controls"])!==this&&this.grabbedEl&&this.grabbedEl===t.grabbedEl&&t.releaseGrabbedEntity();return!1},onCollisionStarted:function(t){var e=t.detail.withEl;this.collidedEl||e.getAttribute("grabbable")&&(this.collidedEl=e,this.grabbingObject3D=t.detail.trackedObject3D,this.data.hoverEnabled&&this.el.setAttribute("hand-tracking-controls","modelColor",this.data.hoverColor))},onCollisionEnded:function(){this.collidedEl=void 0,this.grabbedEl||(this.grabbingObject3D=void 0,this.data.hoverEnabled&&this.el.setAttribute("hand-tracking-controls","modelColor",this.data.color))},onPinchStarted:function(t){this.collidedEl&&(this.grabbedEl=this.collidedEl,this.transferEntityOwnership(),this.grab())},onPinchEnded:function(){this.releaseGrabbedEntity()},releaseGrabbedEntity:function(){var t=this.grabbedEl;if(t){var e=t.object3D,n=e.parent,i=this.originalParent;e.applyMatrix4(n.matrixWorld),e.applyMatrix4(this.auxMatrix.copy(i.matrixWorld).invert()),n.remove(e),i.add(e),this.el.emit("grabended",{grabbedEl:t}),this.grabbedEl=void 0,this.originalParent=void 0}},grab:function(){var t=this.grabbedEl,e=t.object3D,n=e.parent;this.originalParent=n;var i=this.el.components["hand-tracking-controls"].wristObject3D;e.applyMatrix4(n.matrixWorld),e.applyMatrix4(this.auxMatrix.copy(i.matrixWorld).invert()),n.remove(e),i.add(e),this.el.emit("grabstarted",{grabbedEl:t})}});var aw={toonLeft:My+"controllers/hands/leftHand.glb",toonRight:My+"controllers/hands/rightHand.glb",lowPolyLeft:My+"controllers/hands/leftHandLow.glb",lowPolyRight:My+"controllers/hands/rightHandLow.glb",highPolyLeft:My+"controllers/hands/leftHandHigh.glb",highPolyRight:My+"controllers/hands/rightHandHigh.glb"},lw="Point",cw="Fist",hw="Thumb Up",uw={};function dw(t,e){var n;if(t)return"grip"===(n=uw[t])?n+(e?"close":"open"):"point"===n?n+(e?"up":"down"):"pointing"===n||"pistol"===n?n+(e?"start":"end"):void 0}uw[cw]="grip",uw[hw]="pistol",uw[lw]="pointing",_b("hand-controls",{schema:{color:{default:"white",type:"color"},hand:{default:"left"},handModelStyle:{default:"lowPoly",oneOf:["lowPoly","highPoly","toon"]}},after:["tracked-controls"],init:function(){var t=this,e=this.el;this.pressedButtons={},this.touchedButtons={},this.loader=new THREE.GLTFLoader,this.loader.setCrossOrigin("anonymous"),this.onGripDown=function(){t.handleButton("grip","down")},this.onGripUp=function(){t.handleButton("grip","up")},this.onTrackpadDown=function(){t.handleButton("trackpad","down")},this.onTrackpadUp=function(){t.handleButton("trackpad","up")},this.onTrackpadTouchStart=function(){t.handleButton("trackpad","touchstart")},this.onTrackpadTouchEnd=function(){t.handleButton("trackpad","touchend")},this.onTriggerDown=function(){t.handleButton("trigger","down")},this.onTriggerUp=function(){t.handleButton("trigger","up")},this.onTriggerTouchStart=function(){t.handleButton("trigger","touchstart")},this.onTriggerTouchEnd=function(){t.handleButton("trigger","touchend")},this.onGripTouchStart=function(){t.handleButton("grip","touchstart")},this.onGripTouchEnd=function(){t.handleButton("grip","touchend")},this.onThumbstickDown=function(){t.handleButton("thumbstick","down")},this.onThumbstickUp=function(){t.handleButton("thumbstick","up")},this.onAorXTouchStart=function(){t.handleButton("AorX","touchstart")},this.onAorXTouchEnd=function(){t.handleButton("AorX","touchend")},this.onBorYTouchStart=function(){t.handleButton("BorY","touchstart")},this.onBorYTouchEnd=function(){t.handleButton("BorY","touchend")},this.onSurfaceTouchStart=function(){t.handleButton("surface","touchstart")},this.onSurfaceTouchEnd=function(){t.handleButton("surface","touchend")},this.onControllerConnected=this.onControllerConnected.bind(this),this.onControllerDisconnected=this.onControllerDisconnected.bind(this),e.addEventListener("controllerconnected",this.onControllerConnected),e.addEventListener("controllerdisconnected",this.onControllerDisconnected),e.object3D.visible=!1},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},tick:function(t,e){var n=this.el.getObject3D("mesh");n&&n.mixer&&n.mixer.update(e/1e3)},onControllerConnected:function(t){var e=this.el,n=this.data.hand,i=this.el.getObject3D("mesh");e.object3D.visible=!0;var r="left"===n?Math.PI/2:-Math.PI/2,s=e.sceneEl.hasWebXR?-Math.PI/2:0;"pico-controls"===t.detail.name&&(s+=Math.PI/4),i.position.set(0,0,0),i.rotation.set(s,0,r)},onControllerDisconnected:function(){this.el.object3D.visible=!1},addEventListeners:function(){var t=this.el;t.addEventListener("gripdown",this.onGripDown),t.addEventListener("gripup",this.onGripUp),t.addEventListener("trackpaddown",this.onTrackpadDown),t.addEventListener("trackpadup",this.onTrackpadUp),t.addEventListener("trackpadtouchstart",this.onTrackpadTouchStart),t.addEventListener("trackpadtouchend",this.onTrackpadTouchEnd),t.addEventListener("triggerdown",this.onTriggerDown),t.addEventListener("triggerup",this.onTriggerUp),t.addEventListener("triggertouchstart",this.onTriggerTouchStart),t.addEventListener("triggertouchend",this.onTriggerTouchEnd),t.addEventListener("griptouchstart",this.onGripTouchStart),t.addEventListener("griptouchend",this.onGripTouchEnd),t.addEventListener("thumbstickdown",this.onThumbstickDown),t.addEventListener("thumbstickup",this.onThumbstickUp),t.addEventListener("abuttontouchstart",this.onAorXTouchStart),t.addEventListener("abuttontouchend",this.onAorXTouchEnd),t.addEventListener("bbuttontouchstart",this.onBorYTouchStart),t.addEventListener("bbuttontouchend",this.onBorYTouchEnd),t.addEventListener("xbuttontouchstart",this.onAorXTouchStart),t.addEventListener("xbuttontouchend",this.onAorXTouchEnd),t.addEventListener("ybuttontouchstart",this.onBorYTouchStart),t.addEventListener("ybuttontouchend",this.onBorYTouchEnd),t.addEventListener("surfacetouchstart",this.onSurfaceTouchStart),t.addEventListener("surfacetouchend",this.onSurfaceTouchEnd)},removeEventListeners:function(){var t=this.el;t.removeEventListener("gripdown",this.onGripDown),t.removeEventListener("gripup",this.onGripUp),t.removeEventListener("trackpaddown",this.onTrackpadDown),t.removeEventListener("trackpadup",this.onTrackpadUp),t.removeEventListener("trackpadtouchstart",this.onTrackpadTouchStart),t.removeEventListener("trackpadtouchend",this.onTrackpadTouchEnd),t.removeEventListener("triggerdown",this.onTriggerDown),t.removeEventListener("triggerup",this.onTriggerUp),t.removeEventListener("triggertouchstart",this.onTriggerTouchStart),t.removeEventListener("triggertouchend",this.onTriggerTouchEnd),t.removeEventListener("griptouchstart",this.onGripTouchStart),t.removeEventListener("griptouchend",this.onGripTouchEnd),t.removeEventListener("thumbstickdown",this.onThumbstickDown),t.removeEventListener("thumbstickup",this.onThumbstickUp),t.removeEventListener("abuttontouchstart",this.onAorXTouchStart),t.removeEventListener("abuttontouchend",this.onAorXTouchEnd),t.removeEventListener("bbuttontouchstart",this.onBorYTouchStart),t.removeEventListener("bbuttontouchend",this.onBorYTouchEnd),t.removeEventListener("xbuttontouchstart",this.onAorXTouchStart),t.removeEventListener("xbuttontouchend",this.onAorXTouchEnd),t.removeEventListener("ybuttontouchstart",this.onBorYTouchStart),t.removeEventListener("ybuttontouchend",this.onBorYTouchEnd),t.removeEventListener("surfacetouchstart",this.onSurfaceTouchStart),t.removeEventListener("surfacetouchend",this.onSurfaceTouchEnd)},update:function(t){var e,n=this.el,i=this.data.hand,r=this.data.handModelStyle,s=this.data.color,o=this;if(e={hand:i,model:!1},i!==t){var a=aw[r+i.charAt(0).toUpperCase()+i.slice(1)];this.loader.load(a,(function(t){var i=t.scene.children[0];i.mixer=new THREE.AnimationMixer(i),o.clips=t.animations,n.setObject3D("mesh",i),i.traverse((function(t){t.isMesh&&(t.material.color=new THREE.Color(s))})),n.setAttribute("magicleap-controls",e),n.setAttribute("vive-controls",e),n.setAttribute("meta-touch-controls",e),n.setAttribute("pico-controls",e),n.setAttribute("windows-motion-controls",e),n.setAttribute("hp-mixed-reality-controls",e)}))}},remove:function(){this.el.removeObject3D("mesh")},handleButton:function(t,e){var n,i="down"===e,r="touchstart"===e;if(0===e.indexOf("touch")){if(r===this.touchedButtons[t])return;this.touchedButtons[t]=r}else{if(i===this.pressedButtons[t])return;this.pressedButtons[t]=i}n=this.gesture,this.gesture=this.determineGesture(),this.gesture!==n&&(this.animateGesture(this.gesture,n),this.emitGestureEvents(this.gesture,n))},determineGesture:function(){var t,e,n,i=this.pressedButtons.grip,r=this.pressedButtons.surface||this.touchedButtons.surface,s=this.pressedButtons.trackpad||this.touchedButtons.trackpad,o=this.pressedButtons.trigger||this.touchedButtons.trigger,a=this.touchedButtons.AorX||this.touchedButtons.BorY;return e=this.el.components["tracked-controls"],(n=e&&e.controller)&&(n.id&&0===n.id.indexOf("OpenVR ")||n.profiles&&n.profiles[0]&&"htc-vive"===n.profiles[0])?i||o?t=cw:s&&(t=lw):i?t=r||a||s?o?cw:lw:o?hw:"Point + Thumb":o&&(t="Hold"),t},getClip:function(t){var e,n;for(n=0;n<this.clips.length;n++)if((e=this.clips[n]).name===t)return e},animateGesture:function(t,e){t?this.playAnimation(t||"Open",e,!1):this.playAnimation(e,e,!0)},emitGestureEvents:function(t,e){var n,i=this.el;e!==t&&((n=dw(e,!1))&&i.emit(n),(n=dw(t,!0))&&i.emit(n))},playAnimation:function(t,e,n){var i,r,s=this.el.getObject3D("mesh");if(s){if(i=this.getClip(t),r=s.mixer.clipAction(i),n)return r.paused=!1,void(r.timeScale=-1);if(r.clampWhenFinished=!0,r.loop=THREE.LoopOnce,r.repetitions=0,r.timeScale=1,r.time=0,r.weight=1,!e)return s.mixer.stopAllAction(),void r.play();i=this.getClip(e),r.reset(),r.play(),s.mixer.clipAction(i).crossFadeTo(r,.15,!0)}}}),_b("hide-on-enter-ar",{init:function(){var t=this;this.el.sceneEl.addEventListener("enter-vr",(function(){t.el.sceneEl.is("ar-mode")&&(t.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){t.el.object3D.visible=!0}))}}),_b("hide-on-enter-vr",{init:function(){var t=this;this.el.sceneEl.addEventListener("enter-vr",(function(){t.el.sceneEl.is("vr-mode")&&(t.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){t.el.object3D.visible=!0}))}});var pw="hp-mixed-reality",Aw=My+"controllers/hp/mixed-reality/",fw={x:0,y:0,z:.06},mw={_x:Math.PI/4,_y:0,_z:0,_order:"XYZ"},gw=(_b("hp-mixed-reality-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{left:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var t=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){nx(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t,t.data.hand)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t,t.data.hand)},this.previousButtonValues={},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;ZE(this,pw,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:pw,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",Aw+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping[this.data.hand].buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){var e=t.detail.model;this.data.model&&(e.position.copy(fw),e.rotation.copy(mw),this.el.emit("controllermodelready",{name:"hp-mixed-reality-controls",model:this.data.model,rayOrigin:new _y.Vector3(0,0,0)}))},onAxisMoved:function(t){ex(this,this.mapping.axes,t)}}),Ly("components:layer:warn"));function vw(t,e,n){return(e.dot(t)-e.dot(n))/e.length()}_b("layer",{schema:{type:{default:"quad",oneOf:["quad","monocubemap","stereocubemap"]},src:{type:"map"},rotateCubemap:{default:!1},width:{default:0},height:{default:0}},init:function(){var t=this.el.sceneEl.renderer.getContext();this.quaternion=new THREE.Quaternion,this.position=new THREE.Vector3,this.bindMethods(),this.needsRedraw=!1,this.frameBuffer=t.createFramebuffer();var e=this.el.sceneEl.getAttribute("webxr"),n=e.requiredFeatures;-1===n.indexOf("layers")&&(n.push("layers"),this.el.sceneEl.setAttribute("webxr",e)),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR),this.el.sceneEl.addEventListener("exit-vr",this.onExitVR)},bindMethods:function(){this.onRequestedReferenceSpace=this.onRequestedReferenceSpace.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this)},update:function(t){this.data.src!==t.src&&this.updateSrc()},updateSrc:function(){var t=this.data.type;this.texture=void 0,"quad"!==t?"monocubemap"!==t&&"stereocubemap"!==t||this.loadCubeMapImages():this.loadQuadImage()},loadCubeMapImages:function(){var t,e=this.xrGLFactory,n=this.el.sceneEl.frame,i=this.data.src,r=this.data.type;this.visibilityChanged=!1,this.layer&&("monocubemap"!==r&&"stereocubemap"!==r||(i.complete?this.pendingCubeMapUpdate=!1:this.pendingCubeMapUpdate=!0,this.loadingScreen?this.loadingScreen=!1:this.loadingScreen=!0,"monocubemap"===r?(t=e.getSubImage(this.layer,n),this.loadCubeMapImage(t.colorTexture,i,0)):(t=e.getSubImage(this.layer,n,"left"),this.loadCubeMapImage(t.colorTexture,i,0),t=e.getSubImage(this.layer,n,"right"),this.loadCubeMapImage(t.colorTexture,i,6))))},loadQuadImage:function(){var t=this.data.src,e=this;this.el.sceneEl.systems.material.loadTexture(t,{src:t},(function(n){e.el.sceneEl.renderer.initTexture(n),e.texture=n,"VIDEO"===t.tagName&&setTimeout((function(){e.textureIsVideo=!0}),1e3),e.layer&&(e.layer.height=e.data.height/2||e.texture.image.height/1e3,e.layer.width=e.data.width/2||e.texture.image.width/1e3,e.needsRedraw=!0),e.updateQuadPanel()}))},preGenerateCubeMapTextures:function(t,e){"monocubemap"===this.data.type?this.generateCubeMapTextures(t,0,e):(this.generateCubeMapTextures(t,0,e),this.generateCubeMapTextures(t,6,e))},generateCubeMapTextures:function(t,e,n){for(var i,r,s=this.data,o=this.cubeFaceSize,a=Math.min(t.width,t.height),l=[],c=0;c<6;c++){var h=document.createElement("CANVAS");h.width=h.height=o;var u=h.getContext("2d");s.rotateCubemap&&(2!==c&&3!==c||(u.save(),u.translate(o,o),u.rotate(Math.PI))),u.drawImage(t,(c+e)*a,0,a,a,0,0,o,o),u.restore(),n&&n(),l.push(h)}return s.rotateCubemap&&(i=l[0],r=l[1],l[0]=r,l[1]=i,i=l[4],r=l[5],l[4]=r,l[5]=i),n&&n(),l},loadCubeMapImage:function(t,e,n){var i,r=this.el.sceneEl.renderer.getContext();r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.bindTexture(r.TEXTURE_CUBE_MAP,t),i=!e.complete||this.loadingScreen?this.loadingScreenImages:this.generateCubeMapTextures(e,n);var s=0;i.forEach((function(t,e){r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,r.RGBA,r.UNSIGNED_BYTE,t),s=r.getError()})),0!==s&&console.log("renderingError, WebGL Error Code: "+s),r.bindTexture(r.TEXTURE_CUBE_MAP,null)},tick:function(){this.el.sceneEl.xrSession&&this.referenceSpace&&(this.layer||!this.el.sceneEl.is("vr-mode")&&!this.el.sceneEl.is("ar-mode")||this.initLayer(),this.updateTransform(),this.data.src.complete&&(this.pendingCubeMapUpdate||this.loadingScreen||this.visibilityChanged)&&this.loadCubeMapImages(),(this.needsRedraw||this.layer.needsRedraw||this.textureIsVideo)&&("quad"===this.data.type&&this.draw(),this.needsRedraw=!1))},initLayer:function(){var t=this,e=this.data.type;this.el.sceneEl.xrSession.onvisibilitychange=function(e){t.visibilityChanged="hidden"!==e.session.visibilityState},"quad"!==e?"monocubemap"!==e&&"stereocubemap"!==e||this.initCubeMapLayer():this.initQuadLayer()},initQuadLayer:function(){var t=this.el.sceneEl,e=t.renderer.getContext(),n=this.xrGLFactory=new XRWebGLBinding(t.xrSession,e);this.texture&&(this.layer=n.createQuadLayer({space:this.referenceSpace,viewPixelHeight:2048,viewPixelWidth:2048,height:this.data.height/2||this.texture.image.height/1e3,width:this.data.width/2||this.texture.image.width/1e3}),this.initLoadingScreenImages(),t.renderer.xr.addLayer(this.layer))},initCubeMapLayer:function(){var t=this.data.src,e=this.el.sceneEl,n=e.renderer.getContext(),i=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),r=this.cubeFaceSize=Math.min(i,Math.min(t.width,t.height)),s=this.xrGLFactory=new XRWebGLBinding(e.xrSession,n);this.layer=s.createCubeLayer({space:this.referenceSpace,viewPixelWidth:r,viewPixelHeight:r,layout:"monocubemap"===this.data.type?"mono":"stereo",isStatic:!1}),this.initLoadingScreenImages(),this.loadCubeMapImages(),e.renderer.xr.addLayer(this.layer)},initLoadingScreenImages:function(){for(var t=this.cubeFaceSize,e=this.loadingScreenImages=[],n=0;n<6;n++){var i=document.createElement("CANVAS");i.width=i.height=t;var r=i.getContext("2d");i.width=i.height=t,r.fillStyle="black",r.fillRect(0,0,t,t),2!==n&&3!==n&&(r.translate(t,0),r.scale(-1,1),r.fillStyle="white",r.font="30px Arial",r.fillText("Loading",t/2,t/2)),e.push(i)}},destroyLayer:function(){this.layer&&(this.el.sceneEl.renderer.xr.removeLayer(this.layer),this.layer.destroy(),this.layer=void 0)},toggleCompositorLayer:function(){this.enableCompositorLayer(!this.layerEnabled)},enableCompositorLayer:function(t){this.layerEnabled=t,this.quadPanelEl.object3D.visible=!this.layerEnabled},updateQuadPanel:function(){var t=this.quadPanelEl;this.quadPanelEl||(t=this.quadPanelEl=document.createElement("a-entity"),this.el.appendChild(t)),t.setAttribute("material",{shader:"flat",src:this.data.src,transparent:!0}),t.setAttribute("geometry",{primitive:"plane",height:this.data.height||this.texture.image.height/1e3,width:this.data.width||this.texture.image.height/1e3})},draw:function(){var t=this.el.sceneEl,e=this.el.sceneEl.renderer.getContext(),n=this.xrGLFactory.getSubImage(this.layer,t.frame),i=t.renderer.properties.get(this.texture).__webglTexture,r=e.getParameter(e.FRAMEBUFFER_BINDING);e.viewport(n.viewport.x,n.viewport.y,n.viewport.width,n.viewport.height),e.bindFramebuffer(e.FRAMEBUFFER,this.frameBuffer),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n.colorTexture,0),function(t,e,n,i){var r=t.createFramebuffer(),s=n.viewport.x,o=n.viewport.y,a=n.viewport.x+n.viewport.width,l=n.viewport.y+n.viewport.height;"VIDEO"===i.tagName&&(t.bindTexture(t.TEXTURE_2D,e),t.texSubImage2D(t.TEXTURE_2D,0,0,0,i.width,i.height,t.RGB,t.UNSIGNED_BYTE,i)),t.bindFramebuffer(t.READ_FRAMEBUFFER,r),t.framebufferTexture2D(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),t.readBuffer(t.COLOR_ATTACHMENT0),t.blitFramebuffer(0,0,i.width,i.height,s,o,a,l,t.COLOR_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.deleteFramebuffer(r)}(e,i,n,this.data.src),e.bindFramebuffer(e.FRAMEBUFFER,r)},updateTransform:function(){var t=this.el,e=this.position,n=this.quaternion;t.object3D.updateMatrixWorld(),e.setFromMatrixPosition(t.object3D.matrixWorld),n.setFromRotationMatrix(t.object3D.matrixWorld),this.layerEnabled||e.set(0,0,1e8),this.layer.transform=new XRRigidTransform(e,n)},onEnterVR:function(){var t=this.el.sceneEl,e=t.xrSession;t.hasWebXR&&XRWebGLBinding&&e?(e.requestReferenceSpace("local-floor").then(this.onRequestedReferenceSpace),this.layerEnabled=!0,this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!1),this.data.src.play&&this.data.src.play()):gw("The layer component requires WebXR and the layers API enabled")},onExitVR:function(){this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!0),this.destroyLayer()},onRequestedReferenceSpace:function(t){this.referenceSpace=t}}),_b("laser-controls",{schema:{hand:{default:"right"},model:{default:!0},defaultModelColor:{type:"color",default:"grey"}},init:function(){var t=this.config,e=this.data,n=this.el,i=this,r={hand:e.hand,model:e.model};function s(e){var r=t[e.detail.name];if(r){var s=dx({showLine:!0},r.raycaster||{});e.detail.rayOrigin&&(s.origin=e.detail.rayOrigin.origin,s.direction=e.detail.rayOrigin.direction,s.showLine=!0),e.detail.rayOrigin||!i.modelReady?n.setAttribute("raycaster",s):n.setAttribute("raycaster","showLine",!0),n.setAttribute("cursor",dx({fuse:!1},r.cursor))}}n.setAttribute("hp-mixed-reality-controls",r),n.setAttribute("magicleap-controls",r),n.setAttribute("oculus-go-controls",r),n.setAttribute("meta-touch-controls",r),n.setAttribute("pico-controls",r),n.setAttribute("valve-index-controls",r),n.setAttribute("vive-controls",r),n.setAttribute("vive-focus-controls",r),n.setAttribute("windows-motion-controls",r),n.setAttribute("generic-tracked-controller-controls",{hand:r.hand}),n.addEventListener("controllerconnected",s),n.addEventListener("controllerdisconnected",(function(e){t[e.detail.name]&&n.setAttribute("raycaster","showLine",!1)})),n.addEventListener("controllermodelready",(function(t){s(t),i.modelReady=!0}))},config:{"generic-tracked-controller-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"hp-mixed-reality-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"magicleap-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"oculus-go-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:5e-4,z:0}}},"meta-touch-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"pico-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"valve-index-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-focus-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"windows-motion-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{showLine:!1}}}});var yw,Ew,xw,bw,Cw,ww,_w,Mw,Sw,Iw,Bw=_y.MathUtils.degToRad,Tw=Ly("components:light:warn"),Rw=new _y.CubeTextureLoader,Lw={};function Dw(t,e){return!(!t||!e)&&t.x===e.x&&t.y===e.y&&t.z===e.z}_b("light",{schema:{angle:{default:60,if:{type:["spot"]}},color:{type:"color",if:{type:["ambient","directional","hemisphere","point","spot"]}},envMap:{default:"",if:{type:["probe"]}},groundColor:{type:"color",if:{type:["hemisphere"]}},decay:{default:1,if:{type:["point","spot"]}},distance:{default:0,min:0,if:{type:["point","spot"]}},intensity:{default:3.14,min:0,if:{type:["ambient","directional","hemisphere","point","spot","probe"]}},penumbra:{default:0,min:0,max:1,if:{type:["spot"]}},type:{default:"directional",oneOf:["ambient","directional","hemisphere","point","spot","probe"],schemaChange:!0},target:{type:"selector",if:{type:["spot","directional"]}},castShadow:{default:!1,if:{type:["point","spot","directional"]}},shadowBias:{default:0,if:{castShadow:!0}},shadowCameraFar:{default:500,if:{castShadow:!0}},shadowCameraFov:{default:90,if:{castShadow:!0}},shadowCameraNear:{default:.5,if:{castShadow:!0}},shadowCameraTop:{default:5,if:{castShadow:!0}},shadowCameraRight:{default:5,if:{castShadow:!0}},shadowCameraBottom:{default:-5,if:{castShadow:!0}},shadowCameraLeft:{default:-5,if:{castShadow:!0}},shadowCameraVisible:{default:!1,if:{castShadow:!0}},shadowCameraAutomatic:{default:"",if:{type:["directional"]}},shadowMapHeight:{default:512,if:{castShadow:!0}},shadowMapWidth:{default:512,if:{castShadow:!0}},shadowRadius:{default:1,if:{castShadow:!0}}},init:function(){var t=this.el;this.light=null,this.defaultTarget=null,this.system.registerLight(t)},update:function(t){var e=this.data,n=vx(e,t),i=this.light,r=this;if(!i||"type"in n)this.setLight(this.data),this.updateShadow();else{var s=!1;Object.keys(n).forEach((function(t){var n=e[t];switch(t){case"color":i.color.set(n);break;case"groundColor":i.groundColor.set(n);break;case"angle":i.angle=Bw(n);break;case"target":null===n?"spot"!==e.type&&"directional"!==e.type||(i.target=r.defaultTarget):n.hasLoaded?r.onSetTarget(n,i):n.addEventListener("loaded",r.onSetTarget.bind(r,n,i));break;case"envMap":r.updateProbeMap(e,i);break;case"castShadow":case"shadowBias":case"shadowCameraFar":case"shadowCameraFov":case"shadowCameraNear":case"shadowCameraTop":case"shadowCameraRight":case"shadowCameraBottom":case"shadowCameraLeft":case"shadowCameraVisible":case"shadowMapHeight":case"shadowMapWidth":case"shadowRadius":s||(r.updateShadow(),s=!0);break;case"shadowCameraAutomatic":e.shadowCameraAutomatic?r.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(e.shadowCameraAutomatic)):r.shadowCameraAutomaticEls=[];break;default:i[t]=n}}))}},tick:(yw=new _y.Box3,Ew=new _y.Vector3,xw=new _y.Vector3,bw=new _y.Matrix4,Cw=new _y.Sphere,ww=new _y.Vector3,function(){if("directional"===this.data.type&&this.light.shadow&&this.light.shadow.camera instanceof _y.OrthographicCamera&&this.shadowCameraAutomaticEls.length){var t=this.light.shadow.camera;t.getWorldDirection(Ew),t.getWorldPosition(xw),bw.copy(t.matrixWorld),bw.invert(),t.near=1,t.left=1e5,t.right=-1e5,t.top=-1e5,t.bottom=1e5,this.shadowCameraAutomaticEls.forEach((function(e){yw.setFromObject(e.object3D),yw.getBoundingSphere(Cw);var n,i,r,s,o,a=vw(xw,Ew,Cw.center),l=(n=xw,i=Ew,r=Cw.center,s=ww,o=vw(n,i,r),s.copy(i),s.multiplyScalar(o),s.add(r),s).applyMatrix4(bw);t.near=Math.min(-a-Cw.radius-1,t.near),t.left=Math.min(-Cw.radius+l.x,t.left),t.right=Math.max(Cw.radius+l.x,t.right),t.top=Math.max(Cw.radius+l.y,t.top),t.bottom=Math.min(-Cw.radius+l.y,t.bottom)})),t.updateProjectionMatrix()}}),setLight:function(t){var e=this.el,n=this.getLight(t);n&&(this.light&&e.removeObject3D("light"),this.light=n,this.light.el=e,e.setObject3D("light",this.light),"spot"!==t.type&&"directional"!==t.type&&"hemisphere"!==t.type||e.getObject3D("light").translateY(-1),"spot"===t.type&&(e.setObject3D("light-target",this.defaultTarget),e.getObject3D("light-target").position.set(0,0,-1)),t.shadowCameraAutomatic?this.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(t.shadowCameraAutomatic)):this.shadowCameraAutomaticEls=[])},updateShadow:function(){var t=this.el,e=this.data,n=this.light;n.castShadow=e.castShadow;var i=t.getObject3D("cameraHelper");if(e.shadowCameraVisible&&!i?(i=new _y.CameraHelper(n.shadow.camera),t.setObject3D("cameraHelper",i)):!e.shadowCameraVisible&&i&&t.removeObject3D("cameraHelper"),!e.castShadow)return n;n.shadow.bias=e.shadowBias,n.shadow.radius=e.shadowRadius,n.shadow.mapSize.height=e.shadowMapHeight,n.shadow.mapSize.width=e.shadowMapWidth,n.shadow.camera.near=e.shadowCameraNear,n.shadow.camera.far=e.shadowCameraFar,n.shadow.camera instanceof _y.OrthographicCamera?(n.shadow.camera.top=e.shadowCameraTop,n.shadow.camera.right=e.shadowCameraRight,n.shadow.camera.bottom=e.shadowCameraBottom,n.shadow.camera.left=e.shadowCameraLeft):n.shadow.camera.fov=e.shadowCameraFov,n.shadow.camera.updateProjectionMatrix(),i&&i.update()},getLight:function(t){var e=t.angle,n=new _y.Color(t.color);n=n.getHex();var i=t.decay,r=t.distance,s=new _y.Color(t.groundColor);s=s.getHex();var o=t.intensity,a=t.type,l=t.target,c=null;switch(a.toLowerCase()){case"ambient":return new _y.AmbientLight(n,o);case"directional":return c=new _y.DirectionalLight(n,o),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"hemisphere":return new _y.HemisphereLight(n,s,o);case"point":return new _y.PointLight(n,o,r,i);case"spot":return c=new _y.SpotLight(n,o,r,Bw(e),t.penumbra,i),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"probe":return c=new _y.LightProbe,this.updateProbeMap(t,c),c;default:Tw("%s is not a valid light type. Choose from ambient, directional, hemisphere, point, spot.",a)}},updateProbeMap:function(t,e){t.envMap?(void 0===Lw[t.envMap]&&(Lw[t.envMap]=new window.Promise((function(e){BE(t.envMap,(function(n){Rw.load(n,(function(n){var i=_y.LightProbeGenerator.fromCubeTexture(n);Lw[t.envMap]=i,e(i)}))}))}))),Lw[t.envMap]instanceof window.Promise?Lw[t.envMap].then((function(t){e.copy(t)})):Lw[t.envMap]instanceof _y.LightProbe&&e.copy(Lw[t.envMap])):e.copy(new _y.LightProbe)},onSetTarget:function(t,e){e.target=t.object3D},remove:function(){var t=this.el;t.removeObject3D("light"),t.getObject3D("cameraHelper")&&t.removeObject3D("cameraHelper")}}),_b("line",{schema:{start:{type:"vec3",default:{x:0,y:0,z:0}},end:{type:"vec3",default:{x:0,y:0,z:0}},color:{type:"color",default:"#74BEC1"},opacity:{type:"number",default:1},visible:{default:!0}},multiple:!0,init:function(){var t,e,n=this.data;e=this.material=new THREE.LineBasicMaterial({color:n.color,opacity:n.opacity,transparent:n.opacity<1,visible:n.visible}),(t=this.geometry=new THREE.BufferGeometry).setAttribute("position",new THREE.BufferAttribute(new Float32Array(6),3)),this.line=new THREE.Line(t,e),this.el.setObject3D(this.attrName,this.line)},update:function(t){var e=this.data,n=this.geometry,i=!1,r=this.material,s=n.attributes.position.array;Dw(e.start,t.start)||(s[0]=e.start.x,s[1]=e.start.y,s[2]=e.start.z,i=!0),Dw(e.end,t.end)||(s[3]=e.end.x,s[4]=e.end.y,s[5]=e.end.z,i=!0),i&&(n.attributes.position.needsUpdate=!0,n.computeBoundingSphere()),r.color.setStyle(e.color),r.opacity=e.opacity,r.transparent=e.opacity<1,r.visible=e.visible},remove:function(){this.el.removeObject3D(this.attrName,this.line)}}),_b("link",{schema:{backgroundColor:{default:"red",type:"color"},borderColor:{default:"white",type:"color"},highlighted:{default:!1},highlightedColor:{default:"#24CAFF",type:"color"},href:{default:""},image:{type:"asset"},on:{default:"click"},peekMode:{default:!1},title:{default:""},titleColor:{default:"white",type:"color"},visualAspectEnabled:{default:!1}},init:function(){this.navigate=this.navigate.bind(this),this.previousQuaternion=void 0,this.quaternionClone=new _y.Quaternion,this.hiddenEls=[]},update:function(t){var e,n,i=this.data,r=this.el;if(i.visualAspectEnabled){var s=this.el.getAttribute("scale");this.previewDistance=15*(s.x+s.y)/2,this.initVisualAspect(),e=i.highlighted?i.highlightedColor:i.backgroundColor,n=i.highlighted?i.highlightedColor:i.borderColor,r.setAttribute("material","backgroundColor",e),r.setAttribute("material","strokeColor",n),i.on!==t.on&&this.updateEventListener(),void 0!==t.peekMode&&i.peekMode!==t.peekMode&&this.updatePeekMode(),i.image&&t.image!==i.image&&r.setAttribute("material","pano","string"==typeof i.image?i.image:i.image.src)}},updatePeekMode:function(){var t=this.el,e=this.sphereEl;this.data.peekMode?(this.hideAll(),t.getObject3D("mesh").visible=!1,e.setAttribute("visible",!0)):(this.showAll(),t.getObject3D("mesh").visible=!0,e.setAttribute("visible",!1))},play:function(){this.updateEventListener()},pause:function(){this.removeEventListener()},updateEventListener:function(){var t=this.el;t.isPlaying&&(this.removeEventListener(),t.addEventListener(this.data.on,this.navigate))},removeEventListener:function(){var t=this.data.on;t&&this.el.removeEventListener(t,this.navigate)},initVisualAspect:function(){var t,e,n,i=this.el;this.data.visualAspectEnabled&&!this.visualAspectInitialized&&(n=this.textEl=this.textEl||document.createElement("a-entity"),e=this.sphereEl=this.sphereEl||document.createElement("a-entity"),t=this.semiSphereEl=this.semiSphereEl||document.createElement("a-entity"),i.setAttribute("geometry",{primitive:"circle",radius:1,segments:64}),i.setAttribute("material",{shader:"portal",pano:this.data.image,side:"double",previewDistance:this.previewDistance}),n.setAttribute("text",{color:this.data.titleColor,align:"center",font:"kelsonsans",value:this.data.title||this.data.href,width:4}),n.setAttribute("position","0 1.5 0"),i.appendChild(n),t.setAttribute("geometry",{primitive:"sphere",radius:1,phiStart:0,segmentsWidth:64,segmentsHeight:64,phiLength:180,thetaStart:0,thetaLength:360}),t.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back",previewDistance:this.previewDistance}),t.setAttribute("rotation","0 180 0"),t.setAttribute("position","0 0 0"),t.setAttribute("visible",!1),i.appendChild(t),e.setAttribute("geometry",{primitive:"sphere",radius:10,segmentsWidth:64,segmentsHeight:64}),e.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back",previewDistance:this.previewDistance}),e.setAttribute("visible",!1),i.appendChild(e),this.visualAspectInitialized=!0)},navigate:function(){window.location=this.data.href},tick:function(){var t=new _y.Vector3,e=new _y.Vector3,n=new _y.Quaternion,i=new _y.Vector3;return function(){var r,s,o=this.el,a=o.object3D,l=o.sceneEl.camera,c=this.textEl;if(this.data.visualAspectEnabled)if(a.updateMatrixWorld(),l.parent.updateMatrixWorld(),l.updateMatrixWorld(),a.matrix.decompose(e,n,i),e.setFromMatrixPosition(a.matrixWorld),t.setFromMatrixPosition(l.matrixWorld),(s=e.distanceTo(t))>1.33333*this.previewDistance)this.previousQuaternion||(this.quaternionClone.copy(n),this.previousQuaternion=this.quaternionClone),a.lookAt(t);else{if(r=this.calculateCameraPortalOrientation(),s<.5){if(!0===this.semiSphereEl.getAttribute("visible"))return;c.setAttribute("text","width",1.5),r<=0?(c.setAttribute("position","0 0 0.75"),c.setAttribute("rotation","0 180 0"),this.semiSphereEl.setAttribute("rotation","0 0 0")):(c.setAttribute("position","0 0 -0.75"),c.setAttribute("rotation","0 0 0"),this.semiSphereEl.setAttribute("rotation","0 180 0")),o.getObject3D("mesh").visible=!1,this.semiSphereEl.setAttribute("visible",!0),this.peekCameraPortalOrientation=r}else r<=0?c.setAttribute("rotation","0 180 0"):c.setAttribute("rotation","0 0 0"),c.setAttribute("text","width",5),c.setAttribute("position","0 1.5 0"),o.getObject3D("mesh").visible=!0,this.semiSphereEl.setAttribute("visible",!1),this.peekCameraPortalOrientation=void 0;this.previousQuaternion&&(a.quaternion.copy(this.previousQuaternion),this.previousQuaternion=void 0)}}}(),hideAll:function(){var t=this.el,e=this.hiddenEls,n=this;e.length>0||t.sceneEl.object3D.traverse((function(i){i&&i.el&&i.el.hasAttribute("link-controls")||i.el&&i!==t.sceneEl.object3D&&i.el!==t&&i.el!==n.sphereEl&&i.el!==t.sceneEl.cameraEl&&!1!==i.el.getAttribute("visible")&&i.el!==n.textEl&&i.el!==n.semiSphereEl&&(i.el.setAttribute("visible",!1),e.push(i.el))}))},showAll:function(){this.hiddenEls.forEach((function(t){t.setAttribute("visible",!0)})),this.hiddenEls=[]},calculateCameraPortalOrientation:(_w=new _y.Matrix4,Mw=new _y.Vector3,Sw=new _y.Vector3(0,0,1),Iw=new _y.Vector3(0,0,0),function(){var t=this.el,e=t.sceneEl.camera;return Mw.set(0,0,0),Sw.set(0,0,1),Iw.set(0,0,0),t.object3D.matrixWorld.extractRotation(_w),Sw.applyMatrix4(_w),t.object3D.updateMatrixWorld(),t.object3D.localToWorld(Iw),e.parent.parent.updateMatrixWorld(),e.parent.updateMatrixWorld(),e.updateMatrixWorld(),e.localToWorld(Mw),Mw.sub(Iw).normalize(),Sw.normalize(),Math.sign(Sw.dot(Mw))}),remove:function(){this.removeEventListener()}}),vC("portal",{schema:{borderEnabled:{default:1,type:"int",is:"uniform"},backgroundColor:{default:"red",type:"color",is:"uniform"},pano:{type:"map",is:"uniform"},strokeColor:{default:"white",type:"color",is:"uniform"},previewDistance:{default:15,type:"float",is:"uniform"}},vertexShader:["vec3 portalPosition;","varying vec3 vWorldPosition;","varying float vDistanceToCenter;","varying float vDistance;","void main() {","vDistanceToCenter = clamp(length(position - vec3(0.0, 0.0, 0.0)), 0.0, 1.0);","portalPosition = (modelMatrix * vec4(0.0, 0.0, 0.0, 1.0)).xyz;","vDistance = length(portalPosition - cameraPosition);","vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI2 0.15915494","uniform sampler2D pano;","uniform vec3 strokeColor;","uniform vec3 backgroundColor;","uniform float borderEnabled;","uniform float previewDistance;","varying float vDistanceToCenter;","varying float vDistance;","varying vec3 vWorldPosition;","void main() {","vec3 direction = normalize(vWorldPosition - cameraPosition);","vec2 sampleUV;","float borderThickness = clamp(exp(-vDistance / 50.0), 0.6, 0.95);","sampleUV.y = clamp(direction.y * 0.5 + 0.5, 0.0, 1.0);","sampleUV.x = atan(direction.z, -direction.x) * -RECIPROCAL_PI2 + 0.5;","if (vDistanceToCenter > borderThickness && borderEnabled == 1.0) {","gl_FragColor = vec4(strokeColor, 1.0);","} else {","gl_FragColor = mix(texture2D(pano, sampleUV), vec4(backgroundColor, 1.0), clamp(pow((vDistance / previewDistance), 2.0), 0.0, 1.0));","}","}"].join("\n")});var Pw="logitech-mx-ink",Uw=My+"controllers/logitech/",Ow=(_b("logitech-mx-ink-controls",{schema:{hand:{default:"left"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{left:{buttons:["front","back","none","none","none","tip"]},right:{buttons:["front","back","none","none","none","tip"]}},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){nx(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t,t.data.hand)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t,t.data.hand)},this.bindMethods()},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),t.sceneEl.removeEventListener("enter-vr",this.onEnterVR),t.sceneEl.removeEventListener("exit-vr",this.onExitVR),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.controllerObject3D;t&&(t.visible=!1),ZE(this,Pw,{hand:this.data.hand,iterateControllerProfiles:!0})},injectTrackedControls:function(){var t=this.el,e=this.data,n=Pw;t.setAttribute("tracked-controls",{id:n,hand:e.hand,handTrackingEnabled:!1,iterateControllerProfiles:!0,orientationOffset:e.orientationOffset}),this.loadModel()},loadModel:function(){var t=this.controllerObject3D;if(this.data.model)return t?(t.visible=this.el.sceneEl.is("vr-mode"),void this.el.setObject3D("mesh",t)):void this.el.setAttribute("gltf-model",Uw+"logitech-mx-ink.glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping[this.data.hand].buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){t.target===this.el&&this.data.model&&(this.el.emit("controllermodelready",{name:"logitech-mx-ink-controls",model:this.data.model,rayOrigin:new _y.Vector3(0,0,0)}),this.controllerObject3D=this.el.getObject3D("mesh"),this.controllerObject3D.visible=this.el.sceneEl.is("vr-mode"))},onAxisMoved:function(t){ex(this,this.mapping.axes,t)}}),Math.PI/2),Fw=(_b("look-controls",{dependencies:["position","rotation"],schema:{enabled:{default:!0},magicWindowTrackingEnabled:{default:!0},pointerLockEnabled:{default:!1},reverseMouseDrag:{default:!1},reverseTouchDrag:{default:!1},touchEnabled:{default:!0},mouseEnabled:{default:!0}},init:function(){this.deltaYaw=0,this.previousHMDPosition=new _y.Vector3,this.hmdQuaternion=new _y.Quaternion,this.magicWindowAbsoluteEuler=new _y.Euler,this.magicWindowDeltaEuler=new _y.Euler,this.position=new _y.Vector3,this.magicWindowObject=new _y.Object3D,this.rotation={},this.deltaRotation={},this.savedPose=null,this.pointerLocked=!1,this.setupMouseControls(),this.bindMethods(),this.previousMouseEvent={},this.setupMagicWindowControls(),this.savedPose={position:new _y.Vector3,rotation:new _y.Euler},(this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode"))&&this.onEnterVR()},setupMagicWindowControls:function(){var t,e=this.data;(Wy()||Ky())&&(t=this.magicWindowControls=new _y.DeviceOrientationControls(this.magicWindowObject),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission&&(t.enabled=!1,this.el.sceneEl.components["device-orientation-permission-ui"].permissionGranted?t.enabled=e.magicWindowTrackingEnabled:this.el.sceneEl.addEventListener("deviceorientationpermissiongranted",(function(){t.enabled=e.magicWindowTrackingEnabled}))))},update:function(t){var e=this.data;e.enabled!==t.enabled&&this.updateGrabCursor(e.enabled),t&&!e.magicWindowTrackingEnabled&&t.magicWindowTrackingEnabled&&(this.magicWindowAbsoluteEuler.set(0,0,0),this.magicWindowDeltaEuler.set(0,0,0)),this.magicWindowControls&&(this.magicWindowControls.enabled=e.magicWindowTrackingEnabled),t&&!e.pointerLockEnabled!==t.pointerLockEnabled&&(this.removeEventListeners(),this.addEventListeners(),this.pointerLocked&&this.exitPointerLock())},tick:function(t){this.data.enabled&&this.updateOrientation()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},remove:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},bindMethods:function(){this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this),this.onPointerLockChange=this.onPointerLockChange.bind(this),this.onPointerLockError=this.onPointerLockError.bind(this)},setupMouseControls:function(){this.mouseDown=!1,this.pitchObject=new _y.Object3D,this.yawObject=new _y.Object3D,this.yawObject.position.y=10,this.yawObject.add(this.pitchObject)},addEventListeners:function(){var t=this.el.sceneEl,e=t.canvas;e?(e.addEventListener("mousedown",this.onMouseDown,!1),window.addEventListener("mousemove",this.onMouseMove,!1),window.addEventListener("mouseup",this.onMouseUp,!1),e.addEventListener("touchstart",this.onTouchStart,{passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{passive:!0}),t.addEventListener("enter-vr",this.onEnterVR),t.addEventListener("exit-vr",this.onExitVR),this.data.pointerLockEnabled&&(document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.addEventListener("pointerlockerror",this.onPointerLockError,!1))):t.addEventListener("render-target-loaded",this.addEventListeners.bind(this))},removeEventListeners:function(){var t=this.el.sceneEl,e=t&&t.canvas;e&&(e.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),e.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),t.removeEventListener("enter-vr",this.onEnterVR),t.removeEventListener("exit-vr",this.onExitVR),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("pointerlockerror",this.onPointerLockError,!1))},updateOrientation:function(){var t=this.el.object3D,e=this.pitchObject,n=this.yawObject,i=this.el.sceneEl;(i.is("vr-mode")||i.is("ar-mode"))&&i.checkHeadsetConnected()||(this.updateMagicWindowOrientation(),t.rotation.x=this.magicWindowDeltaEuler.x+e.rotation.x,t.rotation.y=this.magicWindowDeltaEuler.y+n.rotation.y,t.rotation.z=this.magicWindowDeltaEuler.z)},updateMagicWindowOrientation:function(){var t=this.magicWindowAbsoluteEuler,e=this.magicWindowDeltaEuler;this.magicWindowControls&&this.magicWindowControls.enabled&&(this.magicWindowControls.update(),t.setFromQuaternion(this.magicWindowObject.quaternion,"YXZ"),this.previousMagicWindowYaw||0===t.y||(this.previousMagicWindowYaw=t.y),this.previousMagicWindowYaw&&(e.x=t.x,e.y+=t.y-this.previousMagicWindowYaw,e.z=t.z,this.previousMagicWindowYaw=t.y))},onMouseMove:function(t){var e,n,i,r=this.pitchObject,s=this.previousMouseEvent,o=this.yawObject;this.data.enabled&&(this.mouseDown||this.pointerLocked)&&(this.pointerLocked?(n=t.movementX||t.mozMovementX||0,i=t.movementY||t.mozMovementY||0):(n=t.screenX-s.screenX,i=t.screenY-s.screenY),this.previousMouseEvent.screenX=t.screenX,this.previousMouseEvent.screenY=t.screenY,e=this.data.reverseMouseDrag?1:-1,o.rotation.y+=.002*n*e,r.rotation.x+=.002*i*e,r.rotation.x=Math.max(-Ow,Math.min(Ow,r.rotation.x)))},onMouseDown:function(t){var e=this.el.sceneEl;if(this.data.enabled&&this.data.mouseEnabled&&(!e.is("vr-mode")&&!e.is("ar-mode")||!e.checkHeadsetConnected())&&0===t.button){var n=e&&e.canvas;this.mouseDown=!0,this.previousMouseEvent.screenX=t.screenX,this.previousMouseEvent.screenY=t.screenY,this.showGrabbingCursor(),this.data.pointerLockEnabled&&!this.pointerLocked&&(n.requestPointerLock?n.requestPointerLock():n.mozRequestPointerLock&&n.mozRequestPointerLock())}},showGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor="grabbing"},hideGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor=""},onMouseUp:function(){this.mouseDown=!1,this.hideGrabbingCursor()},onTouchStart:function(t){1!==t.touches.length||!this.data.touchEnabled||this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode")||(this.touchStart={x:t.touches[0].pageX,y:t.touches[0].pageY},this.touchStarted=!0)},onTouchMove:function(t){var e,n,i=this.el.sceneEl.canvas,r=this.yawObject;this.touchStarted&&this.data.touchEnabled&&(n=2*Math.PI*(t.touches[0].pageX-this.touchStart.x)/i.clientWidth,e=this.data.reverseTouchDrag?1:-1,r.rotation.y-=.5*n*e,this.touchStart={x:t.touches[0].pageX,y:t.touches[0].pageY})},onTouchEnd:function(){this.touchStarted=!1},onEnterVR:function(){var t=this.el.sceneEl;t.checkHeadsetConnected()&&(this.saveCameraPose(),this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),t.hasWebXR&&(this.el.object3D.matrixAutoUpdate=!1,this.el.object3D.updateMatrix()))},onExitVR:function(){this.el.sceneEl.checkHeadsetConnected()&&(this.restoreCameraPose(),this.previousHMDPosition.set(0,0,0),this.el.object3D.matrixAutoUpdate=!0)},onPointerLockChange:function(){this.pointerLocked=!(!document.pointerLockElement&&!document.mozPointerLockElement)},onPointerLockError:function(){this.pointerLocked=!1},exitPointerLock:function(){document.exitPointerLock(),this.pointerLocked=!1},updateGrabCursor:function(t){var e=this.el.sceneEl;function n(){e.canvas.classList.add("a-grab-cursor")}function i(){e.canvas.classList.remove("a-grab-cursor")}e.canvas?t?n():i():t?e.addEventListener("render-target-loaded",n):e.addEventListener("render-target-loaded",i)},saveCameraPose:function(){var t=this.el;this.savedPose.position.copy(t.object3D.position),this.savedPose.rotation.copy(t.object3D.rotation),this.hasSavedPose=!0},restoreCameraPose:function(){var t=this.el,e=this.savedPose;this.hasSavedPose&&(t.object3D.position.copy(e.position),t.object3D.rotation.copy(e.rotation),this.hasSavedPose=!1)}}),"magicleap-one"),kw=My+"controllers/magicleap/magicleap-one-controller.glb",Nw=(_b("magicleap-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","menu"]},init:function(){var t=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.previousButtonValues={},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;ZE(this,Fw,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:Fw,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",kw)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping.buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){t.detail.model.scale.set(.01,.01,.01)},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},updateModel:function(t,e){},setButtonColor:function(t,e){}}),Ly("components:material:error"));function Qw(t,e){t.dispose(),e.unregisterMaterial(t),Object.keys(t).filter((function(e){return t[e]&&t[e].isTexture})).forEach((function(e){t[e].dispose()}))}_b("material",{schema:{alphaTest:{default:0,min:0,max:1},depthTest:{default:!0},depthWrite:{default:!0},flatShading:{default:!1},npot:{default:!1},offset:{type:"vec2",default:{x:0,y:0}},opacity:{default:1,min:0,max:1},repeat:{type:"vec2",default:{x:1,y:1}},shader:{default:"standard",oneOf:fC,schemaChange:!0},side:{default:"front",oneOf:["front","back","double"]},transparent:{default:!1},vertexColorsEnabled:{default:!1},visible:{default:!0},blending:{default:"normal",oneOf:["none","normal","additive","subtractive","multiply"]},dithering:{default:!0},anisotropy:{default:0,min:0}},init:function(){this.material=null},update:function(t){var e=this.data;this.shader&&e.shader===t.shader||this.updateShader(e.shader),this.shader.update(this.data),this.updateMaterial(t)},updateSchema:function(t){var e,n,i,r;n=t&&t.shader,e=this.oldData&&this.oldData.shader,(i=AC[r=n||e]&&AC[r].schema)||Nw("Unknown shader schema "+r),e&&n===e||(this.extendSchema(i),this.updateBehavior())},updateBehavior:function(){var t,e,n=this.el.sceneEl,i=this.schema,r=this;function s(t,n){var i;for(i in e)e[i]=t;r.shader.update(e)}for(t in this.tick=void 0,e={},i)"time"===i[t].type&&(this.tick=s,e[t]=!0);n&&(this.tick?n.addBehavior(this):n.removeBehavior(this))},updateShader:function(t){var e,n=this.data,i=AC[t]&&AC[t].Shader;if(!i)throw new Error("Unknown shader "+t);(e=this.shader=new i).el=this.el,e.init(n),this.setMaterial(e.material),this.updateSchema(n)},updateMaterial:function(t){var e,n=this.data,i=this.material;for(e in i.alphaTest=n.alphaTest,i.depthTest=!1!==n.depthTest,i.depthWrite=!1!==n.depthWrite,i.opacity=n.opacity,i.flatShading=n.flatShading,i.side=function(t){switch(t){case"back":return _y.BackSide;case"double":return _y.DoubleSide;default:return _y.FrontSide}}(n.side),i.transparent=!1!==n.transparent||n.opacity<1,i.vertexColors=n.vertexColorsEnabled,i.visible=n.visible,i.blending=function(t){switch(t){case"none":return _y.NoBlending;case"additive":return _y.AdditiveBlending;case"subtractive":return _y.SubtractiveBlending;case"multiply":return _y.MultiplyBlending;default:return _y.NormalBlending}}(n.blending),i.dithering=n.dithering,t)break;!e||t.alphaTest===n.alphaTest&&t.side===n.side&&t.vertexColorsEnabled===n.vertexColorsEnabled||(i.needsUpdate=!0)},remove:function(){var t=new _y.MeshBasicMaterial,e=this.material,n=this.el.getObject3D("mesh");n&&(n.material=t),Qw(e,this.system)},setMaterial:function(t){var e,n=this.el,i=this.system;this.material&&Qw(this.material,i),this.material=t,i.registerMaterial(t),(e=n.getObject3D("mesh"))?e.material=t:n.addEventListener("object3dset",(function e(i){"mesh"===i.detail.type&&i.target===n&&(n.getObject3D("mesh").material=t,n.removeEventListener("object3dset",e))}))}});var Gw,zw,Hw,Vw,jw,Ww="oculus-touch",qw=My+"controllers/oculus/oculus-touch-controller-",Xw=My+"controllers/meta/",Yw={left:{modelUrl:qw+"left.gltf",rayOrigin:{origin:{x:.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new _y.Vector3(-.005,.036,-.037),modelPivotRotation:new _y.Euler(Math.PI/4.5,0,0)},right:{modelUrl:qw+"right.gltf",rayOrigin:{origin:{x:-.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new _y.Vector3(.005,.036,-.037),modelPivotRotation:new _y.Euler(Math.PI/4.5,0,0)}},Jw="oculus-touch",Kw={"oculus-touch":Yw,"oculus-touch-v2":{left:{modelUrl:qw+"gen2-left.gltf",rayOrigin:{origin:{x:-.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new _y.Vector3(0,-.007,-.021),modelPivotRotation:new _y.Euler(-Math.PI/4,0,0)},right:{modelUrl:qw+"gen2-right.gltf",rayOrigin:{origin:{x:.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new _y.Vector3(0,-.007,-.021),modelPivotRotation:new _y.Euler(-Math.PI/4,0,0)}},"oculus-touch-v3":{left:{modelUrl:qw+"v3-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)},right:{modelUrl:qw+"v3-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)}},"meta-quest-touch-pro":{left:{modelUrl:Xw+"quest-touch-pro-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)},right:{modelUrl:Xw+"quest-touch-pro-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)}},"meta-quest-touch-plus":{left:{modelUrl:Xw+"quest-touch-plus-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)},right:{modelUrl:Xw+"quest-touch-plus-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new _y.Vector3(0,0,0),modelPivotRotation:new _y.Euler(0,0,0)}}},Zw={schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#999"},buttonTouchColor:{type:"color",default:"#8AB"},buttonHighlightColor:{type:"color",default:"#2DF"},model:{default:!0},controllerType:{default:"auto",oneOf:["auto","oculus-touch","oculus-touch-v2","oculus-touch-v3"]}},after:["tracked-controls"],mapping:{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton","surface"]}},bindMethods:function(){this.onButtonChanged=this.onButtonChanged.bind(this),this.onThumbstickMoved=this.onThumbstickMoved.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonDown=function(e){nx(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){nx(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t,t.data.hand)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t,t.data.hand)},this.controllerPresent=!1,this.previousButtonValues={},this.bindMethods(),this.triggerEuler=new _y.Euler},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.controllerObject3D;t&&(t.visible=!1),ZE(this,Ww,{hand:this.data.hand,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},loadModel:function(t){var e,n=this.data;if(n.model){if(this.controllerObject3D)return this.controllerObject3D.visible=!0,void this.el.setObject3D("mesh",this.controllerObject3D);if(this.displayModel=Kw[n.controllerType]||Kw[Jw],"auto"===n.controllerType){e=Jw;for(var i=Object.keys(Kw),r=0;r<t.profiles.length;r++)if(-1!==i.indexOf(t.profiles[r])){e=t.profiles[r];break}this.displayModel=Kw[e]}var s=this.displayModel[n.hand].modelUrl;this.isTouchV3orPROorPlus=this.displayModel===Kw["oculus-touch-v3"]||this.displayModel===Kw["meta-quest-touch-pro"]||this.displayModel===Kw["meta-quest-touch-plus"],this.el.setAttribute("gltf-model",s)}},injectTrackedControls:function(t){var e=this.data,n=Ww;this.el.setAttribute("tracked-controls",{id:n,hand:e.hand,handTrackingEnabled:!1,iterateControllerProfiles:!0}),this.loadModel(t)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e=this.mapping[this.data.hand].buttons[t.detail.id];if(e){if(this.isTouchV3orPROorPlus)this.onButtonChangedV3orPROorPlus(t);else{var n,i=this.buttonMeshes;"trigger"!==e&&"grip"!==e||(n=t.detail.state.value),i&&("trigger"===e&&i.trigger&&(i.trigger.rotation.x=this.originalXRotationTrigger-n*(Math.PI/26)),"grip"===e&&i.grip&&(n*="left"===this.data.hand?-1:1,i.grip.position.x=this.originalXPositionGrip+.004*n))}this.el.emit(e+"changed",t.detail.state)}},onButtonChangedV3orPROorPlus:function(t){var e,n=this.mapping[this.data.hand].buttons[t.detail.id],i=this.buttonObjects;i&&i[n]&&(e=t.detail.state.value,i[n].quaternion.slerpQuaternions(this.buttonRanges[n].min.quaternion,this.buttonRanges[n].max.quaternion,e),i[n].position.lerpVectors(this.buttonRanges[n].min.position,this.buttonRanges[n].max.position,e))},onModelLoaded:function(t){if(t.target===this.el&&this.data.model){if(this.isTouchV3orPROorPlus)this.onTouchV3orPROorPlusModelLoaded(t);else{var e,n=this.controllerObject3D=t.detail.model;(e=this.buttonMeshes={}).grip=n.getObjectByName("buttonHand"),this.originalXPositionGrip=e.grip&&e.grip.position.x,e.trigger=n.getObjectByName("buttonTrigger"),this.originalXRotationTrigger=e.trigger&&e.trigger.rotation.x,e.thumbstick=n.getObjectByName("stick"),e.xbutton=n.getObjectByName("buttonX"),e.abutton=n.getObjectByName("buttonA"),e.ybutton=n.getObjectByName("buttonY"),e.bbutton=n.getObjectByName("buttonB")}for(var i in this.buttonMeshes)this.buttonMeshes[i]&&$w(this.buttonMeshes[i]);this.applyOffset(t.detail.model),this.el.emit("controllermodelready",{name:"meta-touch-controls",model:this.data.model,rayOrigin:this.displayModel[this.data.hand].rayOrigin})}},applyOffset:function(t){t.position.copy(this.displayModel[this.data.hand].modelPivotOffset),t.rotation.copy(this.displayModel[this.data.hand].modelPivotRotation)},onTouchV3orPROorPlusModelLoaded:function(t){var e=this.controllerObject3D=t.detail.model,n=this.buttonObjects={},i=this.buttonMeshes={},r=this.buttonRanges={};i.grip=e.getObjectByName("squeeze"),n.grip=e.getObjectByName("xr_standard_squeeze_pressed_value"),r.grip={min:e.getObjectByName("xr_standard_squeeze_pressed_min"),max:e.getObjectByName("xr_standard_squeeze_pressed_max")},n.grip.minX=n.grip.position.x,i.thumbstick=e.getObjectByName("thumbstick"),n.thumbstick=e.getObjectByName("xr_standard_thumbstick_pressed_value"),r.thumbstick={min:e.getObjectByName("xr_standard_thumbstick_pressed_min"),max:e.getObjectByName("xr_standard_thumbstick_pressed_max")},n.thumbstickXAxis=e.getObjectByName("xr_standard_thumbstick_xaxis_pressed_value"),r.thumbstickXAxis={min:e.getObjectByName("xr_standard_thumbstick_xaxis_pressed_min"),max:e.getObjectByName("xr_standard_thumbstick_xaxis_pressed_max")},n.thumbstickYAxis=e.getObjectByName("xr_standard_thumbstick_yaxis_pressed_value"),r.thumbstickYAxis={min:e.getObjectByName("xr_standard_thumbstick_yaxis_pressed_min"),max:e.getObjectByName("xr_standard_thumbstick_yaxis_pressed_max")},i.trigger=e.getObjectByName("trigger"),n.trigger=e.getObjectByName("xr_standard_trigger_pressed_value"),r.trigger={min:e.getObjectByName("xr_standard_trigger_pressed_min"),max:e.getObjectByName("xr_standard_trigger_pressed_max")},r.trigger.diff={x:Math.abs(r.trigger.max.rotation.x)-Math.abs(r.trigger.min.rotation.x),y:Math.abs(r.trigger.max.rotation.y)-Math.abs(r.trigger.min.rotation.y),z:Math.abs(r.trigger.max.rotation.z)-Math.abs(r.trigger.min.rotation.z)};var s="left"===this.data.hand?"x":"a",o="left"===this.data.hand?"y":"b",a=s+"button",l=o+"button";i[a]=e.getObjectByName(s+"_button"),n[a]=e.getObjectByName(s+"_button_pressed_value"),r[a]={min:e.getObjectByName(s+"_button_pressed_min"),max:e.getObjectByName(s+"_button_pressed_max")},i[l]=e.getObjectByName(o+"_button"),n[l]=e.getObjectByName(o+"_button_pressed_value"),r[l]={min:e.getObjectByName(o+"_button_pressed_min"),max:e.getObjectByName(o+"_button_pressed_max")}},onAxisMoved:function(t){ex(this,this.mapping[this.data.hand].axes,t)},onThumbstickMoved:function(t){if(this.buttonMeshes&&this.buttonMeshes.thumbstick)if(this.isTouchV3orPROorPlus)this.updateThumbstickTouchV3orPROorPlus(t);else for(var e in t.detail)this.buttonObjects.thumbstick.rotation[this.axisMap[e]]=this.buttonRanges.thumbstick.originalRotation[this.axisMap[e]]-Math.PI/8*t.detail[e]*("y"===e||"right"===this.data.hand?-1:1)},axisMap:{y:"x",x:"z"},updateThumbstickTouchV3orPROorPlus:function(t){var e=(t.detail.x+1)/2;this.buttonObjects.thumbstickXAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickXAxis.min.quaternion,this.buttonRanges.thumbstickXAxis.max.quaternion,e);var n=(t.detail.y+1)/2;this.buttonObjects.thumbstickYAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickYAxis.min.quaternion,this.buttonRanges.thumbstickYAxis.max.quaternion,n)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var n,i=this.buttonMeshes;i&&i[t]&&(n="up"===e||"touchend"===e?i[t].originalColor||this.data.buttonColor:"touchstart"===e?this.data.buttonTouchColor:this.data.buttonHighlightColor,i[t].material.color.set(n))}};function $w(t){t.traverse((function(e){var n;"Mesh"===e.type&&(n=e.material.clone(),t.originalColor=e.material.color,e.material.dispose(),e.material=n)}))}_b("oculus-touch-controls",Zw),_b("meta-touch-controls",Zw),_b("obb-collider",{schema:{size:{default:0},trackedObject3D:{default:""},minimumColliderDimension:{default:.02},centerModel:{default:!1}},init:function(){this.previousScale=(new _y.Vector3).copy(this.el.object3D.scale),this.auxEuler=new _y.Euler,this.boundingBox=new _y.Box3,this.boundingBoxSize=new _y.Vector3,this.updateCollider=this.updateCollider.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.updateBoundingBox=this.updateBoundingBox.bind(this),this.el.addEventListener("model-loaded",this.onModelLoaded),this.updateCollider(),this.system.addCollider(this.el)},remove:function(){this.system.removeCollider(this.el)},update:function(){this.data.trackedObject3D&&(this.trackedObject3DPath=this.data.trackedObject3D.split("."))},onModelLoaded:function(){this.data.centerModel&&this.centerModel(),this.updateCollider()},centerModel:function(){var t,e=this.el,n=e.components["gltf-model"]&&e.components["gltf-model"].model;n&&(this.el.removeObject3D("mesh"),t=(new _y.Box3).setFromObject(n).getCenter(new _y.Vector3),n.position.x+=n.position.x-t.x,n.position.y+=n.position.y-t.y,n.position.z+=n.position.z-t.z,this.el.setObject3D("mesh",n))},updateCollider:function(){var t=this.el,e=this.boundingBoxSize,n=this.aabb=this.aabb||new _y.OBB;this.obb=this.obb||new _y.OBB,t.hasLoaded?(this.updateBoundingBox(),n.halfSize.copy(e).multiplyScalar(.5),this.el.sceneEl.systems["obb-collider"].data.showColliders&&this.showCollider()):t.addEventListener("loaded",this.updateCollider)},showCollider:function(){this.updateColliderMesh(),this.renderColliderMesh.visible=!0},updateColliderMesh:function(){var t=this.renderColliderMesh,e=this.boundingBoxSize;t?(t.geometry.dispose(),t.geometry=new _y.BoxGeometry(e.x,e.y,e.z)):this.initColliderMesh()},hideCollider:function(){this.renderColliderMesh&&(this.renderColliderMesh.visible=!1)},initColliderMesh:function(){var t,e,n;t=this.boundingBoxSize,e=this.renderColliderGeometry=new _y.BoxGeometry(t.x,t.y,t.z),(n=this.renderColliderMesh=new _y.Mesh(e,new _y.MeshLambertMaterial({color:65280,side:_y.DoubleSide}))).matrixAutoUpdate=!1,n.matrixWorldAutoUpdate=!1,n.updateMatrixWorld=function(){},this.el.sceneEl.object3D.add(n)},updateBoundingBox:(Gw=new _y.Vector3,zw=new _y.Vector3,Hw=new _y.Quaternion,Vw=new _y.Quaternion,jw=new _y.Matrix4,function(){var t=this.auxEuler,e=this.boundingBox,n=this.data.size,i=this.trackedObject3D||this.el.object3D,r=this.boundingBoxSize,s=this.data.minimumColliderDimension;if(n)return this.boundingBoxSize.x=n,this.boundingBoxSize.y=n,void(this.boundingBoxSize.z=n);t.copy(i.rotation),i.rotation.set(0,0,0),i.parent.matrixWorld.decompose(Gw,Hw,zw),jw.compose(Gw,Vw,zw),i.parent.matrixWorld.copy(jw),e.setFromObject(i,!0),e.getSize(r),r.x=r.x<s?s:r.x,r.y=r.y<s?s:r.y,r.z=r.z<s?s:r.z,i.parent.matrixWorld.compose(Gw,Hw,zw),this.el.object3D.rotation.copy(t)}),checkTrackedObject:function(){var t,e=this.trackedObject3DPath;if(e&&e.length&&!this.trackedObject3D){t=this.el;for(var n=0;n<e.length&&(t=t[e[n]]);n++);t&&(this.trackedObject3D=t,this.updateCollider())}return this.trackedObject3D},tick:function(){var t=new _y.Vector3,e=new _y.Vector3,n=new _y.Quaternion,i=new _y.Matrix4;return function(){var r=this.obb,s=this.renderColliderMesh,o=this.checkTrackedObject()||this.el.object3D;o&&(o.updateMatrix(),o.updateMatrixWorld(!0),o.matrixWorld.decompose(t,n,e),(Math.abs(e.x-this.previousScale.x)>1e-4||Math.abs(e.y-this.previousScale.y)>1e-4||Math.abs(e.z-this.previousScale.z)>1e-4)&&this.updateCollider(),this.previousScale.copy(e),e.set(1,1,1),i.compose(t,n,e),s&&s.matrixWorld.copy(i),r.copy(this.aabb),r.applyMatrix4(i))}}()});var t_=Ly("components:obj-model:warn"),e_=(_b("obj-model",{schema:{mtl:{type:"model"},obj:{type:"model"}},init:function(){var t=this;this.model=null,this.objLoader=new _y.OBJLoader,this.mtlLoader=new _y.MTLLoader(this.objLoader.manager),this.mtlLoader.crossOrigin="",this.el.addEventListener("componentinitialized",(function(e){t.model&&"material"===e.detail.name&&t.applyMaterial()}))},update:function(){var t=this.data;t.obj&&(this.resetMesh(),this.loadObj(t.obj,t.mtl))},remove:function(){this.resetMesh()},resetMesh:function(){this.model&&this.el.removeObject3D("mesh")},loadObj:function(t,e){var n=this,i=this.el,r=this.mtlLoader,s=this.objLoader,o=this.el.sceneEl.systems.renderer,a=e.substr(0,e.lastIndexOf("/")+1);if(e)return i.hasAttribute("material")&&t_("Material component properties are ignored when a .MTL is provided"),r.setResourcePath(a),void r.load(e,(function(e){e.preload(),s.setMaterials(e),s.load(t,(function(t){n.model=t,n.model.traverse((function(t){if(t.isMesh){var e=t.material;e.map&&o.applyColorCorrection(e.map),e.emissiveMap&&o.applyColorCorrection(e.emissiveMap)}})),i.setObject3D("mesh",t),i.emit("model-loaded",{format:"obj",model:t})}))}));s.load(t,(function(t){n.model=t,n.applyMaterial(),i.setObject3D("mesh",t),i.emit("model-loaded",{format:"obj",model:t})}))},applyMaterial:function(){var t=this.el.components.material;t&&this.model.traverse((function(e){e instanceof _y.Mesh&&(e.material=t.material)}))}}),My+"controllers/oculus/go/oculus-go-controller.gltf"),n_="oculus-go",i_=(_b("oculus-go-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#FFFFFF"},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad"]},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.bindMethods()},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){ZE(this,n_,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{hand:e.hand,idPrefix:n_}),this.data.model&&this.el.setAttribute("gltf-model",e_)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(t){var e,n=t.detail.model;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).trigger=n.getObjectByName("oculus_go_button_trigger"),e.trackpad=n.getObjectByName("oculus_go_touchpad"),e.touchpad=n.getObjectByName("oculus_go_touchpad"))},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var n=this.buttonMeshes;if(n&&n[t]){var i;switch(e){case"down":i=this.data.buttonHighlightColor;break;case"touchstart":i=this.data.buttonTouchedColor;break;default:i=this.data.buttonColor}n[t].material.color.set(i)}}}),"pico-4"),r_=My+"controllers/pico/pico4/",s_=(_b("pico-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t,t.data.hand)},this.onButtonUp=function(e){nx(e.detail.id,"up",t,t.data.hand)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t,t.data.hand)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t,t.data.hand)},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;ZE(this,i_,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:i_,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",r_+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping[this.data.hand].buttons[t.detail.id];n&&("trigger"===n&&(e=t.detail.state.value,console.log("analog value of trigger press: "+e)),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){t.target===this.el&&this.data.model&&this.el.emit("controllermodelready",{name:"pico-controls",model:this.data.model,rayOrigin:new _y.Vector3(0,0,0)})},onAxisMoved:function(t){ex(this,this.mapping[this.data.hand].axes,t)}}),_b("position",{schema:{type:"vec3"},update:function(){var t=this.el.object3D,e=this.data;t.position.set(e.x,e.y,e.z)},remove:function(){this.el.object3D.position.set(0,0,0)}}),Ly("components:raycaster:warn")),o_=/^[\w\s-.,[\]#]*$/,a_={childList:!0,attributes:!0,subtree:!0},l_="raycaster-intersected-cleared",c_="raycaster-intersection-cleared";function h_(t,e){var n;for(t.length=e.length,n=0;n<e.length;n++)t[n]=e[n]}_b("raycaster",{schema:{autoRefresh:{default:!0},direction:{type:"vec3",default:{x:0,y:0,z:-1}},enabled:{default:!0},far:{default:1e3},interval:{default:0},near:{default:0},objects:{default:""},origin:{type:"vec3"},showLine:{default:!1},lineColor:{default:"white"},lineOpacity:{default:1},useWorldCoordinates:{default:!1}},multiple:!0,init:function(){this.clearedIntersectedEls=[],this.unitLineEndVec3=new _y.Vector3,this.intersectedEls=[],this.intersections=[],this.newIntersectedEls=[],this.newIntersections=[],this.objects=[],this.prevCheckTime=void 0,this.prevIntersectedEls=[],this.rawIntersections=[],this.raycaster=new _y.Raycaster,this.updateOriginDirection(),this.setDirty=this.setDirty.bind(this),this.updateLine=this.updateLine.bind(this),this.observer=new MutationObserver(this.setDirty),this.dirty=!0,this.lineEndVec3=new _y.Vector3,this.otherLineEndVec3=new _y.Vector3,this.lineData={end:this.lineEndVec3},this.getIntersection=this.getIntersection.bind(this),this.intersectedDetail={el:this.el,getIntersection:this.getIntersection},this.intersectedClearedDetail={el:this.el},this.intersectionClearedDetail={clearedEls:this.clearedIntersectedEls},this.intersectionDetail={}},update:function(t){var e=this.data,n=this.el,i=this.raycaster;i.far=e.far,i.near=e.near,!e.showLine||e.far===t.far&&e.origin===t.origin&&e.direction===t.direction&&t.showLine||(this.unitLineEndVec3.copy(e.direction).normalize(),this.drawLine()),!e.showLine&&t.showLine&&n.removeAttribute("line"),e.objects===t.objects||o_.test(e.objects)||s_('[raycaster] Selector "'+e.objects+'" may not update automatically with DOM changes.'),e.objects||s_('[raycaster] For performance, please define raycaster.objects when using raycaster or cursor components to whitelist which entities to intersect with. e.g., raycaster="objects: [data-raycastable]".'),e.autoRefresh!==t.autoRefresh&&n.isPlaying&&(e.autoRefresh?this.addEventListeners():this.removeEventListeners()),t.enabled&&!e.enabled&&this.clearAllIntersections(),e.objects!==t.objects&&this.setDirty()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){this.data.showLine&&this.el.removeAttribute("line"),this.clearAllIntersections()},addEventListeners:function(){this.data.autoRefresh&&(this.observer.observe(this.el.sceneEl,a_),this.el.sceneEl.addEventListener("object3dset",this.setDirty),this.el.sceneEl.addEventListener("object3dremove",this.setDirty))},removeEventListeners:function(){this.observer.disconnect(),this.el.sceneEl.removeEventListener("object3dset",this.setDirty),this.el.sceneEl.removeEventListener("object3dremove",this.setDirty)},setDirty:function(){this.dirty=!0},refreshObjects:function(){var t,e=this.data;t=e.objects?this.el.sceneEl.querySelectorAll(e.objects):this.el.sceneEl.querySelectorAll("*"),this.objects=this.flattenObject3DMaps(t),this.dirty=!1},tock:function(t){var e=this.data,n=this.prevCheckTime;e.enabled&&(n&&t-n<e.interval||(this.prevCheckTime=t,this.checkIntersections()))},checkIntersections:function(){var t,e,n=this.clearedIntersectedEls,i=this.el,r=this.data,s=this.intersectedEls,o=this.intersections,a=this.newIntersectedEls,l=this.newIntersections,c=this.prevIntersectedEls,h=this.rawIntersections;for(this.dirty&&this.refreshObjects(),h_(this.prevIntersectedEls,this.intersectedEls),this.updateOriginDirection(),h.length=0,this.raycaster.intersectObjects(this.objects,!0,h),o.length=0,s.length=0,t=0;t<h.length;t++)e=h[t],r.showLine&&e.object===i.getObject3D("line")||e.object.el&&(o.push(e),s.push(e.object.el));for(l.length=0,a.length=0,t=0;t<o.length;t++)-1===c.indexOf(o[t].object.el)&&(l.push(o[t]),a.push(o[t].object.el));for(n.length=0,t=0;t<c.length;t++)-1===s.indexOf(c[t])&&(c[t].emit(l_,this.intersectedClearedDetail),n.push(c[t]));for(n.length&&i.emit(c_,this.intersectionClearedDetail),t=0;t<a.length;t++)a[t].emit("raycaster-intersected",this.intersectedDetail);l.length&&(this.intersectionDetail.els=a,this.intersectionDetail.intersections=l,i.emit("raycaster-intersection",this.intersectionDetail)),(0===c.length&&o.length>0||c.length>0&&0===o.length||c.length&&o.length&&c[0]!==o[0].object.el)&&(this.intersectionDetail.els=this.intersectedEls,this.intersectionDetail.intersections=o,i.emit("raycaster-closest-entity-changed",this.intersectionDetail)),r.showLine&&setTimeout(this.updateLine)},updateLine:function(){var t,e=this.el,n=this.intersections;n.length&&(t=n[0].object.el===e&&n[1]?n[1].distance:n[0].distance),this.drawLine(t)},getIntersection:function(t){var e,n;for(e=0;e<this.intersections.length;e++)if((n=this.intersections[e]).object.el===t)return n;return null},updateOriginDirection:function(){var t=new _y.Vector3,e=new _y.Vector3;return function(){var n=this.el,i=this.data;i.useWorldCoordinates?this.raycaster.set(i.origin,i.direction):(n.object3D.updateMatrixWorld(),e.setFromMatrixPosition(n.object3D.matrixWorld),0===i.origin.x&&0===i.origin.y&&0===i.origin.z||(e=n.object3D.localToWorld(e.copy(i.origin))),t.copy(i.direction).transformDirection(n.object3D.matrixWorld).normalize(),this.raycaster.set(e,t))}}(),drawLine:function(t){var e,n=this.data,i=this.el;e=this.lineData.end===this.lineEndVec3?this.otherLineEndVec3:this.lineEndVec3,void 0===t&&(t=n.far===1/0?1e3:n.far),this.lineData.start=n.origin,this.lineData.end=e.copy(this.unitLineEndVec3).multiplyScalar(t).add(n.origin),this.lineData.color=n.lineColor,this.lineData.opacity=n.lineOpacity,i.setAttribute("line",this.lineData)},flattenObject3DMaps:function(t){var e,n,i=this.objects,r=this.el.sceneEl.object3D;function s(t){return t.parent?s(t.parent):t===r}for(i.length=0,n=0;n<t.length;n++){var o=t[n];if(o.isEntity&&o.object3D&&s(o.object3D))for(e in o.object3DMap)i.push(o.getObject3D(e))}return i},clearAllIntersections:function(){var t;for(t=0;t<this.intersectedEls.length;t++)this.intersectedEls[t].emit(l_,this.intersectedClearedDetail);h_(this.clearedIntersectedEls,this.intersectedEls),this.intersectedEls.length=0,this.intersections.length=0,this.el.emit(c_,this.intersectionClearedDetail)}});var u_,d_,p_,A_,f_=_y.MathUtils.degToRad,m_=(_b("rotation",{schema:{type:"vec3"},update:function(){var t=this.data;this.el.object3D.rotation.set(f_(t.x),f_(t.y),f_(t.z),"YXZ")},remove:function(){this.el.object3D.rotation.set(0,0,0)}}),_b("scale",{schema:{type:"vec3",default:{x:1,y:1,z:1}},update:function(){var t=this.data;this.el.object3D.scale.set(t.x,t.y,t.z)},remove:function(){this.el.object3D.scale.set(1,1,1)}}),_b("shadow",{schema:{cast:{default:!0},receive:{default:!0}},init:function(){this.onMeshChanged=this.update.bind(this),this.el.addEventListener("object3dset",this.onMeshChanged),this.system.setShadowMapEnabled(!0)},update:function(){var t=this.data;this.updateDescendants(t.cast,t.receive)},remove:function(){this.el.removeEventListener("object3dset",this.onMeshChanged),this.updateDescendants(!1,!1)},updateDescendants:function(t,e){var n=this.el.sceneEl;this.el.object3D.traverse((function(i){if(i instanceof _y.Mesh&&(i.castShadow=t,i.receiveShadow=e,n.hasLoaded&&i.material))for(var r=Array.isArray(i.material)?i.material:[i.material],s=0;s<r.length;s++)r[s].needsUpdate=!0}))}}),Ly("components:sound:warn")),g_=(_b("sound",{schema:{autoplay:{default:!1},distanceModel:{default:"inverse",oneOf:["linear","inverse","exponential"]},loop:{default:!1},loopStart:{default:0},loopEnd:{default:0},maxDistance:{default:1e4},on:{default:""},poolSize:{default:1},positional:{default:!0},refDistance:{default:1},rolloffFactor:{default:1},src:{type:"audio"},volume:{default:1}},multiple:!0,init:function(){var t=this;this.listener=null,this.audioLoader=new _y.AudioLoader,this.pool=new _y.Group,this.loaded=!1,this.mustPlay=!1,this.playSoundBound=function(){t.playSound()}},update:function(t){var e,n,i=this.data,r=i.src!==t.src;if(r){if(!i.src)return;this.setupSound()}for(e=0;e<this.pool.children.length;e++)n=this.pool.children[e],i.positional&&(n.setDistanceModel(i.distanceModel),n.setMaxDistance(i.maxDistance),n.setRefDistance(i.refDistance),n.setRolloffFactor(i.rolloffFactor)),n.setLoop(i.loop),n.setLoopStart(i.loopStart),0!==i.loopStart&&0===i.loopEnd?n.setLoopEnd(n.buffer.duration):n.setLoopEnd(i.loopEnd),n.setVolume(i.volume),n.isPaused=!1;if(i.on!==t.on&&this.updateEventListener(t.on),r){var s=this;this.loaded=!1,this.audioLoader.load(i.src,(function(t){for(e=0;e<s.pool.children.length;e++)(n=s.pool.children[e]).setBuffer(t);s.loaded=!0,_y.Cache.remove(i.src),(s.data.autoplay||s.mustPlay)&&s.playSound(s.processSound),s.el.emit("sound-loaded",s.evtDetail,!1)}))}},pause:function(){this.stopSound(),this.removeEventListener()},play:function(){this.data.autoplay&&this.playSound(),this.updateEventListener()},remove:function(){var t;this.removeEventListener(),this.el.getObject3D(this.attrName)&&this.el.removeObject3D(this.attrName);try{for(t=0;t<this.pool.children.length;t++)this.pool.children[t].disconnect()}catch(t){m_("Audio source not properly disconnected")}},updateEventListener:function(t){var e=this.el;t&&e.removeEventListener(t,this.playSoundBound),e.addEventListener(this.data.on,this.playSoundBound)},removeEventListener:function(){this.el.removeEventListener(this.data.on,this.playSoundBound)},setupSound:function(){var t,e,n=this.el,i=n.sceneEl,r=this;this.pool.children.length>0&&(this.stopSound(),n.removeObject3D("sound"));var s=this.listener=i.audioListener||new _y.AudioListener;for(i.audioListener=s,i.camera&&i.camera.add(s),i.addEventListener("camera-set-active",(function(t){t.detail.cameraEl.getObject3D("camera").add(s)})),this.pool=new _y.Group,t=0;t<this.data.poolSize;t++)e=this.data.positional?new _y.PositionalAudio(s):new _y.Audio(s),this.pool.add(e);for(n.setObject3D(this.attrName,this.pool),t=0;t<this.pool.children.length;t++)(e=this.pool.children[t]).onEnded=function(){this.isPlaying=!1,r.el.emit("sound-ended",r.evtDetail,!1)}},pauseSound:function(){var t,e;for(this.isPlaying=!1,t=0;t<this.pool.children.length;t++)(e=this.pool.children[t]).source&&e.source.buffer&&e.isPlaying&&!e.isPaused&&(e.isPaused=!0,e.pause())},playSound:function(t){var e,n,i;if(!this.loaded)return m_("Sound not loaded yet. It will be played once it finished loading"),this.mustPlay=!0,void(this.processSound=t);for(e=!1,this.isPlaying=!0,n=0;n<this.pool.children.length;n++)(i=this.pool.children[n]).isPlaying||!i.buffer||e||(t&&t(i),i.play(),i.isPaused=!1,e=!0);e?(this.mustPlay=!1,this.processSound=void 0):m_("All the sounds are playing. If you need to play more sounds simultaneously consider increasing the size of pool with the `poolSize` attribute.",this.el)},stopSound:function(){var t,e;for(this.isPlaying=!1,t=0;t<this.pool.children.length;t++){if(!(e=this.pool.children[t]).source||!e.source.buffer)return;e.stop()}}}),n(4433)),v_=n.n(g_),y_=n(5751),E_=n.n(y_),x_=Ly("components:text:error"),b_=Ly("components:text:warn"),C_=My+"fonts/",w_={aileronsemibold:C_+"Aileron-Semibold.fnt",dejavu:C_+"DejaVu-sdf.fnt",exo2bold:C_+"Exo2Bold.fnt",exo2semibold:C_+"Exo2SemiBold.fnt",kelsonsans:C_+"KelsonSans.fnt",monoid:C_+"Monoid.fnt",mozillavr:C_+"mozillavr.fnt",roboto:C_+"Roboto-msdf.json",sourcecodepro:C_+"SourceCodePro.fnt"},__=["roboto"],M_="roboto",S_=new function(){var t=this.cache={};this.get=function(e,n){return e in t||(t[e]=n()),t[e]}},I_={},B_={},T_=/^\w+:/;function R_(t,e,n){return t||(.5+e)*n}_b("text",{multiple:!0,schema:{align:{type:"string",default:"left",oneOf:["left","right","center"]},alphaTest:{default:.5},anchor:{default:"center",oneOf:["left","right","center","align"]},baseline:{default:"center",oneOf:["top","center","bottom"]},color:{type:"color",default:"#FFF"},font:{type:"string",default:M_},fontImage:{type:"string"},height:{type:"number"},letterSpacing:{type:"number",default:0},lineHeight:{type:"number"},negate:{type:"boolean",default:!0},opacity:{type:"number",default:1},shader:{default:"sdf",oneOf:AC},side:{default:"front",oneOf:["front","back","double"]},tabSize:{default:4},transparent:{default:!0},value:{type:"string"},whiteSpace:{default:"normal",oneOf:["normal","pre","nowrap"]},width:{type:"number"},wrapCount:{type:"number",default:40},wrapPixels:{type:"number"},xOffset:{type:"number",default:0},yOffset:{type:"number",default:0},zOffset:{type:"number",default:.001}},init:function(){this.shaderData={},this.geometry=v_()(),this.createOrUpdateMaterial(),this.explicitGeoDimensionsChecked=!1},update:function(t){var e=this.data,n=this.currentFont;B_[e.font]?this.texture=B_[e.font]:(this.texture=B_[e.font]=new _y.Texture,this.texture.anisotropy=16),this.createOrUpdateMaterial(),t.font===e.font?n&&(this.updateGeometry(this.geometry,n),this.updateLayout()):this.updateFont()},remove:function(){this.geometry.dispose(),this.geometry=null,this.el.removeObject3D(this.attrName),this.material.dispose(),this.material=null,this.texture.dispose(),this.texture=null,this.shaderObject&&delete this.shaderObject},createOrUpdateMaterial:function(){var t,e,n,i=this.data,r=this.material,s=this.shaderData;if(n=i.shader,-1!==__.indexOf(i.font)||i.font.indexOf("-msdf.")>=0?n="msdf":i.font in w_&&-1===__.indexOf(i.font)&&(n="sdf"),t=(this.shaderObject&&this.shaderObject.name)!==n,s.alphaTest=i.alphaTest,s.color=i.color,s.map=this.texture,s.opacity=i.opacity,s.side=function(t){switch(t){case"back":return _y.FrontSide;case"double":return _y.DoubleSide;default:return _y.BackSide}}(i.side),s.transparent=i.transparent,s.negate=i.negate,!t)return this.shaderObject.update(s),r.transparent=s.transparent,void(r.side=s.side);e=function(t,e,n){var i,r;return(r=new AC[e].Shader).el=t,r.init(n),r.update(n),(i=r.material).transparent=n.transparent,{material:i,shader:r}}(this.el,n,s),this.material=e.material,this.shaderObject=e.shader,this.material.side=s.side,this.mesh&&(this.mesh.material=this.material)},updateFont:function(){var t,e=this.data,n=this.el,i=this.geometry,r=this;e.font||b_("No font specified. Using the default font."),this.mesh&&(this.mesh.visible=!1),t=this.lookupFont(e.font||M_)||e.font,S_.get(t,(function(){return function(t,e){return new Promise((function(n,i){E_()(t,(function(r,s){if(r)return x_("Error loading font",t),void i(r);t.indexOf("/Roboto-msdf.json")>=0&&(e=30),e&&s.chars.forEach((function(t){t.yoffset+=e})),n(s)}))}))}(t,e.yOffset)})).then((function(s){var o;if(1!==s.pages.length)throw new Error("Currently only single-page bitmap fonts are supported.");I_[t]||(s.widthFactor=I_[s]=function(t){var e=0,n=0,i=0;return t.chars.forEach((function(t){e+=t.xadvance,t.id>=48&&t.id<=57&&(i++,n+=t.xadvance)})),i?n/i:e/t.chars.length}(s)),r.currentFont=s,o=r.getFontImageSrc(),S_.get(o,(function(){return function(t){return new Promise((function(e,n){(new _y.ImageLoader).load(t,(function(t){e(t)}),void 0,(function(){x_("Error loading font image",t),n(null)}))}))}(o)})).then((function(t){var o=r.texture;o&&(o.image=t,o.needsUpdate=!0,B_[e.font]=o,r.texture=o,r.initMesh(),r.currentFont=s,r.updateGeometry(i,s),r.updateLayout(),r.mesh.visible=!0,n.emit("textfontset",{font:e.font,fontObj:s}))})).catch((function(t){x_(t.message),x_(t.stack)}))})).catch((function(t){x_(t.message),x_(t.stack)}))},initMesh:function(){this.mesh||(this.mesh=new _y.Mesh(this.geometry,this.material),this.el.setObject3D(this.attrName,this.mesh))},getFontImageSrc:function(){if(this.data.fontImage)return this.data.fontImage;var t=this.lookupFont(this.data.font||M_)||this.data.font,e=this.currentFont.pages[0];return e.match(T_)&&0!==e.indexOf("http")?t.replace(/(\.fnt)|(\.json)/,".png"):_y.LoaderUtils.extractUrlBase(t)+e},updateLayout:function(){var t,e,n,i,r,s,o,a,l,c=this.el,h=this.data,u=this.geometry,d=this.mesh;if(d&&u.layout){if(n=c.getAttribute("geometry"),i=(s=(o=h.width||n&&n.width||1)/R_(h.wrapPixels,h.wrapCount,this.currentFont.widthFactor))*((r=u.layout).height+r.descender),n&&"plane"===n.primitive&&(this.explicitGeoDimensionsChecked||(this.explicitGeoDimensionsChecked=!0,this.hasExplicitGeoWidth=!!n.width,this.hasExplicitGeoHeight=!!n.height),this.hasExplicitGeoWidth||c.setAttribute("geometry","width",o),this.hasExplicitGeoHeight||c.setAttribute("geometry","height",i)),"left"===(t="align"===h.anchor?h.align:h.anchor))a=0;else if("right"===t)a=-1*r.width;else{if("center"!==t)throw new TypeError("Invalid text.anchor property value",t);a=-1*r.width/2}if("bottom"===(e=h.baseline))l=0;else if("top"===e)l=-1*r.height+r.ascender;else{if("center"!==e)throw new TypeError("Invalid text.baseline property value",e);l=-1*r.height/2}d.position.x=a*s+h.xOffset,d.position.y=l*s,d.position.z=h.zOffset,d.scale.set(s,-1*s,s)}},lookupFont:function(t){return w_[t]},updateGeometry:(u_={},d_={},p_=/\\n/g,A_=/\\t/g,function(t,e){var n=this.data;d_.font=e,d_.lineHeight=n.lineHeight&&isFinite(n.lineHeight)?n.lineHeight:e.common.lineHeight,d_.text=n.value.toString().replace(p_,"\n").replace(A_,"\t"),d_.width=R_(n.wrapPixels,n.wrapCount,e.widthFactor),t.update(dx(u_,n,d_))})});var L_,D_,P_=(_b("tracked-controls",{schema:{id:{type:"string",default:""},controller:{default:-1},autoHide:{default:!0},hand:{type:"string",default:""},handTrackingEnabled:{default:!1},iterateControllerProfiles:{default:!1}},init:function(){this.buttonEventDetails={},this.buttonStates=this.el.components["tracked-controls"].buttonStates={},this.axis=this.el.components["tracked-controls"].axis=[0,0,0],this.changedAxes=[],this.axisMoveEventDetail={axis:this.axis,changed:this.changedAxes},this.updateController=this.updateController.bind(this)},update:function(){this.updateController()},play:function(){var t=this.el.sceneEl;this.updateController(),t.addEventListener("controllersupdated",this.updateController)},pause:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.updateController)},isControllerPresent:function(t){return!(!this.controller||this.controller.gamepad||"none"!==t.inputSource.handedness&&t.inputSource.handedness!==this.data.hand)},updateController:function(){this.controller=tx(this.system.controllers,this.data.id,this.data.hand,this.data.controller,this.data.iterateControllerProfiles,this.data.handTrackingEnabled),this.el.components["tracked-controls"].controller=this.controller},tick:function(){var t=this.el.sceneEl,e=this.controller,n=t.frame;this.data.autoHide&&(this.el.object3D.visible=!!e),e&&t.frame&&this.system.referenceSpace&&(e.hand||(this.pose=n.getPose(e.gripSpace,this.system.referenceSpace),this.updatePose(),this.updateButtons()))},updatePose:function(){var t=this.el.object3D,e=this.pose;e&&(t.matrix.elements=e.transform.matrix,t.matrix.decompose(t.position,t.rotation,t.scale))},updateButtons:function(){var t,e,n,i=this.controller;if(i&&i.gamepad){for(n=i.gamepad,e=0;e<n.buttons.length;++e)this.buttonStates[e]||(this.buttonStates[e]={pressed:!1,touched:!1,value:0}),this.buttonEventDetails[e]||(this.buttonEventDetails[e]={id:e,state:this.buttonStates[e]}),t=n.buttons[e],this.handleButton(e,t);this.handleAxes()}},handleButton:function(t,e){return!!(this.handlePress(t,e)|this.handleTouch(t,e)|this.handleValue(t,e))&&(this.el.emit("buttonchanged",this.buttonEventDetails[t],!1),!0)},handleAxes:function(){var t,e=!1,n=this.controller.gamepad.axes,i=this.axis,r=this.changedAxes;for(this.changedAxes.splice(0,this.changedAxes.length),t=0;t<n.length;++t)r.push(i[t]!==n[t]),r[t]&&(e=!0);if(!e)return!1;for(this.axis.splice(0,this.axis.length),t=0;t<n.length;t++)this.axis.push(n[t]);return this.el.emit("axismove",this.axisMoveEventDetail,!1),!0},handlePress:function(t,e){var n,i=this.buttonStates[t];return e.pressed!==i.pressed&&(n=e.pressed?"buttondown":"buttonup",this.el.emit(n,this.buttonEventDetails[t],!1),i.pressed=e.pressed,!0)},handleTouch:function(t,e){var n,i=this.buttonStates[t];return e.touched!==i.touched&&(n=e.touched?"touchstart":"touchend",this.el.emit(n,this.buttonEventDetails[t],!1),i.touched=e.touched,!0)},handleValue:function(t,e){var n=this.buttonStates[t];return e.value!==n.value&&(n.value=e.value,!0)}}),_b("visible",{schema:{default:!0},update:function(){this.el.object3D.visible=this.data}}),My+"controllers/valve/index/valve-index-"),U_={left:P_+"left.glb",right:P_+"right.glb"},O_="valve",F_={left:{x:0,y:-.05,z:.06},right:{x:0,y:-.05,z:.06}},k_={left:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"},right:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"}},N_=(_b("valve-index-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{trackpad:[0,1],thumbstick:[2,3]},buttons:["trigger","grip","trackpad","thumbstick","abutton"]},init:function(){var t=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.previousButtonValues={},this.bindMethods()},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data,e="right"===t.hand?0:"left"===t.hand?1:2;ZE(this,O_,{index:e,iterateControllerProfiles:!0,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:O_,controller:"right"===e.hand?1:"left"===e.hand?0:2,hand:e.hand}),this.loadModel()},loadModel:function(){var t=this.data;t.model&&this.el.setAttribute("gltf-model",""+U_[t.hand])},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping.buttons[t.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(e=t.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=this.triggerOriginalRotationX-e*(Math.PI/40))),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){var e,n=t.detail.model,i=this;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},e.menu=n.getObjectByName("menubutton"),e.system=n.getObjectByName("systembutton"),e.trackpad=n.getObjectByName("touchpad"),e.trigger=n.getObjectByName("trigger"),this.triggerOriginalRotationX=e.trigger.rotation.x,Object.keys(e).forEach((function(t){i.setButtonColor(t,i.data.buttonColor)})),n.position.copy(k_[this.data.hand]),n.rotation.copy(F_[this.data.hand]),this.el.emit("controllermodelready",{name:"valve-index-controls",model:this.data.model,rayOrigin:new _y.Vector3(0,0,0)}))},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},updateModel:function(t,e){var n;this.data.model&&(-1!==e.indexOf("touch")||(n="up"===e?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(t,n)))},setButtonColor:function(t,e){}}),My+"controllers/vive/vr_controller_vive.obj"),Q_=My+"controllers/vive/vr_controller_vive.mtl",G_="htc-vive",z_=(_b("vive-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","none"]},init:function(){var t=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.previousButtonValues={},this.bindMethods()},update:function(){var t=this.data;this.controllerIndex="right"===t.hand?0:"left"===t.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var t=this.data;ZE(this,G_,{index:this.controllerIndex,hand:t.hand})},injectTrackedControls:function(){var t=this.el,e=this.data;t.setAttribute("tracked-controls",{idPrefix:G_,hand:e.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("obj-model",{obj:N_,mtl:Q_})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(t){var e,n=this.mapping.buttons[t.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(e=t.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=-e*(Math.PI/12))),this.el.emit(n+"changed",t.detail.state))},onModelLoaded:function(t){var e,n=t.detail.model,i=this;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},e.menu=n.getObjectByName("menubutton"),e.system=n.getObjectByName("systembutton"),e.trackpad=n.getObjectByName("touchpad"),e.touchpad=n.getObjectByName("touchpad"),e.trigger=n.getObjectByName("trigger"),Object.keys(e).forEach((function(t){i.setButtonColor(t,i.data.buttonColor)})),n.position.set(0,-.015,.04))},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},updateModel:function(t,e){var n;this.data.model&&(-1!==e.indexOf("touch")||(n="up"===e?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(t,n)))},setButtonColor:function(t,e){var n=this.buttonMeshes;if(n)return"grip"===t?(n.grip.left.material.color.set(e),void n.grip.right.material.color.set(e)):void n[t].material.color.set(e)}}),My+"controllers/vive/focus-controller/focus-controller.gltf"),H_="htc-vive-focus",V_=(_b("vive-focus-controls",{schema:{hand:{default:""},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad","none","menu"]},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.controllerPresent=!1,this.bindMethods()},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("model-loaded",this.onModelLoaded),t.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0,this.addControllersUpdateListener()},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("model-loaded",this.onModelLoaded),t.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1,this.removeControllersUpdateListener()},checkIfControllerPresent:function(){ZE(this,H_,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){this.el.setAttribute("tracked-controls",{idPrefix:H_}),this.data.model&&this.el.setAttribute("gltf-model",z_)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(t){var e,n=t.detail.model;t.target===this.el&&this.data.model&&((e=this.buttonMeshes={}).trigger=n.getObjectByName("BumperKey"),e.triggerPressed=n.getObjectByName("BumperKey_Press"),e.triggerPressed&&(e.triggerPressed.visible=!1),e.touchpad=n.getObjectByName("TouchPad"),e.touchpadPressed=n.getObjectByName("TouchPad_Press"),e.trackpad=n.getObjectByName("TouchPad"),e.trackpadPressed=n.getObjectByName("TouchPad_Press"),e.trackpadPressed&&(e.trackpadPressed.visible=!1))},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&this.el.emit(e+"changed",t.detail.state)},onAxisMoved:function(t){ex(this,this.mapping.axes,t)},updateModel:function(t,e){this.data.model&&this.updateButtonModel(t,e)},updateButtonModel:function(t,e){var n=this.buttonMeshes,i=t+"Pressed";if(n&&n[t]&&n[i]){var r;switch(e){case"down":r=this.data.buttonHighlightColor;break;case"touchstart":r=this.data.buttonTouchedColor}r&&n[i].material.color.set(r),n[i].visible=!!r,n[t].visible=!r}}}),{38:"ArrowUp",37:"ArrowLeft",40:"ArrowDown",39:"ArrowRight",87:"KeyW",65:"KeyA",83:"KeyS",68:"KeyD"}),j_=yx,W_=1e-5,q_=["KeyW","KeyA","KeyS","KeyD","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"];_b("wasd-controls",{schema:{acceleration:{default:65},adAxis:{default:"x",oneOf:["x","y","z"]},adEnabled:{default:!0},adInverted:{default:!1},enabled:{default:!0},fly:{default:!1},wsAxis:{default:"z",oneOf:["x","y","z"]},wsEnabled:{default:!0},wsInverted:{default:!1}},after:["look-controls"],init:function(){this.keys={},this.easing=1.1,this.velocity=new _y.Vector3,this.onBlur=this.onBlur.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.onFocus=this.onFocus.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.attachVisibilityEventListeners()},tick:function(t,e){var n=this.data,i=this.el,r=this.velocity;(r[n.adAxis]||r[n.wsAxis]||!function(t){var e;for(e in t)return!1;return!0}(this.keys))&&(e/=1e3,this.updateVelocity(e),(r[n.adAxis]||r[n.wsAxis])&&i.object3D.position.add(this.getMovementVector(e)))},update:function(t){t.adAxis!==this.data.adAxis&&(this.velocity[t.adAxis]=0),t.wsAxis!==this.data.wsAxis&&(this.velocity[t.wsAxis]=0)},remove:function(){this.removeKeyEventListeners(),this.removeVisibilityEventListeners()},play:function(){this.attachKeyEventListeners()},pause:function(){this.keys={},this.removeKeyEventListeners()},updateVelocity:function(t){var e,n,i,r,s,o=this.data,a=this.keys,l=this.velocity;if(n=o.adAxis,r=o.wsAxis,t>.2)return l[n]=0,void(l[r]=0);var c=Math.pow(1/this.easing,60*t);0!==l[n]&&(l[n]=l[n]*c),0!==l[r]&&(l[r]=l[r]*c),Math.abs(l[n])<W_&&(l[n]=0),Math.abs(l[r])<W_&&(l[r]=0),o.enabled&&(e=o.acceleration,o.adEnabled&&(i=o.adInverted?-1:1,(a.KeyA||a.ArrowLeft)&&(l[n]-=i*e*t),(a.KeyD||a.ArrowRight)&&(l[n]+=i*e*t)),o.wsEnabled&&(s=o.wsInverted?-1:1,(a.KeyW||a.ArrowUp)&&(l[r]-=s*e*t),(a.KeyS||a.ArrowDown)&&(l[r]+=s*e*t)))},getMovementVector:(L_=new _y.Vector3(0,0,0),D_=new _y.Euler(0,0,0,"YXZ"),function(t){var e,n=this.el.getAttribute("rotation"),i=this.velocity;return L_.copy(i),L_.multiplyScalar(t),n?(e=this.data.fly?n.x:0,D_.set(_y.MathUtils.degToRad(e),_y.MathUtils.degToRad(n.y),0),L_.applyEuler(D_),L_):L_}),attachVisibilityEventListeners:function(){window.oncontextmenu=this.onContextMenu,window.addEventListener("blur",this.onBlur),window.addEventListener("focus",this.onFocus),document.addEventListener("visibilitychange",this.onVisibilityChange)},removeVisibilityEventListeners:function(){window.removeEventListener("blur",this.onBlur),window.removeEventListener("focus",this.onFocus),document.removeEventListener("visibilitychange",this.onVisibilityChange)},attachKeyEventListeners:function(){window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp)},removeKeyEventListeners:function(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp)},onContextMenu:function(){for(var t=Object.keys(this.keys),e=0;e<t.length;e++)delete this.keys[t[e]]},onBlur:function(){this.pause()},onFocus:function(){this.play()},onVisibilityChange:function(){document.hidden?this.onBlur():this.onFocus()},onKeyDown:function(t){var e;j_(t)&&(e=t.code||V_[t.keyCode],-1!==q_.indexOf(e)&&(this.keys[e]=!0))},onKeyUp:function(t){var e;e=t.code||V_[t.keyCode],delete this.keys[e]}});var X_,Y_,J_,K_=Ly("components:windows-motion-controls:debug"),Z_=Ly("components:windows-motion-controls:warn"),$_=My+"controllers/microsoft/",tM={left:"left.glb",right:"right.glb",default:"universal.glb"},eM="windows-mixed-reality",nM=(_b("windows-motion-controls",{schema:{hand:{default:"right"},pair:{default:0},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick","menu"],axisMeshNames:["TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_X","THUMBSTICK_X","THUMBSTICK_Y"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",squeeze:"GRASP",thumbstick:"THUMBSTICK_PRESS",touchpad:"TOUCHPAD_PRESS"},pointingPoseMeshName:"POINTING_POSE"},bindMethods:function(){this.onModelError=this.onModelError.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var t=this,e=this.el;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(e){nx(e.detail.id,"down",t)},this.onButtonUp=function(e){nx(e.detail.id,"up",t)},this.onButtonTouchStart=function(e){nx(e.detail.id,"touchstart",t)},this.onButtonTouchEnd=function(e){nx(e.detail.id,"touchend",t)},this.onControllerConnected=function(){t.setModelVisibility(!0)},this.onControllerDisconnected=function(){t.setModelVisibility(!1)},this.controllerPresent=!1,this.previousButtonValues={},this.bindMethods(),this.loadedMeshInfo={buttonMeshes:null,axisMeshes:null},this.rayOrigin={origin:new THREE.Vector3,direction:new THREE.Vector3(0,0,-1),createdFromMesh:!1},e.addEventListener("controllerconnected",this.onControllerConnected),e.addEventListener("controllerdisconnected",this.onControllerDisconnected)},addEventListeners:function(){var t=this.el;t.addEventListener("buttonchanged",this.onButtonChanged),t.addEventListener("buttondown",this.onButtonDown),t.addEventListener("buttonup",this.onButtonUp),t.addEventListener("touchstart",this.onButtonTouchStart),t.addEventListener("touchend",this.onButtonTouchEnd),t.addEventListener("axismove",this.onAxisMoved),t.addEventListener("model-error",this.onModelError),t.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var t=this.el;t.removeEventListener("buttonchanged",this.onButtonChanged),t.removeEventListener("buttondown",this.onButtonDown),t.removeEventListener("buttonup",this.onButtonUp),t.removeEventListener("touchstart",this.onButtonTouchStart),t.removeEventListener("touchend",this.onButtonTouchEnd),t.removeEventListener("axismove",this.onAxisMoved),t.removeEventListener("model-error",this.onModelError),t.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){ZE(this,eM,{hand:this.data.hand,index:this.data.pair,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},updateControllerModel:function(){if(this.data.model&&!this.rayOrigin.createdFromMesh){var t=this.createControllerModelUrl();this.loadModel(t)}else this.modelReady()},createControllerModelUrl:function(t){var e=this.data.hand;return $_+"default/"+(tM[e]||tM.default)},injectTrackedControls:function(){var t=this.data;this.el.setAttribute("tracked-controls",{idPrefix:eM,controller:t.pair,hand:t.hand}),this.updateControllerModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelError:function(t){var e=this.createControllerModelUrl(!0);t.detail.src!==e?(Z_("Failed to load controller model for device, attempting to load default."),this.loadModel(e)):Z_("Failed to load default controller model.")},loadModel:function(t){this.el.setAttribute("gltf-model","url("+t+")")},onModelLoaded:function(t){var e,n,i,r,s=this.controllerModel=t.detail.model,o=this.loadedMeshInfo;if(t.target===this.el){if(K_("Processing model"),o.buttonMeshes={},o.axisMeshes={},s){for(e=0;e<this.mapping.buttons.length;e++)(n=this.mapping.buttonMeshNames[this.mapping.buttons[e]])?(i=s.getObjectByName(n))?(r={index:e,value:a(i,"VALUE"),pressed:a(i,"PRESSED"),unpressed:a(i,"UNPRESSED")}).value&&r.pressed&&r.unpressed?o.buttonMeshes[this.mapping.buttons[e]]=r:Z_("Missing button submesh under mesh with name: "+n+"(VALUE: "+!!r.value+", PRESSED: "+!!r.pressed+", UNPRESSED:"+!!r.unpressed+")"):Z_("Missing button mesh with name: "+n):K_("Skipping unknown button at index: "+e+" with mapped name: "+this.mapping.buttons[e]);for(e=0;e<this.mapping.axisMeshNames.length;e++)(n=this.mapping.axisMeshNames[e])?(i=s.getObjectByName(n))?(r={index:e,value:a(i,"VALUE"),min:a(i,"MIN"),max:a(i,"MAX")}).value&&r.min&&r.max?o.axisMeshes[e]=r:Z_("Missing axis submesh under mesh with name: "+n+"(VALUE: "+!!r.value+", MIN: "+!!r.min+", MAX:"+!!r.max+")"):Z_("Missing axis mesh with name: "+n):K_("Skipping unknown axis at index: "+e);this.calculateRayOriginFromMesh(s),this.setModelVisibility()}K_("Model load complete.")}function a(t,e){for(var n=0,i=t.children.length;n<i;n++){var r=t.children[n];if(r&&r.name===e)return r}}},calculateRayOriginFromMesh:function(){var t=new THREE.Quaternion;return function(e){var n;if(this.rayOrigin.origin.set(0,0,0),this.rayOrigin.direction.set(0,0,-1),this.rayOrigin.createdFromMesh=!0,n=e.getObjectByName(this.mapping.pointingPoseMeshName)){var i=e.parent;i&&(e.parent=null,e.updateMatrixWorld(!0),e.parent=i),n.getWorldPosition(this.rayOrigin.origin),n.getWorldQuaternion(t),this.rayOrigin.direction.applyQuaternion(t),i&&e.updateMatrixWorld(!0)}else K_("Mesh does not contain pointing origin data, defaulting to none.");this.modelReady()}}(),lerpAxisTransform:function(){var t=new THREE.Quaternion;return function(e,n){var i=this.loadedMeshInfo.axisMeshes[e];if(i){var r=i.min,s=i.max,o=i.value,a=.5*n+.5;o.setRotationFromQuaternion(t.copy(r.quaternion).slerp(s.quaternion,a)),o.position.lerpVectors(r.position,s.position,a)}}}(),lerpButtonTransform:function(){var t=new THREE.Quaternion;return function(e,n){var i=this.loadedMeshInfo.buttonMeshes[e];if(i){var r=i.unpressed,s=i.pressed,o=i.value;o.setRotationFromQuaternion(t.copy(r.quaternion).slerp(s.quaternion,n)),o.position.lerpVectors(r.position,s.position,n)}}}(),modelReady:function(){this.el.emit("controllermodelready",{name:"windows-motion-controls",model:this.data.model,rayOrigin:this.rayOrigin})},onButtonChanged:function(t){var e=this.mapping.buttons[t.detail.id];e&&(this.loadedMeshInfo&&this.loadedMeshInfo.buttonMeshes&&this.lerpButtonTransform(e,t.detail.state.value),this.el.emit(e+"changed",t.detail.state))},onAxisMoved:function(t){var e=this.mapping.axisMeshNames.length;if(this.loadedMeshInfo&&this.loadedMeshInfo.axisMeshes)for(var n=0;n<e;n++)this.lerpAxisTransform(n,t.detail.axis[n]||0);ex(this,this.mapping.axes,t)},setModelVisibility:function(t){var e=this.el.getObject3D("mesh");this.controllerPresent&&(t=void 0!==t?t:this.modelVisible,this.modelVisible=t,e&&(e.visible=t))}}),X_=new _y.Quaternion,Y_=new _y.Vector3,function(t,e,n){e.position.copy(t.transform.position),e.quaternion.copy(t.transform.orientation),Y_.copy(n),X_.copy(t.transform.orientation),Y_.applyQuaternion(X_),e.position.sub(Y_)});function iM(t,e){this.renderer=t,this.xrHitTestSource=null,t.xr.addEventListener("sessionend",function(){this.xrHitTestSource=null}.bind(this)),t.xr.addEventListener("sessionstart",function(){this.sessionStart(e)}.bind(this)),this.renderer.xr.isPresenting&&this.sessionStart(e)}function rM(t){console.warn(t.message),console.warn('Cannot requestHitTestSource Are you missing: webxr="optionalFeatures: hit-test;" from <a-scene>?')}nM.tempFakePose={transform:{orientation:new _y.Quaternion,position:new _y.Vector3}},iM.prototype.previousFrameAnchors=new Set,iM.prototype.anchorToObject3D=new Map,iM.prototype.sessionStart=function(t){this.session=this.renderer.xr.getSession(),"requestHitTestSource"in this.session?t.space?this.session.requestHitTestSource(t).then(function(t){this.xrHitTestSource=t}.bind(this)).catch(rM):t.profile&&this.session.requestHitTestSourceForTransientInput(t).then(function(t){this.xrHitTestSource=t,this.transient=!0}.bind(this)).catch(rM):rM({message:"No requestHitTestSource on the session."})},iM.prototype.anchorFromLastHitTestResult=function(t,e){var n=this.lastHitTest;if(n){var i={object3D:t,offset:e};Array.from(this.anchorToObject3D.entries()).forEach(function(e){var n=e[1].object3D,i=e[0];n===t&&(this.anchorToObject3D.delete(i),i.delete())}.bind(this)),n.createAnchor&&n.createAnchor().then(function(t){this.anchorToObject3D.set(t,i)}.bind(this)).catch((function(t){console.warn(t.message),console.warn('Cannot create anchor, are you missing: webxr="optionalFeatures: anchors;" from <a-scene>?')}))}},iM.prototype.doHit=function(t){if(this.renderer.xr.isPresenting){var e,n,i=this.renderer.xr.getReferenceSpace(),r=t.getViewerPose(i);return this.xrHitTestSource&&r?this.transient?(e=t.getHitTestResultsForTransientInput(this.xrHitTestSource)).length>0&&(n=e[0].results).length>0&&(this.lastHitTest=n[0],n[0].getPose(i)):(e=t.getHitTestResults(this.xrHitTestSource)).length>0&&(this.lastHitTest=e[0],e[0].getPose(i)):void 0}},iM.updateAnchorPoses=function(t,e){var n=t.trackedAnchors||iM.prototype.previousFrameAnchors;iM.prototype.previousFrameAnchors.forEach((function(t){n.has(t)||iM.prototype.anchorToObject3D.delete(t)})),n.forEach((function(n){var i,r,s,o;try{if(i=t.getPose(n.anchorSpace,e)){if(!(r=iM.prototype.anchorToObject3D.get(n)))return;s=r.offset,o=r.object3D,nM(i,o,s)}}catch(t){console.error("while updating anchor poses:",t)}})),iM.prototype.previousFrameAnchors=n},_b("ar-hit-test",{schema:{target:{type:"selector"},enabled:{default:!0},src:{default:"data:image/webp;base64,UklGRkQHAABXRUJQVlA4WAoAAAAQAAAA/wEA/wEAQUxQSL0DAAARDzD/ERGCjrY9sYYFfgo6aa1kJ7K0w9Lo3AadLSVeFxevQwj5kuM8RfR/Atw/C0+ozB/oUBrloFZs6ElSW88j1KA4yExNWQaqRZquIDF0JYmlq0hAuUDTFu66tng3teW7pa3cQf1V1edvur54M/Slm6Wv3Gx9zw0MXlQLntcsBN6wkHjTQuYtC4W3LTw8mGRVG57TbAROtxHfZNhInGkjc5aNwtk2Hg6Mvki14k+NkZzCwQgCxalcAv3kddRTPI1DcUrXId1FLf1uHpzaQz4tquhZVLlKesbVpqKeTj0n0F5PpXDlFN9UqmhalL/ImuZFo6KmToWLoKlddMprqlS8cKovBvHo2kTiFV2LN4msaxKZl3QNiair8xYRdDWivIvXVXmbcMqJ51UebZuFXxZt6xd4laxtciqRtA3Cv0nU1t+kEUFbI8JvCa+tvkm3FDlO/W+OR99+kWEp/YYo+tYfTVnf/K8cE/F///3vv//993eeL+a+uvjawLcX3xjYvJotBFY3kVjTRGFtE+BU2AiMbiQyhpHMWEYeBozAH5qNBYRDB5KBCaTDBKKBAZTDBoKBDjwHAN5ABeCJBsAZcAAC0YHHxAYSMYBiYgGZWEA2MYFCbCCZGAAIANFEB+AnYgMQTDQAYSJ2AN5EBZAm4gDgTDgAeSIu4DGygTIRN1CMLOCZiACykQlg4jsAycgA8AO+BxCNdJyDkcbwRirDGXGnx8w+FDPrkM3MQ9JQZMYhiiwV/RDMtIM3U1/DmXHUo+IR2kSR2ToWkQ1NIn2qf2J8LCqJKiDUiSADHY3whirhdHgZ94HKaR97PhE+twEUJUFoAcgyTct8hfSxSkShASDKdMJ/ritKHwgyQ0sD4D/miCxU5SbhOOUDTnZpccCjYP/i0bZ/8bAgtVGEoGapWIQXyzKVKLwgNJFk2rtMIgoNRJlOZF7SNSSyUEeQmbxBFKEmtYjEe8S8zOZ1AkJVCmS88FJOtF40Ksg4oUaFiygk3C8qlTVNyl8UTevCUdAE2t14PfVqU1FPp57TopKeQZWromddTQp6QOfTOEQt/ZDuipZ11w/wOiqO8dRORcc6BQEkDQMClaHcn5wV9yLbxsNZNgpn2sicYSNxuo34Js1G4FQbnuNsOPa28PCWhcKbFjJvWEi8ZiHwqgXPcxbc5db33Cx95WboSzddX7yp+vyN0+eul7ZyN7Xlu64t3jVt4c5pc4JLV5EYupJE0xUknC4nOjVlmaYpyLit53HCQ0+ScnqceNcS5dzUkd0/CwMAVlA4IGADAAAQXwCdASoAAgACP8ne6Wy/tjCpqJ/IA/A5CWlu4XYBG/Pz8AfwD8APz//f3v8E1fuHZnxKYACtfuHZnxKYACrYTb5mOslhxu843ecbvON3nG7zjd3a0VCn7G1MABVxwH/Xd25gAK1+4dmfEpe2+PHhQaj75++riG6FuYACtfuHZnxKYACRrK3q9xO8Ss3uWKnMhs/rDF1hi6wxdYYusMXWGI5QRcCFDZog5OgqNlse1NDuz/UoFa/cOzPiUwAEsAOK4/nu5eZHK2tlXxJfNYlMABWv3Dsz4bvNJ5YA/LtxJ38SmAArX7h2Z8Sk5vdZUYv7mZPiUwAFa/cOzPh21s5OgZxf1mfEpemRyFr/rM+JS9noA/LtxJ38SmAAlUJIotzAASn6TjdhK+D3Dsz4dyvB7h2Z8O2tnJ0DOL+sz4lL2nKLT4lL/+iSLOocxq639w7M34MNZdm55uJ8v8ra2cpVZnxKTq2F3PN/cNksAfl24k7+JTAASqrD37h2Z7b1W+VtbOUqsz4lJ1bC7nm/uGyWAPy7cSd/EpgAJVVh79w7M9t6rfK2tnKVWZ8Sk6thdzzf3DZLAH5duJO/iUwAEqqw9+4dme29VvlbWzlKrM+JSdWwu55v7hslgD8u3EnfxKYACVVYe/cOzPbeq3ytrZylVme0kYJ8557FLerqFrzIbPrrf3DZLAH5duJO/iUvaVMS9BoaF4p7pSDFTP1XMyfElelrM0DOL+sz4eBJ13nV1OppBGPuKb4YzXQgq9uH19uS/0+JS9t9fr6ZUlQBelDG6GMgq97otb5QMPJwtKyBTbFp8Sl7b6/X0ykkawEOsgdiE6Fi0vb/Eve6xkwsmug0Z4nGNHQO8839bpTsjpz7SWIJxKagvd1QWMa6FYT1KEw3j4XDT6vJ9Xk+nyfT5Pq8n1eEmk5dinMM/9Fcfz4Z3Dsz3KD2dw7LxBRxKrqUUGQPH/7zxr1KIfNpLEJ0MZB2ITM/0Z2EFoh12NlXnEcpYcbvON3nG7zjd5xu84vfcNIAAP7+y8ceyzbVxkakPYY4lcr72fqOnDwipv+yxC71wAADBrjKnAAAAAAAAAAAAAAw7oNGHttqWONcoFN/2WIDc2pa6WVFtFYROlsaMaTXdcOjXHz93+YxAglKa4AAAAA=",type:"map"},type:{default:"footprint",oneOf:["footprint","map"]},footprintDepth:{default:.1},mapSize:{type:"vec2",default:{x:.5,y:.5}}},sceneOnly:!0,init:function(){this.hitTest=null,this.imageDataArray=new Uint8ClampedArray(1048576),this.imageData=new ImageData(this.imageDataArray,512,512),this.textureCache=new Map,this.orthoCam=new _y.OrthographicCamera,this.orthoCam.layers.set(21),this.textureTarget=new _y.WebGLRenderTarget(512,512,{}),this.basicMaterial=new _y.MeshBasicMaterial({color:0,side:_y.DoubleSide}),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.context.imageSmoothingEnabled=!1,this.canvas.width=512,this.canvas.height=512,this.canvasTexture=new _y.CanvasTexture(this.canvas,{alpha:!0}),this.canvasTexture.flipY=!1;var t=this.el.getAttribute("webxr"),e=t.optionalFeatures;e.includes("hit-test")&&e.includes("anchors")||(e.push("hit-test"),e.push("anchors"),this.el.setAttribute("webxr",t)),this.el.sceneEl.renderer.xr.addEventListener("sessionend",function(){this.hitTest=null}.bind(this)),this.el.sceneEl.renderer.xr.addEventListener("sessionstart",function(){if(this.el.is("ar-mode")){var t=this.el.sceneEl.renderer,e=this.session=t.xr.getSession();this.hasPosedOnce=!1,this.bboxMesh.visible=!1,J_||(J_=new Map),e.requestReferenceSpace("viewer").then(function(e){this.viewerHitTest=this.hitTest=new iM(t,{space:e}),this.el.emit("ar-hit-test-start")}.bind(this));var n=this;this.el.sceneEl.addEventListener("controllersupdated",(function(){var e=this.xrSession&&this.xrSession.inputSources;if(e)for(var i=0;i<e.length;++i)if("tracked-pointer"===e[i].targetRayMode){n.hitTest=new iM(t,{space:e[i].targetRaySpace}),J_.set(e[i],n.hitTest),n.viewerHitTest&&"function"==typeof n.viewerHitTest.cancel&&(n.viewerHitTest.cancel(),n.viewerHitTest=null);break}}));var i="generic-touchscreen",r=new iM(t,{profile:i});e.addEventListener("selectstart",function(e){if(!0===this.data.enabled){var n=e.inputSource;this.bboxMesh.visible=!0,!0===this.hasPosedOnce&&(this.el.emit("ar-hit-test-select-start",{inputSource:n,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),n.profiles[0]===i?this.hitTest=r:(this.hitTest=J_.get(n)||new iM(t,{space:n.targetRaySpace}),J_.set(n,this.hitTest)))}}.bind(this)),e.addEventListener("selectend",function(t){if(this.hitTest&&!0===this.data.enabled){var e,n=t.inputSource;!0===this.hasPosedOnce&&(this.bboxMesh.visible=!1,this.data.target&&(e=this.data.target.object3D)&&(nM.tempFakePose.transform.position.copy(this.bboxMesh.position),nM.tempFakePose.transform.orientation.copy(this.bboxMesh.quaternion),nM(nM.tempFakePose,e,this.bboxOffset),e.visible=!0,this.hitTest.anchorFromLastHitTestResult(e,this.bboxOffset)),this.el.emit("ar-hit-test-select",{inputSource:n,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),this.hitTest=null)}else this.hitTest=null}.bind(this))}}.bind(this)),this.bboxOffset=new _y.Vector3,this.update=this.update.bind(this),this.makeBBox()},update:function(){!1===this.data.enabled&&(this.hitTest=null,this.bboxMesh.visible=!1),this.data.target&&(this.data.target.object3D?(this.data.target.addEventListener("model-loaded",this.update),this.data.target.object3D.layers.enable(21),this.data.target.object3D.traverse((function(t){t.layers.enable(21)}))):this.data.target.addEventListener("loaded",this.update,{once:!0})),this.bboxNeedsUpdate=!0},makeBBox:function(){var t=new _y.PlaneGeometry(1,1),e=new _y.MeshBasicMaterial({transparent:!0,color:16777215});t.rotateX(-Math.PI/2),t.rotateY(-Math.PI/2),this.bbox=new _y.Box3,this.bboxMesh=new _y.Mesh(t,e),this.el.setObject3D("ar-hit-test",this.bboxMesh),this.bboxMesh.visible=!1},updateFootprint:function(){var t,e,n,i=this.el.sceneEl.renderer,r=i.xr.enabled;this.bboxMesh.material.map=this.canvasTexture,this.bboxMesh.material.needsUpdate=!0,this.orthoCam.rotation.set(-Math.PI/2,0,-Math.PI/2),this.orthoCam.position.copy(this.bboxMesh.position),this.orthoCam.position.y-=this.bboxMesh.scale.y/2,this.orthoCam.near=.1,this.orthoCam.far=this.orthoCam.near+this.data.footprintDepth*this.bboxMesh.scale.y,this.orthoCam.position.y+=this.orthoCam.far,this.orthoCam.right=this.bboxMesh.scale.z/2,this.orthoCam.left=-this.bboxMesh.scale.z/2,this.orthoCam.top=this.bboxMesh.scale.x/2,this.orthoCam.bottom=-this.bboxMesh.scale.x/2,this.orthoCam.updateProjectionMatrix(),e=i.getRenderTarget(),i.setRenderTarget(this.textureTarget),i.xr.enabled=!1,n=this.el.object3D.background,this.el.object3D.overrideMaterial=this.basicMaterial,this.el.object3D.background=null,i.render(this.el.object3D,this.orthoCam),this.el.object3D.background=n,this.el.object3D.overrideMaterial=null,i.xr.enabled=r,i.setRenderTarget(e),i.readRenderTargetPixels(this.textureTarget,0,0,512,512,this.imageDataArray),this.context.putImageData(this.imageData,0,0),this.context.shadowColor="white",this.context.shadowBlur=10,this.context.drawImage(this.canvas,0,0),t=this.context.getImageData(0,0,512,512);for(var s=0;s<262144;s++)0!==t.data[4*s+3]&&255!==t.data[4*s+3]&&(t.data[4*s+3]=128);this.context.putImageData(t,0,0),this.canvasTexture.needsUpdate=!0},tick:function(){var t,e,n=this.el.sceneEl.frame,i=this.el.sceneEl.renderer;(n&&iM.updateAnchorPoses(n,i.xr.getReferenceSpace()),this.bboxNeedsUpdate)&&(this.bboxNeedsUpdate=!1,this.data.target&&"map"!==this.data.type||(this.textureCache.has(this.data.src)?e=this.textureCache.get(this.data.src):(e=(new _y.TextureLoader).load(this.data.src),this.textureCache.set(this.data.src,e)),this.bboxMesh.material.map=e,this.bboxMesh.material.needsUpdate=!0),this.data.target&&this.data.target.object3D?(this.bbox.setFromObject(this.data.target.object3D),this.bbox.getCenter(this.bboxMesh.position),this.bbox.getSize(this.bboxMesh.scale),"footprint"===this.data.type&&(this.bboxMesh.scale.x*=1.04,this.bboxMesh.scale.z*=1.04,this.updateFootprint()),this.bboxMesh.position.y-=this.bboxMesh.scale.y/2,this.bboxOffset.copy(this.bboxMesh.position),this.bboxOffset.sub(this.data.target.object3D.position)):this.bboxMesh.scale.set(this.data.mapSize.x,1,this.data.mapSize.y));this.hitTest&&(t=this.hitTest.doHit(n))&&(!0!==this.hasPosedOnce&&(this.hasPosedOnce=!0,this.el.emit("ar-hit-test-achieved")),this.bboxMesh.visible=!0,this.bboxMesh.position.copy(t.transform.position),this.bboxMesh.quaternion.copy(t.transform.orientation))}}),_b("background",{schema:{color:{type:"color",default:"black"},transparent:{default:!1}},sceneOnly:!0,update:function(){var t=this.data,e=this.el.object3D;t.transparent?e.background=null:e.background=new THREE.Color(t.color)},remove:function(){this.el.object3D.background=null}}),_b("debug",{schema:{default:!0},sceneOnly:!0});var sM="a-dialog-buttons-container",oM="a-dialog-button";function aM(t,e){var n,i,r,s;return(n=document.createElement("div")).classList.add("a-modal"),n.setAttribute(Sy,""),(i=document.createElement("div")).className="a-dialog",i.setAttribute(Sy,""),n.appendChild(i),(r=document.createElement("div")).classList.add("a-dialog-text-container"),i.appendChild(r),(s=document.createElement("div")).classList.add("a-dialog-text"),s.innerHTML=t,r.appendChild(s),i.appendChild(e),n}_b("device-orientation-permission-ui",{schema:{enabled:{default:!0},deviceMotionMessage:{default:"This immersive website requires access to your device motion sensors."},httpsMessage:{default:"Access this site over HTTPS to enter VR mode and grant access to the device sensors."},denyButtonText:{default:"Deny"},allowButtonText:{default:"Allow"},cancelButtonText:{default:"Cancel"}},sceneOnly:!0,init:function(){var t=this;this.data.enabled&&(window.isSecureContext||this.showHTTPAlert(),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission?(this.onDeviceMotionDialogAllowClicked=this.onDeviceMotionDialogAllowClicked.bind(this),this.onDeviceMotionDialogDenyClicked=this.onDeviceMotionDialogDenyClicked.bind(this),DeviceOrientationEvent.requestPermission().then((function(){t.el.emit("deviceorientationpermissiongranted"),t.permissionGranted=!0})).catch((function(){var e,n,i,r,s,o,a,l;t.devicePermissionDialogEl=(e=t.data.denyButtonText,n=t.data.allowButtonText,i=t.data.deviceMotionMessage,r=t.onDeviceMotionDialogAllowClicked,s=t.onDeviceMotionDialogDenyClicked,(o=document.createElement("div")).classList.add(sM),(a=document.createElement("button")).classList.add(oM,"a-dialog-deny-button"),a.setAttribute(Sy,""),a.innerHTML=e,o.appendChild(a),(l=document.createElement("button")).classList.add(oM,"a-dialog-allow-button"),l.setAttribute(Sy,""),l.innerHTML=n,o.appendChild(l),l.addEventListener("click",(function(t){t.stopPropagation(),r()})),a.addEventListener("click",(function(t){t.stopPropagation(),s()})),aM(i,o)),t.el.appendChild(t.devicePermissionDialogEl)}))):this.permissionGranted=!0)},remove:function(){this.devicePermissionDialogEl&&this.el.removeChild(this.devicePermissionDialogEl)},onDeviceMotionDialogDenyClicked:function(){this.remove()},showHTTPAlert:function(){var t,e,n,i,r,s=this,o=(t=s.data.cancelButtonText,e=s.data.httpsMessage,n=function(){s.el.removeChild(o)},(i=document.createElement("div")).classList.add(sM),(r=document.createElement("button")).classList.add(oM,"a-dialog-ok-button"),r.setAttribute(Sy,""),r.innerHTML=t,i.appendChild(r),r.addEventListener("click",(function(t){t.stopPropagation(),n()})),aM(e,i));this.el.appendChild(o)},onDeviceMotionDialogAllowClicked:function(){var t=this;this.el.emit("deviceorientationpermissionrequested"),DeviceOrientationEvent.requestPermission().then((function(e){"granted"===e?(t.el.emit("deviceorientationpermissiongranted"),t.permissionGranted=!0):t.el.emit("deviceorientationpermissionrejected"),t.remove()})).catch(console.error)}}),_b("embedded",{dependencies:["xr-mode-ui"],schema:{default:!0},sceneOnly:!0,update:function(){var t=this.el,e=t.querySelector(".a-enter-vr");!0===this.data?(e&&e.classList.add("embedded"),t.removeFullScreenStyles()):(e&&e.classList.remove("embedded"),t.addFullScreenStyles())}});var lM="https://unpkg.com/aframe-inspector@"+function(t){var e=t.split(".");return e[2]="x",e.join(".")}(_C)+"/dist/aframe-inspector.min.js";_b("inspector",{schema:{url:{default:lM}},sceneOnly:!0,init:function(){this.firstPlay=!0,this.onKeydown=this.onKeydown.bind(this),this.onMessage=this.onMessage.bind(this),this.initOverlay(),window.addEventListener("keydown",this.onKeydown),window.addEventListener("message",this.onMessage)},play:function(){var t;this.firstPlay&&"false"!==(t=bx("inspector"))&&t&&(this.openInspector(),this.firstPlay=!1)},initOverlay:function(){this.loadingMessageEl=document.createElement("div"),this.loadingMessageEl.classList.add("a-inspector-loader"),this.loadingMessageEl.innerHTML='Loading Inspector<span class="dots"><span>.</span><span>.</span><span>.</span></span>'},remove:function(){this.removeEventListeners()},onKeydown:function(t){73===t.keyCode&&(t.ctrlKey&&t.altKey||t.getModifierState("AltGraph"))&&this.openInspector()},showLoader:function(){document.body.appendChild(this.loadingMessageEl)},hideLoader:function(){document.body.removeChild(this.loadingMessageEl)},onMessage:function(t){"INJECT_AFRAME_INSPECTOR"===t.data&&this.openInspector()},openInspector:function(t){var e,n=this;AFRAME.INSPECTOR||AFRAME.inspectorInjected?AFRAME.INSPECTOR.open(t):(this.showLoader(),(e=document.createElement("script")).src=this.data.url,e.setAttribute("data-name","aframe-inspector"),e.setAttribute(Sy,""),e.onload=function(){AFRAME.INSPECTOR.open(t),n.hideLoader(),n.removeEventListeners()},e.onerror=function(){n.loadingMessageEl.innerHTML="Error loading Inspector"},document.head.appendChild(e),AFRAME.inspectorInjected=!0)},removeEventListeners:function(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("message",this.onMessage)}}),_b("fog",{schema:{color:{type:"color",default:"#000"},density:{default:25e-5},far:{default:1e3,min:0},near:{default:1,min:0},type:{default:"linear",oneOf:["linear","exponential"]}},sceneOnly:!0,update:function(){var t=this.data,e=this.el,n=this.el.object3D.fog;n&&t.type===n.name?Object.keys(this.schema).forEach((function(e){var i=t[e];"color"===e&&(i=new _y.Color(i)),n[e]=i})):e.object3D.fog=function(t){var e;return(e="exponential"===t.type?new _y.FogExp2(t.color,t.density):new _y.Fog(t.color,t.near,t.far)).name=t.type,e}(t)},remove:function(){var t=this.el;this.el.object3D.fog&&(t.object3D.fog=null)}}),_b("keyboard-shortcuts",{schema:{enterVR:{default:!0},exitVR:{default:!0}},sceneOnly:!0,init:function(){this.onKeyup=this.onKeyup.bind(this)},play:function(){window.addEventListener("keyup",this.onKeyup,!1)},pause:function(){window.removeEventListener("keyup",this.onKeyup)},onKeyup:function(t){var e=this.el;yx(t)&&(this.data.enterVR&&70===t.keyCode&&e.enterVR(),this.data.exitVR&&27===t.keyCode&&e.exitVR())}});var cM=Ly("components:pool:warn");_b("pool",{schema:{container:{default:""},mixin:{default:""},size:{default:0},dynamic:{default:!1}},sceneOnly:!0,multiple:!0,initPool:function(){var t;for(this.availableEls=[],this.usedEls=[],this.data.mixin||cM("No mixin provided for pool component."),this.data.container&&(this.container=document.querySelector(this.data.container),this.container||cM("Container "+this.data.container+" not found.")),this.container=this.container||this.el,t=0;t<this.data.size;++t)this.createEntity()},update:function(t){var e=this.data;t.mixin===e.mixin&&t.size===e.size||this.initPool()},createEntity:function(){var t;(t=document.createElement("a-entity")).play=this.wrapPlay(t.play),t.setAttribute("mixin",this.data.mixin),t.object3D.visible=!1,t.pause(),this.container.appendChild(t),this.availableEls.push(t);var e=this.usedEls;t.addEventListener("loaded",(function(){-1===e.indexOf(t)&&(t.object3DParent=t.object3D.parent,t.object3D.parent.remove(t.object3D))}))},wrapPlay:function(t){var e=this.usedEls;return function(){-1!==e.indexOf(this)&&t.call(this)}},requestEntity:function(){var t;if(0===this.availableEls.length){if(!1===this.data.dynamic)return void cM("Requested entity from empty pool: "+this.attrName);cM("Requested entity from empty pool. This pool is dynamic and will resize automatically. You might want to increase its initial size: "+this.attrName),this.createEntity()}return t=this.availableEls.shift(),this.usedEls.push(t),t.object3DParent&&(t.object3DParent.add(t.object3D),this.updateRaycasters()),t.object3D.visible=!0,t},returnEntity:function(t){var e=this.usedEls.indexOf(t);if(-1!==e)return this.usedEls.splice(e,1),this.availableEls.push(t),t.object3DParent=t.object3D.parent,t.object3D.parent.remove(t.object3D),this.updateRaycasters(),t.object3D.visible=!1,t.pause(),t;cM("The returned entity was not previously pooled from "+this.attrName)},updateRaycasters:function(){document.querySelectorAll("[raycaster]").forEach((function(t){t.components.raycaster.setDirty()}))}}),_b("real-world-meshing",{schema:{filterLabels:{type:"array"},meshesEnabled:{default:!0},meshMixin:{default:!0},planesEnabled:{default:!0},planeMixin:{default:""}},sceneOnly:!0,init:function(){var t=this.el.getAttribute("webxr"),e=t.requiredFeatures;-1===e.indexOf("mesh-detection")&&(e.push("mesh-detection"),this.el.setAttribute("webxr",t)),-1===e.indexOf("plane-detection")&&(e.push("plane-detection"),this.el.setAttribute("webxr",t)),this.meshEntities=[],this.initWorldMeshEntity=this.initWorldMeshEntity.bind(this)},tick:function(){this.el.is("ar-mode")&&(this.detectMeshes(),this.updateMeshes())},detectMeshes:function(){var t,e,n,i=this.data,r=this.el,s=this.meshEntities,o=!1,a=[],l=this.data.filterLabels;t=(n=r.frame).detectedMeshes,e=n.detectedPlanes;for(var c=0;c<s.length;c++)s[c].present=!1;if(i.meshesEnabled)for(var h of t.values())if(!l.length||-1!==l.indexOf(h.semanticLabel)){for(c=0;c<s.length;c++)if(h===s[c].mesh){o=!0,s[c].present=!0,s[c].lastChangedTime<h.lastChangedTime&&this.updateMeshGeometry(s[c].el,h),s[c].lastChangedTime=h.lastChangedTime;break}o||a.push(h),o=!1}if(i.planesEnabled)for(h of e.values())if(!l.length||-1!==l.indexOf(h.semanticLabel)){for(c=0;c<s.length;c++)if(h===s[c].mesh){o=!0,s[c].present=!0,s[c].lastChangedTime<h.lastChangedTime&&this.updateMeshGeometry(s[c].el,h),s[c].lastChangedTime=h.lastChangedTime;break}o||a.push(h),o=!1}this.deleteMeshes(),this.createNewMeshes(a)},updateMeshes:function(){var t=new _y.Matrix4;return function(){for(var e,n,i,r=this.el,s=r.frame,o=this.meshEntities,a=r.renderer.xr.getReferenceSpace(),l=0;l<o.length;l++)i=o[l].mesh.meshSpace||o[l].mesh.planeSpace,e=s.getPose(i,a),(n=o[l].el).hasLoaded&&(t.fromArray(e.transform.matrix),t.decompose(n.object3D.position,n.object3D.quaternion,n.object3D.scale))}}(),deleteMeshes:function(){for(var t=this.meshEntities,e=[],n=0;n<t.length;n++)t[n].present?e.push(t[n]):this.el.removeChild(t[n]);this.meshEntities=e},createNewMeshes:function(t){for(var e,n=0;n<t.length;n++)e=document.createElement("a-entity"),this.meshEntities.push({mesh:t[n],el:e}),e.addEventListener("loaded",this.initWorldMeshEntity),this.el.appendChild(e)},initMeshGeometry:function(t){var e,n,i;if(t instanceof XRPlane){n=new _y.Shape,i=t.polygon;for(var r=0;r<i.length;++r)0===r?n.moveTo(i[r].x,i[r].z):n.lineTo(i[r].x,i[r].z);return(e=new _y.ShapeGeometry(n)).rotateX(Math.PI/2),e}return(e=new _y.BufferGeometry).setAttribute("position",new _y.BufferAttribute(t.vertices,3)),e.setIndex(new _y.BufferAttribute(t.indices,1)),e},initWorldMeshEntity:function(t){for(var e,n,i,r=t.target,s=this.meshEntities,o=0;o<s.length;o++)if(s[o].el===r){i=s[o];break}e=this.initMeshGeometry(i.mesh),n=new _y.Mesh(e,new _y.MeshBasicMaterial({color:16777215*Math.random(),side:_y.DoubleSide})),r.setObject3D("mesh",n),i.mesh instanceof XRPlane&&this.data.planeMixin?r.setAttribute("mixin",this.data.planeMixin):this.data.meshMixin&&r.setAttribute("mixin",this.data.meshMixin),r.setAttribute("data-world-mesh",i.mesh.semanticLabel)},updateMeshGeometry:function(t,e){var n=t.getObject3D("mesh");n.geometry.dispose(),n.geometry=this.initMeshGeometry(e)}}),_b("reflection",{schema:{directionalLight:{type:"selector"}},sceneOnly:!0,init:function(){var t=this;this.cubeRenderTarget=new THREE.WebGLCubeRenderTarget(16),this.cubeCamera=new THREE.CubeCamera(.1,1e3,this.cubeRenderTarget),this.lightingEstimationTexture=new THREE.WebGLCubeRenderTarget(16).texture,this.needsVREnvironmentUpdate=!0;var e=this.el.getAttribute("webxr"),n=e.optionalFeatures;n.includes("light-estimation")||(n.push("light-estimation"),this.el.setAttribute("webxr",e)),this.el.addEventListener("enter-vr",(function(){t.el.is("ar-mode")&&t.el.renderer.xr.getSession().requestLightProbe&&t.startLightProbe()})),this.el.addEventListener("exit-vr",(function(){t.xrLightProbe&&t.stopLightProbe()})),this.el.object3D.environment=this.cubeRenderTarget.texture},stopLightProbe:function(){this.xrLightProbe=null,this.probeLight&&(this.probeLight.components.light.light.intensity=0),this.needsVREnvironmentUpdate=!0,this.el.object3D.environment=this.cubeRenderTarget.texture},startLightProbe:function(){this.needsLightProbeUpdate=!0},setupLightProbe:function(){var t=this.el.renderer,e=t.xr.getSession(),n=this,i=t.getContext();if(!this.probeLight){var r=document.createElement("a-light");r.setAttribute("type","probe"),r.setAttribute("intensity",0),this.el.appendChild(r),this.probeLight=r}switch(e.preferredReflectionFormat){case"srgba8":i.getExtension("EXT_sRGB");break;case"rgba16f":i.getExtension("OES_texture_half_float")}this.glBinding=new XRWebGLBinding(e,i),i.getExtension("EXT_sRGB"),i.getExtension("OES_texture_half_float"),e.requestLightProbe().then((function(t){n.xrLightProbe=t,t.addEventListener("reflectionchange",n.updateXRCubeMap.bind(n))})).catch((function(t){console.warn("Lighting estimation not supported: "+t.message),console.warn('Are you missing: webxr="optionalFeatures: light-estimation;" from <a-scene>?')}))},updateXRCubeMap:function(){var t=this.el.renderer,e=this.glBinding.getReflectionCubeMap(this.xrLightProbe);e&&(t.properties.get(this.lightingEstimationTexture).__webglTexture=e,this.lightingEstimationTexture.needsPMREMUpdate=!0,this.el.object3D.environment=this.lightingEstimationTexture)},tick:function(){var t=this.el.object3D,e=this.el.renderer,n=this.el.frame;if(n&&this.xrLightProbe){var i=n.getLightEstimate(this.xrLightProbe);i&&function(t,e,n,i){var r=Math.max(t.primaryLightIntensity.x,Math.max(t.primaryLightIntensity.y,t.primaryLightIntensity.z));e.sh.fromArray(t.sphericalHarmonicsCoefficients),e.intensity=3.14,n&&(n.color.setRGB(t.primaryLightIntensity.x/r,t.primaryLightIntensity.y/r,t.primaryLightIntensity.z/r),n.intensity=r,i.copy(t.primaryLightDirection))}(i,this.probeLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.object3D.position)}this.needsVREnvironmentUpdate&&(t.environment=null,this.needsVREnvironmentUpdate=!1,this.cubeCamera.position.set(0,1.6,0),this.cubeCamera.update(e,t),t.environment=this.cubeRenderTarget.texture),this.needsLightProbeUpdate&&n&&(this.setupLightProbe(),this.needsLightProbeUpdate=!1)},remove:function(){this.el.object3D.environment=null,this.probeLight&&this.el.removeChild(this.probeLight)}});var hM=["attribute vec3 position;","attribute vec2 uv;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","varying vec2 vUv;","void main() {"," vUv = vec2( 1.- uv.x, uv.y );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),uM=["precision mediump float;","uniform samplerCube map;","varying vec2 vUv;","#define M_PI 3.141592653589793238462643383279","void main() {"," vec2 uv = vUv;"," float longitude = uv.x * 2. * M_PI - M_PI + M_PI / 2.;"," float latitude = uv.y * M_PI;"," vec3 dir = vec3("," - sin( longitude ) * sin( latitude ),"," cos( latitude ),"," - cos( longitude ) * sin( latitude )"," );"," normalize( dir );"," gl_FragColor = vec4( textureCube( map, dir ).rgb, 1.0 );","}"].join("\n"),dM=(_b("screenshot",{schema:{width:{default:4096},height:{default:2048},camera:{type:"selector"}},sceneOnly:!0,setup:function(){var t=this.el;if(!this.canvas){var e=t.renderer.getContext();e&&(this.cubeMapSize=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),this.material=new _y.RawShaderMaterial({uniforms:{map:{type:"t",value:null}},vertexShader:hM,fragmentShader:uM,side:_y.DoubleSide}),this.quad=new _y.Mesh(new _y.PlaneGeometry(1,1),this.material),this.quad.visible=!1,this.camera=new _y.OrthographicCamera(-.5,.5,.5,-.5,-1e4,1e4),this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),t.object3D.add(this.quad),this.onKeyDown=this.onKeyDown.bind(this))}},getRenderTarget:function(t,e){return new _y.WebGLRenderTarget(t,e,{colorSpace:this.el.sceneEl.renderer.outputColorSpace,minFilter:_y.LinearFilter,magFilter:_y.LinearFilter,wrapS:_y.ClampToEdgeWrapping,wrapT:_y.ClampToEdgeWrapping,format:_y.RGBAFormat,type:_y.UnsignedByteType})},resize:function(t,e){this.quad.scale.set(t,e,1),this.camera.left=-1*t/2,this.camera.right=t/2,this.camera.top=e/2,this.camera.bottom=-1*e/2,this.camera.updateProjectionMatrix(),this.canvas.width=t,this.canvas.height=e},play:function(){window.addEventListener("keydown",this.onKeyDown)},onKeyDown:function(t){var e=83===t.keyCode&&t.ctrlKey&&t.altKey;if(this.data&&e){var n=t.shiftKey?"equirectangular":"perspective";this.capture(n)}},setCapture:function(t){var e,n,i,r,s=this.el;return"perspective"===t?(this.quad.visible=!1,n=this.data.camera&&this.data.camera.components.camera.camera||s.camera,e={width:this.data.width,height:this.data.height}):(n=this.camera,r=new _y.WebGLCubeRenderTarget(Math.min(this.cubeMapSize,2048),{format:_y.RGBFormat,generateMipmaps:!0,minFilter:_y.LinearMipmapLinearFilter,colorSpace:_y.SRGBColorSpace}),i=new _y.CubeCamera(s.camera.near,s.camera.far,r),s.camera.getWorldPosition(i.position),s.camera.getWorldQuaternion(i.quaternion),i.update(s.renderer,s.object3D),this.quad.material.uniforms.map.value=i.renderTarget.texture,e={width:this.data.width,height:this.data.height},this.quad.visible=!0),{camera:n,size:e,projection:t}},capture:function(t){var e,n=this.el.renderer.xr.enabled,i=this.el.renderer;this.setup(),i.xr.enabled=!1,e=this.setCapture(t),this.renderCapture(e.camera,e.size,e.projection),this.saveCapture(),i.xr.enabled=n},getCanvas:function(t){var e=this.el.renderer.xr.enabled,n=this.el.renderer;this.setup();var i=this.setCapture(t);return n.xr.enabled=!1,this.renderCapture(i.camera,i.size,i.projection),n.xr.enabled=e,this.canvas},renderCapture:function(t,e,n){var i,r,s,o=this.el.renderer.autoClear,a=this.el,l=a.renderer;r=this.getRenderTarget(e.width,e.height),s=new Uint8Array(4*e.width*e.height),this.resize(e.width,e.height),l.autoClear=!0,l.clear(),l.setRenderTarget(r),l.render(a.object3D,t),l.autoClear=o,l.readRenderTargetPixels(r,0,0,e.width,e.height,s),l.setRenderTarget(null),"perspective"===n&&(s=this.flipPixelsVertically(s,e.width,e.height)),i=new ImageData(new Uint8ClampedArray(s),e.width,e.height),this.quad.visible=!1,this.ctx.putImageData(i,0,0)},flipPixelsVertically:function(t,e,n){for(var i=t.slice(0),r=0;r<e;++r)for(var s=0;s<n;++s)i[4*r+s*e*4]=t[4*r+(n-s)*e*4],i[4*r+1+s*e*4]=t[4*r+1+(n-s)*e*4],i[4*r+2+s*e*4]=t[4*r+2+(n-s)*e*4],i[4*r+3+s*e*4]=t[4*r+3+(n-s)*e*4];return i},saveCapture:function(){this.canvas.toBlob((function(t){var e="screenshot-"+document.title.toLowerCase()+"-"+Date.now()+".png",n=document.createElement("a"),i=URL.createObjectURL(t);n.href=i,n.setAttribute("download",e),n.innerHTML="downloading...",n.style.display="none",document.body.appendChild(n),setTimeout((function(){n.click(),document.body.removeChild(n)}),1)}),"image/png")}}),n(282)),pM=n.n(dM),AM=(n(3729),n(8132),window.aframeStats),fM="a-hidden",mM=window.threeStats;_b("stats",{schema:{default:!0},sceneOnly:!0,init:function(){var t=this.el;"false"!==bx("stats")&&(this.stats=function(t){var e=new mM(t.renderer),n=new AM(t),i=t.isMobile?[]:[e,n];return new(pM())({css:[],values:{fps:{caption:"fps",below:30}},groups:[{caption:"Framerate",values:["fps","raf"]}],plugins:i})}(t),this.statsEl=document.querySelector(".rs-base"),this.hideBound=this.hide.bind(this),this.showBound=this.show.bind(this),t.addEventListener("enter-vr",this.hideBound),t.addEventListener("exit-vr",this.showBound))},update:function(){if(this.stats)return this.data?this.show():this.hide()},remove:function(){this.el.removeEventListener("enter-vr",this.hideBound),this.el.removeEventListener("exit-vr",this.showBound),this.statsEl&&this.statsEl.parentNode.removeChild(this.statsEl)},tick:function(){var t=this.stats;t&&(t("rAF").tick(),t("FPS").frame(),t().update())},hide:function(){this.statsEl.classList.add(fM)},show:function(){this.statsEl.classList.remove(fM)}});var gM="a-hidden";function vM(t){t.addEventListener("touchstart",(function(){t.classList.remove("resethover")}),{passive:!0}),t.addEventListener("touchend",(function(){t.classList.add("resethover")}),{passive:!0})}_b("xr-mode-ui",{dependencies:["canvas"],schema:{enabled:{default:!0},enterVRButton:{default:""},enterVREnabled:{default:!0},enterARButton:{default:""},enterAREnabled:{default:!0},XRMode:{default:"vr",oneOf:["vr","ar","xr"]}},sceneOnly:!0,init:function(){var t=this,e=this.el;"false"!==bx("ui")&&(this.insideLoader=!1,this.enterVREl=null,this.enterAREl=null,this.orientationModalEl=null,this.bindMethods(),e.addEventListener("enter-vr",this.updateEnterInterfaces),e.addEventListener("exit-vr",this.updateEnterInterfaces),e.addEventListener("update-vr-devices",this.updateEnterInterfaces),window.addEventListener("message",(function(e){"loaderReady"===e.data.type&&(t.insideLoader=!0,t.remove())})),window.addEventListener("orientationchange",this.toggleOrientationModalIfNeeded))},bindMethods:function(){this.onEnterVRButtonClick=this.onEnterVRButtonClick.bind(this),this.onEnterARButtonClick=this.onEnterARButtonClick.bind(this),this.onModalClick=this.onModalClick.bind(this),this.toggleOrientationModalIfNeeded=this.toggleOrientationModalIfNeeded.bind(this),this.updateEnterInterfaces=this.updateEnterInterfaces.bind(this)},onModalClick:function(){this.el.exitVR()},onEnterVRButtonClick:function(){this.el.enterVR()},onEnterARButtonClick:function(){this.el.enterAR()},update:function(){var t,e,n,i=this.data,r=this.el;if(!i.enabled||this.insideLoader||"false"===bx("ui"))return this.remove();this.enterVREl||this.enterAREl||this.orientationModalEl||(this.enterVREl||!i.enterVREnabled||"xr"!==i.XRMode&&"vr"!==i.XRMode||(i.enterVRButton?(this.enterVREl=document.querySelector(i.enterVRButton),this.enterVREl.addEventListener("click",this.onEnterVRButtonClick)):(this.enterVREl=(t=this.onEnterVRButtonClick,(n=document.createElement("div")).classList.add("a-enter-vr"),n.setAttribute(Sy,""),(e=document.createElement("button")).className="a-enter-vr-button",e.setAttribute("title","Enter VR mode with a headset or fullscreen without"),e.setAttribute(Sy,""),Wy()&&vM(e),n.appendChild(e),e.addEventListener("click",(function(e){t(),e.stopPropagation()})),n),r.appendChild(this.enterVREl))),this.enterAREl||!i.enterAREnabled||"xr"!==i.XRMode&&"ar"!==i.XRMode||(i.enterARButton?(this.enterAREl=document.querySelector(i.enterARButton),this.enterAREl.addEventListener("click",this.onEnterARButtonClick)):(this.enterAREl=function(t,e){var n,i;return(i=document.createElement("div")).classList.add("a-enter-ar"),e&&i.classList.add("xr"),i.setAttribute(Sy,""),(n=document.createElement("button")).className="a-enter-ar-button",n.setAttribute("title","Enter AR mode with a headset or handheld device."),n.setAttribute(Sy,""),Wy()&&vM(n),i.appendChild(n),n.addEventListener("click",(function(e){t(),e.stopPropagation()})),i}(this.onEnterARButtonClick,"xr"===i.XRMode),r.appendChild(this.enterAREl))),this.orientationModalEl=function(t){var e=document.createElement("div");e.className="a-orientation-modal",e.classList.add(gM),e.setAttribute(Sy,"");var n=document.createElement("button");return n.setAttribute(Sy,""),n.innerHTML="Exit VR",n.addEventListener("click",t),e.appendChild(n),e}(this.onModalClick),r.appendChild(this.orientationModalEl),this.updateEnterInterfaces())},remove:function(){[this.enterVREl,this.enterAREl,this.orientationModalEl].forEach((function(t){t&&t.parentNode&&t.parentNode.removeChild(t)})),this.enterVREl=void 0,this.enterAREl=void 0,this.orientationModalEl=void 0},updateEnterInterfaces:function(){this.toggleEnterVRButtonIfNeeded(),this.toggleEnterARButtonIfNeeded(),this.toggleOrientationModalIfNeeded()},toggleEnterVRButtonIfNeeded:function(){var t=this.el;this.enterVREl&&(t.is("vr-mode")||(t.isMobile||Ky())&&!Hy()?this.enterVREl.classList.add(gM):(Hy()||this.enterVREl.classList.add("fullscreen"),this.enterVREl.classList.remove(gM),t.enterVR(!1,!0)))},toggleEnterARButtonIfNeeded:function(){var t=this.el;this.enterAREl&&(t.is("vr-mode")||!zy()?this.enterAREl.classList.add(gM):(this.enterAREl.classList.remove(gM),t.enterVR(!0,!0)))},toggleOrientationModalIfNeeded:function(){var t=this.el,e=this.orientationModalEl;e&&t.isMobile&&(!nE()&&t.is("vr-mode")?e.classList.remove(gM):e.classList.add(gM))}}),sC("box",{schema:{depth:{default:1,min:0},height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"},segmentsDepth:{default:1,min:1,max:20,type:"int"}},init:function(t){this.geometry=new _y.BoxGeometry(t.width,t.height,t.depth,t.segmentsWidth,t.segmentsHeight,t.segmentsDepth)}});var yM=_y.MathUtils.degToRad;sC("circle",{schema:{radius:{default:1,min:0},segments:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(t){this.geometry=new _y.CircleGeometry(t.radius,t.segments,yM(t.thetaStart),yM(t.thetaLength))}});var EM=_y.MathUtils.degToRad;sC("cone",{schema:{height:{default:1,min:0},openEnded:{default:!1},radiusBottom:{default:1,min:0},radiusTop:{default:.01,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(t){this.geometry=new _y.CylinderGeometry(t.radiusTop,t.radiusBottom,t.height,t.segmentsRadial,t.segmentsHeight,t.openEnded,EM(t.thetaStart),EM(t.thetaLength))}});var xM=_y.MathUtils.degToRad;sC("cylinder",{schema:{height:{default:1,min:0},openEnded:{default:!1},radius:{default:1,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(t){this.geometry=new _y.CylinderGeometry(t.radius,t.radius,t.height,t.segmentsRadial,t.segmentsHeight,t.openEnded,xM(t.thetaStart),xM(t.thetaLength))}}),sC("dodecahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(t){this.geometry=new _y.DodecahedronGeometry(t.radius,t.detail)}}),sC("icosahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(t){this.geometry=new _y.IcosahedronGeometry(t.radius,t.detail)}}),sC("octahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(t){this.geometry=new _y.OctahedronGeometry(t.radius,t.detail)}}),sC("plane",{schema:{height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"}},init:function(t){this.geometry=new _y.PlaneGeometry(t.width,t.height,t.segmentsWidth,t.segmentsHeight)}});var bM=_y.MathUtils.degToRad;sC("ring",{schema:{radiusInner:{default:.8,min:0},radiusOuter:{default:1.2,min:0},segmentsPhi:{default:10,min:1,type:"int"},segmentsTheta:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(t){this.geometry=new _y.RingGeometry(t.radiusInner,t.radiusOuter,t.segmentsTheta,t.segmentsPhi,bM(t.thetaStart),bM(t.thetaLength))}});var CM=_y.MathUtils.degToRad;sC("sphere",{schema:{radius:{default:1,min:0},phiLength:{default:360},phiStart:{default:0,min:0},thetaLength:{default:180,min:0},thetaStart:{default:0},segmentsHeight:{default:18,min:2,type:"int"},segmentsWidth:{default:36,min:3,type:"int"}},init:function(t){this.geometry=new _y.SphereGeometry(t.radius,t.segmentsWidth,t.segmentsHeight,CM(t.phiStart),CM(t.phiLength),CM(t.thetaStart),CM(t.thetaLength))}}),sC("tetrahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(t){this.geometry=new _y.TetrahedronGeometry(t.radius,t.detail)}});var wM=_y.MathUtils.degToRad;sC("torus",{schema:{arc:{default:360},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:36,min:2,type:"int"},segmentsTubular:{default:32,min:3,type:"int"}},init:function(t){this.geometry=new _y.TorusGeometry(t.radius,2*t.radiusTubular,t.segmentsRadial,t.segmentsTubular,wM(t.arc))}}),sC("torusKnot",{schema:{p:{default:2,min:1},q:{default:3,min:1},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:8,min:3,type:"int"},segmentsTubular:{default:100,min:3,type:"int"}},init:function(t){this.geometry=new _y.TorusKnotGeometry(t.radius,2*t.radiusTubular,t.segmentsTubular,t.segmentsRadial,t.p,t.q)}});var _M=new _y.Quaternion,MM=new _y.Vector3(0,0,1),SM=new _y.Vector2,IM=new _y.Vector2,BM=new _y.Vector2;function TM(t,e){return e.color.set(t.color),e.fog=t.fog,e.wireframe=t.wireframe,e.toneMapped=t.toneMapped,e.wireframeLinewidth=t.wireframeLinewidth,e}function RM(t,e){return e.color.set(t.color),e.emissive.set(t.emissive),e.emissiveIntensity=t.emissiveIntensity,e.fog=t.fog,e.metalness=t.metalness,e.roughness=t.roughness,e.wireframe=t.wireframe,e.wireframeLinewidth=t.wireframeLinewidth,t.normalMap&&(e.normalScale=t.normalScale),t.ambientOcclusionMap&&(e.aoMapIntensity=t.ambientOcclusionMapIntensity),t.displacementMap&&(e.displacementScale=t.displacementScale,e.displacementBias=t.displacementBias),e}function LM(t,e){switch(e.color.set(t.color),e.specular.set(t.specular),e.emissive.set(t.emissive),e.emissiveIntensity=t.emissiveIntensity,e.fog=t.fog,e.transparent=t.transparent,e.wireframe=t.wireframe,e.wireframeLinewidth=t.wireframeLinewidth,e.shininess=t.shininess,e.flatShading=t.flatShading,e.wireframe=t.wireframe,e.wireframeLinewidth=t.wireframeLinewidth,e.reflectivity=t.reflectivity,e.refractionRatio=t.refractionRatio,t.combine){case"mix":e.combine=_y.MixOperation;break;case"multiply":e.combine=_y.MultiplyOperation;break;case"add":e.combine=_y.AddOperation}return t.normalMap&&(e.normalScale=t.normalScale),t.ambientOcclusionMap&&(e.aoMapIntensity=t.ambientOcclusionMapIntensity),t.bumpMap&&(e.bumpScale=t.bumpMapScale),t.displacementMap&&(e.displacementScale=t.displacementScale,e.displacementBias=t.displacementBias),e}sC("triangle",{schema:{vertexA:{type:"vec3",default:{x:0,y:.5,z:0}},vertexB:{type:"vec3",default:{x:-.5,y:-.5,z:0}},vertexC:{type:"vec3",default:{x:.5,y:-.5,z:0}}},init:function(t){var e,n,i,r,s,o,a,l,c;(i=new _y.Triangle).a.set(t.vertexA.x,t.vertexA.y,t.vertexA.z),i.b.set(t.vertexB.x,t.vertexB.y,t.vertexB.z),i.c.set(t.vertexC.x,t.vertexC.y,t.vertexC.z),n=i.getNormal(new _y.Vector3),_M.setFromUnitVectors(n,MM),r=i.a.clone().applyQuaternion(_M),s=i.b.clone().applyQuaternion(_M),o=i.c.clone().applyQuaternion(_M),SM.set(Math.min(r.x,s.x,o.x),Math.min(r.y,s.y,o.y)),IM.set(Math.max(r.x,s.x,o.x),Math.max(r.y,s.y,o.y)),BM.set(0,0).subVectors(IM,SM),r=(new _y.Vector2).subVectors(r,SM).divide(BM),s=(new _y.Vector2).subVectors(s,SM).divide(BM),o=(new _y.Vector2).subVectors(o,SM).divide(BM),e=this.geometry=new _y.BufferGeometry,a=[i.a.x,i.a.y,i.a.z,i.b.x,i.b.y,i.b.z,i.c.x,i.c.y,i.c.z],l=[n.x,n.y,n.z,n.x,n.y,n.z,n.x,n.y,n.z],c=[r.x,r.y,s.x,s.y,o.x,o.y],e.setAttribute("position",new _y.Float32BufferAttribute(a,3)),e.setAttribute("normal",new _y.Float32BufferAttribute(l,3)),e.setAttribute("uv",new _y.Float32BufferAttribute(c,2))}}),vC("flat",{schema:{color:{type:"color"},fog:{default:!0},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},src:{type:"map"},wireframe:{default:!1},wireframeLinewidth:{default:2},toneMapped:{default:!0}},init:function(t){this.materialData={color:new _y.Color},TM(t,this.materialData),this.material=new _y.MeshBasicMaterial(this.materialData)},update:function(t){this.updateMaterial(t),OE(this,t)},updateMaterial:function(t){var e;for(e in TM(t,this.materialData),this.materialData)this.material[e]=this.materialData[e]}}),vC("standard",{schema:{ambientOcclusionMap:{type:"map"},ambientOcclusionMapIntensity:{default:1},ambientOcclusionTextureOffset:{type:"vec2"},ambientOcclusionTextureRepeat:{type:"vec2",default:{x:1,y:1}},color:{type:"color"},displacementMap:{type:"map"},displacementScale:{default:1},displacementBias:{default:.5},displacementTextureOffset:{type:"vec2"},displacementTextureRepeat:{type:"vec2",default:{x:1,y:1}},emissive:{type:"color",default:"#000"},emissiveIntensity:{default:1},envMap:{default:""},fog:{default:!0},metalness:{default:0,min:0,max:1},metalnessMap:{type:"map"},metalnessTextureOffset:{type:"vec2"},metalnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},normalMap:{type:"map"},normalScale:{type:"vec2",default:{x:1,y:1}},normalTextureOffset:{type:"vec2"},normalTextureRepeat:{type:"vec2",default:{x:1,y:1}},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},roughness:{default:.5,min:0,max:1},roughnessMap:{type:"map"},roughnessTextureOffset:{type:"vec2"},roughnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},sphericalEnvMap:{type:"map"},src:{type:"map"},wireframe:{default:!1},wireframeLinewidth:{default:2}},init:function(t){this.materialData={color:new _y.Color,emissive:new _y.Color},RM(t,this.materialData),this.material=new _y.MeshStandardMaterial(this.materialData)},update:function(t){this.updateMaterial(t),OE(this,t),FE("normal",this,t),FE("displacement",this,t),FE("ambientOcclusion",this,t),FE("metalness",this,t),FE("roughness",this,t),NE(this,t)},updateMaterial:function(t){var e,n=this.material;for(e in RM(t,this.materialData),this.materialData)n[e]=this.materialData[e]}}),vC("phong",{schema:{color:{type:"color"},emissive:{type:"color",default:"black"},emissiveIntensity:{default:1},specular:{type:"color",default:"#111111"},transparent:{default:!1},fog:{default:!0},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},src:{type:"map"},envMap:{default:""},sphericalEnvMap:{type:"map"},shininess:{default:30},flatShading:{default:!1},wireframe:{default:!1},wireframeLinewidth:{default:2},combine:{oneOF:["multiply","mix","add"],default:"mix"},reflectivity:{default:.9},refractionRatio:{default:.98},refract:{default:!1},normalMap:{type:"map"},normalScale:{type:"vec2",default:{x:1,y:1}},normalTextureOffset:{type:"vec2"},normalTextureRepeat:{type:"vec2",default:{x:1,y:1}},ambientOcclusionMap:{type:"map"},ambientOcclusionMapIntensity:{default:1},displacementMap:{type:"map"},displacementScale:{default:1},displacementBias:{default:.5},displacementTextureOffset:{type:"vec2"},displacementTextureRepeat:{type:"vec2",default:{x:1,y:1}},bumpMap:{type:"map"},bumpMapScale:{default:1},bumpTextureOffset:{type:"vec2"},bumpTextureRepeat:{type:"vec2",default:{x:1,y:1}}},init:function(t){this.materialData={color:new _y.Color,specular:new _y.Color,emissive:new _y.Color},LM(t,this.materialData),this.material=new _y.MeshPhongMaterial(this.materialData);var e=this.el.sceneEl;Object.defineProperty(this.material,"envMap",{get:function(){return this._envMap||e.object3D.environment},set:function(t){this._envMap=t}})},update:function(t){this.updateMaterial(t),OE(this,t),FE("normal",this,t),FE("displacement",this,t),FE("ambientOcclusion",this,t),FE("bump",this,t),NE(this,t)},updateMaterial:function(t){var e;for(e in LM(t,this.materialData),this.materialData)this.material[e]=this.materialData[e]}}),vC("sdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},opacity:{type:"number",is:"uniform",default:1}},vertexShader:["#include <common>","#include <fog_pars_vertex>","#include <logdepthbuf_pars_vertex>","out vec2 vUV;","void main(void) {"," vUV = uv;"," #include <begin_vertex>"," #include <project_vertex>"," #include <logdepthbuf_vertex>"," #include <fog_vertex>","}"].join("\n"),fragmentShader:["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","float contour(float width, float value) {"," return smoothstep(0.5 - value, 0.5 + value, width);","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec2 uv = vUV;"," vec4 texColor = texture(map, uv);"," float dist = texColor.a;"," float width = fwidth(dist);"," float alpha = contour(dist, width);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(uv) + dFdy(uv));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * dist;"," }"," if (isBigEnough <= BIG_ENOUGH) {"," vec4 box = vec4 (uv - duv, uv + duv);"," alpha = (alpha + 0.5 * ("," contour(texture(map, box.xy).a, width)"," + contour(texture(map, box.zw).a, width)"," + contour(texture(map, box.xw).a, width)"," + contour(texture(map, box.zy).a, width)"," )) / 3.0;"," }"," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," gl_FragColor = vec4(color, opacity * alpha);"," #include <logdepthbuf_fragment>"," #include <tonemapping_fragment>"," #include <colorspace_fragment>"," #include <fog_fragment>","}"].join("\n"),init:function(){return this.uniforms=_y.UniformsUtils.merge([_y.UniformsLib.fog,this.initUniforms()]),this.material=new _y.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,fog:!0}),this.material}}),vC("msdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},negate:{type:"boolean",is:"uniform",default:!0},opacity:{type:"number",is:"uniform",default:1}},vertexShader:["#include <common>","#include <fog_pars_vertex>","#include <logdepthbuf_pars_vertex>","out vec2 vUV;","void main(void) {"," vUV = uv;"," #include <begin_vertex>"," #include <project_vertex>"," #include <logdepthbuf_vertex>"," #include <fog_vertex>","}"].join("\n"),fragmentShader:["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","uniform bool negate;","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","float median(float r, float g, float b) {"," return max(min(r, g), min(max(r, g), b));","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec3 sampleColor = texture(map, vUV).rgb;"," if (negate) { sampleColor = 1.0 - sampleColor; }"," float sigDist = median(sampleColor.r, sampleColor.g, sampleColor.b) - 0.5;"," float alpha = clamp(sigDist / fwidth(sigDist) + 0.5, 0.0, 1.0);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(vUV) + dFdy(vUV));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," // Do modified alpha test."," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * (sigDist + 0.5);"," }"," // Do modified alpha test."," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," gl_FragColor = vec4(color.xyz, alpha * opacity);"," #include <logdepthbuf_fragment>"," #include <tonemapping_fragment>"," #include <colorspace_fragment>"," #include <fog_fragment>","}"].join("\n"),init:function(){return this.uniforms=_y.UniformsUtils.merge([_y.UniformsLib.fog,this.initUniforms()]),this.material=new _y.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,fog:!0}),this.material}}),vC("shadow",{schema:{opacity:{default:.5},transparent:{default:!0},alphaToCoverage:{default:!0}},init:function(t){this.material=new _y.ShadowMaterial},update:function(t){this.material.opacity=t.opacity,this.material.alphaToCoverage=t.alphaToCoverage,this.material.transparent=t.transparent}});var DM="data-aframe-default-camera";function PM(t){var e=t.primitive,n=nC[e]&&nC[e].Geometry,i=new n;if(!n)throw new Error("Unknown geometry `"+e+"`");return i.init(t),i.geometry}Db("camera",{init:function(){this.activeCameraEl=null,this.render=this.render.bind(this),this.unwrapRender=this.unwrapRender.bind(this),this.wrapRender=this.wrapRender.bind(this),this.initialCameraFound=!1,this.numUserCameras=0,this.numUserCamerasChecked=0,this.setupInitialCamera()},setupInitialCamera:function(){var t,e,n=this.sceneEl,i=this;if(!n.camera||n.camera.el.getAttribute("camera").spectator)if((t=n.querySelectorAll("a-camera, :not(a-mixin)[camera]")).length)for(this.numUserCameras=t.length,e=0;e<t.length;e++)t[e].addEventListener("object3dset",(function(t){"camera"===t.detail.type&&i.checkUserCamera(this)})),t[e].isNode?t[e].load():t[e].addEventListener("nodeready",(function(){this.load()}));else this.createDefaultCamera();else n.emit("cameraready",{cameraEl:n.camera.el})},checkUserCamera:function(t){var e,n=this.el.sceneEl;this.numUserCamerasChecked++,this.initialCameraFound||((e=t.getAttribute("camera")).active&&!e.spectator?(this.initialCameraFound=!0,n.camera=t.getObject3D("camera"),n.emit("cameraready",{cameraEl:t})):this.numUserCamerasChecked===this.numUserCameras&&this.createDefaultCamera())},createDefaultCamera:function(){var t,e=this.sceneEl;(t=document.createElement("a-entity")).setAttribute("camera",{active:!0}),t.setAttribute("position",{x:0,y:1.6,z:0}),t.setAttribute("wasd-controls",""),t.setAttribute("look-controls",""),t.setAttribute(Sy,""),t.addEventListener("object3dset",(function(n){"camera"===n.detail.type&&(e.camera=n.detail.object,e.emit("cameraready",{cameraEl:t}))})),e.appendChild(t)},disableActiveCamera:function(){var t;(t=this.sceneEl.querySelectorAll(":not(a-mixin)[camera]"))[t.length-1].setAttribute("camera","active",!0)},setActiveCamera:function(t){var e,n,i,r,s=this.activeCameraEl,o=this.sceneEl;if((r=t.getObject3D("camera"))&&t!==this.activeCameraEl){var a=o.querySelector("["+DM+"]");for(t!==(a&&a.querySelector(":not(a-mixin)[camera]"))&&function(t){var e;t.camera&&(e=t.querySelector("["+DM+"]"))&&t.removeChild(e)}(o),this.activeCameraEl=t,this.activeCameraEl.play(),o.camera=r,s&&s.setAttribute("camera","active",!1),n=o.querySelectorAll(":not(a-mixin)[camera]"),i=0;i<n.length;i++)(e=n[i]).isEntity&&t!==e&&(e.setAttribute("camera","active",!1),e.pause());o.emit("camera-set-active",{cameraEl:t})}},setSpectatorCamera:function(t){var e,n=this.spectatorCameraEl,i=this.sceneEl;t.getObject3D("camera")&&t!==this.spectatorCameraEl&&(n&&n.setAttribute("camera","spectator",!1),e=this.spectatorCameraEl=t,i.addEventListener("enter-vr",this.wrapRender),i.addEventListener("exit-vr",this.unwrapRender),e.setAttribute("camera","active",!1),e.play(),i.emit("camera-set-spectator",{cameraEl:t}))},disableSpectatorCamera:function(){this.spectatorCameraEl=void 0},wrapRender:function(){this.spectatorCameraEl&&!this.originalRender&&(this.originalRender=this.sceneEl.renderer.render,this.sceneEl.renderer.render=this.render)},unwrapRender:function(){this.originalRender&&(this.sceneEl.renderer.render=this.originalRender,this.originalRender=void 0)},render:function(t,e){var n,i,r=this.sceneEl;n=r.renderer.xr.enabled,this.originalRender.call(r.renderer,t,e),this.spectatorCameraEl&&!r.isMobile&&n&&(i=this.spectatorCameraEl.components.camera.camera,r.renderer.xr.enabled=!1,this.originalRender.call(r.renderer,t,i),r.renderer.xr.enabled=n)}}),Db("geometry",{init:function(){this.cache={},this.cacheCount={}},clearCache:function(){this.cache={},this.cacheCount={}},getOrCreateGeometry:function(t){var e,n,i=this.cache;return t.skipCache?PM(t):(e=i[n=this.hash(t)],function(t,e){t[e]=void 0===t[e]?1:t[e]+1}(this.cacheCount,n),e||(e=PM(t),i[n]=e,e))},unuseGeometry:function(t){var e,n=this.cache,i=this.cacheCount;t.skipCache||n[e=this.hash(t)]&&(function(t,e){t[e]--}(i,e),i[e]>0||(n[e].dispose(),delete n[e],delete i[e]))},hash:function(t){return JSON.stringify(t)}}),Db("gltf-model",{schema:{dracoDecoderPath:{default:"https://www.gstatic.com/draco/versioned/decoders/1.5.7/"},basisTranscoderPath:{default:""},meshoptDecoderPath:{default:""}},init:function(){this.update()},update:function(){var t=this.data.dracoDecoderPath,e=this.data.basisTranscoderPath,n=this.data.meshoptDecoderPath;!this.dracoLoader&&t&&(this.dracoLoader=new _y.DRACOLoader,this.dracoLoader.setDecoderPath(t)),!this.ktx2Loader&&e&&(this.ktx2Loader=new _y.KTX2Loader,this.ktx2Loader.setTranscoderPath(e).detectSupport(this.el.renderer)),!this.meshoptDecoder&&n&&(this.meshoptDecoder=function(t){return new Promise((function(e,n){var i=document.createElement("script");document.body.appendChild(i),i.onload=e,i.onerror=n,i.async=!0,i.src=t}))}(n).then((function(){return window.MeshoptDecoder.ready})).then((function(){return window.MeshoptDecoder})))},getDRACOLoader:function(){return this.dracoLoader},getKTX2Loader:function(){return this.ktx2Loader},getMeshoptDecoder:function(){return this.meshoptDecoder}});var UM="data-aframe-default-light",OM=(Db("light",{schema:{defaultLightsEnabled:{default:!0}},init:function(){this.defaultLights=!1,this.userDefinedLights=!1,this.sceneEl.addEventListener("loaded",this.setupDefaultLights.bind(this))},registerLight:function(t){t.hasAttribute(UM)||(this.removeDefaultLights(),this.userDefinedLights=!0)},removeDefaultLights:function(){var t,e=this.sceneEl;if(this.defaultLights){t=document.querySelectorAll("["+UM+"]");for(var n=0;n<t.length;n++)e.removeChild(t[n]);this.defaultLights=!1}},setupDefaultLights:function(){var t,e,n=this.sceneEl;this.userDefinedLights||this.defaultLights||!this.data.defaultLightsEnabled||((t=document.createElement("a-entity")).setAttribute("light",{color:"#BBB",type:"ambient"}),t.setAttribute(UM,""),t.setAttribute(Sy,""),n.appendChild(t),(e=document.createElement("a-entity")).setAttribute("light",{color:"#FFF",intensity:1.884,castShadow:!0}),e.setAttribute("position",{x:-.5,y:1,z:1}),e.setAttribute(UM,""),e.setAttribute(Sy,""),n.appendChild(e),this.defaultLights=!0)}}),Ly),FM=OM("components:texture:error"),kM=OM("components:texture:warn"),NM=new _y.ImageLoader;Db("material",{init:function(){this.materials={},this.sourceCache={}},clearTextureSourceCache:function(){this.sourceCache={}},loadTexture:function(t,e,n){this.loadTextureSource(t,(function(t){var i=zE(t);PE(i,e),n(i)}))},loadTextureSource:function(t,e){var n=this,i=this.sourceCache,r=this.hash(t);function s(t){i[r]=Promise.resolve(t),i[r].then(e)}i[r]?i[r].then(e):"CANVAS"!==t.tagName?s(new Promise((function(e,i){SE(t,(function(t){n.loadImage(t,e)}),(function(t){n.loadVideo(t,e)}))}))):s(new _y.Source(t))},loadCubeMapTexture:function(t,e){var n=this,i=0,r=new _y.CubeTexture;function s(s){n.loadTextureSource(t[s],(function(t){r.images[s]=t.data,6==++i&&(r.needsUpdate=!0,e(r))}))}if(r.colorSpace=_y.SRGBColorSpace,6===t.length)for(var o=0;o<t.length;o++)s(o);else kM("Cube map texture requires exactly 6 sources, got only %s sources",t.length)},loadImage:function(t,e){e("string"==typeof t?function(t){return new Promise((function(e,n){NM.load(t,(function(t){e(new _y.Source(t))}),(function(){}),(function(t){FM("`$s` could not be fetched (Error code: %s; Response: %s)",t.status,t.statusText)}))}))}(t):new _y.Source(t))},loadVideo:function(t,e){var n;"string"!=typeof t&&function(t){t.autoplay=t.hasAttribute("autoplay")&&"false"!==t.getAttribute("autoplay"),t.controls=t.hasAttribute("controls")&&"false"!==t.getAttribute("controls"),"false"===t.getAttribute("loop")&&t.removeAttribute("loop"),"false"===t.getAttribute("preload")&&(t.preload="none"),t.crossOrigin=t.crossOrigin||"anonymous",t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline","")}(n=t),n=n||function(t){var e=document.createElement("video");return e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline",""),e.autoplay=!0,e.loop=!0,e.crossOrigin="anonymous",e.addEventListener("error",(function(){kM("`%s` is not a valid video",t)}),!0),e.src=t,e}(t),e(new _y.Source(n))},hash:function(t){return t.tagName&&(t.id||t.src)||t},registerMaterial:function(t){this.materials[t.uuid]=t},unregisterMaterial:function(t){delete this.materials[t.uuid]}}),Db("obb-collider",{schema:{showColliders:{default:!1}},init:function(){this.collisions=[],this.colliderEls=[]},addCollider:function(t){this.colliderEls.push(t),this.data.showColliders?t.components["obb-collider"].showCollider():t.components["obb-collider"].hideCollider(),this.tick=this.detectCollisions},removeCollider:function(t){var e=this.colliderEls,n=e.indexOf(t);t.components["obb-collider"].hideCollider(),n>-1&&e.splice(n,1),0===e.length&&(this.tick=void 0)},registerCollision:function(t,e){var n=this.collisions,i=!1,r=t.obb,s=e.obb,o=t.renderColliderMesh,a=e.renderColliderMesh;o&&o.material.color.set(16711680),a&&a.material.color.set(16711680);for(var l=0;l<n.length;l++)if(n[l].componentA.obb===r&&n[l].componentB.obb===s||n[l].componentA.obb===s&&n[l].componentB.obb===r){i=!0,n[l].detected=!0;break}i||(n.push({componentA:t,componentB:e,detected:!0}),t.el.emit("obbcollisionstarted",{trackedObject3D:t.trackedObject3D,withEl:e.el}),e.el.emit("obbcollisionstarted",{trackedObject3D:e.trackedObject3D,withEl:t.el}))},resetCollisions:function(){for(var t=this.collisions,e=0;e<t.length;e++)t[e].detected=!1},clearCollisions:function(){for(var t,e,n,i,r=this.collisions,s=[],o=0;o<r.length;o++)r[o].detected?s.push(r[o]):(t=r[o].componentA,e=r[o].componentB,n=t.renderColliderMesh,i=e.renderColliderMesh,n&&n.material.color.set(65280),t.el.emit("obbcollisionended",{trackedObject3D:this.trackedObject3D,withEl:e.el}),i&&i.material.color.set(65280),e.el.emit("obbcollisionended",{trackedObject3D:this.trackedObject3D,withEl:t.el}));this.collisions=s},detectCollisions:function(){var t,e,n,i,r=this.colliderEls;if(!(r.length<2)){this.resetCollisions();for(var s=0;s<r.length;s++)if(n=r[s].components["obb-collider"],0!==(t=r[s].components["obb-collider"].obb).halfSize.x&&0!==t.halfSize.y&&0!==t.halfSize.z)for(var o=s+1;o<r.length;o++)0!==(e=(i=r[o].components["obb-collider"]).obb).halfSize.x&&0!==e.halfSize.y&&0!==e.halfSize.z&&t.intersectsOBB(e)&&this.registerCollision(n,i);this.clearCollisions()}}});var QM=Ly("components:renderer:warn");function GM(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z-e.z}function zM(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder-e.renderOrder}function HM(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:e.z-t.z}Db("renderer",{schema:{antialias:{default:"auto",oneOf:["true","false","auto"]},highRefreshRate:{default:Zy()},logarithmicDepthBuffer:{default:"auto",oneOf:["true","false","auto"]},maxCanvasWidth:{default:-1},maxCanvasHeight:{default:-1},multiviewStereo:{default:!1},exposure:{default:1,if:{toneMapping:["ACESFilmic","linear","reinhard","cineon","AgX","neutral"]}},toneMapping:{default:"no",oneOf:["no","ACESFilmic","linear","reinhard","cineon","AgX","neutral"]},precision:{default:"high",oneOf:["high","medium","low"]},anisotropy:{default:1},sortTransparentObjects:{default:!1},colorManagement:{default:!0},alpha:{default:!0},stencil:{default:!1},foveationLevel:{default:1}},init:function(){var t=this.data,e=this.el,n=this.data.toneMapping.charAt(0).toUpperCase()+this.data.toneMapping.slice(1),i=e.renderer;i.toneMapping=_y[n+"ToneMapping"],_y.Texture.DEFAULT_ANISOTROPY=t.anisotropy,_y.ColorManagement.enabled=t.colorManagement,i.outputColorSpace=t.colorManagement?_y.SRGBColorSpace:_y.LinearSRGBColorSpace,e.hasAttribute("antialias")&&QM('Component `antialias` is deprecated. Use `renderer="antialias: true"` instead.'),e.hasAttribute("logarithmicDepthBuffer")&&QM('Component `logarithmicDepthBuffer` is deprecated. Use `renderer="logarithmicDepthBuffer: true"` instead.'),i.sortObjects=!0,i.setOpaqueSort(GM)},update:function(){var t=this.data,e=this.el.renderer,n=this.data.toneMapping.charAt(0).toUpperCase()+this.data.toneMapping.slice(1);e.toneMapping=_y[n+"ToneMapping"],e.toneMappingExposure=t.exposure,e.xr.setFoveation(t.foveationLevel),t.sortObjects&&QM('`sortObjects` property is deprecated. Use `renderer="sortTransparentObjects: true"` instead.'),t.sortTransparentObjects?e.setTransparentSort(HM):e.setTransparentSort(zM)},applyColorCorrection:function(t){this.data.colorManagement&&t&&t.isTexture&&t.colorSpace!==_y.SRGBColorSpace&&(t.colorSpace=_y.SRGBColorSpace,t.needsUpdate=!0)},setWebXRFrameRate:function(t){var e,n=this.data,i=t.supportedFrameRates;i&&t.updateTargetFrameRate&&(e=i.includes(90)?n.highRefreshRate?90:72:n.highRefreshRate?72:60,t.updateTargetFrameRate(e).catch((function(t){console.warn("failed to set target frame rate of "+e+". Error info: "+t)})))}});var VM={basic:_y.BasicShadowMap,pcf:_y.PCFShadowMap,pcfsoft:_y.PCFSoftShadowMap};Db("shadow",{schema:{enabled:{default:!0},autoUpdate:{default:!0},type:{default:"pcf",oneOf:["basic","pcf","pcfsoft"]}},init:function(){var t=this.sceneEl,e=this.data;this.shadowMapEnabled=!1,t.renderer.shadowMap.type=VM[e.type],t.renderer.shadowMap.autoUpdate=e.autoUpdate},update:function(t){t.enabled!==this.data.enabled&&this.setShadowMapEnabled(this.shadowMapEnabled)},setShadowMapEnabled:function(t){var e=this.sceneEl,n=this.sceneEl.renderer;this.shadowMapEnabled=t;var i=this.data.enabled&&this.shadowMapEnabled;n&&i!==n.shadowMap.enabled&&(n.shadowMap.enabled=i,function(t){t.hasLoaded&&t.object3D.traverse((function(t){if(t.material)for(var e=Array.isArray(t.material)?t.material:[t.material],n=0;n<e.length;n++)e[n].needsUpdate=!0}))}(e))}}),Db("tracked-controls",{init:function(){this.controllers=[],this.onInputSourcesChange=this.onInputSourcesChange.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.el.addEventListener("enter-vr",this.onEnterVR),this.onExitVR=this.onExitVR.bind(this),this.el.addEventListener("exit-vr",this.onExitVR)},onEnterVR:function(){this.el.xrSession&&this.el.xrSession.addEventListener("inputsourceschange",this.onInputSourcesChange)},onExitVR:function(){this.referenceSpace=void 0,this.controllers=[],this.el.emit("controllersupdated",void 0,!1)},onInputSourcesChange:function(){var t=this,e=this.el.xrSession,n=this.el.sceneEl.systems.webxr.sessionReferenceSpaceType;e.requestReferenceSpace(n).then((function(e){t.referenceSpace=e})).catch((function(e){throw t.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(n,'tracked-controls uses reference space "'+n+'".'),e})),this.controllers=e.inputSources,this.el.emit("controllersupdated",void 0,!1)}});var jM=Ly("systems:webxr:warn"),WM=(Db("webxr",{schema:{referenceSpaceType:{type:"string",default:"local-floor"},requiredFeatures:{type:"array",default:["local-floor"]},optionalFeatures:{type:"array",default:["bounded-floor"]},overlayElement:{type:"selector"}},update:function(){var t=this.data;this.sessionConfiguration={requiredFeatures:t.requiredFeatures,optionalFeatures:t.optionalFeatures},this.sessionReferenceSpaceType=t.referenceSpaceType,t.overlayElement&&(t.overlayElement.classList.remove("a-dom-overlay"),t.optionalFeatures.includes("dom-overlay")||(t.optionalFeatures.push("dom-overlay"),this.el.setAttribute("webxr",t)),this.warnIfFeatureNotRequested("dom-overlay"),this.sessionConfiguration.domOverlay={root:t.overlayElement},t.overlayElement.classList.add("a-dom-overlay"))},wasFeatureRequested:function(t){return"viewer"===t||"local"===t||!(!this.sessionConfiguration.requiredFeatures.includes(t)&&!this.sessionConfiguration.optionalFeatures.includes(t))},warnIfFeatureNotRequested:function(t,e){this.wasFeatureRequested(t)||jM((e?e+" ":"")+'Please add the feature "'+t+"\" to a-scene's webxr system options in requiredFeatures/optionalFeatures.")}}),{});function qM(t){var e=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();"fog"===t&&(e="material-fog"),"visible"===t&&(e="material-visible"),WM[e]="material."+t}function XM(){return{defaultComponents:{material:{}},mappings:dx({},WM)}}Object.keys(cb.material.schema).forEach(qM),Object.keys(AC.standard.schema).forEach(qM);var YM=new _y.Vector3,JM=new _y.Vector3;_b("pivot",{dependencies:["position"],schema:{type:"vec3"},init:function(){var t=this.data,e=this.el,n=e.object3D.parent,i=e.object3D,r=new _y.Group;YM.copy(i.position),JM.copy(i.rotation),n.remove(i),r.add(i),n.add(r),e.object3D=r,i.position.set(-1*t.x,-1*t.y,-1*t.z),r.position.set(t.x+YM.x,t.y+YM.y,t.z+YM.z),r.rotation.copy(i.rotation),i.rotation.set(0,0,0)}}),dC("a-camera",{defaultComponents:{camera:{},"look-controls":{},"wasd-controls":{},position:{x:0,y:1.6,z:0}},mappings:{active:"camera.active",far:"camera.far",fov:"camera.fov","look-controls-enabled":"look-controls.enabled",near:"camera.near","pointer-lock-enabled":"look-controls.pointerLockEnabled","wasd-controls-enabled":"wasd-controls.enabled","reverse-mouse-drag":"look-controls.reverseMouseDrag",zoom:"camera.zoom"}}),dC("a-cursor",px({},XM(),{defaultComponents:{cursor:{},geometry:{primitive:"ring",radiusOuter:.016,radiusInner:.01,segmentsTheta:32},material:{color:"#000",shader:"flat",opacity:.8},position:{x:0,y:0,z:-1}},mappings:{far:"raycaster.far",fuse:"cursor.fuse","fuse-timeout":"cursor.fuseTimeout",interval:"raycaster.interval",objects:"raycaster.objects"}})),dC("a-curvedimage",px({},XM(),{defaultComponents:{geometry:{height:1,primitive:"cylinder",radius:2,segmentsRadial:48,thetaLength:270,openEnded:!0,thetaStart:0},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0,repeat:"-1 1"}},mappings:{height:"geometry.height","open-ended":"geometry.openEnded",radius:"geometry.radius",segments:"geometry.segmentsRadial",start:"geometry.thetaStart","theta-length":"geometry.thetaLength","theta-start":"geometry.thetaStart",width:"geometry.thetaLength"}})),dC("a-gltf-model",{mappings:{src:"gltf-model"}}),dC("a-image",px({},XM(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}})),dC("a-light",{defaultComponents:{light:{}},mappings:{angle:"light.angle",color:"light.color","ground-color":"light.groundColor",decay:"light.decay",distance:"light.distance",intensity:"light.intensity",penumbra:"light.penumbra",type:"light.type",target:"light.target",envmap:"light.envMap","shadow-camera-automatic":"light.shadowCameraAutomatic"}}),dC("a-link",{defaultComponents:{link:{visualAspectEnabled:!0}},mappings:{href:"link.href",image:"link.image",title:"link.title"}}),dC("a-obj-model",px({},XM(),{defaultComponents:{"obj-model":{}},mappings:{src:"obj-model.obj",mtl:"obj-model.mtl"}}));const KM={},ZM=KM;function $M(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}var tS,eS;iC.forEach((function(t){var e=nC[t],n=$M(t),i={};Object.keys(e.schema).forEach((function(t){i[$M(t)]="geometry."+t}));var r="a-"+n,s=dC(r,px({},XM(),{defaultComponents:{geometry:{primitive:t}},mappings:i}));KM[r]=s})),dC("a-sky",px({},XM(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",side:"back",shader:"flat",npot:!0},scale:"-1 1 1"},mappings:px({},ZM["a-sphere"].mappings)})),dC("a-sound",{defaultComponents:{sound:{}},mappings:{src:"sound.src",on:"sound.on",autoplay:"sound.autoplay",loop:"sound.loop",volume:"sound.volume"}}),tS={text:{anchor:"align",width:5}},eS=eS||{},Object.keys(tS).forEach((function(t){!function(t,e){var n=cb[t].schema;Object.keys(n).forEach((function(n){var i=n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();void 0!==e[i]&&(i=t+"-"+n),e[i]=t+"."+n}))}(t,eS)})),dC("a-text",px({},null,{defaultComponents:tS,mappings:eS})),dC("a-video",px({},XM(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}})),dC("a-videosphere",px({},XM(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",shader:"flat",side:"back",npot:!0},scale:"-1 1 1"},mappings:{radius:"geometry.radius","segments-height":"geometry.segmentsHeight","segments-width":"geometry.segmentsWidth"}}));var nS=Ly,iS=nS("A-Frame:error"),rS=nS("A-Frame:warn");window.document.currentScript&&window.document.currentScript.parentNode!==window.document.head&&!window.debug&&rS("Put the A-Frame <script> tag in the <head> of the HTML *before* the scene to ensure everything for A-Frame is properly registered before they are used from HTML."),window.cordova||"file:"!==window.location.protocol||iS("This HTML file is currently being served via the file:// protocol. Assets, textures, and models WILL NOT WORK due to cross-origin policy! Please use a local or hosted server: https://aframe.io/docs/1.4.0/introduction/installation.html#use-a-local-server."),iE&&(window.logs=nS,n(7180),n(9379)),console.log("A-Frame Version: 1.6.0 (Date 2025-02-09, Commit #b9e4838)"),console.log("THREE Version (https://github.com/supermedium/three.js):",_y.REVISION),window.AFRAME_ASYNC||("complete"!==document.readyState?document.addEventListener("readystatechange",(function t(){"complete"===document.readyState&&(document.removeEventListener("readystatechange",t),Bb())})):Bb());const sS=globalThis.AFRAME={AComponent:Cb,AEntity:Hb,ANode:Fb,ANIME:Rt,AScene:Kb,components:cb,coreComponents:Object.keys(cb),geometries:nC,registerComponent:_b,registerGeometry:sC,registerPrimitive:dC,registerShader:vC,registerSystem:Db,primitives:{getMeshMixin:XM,primitives:uC},scenes:Fx,schema:p,shaders:AC,systems:Rb,emitReady:Bb,THREE:_y,utils:d,version:_C}})(),i.default})())); +//# sourceMappingURL=aframe-master.min.js.map(()=>{if(AFRAME.registerGeometry("prism",{schema:{depth:{default:1,min:0},height:{default:1,min:0},width:{default:1,min:0}},init:function(t){const i=new THREE.Shape;i.moveTo(t.width/2,0),i.lineTo(0,t.height),i.lineTo(-t.width/2,0),i.lineTo(t.width/2,0);const e={steps:2,depth:t.depth,bevelEnabled:!1};this.geometry=new THREE.ExtrudeGeometry(i,e)}}),"undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("blink-controls",{schema:{button:{default:"",oneOf:["trackpad","trigger","grip","menu","thumbstick"]},startEvents:{type:"array",default:[]},endEvents:{type:"array",default:[]},cancelEvents:{type:"array",default:[]},collisionEntities:{default:""},hitEntity:{type:"selector"},cameraRig:{type:"selector",default:"#player"},teleportOrigin:{type:"selector",default:"#camera"},hitCylinderColor:{type:"color",default:"#4d93fd"},hitCylinderRadius:{default:.25,min:0},hitCylinderHeight:{default:.3,min:0},interval:{default:0},curveNumberPoints:{default:60,min:2},curveLineWidth:{default:.025},curveHitColor:{type:"color",default:"#4d93fd"},curveMissColor:{type:"color",default:"#ff0000"},curveShootingSpeed:{default:10,min:0},defaultPlaneSize:{default:100},landingNormal:{type:"vec3",default:{x:0,y:1,z:0}},landingMaxAngle:{default:"45",min:0,max:360},drawIncrementally:{default:!0},incrementalDrawMs:{default:300},missOpacity:{default:.8},hitOpacity:{default:.8},snapTurn:{default:!0},rotateOnTeleport:{default:!0}},init:function(){const t=this.data,i=this.el;let e;this.active=!1,this.obj=i.object3D,this.controllerPosition=new THREE.Vector3,this.hitEntityQuaternion=new THREE.Quaternion,this.teleportOriginQuaternion=new THREE.Quaternion,this.hitPoint=new THREE.Vector3,this.collisionObjectNormalMatrix=new THREE.Matrix3,this.collisionWorldNormal=new THREE.Vector3,this.rigWorldPosition=new THREE.Vector3,this.newRigWorldPosition=new THREE.Vector3,this.teleportEventDetail={oldPosition:this.rigWorldPosition,newPosition:this.newRigWorldPosition,hitPoint:this.hitPoint,rotationQuaternion:this.hitEntityQuaternion},this.hit=!1,this.prevCheckTime=void 0,this.referenceNormal=new THREE.Vector3,this.curveMissColor=new THREE.Color,this.curveHitColor=new THREE.Color,this.raycaster=new THREE.Raycaster,this.defaultPlane=this.createDefaultPlane(this.data.defaultPlaneSize),this.defaultCollisionMeshes=[this.defaultPlane];const n=this.teleportEntity=document.createElement("a-entity");if(n.classList.add("teleportRay"),n.setAttribute("visible",!1),i.sceneEl.appendChild(this.teleportEntity),this.onButtonDown=this.onButtonDown.bind(this),this.onButtonUp=this.onButtonUp.bind(this),this.cancel=this.cancel.bind(this),this.handleThumbstickAxis=this.handleThumbstickAxis.bind(this),this.teleportOrigin=this.data.teleportOrigin,this.cameraRig=this.data.cameraRig,this.snapturnRotation=THREE.MathUtils.degToRad(45),this.canSnapturn=!0,this.addedEvents=[],this.data.startEvents.length&&this.data.endEvents.length){for(e=0;e<this.data.startEvents.length;e++)this.addedEvents.push([this.data.startEvents[e],this.onButtonDown]),i.addEventListener(this.data.startEvents[e],this.onButtonDown);for(e=0;e<this.data.endEvents.length;e++)this.addedEvents.push([this.data.endEvents[e],this.onButtonUp]),i.addEventListener(this.data.endEvents[e],this.onButtonUp)}else t.button?(this.addedEvents.push([t.button+"down",this.onButtonDown]),this.addedEvents.push([t.button+"up",this.onButtonUp]),i.addEventListener(t.button+"down",this.onButtonDown),i.addEventListener(t.button+"up",this.onButtonUp)):this.thumbstickAxisActivation=!0;for(e=0;e<this.data.cancelEvents.length;e++)this.addedEvents.push([this.data.cancelEvents[e],this.cancel]),i.addEventListener(this.data.cancelEvents[e],this.cancel);this.addedEvents.push(["thumbstickmoved",this.handleThumbstickAxis]),i.addEventListener("thumbstickmoved",this.handleThumbstickAxis),this.queryCollisionEntities()},handleSnapturn:function(t,i){i<.5&&(this.canSnapturn=!0),this.canSnapturn&&i>.95&&(Math.abs(t-Math.PI/2)<.6?(this.cameraRig.object3D.rotateY(+this.snapturnRotation),this.canSnapturn=!1):Math.abs(t-1.5*Math.PI)<.6&&(this.cameraRig.object3D.rotateY(-this.snapturnRotation),this.canSnapturn=!1))},handleThumbstickAxis:function(t){if(void 0!==t.detail.x&&void 0!==t.detail.y){const i=Math.atan2(t.detail.x,t.detail.y)+Math.PI,e=Math.sqrt(t.detail.x**2+t.detail.y**2);this.active?(e>.95&&(this.obj.getWorldPosition(this.controllerPosition),this.controllerPosition.setComponent(1,this.hitEntity.object3D.position.y),this.hitEntity.object3D.visible=!1,this.hitEntity.object3D.lookAt(this.controllerPosition),this.hitEntity.object3D.rotateY(i),this.hitEntity.object3D.visible=!0,this.hitEntity.object3D.getWorldQuaternion(this.hitEntityQuaternion)),0===Math.abs(t.detail.x)&&0===Math.abs(t.detail.y)&&this.onButtonUp()):this.thumbstickAxisActivation&&e>.95&&(i<.5||i>5.78)?this.onButtonDown():this.data.snapTurn&&this.handleSnapturn(i,e)}},update:function(t){const i=this.data,e=AFRAME.utils.diff(i,t);this.referenceNormal.copy(i.landingNormal),this.curveMissColor.set(i.curveMissColor),this.curveHitColor.set(i.curveHitColor),(!this.line||"curveLineWidth"in e||"curveNumberPoints"in e||"type"in e)&&(this.line=this.createLine(i),this.line.material.opacity=this.data.hitOpacity,this.line.material.transparent=this.data.hitOpacity<1,this.numActivePoints=i.curveNumberPoints,this.teleportEntity.setObject3D("mesh",this.line.mesh)),i.hitEntity?this.hitEntity=i.hitEntity:(!this.hitEntity||"hitCylinderColor"in e||"hitCylinderHeight"in e||"hitCylinderRadius"in e)&&(this.hitEntity&&this.hitEntity.parentNode.removeChild(this.hitEntity),this.hitEntity=this.createHitEntity(i),this.el.sceneEl.appendChild(this.hitEntity)),this.hitEntity.setAttribute("visible",!1),i.hitEntity||this.hitEntity.lastElementChild.setAttribute("visible",i.rotateOnTeleport),"collisionEntities"in e&&this.queryCollisionEntities()},remove:function(){const t=this.el,i=this.hitEntity,e=this.teleportEntity;i&&i.parentNode.removeChild(i),e&&e.parentNode.removeChild(e),t.sceneEl.removeEventListener("child-attached",this.childAttachHandler),t.sceneEl.removeEventListener("child-detached",this.childDetachHandler);for(const[i,e]of this.addedEvents)t.removeEventListener(i,e)},tick:function(){const t=new THREE.Vector3,i=new THREE.Vector3,e=new THREE.Vector3(0,-9.8,0),n=new THREE.Vector3,s=new THREE.Vector3,o=new THREE.Quaternion,r=new THREE.Vector3,a=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,c=new THREE.Vector3;let d=0;return function(u,E){if(!this.active)return;if(this.data.drawIncrementally&&this.redrawLine&&(this.redrawLine=!1,d=0),d+=E,this.numActivePoints=this.data.curveNumberPoints*d/this.data.incrementalDrawMs,this.numActivePoints>this.data.curveNumberPoints&&(this.numActivePoints=this.data.curveNumberPoints),this.prevCheckTime&&u-this.prevCheckTime<this.data.interval)return;this.prevCheckTime=u;this.obj.matrixWorld.decompose(r,o,a);const p=h.set(0,0,-1).applyQuaternion(o).normalize();this.line.setDirection(c.copy(p)),this.obj.getWorldPosition(t),s.copy(t),this.teleportEntity.setAttribute("visible",!0),d<this.data.incrementalDrawMs?this.line.material.color.set(this.curveHitColor):this.line.material.color.set(this.curveMissColor),this.line.material.opacity=this.data.missOpacity,this.line.material.transparent=this.data.missOpacity<1,this.hitEntity.setAttribute("visible",!1),this.hit=!1,i.copy(p).multiplyScalar(this.data.curveShootingSpeed),this.lastDrawnIndex=0;const A=this.data.drawIncrementally?this.numActivePoints:this.line.numPoints;for(let o=0;o<A+1;o++){let r;r=o===Math.floor(A+1)?A/(this.line.numPoints-1):o/(this.line.numPoints-1);const a=this.parabolicCurveMaxRoot(t,i,e);r*=Math.max(1,1.5*a),this.parabolicCurve(t,i,e,r,n);const h=l.copy(n).sub(s).normalize();if(this.raycaster.far=h.length(),this.raycaster.set(s,h),this.lastDrawnPoint=n,this.lastDrawnIndex=o,this.checkMeshCollisions(o,s,n))break;s.copy(n)}for(let t=this.lastDrawnIndex+1;t<this.line.numPoints;t++)this.line.setPoint(t,this.lastDrawnPoint,this.lastDrawnPoint)}}(),queryCollisionEntities:function(){const t=this.data,i=this.el;if(!t.collisionEntities)return void(this.collisionEntities=[]);const e=[].slice.call(i.sceneEl.querySelectorAll(t.collisionEntities));this.collisionEntities=e,this.childAttachHandler=function(i){i.detail.el.matches(t.collisionEntities)&&e.push(i.detail.el)},i.sceneEl.addEventListener("child-attached",this.childAttachHandler),this.childDetachHandler=function(i){if(!i.detail.el.matches(t.collisionEntities))return;const n=e.indexOf(i.detail.el);-1!==n&&e.splice(n,1)},i.sceneEl.addEventListener("child-detached",this.childDetachHandler)},onButtonDown:function(){this.active=!0,this.redrawLine=!0},onButtonUp:function(){const t=new THREE.Vector3,i=[new THREE.Vector3,new THREE.Vector3],e=new THREE.Vector3;return function(n){if(!this.active)return;if(this.active=!1,this.hitEntity.setAttribute("visible",!1),this.teleportEntity.setAttribute("visible",!1),!this.hit)return;const s=this.data.cameraRig||this.el.sceneEl.camera.el;if(s.object3D.getWorldPosition(this.rigWorldPosition),this.newRigWorldPosition.copy(this.hitPoint),t.copy(this.newRigWorldPosition),s.object3D.parent&&s.object3D.parent.worldToLocal(t),s.setAttribute("position",t),this.data.rotateOnTeleport&&(this.teleportOriginQuaternion.setFromEuler(new THREE.Euler(0,this.teleportOrigin.object3D.rotation.y,0)),this.teleportOriginQuaternion.invert(),this.teleportOriginQuaternion.multiply(this.hitEntityQuaternion),this.cameraRig.object3D.setRotationFromQuaternion(this.teleportOriginQuaternion)),!this.data.cameraRig){const t=document.querySelectorAll("a-entity[tracked-controls]");for(let n=0;n<t.length;n++)t[n].object3D.getWorldPosition(e),i[n].copy(this.newRigWorldPosition).sub(this.rigWorldPosition).add(e),t[n].setAttribute("position",i[n])}this.el.emit("teleported",this.teleportEventDetail)}}(),cancel:function(){this.active=!1,this.hitEntity.setAttribute("visible",!1),this.teleportEntity.setAttribute("visible",!1)},checkMeshCollisions:function(t,i,e){let n;this.data.collisionEntities?(n=this.collisionEntities.map((function(t){return t.getObject3D("mesh")})).filter((function(t){return t})),n=n.length?n:this.defaultCollisionMeshes):n=this.defaultCollisionMeshes;const s=this.raycaster.intersectObjects(n,!0);if(s.length>0&&!this.hit&&this.isValidNormalsAngle(s[0].face.normal,s[0].object)){const e=s[0].point;this.line.material.color.set(this.curveHitColor),this.line.material.opacity=this.data.hitOpacity,this.line.material.transparent=this.data.hitOpacity<1,this.hitEntity.setAttribute("position",e),this.hitEntity.setAttribute("visible",!0),this.hit=!0,this.hitPoint.copy(s[0].point);for(let e=t;e<this.line.numPoints;e++)this.line.setPoint(e,i,this.hitPoint);return!0}return this.line.setPoint(t,i,e),!1},isValidNormalsAngle:function(t,i){this.collisionObjectNormalMatrix.getNormalMatrix(i.matrixWorld),this.collisionWorldNormal.copy(t).applyMatrix3(this.collisionObjectNormalMatrix).normalize();const e=this.referenceNormal.angleTo(this.collisionWorldNormal);return THREE.MathUtils.RAD2DEG*e<=this.data.landingMaxAngle},parabolicCurveScalar:function(t,i,e,n){return t+i*n+.5*e*n*n},parabolicCurve:function(t,i,e,n,s){return s.x=this.parabolicCurveScalar(t.x,i.x,e.x,n),s.y=this.parabolicCurveScalar(t.y,i.y,e.y,n),s.z=this.parabolicCurveScalar(t.z,i.z,e.z,n),s},parabolicCurveMaxRoot:function(t,i,e){return(-i.y-Math.sqrt(i.y**2-.5*e.y*4*t.y))/(1*e.y)},createLine:function(t){const i="line"===t.type?2:t.curveNumberPoints;return new AFRAME.utils.RayCurve(i,t.curveLineWidth)},createHitEntity:function(t){const i=document.createElement("a-entity");i.className="hitEntity";const e=document.createElement("a-entity");e.setAttribute("geometry",{primitive:"torus",radius:t.hitCylinderRadius,radiusTubular:.01}),e.setAttribute("rotation",{x:90,y:0,z:0}),e.setAttribute("material",{shader:"flat",color:t.hitCylinderColor,side:"double",depthTest:!1}),i.appendChild(e);const n=document.createElement("a-entity");n.setAttribute("position",{x:0,y:t.hitCylinderHeight/2,z:0}),n.setAttribute("geometry",{primitive:"cylinder",segmentsHeight:1,radius:t.hitCylinderRadius,height:t.hitCylinderHeight,openEnded:!0}),n.setAttribute("material",{shader:"flat",color:t.hitCylinderColor,opacity:.5,side:"double",src:this.cylinderTexture,transparent:!0,depthTest:!1}),i.appendChild(n);const s=document.createElement("a-entity");return s.setAttribute("position",{x:0,y:.05,z:-1.5*t.hitCylinderRadius}),s.setAttribute("rotation",{x:90,y:180,z:0}),s.setAttribute("geometry",{primitive:"prism",height:.2,width:.2,depth:.05}),s.setAttribute("material",{shader:"flat",color:t.hitCylinderColor,side:"double",transparent:!0,opacity:.6,depthTest:!1}),i.appendChild(s),i},createDefaultPlane:function(t){const i=new THREE.PlaneGeometry(100,100);i.rotateX(-Math.PI/2);const e=new THREE.MeshBasicMaterial({color:16776960});return new THREE.Mesh(i,e)},cylinderTexture:"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAQCAYAAADXnxW3AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAADJJREFUeNpEx7ENgDAAAzArK0JA6f8X9oewlcWStU1wBGdwB08wgjeYm79jc2nbYH0DAC/+CORJxO5fAAAAAElFTkSuQmCC)"}),AFRAME.utils.RayCurve=function(t,i){this.geometry=new THREE.BufferGeometry,this.vertices=new Float32Array(3*t*6),this.uvs=new Float32Array(2*t*6),this.width=i,this.geometry.setAttribute("position",new THREE.BufferAttribute(this.vertices,3).setUsage(THREE.DynamicDrawUsage)),this.material=new THREE.MeshBasicMaterial({side:THREE.DoubleSide,color:16711680}),this.mesh=new THREE.Mesh(this.geometry,this.material),this.mesh.frustumCulled=!1,this.mesh.vertices=this.vertices,this.direction=new THREE.Vector3,this.numPoints=t},AFRAME.utils.RayCurve.prototype={setDirection:function(t){const i=new THREE.Vector3(0,1,0);this.direction.copy(t).cross(i).normalize().multiplyScalar(this.width/2)},setWidth:function(t){this.width=t},setPoint:function(){const t=new THREE.Vector3,i=new THREE.Vector3,e=new THREE.Vector3,n=new THREE.Vector3;return function(s,o,r){t.copy(o).add(this.direction),i.copy(o).sub(this.direction),e.copy(r).add(this.direction),n.copy(r).sub(this.direction);let a=18*s;this.vertices[a++]=t.x,this.vertices[a++]=t.y,this.vertices[a++]=t.z,this.vertices[a++]=i.x,this.vertices[a++]=i.y,this.vertices[a++]=i.z,this.vertices[a++]=e.x,this.vertices[a++]=e.y,this.vertices[a++]=e.z,this.vertices[a++]=e.x,this.vertices[a++]=e.y,this.vertices[a++]=e.z,this.vertices[a++]=i.x,this.vertices[a++]=i.y,this.vertices[a++]=i.z,this.vertices[a++]=n.x,this.vertices[a++]=n.y,this.vertices[a++]=n.z,this.geometry.attributes.position.needsUpdate=!0}}()}})(); +//# sourceMappingURL=aframe-blink-controls.min.js.map/* * v0.5.1 generated at Wed Jan 15 10:52:05 AM CET 2025 * https://xrfragment.org * SPDX-License-Identifier: AGPL-3.0-or-later */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AFRAME=t():e.AFRAME=t()}(self,(()=>(()=>{var e={8167:e=>{var t=Object.prototype.toString;e.exports=function(e){return e.BYTES_PER_ELEMENT&&"[object ArrayBuffer]"===t.call(e.buffer)||Array.isArray(e)}},5734:e=>{e.exports=function(e,t){return"number"==typeof e?e:"number"==typeof t?t:0}},7961:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),n=t[0],i=t[1];return 3*(n+i)/4-i},t.toByteArray=function(e){var t,n,s=a(e),o=s[0],l=s[1],c=new r(function(e,t,n){return 3*(t+n)/4-n}(0,o,l)),h=0,d=l>0?o-4:o;for(n=0;n<d;n+=4)t=i[e.charCodeAt(n)]<<18|i[e.charCodeAt(n+1)]<<12|i[e.charCodeAt(n+2)]<<6|i[e.charCodeAt(n+3)],c[h++]=t>>16&255,c[h++]=t>>8&255,c[h++]=255&t;return 2===l&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,c[h++]=255&t),1===l&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,c[h++]=t>>8&255,c[h++]=255&t),c},t.fromByteArray=function(e){for(var t,i=e.length,r=i%3,s=[],o=16383,a=0,c=i-r;a<c;a+=o)s.push(l(e,a,a+o>c?c:a+o));return 1===r?(t=e[i-1],s.push(n[t>>2]+n[t<<4&63]+"==")):2===r&&(t=(e[i-2]<<8)+e[i-1],s.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),s.join("")};for(var n=[],i=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)n[o]=s[o],i[s.charCodeAt(o)]=o;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,i){for(var r,s,o=[],a=t;a<i;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(n[(s=r)>>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},911:(e,t,n)=>{var i=n(9922).hp;e.exports=function(e,t){if(i.isBuffer(e)&&i.isBuffer(t)){if("function"==typeof e.equals)return e.equals(t);if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}}},9922:(e,t,n)=>{"use strict";const i=n(7961),r=n(1024),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=l,t.IS=50;const o=2147483647;function a(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,l.prototype),t}function l(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return c(e,t,n)}function c(e,t,n){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!l.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|f(e,t);let i=a(n);const r=i.write(e,t);return r!==n&&(i=i.slice(0,r)),i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return p(t.buffer,t.byteOffset,t.byteLength)}return u(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return p(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return p(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return l.from(i,t,n);const r=function(e){if(l.isBuffer(e)){const t=0|A(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||J(e.length)?a(0):u(e):"Buffer"===e.type&&Array.isArray(e.data)?u(e.data):void 0}(e);if(r)return r;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return l.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function h(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return h(e),a(e<0?0:0|A(e))}function u(e){const t=e.length<0?0:0|A(e.length),n=a(t);for(let i=0;i<t;i+=1)n[i]=255&e[i];return n}function p(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(i,l.prototype),i}function A(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function f(e,t){if(l.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===n)return 0;let r=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return q(e).length;default:if(r)return i?-1:W(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,n);case"utf8":case"utf-8":return M(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return B(this,t,n);case"base64":return _(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function g(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function v(e,t,n,i,r){if(0===e.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),J(n=+n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=l.from(t,i)),l.isBuffer(t))return 0===t.length?-1:y(e,t,n,i,r);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,i,r);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,i,r){let s,o=1,a=e.length,l=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,n/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(r){let i=-1;for(s=n;s<a;s++)if(c(e,s)===c(t,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===l)return i*o}else-1!==i&&(s-=s-i),i=-1}else for(n+l>a&&(n=a-l),s=n;s>=0;s--){let n=!0;for(let i=0;i<l;i++)if(c(e,s+i)!==c(t,i)){n=!1;break}if(n)return s}return-1}function E(e,t,n,i){n=Number(n)||0;const r=e.length-n;i?(i=Number(i))>r&&(i=r):i=r;const s=t.length;let o;for(i>s/2&&(i=s/2),o=0;o<i;++o){const i=parseInt(t.substr(2*o,2),16);if(J(i))return o;e[n+o]=i}return o}function x(e,t,n,i){return X(W(t,e.length-n),e,n,i)}function b(e,t,n,i){return X(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,i)}function C(e,t,n,i){return X(q(t),e,n,i)}function w(e,t,n,i){return X(function(e,t){let n,i,r;const s=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),i=n>>8,r=n%256,s.push(r),s.push(i);return s}(t,e.length-n),e,n,i)}function _(e,t,n){return 0===t&&n===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,n))}function M(e,t,n){n=Math.min(e.length,n);const i=[];let r=t;for(;r<n;){const t=e[r];let s=null,o=t>239?4:t>223?3:t>191?2:1;if(r+o<=n){let n,i,a,l;switch(o){case 1:t<128&&(s=t);break;case 2:n=e[r+1],128==(192&n)&&(l=(31&t)<<6|63&n,l>127&&(s=l));break;case 3:n=e[r+1],i=e[r+2],128==(192&n)&&128==(192&i)&&(l=(15&t)<<12|(63&n)<<6|63&i,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:n=e[r+1],i=e[r+2],a=e[r+3],128==(192&n)&&128==(192&i)&&128==(192&a)&&(l=(15&t)<<18|(63&n)<<12|(63&i)<<6|63&a,l>65535&&l<1114112&&(s=l))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),r+=o}return function(e){const t=e.length;if(t<=S)return String.fromCharCode.apply(String,e);let n="",i=0;for(;i<t;)n+=String.fromCharCode.apply(String,e.slice(i,i+=S));return n}(i)}l.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),l.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}}),l.poolSize=8192,l.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array),l.alloc=function(e,t,n){return function(e,t,n){return h(e),e<=0?a(e):void 0!==t?"string"==typeof n?a(e).fill(t,n):a(e).fill(t):a(e)}(e,t,n)},l.allocUnsafe=function(e){return d(e)},l.allocUnsafeSlow=function(e){return d(e)},l.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==l.prototype},l.compare=function(e,t){if(Y(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=l.from(t,t.offset,t.byteLength)),!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,i=t.length;for(let r=0,s=Math.min(n,i);r<s;++r)if(e[r]!==t[r]){n=e[r],i=t[r];break}return n<i?-1:i<n?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const i=l.allocUnsafe(t);let r=0;for(n=0;n<e.length;++n){let t=e[n];if(Y(t,Uint8Array))r+t.length>i.length?(l.isBuffer(t)||(t=l.from(t)),t.copy(i,r)):Uint8Array.prototype.set.call(i,t,r);else{if(!l.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,r)}r+=t.length}return i},l.byteLength=f,l.prototype._isBuffer=!0,l.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)g(this,t,t+1);return this},l.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},l.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},l.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?M(this,0,e):m.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){let e="";const n=t.IS;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},s&&(l.prototype[s]=l.prototype.inspect),l.prototype.compare=function(e,t,n,i,r){if(Y(e,Uint8Array)&&(e=l.from(e,e.offset,e.byteLength)),!l.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),t<0||n>e.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&t>=n)return 0;if(i>=r)return-1;if(t>=n)return 1;if(this===e)return 0;let s=(r>>>=0)-(i>>>=0),o=(n>>>=0)-(t>>>=0);const a=Math.min(s,o),c=this.slice(i,r),h=e.slice(t,n);for(let e=0;e<a;++e)if(c[e]!==h[e]){s=c[e],o=h[e];break}return s<o?-1:o<s?1:0},l.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},l.prototype.indexOf=function(e,t,n){return v(this,e,t,n,!0)},l.prototype.lastIndexOf=function(e,t,n){return v(this,e,t,n,!1)},l.prototype.write=function(e,t,n,i){if(void 0===t)i="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)i=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}const r=this.length-t;if((void 0===n||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return x(this,e,t,n);case"ascii":case"latin1":case"binary":return b(this,e,t,n);case"base64":return C(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const S=4096;function I(e,t,n){let i="";n=Math.min(e.length,n);for(let r=t;r<n;++r)i+=String.fromCharCode(127&e[r]);return i}function B(e,t,n){let i="";n=Math.min(e.length,n);for(let r=t;r<n;++r)i+=String.fromCharCode(e[r]);return i}function T(e,t,n){const i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);let r="";for(let i=t;i<n;++i)r+=K[e[i]];return r}function R(e,t,n){const i=e.slice(t,n);let r="";for(let e=0;e<i.length-1;e+=2)r+=String.fromCharCode(i[e]+256*i[e+1]);return r}function L(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function D(e,t,n,i,r,s){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<s)throw new RangeError('"value" argument is out of bounds');if(n+i>e.length)throw new RangeError("Index out of range")}function P(e,t,n,i,r){z(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function U(e,t,n,i,r){z(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n+7]=s,s>>=8,e[n+6]=s,s>>=8,e[n+5]=s,s>>=8,e[n+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function O(e,t,n,i,r,s){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(e,t,n,i,s){return t=+t,n>>>=0,s||O(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function k(e,t,n,i,s){return t=+t,n>>>=0,s||O(e,0,n,8),r.write(e,t,n,i,52,8),n+8}l.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const i=this.subarray(e,t);return Object.setPrototypeOf(i,l.prototype),i},l.prototype.readUintLE=l.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let i=this[e],r=1,s=0;for(;++s<t&&(r*=256);)i+=this[e+s]*r;return i},l.prototype.readUintBE=l.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let i=this[e+--t],r=1;for(;t>0&&(r*=256);)i+=this[e+--t]*r;return i},l.prototype.readUint8=l.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readBigUInt64LE=Z((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,r=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(i)+(BigInt(r)<<BigInt(32))})),l.prototype.readBigUInt64BE=Z((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=t*2**24+65536*this[++e]+256*this[++e]+this[++e],r=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(i)<<BigInt(32))+BigInt(r)})),l.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let i=this[e],r=1,s=0;for(;++s<t&&(r*=256);)i+=this[e+s]*r;return r*=128,i>=r&&(i-=Math.pow(2,8*t)),i},l.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let i=t,r=1,s=this[e+--i];for(;i>0&&(r*=256);)s+=this[e+--i]*r;return r*=128,s>=r&&(s-=Math.pow(2,8*t)),s},l.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readBigInt64LE=Z((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),l.prototype.readBigInt64BE=Z((function(e){H(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),l.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),r.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),r.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),r.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),r.read(this,e,!1,52,8)},l.prototype.writeUintLE=l.prototype.writeUIntLE=function(e,t,n,i){e=+e,t>>>=0,n>>>=0,i||D(this,e,t,n,Math.pow(2,8*n)-1,0);let r=1,s=0;for(this[t]=255&e;++s<n&&(r*=256);)this[t+s]=e/r&255;return t+n},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(e,t,n,i){e=+e,t>>>=0,n>>>=0,i||D(this,e,t,n,Math.pow(2,8*n)-1,0);let r=n-1,s=1;for(this[t+r]=255&e;--r>=0&&(s*=256);)this[t+r]=e/s&255;return t+n},l.prototype.writeUint8=l.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,1,255,0),this[t]=255&e,t+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigUInt64LE=Z((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeBigUInt64BE=Z((function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),l.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);D(this,e,t,n,i-1,-i)}let r=0,s=1,o=0;for(this[t]=255&e;++r<n&&(s*=256);)e<0&&0===o&&0!==this[t+r-1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+n},l.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*n-1);D(this,e,t,n,i-1,-i)}let r=n-1,s=1,o=0;for(this[t+r]=255&e;--r>=0&&(s*=256);)e<0&&0===o&&0!==this[t+r+1]&&(o=1),this[t+r]=(e/s|0)-o&255;return t+n},l.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},l.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},l.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},l.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||D(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},l.prototype.writeBigInt64LE=Z((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeBigInt64BE=Z((function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),l.prototype.writeFloatLE=function(e,t,n){return F(this,e,t,!0,n)},l.prototype.writeFloatBE=function(e,t,n){return F(this,e,t,!1,n)},l.prototype.writeDoubleLE=function(e,t,n){return k(this,e,t,!0,n)},l.prototype.writeDoubleBE=function(e,t,n){return k(this,e,t,!1,n)},l.prototype.copy=function(e,t,n,i){if(!l.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);const r=i-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),t),r},l.prototype.fill=function(e,t,n,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!l.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){const t=e.charCodeAt(0);("utf8"===i&&t<128||"latin1"===i)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let r;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(r=t;r<n;++r)this[r]=e;else{const s=l.isBuffer(e)?e:l.from(e,i),o=s.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(r=0;r<n-t;++r)this[r+t]=s[r%o]}return this};const N={};function Q(e,t,n){N[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function G(e){let t="",n=e.length;const i="-"===e[0]?1:0;for(;n>=i+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function z(e,t,n,i,r,s){if(e>n||e<t){const i="bigint"==typeof t?"n":"";let r;throw r=s>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${t}${i} and <= ${n}${i}`,new N.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,n){H(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||V(t,e.length-(n+1))}(i,r,s)}function H(e,t){if("number"!=typeof e)throw new N.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,n){if(Math.floor(e)!==e)throw H(e,n),new N.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new N.ERR_BUFFER_OUT_OF_BOUNDS;throw new N.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}Q("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),Q("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),Q("ERR_OUT_OF_RANGE",(function(e,t,n){let i=`The value of "${e}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=G(String(n)):"bigint"==typeof n&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=G(r)),r+="n"),i+=` It must be ${t}. Received ${r}`,i}),RangeError);const j=/[^+/0-9A-Za-z-_]/g;function W(e,t){let n;t=t||1/0;const i=e.length;let r=null;const s=[];for(let o=0;o<i;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&s.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function q(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(j,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,n,i){let r;for(r=0;r<i&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const K=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const i=16*n;for(let r=0;r<16;++r)t[i+r]=e[n]+e[r]}return t}();function Z(e){return"undefined"==typeof BigInt?$:e}function $(){throw new Error("BigInt not supported")}},9089:e=>{"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n})).join("")},t.i=function(e,n,i,r,s){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(i)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(o[l]=!0)}for(var c=0;c<e.length;c++){var h=[].concat(e[c]);i&&o[h[0]]||(void 0!==s&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=s),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),t.push(h))}},t}},6492:e=>{"use strict";e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},963:e=>{"use strict";e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),s="/*# ".concat(r," */");return[t].concat([s]).join("\n")}return[t].join("\n")}},8878:(e,t,n)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let i=0,r=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(i++,"%c"===e&&(r=i))})),t.splice(r,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(8945)(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},8945:(e,t,n)=>{e.exports=function(e){function t(e){let n,r,s,o=null;function a(...e){if(!a.enabled)return;const i=a,r=Number(new Date),s=r-(n||r);i.diff=s,i.prev=n,i.curr=r,n=r,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,r)=>{if("%%"===n)return"%";o++;const s=t.formatters[r];if("function"==typeof s){const t=e[o];n=s.call(i,t),e.splice(o,1),o--}return n})),t.formatArgs.call(i,e),(i.log||t.log).apply(i,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=i,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(r!==t.namespaces&&(r=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function i(e,n){const i=t(this.namespace+(void 0===n?":":n)+e);return i.log=this.log,i}function r(e,t){let n=0,i=0,r=-1,s=0;for(;n<e.length;)if(i<t.length&&(t[i]===e[n]||"*"===t[i]))"*"===t[i]?(r=i,s=n,i++):(n++,i++);else{if(-1===r)return!1;i=r+1,s++,n=s}for(;i<t.length&&"*"===t[i];)i++;return i===t.length}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names,...t.skips.map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").trim().replace(" ",",").split(",").filter(Boolean);for(const e of n)"-"===e[0]?t.skips.push(e.slice(1)):t.names.push(e)},t.enabled=function(e){for(const n of t.skips)if(r(e,n))return!1;for(const n of t.names)if(r(e,n))return!0;return!1},t.humanize=n(9192),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},1124:(e,t,n)=>{"use strict";var i=n(6240),r=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;function o(e,t,n){var s=t[n];if(null!=s){if(r.call(e,n)&&(void 0===e[n]||null===e[n]))throw new TypeError("Cannot convert undefined or null to object ("+n+")");r.call(e,n)&&i(s)?e[n]=a(Object(e[n]),t[n]):e[n]=s}}function a(e,t){if(e===t)return e;for(var n in t=Object(t))r.call(t,n)&&o(e,t,n);if(Object.getOwnPropertySymbols)for(var i=Object.getOwnPropertySymbols(t),a=0;a<i.length;a++)s.call(t,i[a])&&o(e,t,i[a]);return e}e.exports=function(e){e=function(e){if(null==e)throw new TypeError("Sources cannot be null or undefined");return Object(e)}(e);for(var t=1;t<arguments.length;t++)a(e,arguments[t]);return e}},8480:e=>{e.exports=function(e){switch(e){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},919:(e,t,n)=>{var i;i="undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{},e.exports=i},1024:(e,t)=>{t.read=function(e,t,n,i,r){var s,o,a=8*r-i-1,l=(1<<a)-1,c=l>>1,h=-7,d=n?r-1:0,u=n?-1:1,p=e[t+d];for(d+=u,s=p&(1<<-h)-1,p>>=-h,h+=a;h>0;s=256*s+e[t+d],d+=u,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=i;h>0;o=256*o+e[t+d],d+=u,h-=8);if(0===s)s=1-c;else{if(s===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,i),s-=c}return(p?-1:1)*o*Math.pow(2,s-i)},t.write=function(e,t,n,i,r,s){var o,a,l,c=8*s-r-1,h=(1<<c)-1,d=h>>1,u=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,p=i?0:s-1,A=i?1:-1,f=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+d>=1?u/l:u*Math.pow(2,1-d))*l>=2&&(o++,l/=2),o+d>=h?(a=0,o=h):o+d>=1?(a=(t*l-1)*Math.pow(2,r),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,r),o=0));r>=8;e[n+p]=255&a,p+=A,a/=256,r-=8);for(o=o<<r|a,c+=r;c>0;e[n+p]=255&o,p+=A,o/=256,c-=8);e[n+p-A]|=128*f}},2225:e=>{function t(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}e.exports=function(e){return null!=e&&(t(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&t(e.slice(0,0))}(e)||!!e._isBuffer)}},8847:e=>{e.exports=function(e){if(!e)return!1;var n=t.call(e);return"[object Function]"===n||"function"==typeof e&&"[object RegExp]"!==n||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var t=Object.prototype.toString},6240:e=>{"use strict";e.exports=function(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}},5651:(e,t,n)=>{var i=n(5406),r=n(4597),s=n(5734),o=["x","e","a","o","n","s","r","c","u","m","v","w","z"],a=["m","w"],l=["H","I","N","E","F","K","L","T","U","V","W","X","Y","Z"],c="\t".charCodeAt(0),h=" ".charCodeAt(0);function d(e){this.glyphs=[],this._measure=this.computeMetrics.bind(this),this.update(e)}function u(e){return new Function(["return function "+e+"() {"," return this._"+e,"}"].join("\n"))()}function p(e,t){if(!e.chars||0===e.chars.length)return null;var n=f(e.chars,t);return n>=0?e.chars[n]:null}function A(e,t,n){if(!e.kernings||0===e.kernings.length)return 0;for(var i=e.kernings,r=0;r<i.length;r++){var s=i[r];if(s.first===t&&s.second===n)return s.amount}return 0}function f(e,t,n){for(var i=n=n||0;i<e.length;i++)if(e[i].id===t)return i;return-1}e.exports=function(e){return new d(e)},d.prototype.update=function(e){if(e=r({measure:this._measure},e),this._opt=e,this._opt.tabSize=s(this._opt.tabSize,4),!e.font)throw new Error("must provide a valid bitmap font");var t=this.glyphs,n=e.text||"",a=e.font;this._setupSpaceGlyphs(a);var c=i.lines(n,e),h=e.width||0;t.length=0;var d=c.reduce((function(e,t){return Math.max(e,t.width,h)}),0),u=0,p=0,m=s(e.lineHeight,a.common.lineHeight),g=a.common.base,v=m-g,y=e.letterSpacing||0,E=m*c.length-v,x=function(e){return"center"===e?1:"right"===e?2:0}(this._opt.align);p-=E,this._width=d,this._height=E,this._descender=m-g,this._baseline=g,this._xHeight=function(e){for(var t=0;t<o.length;t++){var n=o[t].charCodeAt(0),i=f(e.chars,n);if(i>=0)return e.chars[i].height}return 0}(a),this._capHeight=function(e){for(var t=0;t<l.length;t++){var n=l[t].charCodeAt(0),i=f(e.chars,n);if(i>=0)return e.chars[i].height}return 0}(a),this._lineHeight=m,this._ascender=m-v-this._xHeight;var b=this;c.forEach((function(e,i){for(var r,s=e.start,o=e.end,l=e.width,c=s;c<o;c++){var h=n.charCodeAt(c),f=b.getGlyph(a,h);if(f){r&&(u+=A(a,r.id,f.id));var g=u;1===x?g+=(d-l)/2:2===x&&(g+=d-l),t.push({position:[g,p],data:f,index:c,line:i}),u+=f.xadvance+y,r=f}}p+=m,u=0})),this._linesTotal=c.length},d.prototype._setupSpaceGlyphs=function(e){if(this._fallbackSpaceGlyph=null,this._fallbackTabGlyph=null,e.chars&&0!==e.chars.length){var t=p(e,h)||function(e){for(var t=0;t<a.length;t++){var n=a[t].charCodeAt(0),i=f(e.chars,n);if(i>=0)return e.chars[i]}return 0}(e)||e.chars[0],n=this._opt.tabSize*t.xadvance;this._fallbackSpaceGlyph=t,this._fallbackTabGlyph=r(t,{x:0,y:0,xadvance:n,id:c,xoffset:0,yoffset:0,width:0,height:0})}},d.prototype.getGlyph=function(e,t){return p(e,t)||(t===c?this._fallbackTabGlyph:t===h?this._fallbackSpaceGlyph:null)},d.prototype.computeMetrics=function(e,t,n,i){var r,s=this._opt.letterSpacing||0,o=this._opt.font,a=0,l=0,c=0;if(!o.chars||0===o.chars.length)return{start:t,end:t,width:0};n=Math.min(e.length,n);for(var h=t;h<n;h++){var d,u=e.charCodeAt(h);if(d=this.getGlyph(o,u)){d.xoffset;var p=(a+=r?A(o,r.id,d.id):0)+d.xadvance+s,f=a+d.width;if(f>=i||p>=i)break;a=p,l=f,r=d}c++}return r&&(l+=r.xoffset),{start:t,end:t+c,width:l}},["width","height","descender","ascender","xHeight","baseline","capHeight","lineHeight"].forEach((function(e){Object.defineProperty(d.prototype,e,{get:u(e),configurable:!0})}))},5751:(e,t,n)=>{var i=n(9922).hp,r=n(3558),s=function(){},o=n(1476),a=n(7034),l=n(7480),c=n(573),h=n(4597),d=self.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest;e.exports=function(e,t){t="function"==typeof t?t:s,"string"==typeof e?e={uri:e}:e||(e={}),e.binary&&(e=function(e){if(d)return h(e,{responseType:"arraybuffer"});if(void 0===self.XMLHttpRequest)throw new Error("your browser does not support XHR loading");var t=new self.XMLHttpRequest;return t.overrideMimeType("text/plain; charset=x-user-defined"),h({xhr:t},e)}(e)),r(e,(function(n,r,h){if(n)return t(n);if(!/^2/.test(r.statusCode))return t(new Error("http status code: "+r.statusCode));if(!h)return t(new Error("no body result"));var d,u,p=!1;if(d=h,"[object ArrayBuffer]"===Object.prototype.toString.call(d)){var A=new Uint8Array(h);h=i.from(A,"binary")}c(h)&&(p=!0,"string"==typeof h&&(h=i.from(h,"binary"))),p||(i.isBuffer(h)&&(h=h.toString(e.encoding)),h=h.trim());try{var f=r.headers["content-type"];u=p?l(h):/json/.test(f)||"{"===h.charAt(0)?JSON.parse(h):/xml/.test(f)||"<"===h.charAt(0)?a(h):o(h)}catch(e){t(new Error("error parsing font "+e.message)),t=s}t(null,u)}))}},573:(e,t,n)=>{var i=n(9922).hp,r=n(911),s=i.from([66,77,70,3]);e.exports=function(e){return"string"==typeof e?"BMF"===e.substring(0,3):e.length>4&&r(e.slice(0,4),s)}},9192:e=>{var t=1e3,n=60*t,i=60*n,r=24*i,s=7*r;function o(e,t,n,i){var r=t>=1.5*n;return Math.round(e/n)+" "+i+(r?"s":"")}e.exports=function(e,a){a=a||{};var l,c,h=typeof e;if("string"===h&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(o){var a=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return a*s;case"days":case"day":case"d":return a*r;case"hours":case"hour":case"hrs":case"hr":case"h":return a*i;case"minutes":case"minute":case"mins":case"min":case"m":return a*n;case"seconds":case"second":case"secs":case"sec":case"s":return a*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(e);if("number"===h&&isFinite(e))return a.long?(l=e,(c=Math.abs(l))>=r?o(l,c,r,"day"):c>=i?o(l,c,i,"hour"):c>=n?o(l,c,n,"minute"):c>=t?o(l,c,t,"second"):l+" ms"):function(e){var s=Math.abs(e);return s>=r?Math.round(e/r)+"d":s>=i?Math.round(e/i)+"h":s>=n?Math.round(e/n)+"m":s>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},1476:e=>{function t(e,t){if(!(e=e.replace(/\t+/g," ").trim()))return null;var i=e.indexOf(" ");if(-1===i)throw new Error("no named row at line "+t);var r=e.substring(0,i);e=(e=(e=(e=e.substring(i+1)).replace(/letter=[\'\"]\S+[\'\"]/gi,"")).split("=")).map((function(e){return e.trim().match(/(".*?"|[^"\s]+)+(?=\s*|\s*$)/g)}));for(var s=[],o=0;o<e.length;o++){var a=e[o];0===o?s.push({key:a[0],data:""}):o===e.length-1?s[s.length-1].data=n(a[0]):(s[s.length-1].data=n(a[0]),s.push({key:a[1],data:""}))}var l={key:r,data:{}};return s.forEach((function(e){l.data[e.key]=e.data})),l}function n(e){return e&&0!==e.length?0===e.indexOf('"')||0===e.indexOf("'")?e.substring(1,e.length-1):-1!==e.indexOf(",")?function(e){return e.split(",").map((function(e){return parseInt(e,10)}))}(e):parseInt(e,10):""}e.exports=function(e){if(!e)throw new Error("no data provided");var n={pages:[],chars:[],kernings:[]},i=(e=e.toString().trim()).split(/\r\n?|\n/g);if(0===i.length)throw new Error("no data in BMFont file");for(var r=0;r<i.length;r++){var s=t(i[r],r);if(s)if("page"===s.key){if("number"!=typeof s.data.id)throw new Error("malformed file at line "+r+" -- needs page id=N");if("string"!=typeof s.data.file)throw new Error("malformed file at line "+r+' -- needs page file="path"');n.pages[s.data.id]=s.data.file}else"chars"===s.key||"kernings"===s.key||("char"===s.key?n.chars.push(s.data):"kerning"===s.key?n.kernings.push(s.data):n[s.key]=s.data)}return n}},7480:e=>{var t=[66,77,70];function n(e,t,n){if(n>t.length-1)return 0;var r=t.readUInt8(n++),s=t.readInt32LE(n);switch(n+=4,r){case 1:e.info=function(e,t){var n={};n.size=e.readInt16LE(t);var r=e.readUInt8(t+2);return n.smooth=r>>7&1,n.unicode=r>>6&1,n.italic=r>>5&1,n.bold=r>>4&1,r>>3&1&&(n.fixedHeight=1),n.charset=e.readUInt8(t+3)||"",n.stretchH=e.readUInt16LE(t+4),n.aa=e.readUInt8(t+6),n.padding=[e.readInt8(t+7),e.readInt8(t+8),e.readInt8(t+9),e.readInt8(t+10)],n.spacing=[e.readInt8(t+11),e.readInt8(t+12)],n.outline=e.readUInt8(t+13),n.face=function(e,t){return i(e,t).toString("utf8")}(e,t+14),n}(t,n);break;case 2:e.common=function(e,t){var n={};return n.lineHeight=e.readUInt16LE(t),n.base=e.readUInt16LE(t+2),n.scaleW=e.readUInt16LE(t+4),n.scaleH=e.readUInt16LE(t+6),n.pages=e.readUInt16LE(t+8),e.readUInt8(t+10),n.packed=0,n.alphaChnl=e.readUInt8(t+11),n.redChnl=e.readUInt8(t+12),n.greenChnl=e.readUInt8(t+13),n.blueChnl=e.readUInt8(t+14),n}(t,n);break;case 3:e.pages=function(e,t,n){for(var r=[],s=i(e,t),o=s.length+1,a=n/o,l=0;l<a;l++)r[l]=e.slice(t,t+s.length).toString("utf8"),t+=o;return r}(t,n,s);break;case 4:e.chars=function(e,t,n){for(var i=[],r=n/20,s=0;s<r;s++){var o={},a=20*s;o.id=e.readUInt32LE(t+0+a),o.x=e.readUInt16LE(t+4+a),o.y=e.readUInt16LE(t+6+a),o.width=e.readUInt16LE(t+8+a),o.height=e.readUInt16LE(t+10+a),o.xoffset=e.readInt16LE(t+12+a),o.yoffset=e.readInt16LE(t+14+a),o.xadvance=e.readInt16LE(t+16+a),o.page=e.readUInt8(t+18+a),o.chnl=e.readUInt8(t+19+a),i[s]=o}return i}(t,n,s);break;case 5:e.kernings=function(e,t,n){for(var i=[],r=n/10,s=0;s<r;s++){var o={},a=10*s;o.first=e.readUInt32LE(t+0+a),o.second=e.readUInt32LE(t+4+a),o.amount=e.readInt16LE(t+8+a),i[s]=o}return i}(t,n,s)}return 5+s}function i(e,t){for(var n=t;n<e.length&&0!==e[n];n++);return e.slice(t,n)}e.exports=function(e){if(e.length<6)throw new Error("invalid buffer length for BMFont");var i=t.every((function(t,n){return e.readUInt8(n)===t}));if(!i)throw new Error("BMFont missing BMF byte header");var r=3;if(e.readUInt8(r++)>3)throw new Error("Only supports BMFont Binary v3 (BMFont App v1.10)");for(var s={kernings:[],chars:[]},o=0;o<5;o++)r+=n(s,e,r);return s}},7034:(e,t,n)=>{var i=n(7829),r=n(1896),s={scaleh:"scaleH",scalew:"scaleW",stretchh:"stretchH",lineheight:"lineHeight",alphachnl:"alphaChnl",redchnl:"redChnl",greenchnl:"greenChnl",bluechnl:"blueChnl"};function o(e){var t=function(e){for(var t=[],n=0;n<e.attributes.length;n++)t.push(e.attributes[n]);return t}(e);return t.reduce((function(e,t){var n;return e[(n=t.nodeName,s[n.toLowerCase()]||n)]=t.nodeValue,e}),{})}e.exports=function(e){e=e.toString();var t=r(e),n={pages:[],chars:[],kernings:[]};["info","common"].forEach((function(e){var r=t.getElementsByTagName(e)[0];r&&(n[e]=i(o(r)))}));var s=t.getElementsByTagName("pages")[0];if(!s)throw new Error("malformed file -- no <pages> element");for(var a=s.getElementsByTagName("page"),l=0;l<a.length;l++){var c=a[l],h=parseInt(c.getAttribute("id"),10),d=c.getAttribute("file");if(isNaN(h))throw new Error('malformed file -- page "id" attribute is NaN');if(!d)throw new Error('malformed file -- needs page "file" attribute');n.pages[parseInt(h,10)]=d}return["chars","kernings"].forEach((function(e){var r=t.getElementsByTagName(e)[0];if(r)for(var s=e.substring(0,e.length-1),a=r.getElementsByTagName(s),l=0;l<a.length;l++){var c=a[l];n[e].push(i(o(c)))}})),n}},7829:e=>{var t="chasrset";e.exports=function(e){for(var n in e=Object.assign({},e),t in e&&(e.charset=e[t],delete e[t]),e)"face"!==n&&"charset"!==n&&(e[n]="padding"===n||"spacing"===n?e[n].split(",").map((function(e){return parseInt(e,10)})):parseInt(e[n],10));return e}},3216:e=>{var t=function(e){return e.replace(/^\s+|\s+$/g,"")};e.exports=function(e){if(!e)return{};for(var n,i={},r=t(e).split("\n"),s=0;s<r.length;s++){var o=r[s],a=o.indexOf(":"),l=t(o.slice(0,a)).toLowerCase(),c=t(o.slice(a+1));void 0===i[l]?i[l]=c:(n=i[l],"[object Array]"===Object.prototype.toString.call(n)?i[l].push(c):i[l]=[i[l],c])}return i}},9035:(e,t,n)=>{var i=n(8480),r=n(8167),s=n(2225),o=[0,2,3],a=[2,1,3];e.exports=function(e,t){e&&(r(e)||s(e))||(t=e||{},e=null);for(var n="string"==typeof(t="number"==typeof t?{count:t}:t||{}).type?t.type:"uint16",l="number"==typeof t.count?t.count:1,c=t.start||0,h=!1!==t.clockwise?o:a,d=h[0],u=h[1],p=h[2],A=6*l,f=e||new(i(n))(A),m=0,g=0;m<A;m+=6,g+=4){var v=m+c;f[v+0]=g+0,f[v+1]=g+1,f[v+2]=g+2,f[v+3]=g+d,f[v+4]=g+u,f[v+5]=g+p}return f}},4635:(e,t,n)=>{"use strict";n.d(t,{A:()=>ve});var i={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0},r={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},s=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective"],o={CSS:{},springs:{}};function a(e,t,n){return Math.min(Math.max(e,t),n)}function l(e,t){return e.indexOf(t)>-1}function c(e,t){return e.apply(null,t)}var h=/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i,d=/^rgb/,u=/^hsl/,p={arr:function(e){return Array.isArray(e)},obj:function(e){return l(Object.prototype.toString.call(e),"Object")},pth:function(e){return p.obj(e)&&e.hasOwnProperty("totalLength")},svg:function(e){return e instanceof SVGElement},inp:function(e){return e instanceof HTMLInputElement},dom:function(e){return e.nodeType||p.svg(e)},str:function(e){return"string"==typeof e},fnc:function(e){return"function"==typeof e},und:function(e){return void 0===e},hex:function(e){return h.test(e)},rgb:function(e){return d.test(e)},hsl:function(e){return u.test(e)},col:function(e){return p.hex(e)||p.rgb(e)||p.hsl(e)},key:function(e){return!i.hasOwnProperty(e)&&!r.hasOwnProperty(e)&&"targets"!==e&&"keyframes"!==e}},A=/\(([^)]+)\)/;function f(e){var t=A.exec(e);return t?t[1].split(",").map((function(e){return parseFloat(e)})):[]}function m(e,t){var n=f(e),i=a(p.und(n[0])?1:n[0],.1,100),r=a(p.und(n[1])?100:n[1],.1,100),s=a(p.und(n[2])?10:n[2],.1,100),l=a(p.und(n[3])?0:n[3],.1,100),c=Math.sqrt(r/i),h=s/(2*Math.sqrt(r*i)),d=h<1?c*Math.sqrt(1-h*h):0,u=h<1?(h*c-l)/d:-l+c;function A(e){var n=t?t*e/1e3:e;return n=h<1?Math.exp(-n*h*c)*(1*Math.cos(d*n)+u*Math.sin(d*n)):(1+u*n)*Math.exp(-n*c),0===e||1===e?e:1-n}return t?A:function(){var t=o.springs[e];if(t)return t;for(var n=1/6,i=0,r=0;;)if(1===A(i+=n)){if(++r>=16)break}else r=0;var s=i*n*1e3;return o.springs[e]=s,s}}function g(e,t){void 0===e&&(e=1),void 0===t&&(t=.5);var n=a(e,1,10),i=a(t,.1,2);return function(e){return 0===e||1===e?e:-n*Math.pow(2,10*(e-1))*Math.sin((e-1-i/(2*Math.PI)*Math.asin(1/n))*(2*Math.PI)/i)}}function v(e){return void 0===e&&(e=10),function(t){return Math.round(t*e)*(1/e)}}var y=function(){var e=.1;function t(e,t){return 1-3*t+3*e}function n(e,t){return 3*t-6*e}function i(e){return 3*e}function r(e,r,s){return((t(r,s)*e+n(r,s))*e+i(r))*e}function s(e,r,s){return 3*t(r,s)*e*e+2*n(r,s)*e+i(r)}return function(t,n,i,o){if(0<=t&&t<=1&&0<=i&&i<=1){var a=new Float32Array(11);if(t!==n||i!==o)for(var l=0;l<11;++l)a[l]=r(l*e,t,i);return function(l){return t===n&&i===o||0===l||1===l?l:r(function(n){for(var o=0,l=1;10!==l&&a[l]<=n;++l)o+=e;--l;var c=o+(n-a[l])/(a[l+1]-a[l])*e,h=s(c,t,i);return h>=.001?function(e,t,n,i){for(var o=0;o<4;++o){var a=s(t,n,i);if(0===a)return t;t-=(r(t,n,i)-e)/a}return t}(n,c,t,i):0===h?c:function(e,t,n,i,s){var o,a,l=0;do{(o=r(a=t+(n-t)/2,i,s)-e)>0?n=a:t=a}while(Math.abs(o)>1e-7&&++l<10);return a}(n,o,o+e,t,i)}(l),n,o)}}}}(),E=function(){var e=["Quad","Cubic","Quart","Quint","Sine","Expo","Circ","Back","Elastic"],t={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],g],Out:[[.25,.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(e,t){return function(n){return 1-g(e,t)(1-n)}}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(e,t){return function(n){return n<.5?g(e,t)(2*n)/2:1-g(e,t)(-2*n+2)/2}}]},n={linear:[.25,.25,.75,.75]};for(var i in t)for(var r=0,s=t[i].length;r<s;r++)n["ease"+i+e[r]]=t[i][r];return n}();function x(e,t){if(p.fnc(e))return e;var n=e.split("(")[0],i=E[n],r=f(e);switch(n){case"spring":return m(e,t);case"cubicBezier":return c(y,r);case"steps":return c(v,r);default:return p.fnc(i)?c(i,r):c(y,i)}}function b(e){try{return document.querySelectorAll(e)}catch(e){return}}var C=[];function w(e,t){for(var n=C,i=e.length,r=arguments.length>=2?arguments[1]:void 0,s=0;s<i;s++)if(s in e){var o=e[s];t.call(r,o,s,e)&&n.push(o)}return(C=e).length=0,n}function _(e,t){t||(t=[]);for(var n=0,i=e.length;n<i;n++){var r=e[n];Array.isArray(r)?_(r,t):t.push(r)}return t}function M(e){return p.arr(e)?e:(p.str(e)&&(e=b(e)||e),e instanceof NodeList||e instanceof HTMLCollection?[].slice.call(e):[e])}function S(e,t){return e.some((function(e){return e===t}))}function I(e){var t={};for(var n in e)t[n]=e[n];return t}function B(e,t){var n=I(e);for(var i in e)n[i]=t.hasOwnProperty(i)?t[i]:e[i];return n}function T(e,t){var n=I(e);for(var i in t)n[i]=p.und(e[i])?t[i]:e[i];return n}var R=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g,L=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,D=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,P=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g,U=/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g;var O=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/;function F(e){var t=O.exec(e);if(t)return t[2]}function k(e,t){return p.fnc(e)?e(t.target,t.id,t.total):e}function N(e,t){return e.getAttribute(t)}function Q(e,t,n){if(S([n,"deg","rad","turn"],F(t)))return t;var i=o.CSS[t+n];if(!p.und(i))return i;var r=document.createElement(e.tagName),s=e.parentNode&&e.parentNode!==document?e.parentNode:document.body;s.appendChild(r),r.style.position="absolute",r.style.width=100+n;var a=100/r.offsetWidth;s.removeChild(r);var l=a*parseFloat(t);return o.CSS[t+n]=l,l}function G(e,t,n){if(t in e.style){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=e.style[t]||getComputedStyle(e).getPropertyValue(i)||"0";return n?Q(e,r,n):r}}function z(e,t){return p.dom(e)&&!p.inp(e)&&(N(e,t)||p.svg(e)&&e[t])?"attribute":p.dom(e)&&S(s,t)?"transform":p.dom(e)&&"transform"!==t&&G(e,t)?"css":null!=e[t]?"object":void 0}var H=/(\w+)\(([^)]*)\)/g;function V(e){if(p.dom(e)){for(var t,n=e.style.transform||"",i=new Map;t=H.exec(n);)i.set(t[1],t[2]);return i}}function j(e,t,n,i){switch(z(e,t)){case"transform":return function(e,t,n,i){var r=l(t,"scale")?1:0+function(e){return l(e,"translate")||"perspective"===e?"px":l(e,"rotate")||l(e,"skew")?"deg":void 0}(t),s=V(e).get(t)||r;return n&&(n.transforms.list.set(t,s),n.transforms.last=t),i?Q(e,s,i):s}(e,t,i,n);case"css":return G(e,t,n);case"attribute":return N(e,t);default:return e[t]||0}}var W=/^(\*=|\+=|-=)/;function q(e,t){var n=W.exec(e);if(!n)return e;var i=F(e)||0,r=parseFloat(t),s=parseFloat(e.replace(n[0],""));switch(n[0][0]){case"+":return r+s+i;case"-":return r-s+i;case"*":return r*s+i}}var X=/\s/g;function Y(e,t){if(p.col(e))return function(e){return p.rgb(e)?(t=e,(n=R.exec(t))?"rgba("+n[1]+",1)":t):p.hex(e)?function(e){var t=e.replace(L,(function(e,t,n,i){return t+t+n+n+i+i})),n=D.exec(t);return"rgba("+parseInt(n[1],16)+","+parseInt(n[2],16)+","+parseInt(n[3],16)+",1)"}(e):p.hsl(e)?function(e){var t,n,i,r=P.exec(e)||U.exec(e),s=parseInt(r[1],10)/360,o=parseInt(r[2],10)/100,a=parseInt(r[3],10)/100,l=r[4]||1;function c(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+(t-e)*(2/3-n)*6:e}if(0==o)t=n=i=a;else{var h=a<.5?a*(1+o):a+o-a*o,d=2*a-h;t=c(d,h,s+1/3),n=c(d,h,s),i=c(d,h,s-1/3)}return"rgba("+255*t+","+255*n+","+255*i+","+l+")"}(e):void 0;var t,n}(e);var n=F(e),i=n?e.substr(0,e.length-n.length):e;return t&&!X.test(e)?i+t:i}function J(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function K(e){for(var t,n=e.points,i=0,r=0;r<n.numberOfItems;r++){var s=n.getItem(r);r>0&&(i+=J(t,s)),t=s}return i}function Z(e){if(e.getTotalLength)return e.getTotalLength();switch(e.tagName.toLowerCase()){case"circle":return function(e){return 2*Math.PI*N(e,"r")}(e);case"rect":return function(e){return 2*N(e,"width")+2*N(e,"height")}(e);case"line":return function(e){return J({x:N(e,"x1"),y:N(e,"y1")},{x:N(e,"x2"),y:N(e,"y2")})}(e);case"polyline":return K(e);case"polygon":return function(e){var t=e.points;return K(e)+J(t.getItem(t.numberOfItems-1),t.getItem(0))}(e)}}function $(e,t){var n=t||{},i=n.el||function(e){for(var t=e.parentNode;p.svg(t)&&(t=t.parentNode,p.svg(t.parentNode)););return t}(e),r=i.getBoundingClientRect(),s=N(i,"viewBox"),o=r.width,a=r.height,l=n.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:i,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function ee(e,t){function n(n){void 0===n&&(n=0);var i=t+n>=1?t+n:0;return e.el.getPointAtLength(i)}var i=$(e.el,e.svg),r=n(),s=n(-1),o=n(1);switch(e.property){case"x":return(r.x-i.x)*i.w;case"y":return(r.y-i.y)*i.h;case"angle":return 180*Math.atan2(o.y-s.y,o.x-s.x)/Math.PI}}var te=/-?\d*\.?\d+/g;function ne(e,t){var n=Y(p.pth(e)?e.totalLength:e,t)+"";return{original:n,numbers:n.match(te)?n.match(te).map(Number):[0],strings:p.str(e)||t?n.split(te):[]}}function ie(e){return w(e?_(p.arr(e)?e.map(M):M(e)):[],(function(e,t,n){return n.indexOf(e)===t}))}function re(e){var t=ie(e);return t.map((function(e,n){return{target:e,id:n,total:t.length,transforms:{list:V(e)}}}))}var se=/^spring/;function oe(e,t){var n=I(t);if(se.test(n.easing)&&(n.duration=m(n.easing)),p.arr(e)){var i=e.length;2!==i||p.obj(e[0])?p.fnc(t.duration)||(n.duration=t.duration/i):e={value:e}}var r=p.arr(e)?e:[e];return r.map((function(e,n){var i=p.obj(e)&&!p.pth(e)?e:{value:e};return p.und(i.delay)&&(i.delay=n?0:t.delay),p.und(i.endDelay)&&(i.endDelay=n===r.length-1?t.endDelay:0),i})).map((function(e){return T(e,n)}))}var ae={css:function(e,t,n){return e.style[t]=n},attribute:function(e,t,n){return e.setAttribute(t,n)},object:function(e,t,n){return e[t]=n},transform:function(e,t,n,i,r){if(i.list.set(t,n),t===i.last||r){var s="";i.list.forEach((function(e,t){s+=t+"("+e+") "})),e.style.transform=s}}};function le(e,t){for(var n=re(e),i=0,r=n.length;i<r;i++){var s=n[i];for(var o in t){var a=k(t[o],s),l=s.target,c=F(a),h=j(l,o,c,s),d=q(Y(a,c||F(h)),h),u=z(l,o);ae[u](l,o,d,s.transforms,!0)}}}function ce(e,t){return w(_(e.map((function(e){return t.map((function(t){return function(e,t){var n=z(e.target,t.name);if(n){var i=function(e,t){var n;return e.tweens.map((function(i){var r=function(e,t){var n={};for(var i in e){var r=k(e[i],t);p.arr(r)&&1===(r=r.map((function(e){return k(e,t)}))).length&&(r=r[0]),n[i]=r}return n.duration=parseFloat(n.duration),n.delay=parseFloat(n.delay),n}(i,t),s=r.value,o=p.arr(s)?s[1]:s,a=F(o),l=j(t.target,e.name,a,t),c=n?n.to.original:l,h=p.arr(s)?s[0]:c,d=F(h)||F(l),u=a||d;return p.und(o)&&(o=c),r.from=ne(h,u),r.to=ne(q(o,h),u),r.start=n?n.end:0,r.end=r.start+r.delay+r.duration+r.endDelay,r.easing=x(r.easing,r.duration),r.isPath=p.pth(s),r.isColor=p.col(r.from.original),r.isColor&&(r.round=1),n=r,r}))}(t,e),r=i[i.length-1];return{type:n,property:t.name,animatable:e,tweens:i,duration:r.end,delay:i[0].delay,endDelay:r.endDelay}}}(e,t)}))}))),(function(e){return!p.und(e)}))}function he(e,t){var n=e.length,i=function(e){return e.timelineOffset?e.timelineOffset:0},r={};return r.duration=n?Math.max.apply(Math,e.map((function(e){return i(e)+e.duration}))):t.duration,r.delay=n?Math.min.apply(Math,e.map((function(e){return i(e)+e.delay}))):t.delay,r.endDelay=n?r.duration-Math.max.apply(Math,e.map((function(e){return i(e)+e.duration-e.endDelay}))):t.endDelay,r}var de,ue=0,pe=[],Ae=[],fe=function(){function e(){de=requestAnimationFrame(t)}function t(t){var n=pe.length;if(n){for(var i=0;i<n;){var r=pe[i];if(r.paused){var s=pe.indexOf(r);s>-1&&(pe.splice(s,1),n=pe.length)}else r.tick(t);i++}e()}else de=cancelAnimationFrame(de)}return e}();function me(e){void 0===e&&(e={});var t,n=0,s=0,o=0,l=0,c=null;function h(){return window.Promise&&new Promise((function(e){return c=e}))}var d=h(),u=function(e){var t=B(i,e),n=B(r,e),s=function(e,t){var n=[],i=t.keyframes;for(var r in i&&(t=T(function(e){for(var t=w(_(e.map((function(e){return Object.keys(e)}))),(function(e){return p.key(e)})).reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[]),n={},i=function(i){var r=t[i];n[r]=e.map((function(e){var t={};for(var n in e)p.key(n)?n==r&&(t.value=e[n]):t[n]=e[n];return t}))},r=0;r<t.length;r++)i(r);return n}(i),t)),t)p.key(r)&&n.push({name:r,tweens:oe(t[r],e)});return n}(n,e),o=re(e.targets),a=ce(o,s),l=he(a,n),c=ue;return ue++,T(t,{id:c,children:[],animatables:o,animations:a,duration:l.duration,delay:l.delay,endDelay:l.endDelay})}(e);function A(){u.reversed=!u.reversed;for(var e=0,n=t.length;e<n;e++)t[e].reversed=u.reversed}function f(e){return u.reversed?u.duration-e:e}function m(){n=0,s=f(u.currentTime)*(1/me.speed)}function g(e,t){t&&t.seek(e-t.timelineOffset)}function v(e){for(var t=0,n=u.animations,i=n.length;t<i;){var r=n[t],s=r.animatable,o=r.tweens,l=o.length-1,c=o[l];l&&(c=w(o,(function(t){return e<t.end}))[0]||c);for(var h=a(e-c.start-c.delay,0,c.duration)/c.duration,d=isNaN(h)?1:c.easing(h),p=c.to.strings,A=c.round,f=[],m=c.to.numbers.length,g=void 0,v=0;v<m;v++){var y=void 0,E=c.to.numbers[v],x=c.from.numbers[v]||0;y=c.isPath?ee(c.value,d*E):x+d*(E-x),A&&(c.isColor&&v>2||(y=Math.round(y*A)/A)),f.push(y)}var b=p.length;if(b){g=p[0];for(var C=0;C<b;C++){p[C];var _=p[C+1],M=f[C];isNaN(M)||(g+=_?M+_:M+" ")}}else g=f[0];ae[r.type](s.target,r.property,g,s.transforms),r.currentValue=g,t++}}function y(e){u[e]&&!u.passThrough&&u[e](u)}function E(e){var i=u.duration,r=u.delay,p=i-u.endDelay,m=f(e);u.progress=a(m/i*100,0,100),u.reversePlayback=m<u.currentTime,t&&function(e){if(u.reversePlayback)for(var n=l;n--;)g(e,t[n]);else for(var i=0;i<l;i++)g(e,t[i])}(m),!u.began&&u.currentTime>0&&(u.began=!0,y("begin"),y("loopBegin")),m<=r&&0!==u.currentTime&&v(0),(m>=p&&u.currentTime!==i||!i)&&v(i),m>r&&m<p?(u.changeBegan||(u.changeBegan=!0,u.changeCompleted=!1,y("changeBegin")),y("change"),v(m)):u.changeBegan&&(u.changeCompleted=!0,u.changeBegan=!1,y("changeComplete")),u.currentTime=a(m,0,i),u.began&&y("update"),e>=i&&(s=0,u.remaining&&!0!==u.remaining&&u.remaining--,u.remaining?(n=o,y("loopComplete"),y("loopBegin"),"alternate"===u.direction&&A()):(u.paused=!0,u.completed||(u.completed=!0,y("loopComplete"),y("complete"),"Promise"in window&&(c(),d=h()))))}return u.reset=function(){var e=u.direction;u.passThrough=!1,u.currentTime=0,u.progress=0,u.paused=!0,u.began=!1,u.changeBegan=!1,u.completed=!1,u.changeCompleted=!1,u.reversePlayback=!1,u.reversed="reverse"===e,u.remaining=u.loop,t=u.children;for(var n=l=t.length;n--;)u.children[n].reset();(u.reversed&&!0!==u.loop||"alternate"===e&&1===u.loop)&&u.remaining++,v(0)},u.set=function(e,t){return le(e,t),u},u.tick=function(e){o=e,n||(n=o),E((o+(s-n))*me.speed)},u.seek=function(e){E(f(e))},u.pause=function(){u.paused=!0,m()},u.play=function(){u.paused&&(u.paused=!1,pe.push(u),m(),de||fe())},u.reverse=function(){A(),m()},u.restart=function(){u.reset(),u.play()},u.finished=d,u.reset(),u.autoplay&&u.play(),u}function ge(e,t){for(var n=t.length;n--;)S(e,t[n].animatable.target)&&t.splice(n,1)}document.addEventListener("visibilitychange",(function(){if(document.hidden){for(var e=0,t=pe.length;e<t;e++)activeInstance[e].pause();Ae=pe.slice(0),pe=[]}else for(var n=0,i=Ae.length;n<i;n++)Ae[n].play()})),me.version="3.0.0",me.speed=1,me.running=pe,me.remove=function(e){for(var t=ie(e),n=pe.length;n--;){var i=pe[n],r=i.animations,s=i.children;ge(t,r);for(var o=s.length;o--;){var a=s[o],l=a.animations;ge(t,l),l.length||a.children.length||s.splice(o,1)}r.length||s.length||i.pause()}},me.get=j,me.set=le,me.convertPx=Q,me.path=function(e,t){var n=p.str(e)?b(e)[0]:e,i=t||100;return function(e){return{property:e,el:n,svg:$(n),totalLength:Z(n)*(i/100)}}},me.setDashoffset=function(e){var t=Z(e);return e.setAttribute("stroke-dasharray",t),t},me.stagger=function(e,t){void 0===t&&(t={});var n=t.direction||"normal",i=t.easing?x(t.easing):null,r=t.grid,s=t.axis,o=t.from||0,a="first"===o,l="center"===o,c="last"===o,h=p.arr(e),d=h?parseFloat(e[0]):parseFloat(e),u=h?parseFloat(e[1]):0,A=F(h?e[1]:e)||0,f=t.start||0+(h?d:0),m=[],g=0;return function(e,t,p){if(a&&(o=0),l&&(o=(p-1)/2),c&&(o=p-1),!m.length){for(var v=0;v<p;v++){if(r){var y=l?(r[0]-1)/2:o%r[0],E=l?(r[1]-1)/2:Math.floor(o/r[0]),x=y-v%r[0],b=E-Math.floor(v/r[0]),C=Math.sqrt(x*x+b*b);"x"===s&&(C=-x),"y"===s&&(C=-b),m.push(C)}else m.push(Math.abs(o-v));g=Math.max.apply(Math,m)}i&&(m=m.map((function(e){return i(e/g)*g}))),"reverse"===n&&(m=m.map((function(e){return s?e<0?-1*e:-e:Math.abs(g-e)})))}return f+(h?(u-d)/g:d)*(Math.round(100*m[t])/100)+A}},me.timeline=function(e){void 0===e&&(e={});var t=me(e);return t.duration=0,t.add=function(n,i){var s=pe.indexOf(t),o=t.children;function a(e){e.passThrough=!0}s>-1&&pe.splice(s,1);for(var l=0;l<o.length;l++)a(o[l]);var c=T(n,B(r,e));c.targets=c.targets||e.targets;var h=t.duration;c.autoplay=!1,c.direction=t.direction,c.timelineOffset=p.und(i)?h:q(i,h),a(t),t.seek(c.timelineOffset);var d=me(c);a(d),o.push(d);var u=he(o,e);return t.delay=u.delay,t.endDelay=u.endDelay,t.duration=u.duration,t.seek(0),t.reset(),t.autoplay&&t.play(),t},t},me.easing=x,me.penner=E,me.random=function(e,t){return Math.floor(Math.random()*(t-e+1))+e};const ve=me},4433:(e,t,n)=>{var i=n(5651),r=n(9035),s=n(7106),o=n(1684);e.exports=function(e){return new a(e)};class a extends THREE.BufferGeometry{constructor(e){super(),"string"==typeof e&&(e={text:e}),this._opt=Object.assign({},e),e&&this.update(e)}update(e){if("string"==typeof e&&(e={text:e}),!(e=Object.assign({},this._opt,e)).font)throw new TypeError("must specify a { font } in options");this.layout=i(e);var t=!1!==e.flipY,n=e.font,o=n.common.scaleW,a=n.common.scaleH,l=this.layout.glyphs.filter((function(e){var t=e.data;return t.width*t.height>0}));this.visibleGlyphs=l;var c=s.positions(l),h=s.uvs(l,o,a,t),d=r([],{clockwise:!0,type:"uint16",count:l.length});if(this.setIndex(d),this.setAttribute("position",new THREE.BufferAttribute(c,2)),this.setAttribute("uv",new THREE.BufferAttribute(h,2)),!e.multipage&&"page"in this.attributes)this.removeAttribute("page");else if(e.multipage){var u=s.pages(l);this.setAttribute("page",new THREE.BufferAttribute(u,1))}null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere()}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new THREE.Sphere);var e=this.attributes.position.array,t=this.attributes.position.itemSize;if(!e||!t||e.length<2)return this.boundingSphere.radius=0,void this.boundingSphere.center.set(0,0,0);o.computeSphere(e,this.boundingSphere),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.')}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new THREE.Box3);var e=this.boundingBox,t=this.attributes.position.array,n=this.attributes.position.itemSize;!t||!n||t.length<2?e.makeEmpty():o.computeBox(t,e)}}},1684:e=>{var t={min:[0,0],max:[0,0]};function n(e){var n=e.length/2;t.min[0]=e[0],t.min[1]=e[1],t.max[0]=e[0],t.max[1]=e[1];for(var i=0;i<n;i++){var r=e[2*i+0],s=e[2*i+1];t.min[0]=Math.min(r,t.min[0]),t.min[1]=Math.min(s,t.min[1]),t.max[0]=Math.max(r,t.max[0]),t.max[1]=Math.max(s,t.max[1])}}e.exports.computeBox=function(e,i){n(e),i.min.set(t.min[0],t.min[1],0),i.max.set(t.max[0],t.max[1],0)},e.exports.computeSphere=function(e,i){n(e);var r=t.min[0],s=t.min[1],o=t.max[0]-r,a=t.max[1]-s,l=Math.sqrt(o*o+a*a);i.center.set(r+o/2,s+a/2,0),i.radius=l/2}},7106:e=>{e.exports.pages=function(e){var t=new Float32Array(4*e.length*1),n=0;return e.forEach((function(e){var i=e.data.page||0;t[n++]=i,t[n++]=i,t[n++]=i,t[n++]=i})),t},e.exports.uvs=function(e,t,n,i){var r=new Float32Array(4*e.length*2),s=0;return e.forEach((function(e){var o=e.data,a=o.x+o.width,l=o.y+o.height,c=o.x/t,h=o.y/n,d=a/t,u=l/n;i&&(h=(n-o.y)/n,u=(n-l)/n),r[s++]=c,r[s++]=h,r[s++]=c,r[s++]=u,r[s++]=d,r[s++]=u,r[s++]=d,r[s++]=h})),r},e.exports.positions=function(e){var t=new Float32Array(4*e.length*2),n=0;return e.forEach((function(e){var i=e.data,r=e.position[0]+i.xoffset,s=e.position[1]+i.yoffset,o=i.width,a=i.height;t[n++]=r,t[n++]=s,t[n++]=r,t[n++]=s+a,t[n++]=r+o,t[n++]=s+a,t[n++]=r+o,t[n++]=s})),t}},5406:e=>{var t=/\n/,n=/\s/;function i(e,t,n,i){var r=e.indexOf(t,n);return-1===r||r>i?i:r}function r(e){return n.test(e)}function s(e,t,n,i){return{start:t,end:t+Math.min(i,n-t)}}e.exports=function(t,n){return e.exports.lines(t,n).map((function(e){return t.substring(e.start,e.end)})).join("\n")},e.exports.lines=function(e,n){if(0===(n=n||{}).width&&"nowrap"!==n.mode)return[];e=e||"";var o="number"==typeof n.width?n.width:Number.MAX_VALUE,a=Math.max(0,n.start||0),l="number"==typeof n.end?n.end:e.length,c=n.mode,h=n.measure||s;return"pre"===c?function(e,n,i,r,s){for(var o=[],a=i,l=i;l<r&&l<n.length;l++){var c=n.charAt(l),h=t.test(c);if(h||l===r-1){var d=e(n,a,h?l:l+1,s);o.push(d),a=l+1}}return o}(h,e,a,l,o):function(e,t,n,s,o,a){var l=[],c=o;for("nowrap"===a&&(c=Number.MAX_VALUE);n<s&&n<t.length;){for(var h=i(t,"\n",n,s);n<h&&r(t.charAt(n));)n++;var d=e(t,n,h,c),u=n+(d.end-d.start),p=u+1;if(u<h){for(;u>n&&!r(t.charAt(u));)u--;if(u===n)p>n+1&&p--,u=p;else for(p=u;u>n&&r(t.charAt(u-1));)u--}if(u>=n){var A=e(t,n,u,c);l.push(A)}n=p}return l}(h,e,a,l,o,c)}},3558:(e,t,n)=>{"use strict";var i=n(919),r=n(8847),s=n(3216),o=n(4597);function a(e,t,n){var i=e;return r(t)?(n=t,"string"==typeof e&&(i={uri:e})):i=o(t,{uri:e}),i.callback=n,i}function l(e,t,n){return c(t=a(e,t,n))}function c(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,n=function(n,i,r){t||(t=!0,e.callback(n,i,r))};function i(){var e=void 0;if(e=h.response?h.response:h.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(h),g)try{e=JSON.parse(e)}catch(e){}return e}function r(e){return clearTimeout(d),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,n(e,v)}function o(){if(!c){var t;clearTimeout(d),t=e.useXDR&&void 0===h.status?200:1223===h.status?204:h.status;var r=v,o=null;return 0!==t?(r={body:i(),statusCode:t,method:p,headers:{},url:u,rawRequest:h},h.getAllResponseHeaders&&(r.headers=s(h.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var a,c,h=e.xhr||null;h||(h=e.cors||e.useXDR?new l.XDomainRequest:new l.XMLHttpRequest);var d,u=h.url=e.uri||e.url,p=h.method=e.method||"GET",A=e.body||e.data,f=h.headers=e.headers||{},m=!!e.sync,g=!1,v={body:void 0,headers:{},statusCode:0,method:p,url:u,rawRequest:h};if("json"in e&&!1!==e.json&&(g=!0,f.accept||f.Accept||(f.Accept="application/json"),"GET"!==p&&"HEAD"!==p&&(f["content-type"]||f["Content-Type"]||(f["Content-Type"]="application/json"),A=JSON.stringify(!0===e.json?A:e.json))),h.onreadystatechange=function(){4===h.readyState&&setTimeout(o,0)},h.onload=o,h.onerror=r,h.onprogress=function(){},h.onabort=function(){c=!0},h.ontimeout=r,h.open(p,u,!m,e.username,e.password),m||(h.withCredentials=!!e.withCredentials),!m&&e.timeout>0&&(d=setTimeout((function(){if(!c){c=!0,h.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}}),e.timeout)),h.setRequestHeader)for(a in f)f.hasOwnProperty(a)&&h.setRequestHeader(a,f[a]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(h.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(h),h.send(A||null),h}e.exports=l,e.exports.default=l,l.XMLHttpRequest=i.XMLHttpRequest||function(){},l.XDomainRequest="withCredentials"in new l.XMLHttpRequest?l.XMLHttpRequest:i.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],(function(e){l["delete"===e?"del":e]=function(t,n,i){return(n=a(t,n,i)).method=e.toUpperCase(),c(n)}}))},1896:e=>{e.exports=void 0!==self.DOMParser?function(e){return(new self.DOMParser).parseFromString(e,"application/xml")}:void 0!==self.ActiveXObject&&new self.ActiveXObject("Microsoft.XMLDOM")?function(e){var t=new self.ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(e),t}:function(e){var t=document.createElement("div");return t.innerHTML=e,t}},4597:e=>{e.exports=function(){for(var e={},n=0;n<arguments.length;n++){var i=arguments[n];for(var r in i)t.call(i,r)&&(e[r]=i[r])}return e};var t=Object.prototype.hasOwnProperty},2784:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7427).debug("components:anchored:warn");e.exports.Component=i("anchored",{schema:{persistent:{default:!1}},init:function(){var e=this.el.sceneEl.getAttribute("webxr"),t=e.optionalFeatures;-1===t.indexOf("anchors")&&(t.push("anchors"),this.el.sceneEl.setAttribute("webxr",e)),this.auxQuaternion=new THREE.Quaternion,this.onEnterVR=this.onEnterVR.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR)},onEnterVR:function(){this.anchor=void 0,this.requestPersistentAnchorPending=this.data.persistent,this.requestAnchorPending=!this.data.persistent},tick:function(){var e,t,n,i=this.el.sceneEl,r=i.renderer.xr,s=this.el.object3D;(i.is("ar-mode")||i.is("vr-mode"))&&(!this.anchor&&this.requestPersistentAnchorPending&&this.restorePersistentAnchor(),!this.anchor&&this.requestAnchorPending&&this.createAnchor(),this.anchor&&(e=i.frame,t=r.getReferenceSpace(),n=e.getPose(this.anchor.anchorSpace,t),s.matrix.elements=n.transform.matrix,s.matrix.decompose(s.position,s.rotation,s.scale)))},createAnchor:async function(e,t){var n,i,s,o,a=this.el.sceneEl,l=a.renderer.xr,c=this.el.object3D;e=e||c.position,t=t||this.auxQuaternion.setFromEuler(c.rotation),function(e){var t=e.renderer.xr.getSession();return t&&t.restorePersistentAnchor}(a)?(this.anchor&&this.deleteAnchor(),n=a.frame,i=l.getReferenceSpace(),s=new XRRigidTransform({x:e.x,y:e.y,z:e.z},{x:t.x,y:t.y,z:t.z,w:t.w}),this.requestAnchorPending=!1,o=await n.createAnchor(s,i),this.data.persistent&&(this.el.id?(this.persistentHandle=await o.requestPersistentHandle(),localStorage.setItem(this.el.id,this.persistentHandle)):r("The anchor won't be persisted because the entity has no assigned id.")),a.object3D.attach(this.el.object3D),this.anchor=o):r("This browser doesn't support the WebXR anchors module")},restorePersistentAnchor:async function(){var e,t=this.el.sceneEl.renderer.xr.getSession(),n=t.persistentAnchors;if(this.requestPersistentAnchorPending=!1,!this.el.id)return r("The entity associated to the persistent anchor cannot be retrieved because it doesn't have an assigned id."),void(this.requestAnchorPending=!0);if(n){e=localStorage.getItem(this.el.id);for(var i=0;i<n.length;++i)if(e===n[i]){this.anchor=await t.restorePersistentAnchor(n[i]),this.anchor&&(this.persistentHandle=n[i]);break}this.anchor||(this.requestAnchorPending=!0)}else this.requestPersistentAnchorPending=!0},deleteAnchor:function(){var e,t=this.anchor;t&&(e=this.el.sceneEl.renderer.xr.getSession(),t.delete(),this.el.sceneEl.object3D.add(this.el.object3D),this.persistentHandle&&e.deletePersistentAnchor(this.persistentHandle),this.anchor=void 0)}})},6896:(e,t,n)=>{var i=n(4635).A,r=n(8190).components,s=n(8190).registerComponent,o=n(9437),a=n(7427),l=new o.Color,c=new o.Color,h=a.entity.getComponentProperty,d=a.entity.setComponentProperty,u={},p="color",A="rotation",f="components";function m(e){e.x=o.MathUtils.degToRad(e.x),e.y=o.MathUtils.degToRad(e.y),e.z=o.MathUtils.degToRad(e.z)}function g(e,t,n){var i;for(i=0;i<t.length;i++)e.addEventListener(t[i],n)}function v(e,t,n){var i;for(i=0;i<t.length;i++)e.removeEventListener(t[i],n)}function y(e,t){var n,i,r;for(i=x(t),r=e,n=0;n<i.length;n++)r=r[i[n]];if(void 0===r)throw console.log(e),new Error("[animation] property ("+t+") could not be found");return r}function E(e,t,n,i){var r,s,a,l;for(t.startsWith("object3D.rotation")&&(n=o.MathUtils.degToRad(n)),s=x(t),l=e,r=0;r<s.length-1;r++)l=l[s[r]];a=s[s.length-1],i!==p?l[a]=n:"r"in l[a]?(l[a].r=n.r,l[a].g=n.g,l[a].b=n.b):(l[a].x=n.r,l[a].y=n.g,l[a].z=n.b)}function x(e){return e in u||(u[e]=e.split(".")),u[e]}function b(e){return e.isRawProperty||e.property.startsWith(f)||e.property.startsWith("object3D")}e.exports.Component=s("animation",{schema:{autoplay:{default:!0},delay:{default:0},dir:{default:""},dur:{default:1e3},easing:{default:"easeInQuad"},elasticity:{default:400},enabled:{default:!0},from:{default:""},loop:{default:0,parse:function(e){return!0===e||"true"===e||!1!==e&&"false"!==e&&parseInt(e,10)}},property:{default:""},startEvents:{type:"array"},pauseEvents:{type:"array"},resumeEvents:{type:"array"},round:{default:!1},to:{default:""},type:{default:""},isRawProperty:{default:!1}},multiple:!0,init:function(){var e=this;this.eventDetail={name:this.attrName},this.time=0,this.animation=null,this.animationIsPlaying=!1,this.onStartEvent=this.onStartEvent.bind(this),this.beginAnimation=this.beginAnimation.bind(this),this.pauseAnimation=this.pauseAnimation.bind(this),this.resumeAnimation=this.resumeAnimation.bind(this),this.fromColor={},this.toColor={},this.targets={},this.targetsArray=[],this.updateConfigForDefault=this.updateConfigForDefault.bind(this),this.updateConfigForRawColor=this.updateConfigForRawColor.bind(this),this.config={complete:function(){e.animationIsPlaying=!1,e.el.emit("animationcomplete",e.eventDetail,!1),e.id&&e.el.emit("animationcomplete__"+e.id,e.eventDetail,!1)}}},update:function(e){var t=this.config,n=this.data;this.animationIsPlaying=!1,this.data.enabled&&n.property&&(t.autoplay=!1,t.direction=n.dir,t.duration=n.dur,t.easing=n.easing,t.elasticity=n.elasticity,t.loop=n.loop,t.round=n.round,this.createAndStartAnimation())},tick:function(e,t){this.animationIsPlaying&&(this.time+=t,this.animation.tick(this.time))},remove:function(){this.pauseAnimation(),this.removeEventListeners()},pause:function(){this.paused=!0,this.pausedWasPlaying=this.animationIsPlaying,this.pauseAnimation(),this.removeEventListeners()},play:function(){this.paused&&(this.paused=!1,this.addEventListeners(),this.pausedWasPlaying&&(this.resumeAnimation(),this.pausedWasPlaying=!1))},createAndStartAnimation:function(){var e=this.data;this.updateConfig(),this.animationIsPlaying=!1,this.animation=i(this.config),this.animation.began=!0,this.removeEventListeners(),this.addEventListeners(),!e.autoplay||e.startEvents&&e.startEvents.length||(e.delay?setTimeout(this.beginAnimation,e.delay):this.beginAnimation())},beginAnimation:function(){this.updateConfig(),this.animation.began=!0,this.time=0,this.animationIsPlaying=!0,this.stopRelatedAnimations(),this.el.emit("animationbegin",this.eventDetail,!1)},pauseAnimation:function(){this.animationIsPlaying=!1},resumeAnimation:function(){this.animationIsPlaying=!0},onStartEvent:function(){this.data.enabled&&(this.updateConfig(),this.animation&&this.animation.pause(),this.animation=i(this.config),this.data.delay?setTimeout(this.beginAnimation,this.data.delay):this.beginAnimation())},updateConfigForRawColor:function(){var e,t,n,i=this.config,r=this.data,s=this.el;if(!this.waitComponentInitRawProperty(this.updateConfigForRawColor)){for(t in e=""===r.from?y(s,r.property):r.from,n=r.to,this.setColorConfig(e,n),e=this.fromColor,n=this.toColor,this.targetsArray.length=0,this.targetsArray.push(e),i.targets=this.targetsArray,n)i[t]=n[t];var o;i.update=(o={},function(e){var t;(t=e.animatables[0].target).r===o.r&&t.g===o.g&&t.b===o.b||E(s,r.property,t,r.type)})}},updateConfigForDefault:function(){var e,t,n,i,r=this.config,s=this.data,o=this.el;this.waitComponentInitRawProperty(this.updateConfigForDefault)||(e=""===s.from?b(s)?y(o,s.property):h(o,s.property):s.from,n=s.to,isNaN(e||n)?(e=e?e.toString():e,n=n?n.toString():n):(e=parseFloat(e),n=parseFloat(n)),(t="true"===s.to||"false"===s.to||!0===s.to||!1===s.to)&&(e="true"===s.from||!0===s.from?1:0,n="true"===s.to||!0===s.to?1:0),this.targets.aframeProperty=e,r.targets=this.targets,r.aframeProperty=n,r.update=function(e){var n;(n=e.animatables[0].target.aframeProperty)!==i&&(i=n,t&&(n=n>=1),b(s)?E(o,s.property,n,s.type):d(o,s.property,n))})},updateConfigForVector:function(){var e,t,n,i,r=this.config,s=this.data,o=this.el,l=x(s.property),c="object3D"===l[0]?l[1]:l[0];for(e in t=""!==s.from?a.coordinates.parse(s.from):h(o,c),n=a.coordinates.parse(s.to),c===A&&(m(t),m(n)),this.targetsArray.length=0,this.targetsArray.push(t),r.targets=this.targetsArray,n)r[e]=n[e];r.update="position"!==c&&c!==A&&"scale"!==c?function(){var e={};return function(t){var n=t.animatables[0].target;n.x===e.x&&n.y===e.y&&n.z===e.z||(e.x=n.x,e.y=n.y,e.z=n.z,d(o,s.property,n))}}():(i={},function(e){var t=e.animatables[0].target;t.x===i.x&&t.y===i.y&&t.z===i.z||(i.x=t.x,i.y=t.y,i.z=t.z,o.object3D[c].set(t.x,t.y,t.z))})},updateConfig:function(){var e,t,n,i,s,o,a;t=this.el,n=this.data.property,e="object3D"!==(o=n.split("."))[0]||o[2]||"position"!==o[1]&&"rotation"!==o[1]&&"scale"!==o[1]?(s=o[0],a=o[1],(i=t.components[s]||r[s])?a&&!i.schema[a]?null:a?i.schema[a].type:i.schema.type:null):"vec3",b(this.data)&&this.data.type===p?this.updateConfigForRawColor():"vec2"===e||"vec3"===e||"vec4"===e?this.updateConfigForVector():this.updateConfigForDefault()},waitComponentInitRawProperty:function(e){var t,n=this.data,r=this.el,s=this;return""===n.from&&!!n.property.startsWith(f)&&(t=x(n.property)[1],!r.components[t]&&(r.addEventListener("componentinitialized",(function n(o){o.detail.name===t&&(e(),s.animation=i(s.config),r.removeEventListener("componentinitialized",n))})),!0))},stopRelatedAnimations:function(){var e,t;for(t in this.el.components)e=this.el.components[t],t!==this.attrName&&"animation"===e.name&&e.animationIsPlaying&&e.data.property===this.data.property&&(e.animationIsPlaying=!1)},addEventListeners:function(){var e=this.data,t=this.el;g(t,e.startEvents,this.onStartEvent),g(t,e.pauseEvents,this.pauseAnimation),g(t,e.resumeEvents,this.resumeAnimation)},removeEventListeners:function(){var e=this.data,t=this.el;v(t,e.startEvents,this.onStartEvent),v(t,e.pauseEvents,this.pauseAnimation),v(t,e.resumeEvents,this.resumeAnimation)},setColorConfig:function(e,t){l.set(e),c.set(t),e=this.fromColor,t=this.toColor,e.r=l.r,e.g=l.g,e.b=l.b,t.r=c.r,t.g=c.g,t.b=c.b}})},4395:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437);e.exports.Component=i("camera",{schema:{active:{default:!0},far:{default:1e4},fov:{default:80,min:0},near:{default:.005,min:0},spectator:{default:!1},zoom:{default:1,min:0}},init:function(){var e,t=this.el;e=this.camera=new r.PerspectiveCamera,t.setObject3D("camera",e)},update:function(e){var t=this.data,n=this.camera;n.aspect=t.aspect||window.innerWidth/window.innerHeight,n.far=t.far,n.fov=t.fov,n.near=t.near,n.zoom=t.zoom,n.updateProjectionMatrix(),this.updateActiveCamera(e),this.updateSpectatorCamera(e)},updateActiveCamera:function(e){var t=this.data,n=this.el,i=this.system;e&&e.active===t.active||t.spectator||(t.active&&i.activeCameraEl!==n?i.setActiveCamera(n):t.active||i.activeCameraEl!==n||i.disableActiveCamera())},updateSpectatorCamera:function(e){var t=this.data,n=this.el,i=this.system;e&&e.spectator===t.spectator||(t.spectator&&i.spectatorCameraEl!==n?i.setSpectatorCamera(n):t.spectator||i.spectatorCameraEl!==n||i.disableSpectatorCamera())},remove:function(){this.el.removeObject3D("camera")}})},3674:(e,t,n)=>{var i,r,s,o,a=n(8190).registerComponent,l=n(7427),c="click",h="mouseup",d="cursor-fusing",u="cursor-hovering",p="cursor-hovered",A={DOWN:["mousedown","touchstart"],UP:["mouseup","touchend"]},f={DOWN:["selectstart"],UP:["selectend"]},m="a-mouse-cursor-hover";e.exports.Component=a("cursor",{dependencies:["raycaster"],schema:{downEvents:{default:[]},fuse:{default:l.device.isMobile()},fuseTimeout:{default:1500,min:0},mouseCursorStylesEnabled:{default:!0},upEvents:{default:[]},rayOrigin:{default:"entity",oneOf:["mouse","entity","xrselect"]}},after:["tracked-controls"],multiple:!0,init:function(){var e=this;this.fuseTimeout=void 0,this.cursorDownEl=null,this.intersectedEl=null,this.canvasBounds=document.body.getBoundingClientRect(),this.isCursorDown=!1,this.activeXRInput=null,this.updateCanvasBounds=l.debounce((function(){e.canvasBounds=e.el.sceneEl.canvas.getBoundingClientRect()}),500),this.eventDetail={},this.intersectedEventDetail={cursorEl:this.el},this.onCursorDown=this.onCursorDown.bind(this),this.onCursorUp=this.onCursorUp.bind(this),this.onIntersection=this.onIntersection.bind(this),this.onIntersectionCleared=this.onIntersectionCleared.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onEnterVR=this.onEnterVR.bind(this)},update:function(e){this.data.rayOrigin!==e.rayOrigin&&("entity"===this.data.rayOrigin&&this.resetRaycaster(),this.updateMouseEventListeners(),"xrselect"===this.data.rayOrigin&&this.addWebXREventListeners(),"xrselect"===e.rayOrigin&&this.removeWebXREventListeners())},tick:function(){var e=this.el.sceneEl.frame,t=this.activeXRInput;"xrselect"===this.data.rayOrigin&&e&&t&&this.onMouseMove({frame:e,inputSource:t,type:"fakeselectevent"})},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){var e=this.el;e.removeState(u),e.removeState(d),clearTimeout(this.fuseTimeout),this.intersectedEl&&this.intersectedEl.removeState(p),this.removeEventListeners()},addEventListeners:function(){var e,t=this.data,n=this.el,i=this;function r(){e=n.sceneEl.canvas,t.downEvents.length||t.upEvents.length||(A.DOWN.forEach((function(t){e.addEventListener(t,i.onCursorDown,{passive:!1})})),A.UP.forEach((function(t){e.addEventListener(t,i.onCursorUp,{passive:!1})})))}(e=n.sceneEl.canvas)?r():n.sceneEl.addEventListener("render-target-loaded",r),t.downEvents.forEach((function(e){n.addEventListener(e,i.onCursorDown)})),t.upEvents.forEach((function(e){n.addEventListener(e,i.onCursorUp)})),n.addEventListener("raycaster-intersection",this.onIntersection),n.addEventListener("raycaster-closest-entity-changed",this.onIntersection),n.addEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),n.sceneEl.addEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.addEventListener("enter-vr",this.onEnterVR),window.addEventListener("resize",this.updateCanvasBounds),window.addEventListener("scroll",this.updateCanvasBounds),this.updateMouseEventListeners()},removeEventListeners:function(){var e,t=this.data,n=this.el,i=this;!(e=n.sceneEl.canvas)||t.downEvents.length||t.upEvents.length||(A.DOWN.forEach((function(t){e.removeEventListener(t,i.onCursorDown)})),A.UP.forEach((function(t){e.removeEventListener(t,i.onCursorUp)}))),t.downEvents.forEach((function(e){n.removeEventListener(e,i.onCursorDown)})),t.upEvents.forEach((function(e){n.removeEventListener(e,i.onCursorUp)})),n.removeEventListener("raycaster-intersection",this.onIntersection),n.removeEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),e.removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchstart",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),n.sceneEl.removeEventListener("rendererresize",this.updateCanvasBounds),n.sceneEl.removeEventListener("enter-vr",this.onEnterVR),window.removeEventListener("resize",this.updateCanvasBounds),window.removeEventListener("scroll",this.updateCanvasBounds),this.removeWebXREventListeners()},updateMouseEventListeners:function(){var e,t=this.el;(e=t.sceneEl.canvas).removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),t.setAttribute("raycaster","useWorldCoordinates",!1),"mouse"===this.data.rayOrigin&&(e.addEventListener("mousemove",this.onMouseMove),e.addEventListener("touchmove",this.onMouseMove,{passive:!1}),t.setAttribute("raycaster","useWorldCoordinates",!0),this.updateCanvasBounds())},resetRaycaster:function(){this.el.setAttribute("raycaster",{direction:(new THREE.Vector3).set(0,0,-1),origin:new THREE.Vector3})},addWebXREventListeners:function(){var e=this,t=this.el.sceneEl.xrSession;t&&(f.DOWN.forEach((function(n){t.addEventListener(n,e.onCursorDown)})),f.UP.forEach((function(n){t.addEventListener(n,e.onCursorUp)})))},removeWebXREventListeners:function(){var e=this,t=this.el.sceneEl.xrSession;t&&(f.DOWN.forEach((function(n){t.removeEventListener(n,e.onCursorDown)})),f.UP.forEach((function(n){t.removeEventListener(n,e.onCursorUp)})))},onMouseMove:(i=new THREE.Vector3,r=new THREE.Vector2,s=new THREE.Vector3,o={origin:s,direction:i},function(e){var t,n,a,l,c,h,d,u,p,A=this.canvasBounds,f=this.el.sceneEl.camera;f.parent.updateMatrixWorld(),n=(a="touchmove"===e.type||"touchstart"===e.type?e.touches.item(0):e).clientX-A.left,l=a.clientY-A.top,r.x=n/A.width*2-1,r.y=-l/A.height*2+1,"xrselect"!==this.data.rayOrigin||"selectstart"!==e.type&&"fakeselectevent"!==e.type?"fakeselectout"===e.type?(i.set(0,1,0),s.set(0,9999,0)):f&&f.isPerspectiveCamera?(s.setFromMatrixPosition(f.matrixWorld),i.set(r.x,r.y,.5).unproject(f).sub(s).normalize()):f&&f.isOrthographicCamera?(s.set(r.x,r.y,(f.near+f.far)/(f.near-f.far)).unproject(f),i.set(0,0,-1).transformDirection(f.matrixWorld)):console.error("AFRAME.Raycaster: Unsupported camera type: "+f.type):(c=e.frame,h=e.inputSource,d=this.el.sceneEl.renderer.xr.getReferenceSpace(),(u=c.getPose(h.targetRaySpace,d))&&(p=u.transform,i.set(0,0,-1),i.applyQuaternion(p.orientation),s.copy(p.position),(t=f.el.object3D.parent).localToWorld(s),i.transformDirection(t.matrixWorld))),this.el.setAttribute("raycaster",o),"touchmove"===e.type&&e.preventDefault()}),onCursorDown:function(e){this.isCursorDown=!0,"mouse"===this.data.rayOrigin&&"touchstart"===e.type&&(this.onMouseMove(e),this.el.components.raycaster.checkIntersections(),e.preventDefault()),"xrselect"===this.data.rayOrigin&&"selectstart"===e.type&&(this.activeXRInput=e.inputSource,this.onMouseMove(e),this.el.components.raycaster.checkIntersections(),this.el.components.raycaster.intersectedEls.length&&void 0!==this.el.sceneEl.components["ar-hit-test"]&&this.el.sceneEl.getAttribute("ar-hit-test").enabled&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!1),this.reenableARHitTest=!0)),this.twoWayEmit("mousedown",e),this.cursorDownEl=this.intersectedEl},onCursorUp:function(e){if(this.isCursorDown&&("xrselect"!==this.data.rayOrigin||this.activeXRInput===e.inputSource)){this.isCursorDown=!1;var t=this.data;this.twoWayEmit(h,e),!0===this.reenableARHitTest&&(this.el.sceneEl.setAttribute("ar-hit-test","enabled",!0),this.reenableARHitTest=void 0),this.cursorDownEl&&this.cursorDownEl!==this.intersectedEl&&(this.intersectedEventDetail.intersection=null,this.cursorDownEl.emit(h,this.intersectedEventDetail)),t.fuse&&"mouse"!==t.rayOrigin&&"xrselect"!==t.rayOrigin||!this.intersectedEl||this.cursorDownEl!==this.intersectedEl||this.twoWayEmit(c,e),"xrselect"===t.rayOrigin&&this.onMouseMove({type:"fakeselectout"}),this.activeXRInput=null,this.cursorDownEl=null,"touchend"===e.type&&e.preventDefault()}},onIntersection:function(e){var t,n,i,r,s=this.el;n=e.detail.els[0]===s?1:0,r=e.detail.intersections[n],(i=e.detail.els[n])&&this.intersectedEl!==i&&(this.intersectedEl&&(t=this.el.components.raycaster.getIntersection(this.intersectedEl))&&t.distance<=r.distance||(this.clearCurrentIntersection(!0),this.setIntersection(i,r)))},onIntersectionCleared:function(e){-1!==e.detail.clearedEls.indexOf(this.intersectedEl)&&this.clearCurrentIntersection()},onEnterVR:function(){this.clearCurrentIntersection(!0),"xrselect"===this.data.rayOrigin&&this.addWebXREventListeners()},setIntersection:function(e,t){var n=this.el,i=this.data,r=this;this.intersectedEl!==e&&(this.intersectedEl=e,n.addState(u),e.addState(p),this.twoWayEmit("mouseenter"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.add(m),0!==i.fuseTimeout&&i.fuse&&"xrselect"!==i.rayOrigin&&"mouse"!==i.rayOrigin&&(n.addState(d),this.twoWayEmit("fusing"),this.fuseTimeout=setTimeout((function(){n.removeState(d),r.twoWayEmit(c)}),i.fuseTimeout)))},clearCurrentIntersection:function(e){var t,n,i=this.el;this.intersectedEl&&(this.intersectedEl.removeState(p),i.removeState(u),i.removeState(d),this.twoWayEmit("mouseleave"),this.data.mouseCursorStylesEnabled&&"mouse"===this.data.rayOrigin&&this.el.sceneEl.canvas.classList.remove(m),this.intersectedEl=null,clearTimeout(this.fuseTimeout),!0!==e&&0!==(n=this.el.components.raycaster.intersections).length&&(t=n[n[0].object.el===i?1:0])&&this.setIntersection(t.object.el,t))},twoWayEmit:function(e,t){var n,i=this.el,r=this.intersectedEl;function s(e,n){t instanceof MouseEvent?e.mouseEvent=t:"undefined"!=typeof TouchEvent&&t instanceof TouchEvent&&(e.touchEvent=t)}n=this.el.components.raycaster.getIntersection(r),this.eventDetail.intersectedEl=r,this.eventDetail.intersection=n,s(this.eventDetail),i.emit(e,this.eventDetail),r&&(this.intersectedEventDetail.intersection=n,s(this.intersectedEventDetail),r.emit(e,this.intersectedEventDetail))}})},8388:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l="generic";e.exports.Component=i("generic-tracked-controller-controls",{schema:{hand:{default:""},defaultModel:{default:!0},defaultModelColor:{default:"gray"},disabled:{default:!1}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick"]},bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.wasControllerConnected=!1,this.bindMethods(),this.el.addEventListener("controllerconnected",(function(t){t.detail.name!==e.name&&(e.wasControllerConnected=!0,e.removeEventListeners(),e.removeControllersUpdateListener())}))},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data,t=e.hand?e.hand:void 0;s(this,l,{hand:t,iterateControllerProfiles:!0})},play:function(){this.wasControllerConnected||(this.checkIfControllerPresent(),this.addControllersUpdateListener())},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;this.el.components["tracked-controls"]?this.removeEventListeners():(e.setAttribute("tracked-controls",{hand:t.hand,idPrefix:l,iterateControllerProfiles:!0}),this.data.defaultModel&&this.initDefaultModel())},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.wasControllerConnected&&this.checkIfControllerPresent()},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},initDefaultModel:function(){var e=this.modelEl=document.createElement("a-entity");e.setAttribute("geometry",{primitive:"sphere",radius:.03}),e.setAttribute("material",{color:this.data.color}),this.el.appendChild(e),this.el.emit("controllermodelready",{name:"generic-tracked-controller-controls",model:this.modelEl,rayOrigin:{origin:{x:0,y:0,z:-.01},direction:{x:0,y:0,z:-1}}})}})},9840:(e,t,n)=>{var i=n(7045).to,r=n(7045).Ls,s=n(8190).registerComponent,o=n(9437),a=new o.BufferGeometry;e.exports.Component=s("geometry",{schema:{buffer:{default:!0},primitive:{default:"box",oneOf:r,schemaChange:!0},skipCache:{default:!1}},init:function(){this.geometry=null},update:function(e){var t,n=this.data,i=this.el,r=this.system;this.geometry&&(r.unuseGeometry(e),this.geometry=null),this.geometry=r.getOrCreateGeometry(n),(t=i.getObject3D("mesh"))?t.geometry=this.geometry:((t=new o.Mesh).geometry=this.geometry,this.el.getAttribute("material")||(t.material=new o.MeshStandardMaterial({color:16777215*Math.random(),metalness:0,roughness:.5})),i.setObject3D("mesh",t))},remove:function(){this.system.unuseGeometry(this.data),this.el.getObject3D("mesh").geometry=a,this.geometry=null},updateSchema:function(e){var t=this.oldData&&this.oldData.primitive,n=e.primitive,r=i[n]&&i[n].schema;if(!r)throw new Error("Unknown geometry schema `"+n+"`");t&&t===n||this.extendSchema(r)}})},297:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7427).debug("components:gltf-model:warn");e.exports.Component=i("gltf-model",{schema:{type:"model"},init:function(){var e=this,t=this.system.getDRACOLoader(),n=this.system.getMeshoptDecoder(),i=this.system.getKTX2Loader();this.model=null,this.loader=new r.GLTFLoader,t&&this.loader.setDRACOLoader(t),this.ready=n?n.then((function(t){e.loader.setMeshoptDecoder(t)})):Promise.resolve(),i&&this.loader.setKTX2Loader(i)},update:function(){var e=this,t=this.el,n=this.data;n&&(this.remove(),this.ready.then((function(){e.loader.load(n,(function(n){e.model=n.scene||n.scenes[0],e.model.animations=n.animations,t.setObject3D("mesh",e.model),t.emit("model-loaded",{format:"gltf",model:e.model})}),void 0,(function(e){var i=e&&e.message?e.message:"Failed to load glTF model";s(i),t.emit("model-error",{format:"gltf",src:n})}))})))},remove:function(){this.model&&this.el.removeObject3D("mesh")}})},9194:(e,t,n)=>{(0,n(8190).registerComponent)("grabbable",{init:function(){this.el.setAttribute("obb-collider","centerModel: true")}})},332:(e,t,n)=>{var i=n(8190).registerComponent,r=n(1343).AFRAME_CDN_ROOT,s={toonLeft:r+"controllers/hands/leftHand.glb",toonRight:r+"controllers/hands/rightHand.glb",lowPolyLeft:r+"controllers/hands/leftHandLow.glb",lowPolyRight:r+"controllers/hands/rightHandLow.glb",highPolyLeft:r+"controllers/hands/leftHandHigh.glb",highPolyRight:r+"controllers/hands/rightHandHigh.glb"},o="Point",a="Fist",l="Thumb Up",c={};function h(e,t){var n;if(e)return"grip"===(n=c[e])?n+(t?"close":"open"):"point"===n?n+(t?"up":"down"):"pointing"===n||"pistol"===n?n+(t?"start":"end"):void 0}c[a]="grip",c[l]="pistol",c[o]="pointing",e.exports.Component=i("hand-controls",{schema:{color:{default:"white",type:"color"},hand:{default:"left"},handModelStyle:{default:"lowPoly",oneOf:["lowPoly","highPoly","toon"]}},after:["tracked-controls"],init:function(){var e=this,t=this.el;this.pressedButtons={},this.touchedButtons={},this.loader=new THREE.GLTFLoader,this.loader.setCrossOrigin("anonymous"),this.onGripDown=function(){e.handleButton("grip","down")},this.onGripUp=function(){e.handleButton("grip","up")},this.onTrackpadDown=function(){e.handleButton("trackpad","down")},this.onTrackpadUp=function(){e.handleButton("trackpad","up")},this.onTrackpadTouchStart=function(){e.handleButton("trackpad","touchstart")},this.onTrackpadTouchEnd=function(){e.handleButton("trackpad","touchend")},this.onTriggerDown=function(){e.handleButton("trigger","down")},this.onTriggerUp=function(){e.handleButton("trigger","up")},this.onTriggerTouchStart=function(){e.handleButton("trigger","touchstart")},this.onTriggerTouchEnd=function(){e.handleButton("trigger","touchend")},this.onGripTouchStart=function(){e.handleButton("grip","touchstart")},this.onGripTouchEnd=function(){e.handleButton("grip","touchend")},this.onThumbstickDown=function(){e.handleButton("thumbstick","down")},this.onThumbstickUp=function(){e.handleButton("thumbstick","up")},this.onAorXTouchStart=function(){e.handleButton("AorX","touchstart")},this.onAorXTouchEnd=function(){e.handleButton("AorX","touchend")},this.onBorYTouchStart=function(){e.handleButton("BorY","touchstart")},this.onBorYTouchEnd=function(){e.handleButton("BorY","touchend")},this.onSurfaceTouchStart=function(){e.handleButton("surface","touchstart")},this.onSurfaceTouchEnd=function(){e.handleButton("surface","touchend")},this.onControllerConnected=this.onControllerConnected.bind(this),this.onControllerDisconnected=this.onControllerDisconnected.bind(this),t.addEventListener("controllerconnected",this.onControllerConnected),t.addEventListener("controllerdisconnected",this.onControllerDisconnected),t.object3D.visible=!1},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},tick:function(e,t){var n=this.el.getObject3D("mesh");n&&n.mixer&&n.mixer.update(t/1e3)},onControllerConnected:function(e){var t=this.el,n=this.data.hand,i=this.el.getObject3D("mesh");t.object3D.visible=!0;var r="left"===n?Math.PI/2:-Math.PI/2,s=t.sceneEl.hasWebXR?-Math.PI/2:0;"pico-controls"===e.detail.name&&(s+=Math.PI/4),i.position.set(0,0,0),i.rotation.set(s,0,r)},onControllerDisconnected:function(){this.el.object3D.visible=!1},addEventListeners:function(){var e=this.el;e.addEventListener("gripdown",this.onGripDown),e.addEventListener("gripup",this.onGripUp),e.addEventListener("trackpaddown",this.onTrackpadDown),e.addEventListener("trackpadup",this.onTrackpadUp),e.addEventListener("trackpadtouchstart",this.onTrackpadTouchStart),e.addEventListener("trackpadtouchend",this.onTrackpadTouchEnd),e.addEventListener("triggerdown",this.onTriggerDown),e.addEventListener("triggerup",this.onTriggerUp),e.addEventListener("triggertouchstart",this.onTriggerTouchStart),e.addEventListener("triggertouchend",this.onTriggerTouchEnd),e.addEventListener("griptouchstart",this.onGripTouchStart),e.addEventListener("griptouchend",this.onGripTouchEnd),e.addEventListener("thumbstickdown",this.onThumbstickDown),e.addEventListener("thumbstickup",this.onThumbstickUp),e.addEventListener("abuttontouchstart",this.onAorXTouchStart),e.addEventListener("abuttontouchend",this.onAorXTouchEnd),e.addEventListener("bbuttontouchstart",this.onBorYTouchStart),e.addEventListener("bbuttontouchend",this.onBorYTouchEnd),e.addEventListener("xbuttontouchstart",this.onAorXTouchStart),e.addEventListener("xbuttontouchend",this.onAorXTouchEnd),e.addEventListener("ybuttontouchstart",this.onBorYTouchStart),e.addEventListener("ybuttontouchend",this.onBorYTouchEnd),e.addEventListener("surfacetouchstart",this.onSurfaceTouchStart),e.addEventListener("surfacetouchend",this.onSurfaceTouchEnd)},removeEventListeners:function(){var e=this.el;e.removeEventListener("gripdown",this.onGripDown),e.removeEventListener("gripup",this.onGripUp),e.removeEventListener("trackpaddown",this.onTrackpadDown),e.removeEventListener("trackpadup",this.onTrackpadUp),e.removeEventListener("trackpadtouchstart",this.onTrackpadTouchStart),e.removeEventListener("trackpadtouchend",this.onTrackpadTouchEnd),e.removeEventListener("triggerdown",this.onTriggerDown),e.removeEventListener("triggerup",this.onTriggerUp),e.removeEventListener("triggertouchstart",this.onTriggerTouchStart),e.removeEventListener("triggertouchend",this.onTriggerTouchEnd),e.removeEventListener("griptouchstart",this.onGripTouchStart),e.removeEventListener("griptouchend",this.onGripTouchEnd),e.removeEventListener("thumbstickdown",this.onThumbstickDown),e.removeEventListener("thumbstickup",this.onThumbstickUp),e.removeEventListener("abuttontouchstart",this.onAorXTouchStart),e.removeEventListener("abuttontouchend",this.onAorXTouchEnd),e.removeEventListener("bbuttontouchstart",this.onBorYTouchStart),e.removeEventListener("bbuttontouchend",this.onBorYTouchEnd),e.removeEventListener("xbuttontouchstart",this.onAorXTouchStart),e.removeEventListener("xbuttontouchend",this.onAorXTouchEnd),e.removeEventListener("ybuttontouchstart",this.onBorYTouchStart),e.removeEventListener("ybuttontouchend",this.onBorYTouchEnd),e.removeEventListener("surfacetouchstart",this.onSurfaceTouchStart),e.removeEventListener("surfacetouchend",this.onSurfaceTouchEnd)},update:function(e){var t,n=this.el,i=this.data.hand,r=this.data.handModelStyle,o=this.data.color,a=this;if(t={hand:i,model:!1},i!==e){var l=s[r+i.charAt(0).toUpperCase()+i.slice(1)];this.loader.load(l,(function(e){var i=e.scene.children[0];i.mixer=new THREE.AnimationMixer(i),a.clips=e.animations,n.setObject3D("mesh",i),i.traverse((function(e){e.isMesh&&(e.material.color=new THREE.Color(o))})),n.setAttribute("magicleap-controls",t),n.setAttribute("vive-controls",t),n.setAttribute("meta-touch-controls",t),n.setAttribute("pico-controls",t),n.setAttribute("windows-motion-controls",t),n.setAttribute("hp-mixed-reality-controls",t)}))}},remove:function(){this.el.removeObject3D("mesh")},handleButton:function(e,t){var n,i="down"===t,r="touchstart"===t;if(0===t.indexOf("touch")){if(r===this.touchedButtons[e])return;this.touchedButtons[e]=r}else{if(i===this.pressedButtons[e])return;this.pressedButtons[e]=i}n=this.gesture,this.gesture=this.determineGesture(),this.gesture!==n&&(this.animateGesture(this.gesture,n),this.emitGestureEvents(this.gesture,n))},determineGesture:function(){var e,t,n,i=this.pressedButtons.grip,r=this.pressedButtons.surface||this.touchedButtons.surface,s=this.pressedButtons.trackpad||this.touchedButtons.trackpad,c=this.pressedButtons.trigger||this.touchedButtons.trigger,h=this.touchedButtons.AorX||this.touchedButtons.BorY;return t=this.el.components["tracked-controls"],(n=t&&t.controller)&&(n.id&&0===n.id.indexOf("OpenVR ")||n.profiles&&n.profiles[0]&&"htc-vive"===n.profiles[0])?i||c?e=a:s&&(e=o):i?e=r||h||s?c?a:o:c?l:"Point + Thumb":c&&(e="Hold"),e},getClip:function(e){var t,n;for(n=0;n<this.clips.length;n++)if((t=this.clips[n]).name===e)return t},animateGesture:function(e,t){e?this.playAnimation(e||"Open",t,!1):this.playAnimation(t,t,!0)},emitGestureEvents:function(e,t){var n,i=this.el;t!==e&&((n=h(t,!1))&&i.emit(n),(n=h(e,!0))&&i.emit(n))},playAnimation:function(e,t,n){var i,r,s=this.el.getObject3D("mesh");if(s){if(i=this.getClip(e),r=s.mixer.clipAction(i),n)return r.paused=!1,void(r.timeScale=-1);if(r.clampWhenFinished=!0,r.loop=THREE.LoopOnce,r.repetitions=0,r.timeScale=1,r.time=0,r.weight=1,!t)return s.mixer.stopAllAction(),void r.play();i=this.getClip(t),r.reset(),r.play(),s.mixer.clipAction(i).crossFadeTo(r,.15,!0)}}})},9686:(e,t,n)=>{var i,r=n(8190).registerComponent,s=n(4056).P,o=n(7960).checkControllerPresentAndSetup,a=n(1343).AFRAME_CDN_ROOT,l=a+"controllers/oculus-hands/v4/left.glb",c=a+"controllers/oculus-hands/v4/right.glb",h=["wrist","thumb-metacarpal","thumb-phalanx-proximal","thumb-phalanx-distal","thumb-tip","index-finger-metacarpal","index-finger-phalanx-proximal","index-finger-phalanx-intermediate","index-finger-phalanx-distal","index-finger-tip","middle-finger-metacarpal","middle-finger-phalanx-proximal","middle-finger-phalanx-intermediate","middle-finger-phalanx-distal","middle-finger-tip","ring-finger-metacarpal","ring-finger-phalanx-proximal","ring-finger-phalanx-intermediate","ring-finger-phalanx-distal","ring-finger-tip","pinky-finger-metacarpal","pinky-finger-phalanx-proximal","pinky-finger-phalanx-intermediate","pinky-finger-phalanx-distal","pinky-finger-tip"];e.exports.Component=r("hand-tracking-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},modelStyle:{default:"mesh",oneOf:["dots","mesh"]},modelColor:{default:"white"},modelOpacity:{default:1}},after:["tracked-controls"],bindMethods:function(){this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this)},addEventListeners:function(){this.el.addEventListener("model-loaded",this.onModelLoaded);for(var e=0;e<this.jointEls.length;++e)this.jointEls[e].object3D.visible=!0},removeEventListeners:function(){this.el.removeEventListener("model-loaded",this.onModelLoaded);for(var e=0;e<this.jointEls.length;++e)this.jointEls[e].object3D.visible=!1},init:function(){var e=this.el.sceneEl,t=e.getAttribute("webxr"),n=t.optionalFeatures;-1===n.indexOf("hand-tracking")&&(n.push("hand-tracking"),e.setAttribute("webxr",t)),this.wristObject3D=new THREE.Object3D,this.el.sceneEl.object3D.add(this.wristObject3D),this.onModelLoaded=this.onModelLoaded.bind(this),this.onChildAttached=this.onChildAttached.bind(this),this.jointEls=[],this.controllerPresent=!1,this.isPinched=!1,this.pinchEventDetail={position:new THREE.Vector3,wristRotation:new THREE.Quaternion},this.indexTipPosition=new THREE.Vector3,this.hasPoses=!1,this.jointPoses=new Float32Array(16*h.length),this.jointRadii=new Float32Array(h.length),this.bindMethods(),this.updateReferenceSpace=this.updateReferenceSpace.bind(this),this.el.sceneEl.addEventListener("enter-vr",this.updateReferenceSpace),this.el.sceneEl.addEventListener("exit-vr",this.updateReferenceSpace),this.el.addEventListener("child-attached",this.onChildAttached),this.wristObject3D.visible=!1},onChildAttached:function(e){this.addChildEntity(e.detail.el)},update:function(){this.updateModelMaterial()},updateModelMaterial:function(){var e=this.jointEls,t=this.skinnedMesh,n=!(1===this.data.modelOpacity);t&&(this.skinnedMesh.material.color.set(this.data.modelColor),this.skinnedMesh.material.transparent=n,this.skinnedMesh.material.opacity=this.data.modelOpacity);for(var i=0;i<e.length;i++)e[i].setAttribute("material",{color:this.data.modelColor,transparent:n,opacity:this.data.modelOpacity})},updateReferenceSpace:function(){var e=this,t=this.el.sceneEl.xrSession;if(this.referenceSpace=void 0,t){var n=e.el.sceneEl.systems.webxr.sessionReferenceSpaceType;t.requestReferenceSpace(n).then((function(t){e.referenceSpace=t})).catch((function(t){throw e.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(n,"tracked-controls-webxr uses reference space "+n),t}))}},checkIfControllerPresent:function(){var e=this.data,t=e.hand?e.hand:void 0;o(this,"",{hand:t,iterateControllerProfiles:!0,handTracking:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},tick:function(){var e=this.el.sceneEl,t=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller,n=e.frame,i=this.el.components["tracked-controls"],r=this.referenceSpace;t&&n&&r&&i&&(this.hasPoses=!1,t.hand&&(this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),this.hasPoses=n.fillPoses(t.hand.values(),r,this.jointPoses)&&n.fillJointRadii(t.hand.values(),this.jointRadii),this.updateHandModel(),this.detectGesture(),this.updateWristObject()))},updateWristObject:(i=new THREE.Matrix4,function(){var e=this.wristObject3D;e&&this.hasPoses&&(i.fromArray(this.jointPoses,0),e.position.setFromMatrixPosition(i),e.quaternion.setFromRotationMatrix(i))}),updateHandModel:function(){this.wristObject3D.visible=!0,this.el.object3D.visible=!0,"dots"===this.data.modelStyle&&this.updateHandDotsModel(),"mesh"===this.data.modelStyle&&this.updateHandMeshModel()},getBone:function(e){for(var t=this.bones,n=0;n<t.length;n++)if(t[n].name===e)return t[n];return null},updateHandMeshModel:function(){var e=new THREE.Matrix4;return function(){var t=0,n=this.jointPoses,i=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller;if(i&&this.mesh&&(this.mesh.visible=!1,this.hasPoses))for(var r of i.hand.values()){var s=this.getBone(r.jointName);null!=s&&(this.mesh.visible=!0,e.fromArray(n,16*t),s.position.setFromMatrixPosition(e),s.quaternion.setFromRotationMatrix(e)),t++}}}(),updateHandDotsModel:function(){for(var e,t,n=this.jointPoses,i=this.jointRadii,r=this.el.components["tracked-controls"]&&this.el.components["tracked-controls"].controller,s=0;s<r.hand.size;s++)t=(e=this.jointEls[s]).object3D,e.object3D.visible=this.hasPoses,this.hasPoses&&(t.matrix.fromArray(n,16*s),t.matrix.decompose(t.position,t.rotation,t.scale),e.setAttribute("scale",{x:i[s],y:i[s],z:i[s]}))},detectGesture:function(){this.detectPinch()},detectPinch:function(){var e=new THREE.Vector3,t=new THREE.Matrix4;return function(){var n=this.indexTipPosition,i=this.pinchEventDetail;if(this.hasPoses){e.setFromMatrixPosition(t.fromArray(this.jointPoses,64)),n.setFromMatrixPosition(t.fromArray(this.jointPoses,144)),i.wristRotation.setFromRotationMatrix(t.fromArray(this.jointPoses,0));var r=n.distanceTo(e);r<.015&&!1===this.isPinched&&(this.isPinched=!0,i.position.copy(n).add(e).multiplyScalar(.5),this.el.emit("pinchstarted",i)),r>.02&&!0===this.isPinched&&(this.isPinched=!1,i.position.copy(n).add(e).multiplyScalar(.5),this.el.emit("pinchended",i)),this.isPinched&&(i.position.copy(n).add(e).multiplyScalar(.5),this.el.emit("pinchmoved",i))}}}(),pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{id:"",hand:t.hand,iterateControllerProfiles:!0,handTrackingEnabled:!0}),this.mesh?this.mesh!==e.getObject3D("mesh")&&e.setObject3D("mesh",this.mesh):this.initDefaultModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){var e,t=this.el;this.checkIfControllerPresent(),e=t.components["tracked-controls"]&&t.components["tracked-controls"].controller,this.mesh&&e&&e.hand&&e.hand instanceof XRHand&&t.setObject3D("mesh",this.mesh)},initDefaultModel:function(){var e=this.data;"dots"===e.modelStyle&&this.initDotsModel(),"mesh"===e.modelStyle&&this.initMeshHandModel(),this.el.object3D.visible=!0,this.wristObject3D.visible=!0},initDotsModel:function(){if(0===this.jointEls.length){for(var e=0;e<h.length;++e){var t=this.jointEl=document.createElement("a-entity");t.setAttribute("geometry",{primitive:"sphere",radius:1}),t.object3D.visible=!1,this.el.appendChild(t),this.jointEls.push(t)}this.updateModelMaterial()}},initMeshHandModel:function(){var e="left"===this.data.hand?l:c;this.el.setAttribute("gltf-model",e)},onModelLoaded:function(){var e=this.mesh=this.el.getObject3D("mesh").children[0],t=this.skinnedMesh=e.getObjectByProperty("type","SkinnedMesh");this.skinnedMesh&&(this.bones=t.skeleton.bones,this.el.removeObject3D("mesh"),e.position.set(0,0,0),e.rotation.set(0,0,0),t.frustumCulled=!1,t.material=new THREE.MeshStandardMaterial,this.updateModelMaterial(),this.setupChildrenEntities(),this.el.setObject3D("mesh",e))},setupChildrenEntities:function(){for(var e=this.el.children,t=0;t<e.length;++t)e[t]instanceof s&&this.addChildEntity(e[t])},addChildEntity:function(e){e instanceof s&&this.wristObject3D.add(e.object3D)}})},5593:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437);i("hand-tracking-grab-controls",{schema:{hand:{default:"right",oneOf:["left","right"]},color:{type:"color",default:"white"},hoverColor:{type:"color",default:"#538df1"},hoverEnabled:{default:!1}},init:function(){var e,t=this.el,n=this.data;e="right"===n.hand?"components.hand-tracking-controls.bones.3":"components.hand-tracking-controls.bones.21",t.setAttribute("hand-tracking-controls",{hand:n.hand}),t.setAttribute("obb-collider",{trackedObject3D:e,size:.04}),this.auxMatrix=new r.Matrix4,this.onCollisionStarted=this.onCollisionStarted.bind(this),this.el.addEventListener("obbcollisionstarted",this.onCollisionStarted),this.onCollisionEnded=this.onCollisionEnded.bind(this),this.el.addEventListener("obbcollisionended",this.onCollisionEnded),this.onPinchStarted=this.onPinchStarted.bind(this),this.el.addEventListener("pinchstarted",this.onPinchStarted),this.onPinchEnded=this.onPinchEnded.bind(this),this.el.addEventListener("pinchended",this.onPinchEnded)},transferEntityOwnership:function(){for(var e,t=this.el.sceneEl.querySelectorAll("[hand-tracking-grab-controls]"),n=0;n<t.length;++n)(e=t[n].components["hand-tracking-grab-controls"])!==this&&this.grabbedEl&&this.grabbedEl===e.grabbedEl&&e.releaseGrabbedEntity();return!1},onCollisionStarted:function(e){var t=e.detail.withEl;this.collidedEl||t.getAttribute("grabbable")&&(this.collidedEl=t,this.grabbingObject3D=e.detail.trackedObject3D,this.data.hoverEnabled&&this.el.setAttribute("hand-tracking-controls","modelColor",this.data.hoverColor))},onCollisionEnded:function(){this.collidedEl=void 0,this.grabbedEl||(this.grabbingObject3D=void 0,this.data.hoverEnabled&&this.el.setAttribute("hand-tracking-controls","modelColor",this.data.color))},onPinchStarted:function(e){this.collidedEl&&(this.grabbedEl=this.collidedEl,this.transferEntityOwnership(),this.grab())},onPinchEnded:function(){this.releaseGrabbedEntity()},releaseGrabbedEntity:function(){var e=this.grabbedEl;if(e){var t=e.object3D,n=t.parent,i=this.originalParent;t.applyMatrix4(n.matrixWorld),t.applyMatrix4(this.auxMatrix.copy(i.matrixWorld).invert()),n.remove(t),i.add(t),this.el.emit("grabended",{grabbedEl:e}),this.grabbedEl=void 0,this.originalParent=void 0}},grab:function(){var e=this.grabbedEl,t=e.object3D,n=t.parent;this.originalParent=n;var i=this.el.components["hand-tracking-controls"].wristObject3D;t.applyMatrix4(n.matrixWorld),t.applyMatrix4(this.auxMatrix.copy(i.matrixWorld).invert()),n.remove(t),i.add(t),this.el.emit("grabstarted",{grabbedEl:e})}})},5387:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("hide-on-enter-ar",{init:function(){var e=this;this.el.sceneEl.addEventListener("enter-vr",(function(){e.el.sceneEl.is("ar-mode")&&(e.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){e.el.object3D.visible=!0}))}})},1620:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("hide-on-enter-vr",{init:function(){var e=this;this.el.sceneEl.addEventListener("enter-vr",(function(){e.el.sceneEl.is("vr-mode")&&(e.el.object3D.visible=!1)})),this.el.sceneEl.addEventListener("exit-vr",(function(){e.el.object3D.visible=!0}))}})},7538:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="hp-mixed-reality",h=n(1343).AFRAME_CDN_ROOT+"controllers/hp/mixed-reality/",d={x:0,y:0,z:.06},u={_x:Math.PI/4,_y:0,_z:0,_order:"XYZ"};e.exports.Component=i("hp-mixed-reality-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{left:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{touchpad:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var e=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){l(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e,e.data.hand)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e,e.data.hand)},this.previousButtonValues={},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;o(this,c,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:c,hand:t.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",h+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t=e.detail.model;this.data.model&&(t.position.copy(d),t.rotation.copy(u),this.el.emit("controllermodelready",{name:"hp-mixed-reality-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)}))},onAxisMoved:function(e){a(this,this.mapping.axes,e)}})},8850:(e,t,n)=>{n(6896),n(2784),n(4395),n(3674),n(9840),n(8388),n(297),n(9194),n(9686),n(5593),n(332),n(5387),n(1620),n(7538),n(6219),n(9248),n(8798),n(6298),n(7796),n(7701),n(7850),n(298),n(3069),n(3176),n(8771),n(6077),n(3942),n(2588),n(7519),n(7394),n(2310),n(4760),n(1072),n(477),n(1603),n(6547),n(5300),n(7360),n(1507),n(4592),n(6458),n(221),n(3575),n(4005),n(3494),n(6273),n(3239),n(2288),n(6149),n(2130),n(3791),n(2662),n(952),n(1217),n(8346),n(6469)},9248:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7427);i("laser-controls",{schema:{hand:{default:"right"},model:{default:!0},defaultModelColor:{type:"color",default:"grey"}},init:function(){var e=this.config,t=this.data,n=this.el,i=this,s={hand:t.hand,model:t.model};function o(t){var s=e[t.detail.name];if(s){var o=r.extend({showLine:!0},s.raycaster||{});t.detail.rayOrigin&&(o.origin=t.detail.rayOrigin.origin,o.direction=t.detail.rayOrigin.direction,o.showLine=!0),t.detail.rayOrigin||!i.modelReady?n.setAttribute("raycaster",o):n.setAttribute("raycaster","showLine",!0),n.setAttribute("cursor",r.extend({fuse:!1},s.cursor))}}n.setAttribute("hp-mixed-reality-controls",s),n.setAttribute("magicleap-controls",s),n.setAttribute("oculus-go-controls",s),n.setAttribute("meta-touch-controls",s),n.setAttribute("pico-controls",s),n.setAttribute("valve-index-controls",s),n.setAttribute("vive-controls",s),n.setAttribute("vive-focus-controls",s),n.setAttribute("windows-motion-controls",s),n.setAttribute("generic-tracked-controller-controls",{hand:s.hand}),n.addEventListener("controllerconnected",o),n.addEventListener("controllerdisconnected",(function(t){e[t.detail.name]&&n.setAttribute("raycaster","showLine",!1)})),n.addEventListener("controllermodelready",(function(e){o(e),i.modelReady=!0}))},config:{"generic-tracked-controller-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"hp-mixed-reality-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"magicleap-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"oculus-go-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:5e-4,z:0}}},"meta-touch-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{origin:{x:0,y:0,z:0}}},"pico-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"valve-index-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]}},"vive-focus-controls":{cursor:{downEvents:["trackpaddown","triggerdown"],upEvents:["trackpadup","triggerup"]}},"windows-motion-controls":{cursor:{downEvents:["triggerdown"],upEvents:["triggerup"]},raycaster:{showLine:!1}}}})},6219:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7427).debug("components:layer:warn");e.exports.Component=i("layer",{schema:{type:{default:"quad",oneOf:["quad","monocubemap","stereocubemap"]},src:{type:"map"},rotateCubemap:{default:!1},width:{default:0},height:{default:0}},init:function(){var e=this.el.sceneEl.renderer.getContext();this.quaternion=new THREE.Quaternion,this.position=new THREE.Vector3,this.bindMethods(),this.needsRedraw=!1,this.frameBuffer=e.createFramebuffer();var t=this.el.sceneEl.getAttribute("webxr"),n=t.requiredFeatures;-1===n.indexOf("layers")&&(n.push("layers"),this.el.sceneEl.setAttribute("webxr",t)),this.el.sceneEl.addEventListener("enter-vr",this.onEnterVR),this.el.sceneEl.addEventListener("exit-vr",this.onExitVR)},bindMethods:function(){this.onRequestedReferenceSpace=this.onRequestedReferenceSpace.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this)},update:function(e){this.data.src!==e.src&&this.updateSrc()},updateSrc:function(){var e=this.data.type;this.texture=void 0,"quad"!==e?"monocubemap"!==e&&"stereocubemap"!==e||this.loadCubeMapImages():this.loadQuadImage()},loadCubeMapImages:function(){var e,t=this.xrGLFactory,n=this.el.sceneEl.frame,i=this.data.src,r=this.data.type;this.visibilityChanged=!1,this.layer&&("monocubemap"!==r&&"stereocubemap"!==r||(i.complete?this.pendingCubeMapUpdate=!1:this.pendingCubeMapUpdate=!0,this.loadingScreen?this.loadingScreen=!1:this.loadingScreen=!0,"monocubemap"===r?(e=t.getSubImage(this.layer,n),this.loadCubeMapImage(e.colorTexture,i,0)):(e=t.getSubImage(this.layer,n,"left"),this.loadCubeMapImage(e.colorTexture,i,0),e=t.getSubImage(this.layer,n,"right"),this.loadCubeMapImage(e.colorTexture,i,6))))},loadQuadImage:function(){var e=this.data.src,t=this;this.el.sceneEl.systems.material.loadTexture(e,{src:e},(function(n){t.el.sceneEl.renderer.initTexture(n),t.texture=n,"VIDEO"===e.tagName&&setTimeout((function(){t.textureIsVideo=!0}),1e3),t.layer&&(t.layer.height=t.data.height/2||t.texture.image.height/1e3,t.layer.width=t.data.width/2||t.texture.image.width/1e3,t.needsRedraw=!0),t.updateQuadPanel()}))},preGenerateCubeMapTextures:function(e,t){"monocubemap"===this.data.type?this.generateCubeMapTextures(e,0,t):(this.generateCubeMapTextures(e,0,t),this.generateCubeMapTextures(e,6,t))},generateCubeMapTextures:function(e,t,n){for(var i,r,s=this.data,o=this.cubeFaceSize,a=Math.min(e.width,e.height),l=[],c=0;c<6;c++){var h=document.createElement("CANVAS");h.width=h.height=o;var d=h.getContext("2d");s.rotateCubemap&&(2!==c&&3!==c||(d.save(),d.translate(o,o),d.rotate(Math.PI))),d.drawImage(e,(c+t)*a,0,a,a,0,0,o,o),d.restore(),n&&n(),l.push(h)}return s.rotateCubemap&&(i=l[0],r=l[1],l[0]=r,l[1]=i,i=l[4],r=l[5],l[4]=r,l[5]=i),n&&n(),l},loadCubeMapImage:function(e,t,n){var i,r=this.el.sceneEl.renderer.getContext();r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,!1),r.bindTexture(r.TEXTURE_CUBE_MAP,e),i=!t.complete||this.loadingScreen?this.loadingScreenImages:this.generateCubeMapTextures(t,n);var s=0;i.forEach((function(e,t){r.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,r.RGBA,r.UNSIGNED_BYTE,e),s=r.getError()})),0!==s&&console.log("renderingError, WebGL Error Code: "+s),r.bindTexture(r.TEXTURE_CUBE_MAP,null)},tick:function(){this.el.sceneEl.xrSession&&(this.layer||!this.el.sceneEl.is("vr-mode")&&!this.el.sceneEl.is("ar-mode")||this.initLayer(),this.updateTransform(),this.data.src.complete&&(this.pendingCubeMapUpdate||this.loadingScreen||this.visibilityChanged)&&this.loadCubeMapImages(),(this.needsRedraw||this.layer.needsRedraw||this.textureIsVideo)&&("quad"===this.data.type&&this.draw(),this.needsRedraw=!1))},initLayer:function(){var e=this,t=this.data.type;this.el.sceneEl.xrSession.onvisibilitychange=function(t){e.visibilityChanged="hidden"!==t.session.visibilityState},"quad"!==t?"monocubemap"!==t&&"stereocubemap"!==t||this.initCubeMapLayer():this.initQuadLayer()},initQuadLayer:function(){var e=this.el.sceneEl,t=e.renderer.getContext(),n=this.xrGLFactory=new XRWebGLBinding(e.xrSession,t);this.texture&&(this.layer=n.createQuadLayer({space:this.referenceSpace,viewPixelHeight:2048,viewPixelWidth:2048,height:this.data.height/2||this.texture.image.height/1e3,width:this.data.width/2||this.texture.image.width/1e3}),this.initLoadingScreenImages(),e.renderer.xr.addLayer(this.layer))},initCubeMapLayer:function(){var e=this.data.src,t=this.el.sceneEl,n=t.renderer.getContext(),i=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),r=this.cubeFaceSize=Math.min(i,Math.min(e.width,e.height)),s=this.xrGLFactory=new XRWebGLBinding(t.xrSession,n);this.layer=s.createCubeLayer({space:this.referenceSpace,viewPixelWidth:r,viewPixelHeight:r,layout:"monocubemap"===this.data.type?"mono":"stereo",isStatic:!1}),this.initLoadingScreenImages(),this.loadCubeMapImages(),t.renderer.xr.addLayer(this.layer)},initLoadingScreenImages:function(){for(var e=this.cubeFaceSize,t=this.loadingScreenImages=[],n=0;n<6;n++){var i=document.createElement("CANVAS");i.width=i.height=e;var r=i.getContext("2d");i.width=i.height=e,r.fillStyle="black",r.fillRect(0,0,e,e),2!==n&&3!==n&&(r.translate(e,0),r.scale(-1,1),r.fillStyle="white",r.font="30px Arial",r.fillText("Loading",e/2,e/2)),t.push(i)}},destroyLayer:function(){this.layer&&(this.el.sceneEl.renderer.xr.removeLayer(this.layer),this.layer.destroy(),this.layer=void 0)},toggleCompositorLayer:function(){this.enableCompositorLayer(!this.layerEnabled)},enableCompositorLayer:function(e){this.layerEnabled=e,this.quadPanelEl.object3D.visible=!this.layerEnabled},updateQuadPanel:function(){var e=this.quadPanelEl;this.quadPanelEl||(e=this.quadPanelEl=document.createElement("a-entity"),this.el.appendChild(e)),e.setAttribute("material",{shader:"flat",src:this.data.src,transparent:!0}),e.setAttribute("geometry",{primitive:"plane",height:this.data.height||this.texture.image.height/1e3,width:this.data.width||this.texture.image.height/1e3})},draw:function(){var e=this.el.sceneEl,t=this.el.sceneEl.renderer.getContext(),n=this.xrGLFactory.getSubImage(this.layer,e.frame),i=e.renderer.properties.get(this.texture).__webglTexture,r=t.getParameter(t.FRAMEBUFFER_BINDING);t.viewport(n.viewport.x,n.viewport.y,n.viewport.width,n.viewport.height),t.bindFramebuffer(t.FRAMEBUFFER,this.frameBuffer),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n.colorTexture,0),function(e,t,n,i){var r=e.createFramebuffer(),s=n.viewport.x,o=n.viewport.y,a=n.viewport.x+n.viewport.width,l=n.viewport.y+n.viewport.height;"VIDEO"===i.tagName&&(e.bindTexture(e.TEXTURE_2D,t),e.texSubImage2D(e.TEXTURE_2D,0,0,0,i.width,i.height,e.RGB,e.UNSIGNED_BYTE,i)),e.bindFramebuffer(e.READ_FRAMEBUFFER,r),e.framebufferTexture2D(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),e.readBuffer(e.COLOR_ATTACHMENT0),e.blitFramebuffer(0,0,i.width,i.height,s,o,a,l,e.COLOR_BUFFER_BIT,e.NEAREST),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.deleteFramebuffer(r)}(t,i,n,this.data.src),t.bindFramebuffer(t.FRAMEBUFFER,r)},updateTransform:function(){var e=this.el,t=this.position,n=this.quaternion;e.object3D.updateMatrixWorld(),t.setFromMatrixPosition(e.object3D.matrixWorld),n.setFromRotationMatrix(e.object3D.matrixWorld),this.layerEnabled||t.set(0,0,1e8),this.layer.transform=new XRRigidTransform(t,n)},onEnterVR:function(){var e=this.el.sceneEl,t=e.xrSession;e.hasWebXR&&XRWebGLBinding&&t?(t.requestReferenceSpace("local-floor").then(this.onRequestedReferenceSpace),this.layerEnabled=!0,this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!1),this.data.src.play&&this.data.src.play()):r("The layer component requires WebXR and the layers API enabled")},onExitVR:function(){this.quadPanelEl&&(this.quadPanelEl.object3D.visible=!0),this.destroyLayer()},onRequestedReferenceSpace:function(e){this.referenceSpace=e}})},8798:(e,t,n)=>{var i,r,s,o,a,l,c=n(7427),h=c.diff,d=n(8940),u=n(8190).registerComponent,p=n(9437),A=n(3657),f=p.MathUtils.degToRad,m=d("components:light:warn"),g=new p.CubeTextureLoader,v={};e.exports.Component=u("light",{schema:{angle:{default:60,if:{type:["spot"]}},color:{type:"color",if:{type:["ambient","directional","hemisphere","point","spot"]}},envMap:{default:"",if:{type:["probe"]}},groundColor:{type:"color",if:{type:["hemisphere"]}},decay:{default:1,if:{type:["point","spot"]}},distance:{default:0,min:0,if:{type:["point","spot"]}},intensity:{default:3.14,min:0,if:{type:["ambient","directional","hemisphere","point","spot","probe"]}},penumbra:{default:0,min:0,max:1,if:{type:["spot"]}},type:{default:"directional",oneOf:["ambient","directional","hemisphere","point","spot","probe"],schemaChange:!0},target:{type:"selector",if:{type:["spot","directional"]}},castShadow:{default:!1,if:{type:["point","spot","directional"]}},shadowBias:{default:0,if:{castShadow:!0}},shadowCameraFar:{default:500,if:{castShadow:!0}},shadowCameraFov:{default:90,if:{castShadow:!0}},shadowCameraNear:{default:.5,if:{castShadow:!0}},shadowCameraTop:{default:5,if:{castShadow:!0}},shadowCameraRight:{default:5,if:{castShadow:!0}},shadowCameraBottom:{default:-5,if:{castShadow:!0}},shadowCameraLeft:{default:-5,if:{castShadow:!0}},shadowCameraVisible:{default:!1,if:{castShadow:!0}},shadowCameraAutomatic:{default:"",if:{type:["directional"]}},shadowMapHeight:{default:512,if:{castShadow:!0}},shadowMapWidth:{default:512,if:{castShadow:!0}},shadowRadius:{default:1,if:{castShadow:!0}}},init:function(){var e=this.el;this.light=null,this.defaultTarget=null,this.system.registerLight(e)},update:function(e){var t=this.data,n=h(t,e),i=this.light,r=this;if(!i||"type"in n)this.setLight(this.data),this.updateShadow();else{var s=!1;Object.keys(n).forEach((function(e){var n=t[e];switch(e){case"color":i.color.set(n);break;case"groundColor":i.groundColor.set(n);break;case"angle":i.angle=f(n);break;case"target":null===n?"spot"!==t.type&&"directional"!==t.type||(i.target=r.defaultTarget):n.hasLoaded?r.onSetTarget(n,i):n.addEventListener("loaded",r.onSetTarget.bind(r,n,i));break;case"envMap":r.updateProbeMap(t,i);break;case"castShadow":case"shadowBias":case"shadowCameraFar":case"shadowCameraFov":case"shadowCameraNear":case"shadowCameraTop":case"shadowCameraRight":case"shadowCameraBottom":case"shadowCameraLeft":case"shadowCameraVisible":case"shadowMapHeight":case"shadowMapWidth":case"shadowRadius":s||(r.updateShadow(),s=!0);break;case"shadowCameraAutomatic":t.shadowCameraAutomatic?r.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(t.shadowCameraAutomatic)):r.shadowCameraAutomaticEls=[];break;default:i[e]=n}}))}},tick:(i=new p.Box3,r=new p.Vector3,s=new p.Vector3,o=new p.Matrix4,a=new p.Sphere,l=new p.Vector3,function(){if("directional"===this.data.type&&this.light.shadow&&this.light.shadow.camera instanceof p.OrthographicCamera&&this.shadowCameraAutomaticEls.length){var e=this.light.shadow.camera;e.getWorldDirection(r),e.getWorldPosition(s),o.copy(e.matrixWorld),o.invert(),e.near=1,e.left=1e5,e.right=-1e5,e.top=-1e5,e.bottom=1e5,this.shadowCameraAutomaticEls.forEach((function(t){i.setFromObject(t.object3D),i.getBoundingSphere(a);var n=A.distanceOfPointFromPlane(s,r,a.center),c=A.nearestPointInPlane(s,r,a.center,l).applyMatrix4(o);e.near=Math.min(-n-a.radius-1,e.near),e.left=Math.min(-a.radius+c.x,e.left),e.right=Math.max(a.radius+c.x,e.right),e.top=Math.max(a.radius+c.y,e.top),e.bottom=Math.min(-a.radius+c.y,e.bottom)})),e.updateProjectionMatrix()}}),setLight:function(e){var t=this.el,n=this.getLight(e);n&&(this.light&&t.removeObject3D("light"),this.light=n,this.light.el=t,t.setObject3D("light",this.light),"spot"!==e.type&&"directional"!==e.type&&"hemisphere"!==e.type||t.getObject3D("light").translateY(-1),"spot"===e.type&&(t.setObject3D("light-target",this.defaultTarget),t.getObject3D("light-target").position.set(0,0,-1)),e.shadowCameraAutomatic?this.shadowCameraAutomaticEls=Array.from(document.querySelectorAll(e.shadowCameraAutomatic)):this.shadowCameraAutomaticEls=[])},updateShadow:function(){var e=this.el,t=this.data,n=this.light;n.castShadow=t.castShadow;var i=e.getObject3D("cameraHelper");if(t.shadowCameraVisible&&!i?(i=new p.CameraHelper(n.shadow.camera),e.setObject3D("cameraHelper",i)):!t.shadowCameraVisible&&i&&e.removeObject3D("cameraHelper"),!t.castShadow)return n;n.shadow.bias=t.shadowBias,n.shadow.radius=t.shadowRadius,n.shadow.mapSize.height=t.shadowMapHeight,n.shadow.mapSize.width=t.shadowMapWidth,n.shadow.camera.near=t.shadowCameraNear,n.shadow.camera.far=t.shadowCameraFar,n.shadow.camera instanceof p.OrthographicCamera?(n.shadow.camera.top=t.shadowCameraTop,n.shadow.camera.right=t.shadowCameraRight,n.shadow.camera.bottom=t.shadowCameraBottom,n.shadow.camera.left=t.shadowCameraLeft):n.shadow.camera.fov=t.shadowCameraFov,n.shadow.camera.updateProjectionMatrix(),i&&i.update()},getLight:function(e){var t=e.angle,n=new p.Color(e.color);n=n.getHex();var i=e.decay,r=e.distance,s=new p.Color(e.groundColor);s=s.getHex();var o=e.intensity,a=e.type,l=e.target,c=null;switch(a.toLowerCase()){case"ambient":return new p.AmbientLight(n,o);case"directional":return c=new p.DirectionalLight(n,o),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"hemisphere":return new p.HemisphereLight(n,s,o);case"point":return new p.PointLight(n,o,r,i);case"spot":return c=new p.SpotLight(n,o,r,f(t),e.penumbra,i),this.defaultTarget=c.target,l&&(l.hasLoaded?this.onSetTarget(l,c):l.addEventListener("loaded",this.onSetTarget.bind(this,l,c))),c;case"probe":return c=new p.LightProbe,this.updateProbeMap(e,c),c;default:m("%s is not a valid light type. Choose from ambient, directional, hemisphere, point, spot.",a)}},updateProbeMap:function(e,t){e.envMap?(void 0===v[e.envMap]&&(v[e.envMap]=new window.Promise((function(t){c.srcLoader.validateCubemapSrc(e.envMap,(function(n){g.load(n,(function(n){var i=p.LightProbeGenerator.fromCubeTexture(n);v[e.envMap]=i,t(i)}))}))}))),v[e.envMap]instanceof window.Promise?v[e.envMap].then((function(e){t.copy(e)})):v[e.envMap]instanceof p.LightProbe&&t.copy(v[e.envMap])):t.copy(new p.LightProbe)},onSetTarget:function(e,t){t.target=e.object3D},remove:function(){var e=this.el;e.removeObject3D("light"),e.getObject3D("cameraHelper")&&e.removeObject3D("cameraHelper")}})},6298:(e,t,n)=>{var i=n(8190).registerComponent;function r(e,t){return!(!e||!t)&&e.x===t.x&&e.y===t.y&&e.z===t.z}e.exports.Component=i("line",{schema:{start:{type:"vec3",default:{x:0,y:0,z:0}},end:{type:"vec3",default:{x:0,y:0,z:0}},color:{type:"color",default:"#74BEC1"},opacity:{type:"number",default:1},visible:{default:!0}},multiple:!0,init:function(){var e,t,n=this.data;t=this.material=new THREE.LineBasicMaterial({color:n.color,opacity:n.opacity,transparent:n.opacity<1,visible:n.visible}),(e=this.geometry=new THREE.BufferGeometry).setAttribute("position",new THREE.BufferAttribute(new Float32Array(6),3)),this.line=new THREE.Line(e,t),this.el.setObject3D(this.attrName,this.line)},update:function(e){var t=this.data,n=this.geometry,i=!1,s=this.material,o=n.attributes.position.array;r(t.start,e.start)||(o[0]=t.start.x,o[1]=t.start.y,o[2]=t.start.z,i=!0),r(t.end,e.end)||(o[3]=t.end.x,o[4]=t.end.y,o[5]=t.end.z,i=!0),i&&(n.attributes.position.needsUpdate=!0,n.computeBoundingSphere()),s.color.setStyle(t.color),s.opacity=t.opacity,s.transparent=t.opacity<1,s.visible=t.visible},remove:function(){this.el.removeObject3D(this.attrName,this.line)}})},7796:(e,t,n)=>{var i,r,s,o,a,l,c,h,d=n(8190).registerComponent,u=n(5892).registerShader,p=n(9437);e.exports.Component=d("link",{schema:{backgroundColor:{default:"red",type:"color"},borderColor:{default:"white",type:"color"},highlighted:{default:!1},highlightedColor:{default:"#24CAFF",type:"color"},href:{default:""},image:{type:"asset"},on:{default:"click"},peekMode:{default:!1},title:{default:""},titleColor:{default:"white",type:"color"},visualAspectEnabled:{default:!1}},init:function(){this.navigate=this.navigate.bind(this),this.previousQuaternion=void 0,this.quaternionClone=new p.Quaternion,this.hiddenEls=[]},update:function(e){var t,n,i=this.data,r=this.el;if(i.visualAspectEnabled){var s=this.el.getAttribute("scale");this.previewDistance=15*(s.x+s.y)/2,this.initVisualAspect(),t=i.highlighted?i.highlightedColor:i.backgroundColor,n=i.highlighted?i.highlightedColor:i.borderColor,r.setAttribute("material","backgroundColor",t),r.setAttribute("material","strokeColor",n),i.on!==e.on&&this.updateEventListener(),void 0!==e.peekMode&&i.peekMode!==e.peekMode&&this.updatePeekMode(),i.image&&e.image!==i.image&&r.setAttribute("material","pano","string"==typeof i.image?i.image:i.image.src)}},updatePeekMode:function(){var e=this.el,t=this.sphereEl;this.data.peekMode?(this.hideAll(),e.getObject3D("mesh").visible=!1,t.setAttribute("visible",!0)):(this.showAll(),e.getObject3D("mesh").visible=!0,t.setAttribute("visible",!1))},play:function(){this.updateEventListener()},pause:function(){this.removeEventListener()},updateEventListener:function(){var e=this.el;e.isPlaying&&(this.removeEventListener(),e.addEventListener(this.data.on,this.navigate))},removeEventListener:function(){var e=this.data.on;e&&this.el.removeEventListener(e,this.navigate)},initVisualAspect:function(){var e,t,n,i=this.el;this.data.visualAspectEnabled&&!this.visualAspectInitialized&&(n=this.textEl=this.textEl||document.createElement("a-entity"),t=this.sphereEl=this.sphereEl||document.createElement("a-entity"),e=this.semiSphereEl=this.semiSphereEl||document.createElement("a-entity"),i.setAttribute("geometry",{primitive:"circle",radius:1,segments:64}),i.setAttribute("material",{shader:"portal",pano:this.data.image,side:"double",previewDistance:this.previewDistance}),n.setAttribute("text",{color:this.data.titleColor,align:"center",font:"kelsonsans",value:this.data.title||this.data.href,width:4}),n.setAttribute("position","0 1.5 0"),i.appendChild(n),e.setAttribute("geometry",{primitive:"sphere",radius:1,phiStart:0,segmentsWidth:64,segmentsHeight:64,phiLength:180,thetaStart:0,thetaLength:360}),e.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back",previewDistance:this.previewDistance}),e.setAttribute("rotation","0 180 0"),e.setAttribute("position","0 0 0"),e.setAttribute("visible",!1),i.appendChild(e),t.setAttribute("geometry",{primitive:"sphere",radius:10,segmentsWidth:64,segmentsHeight:64}),t.setAttribute("material",{shader:"portal",borderEnabled:0,pano:this.data.image,side:"back",previewDistance:this.previewDistance}),t.setAttribute("visible",!1),i.appendChild(t),this.visualAspectInitialized=!0)},navigate:function(){window.location=this.data.href},tick:(a=new p.Vector3,l=new p.Vector3,c=new p.Quaternion,h=new p.Vector3,function(){var e,t,n=this.el,i=n.object3D,r=n.sceneEl.camera,s=this.textEl;if(this.data.visualAspectEnabled)if(i.updateMatrixWorld(),r.parent.updateMatrixWorld(),r.updateMatrixWorld(),i.matrix.decompose(l,c,h),l.setFromMatrixPosition(i.matrixWorld),a.setFromMatrixPosition(r.matrixWorld),(t=l.distanceTo(a))>1.33333*this.previewDistance)this.previousQuaternion||(this.quaternionClone.copy(c),this.previousQuaternion=this.quaternionClone),i.lookAt(a);else{if(e=this.calculateCameraPortalOrientation(),t<.5){if(!0===this.semiSphereEl.getAttribute("visible"))return;s.setAttribute("text","width",1.5),e<=0?(s.setAttribute("position","0 0 0.75"),s.setAttribute("rotation","0 180 0"),this.semiSphereEl.setAttribute("rotation","0 0 0")):(s.setAttribute("position","0 0 -0.75"),s.setAttribute("rotation","0 0 0"),this.semiSphereEl.setAttribute("rotation","0 180 0")),n.getObject3D("mesh").visible=!1,this.semiSphereEl.setAttribute("visible",!0),this.peekCameraPortalOrientation=e}else e<=0?s.setAttribute("rotation","0 180 0"):s.setAttribute("rotation","0 0 0"),s.setAttribute("text","width",5),s.setAttribute("position","0 1.5 0"),n.getObject3D("mesh").visible=!0,this.semiSphereEl.setAttribute("visible",!1),this.peekCameraPortalOrientation=void 0;this.previousQuaternion&&(i.quaternion.copy(this.previousQuaternion),this.previousQuaternion=void 0)}}),hideAll:function(){var e=this.el,t=this.hiddenEls,n=this;t.length>0||e.sceneEl.object3D.traverse((function(i){i&&i.el&&i.el.hasAttribute("link-controls")||i.el&&i!==e.sceneEl.object3D&&i.el!==e&&i.el!==n.sphereEl&&i.el!==e.sceneEl.cameraEl&&!1!==i.el.getAttribute("visible")&&i.el!==n.textEl&&i.el!==n.semiSphereEl&&(i.el.setAttribute("visible",!1),t.push(i.el))}))},showAll:function(){this.hiddenEls.forEach((function(e){e.setAttribute("visible",!0)})),this.hiddenEls=[]},calculateCameraPortalOrientation:(i=new p.Matrix4,r=new p.Vector3,s=new p.Vector3(0,0,1),o=new p.Vector3(0,0,0),function(){var e=this.el,t=e.sceneEl.camera;return r.set(0,0,0),s.set(0,0,1),o.set(0,0,0),e.object3D.matrixWorld.extractRotation(i),s.applyMatrix4(i),e.object3D.updateMatrixWorld(),e.object3D.localToWorld(o),t.parent.parent.updateMatrixWorld(),t.parent.updateMatrixWorld(),t.updateMatrixWorld(),t.localToWorld(r),r.sub(o).normalize(),s.normalize(),Math.sign(s.dot(r))}),remove:function(){this.removeEventListener()}}),u("portal",{schema:{borderEnabled:{default:1,type:"int",is:"uniform"},backgroundColor:{default:"red",type:"color",is:"uniform"},pano:{type:"map",is:"uniform"},strokeColor:{default:"white",type:"color",is:"uniform"},previewDistance:{default:15,type:"float",is:"uniform"}},vertexShader:["vec3 portalPosition;","varying vec3 vWorldPosition;","varying float vDistanceToCenter;","varying float vDistance;","void main() {","vDistanceToCenter = clamp(length(position - vec3(0.0, 0.0, 0.0)), 0.0, 1.0);","portalPosition = (modelMatrix * vec4(0.0, 0.0, 0.0, 1.0)).xyz;","vDistance = length(portalPosition - cameraPosition);","vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;","gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI2 0.15915494","uniform sampler2D pano;","uniform vec3 strokeColor;","uniform vec3 backgroundColor;","uniform float borderEnabled;","uniform float previewDistance;","varying float vDistanceToCenter;","varying float vDistance;","varying vec3 vWorldPosition;","void main() {","vec3 direction = normalize(vWorldPosition - cameraPosition);","vec2 sampleUV;","float borderThickness = clamp(exp(-vDistance / 50.0), 0.6, 0.95);","sampleUV.y = clamp(direction.y * 0.5 + 0.5, 0.0, 1.0);","sampleUV.x = atan(direction.z, -direction.x) * -RECIPROCAL_PI2 + 0.5;","if (vDistanceToCenter > borderThickness && borderEnabled == 1.0) {","gl_FragColor = vec4(strokeColor, 1.0);","} else {","gl_FragColor = mix(texture2D(pano, sampleUV), vec4(backgroundColor, 1.0), clamp(pow((vDistance / previewDistance), 2.0), 0.0, 1.0));","}","}"].join("\n")})},7701:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="logitech-mx-ink",h=n(1343).AFRAME_CDN_ROOT+"controllers/logitech/";e.exports.Component=i("logitech-mx-ink-controls",{schema:{hand:{default:"left"},model:{default:!0},orientationOffset:{type:"vec3"}},mapping:{left:{buttons:["front","back","none","none","none","tip"]},right:{buttons:["front","back","none","none","none","tip"]}},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){l(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e,e.data.hand)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e,e.data.hand)},this.bindMethods()},update:function(){this.data},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),e.sceneEl.removeEventListener("enter-vr",this.onEnterVR),e.sceneEl.removeEventListener("exit-vr",this.onExitVR),this.controllerEventsActive=!1},checkIfControllerPresent:function(){this.data;var e=this.controllerObject3D;e&&(e.visible=!1),o(this,c,{hand:this.data.hand,iterateControllerProfiles:!0})},injectTrackedControls:function(){var e=this.el,t=this.data,n=c;e.setAttribute("tracked-controls",{id:n,hand:t.hand,handTrackingEnabled:!1,iterateControllerProfiles:!0,orientationOffset:t.orientationOffset}),this.loadModel()},loadModel:function(){var e=this.controllerObject3D;if(this.data.model)return e?(e.visible=this.el.sceneEl.is("vr-mode"),void this.el.setObject3D("mesh",e)):void this.el.setAttribute("gltf-model",h+"logitech-mx-ink.glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){e.target===this.el&&this.data.model&&(this.el.emit("controllermodelready",{name:"logitech-mx-ink-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)}),this.controllerObject3D=this.el.getObject3D("mesh"),this.controllerObject3D.visible=this.el.sceneEl.is("vr-mode"))},onAxisMoved:function(e){a(this,this.mapping.axes,e)}})},7850:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7427),o=Math.PI/2;e.exports.Component=i("look-controls",{dependencies:["position","rotation"],schema:{enabled:{default:!0},magicWindowTrackingEnabled:{default:!0},pointerLockEnabled:{default:!1},reverseMouseDrag:{default:!1},reverseTouchDrag:{default:!1},touchEnabled:{default:!0},mouseEnabled:{default:!0}},init:function(){this.deltaYaw=0,this.previousHMDPosition=new r.Vector3,this.hmdQuaternion=new r.Quaternion,this.magicWindowAbsoluteEuler=new r.Euler,this.magicWindowDeltaEuler=new r.Euler,this.position=new r.Vector3,this.magicWindowObject=new r.Object3D,this.rotation={},this.deltaRotation={},this.savedPose=null,this.pointerLocked=!1,this.setupMouseControls(),this.bindMethods(),this.previousMouseEvent={},this.setupMagicWindowControls(),this.savedPose={position:new r.Vector3,rotation:new r.Euler},(this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode"))&&this.onEnterVR()},setupMagicWindowControls:function(){var e,t=this.data;(s.device.isMobile()||s.device.isMobileDeviceRequestingDesktopSite())&&(e=this.magicWindowControls=new r.DeviceOrientationControls(this.magicWindowObject),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission&&(e.enabled=!1,this.el.sceneEl.components["device-orientation-permission-ui"].permissionGranted?e.enabled=t.magicWindowTrackingEnabled:this.el.sceneEl.addEventListener("deviceorientationpermissiongranted",(function(){e.enabled=t.magicWindowTrackingEnabled}))))},update:function(e){var t=this.data;t.enabled!==e.enabled&&this.updateGrabCursor(t.enabled),e&&!t.magicWindowTrackingEnabled&&e.magicWindowTrackingEnabled&&(this.magicWindowAbsoluteEuler.set(0,0,0),this.magicWindowDeltaEuler.set(0,0,0)),this.magicWindowControls&&(this.magicWindowControls.enabled=t.magicWindowTrackingEnabled),e&&!t.pointerLockEnabled!==e.pointerLockEnabled&&(this.removeEventListeners(),this.addEventListeners(),this.pointerLocked&&this.exitPointerLock())},tick:function(e){this.data.enabled&&this.updateOrientation()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},remove:function(){this.removeEventListeners(),this.pointerLocked&&this.exitPointerLock()},bindMethods:function(){this.onMouseDown=this.onMouseDown.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchMove=this.onTouchMove.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.onExitVR=this.onExitVR.bind(this),this.onPointerLockChange=this.onPointerLockChange.bind(this),this.onPointerLockError=this.onPointerLockError.bind(this)},setupMouseControls:function(){this.mouseDown=!1,this.pitchObject=new r.Object3D,this.yawObject=new r.Object3D,this.yawObject.position.y=10,this.yawObject.add(this.pitchObject)},addEventListeners:function(){var e=this.el.sceneEl,t=e.canvas;t?(t.addEventListener("mousedown",this.onMouseDown,!1),window.addEventListener("mousemove",this.onMouseMove,!1),window.addEventListener("mouseup",this.onMouseUp,!1),t.addEventListener("touchstart",this.onTouchStart,{passive:!0}),window.addEventListener("touchmove",this.onTouchMove,{passive:!0}),window.addEventListener("touchend",this.onTouchEnd,{passive:!0}),e.addEventListener("enter-vr",this.onEnterVR),e.addEventListener("exit-vr",this.onExitVR),this.data.pointerLockEnabled&&(document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.addEventListener("pointerlockerror",this.onPointerLockError,!1))):e.addEventListener("render-target-loaded",this.addEventListeners.bind(this))},removeEventListeners:function(){var e=this.el.sceneEl,t=e&&e.canvas;t&&(t.removeEventListener("mousedown",this.onMouseDown),window.removeEventListener("mousemove",this.onMouseMove),window.removeEventListener("mouseup",this.onMouseUp),t.removeEventListener("touchstart",this.onTouchStart),window.removeEventListener("touchmove",this.onTouchMove),window.removeEventListener("touchend",this.onTouchEnd),e.removeEventListener("enter-vr",this.onEnterVR),e.removeEventListener("exit-vr",this.onExitVR),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("mozpointerlockchange",this.onPointerLockChange,!1),document.removeEventListener("pointerlockerror",this.onPointerLockError,!1))},updateOrientation:function(){var e=this.el.object3D,t=this.pitchObject,n=this.yawObject,i=this.el.sceneEl;(i.is("vr-mode")||i.is("ar-mode"))&&i.checkHeadsetConnected()||(this.updateMagicWindowOrientation(),e.rotation.x=this.magicWindowDeltaEuler.x+t.rotation.x,e.rotation.y=this.magicWindowDeltaEuler.y+n.rotation.y,e.rotation.z=this.magicWindowDeltaEuler.z)},updateMagicWindowOrientation:function(){var e=this.magicWindowAbsoluteEuler,t=this.magicWindowDeltaEuler;this.magicWindowControls&&this.magicWindowControls.enabled&&(this.magicWindowControls.update(),e.setFromQuaternion(this.magicWindowObject.quaternion,"YXZ"),this.previousMagicWindowYaw||0===e.y||(this.previousMagicWindowYaw=e.y),this.previousMagicWindowYaw&&(t.x=e.x,t.y+=e.y-this.previousMagicWindowYaw,t.z=e.z,this.previousMagicWindowYaw=e.y))},onMouseMove:function(e){var t,n,i,r=this.pitchObject,s=this.previousMouseEvent,a=this.yawObject;this.data.enabled&&(this.mouseDown||this.pointerLocked)&&(this.pointerLocked?(n=e.movementX||e.mozMovementX||0,i=e.movementY||e.mozMovementY||0):(n=e.screenX-s.screenX,i=e.screenY-s.screenY),this.previousMouseEvent.screenX=e.screenX,this.previousMouseEvent.screenY=e.screenY,t=this.data.reverseMouseDrag?1:-1,a.rotation.y+=.002*n*t,r.rotation.x+=.002*i*t,r.rotation.x=Math.max(-o,Math.min(o,r.rotation.x)))},onMouseDown:function(e){var t=this.el.sceneEl;if(this.data.enabled&&this.data.mouseEnabled&&(!t.is("vr-mode")&&!t.is("ar-mode")||!t.checkHeadsetConnected())&&0===e.button){var n=t&&t.canvas;this.mouseDown=!0,this.previousMouseEvent.screenX=e.screenX,this.previousMouseEvent.screenY=e.screenY,this.showGrabbingCursor(),this.data.pointerLockEnabled&&!this.pointerLocked&&(n.requestPointerLock?n.requestPointerLock():n.mozRequestPointerLock&&n.mozRequestPointerLock())}},showGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor="grabbing"},hideGrabbingCursor:function(){this.el.sceneEl.canvas.style.cursor=""},onMouseUp:function(){this.mouseDown=!1,this.hideGrabbingCursor()},onTouchStart:function(e){1!==e.touches.length||!this.data.touchEnabled||this.el.sceneEl.is("vr-mode")||this.el.sceneEl.is("ar-mode")||(this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY},this.touchStarted=!0)},onTouchMove:function(e){var t,n,i=this.el.sceneEl.canvas,r=this.yawObject;this.touchStarted&&this.data.touchEnabled&&(n=2*Math.PI*(e.touches[0].pageX-this.touchStart.x)/i.clientWidth,t=this.data.reverseTouchDrag?1:-1,r.rotation.y-=.5*n*t,this.touchStart={x:e.touches[0].pageX,y:e.touches[0].pageY})},onTouchEnd:function(){this.touchStarted=!1},onEnterVR:function(){var e=this.el.sceneEl;e.checkHeadsetConnected()&&(this.saveCameraPose(),this.el.object3D.position.set(0,0,0),this.el.object3D.rotation.set(0,0,0),e.hasWebXR&&(this.el.object3D.matrixAutoUpdate=!1,this.el.object3D.updateMatrix()))},onExitVR:function(){this.el.sceneEl.checkHeadsetConnected()&&(this.restoreCameraPose(),this.previousHMDPosition.set(0,0,0),this.el.object3D.matrixAutoUpdate=!0)},onPointerLockChange:function(){this.pointerLocked=!(!document.pointerLockElement&&!document.mozPointerLockElement)},onPointerLockError:function(){this.pointerLocked=!1},exitPointerLock:function(){document.exitPointerLock(),this.pointerLocked=!1},updateGrabCursor:function(e){var t=this.el.sceneEl;function n(){t.canvas.classList.add("a-grab-cursor")}function i(){t.canvas.classList.remove("a-grab-cursor")}t.canvas?e?n():i():e?t.addEventListener("render-target-loaded",n):t.addEventListener("render-target-loaded",i)},saveCameraPose:function(){var e=this.el;this.savedPose.position.copy(e.object3D.position),this.savedPose.rotation.copy(e.object3D.rotation),this.hasSavedPose=!0},restoreCameraPose:function(){var e=this.el,t=this.savedPose;this.hasSavedPose&&(e.object3D.position.copy(t.position),e.object3D.rotation.copy(t.rotation),this.hasSavedPose=!1)}})},298:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l="magicleap-one",c=n(1343).AFRAME_CDN_ROOT+"controllers/magicleap/magicleap-one-controller.glb";e.exports.Component=i("magicleap-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","menu"]},init:function(){var e=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;s(this,l,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:l,hand:t.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",c)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){e.detail.model.scale.set(.01,.01,.01)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){},setButtonColor:function(e,t){}})},3069:(e,t,n)=>{var i=n(7427),r=n(8190),s=n(9437),o=n(5892),a=i.debug("components:material:error"),l=r.registerComponent,c=o.shaders,h=o.shaderNames;function d(e,t){e.dispose(),t.unregisterMaterial(e),Object.keys(e).filter((function(t){return e[t]&&e[t].isTexture})).forEach((function(t){e[t].dispose()}))}e.exports.Component=l("material",{schema:{alphaTest:{default:0,min:0,max:1},depthTest:{default:!0},depthWrite:{default:!0},flatShading:{default:!1},npot:{default:!1},offset:{type:"vec2",default:{x:0,y:0}},opacity:{default:1,min:0,max:1},repeat:{type:"vec2",default:{x:1,y:1}},shader:{default:"standard",oneOf:h,schemaChange:!0},side:{default:"front",oneOf:["front","back","double"]},transparent:{default:!1},vertexColorsEnabled:{default:!1},visible:{default:!0},blending:{default:"normal",oneOf:["none","normal","additive","subtractive","multiply"]},dithering:{default:!0},anisotropy:{default:0,min:0}},init:function(){this.material=null},update:function(e){var t=this.data;this.shader&&t.shader===e.shader||this.updateShader(t.shader),this.shader.update(this.data),this.updateMaterial(e)},updateSchema:function(e){var t,n,i,r;n=e&&e.shader,t=this.oldData&&this.oldData.shader,(i=c[r=n||t]&&c[r].schema)||a("Unknown shader schema "+r),t&&n===t||(this.extendSchema(i),this.updateBehavior())},updateBehavior:function(){var e,t,n=this.el.sceneEl,i=this.schema,r=this;function s(e,n){var i;for(i in t)t[i]=e;r.shader.update(t)}for(e in this.tick=void 0,t={},i)"time"===i[e].type&&(this.tick=s,t[e]=!0);n&&(this.tick?n.addBehavior(this):n.removeBehavior(this))},updateShader:function(e){var t,n=this.data,i=c[e]&&c[e].Shader;if(!i)throw new Error("Unknown shader "+e);(t=this.shader=new i).el=this.el,t.init(n),this.setMaterial(t.material),this.updateSchema(n)},updateMaterial:function(e){var t,n=this.data,i=this.material;for(t in i.alphaTest=n.alphaTest,i.depthTest=!1!==n.depthTest,i.depthWrite=!1!==n.depthWrite,i.opacity=n.opacity,i.flatShading=n.flatShading,i.side=function(e){switch(e){case"back":return s.BackSide;case"double":return s.DoubleSide;default:return s.FrontSide}}(n.side),i.transparent=!1!==n.transparent||n.opacity<1,i.vertexColors=n.vertexColorsEnabled,i.visible=n.visible,i.blending=function(e){switch(e){case"none":return s.NoBlending;case"additive":return s.AdditiveBlending;case"subtractive":return s.SubtractiveBlending;case"multiply":return s.MultiplyBlending;default:return s.NormalBlending}}(n.blending),i.dithering=n.dithering,e)break;!t||e.alphaTest===n.alphaTest&&e.side===n.side&&e.vertexColorsEnabled===n.vertexColorsEnabled||(i.needsUpdate=!0)},remove:function(){var e=new s.MeshBasicMaterial,t=this.material,n=this.el.getObject3D("mesh");n&&(n.material=e),d(t,this.system)},setMaterial:function(e){var t,n=this.el,i=this.system;this.material&&d(this.material,i),this.material=e,i.registerMaterial(e),(t=n.getObject3D("mesh"))?t.material=e:n.addEventListener("object3dset",(function t(i){"mesh"===i.detail.type&&i.target===n&&(n.getObject3D("mesh").material=e,n.removeEventListener("object3dset",t))}))}})},3942:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="oculus-touch",h=n(1343).AFRAME_CDN_ROOT,d=h+"controllers/oculus/oculus-touch-controller-",u=h+"controllers/meta/",p={left:{modelUrl:d+"left.gltf",rayOrigin:{origin:{x:.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new r.Vector3(-.005,.036,-.037),modelPivotRotation:new r.Euler(Math.PI/4.5,0,0)},right:{modelUrl:d+"right.gltf",rayOrigin:{origin:{x:-.002,y:-.005,z:-.03},direction:{x:0,y:-.8,z:-1}},modelPivotOffset:new r.Vector3(.005,.036,-.037),modelPivotRotation:new r.Euler(Math.PI/4.5,0,0)}},A="oculus-touch",f={"oculus-touch":p,"oculus-touch-v2":{left:{modelUrl:d+"gen2-left.gltf",rayOrigin:{origin:{x:-.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new r.Vector3(0,-.007,-.021),modelPivotRotation:new r.Euler(-Math.PI/4,0,0)},right:{modelUrl:d+"gen2-right.gltf",rayOrigin:{origin:{x:.006,y:-.03,z:-.04},direction:{x:0,y:-.9,z:-1}},modelPivotOffset:new r.Vector3(0,-.007,-.021),modelPivotRotation:new r.Euler(-Math.PI/4,0,0)}},"oculus-touch-v3":{left:{modelUrl:d+"v3-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)},right:{modelUrl:d+"v3-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)}},"meta-quest-touch-pro":{left:{modelUrl:u+"quest-touch-pro-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)},right:{modelUrl:u+"quest-touch-pro-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)}},"meta-quest-touch-plus":{left:{modelUrl:u+"quest-touch-plus-left.glb",rayOrigin:{origin:{x:.0065,y:-.0186,z:-.05},direction:{x:.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)},right:{modelUrl:u+"quest-touch-plus-right.glb",rayOrigin:{origin:{x:-.0065,y:-.0186,z:-.05},direction:{x:-.12394785839500175,y:-.5944043672340157,z:-.7945567170519814}},modelPivotOffset:new r.Vector3(0,0,0),modelPivotRotation:new r.Euler(0,0,0)}}},m={schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#999"},buttonTouchColor:{type:"color",default:"#8AB"},buttonHighlightColor:{type:"color",default:"#2DF"},model:{default:!0},controllerType:{default:"auto",oneOf:["auto","oculus-touch","oculus-touch-v2","oculus-touch-v3"]}},after:["tracked-controls"],mapping:{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton","surface"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton","surface"]}},bindMethods:function(){this.onButtonChanged=this.onButtonChanged.bind(this),this.onThumbstickMoved=this.onThumbstickMoved.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonDown=function(t){l(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){l(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e,e.data.hand)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e,e.data.hand)},this.controllerPresent=!1,this.previousButtonValues={},this.bindMethods(),this.triggerEuler=new r.Euler},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("thumbstickmoved",this.onThumbstickMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.controllerObject3D;e&&(e.visible=!1),o(this,c,{hand:this.data.hand,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},loadModel:function(e){var t,n=this.data;if(n.model){if(this.controllerObject3D)return this.controllerObject3D.visible=!0,void this.el.setObject3D("mesh",this.controllerObject3D);if(this.displayModel=f[n.controllerType]||f[A],"auto"===n.controllerType){t=A;for(var i=Object.keys(f),r=0;r<e.profiles.length;r++)if(-1!==i.indexOf(e.profiles[r])){t=e.profiles[r];break}this.displayModel=f[t]}var s=this.displayModel[n.hand].modelUrl;this.isTouchV3orPROorPlus=this.displayModel===f["oculus-touch-v3"]||this.displayModel===f["meta-quest-touch-pro"]||this.displayModel===f["meta-quest-touch-plus"],this.el.setAttribute("gltf-model",s)}},injectTrackedControls:function(e){var t=this.data,n=c;this.el.setAttribute("tracked-controls",{id:n,hand:t.hand,handTrackingEnabled:!1,iterateControllerProfiles:!0}),this.loadModel(e)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t=this.mapping[this.data.hand].buttons[e.detail.id];if(t){if(this.isTouchV3orPROorPlus)this.onButtonChangedV3orPROorPlus(e);else{var n,i=this.buttonMeshes;"trigger"!==t&&"grip"!==t||(n=e.detail.state.value),i&&("trigger"===t&&i.trigger&&(i.trigger.rotation.x=this.originalXRotationTrigger-n*(Math.PI/26)),"grip"===t&&i.grip&&(n*="left"===this.data.hand?-1:1,i.grip.position.x=this.originalXPositionGrip+.004*n))}this.el.emit(t+"changed",e.detail.state)}},onButtonChangedV3orPROorPlus:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id],i=this.buttonObjects;i&&i[n]&&(t=e.detail.state.value,i[n].quaternion.slerpQuaternions(this.buttonRanges[n].min.quaternion,this.buttonRanges[n].max.quaternion,t),i[n].position.lerpVectors(this.buttonRanges[n].min.position,this.buttonRanges[n].max.position,t))},onModelLoaded:function(e){if(e.target===this.el&&this.data.model){if(this.isTouchV3orPROorPlus)this.onTouchV3orPROorPlusModelLoaded(e);else{var t,n=this.controllerObject3D=e.detail.model;(t=this.buttonMeshes={}).grip=n.getObjectByName("buttonHand"),this.originalXPositionGrip=t.grip&&t.grip.position.x,t.trigger=n.getObjectByName("buttonTrigger"),this.originalXRotationTrigger=t.trigger&&t.trigger.rotation.x,t.thumbstick=n.getObjectByName("stick"),t.xbutton=n.getObjectByName("buttonX"),t.abutton=n.getObjectByName("buttonA"),t.ybutton=n.getObjectByName("buttonY"),t.bbutton=n.getObjectByName("buttonB")}for(var i in this.buttonMeshes)this.buttonMeshes[i]&&g(this.buttonMeshes[i]);this.applyOffset(e.detail.model),this.el.emit("controllermodelready",{name:"meta-touch-controls",model:this.data.model,rayOrigin:this.displayModel[this.data.hand].rayOrigin})}},applyOffset:function(e){e.position.copy(this.displayModel[this.data.hand].modelPivotOffset),e.rotation.copy(this.displayModel[this.data.hand].modelPivotRotation)},onTouchV3orPROorPlusModelLoaded:function(e){var t=this.controllerObject3D=e.detail.model,n=this.buttonObjects={},i=this.buttonMeshes={},r=this.buttonRanges={};i.grip=t.getObjectByName("squeeze"),n.grip=t.getObjectByName("xr_standard_squeeze_pressed_value"),r.grip={min:t.getObjectByName("xr_standard_squeeze_pressed_min"),max:t.getObjectByName("xr_standard_squeeze_pressed_max")},n.grip.minX=n.grip.position.x,i.thumbstick=t.getObjectByName("thumbstick"),n.thumbstick=t.getObjectByName("xr_standard_thumbstick_pressed_value"),r.thumbstick={min:t.getObjectByName("xr_standard_thumbstick_pressed_min"),max:t.getObjectByName("xr_standard_thumbstick_pressed_max")},n.thumbstickXAxis=t.getObjectByName("xr_standard_thumbstick_xaxis_pressed_value"),r.thumbstickXAxis={min:t.getObjectByName("xr_standard_thumbstick_xaxis_pressed_min"),max:t.getObjectByName("xr_standard_thumbstick_xaxis_pressed_max")},n.thumbstickYAxis=t.getObjectByName("xr_standard_thumbstick_yaxis_pressed_value"),r.thumbstickYAxis={min:t.getObjectByName("xr_standard_thumbstick_yaxis_pressed_min"),max:t.getObjectByName("xr_standard_thumbstick_yaxis_pressed_max")},i.trigger=t.getObjectByName("trigger"),n.trigger=t.getObjectByName("xr_standard_trigger_pressed_value"),r.trigger={min:t.getObjectByName("xr_standard_trigger_pressed_min"),max:t.getObjectByName("xr_standard_trigger_pressed_max")},r.trigger.diff={x:Math.abs(r.trigger.max.rotation.x)-Math.abs(r.trigger.min.rotation.x),y:Math.abs(r.trigger.max.rotation.y)-Math.abs(r.trigger.min.rotation.y),z:Math.abs(r.trigger.max.rotation.z)-Math.abs(r.trigger.min.rotation.z)};var s="left"===this.data.hand?"x":"a",o="left"===this.data.hand?"y":"b",a=s+"button",l=o+"button";i[a]=t.getObjectByName(s+"_button"),n[a]=t.getObjectByName(s+"_button_pressed_value"),r[a]={min:t.getObjectByName(s+"_button_pressed_min"),max:t.getObjectByName(s+"_button_pressed_max")},i[l]=t.getObjectByName(o+"_button"),n[l]=t.getObjectByName(o+"_button_pressed_value"),r[l]={min:t.getObjectByName(o+"_button_pressed_min"),max:t.getObjectByName(o+"_button_pressed_max")}},onAxisMoved:function(e){a(this,this.mapping[this.data.hand].axes,e)},onThumbstickMoved:function(e){if(this.buttonMeshes&&this.buttonMeshes.thumbstick)if(this.isTouchV3orPROorPlus)this.updateThumbstickTouchV3orPROorPlus(e);else for(var t in e.detail)this.buttonObjects.thumbstick.rotation[this.axisMap[t]]=this.buttonRanges.thumbstick.originalRotation[this.axisMap[t]]-Math.PI/8*e.detail[t]*("y"===t||"right"===this.data.hand?-1:1)},axisMap:{y:"x",x:"z"},updateThumbstickTouchV3orPROorPlus:function(e){var t=(e.detail.x+1)/2;this.buttonObjects.thumbstickXAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickXAxis.min.quaternion,this.buttonRanges.thumbstickXAxis.max.quaternion,t);var n=(e.detail.y+1)/2;this.buttonObjects.thumbstickYAxis.quaternion.slerpQuaternions(this.buttonRanges.thumbstickYAxis.min.quaternion,this.buttonRanges.thumbstickYAxis.max.quaternion,n)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n,i=this.buttonMeshes;i&&i[e]&&(n="up"===t||"touchend"===t?i[e].originalColor||this.data.buttonColor:"touchstart"===t?this.data.buttonTouchColor:this.data.buttonHighlightColor,i[e].material.color.set(n))}};function g(e){e.traverse((function(t){var n;"Mesh"===t.type&&(n=t.material.clone(),e.originalColor=t.material.color,t.material.dispose(),t.material=n)}))}i("oculus-touch-controls",m),e.exports.Component=i("meta-touch-controls",m)},3176:(e,t,n)=>{var i,r,s,o,a,l=n(8190).registerComponent,c=n(9437);l("obb-collider",{schema:{size:{default:0},trackedObject3D:{default:""},minimumColliderDimension:{default:.02},centerModel:{default:!1}},init:function(){this.previousScale=(new c.Vector3).copy(this.el.object3D.scale),this.auxEuler=new c.Euler,this.boundingBox=new c.Box3,this.boundingBoxSize=new c.Vector3,this.updateCollider=this.updateCollider.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.updateBoundingBox=this.updateBoundingBox.bind(this),this.el.addEventListener("model-loaded",this.onModelLoaded),this.updateCollider(),this.system.addCollider(this.el)},remove:function(){this.system.removeCollider(this.el)},update:function(){this.data.trackedObject3D&&(this.trackedObject3DPath=this.data.trackedObject3D.split("."))},onModelLoaded:function(){this.data.centerModel&&this.centerModel(),this.updateCollider()},centerModel:function(){var e,t=this.el,n=t.components["gltf-model"]&&t.components["gltf-model"].model;n&&(this.el.removeObject3D("mesh"),e=(new c.Box3).setFromObject(n).getCenter(new c.Vector3),n.position.x+=n.position.x-e.x,n.position.y+=n.position.y-e.y,n.position.z+=n.position.z-e.z,this.el.setObject3D("mesh",n))},updateCollider:function(){var e=this.el,t=this.boundingBoxSize,n=this.aabb=this.aabb||new c.OBB;this.obb=this.obb||new c.OBB,e.hasLoaded?(this.updateBoundingBox(),n.halfSize.copy(t).multiplyScalar(.5),this.el.sceneEl.systems["obb-collider"].data.showColliders&&this.showCollider()):e.addEventListener("loaded",this.updateCollider)},showCollider:function(){this.updateColliderMesh(),this.renderColliderMesh.visible=!0},updateColliderMesh:function(){var e=this.renderColliderMesh,t=this.boundingBoxSize;e?(e.geometry.dispose(),e.geometry=new c.BoxGeometry(t.x,t.y,t.z)):this.initColliderMesh()},hideCollider:function(){this.renderColliderMesh&&(this.renderColliderMesh.visible=!1)},initColliderMesh:function(){var e,t,n;e=this.boundingBoxSize,t=this.renderColliderGeometry=new c.BoxGeometry(e.x,e.y,e.z),(n=this.renderColliderMesh=new c.Mesh(t,new c.MeshLambertMaterial({color:65280,side:c.DoubleSide}))).matrixAutoUpdate=!1,n.matrixWorldAutoUpdate=!1,n.updateMatrixWorld=function(){},this.el.sceneEl.object3D.add(n)},updateBoundingBox:(i=new c.Vector3,r=new c.Vector3,s=new c.Quaternion,o=new c.Quaternion,a=new c.Matrix4,function(){var e=this.auxEuler,t=this.boundingBox,n=this.data.size,l=this.trackedObject3D||this.el.object3D,c=this.boundingBoxSize,h=this.data.minimumColliderDimension;if(n)return this.boundingBoxSize.x=n,this.boundingBoxSize.y=n,void(this.boundingBoxSize.z=n);e.copy(l.rotation),l.rotation.set(0,0,0),l.parent.matrixWorld.decompose(i,s,r),a.compose(i,o,r),l.parent.matrixWorld.copy(a),t.setFromObject(l,!0),t.getSize(c),c.x=c.x<h?h:c.x,c.y=c.y<h?h:c.y,c.z=c.z<h?h:c.z,l.parent.matrixWorld.compose(i,s,r),this.el.object3D.rotation.copy(e)}),checkTrackedObject:function(){var e,t=this.trackedObject3DPath;if(t&&t.length&&!this.trackedObject3D){e=this.el;for(var n=0;n<t.length&&(e=e[t[n]]);n++);e&&(this.trackedObject3D=e,this.updateCollider())}return this.trackedObject3D},tick:function(){var e=new c.Vector3,t=new c.Vector3,n=new c.Quaternion,i=new c.Matrix4;return function(){var r=this.obb,s=this.renderColliderMesh,o=this.checkTrackedObject()||this.el.object3D;o&&(o.updateMatrix(),o.updateMatrixWorld(!0),o.matrixWorld.decompose(e,n,t),(Math.abs(t.x-this.previousScale.x)>1e-4||Math.abs(t.y-this.previousScale.y)>1e-4||Math.abs(t.z-this.previousScale.z)>1e-4)&&this.updateCollider(),this.previousScale.copy(t),t.set(1,1,1),i.compose(e,n,t),s&&s.matrixWorld.copy(i),r.copy(this.aabb),r.applyMatrix4(i))}}()})},8771:(e,t,n)=>{var i=n(8940),r=n(8190).registerComponent,s=n(9437),o=i("components:obj-model:warn");e.exports.Component=r("obj-model",{schema:{mtl:{type:"model"},obj:{type:"model"}},init:function(){var e=this;this.model=null,this.objLoader=new s.OBJLoader,this.mtlLoader=new s.MTLLoader(this.objLoader.manager),this.mtlLoader.crossOrigin="",this.el.addEventListener("componentinitialized",(function(t){e.model&&"material"===t.detail.name&&e.applyMaterial()}))},update:function(){var e=this.data;e.obj&&(this.resetMesh(),this.loadObj(e.obj,e.mtl))},remove:function(){this.resetMesh()},resetMesh:function(){this.model&&this.el.removeObject3D("mesh")},loadObj:function(e,t){var n=this,i=this.el,r=this.mtlLoader,s=this.objLoader,a=this.el.sceneEl.systems.renderer,l=t.substr(0,t.lastIndexOf("/")+1);if(t)return i.hasAttribute("material")&&o("Material component properties are ignored when a .MTL is provided"),r.setResourcePath(l),void r.load(t,(function(t){t.preload(),s.setMaterials(t),s.load(e,(function(e){n.model=e,n.model.traverse((function(e){if(e.isMesh){var t=e.material;t.map&&a.applyColorCorrection(t.map),t.emissiveMap&&a.applyColorCorrection(t.emissiveMap)}})),i.setObject3D("mesh",e),i.emit("model-loaded",{format:"obj",model:e})}))}));s.load(e,(function(e){n.model=e,n.applyMaterial(),i.setObject3D("mesh",e),i.emit("model-loaded",{format:"obj",model:e})}))},applyMaterial:function(){var e=this.el.components.material;e&&this.model.traverse((function(t){t instanceof s.Mesh&&(t.material=e.material)}))}})},6077:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l=n(1343).AFRAME_CDN_ROOT+"controllers/oculus/go/oculus-go-controller.gltf",c="oculus-go";e.exports.Component=i("oculus-go-controls",{schema:{hand:{default:""},buttonColor:{type:"color",default:"#FFFFFF"},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0}},mapping:{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad"]},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.bindMethods()},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){s(this,c,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{hand:t.hand,idPrefix:c}),this.data.model&&this.el.setAttribute("gltf-model",l)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(e){var t,n=e.detail.model;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).trigger=n.getObjectByName("oculus_go_button_trigger"),t.trackpad=n.getObjectByName("oculus_go_touchpad"),t.touchpad=n.getObjectByName("oculus_go_touchpad"))},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n=this.buttonMeshes;if(n&&n[e]){var i;switch(t){case"down":i=this.data.buttonHighlightColor;break;case"touchstart":i=this.data.buttonTouchedColor;break;default:i=this.data.buttonColor}n[e].material.color.set(i)}}})},2588:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c="pico-4",h=n(1343).AFRAME_CDN_ROOT+"controllers/pico/pico4/";e.exports.Component=i("pico-controls",{schema:{hand:{default:"none"},model:{default:!0}},mapping:{left:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","xbutton","ybutton"]},right:{axes:{thumbstick:[2,3]},buttons:["trigger","grip","none","thumbstick","abutton","bbutton"]}},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e,e.data.hand)},this.onButtonUp=function(t){l(t.detail.id,"up",e,e.data.hand)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e,e.data.hand)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e,e.data.hand)},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;o(this,c,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:c,hand:t.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("gltf-model",h+this.data.hand+".glb")},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping[this.data.hand].buttons[e.detail.id];n&&("trigger"===n&&(t=e.detail.state.value,console.log("analog value of trigger press: "+t)),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){e.target===this.el&&this.data.model&&this.el.emit("controllermodelready",{name:"pico-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)})},onAxisMoved:function(e){a(this,this.mapping[this.data.hand].axes,e)}})},7519:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("position",{schema:{type:"vec3"},update:function(){var e=this.el.object3D,t=this.data;e.position.set(t.x,t.y,t.z)},remove:function(){this.el.object3D.position.set(0,0,0)}})},7394:(e,t,n)=>{var i,r,s=n(8190).registerComponent,o=n(9437),a=n(7427).debug("components:raycaster:warn"),l=/^[\w\s-.,[\]#]*$/,c={childList:!0,attributes:!0,subtree:!0},h="raycaster-intersected-cleared",d="raycaster-intersection-cleared";function u(e,t){var n;for(e.length=t.length,n=0;n<t.length;n++)e[n]=t[n]}e.exports.Component=s("raycaster",{schema:{autoRefresh:{default:!0},direction:{type:"vec3",default:{x:0,y:0,z:-1}},enabled:{default:!0},far:{default:1e3},interval:{default:0},near:{default:0},objects:{default:""},origin:{type:"vec3"},showLine:{default:!1},lineColor:{default:"white"},lineOpacity:{default:1},useWorldCoordinates:{default:!1}},multiple:!0,init:function(){this.clearedIntersectedEls=[],this.unitLineEndVec3=new o.Vector3,this.intersectedEls=[],this.intersections=[],this.newIntersectedEls=[],this.newIntersections=[],this.objects=[],this.prevCheckTime=void 0,this.prevIntersectedEls=[],this.rawIntersections=[],this.raycaster=new o.Raycaster,this.updateOriginDirection(),this.setDirty=this.setDirty.bind(this),this.updateLine=this.updateLine.bind(this),this.observer=new MutationObserver(this.setDirty),this.dirty=!0,this.lineEndVec3=new o.Vector3,this.otherLineEndVec3=new o.Vector3,this.lineData={end:this.lineEndVec3},this.getIntersection=this.getIntersection.bind(this),this.intersectedDetail={el:this.el,getIntersection:this.getIntersection},this.intersectedClearedDetail={el:this.el},this.intersectionClearedDetail={clearedEls:this.clearedIntersectedEls},this.intersectionDetail={}},update:function(e){var t=this.data,n=this.el,i=this.raycaster;i.far=t.far,i.near=t.near,!t.showLine||t.far===e.far&&t.origin===e.origin&&t.direction===e.direction&&e.showLine||(this.unitLineEndVec3.copy(t.direction).normalize(),this.drawLine()),!t.showLine&&e.showLine&&n.removeAttribute("line"),t.objects===e.objects||l.test(t.objects)||a('[raycaster] Selector "'+t.objects+'" may not update automatically with DOM changes.'),t.objects||a('[raycaster] For performance, please define raycaster.objects when using raycaster or cursor components to whitelist which entities to intersect with. e.g., raycaster="objects: [data-raycastable]".'),t.autoRefresh!==e.autoRefresh&&n.isPlaying&&(t.autoRefresh?this.addEventListeners():this.removeEventListeners()),e.enabled&&!t.enabled&&this.clearAllIntersections(),t.objects!==e.objects&&this.setDirty()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){this.data.showLine&&this.el.removeAttribute("line"),this.clearAllIntersections()},addEventListeners:function(){this.data.autoRefresh&&(this.observer.observe(this.el.sceneEl,c),this.el.sceneEl.addEventListener("object3dset",this.setDirty),this.el.sceneEl.addEventListener("object3dremove",this.setDirty))},removeEventListeners:function(){this.observer.disconnect(),this.el.sceneEl.removeEventListener("object3dset",this.setDirty),this.el.sceneEl.removeEventListener("object3dremove",this.setDirty)},setDirty:function(){this.dirty=!0},refreshObjects:function(){var e,t=this.data;e=t.objects?this.el.sceneEl.querySelectorAll(t.objects):this.el.sceneEl.querySelectorAll("*"),this.objects=this.flattenObject3DMaps(e),this.dirty=!1},tock:function(e){var t=this.data,n=this.prevCheckTime;t.enabled&&(n&&e-n<t.interval||(this.prevCheckTime=e,this.checkIntersections()))},checkIntersections:function(){var e,t,n=this.clearedIntersectedEls,i=this.el,r=this.data,s=this.intersectedEls,o=this.intersections,a=this.newIntersectedEls,l=this.newIntersections,c=this.prevIntersectedEls,p=this.rawIntersections;for(this.dirty&&this.refreshObjects(),u(this.prevIntersectedEls,this.intersectedEls),this.updateOriginDirection(),p.length=0,this.raycaster.intersectObjects(this.objects,!0,p),o.length=0,s.length=0,e=0;e<p.length;e++)t=p[e],r.showLine&&t.object===i.getObject3D("line")||t.object.el&&(o.push(t),s.push(t.object.el));for(l.length=0,a.length=0,e=0;e<o.length;e++)-1===c.indexOf(o[e].object.el)&&(l.push(o[e]),a.push(o[e].object.el));for(n.length=0,e=0;e<c.length;e++)-1===s.indexOf(c[e])&&(c[e].emit(h,this.intersectedClearedDetail),n.push(c[e]));for(n.length&&i.emit(d,this.intersectionClearedDetail),e=0;e<a.length;e++)a[e].emit("raycaster-intersected",this.intersectedDetail);l.length&&(this.intersectionDetail.els=a,this.intersectionDetail.intersections=l,i.emit("raycaster-intersection",this.intersectionDetail)),(0===c.length&&o.length>0||c.length>0&&0===o.length||c.length&&o.length&&c[0]!==o[0].object.el)&&(this.intersectionDetail.els=this.intersectedEls,this.intersectionDetail.intersections=o,i.emit("raycaster-closest-entity-changed",this.intersectionDetail)),r.showLine&&setTimeout(this.updateLine)},updateLine:function(){var e,t=this.el,n=this.intersections;n.length&&(e=n[0].object.el===t&&n[1]?n[1].distance:n[0].distance),this.drawLine(e)},getIntersection:function(e){var t,n;for(t=0;t<this.intersections.length;t++)if((n=this.intersections[t]).object.el===e)return n;return null},updateOriginDirection:(i=new o.Vector3,r=new o.Vector3,function(){var e=this.el,t=this.data;t.useWorldCoordinates?this.raycaster.set(t.origin,t.direction):(e.object3D.updateMatrixWorld(),r.setFromMatrixPosition(e.object3D.matrixWorld),0===t.origin.x&&0===t.origin.y&&0===t.origin.z||(r=e.object3D.localToWorld(r.copy(t.origin))),i.copy(t.direction).transformDirection(e.object3D.matrixWorld).normalize(),this.raycaster.set(r,i))}),drawLine:function(e){var t,n=this.data,i=this.el;t=this.lineData.end===this.lineEndVec3?this.otherLineEndVec3:this.lineEndVec3,void 0===e&&(e=n.far===1/0?1e3:n.far),this.lineData.start=n.origin,this.lineData.end=t.copy(this.unitLineEndVec3).multiplyScalar(e).add(n.origin),this.lineData.color=n.lineColor,this.lineData.opacity=n.lineOpacity,i.setAttribute("line",this.lineData)},flattenObject3DMaps:function(e){var t,n,i=this.objects,r=this.el.sceneEl.object3D;function s(e){return e.parent?s(e.parent):e===r}for(i.length=0,n=0;n<e.length;n++){var o=e[n];if(o.isEntity&&o.object3D&&s(o.object3D))for(t in o.object3DMap)i.push(o.getObject3D(t))}return i},clearAllIntersections:function(){var e;for(e=0;e<this.intersectedEls.length;e++)this.intersectedEls[e].emit(h,this.intersectedClearedDetail);u(this.clearedIntersectedEls,this.intersectedEls),this.intersectedEls.length=0,this.intersections.length=0,this.el.emit(d,this.intersectionClearedDetail)}})},2310:(e,t,n)=>{var i=n(9437).MathUtils.degToRad,r=n(8190).registerComponent;e.exports.Component=r("rotation",{schema:{type:"vec3"},update:function(){var e=this.data;this.el.object3D.rotation.set(i(e.x),i(e.y),i(e.z),"YXZ")},remove:function(){this.el.object3D.rotation.set(0,0,0)}})},4760:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("scale",{schema:{type:"vec3",default:{x:1,y:1,z:1}},update:function(){var e=this.data;this.el.object3D.scale.set(e.x,e.y,e.z)},remove:function(){this.el.object3D.scale.set(1,1,1)}})},3575:(e,t,n)=>{var i,r,s,o=n(8190).registerComponent,a=n(9437),l=(i=new a.Quaternion,r=new a.Vector3,function(e,t,n){t.position.copy(e.transform.position),t.quaternion.copy(e.transform.orientation),r.copy(n),i.copy(e.transform.orientation),r.applyQuaternion(i),t.position.sub(r)});function c(e,t){this.renderer=e,this.xrHitTestSource=null,e.xr.addEventListener("sessionend",function(){this.xrHitTestSource=null}.bind(this)),e.xr.addEventListener("sessionstart",function(){this.sessionStart(t)}.bind(this)),this.renderer.xr.isPresenting&&this.sessionStart(t)}function h(e){console.warn(e.message),console.warn('Cannot requestHitTestSource Are you missing: webxr="optionalFeatures: hit-test;" from <a-scene>?')}l.tempFakePose={transform:{orientation:new a.Quaternion,position:new a.Vector3}},c.prototype.previousFrameAnchors=new Set,c.prototype.anchorToObject3D=new Map,c.prototype.sessionStart=function(e){this.session=this.renderer.xr.getSession(),"requestHitTestSource"in this.session?e.space?this.session.requestHitTestSource(e).then(function(e){this.xrHitTestSource=e}.bind(this)).catch(h):e.profile&&this.session.requestHitTestSourceForTransientInput(e).then(function(e){this.xrHitTestSource=e,this.transient=!0}.bind(this)).catch(h):h({message:"No requestHitTestSource on the session."})},c.prototype.anchorFromLastHitTestResult=function(e,t){var n=this.lastHitTest;if(n){var i={object3D:e,offset:t};Array.from(this.anchorToObject3D.entries()).forEach(function(t){var n=t[1].object3D,i=t[0];n===e&&(this.anchorToObject3D.delete(i),i.delete())}.bind(this)),n.createAnchor&&n.createAnchor().then(function(e){this.anchorToObject3D.set(e,i)}.bind(this)).catch((function(e){console.warn(e.message),console.warn('Cannot create anchor, are you missing: webxr="optionalFeatures: anchors;" from <a-scene>?')}))}},c.prototype.doHit=function(e){if(this.renderer.xr.isPresenting){var t,n,i=this.renderer.xr.getReferenceSpace(),r=e.getViewerPose(i);return this.xrHitTestSource&&r?this.transient?(t=e.getHitTestResultsForTransientInput(this.xrHitTestSource)).length>0&&(n=t[0].results).length>0&&(this.lastHitTest=n[0],n[0].getPose(i)):(t=e.getHitTestResults(this.xrHitTestSource)).length>0&&(this.lastHitTest=t[0],t[0].getPose(i)):void 0}},c.updateAnchorPoses=function(e,t){var n=e.trackedAnchors||c.prototype.previousFrameAnchors;c.prototype.previousFrameAnchors.forEach((function(e){n.has(e)||c.prototype.anchorToObject3D.delete(e)})),n.forEach((function(n){var i,r,s,o;try{if(i=e.getPose(n.anchorSpace,t)){if(!(r=c.prototype.anchorToObject3D.get(n)))return;s=r.offset,o=r.object3D,l(i,o,s)}}catch(e){console.error("while updating anchor poses:",e)}})),c.prototype.previousFrameAnchors=n},e.exports.Component=o("ar-hit-test",{schema:{target:{type:"selector"},enabled:{default:!0},src:{default:"data:image/webp;base64,UklGRkQHAABXRUJQVlA4WAoAAAAQAAAA/wEA/wEAQUxQSL0DAAARDzD/ERGCjrY9sYYFfgo6aa1kJ7K0w9Lo3AadLSVeFxevQwj5kuM8RfR/Atw/C0+ozB/oUBrloFZs6ElSW88j1KA4yExNWQaqRZquIDF0JYmlq0hAuUDTFu66tng3teW7pa3cQf1V1edvur54M/Slm6Wv3Gx9zw0MXlQLntcsBN6wkHjTQuYtC4W3LTw8mGRVG57TbAROtxHfZNhInGkjc5aNwtk2Hg6Mvki14k+NkZzCwQgCxalcAv3kddRTPI1DcUrXId1FLf1uHpzaQz4tquhZVLlKesbVpqKeTj0n0F5PpXDlFN9UqmhalL/ImuZFo6KmToWLoKlddMprqlS8cKovBvHo2kTiFV2LN4msaxKZl3QNiair8xYRdDWivIvXVXmbcMqJ51UebZuFXxZt6xd4laxtciqRtA3Cv0nU1t+kEUFbI8JvCa+tvkm3FDlO/W+OR99+kWEp/YYo+tYfTVnf/K8cE/F///3vv//993eeL+a+uvjawLcX3xjYvJotBFY3kVjTRGFtE+BU2AiMbiQyhpHMWEYeBozAH5qNBYRDB5KBCaTDBKKBAZTDBoKBDjwHAN5ABeCJBsAZcAAC0YHHxAYSMYBiYgGZWEA2MYFCbCCZGAAIANFEB+AnYgMQTDQAYSJ2AN5EBZAm4gDgTDgAeSIu4DGygTIRN1CMLOCZiACykQlg4jsAycgA8AO+BxCNdJyDkcbwRirDGXGnx8w+FDPrkM3MQ9JQZMYhiiwV/RDMtIM3U1/DmXHUo+IR2kSR2ToWkQ1NIn2qf2J8LCqJKiDUiSADHY3whirhdHgZ94HKaR97PhE+twEUJUFoAcgyTct8hfSxSkShASDKdMJ/ritKHwgyQ0sD4D/miCxU5SbhOOUDTnZpccCjYP/i0bZ/8bAgtVGEoGapWIQXyzKVKLwgNJFk2rtMIgoNRJlOZF7SNSSyUEeQmbxBFKEmtYjEe8S8zOZ1AkJVCmS88FJOtF40Ksg4oUaFiygk3C8qlTVNyl8UTevCUdAE2t14PfVqU1FPp57TopKeQZWromddTQp6QOfTOEQt/ZDuipZ11w/wOiqO8dRORcc6BQEkDQMClaHcn5wV9yLbxsNZNgpn2sicYSNxuo34Js1G4FQbnuNsOPa28PCWhcKbFjJvWEi8ZiHwqgXPcxbc5db33Cx95WboSzddX7yp+vyN0+eul7ZyN7Xlu64t3jVt4c5pc4JLV5EYupJE0xUknC4nOjVlmaYpyLit53HCQ0+ScnqceNcS5dzUkd0/CwMAVlA4IGADAAAQXwCdASoAAgACP8ne6Wy/tjCpqJ/IA/A5CWlu4XYBG/Pz8AfwD8APz//f3v8E1fuHZnxKYACtfuHZnxKYACrYTb5mOslhxu843ecbvON3nG7zjd3a0VCn7G1MABVxwH/Xd25gAK1+4dmfEpe2+PHhQaj75++riG6FuYACtfuHZnxKYACRrK3q9xO8Ss3uWKnMhs/rDF1hi6wxdYYusMXWGI5QRcCFDZog5OgqNlse1NDuz/UoFa/cOzPiUwAEsAOK4/nu5eZHK2tlXxJfNYlMABWv3Dsz4bvNJ5YA/LtxJ38SmAArX7h2Z8Sk5vdZUYv7mZPiUwAFa/cOzPh21s5OgZxf1mfEpemRyFr/rM+JS9noA/LtxJ38SmAAlUJIotzAASn6TjdhK+D3Dsz4dyvB7h2Z8O2tnJ0DOL+sz4lL2nKLT4lL/+iSLOocxq639w7M34MNZdm55uJ8v8ra2cpVZnxKTq2F3PN/cNksAfl24k7+JTAASqrD37h2Z7b1W+VtbOUqsz4lJ1bC7nm/uGyWAPy7cSd/EpgAJVVh79w7M9t6rfK2tnKVWZ8Sk6thdzzf3DZLAH5duJO/iUwAEqqw9+4dme29VvlbWzlKrM+JSdWwu55v7hslgD8u3EnfxKYACVVYe/cOzPbeq3ytrZylVme0kYJ8557FLerqFrzIbPrrf3DZLAH5duJO/iUvaVMS9BoaF4p7pSDFTP1XMyfElelrM0DOL+sz4eBJ13nV1OppBGPuKb4YzXQgq9uH19uS/0+JS9t9fr6ZUlQBelDG6GMgq97otb5QMPJwtKyBTbFp8Sl7b6/X0ykkawEOsgdiE6Fi0vb/Eve6xkwsmug0Z4nGNHQO8839bpTsjpz7SWIJxKagvd1QWMa6FYT1KEw3j4XDT6vJ9Xk+nyfT5Pq8n1eEmk5dinMM/9Fcfz4Z3Dsz3KD2dw7LxBRxKrqUUGQPH/7zxr1KIfNpLEJ0MZB2ITM/0Z2EFoh12NlXnEcpYcbvON3nG7zjd5xu84vfcNIAAP7+y8ceyzbVxkakPYY4lcr72fqOnDwipv+yxC71wAADBrjKnAAAAAAAAAAAAAAw7oNGHttqWONcoFN/2WIDc2pa6WVFtFYROlsaMaTXdcOjXHz93+YxAglKa4AAAAA=",type:"map"},type:{default:"footprint",oneOf:["footprint","map"]},footprintDepth:{default:.1},mapSize:{type:"vec2",default:{x:.5,y:.5}}},sceneOnly:!0,init:function(){this.hitTest=null,this.imageDataArray=new Uint8ClampedArray(1048576),this.imageData=new ImageData(this.imageDataArray,512,512),this.textureCache=new Map,this.orthoCam=new a.OrthographicCamera,this.orthoCam.layers.set(21),this.textureTarget=new a.WebGLRenderTarget(512,512,{}),this.basicMaterial=new a.MeshBasicMaterial({color:0,side:a.DoubleSide}),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"),this.context.imageSmoothingEnabled=!1,this.canvas.width=512,this.canvas.height=512,this.canvasTexture=new a.CanvasTexture(this.canvas,{alpha:!0}),this.canvasTexture.flipY=!1;var e=this.el.getAttribute("webxr"),t=e.optionalFeatures;t.includes("hit-test")&&t.includes("anchors")||(t.push("hit-test"),t.push("anchors"),this.el.setAttribute("webxr",e)),this.el.sceneEl.renderer.xr.addEventListener("sessionend",function(){this.hitTest=null}.bind(this)),this.el.sceneEl.renderer.xr.addEventListener("sessionstart",function(){if(this.el.is("ar-mode")){var e=this.el.sceneEl.renderer,t=this.session=e.xr.getSession();this.hasPosedOnce=!1,this.bboxMesh.visible=!1,s||(s=new Map),t.requestReferenceSpace("viewer").then(function(t){this.viewerHitTest=this.hitTest=new c(e,{space:t}),this.el.emit("ar-hit-test-start")}.bind(this));var n=this;this.el.sceneEl.addEventListener("controllersupdated",(function(){var t=this.xrSession&&this.xrSession.inputSources;if(t)for(var i=0;i<t.length;++i)if("tracked-pointer"===t[i].targetRayMode){n.hitTest=new c(e,{space:t[i].targetRaySpace}),s.set(t[i],n.hitTest),n.viewerHitTest&&"function"==typeof n.viewerHitTest.cancel&&(n.viewerHitTest.cancel(),n.viewerHitTest=null);break}}));var i="generic-touchscreen",r=new c(e,{profile:i});t.addEventListener("selectstart",function(t){if(!0===this.data.enabled){var n=t.inputSource;this.bboxMesh.visible=!0,!0===this.hasPosedOnce&&(this.el.emit("ar-hit-test-select-start",{inputSource:n,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),n.profiles[0]===i?this.hitTest=r:(this.hitTest=s.get(n)||new c(e,{space:n.targetRaySpace}),s.set(n,this.hitTest)))}}.bind(this)),t.addEventListener("selectend",function(e){if(this.hitTest&&!0===this.data.enabled){var t,n=e.inputSource;!0===this.hasPosedOnce&&(this.bboxMesh.visible=!1,this.data.target&&(t=this.data.target.object3D)&&(l.tempFakePose.transform.position.copy(this.bboxMesh.position),l.tempFakePose.transform.orientation.copy(this.bboxMesh.quaternion),l(l.tempFakePose,t,this.bboxOffset),t.visible=!0,this.hitTest.anchorFromLastHitTestResult(t,this.bboxOffset)),this.el.emit("ar-hit-test-select",{inputSource:n,position:this.bboxMesh.position,orientation:this.bboxMesh.quaternion}),this.hitTest=null)}else this.hitTest=null}.bind(this))}}.bind(this)),this.bboxOffset=new a.Vector3,this.update=this.update.bind(this),this.makeBBox()},update:function(){!1===this.data.enabled&&(this.hitTest=null,this.bboxMesh.visible=!1),this.data.target&&(this.data.target.object3D?(this.data.target.addEventListener("model-loaded",this.update),this.data.target.object3D.layers.enable(21),this.data.target.object3D.traverse((function(e){e.layers.enable(21)}))):this.data.target.addEventListener("loaded",this.update,{once:!0})),this.bboxNeedsUpdate=!0},makeBBox:function(){var e=new a.PlaneGeometry(1,1),t=new a.MeshBasicMaterial({transparent:!0,color:16777215});e.rotateX(-Math.PI/2),e.rotateY(-Math.PI/2),this.bbox=new a.Box3,this.bboxMesh=new a.Mesh(e,t),this.el.setObject3D("ar-hit-test",this.bboxMesh),this.bboxMesh.visible=!1},updateFootprint:function(){var e,t,n,i=this.el.sceneEl.renderer,r=i.xr.enabled;this.bboxMesh.material.map=this.canvasTexture,this.bboxMesh.material.needsUpdate=!0,this.orthoCam.rotation.set(-Math.PI/2,0,-Math.PI/2),this.orthoCam.position.copy(this.bboxMesh.position),this.orthoCam.position.y-=this.bboxMesh.scale.y/2,this.orthoCam.near=.1,this.orthoCam.far=this.orthoCam.near+this.data.footprintDepth*this.bboxMesh.scale.y,this.orthoCam.position.y+=this.orthoCam.far,this.orthoCam.right=this.bboxMesh.scale.z/2,this.orthoCam.left=-this.bboxMesh.scale.z/2,this.orthoCam.top=this.bboxMesh.scale.x/2,this.orthoCam.bottom=-this.bboxMesh.scale.x/2,this.orthoCam.updateProjectionMatrix(),t=i.getRenderTarget(),i.setRenderTarget(this.textureTarget),i.xr.enabled=!1,n=this.el.object3D.background,this.el.object3D.overrideMaterial=this.basicMaterial,this.el.object3D.background=null,i.render(this.el.object3D,this.orthoCam),this.el.object3D.background=n,this.el.object3D.overrideMaterial=null,i.xr.enabled=r,i.setRenderTarget(t),i.readRenderTargetPixels(this.textureTarget,0,0,512,512,this.imageDataArray),this.context.putImageData(this.imageData,0,0),this.context.shadowColor="white",this.context.shadowBlur=10,this.context.drawImage(this.canvas,0,0),e=this.context.getImageData(0,0,512,512);for(var s=0;s<262144;s++)0!==e.data[4*s+3]&&255!==e.data[4*s+3]&&(e.data[4*s+3]=128);this.context.putImageData(e,0,0),this.canvasTexture.needsUpdate=!0},tick:function(){var e,t,n=this.el.sceneEl.frame,i=this.el.sceneEl.renderer;(n&&c.updateAnchorPoses(n,i.xr.getReferenceSpace()),this.bboxNeedsUpdate)&&(this.bboxNeedsUpdate=!1,this.data.target&&"map"!==this.data.type||(this.textureCache.has(this.data.src)?t=this.textureCache.get(this.data.src):(t=(new a.TextureLoader).load(this.data.src),this.textureCache.set(this.data.src,t)),this.bboxMesh.material.map=t,this.bboxMesh.material.needsUpdate=!0),this.data.target&&this.data.target.object3D?(this.bbox.setFromObject(this.data.target.object3D),this.bbox.getCenter(this.bboxMesh.position),this.bbox.getSize(this.bboxMesh.scale),"footprint"===this.data.type&&(this.bboxMesh.scale.x*=1.04,this.bboxMesh.scale.z*=1.04,this.updateFootprint()),this.bboxMesh.position.y-=this.bboxMesh.scale.y/2,this.bboxOffset.copy(this.bboxMesh.position),this.bboxOffset.sub(this.data.target.object3D.position)):this.bboxMesh.scale.set(this.data.mapSize.x,1,this.data.mapSize.y));this.hitTest&&(e=this.hitTest.doHit(n))&&(!0!==this.hasPosedOnce&&(this.hasPosedOnce=!0,this.el.emit("ar-hit-test-achieved")),this.bboxMesh.visible=!0,this.bboxMesh.position.copy(e.transform.position),this.bboxMesh.quaternion.copy(e.transform.orientation))}})},4005:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("background",{schema:{color:{type:"color",default:"black"},transparent:{default:!1}},sceneOnly:!0,update:function(){var e=this.data,t=this.el.object3D;e.transparent?t.background=null:t.background=new THREE.Color(e.color)},remove:function(){this.el.object3D.background=null}})},3494:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("debug",{schema:{default:!0},sceneOnly:!0})},6273:(e,t,n)=>{var i=n(8190).registerComponent,r=n(1343),s="a-dialog-buttons-container",o="a-dialog-button";function a(e,t){var n,i,s,o;return(n=document.createElement("div")).classList.add("a-modal"),n.setAttribute(r.AFRAME_INJECTED,""),(i=document.createElement("div")).className="a-dialog",i.setAttribute(r.AFRAME_INJECTED,""),n.appendChild(i),(s=document.createElement("div")).classList.add("a-dialog-text-container"),i.appendChild(s),(o=document.createElement("div")).classList.add("a-dialog-text"),o.innerHTML=e,s.appendChild(o),i.appendChild(t),n}e.exports.Component=i("device-orientation-permission-ui",{schema:{enabled:{default:!0},deviceMotionMessage:{default:"This immersive website requires access to your device motion sensors."},httpsMessage:{default:"Access this site over HTTPS to enter VR mode and grant access to the device sensors."},denyButtonText:{default:"Deny"},allowButtonText:{default:"Allow"},cancelButtonText:{default:"Cancel"}},sceneOnly:!0,init:function(){var e=this;this.data.enabled&&(window.isSecureContext||this.showHTTPAlert(),"undefined"!=typeof DeviceOrientationEvent&&DeviceOrientationEvent.requestPermission?(this.onDeviceMotionDialogAllowClicked=this.onDeviceMotionDialogAllowClicked.bind(this),this.onDeviceMotionDialogDenyClicked=this.onDeviceMotionDialogDenyClicked.bind(this),DeviceOrientationEvent.requestPermission().then((function(){e.el.emit("deviceorientationpermissiongranted"),e.permissionGranted=!0})).catch((function(){var t,n,i,l,c,h,d,u;e.devicePermissionDialogEl=(t=e.data.denyButtonText,n=e.data.allowButtonText,i=e.data.deviceMotionMessage,l=e.onDeviceMotionDialogAllowClicked,c=e.onDeviceMotionDialogDenyClicked,(h=document.createElement("div")).classList.add(s),(d=document.createElement("button")).classList.add(o,"a-dialog-deny-button"),d.setAttribute(r.AFRAME_INJECTED,""),d.innerHTML=t,h.appendChild(d),(u=document.createElement("button")).classList.add(o,"a-dialog-allow-button"),u.setAttribute(r.AFRAME_INJECTED,""),u.innerHTML=n,h.appendChild(u),u.addEventListener("click",(function(e){e.stopPropagation(),l()})),d.addEventListener("click",(function(e){e.stopPropagation(),c()})),a(i,h)),e.el.appendChild(e.devicePermissionDialogEl)}))):this.permissionGranted=!0)},remove:function(){this.devicePermissionDialogEl&&this.el.removeChild(this.devicePermissionDialogEl)},onDeviceMotionDialogDenyClicked:function(){this.remove()},showHTTPAlert:function(){var e,t,n,i,l,c=this,h=(e=c.data.cancelButtonText,t=c.data.httpsMessage,n=function(){c.el.removeChild(h)},(i=document.createElement("div")).classList.add(s),(l=document.createElement("button")).classList.add(o,"a-dialog-ok-button"),l.setAttribute(r.AFRAME_INJECTED,""),l.innerHTML=e,i.appendChild(l),l.addEventListener("click",(function(e){e.stopPropagation(),n()})),a(t,i));this.el.appendChild(h)},onDeviceMotionDialogAllowClicked:function(){var e=this;this.el.emit("deviceorientationpermissionrequested"),DeviceOrientationEvent.requestPermission().then((function(t){"granted"===t?(e.el.emit("deviceorientationpermissiongranted"),e.permissionGranted=!0):e.el.emit("deviceorientationpermissionrejected"),e.remove()})).catch(console.error)}})},3239:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("embedded",{dependencies:["xr-mode-ui"],schema:{default:!0},sceneOnly:!0,update:function(){var e=this.el,t=e.querySelector(".a-enter-vr");!0===this.data?(t&&t.classList.add("embedded"),e.removeFullScreenStyles()):(t&&t.classList.remove("embedded"),e.addFullScreenStyles())}})},6149:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437);n(8940)("components:fog:warn"),e.exports.Component=i("fog",{schema:{color:{type:"color",default:"#000"},density:{default:25e-5},far:{default:1e3,min:0},near:{default:1,min:0},type:{default:"linear",oneOf:["linear","exponential"]}},sceneOnly:!0,update:function(){var e=this.data,t=this.el,n=this.el.object3D.fog;n&&e.type===n.name?Object.keys(this.schema).forEach((function(t){var i=e[t];"color"===t&&(i=new r.Color(i)),n[t]=i})):t.object3D.fog=function(e){var t;return(t="exponential"===e.type?new r.FogExp2(e.color,e.density):new r.Fog(e.color,e.near,e.far)).name=e.type,t}(e)},remove:function(){var e=this.el;this.el.object3D.fog&&(e.object3D.fog=null)}})},2288:(e,t,n)=>{var i,r=n(1343).AFRAME_INJECTED,s=n(8330),o=n(8190).registerComponent,a=n(7427),l="https://unpkg.com/aframe-inspector@"+((i=s.version.split("."))[2]="x",i.join(".")+"/dist/aframe-inspector.min.js");e.exports.Component=o("inspector",{schema:{url:{default:l}},sceneOnly:!0,init:function(){this.firstPlay=!0,this.onKeydown=this.onKeydown.bind(this),this.onMessage=this.onMessage.bind(this),this.initOverlay(),window.addEventListener("keydown",this.onKeydown),window.addEventListener("message",this.onMessage)},play:function(){var e;this.firstPlay&&"false"!==(e=a.getUrlParameter("inspector"))&&e&&(this.openInspector(),this.firstPlay=!1)},initOverlay:function(){this.loadingMessageEl=document.createElement("div"),this.loadingMessageEl.classList.add("a-inspector-loader"),this.loadingMessageEl.innerHTML='Loading Inspector<span class="dots"><span>.</span><span>.</span><span>.</span></span>'},remove:function(){this.removeEventListeners()},onKeydown:function(e){73===e.keyCode&&(e.ctrlKey&&e.altKey||e.getModifierState("AltGraph"))&&this.openInspector()},showLoader:function(){document.body.appendChild(this.loadingMessageEl)},hideLoader:function(){document.body.removeChild(this.loadingMessageEl)},onMessage:function(e){"INJECT_AFRAME_INSPECTOR"===e.data&&this.openInspector()},openInspector:function(e){var t,n=this;AFRAME.INSPECTOR||AFRAME.inspectorInjected?AFRAME.INSPECTOR.open(e):(this.showLoader(),(t=document.createElement("script")).src=this.data.url,t.setAttribute("data-name","aframe-inspector"),t.setAttribute(r,""),t.onload=function(){AFRAME.INSPECTOR.open(e),n.hideLoader(),n.removeEventListeners()},t.onerror=function(){n.loadingMessageEl.innerHTML="Error loading Inspector"},document.head.appendChild(t),AFRAME.inspectorInjected=!0)},removeEventListeners:function(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("message",this.onMessage)}})},2130:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7427).shouldCaptureKeyEvent;e.exports.Component=i("keyboard-shortcuts",{schema:{enterVR:{default:!0},exitVR:{default:!0}},sceneOnly:!0,init:function(){this.onKeyup=this.onKeyup.bind(this)},play:function(){window.addEventListener("keyup",this.onKeyup,!1)},pause:function(){window.removeEventListener("keyup",this.onKeyup)},onKeyup:function(e){var t=this.el;r(e)&&(this.data.enterVR&&70===e.keyCode&&t.enterVR(),this.data.exitVR&&27===e.keyCode&&t.exitVR())}})},3791:(e,t,n)=>{var i=n(8940),r=n(8190).registerComponent,s=i("components:pool:warn");e.exports.Component=r("pool",{schema:{container:{default:""},mixin:{default:""},size:{default:0},dynamic:{default:!1}},sceneOnly:!0,multiple:!0,initPool:function(){var e;for(this.availableEls=[],this.usedEls=[],this.data.mixin||s("No mixin provided for pool component."),this.data.container&&(this.container=document.querySelector(this.data.container),this.container||s("Container "+this.data.container+" not found.")),this.container=this.container||this.el,e=0;e<this.data.size;++e)this.createEntity()},update:function(e){var t=this.data;e.mixin===t.mixin&&e.size===t.size||this.initPool()},createEntity:function(){var e;(e=document.createElement("a-entity")).play=this.wrapPlay(e.play),e.setAttribute("mixin",this.data.mixin),e.object3D.visible=!1,e.pause(),this.container.appendChild(e),this.availableEls.push(e);var t=this.usedEls;e.addEventListener("loaded",(function(){-1===t.indexOf(e)&&(e.object3DParent=e.object3D.parent,e.object3D.parent.remove(e.object3D))}))},wrapPlay:function(e){var t=this.usedEls;return function(){-1!==t.indexOf(this)&&e.call(this)}},requestEntity:function(){var e;if(0===this.availableEls.length){if(!1===this.data.dynamic)return void s("Requested entity from empty pool: "+this.attrName);s("Requested entity from empty pool. This pool is dynamic and will resize automatically. You might want to increase its initial size: "+this.attrName),this.createEntity()}return e=this.availableEls.shift(),this.usedEls.push(e),e.object3DParent&&(e.object3DParent.add(e.object3D),this.updateRaycasters()),e.object3D.visible=!0,e},returnEntity:function(e){var t=this.usedEls.indexOf(e);if(-1!==t)return this.usedEls.splice(t,1),this.availableEls.push(e),e.object3DParent=e.object3D.parent,e.object3D.parent.remove(e.object3D),this.updateRaycasters(),e.object3D.visible=!1,e.pause(),e;s("The returned entity was not previously pooled from "+this.attrName)},updateRaycasters:function(){document.querySelectorAll("[raycaster]").forEach((function(e){e.components.raycaster.setDirty()}))}})},2662:(e,t,n)=>{var i,r=n(8190).registerComponent,s=n(9437);e.exports.Component=r("real-world-meshing",{schema:{filterLabels:{type:"array"},meshesEnabled:{default:!0},meshMixin:{default:!0},planesEnabled:{default:!0},planeMixin:{default:""}},sceneOnly:!0,init:function(){var e=this.el.getAttribute("webxr"),t=e.requiredFeatures;-1===t.indexOf("mesh-detection")&&(t.push("mesh-detection"),this.el.setAttribute("webxr",e)),-1===t.indexOf("plane-detection")&&(t.push("plane-detection"),this.el.setAttribute("webxr",e)),this.meshEntities=[],this.initWorldMeshEntity=this.initWorldMeshEntity.bind(this)},tick:function(){this.el.is("ar-mode")&&(this.detectMeshes(),this.updateMeshes())},detectMeshes:function(){var e,t,n,i=this.data,r=this.el,s=(r.renderer.xr,this.meshEntities),o=!1,a=[],l=this.data.filterLabels;e=(n=r.frame).detectedMeshes,t=n.detectedPlanes;for(var c=0;c<s.length;c++)s[c].present=!1;if(i.meshesEnabled)for(var h of e.values())if(!l.length||-1!==l.indexOf(h.semanticLabel)){for(c=0;c<s.length;c++)if(h===s[c].mesh){o=!0,s[c].present=!0,s[c].lastChangedTime<h.lastChangedTime&&this.updateMeshGeometry(s[c].el,h),s[c].lastChangedTime=h.lastChangedTime;break}o||a.push(h),o=!1}if(i.planesEnabled)for(h of t.values())if(!l.length||-1!==l.indexOf(h.semanticLabel)){for(c=0;c<s.length;c++)if(h===s[c].mesh){o=!0,s[c].present=!0,s[c].lastChangedTime<h.lastChangedTime&&this.updateMeshGeometry(s[c].el,h),s[c].lastChangedTime=h.lastChangedTime;break}o||a.push(h),o=!1}this.deleteMeshes(),this.createNewMeshes(a)},updateMeshes:(i=new s.Matrix4,function(){for(var e,t,n,r=this.el,s=r.frame,o=this.meshEntities,a=r.renderer.xr.getReferenceSpace(),l=0;l<o.length;l++)n=o[l].mesh.meshSpace||o[l].mesh.planeSpace,e=s.getPose(n,a),(t=o[l].el).hasLoaded&&(i.fromArray(e.transform.matrix),i.decompose(t.object3D.position,t.object3D.quaternion,t.object3D.scale))}),deleteMeshes:function(){for(var e=this.meshEntities,t=[],n=0;n<e.length;n++)e[n].present?t.push(e[n]):this.el.removeChild(e[n]);this.meshEntities=t},createNewMeshes:function(e){for(var t,n=0;n<e.length;n++)t=document.createElement("a-entity"),this.meshEntities.push({mesh:e[n],el:t}),t.addEventListener("loaded",this.initWorldMeshEntity),this.el.appendChild(t)},initMeshGeometry:function(e){var t,n,i;if(e instanceof XRPlane){n=new s.Shape,i=e.polygon;for(var r=0;r<i.length;++r)0===r?n.moveTo(i[r].x,i[r].z):n.lineTo(i[r].x,i[r].z);return(t=new s.ShapeGeometry(n)).rotateX(Math.PI/2),t}return(t=new s.BufferGeometry).setAttribute("position",new s.BufferAttribute(e.vertices,3)),t.setIndex(new s.BufferAttribute(e.indices,1)),t},initWorldMeshEntity:function(e){for(var t,n,i,r=e.target,o=this.meshEntities,a=0;a<o.length;a++)if(o[a].el===r){i=o[a];break}t=this.initMeshGeometry(i.mesh),n=new s.Mesh(t,new s.MeshBasicMaterial({color:16777215*Math.random(),side:s.DoubleSide})),r.setObject3D("mesh",n),i.mesh instanceof XRPlane&&this.data.planeMixin?r.setAttribute("mixin",this.data.planeMixin):this.data.meshMixin&&r.setAttribute("mixin",this.data.meshMixin),r.setAttribute("data-world-mesh",i.mesh.semanticLabel)},updateMeshGeometry:function(e,t){var n=e.getObject3D("mesh");n.geometry.dispose(),n.geometry=this.initMeshGeometry(t)}})},952:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("reflection",{schema:{directionalLight:{type:"selector"}},sceneOnly:!0,init:function(){var e=this;this.cubeRenderTarget=new THREE.WebGLCubeRenderTarget(16),this.cubeCamera=new THREE.CubeCamera(.1,1e3,this.cubeRenderTarget),this.lightingEstimationTexture=new THREE.WebGLCubeRenderTarget(16).texture,this.needsVREnvironmentUpdate=!0;var t=this.el.getAttribute("webxr"),n=t.optionalFeatures;n.includes("light-estimation")||(n.push("light-estimation"),this.el.setAttribute("webxr",t)),this.el.addEventListener("enter-vr",(function(){e.el.is("ar-mode")&&e.el.renderer.xr.getSession().requestLightProbe&&e.startLightProbe()})),this.el.addEventListener("exit-vr",(function(){e.xrLightProbe&&e.stopLightProbe()})),this.el.object3D.environment=this.cubeRenderTarget.texture},stopLightProbe:function(){this.xrLightProbe=null,this.probeLight&&(this.probeLight.components.light.light.intensity=0),this.needsVREnvironmentUpdate=!0,this.el.object3D.environment=this.cubeRenderTarget.texture},startLightProbe:function(){this.needsLightProbeUpdate=!0},setupLightProbe:function(){var e=this.el.renderer,t=e.xr.getSession(),n=this,i=e.getContext();if(!this.probeLight){var r=document.createElement("a-light");r.setAttribute("type","probe"),r.setAttribute("intensity",0),this.el.appendChild(r),this.probeLight=r}switch(t.preferredReflectionFormat){case"srgba8":i.getExtension("EXT_sRGB");break;case"rgba16f":i.getExtension("OES_texture_half_float")}this.glBinding=new XRWebGLBinding(t,i),i.getExtension("EXT_sRGB"),i.getExtension("OES_texture_half_float"),t.requestLightProbe().then((function(e){n.xrLightProbe=e,e.addEventListener("reflectionchange",n.updateXRCubeMap.bind(n))})).catch((function(e){console.warn("Lighting estimation not supported: "+e.message),console.warn('Are you missing: webxr="optionalFeatures: light-estimation;" from <a-scene>?')}))},updateXRCubeMap:function(){var e=this.el.renderer,t=this.glBinding.getReflectionCubeMap(this.xrLightProbe);t&&(e.properties.get(this.lightingEstimationTexture).__webglTexture=t,this.lightingEstimationTexture.needsPMREMUpdate=!0,this.el.object3D.environment=this.lightingEstimationTexture)},tick:function(){var e=this.el.object3D,t=this.el.renderer,n=this.el.frame;if(n&&this.xrLightProbe){var i=n.getLightEstimate(this.xrLightProbe);i&&function(e,t,n,i){var r=Math.max(e.primaryLightIntensity.x,Math.max(e.primaryLightIntensity.y,e.primaryLightIntensity.z));t.sh.fromArray(e.sphericalHarmonicsCoefficients),t.intensity=3.14,n&&(n.color.setRGB(e.primaryLightIntensity.x/r,e.primaryLightIntensity.y/r,e.primaryLightIntensity.z/r),n.intensity=r,i.copy(e.primaryLightDirection))}(i,this.probeLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.components.light.light,this.data.directionalLight&&this.data.directionalLight.object3D.position)}this.needsVREnvironmentUpdate&&(e.environment=null,this.needsVREnvironmentUpdate=!1,this.cubeCamera.position.set(0,1.6,0),this.cubeCamera.update(t,e),e.environment=this.cubeRenderTarget.texture),this.needsLightProbeUpdate&&n&&(this.setupLightProbe(),this.needsLightProbeUpdate=!1)},remove:function(){this.el.object3D.environment=null,this.probeLight&&this.el.removeChild(this.probeLight)}})},1217:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=["attribute vec3 position;","attribute vec2 uv;","uniform mat4 projectionMatrix;","uniform mat4 modelViewMatrix;","varying vec2 vUv;","void main() {"," vUv = vec2( 1.- uv.x, uv.y );"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),o=["precision mediump float;","uniform samplerCube map;","varying vec2 vUv;","#define M_PI 3.141592653589793238462643383279","void main() {"," vec2 uv = vUv;"," float longitude = uv.x * 2. * M_PI - M_PI + M_PI / 2.;"," float latitude = uv.y * M_PI;"," vec3 dir = vec3("," - sin( longitude ) * sin( latitude ),"," cos( latitude ),"," - cos( longitude ) * sin( latitude )"," );"," normalize( dir );"," gl_FragColor = vec4( textureCube( map, dir ).rgb, 1.0 );","}"].join("\n");e.exports.Component=i("screenshot",{schema:{width:{default:4096},height:{default:2048},camera:{type:"selector"}},sceneOnly:!0,setup:function(){var e=this.el;if(!this.canvas){var t=e.renderer.getContext();t&&(this.cubeMapSize=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),this.material=new r.RawShaderMaterial({uniforms:{map:{type:"t",value:null}},vertexShader:s,fragmentShader:o,side:r.DoubleSide}),this.quad=new r.Mesh(new r.PlaneGeometry(1,1),this.material),this.quad.visible=!1,this.camera=new r.OrthographicCamera(-.5,.5,.5,-.5,-1e4,1e4),this.canvas=document.createElement("canvas"),this.ctx=this.canvas.getContext("2d"),e.object3D.add(this.quad),this.onKeyDown=this.onKeyDown.bind(this))}},getRenderTarget:function(e,t){return new r.WebGLRenderTarget(e,t,{colorSpace:this.el.sceneEl.renderer.outputColorSpace,minFilter:r.LinearFilter,magFilter:r.LinearFilter,wrapS:r.ClampToEdgeWrapping,wrapT:r.ClampToEdgeWrapping,format:r.RGBAFormat,type:r.UnsignedByteType})},resize:function(e,t){this.quad.scale.set(e,t,1),this.camera.left=-1*e/2,this.camera.right=e/2,this.camera.top=t/2,this.camera.bottom=-1*t/2,this.camera.updateProjectionMatrix(),this.canvas.width=e,this.canvas.height=t},play:function(){window.addEventListener("keydown",this.onKeyDown)},onKeyDown:function(e){var t=83===e.keyCode&&e.ctrlKey&&e.altKey;if(this.data&&t){var n=e.shiftKey?"equirectangular":"perspective";this.capture(n)}},setCapture:function(e){var t,n,i,s,o=this.el;return"perspective"===e?(this.quad.visible=!1,n=this.data.camera&&this.data.camera.components.camera.camera||o.camera,t={width:this.data.width,height:this.data.height}):(n=this.camera,s=new r.WebGLCubeRenderTarget(Math.min(this.cubeMapSize,2048),{format:r.RGBFormat,generateMipmaps:!0,minFilter:r.LinearMipmapLinearFilter,colorSpace:r.SRGBColorSpace}),i=new r.CubeCamera(o.camera.near,o.camera.far,s),o.camera.getWorldPosition(i.position),o.camera.getWorldQuaternion(i.quaternion),i.update(o.renderer,o.object3D),this.quad.material.uniforms.map.value=i.renderTarget.texture,t={width:this.data.width,height:this.data.height},this.quad.visible=!0),{camera:n,size:t,projection:e}},capture:function(e){var t,n=this.el.renderer.xr.enabled,i=this.el.renderer;this.setup(),i.xr.enabled=!1,t=this.setCapture(e),this.renderCapture(t.camera,t.size,t.projection),this.saveCapture(),i.xr.enabled=n},getCanvas:function(e){var t=this.el.renderer.xr.enabled,n=this.el.renderer;this.setup();var i=this.setCapture(e);return n.xr.enabled=!1,this.renderCapture(i.camera,i.size,i.projection),n.xr.enabled=t,this.canvas},renderCapture:function(e,t,n){var i,r,s,o=this.el.renderer.autoClear,a=this.el,l=a.renderer;r=this.getRenderTarget(t.width,t.height),s=new Uint8Array(4*t.width*t.height),this.resize(t.width,t.height),l.autoClear=!0,l.clear(),l.setRenderTarget(r),l.render(a.object3D,e),l.autoClear=o,l.readRenderTargetPixels(r,0,0,t.width,t.height,s),l.setRenderTarget(null),"perspective"===n&&(s=this.flipPixelsVertically(s,t.width,t.height)),i=new ImageData(new Uint8ClampedArray(s),t.width,t.height),this.quad.visible=!1,this.ctx.putImageData(i,0,0)},flipPixelsVertically:function(e,t,n){for(var i=e.slice(0),r=0;r<t;++r)for(var s=0;s<n;++s)i[4*r+s*t*4]=e[4*r+(n-s)*t*4],i[4*r+1+s*t*4]=e[4*r+1+(n-s)*t*4],i[4*r+2+s*t*4]=e[4*r+2+(n-s)*t*4],i[4*r+3+s*t*4]=e[4*r+3+(n-s)*t*4];return i},saveCapture:function(){this.canvas.toBlob((function(e){var t="screenshot-"+document.title.toLowerCase()+"-"+Date.now()+".png",n=document.createElement("a"),i=URL.createObjectURL(e);n.href=i,n.setAttribute("download",t),n.innerHTML="downloading...",n.style.display="none",document.body.appendChild(n),setTimeout((function(){n.click(),document.body.removeChild(n)}),1)}),"image/png")}})},8346:(e,t,n)=>{var i=n(8190).registerComponent,r=n(282),s=n(7427);n(3729),n(8132);var o=window.aframeStats,a="a-hidden",l=window.threeStats;e.exports.Component=i("stats",{schema:{default:!0},sceneOnly:!0,init:function(){var e=this.el;"false"!==s.getUrlParameter("stats")&&(this.stats=function(e){var t=new l(e.renderer),n=new o(e),i=e.isMobile?[]:[t,n];return new r({css:[],values:{fps:{caption:"fps",below:30}},groups:[{caption:"Framerate",values:["fps","raf"]}],plugins:i})}(e),this.statsEl=document.querySelector(".rs-base"),this.hideBound=this.hide.bind(this),this.showBound=this.show.bind(this),e.addEventListener("enter-vr",this.hideBound),e.addEventListener("exit-vr",this.showBound))},update:function(){if(this.stats)return this.data?this.show():this.hide()},remove:function(){this.el.removeEventListener("enter-vr",this.hideBound),this.el.removeEventListener("exit-vr",this.showBound),this.statsEl&&this.statsEl.parentNode.removeChild(this.statsEl)},tick:function(){var e=this.stats;e&&(e("rAF").tick(),e("FPS").frame(),e().update())},hide:function(){this.statsEl.classList.add(a)},show:function(){this.statsEl.classList.remove(a)}})},6469:(e,t,n)=>{var i=n(8190).registerComponent,r=n(1343),s=n(7427),o="a-hidden";function a(e){e.addEventListener("touchstart",(function(){e.classList.remove("resethover")}),{passive:!0}),e.addEventListener("touchend",(function(){e.classList.add("resethover")}),{passive:!0})}e.exports.Component=i("xr-mode-ui",{dependencies:["canvas"],schema:{enabled:{default:!0},cardboardModeEnabled:{default:!1},enterVRButton:{default:""},enterVREnabled:{default:!0},enterARButton:{default:""},enterAREnabled:{default:!0},XRMode:{default:"vr",oneOf:["vr","ar","xr"]}},sceneOnly:!0,init:function(){var e=this,t=this.el;"false"!==s.getUrlParameter("ui")&&(this.insideLoader=!1,this.enterVREl=null,this.enterAREl=null,this.orientationModalEl=null,this.bindMethods(),t.addEventListener("enter-vr",this.updateEnterInterfaces),t.addEventListener("exit-vr",this.updateEnterInterfaces),t.addEventListener("update-vr-devices",this.updateEnterInterfaces),window.addEventListener("message",(function(t){"loaderReady"===t.data.type&&(e.insideLoader=!0,e.remove())})),window.addEventListener("orientationchange",this.toggleOrientationModalIfNeeded))},bindMethods:function(){this.onEnterVRButtonClick=this.onEnterVRButtonClick.bind(this),this.onEnterARButtonClick=this.onEnterARButtonClick.bind(this),this.onModalClick=this.onModalClick.bind(this),this.toggleOrientationModalIfNeeded=this.toggleOrientationModalIfNeeded.bind(this),this.updateEnterInterfaces=this.updateEnterInterfaces.bind(this)},onModalClick:function(){this.el.exitVR()},onEnterVRButtonClick:function(){this.el.enterVR()},onEnterARButtonClick:function(){this.el.enterAR()},update:function(){var e,t,n,i=this.data,l=this.el;if(!i.enabled||this.insideLoader||"false"===s.getUrlParameter("ui"))return this.remove();this.enterVREl||this.enterAREl||this.orientationModalEl||(this.enterVREl||!i.enterVREnabled||"xr"!==i.XRMode&&"vr"!==i.XRMode||(i.enterVRButton?(this.enterVREl=document.querySelector(i.enterVRButton),this.enterVREl.addEventListener("click",this.onEnterVRButtonClick)):(this.enterVREl=(e=this.onEnterVRButtonClick,(n=document.createElement("div")).classList.add("a-enter-vr"),n.setAttribute(r.AFRAME_INJECTED,""),(t=document.createElement("button")).className="a-enter-vr-button",t.setAttribute("title","Enter VR mode with a headset or fullscreen without"),t.setAttribute(r.AFRAME_INJECTED,""),s.device.isMobile()&&a(t),n.appendChild(t),t.addEventListener("click",(function(t){e(),t.stopPropagation()})),n),l.appendChild(this.enterVREl))),this.enterAREl||!i.enterAREnabled||"xr"!==i.XRMode&&"ar"!==i.XRMode||(i.enterARButton?(this.enterAREl=document.querySelector(i.enterARButton),this.enterAREl.addEventListener("click",this.onEnterARButtonClick)):(this.enterAREl=function(e,t){var n,i;return(i=document.createElement("div")).classList.add("a-enter-ar"),t&&i.classList.add("xr"),i.setAttribute(r.AFRAME_INJECTED,""),(n=document.createElement("button")).className="a-enter-ar-button",n.setAttribute("title","Enter AR mode with a headset or handheld device."),n.setAttribute(r.AFRAME_INJECTED,""),s.device.isMobile()&&a(n),i.appendChild(n),n.addEventListener("click",(function(t){e(),t.stopPropagation()})),i}(this.onEnterARButtonClick,"xr"===i.XRMode),l.appendChild(this.enterAREl))),this.orientationModalEl=function(e){var t=document.createElement("div");t.className="a-orientation-modal",t.classList.add(o),t.setAttribute(r.AFRAME_INJECTED,"");var n=document.createElement("button");return n.setAttribute(r.AFRAME_INJECTED,""),n.innerHTML="Exit VR",n.addEventListener("click",e),t.appendChild(n),t}(this.onModalClick),l.appendChild(this.orientationModalEl),this.updateEnterInterfaces())},remove:function(){[this.enterVREl,this.enterAREl,this.orientationModalEl].forEach((function(e){e&&e.parentNode&&e.parentNode.removeChild(e)})),this.enterVREl=void 0,this.enterAREl=void 0,this.orientationModalEl=void 0},updateEnterInterfaces:function(){this.toggleEnterVRButtonIfNeeded(),this.toggleEnterARButtonIfNeeded(),this.toggleOrientationModalIfNeeded()},toggleEnterVRButtonIfNeeded:function(){var e=this.el;this.enterVREl&&(e.is("vr-mode")||(e.isMobile||s.device.isMobileDeviceRequestingDesktopSite())&&!this.data.cardboardModeEnabled&&!s.device.checkVRSupport()?this.enterVREl.classList.add(o):(s.device.checkVRSupport()||this.enterVREl.classList.add("fullscreen"),this.enterVREl.classList.remove(o),e.enterVR(!1,!0)))},toggleEnterARButtonIfNeeded:function(){var e=this.el;this.enterAREl&&(e.is("vr-mode")||!s.device.checkARSupport()?this.enterAREl.classList.add(o):(this.enterAREl.classList.remove(o),e.enterVR(!0,!0)))},toggleOrientationModalIfNeeded:function(){var e=this.el,t=this.orientationModalEl;t&&e.isMobile&&(!s.device.isLandscape()&&e.is("vr-mode")?t.classList.remove(o):t.classList.add(o))}})},1072:(e,t,n)=>{var i=n(8190),r=n(9437),s=i.registerComponent;e.exports.Component=s("shadow",{schema:{cast:{default:!0},receive:{default:!0}},init:function(){this.onMeshChanged=this.update.bind(this),this.el.addEventListener("object3dset",this.onMeshChanged),this.system.setShadowMapEnabled(!0)},update:function(){var e=this.data;this.updateDescendants(e.cast,e.receive)},remove:function(){this.el.removeEventListener("object3dset",this.onMeshChanged),this.updateDescendants(!1,!1)},updateDescendants:function(e,t){var n=this.el.sceneEl;this.el.object3D.traverse((function(i){if(i instanceof r.Mesh&&(i.castShadow=e,i.receiveShadow=t,n.hasLoaded&&i.material))for(var s=Array.isArray(i.material)?i.material:[i.material],o=0;o<s.length;o++)s[o].needsUpdate=!0}))}})},477:(e,t,n)=>{var i=n(8190).registerComponent,r=n(8940),s=n(9437),o=r("components:sound:warn");e.exports.Component=i("sound",{schema:{autoplay:{default:!1},distanceModel:{default:"inverse",oneOf:["linear","inverse","exponential"]},loop:{default:!1},loopStart:{default:0},loopEnd:{default:0},maxDistance:{default:1e4},on:{default:""},poolSize:{default:1},positional:{default:!0},refDistance:{default:1},rolloffFactor:{default:1},src:{type:"audio"},volume:{default:1}},multiple:!0,init:function(){var e=this;this.listener=null,this.audioLoader=new s.AudioLoader,this.pool=new s.Group,this.loaded=!1,this.mustPlay=!1,this.playSoundBound=function(){e.playSound()}},update:function(e){var t,n,i=this.data,r=i.src!==e.src;if(r){if(!i.src)return;this.setupSound()}for(t=0;t<this.pool.children.length;t++)n=this.pool.children[t],i.positional&&(n.setDistanceModel(i.distanceModel),n.setMaxDistance(i.maxDistance),n.setRefDistance(i.refDistance),n.setRolloffFactor(i.rolloffFactor)),n.setLoop(i.loop),n.setLoopStart(i.loopStart),0!==i.loopStart&&0===i.loopEnd?n.setLoopEnd(n.buffer.duration):n.setLoopEnd(i.loopEnd),n.setVolume(i.volume),n.isPaused=!1;if(i.on!==e.on&&this.updateEventListener(e.on),r){var o=this;this.loaded=!1,this.audioLoader.load(i.src,(function(e){for(t=0;t<o.pool.children.length;t++)(n=o.pool.children[t]).setBuffer(e);o.loaded=!0,s.Cache.remove(i.src),(o.data.autoplay||o.mustPlay)&&o.playSound(o.processSound),o.el.emit("sound-loaded",o.evtDetail,!1)}))}},pause:function(){this.stopSound(),this.removeEventListener()},play:function(){this.data.autoplay&&this.playSound(),this.updateEventListener()},remove:function(){var e;this.removeEventListener(),this.el.getObject3D(this.attrName)&&this.el.removeObject3D(this.attrName);try{for(e=0;e<this.pool.children.length;e++)this.pool.children[e].disconnect()}catch(e){o("Audio source not properly disconnected")}},updateEventListener:function(e){var t=this.el;e&&t.removeEventListener(e,this.playSoundBound),t.addEventListener(this.data.on,this.playSoundBound)},removeEventListener:function(){this.el.removeEventListener(this.data.on,this.playSoundBound)},setupSound:function(){var e,t,n=this.el,i=n.sceneEl,r=this;this.pool.children.length>0&&(this.stopSound(),n.removeObject3D("sound"));var o=this.listener=i.audioListener||new s.AudioListener;for(i.audioListener=o,i.camera&&i.camera.add(o),i.addEventListener("camera-set-active",(function(e){e.detail.cameraEl.getObject3D("camera").add(o)})),this.pool=new s.Group,e=0;e<this.data.poolSize;e++)t=this.data.positional?new s.PositionalAudio(o):new s.Audio(o),this.pool.add(t);for(n.setObject3D(this.attrName,this.pool),e=0;e<this.pool.children.length;e++)(t=this.pool.children[e]).onEnded=function(){this.isPlaying=!1,r.el.emit("sound-ended",r.evtDetail,!1)}},pauseSound:function(){var e,t;for(this.isPlaying=!1,e=0;e<this.pool.children.length;e++)(t=this.pool.children[e]).source&&t.source.buffer&&t.isPlaying&&!t.isPaused&&(t.isPaused=!0,t.pause())},playSound:function(e){var t,n,i;if(!this.loaded)return o("Sound not loaded yet. It will be played once it finished loading"),this.mustPlay=!0,void(this.processSound=e);for(t=!1,this.isPlaying=!0,n=0;n<this.pool.children.length;n++)(i=this.pool.children[n]).isPlaying||!i.buffer||t||(e&&e(i),i.play(),i.isPaused=!1,t=!0);t?(this.mustPlay=!1,this.processSound=void 0):o("All the sounds are playing. If you need to play more sounds simultaneously consider increasing the size of pool with the `poolSize` attribute.",this.el)},stopSound:function(){var e,t;for(this.isPlaying=!1,e=0;e<this.pool.children.length;e++){if(!(t=this.pool.children[e]).source||!t.source.buffer)return;t.stop()}}})},1603:(e,t,n)=>{var i=n(4433),r=n(5751),s=n(8190).registerComponent,o=n(5892),a=n(9437),l=n(7427),c=l.debug("components:text:error"),h=o.shaders,d=l.debug("components:text:warn"),u=n(1343).AFRAME_CDN_ROOT+"fonts/",p={aileronsemibold:u+"Aileron-Semibold.fnt",dejavu:u+"DejaVu-sdf.fnt",exo2bold:u+"Exo2Bold.fnt",exo2semibold:u+"Exo2SemiBold.fnt",kelsonsans:u+"KelsonSans.fnt",monoid:u+"Monoid.fnt",mozillavr:u+"mozillavr.fnt",roboto:u+"Roboto-msdf.json",sourcecodepro:u+"SourceCodePro.fnt"},A=["roboto"],f="roboto";e.exports.FONTS=p;var m,g,v,y,E=new function(){var e=this.cache={};this.get=function(t,n){return t in e||(e[t]=n()),e[t]}},x={},b={},C=/^\w+:/;function w(e,t,n){return e||(.5+t)*n}e.exports.Component=s("text",{multiple:!0,schema:{align:{type:"string",default:"left",oneOf:["left","right","center"]},alphaTest:{default:.5},anchor:{default:"center",oneOf:["left","right","center","align"]},baseline:{default:"center",oneOf:["top","center","bottom"]},color:{type:"color",default:"#FFF"},font:{type:"string",default:f},fontImage:{type:"string"},height:{type:"number"},letterSpacing:{type:"number",default:0},lineHeight:{type:"number"},negate:{type:"boolean",default:!0},opacity:{type:"number",default:1},shader:{default:"sdf",oneOf:h},side:{default:"front",oneOf:["front","back","double"]},tabSize:{default:4},transparent:{default:!0},value:{type:"string"},whiteSpace:{default:"normal",oneOf:["normal","pre","nowrap"]},width:{type:"number"},wrapCount:{type:"number",default:40},wrapPixels:{type:"number"},xOffset:{type:"number",default:0},yOffset:{type:"number",default:0},zOffset:{type:"number",default:.001}},init:function(){this.shaderData={},this.geometry=i(),this.createOrUpdateMaterial(),this.explicitGeoDimensionsChecked=!1},update:function(e){var t=this.data,n=this.currentFont;b[t.font]?this.texture=b[t.font]:(this.texture=b[t.font]=new a.Texture,this.texture.anisotropy=16),this.createOrUpdateMaterial(),e.font===t.font?n&&(this.updateGeometry(this.geometry,n),this.updateLayout()):this.updateFont()},remove:function(){this.geometry.dispose(),this.geometry=null,this.el.removeObject3D(this.attrName),this.material.dispose(),this.material=null,this.texture.dispose(),this.texture=null,this.shaderObject&&delete this.shaderObject},createOrUpdateMaterial:function(){var e,t,n,i=this.data,r=this.material,s=this.shaderData;if(n=i.shader,-1!==A.indexOf(i.font)||i.font.indexOf("-msdf.")>=0?n="msdf":i.font in p&&-1===A.indexOf(i.font)&&(n="sdf"),e=(this.shaderObject&&this.shaderObject.name)!==n,s.alphaTest=i.alphaTest,s.color=i.color,s.map=this.texture,s.opacity=i.opacity,s.side=function(e){switch(e){case"back":return a.FrontSide;case"double":return a.DoubleSide;default:return a.BackSide}}(i.side),s.transparent=i.transparent,s.negate=i.negate,!e)return this.shaderObject.update(s),r.transparent=s.transparent,void(r.side=s.side);t=function(e,t,n){var i,r;return(r=new h[t].Shader).el=e,r.init(n),r.update(n),(i=r.material).transparent=n.transparent,{material:i,shader:r}}(this.el,n,s),this.material=t.material,this.shaderObject=t.shader,this.material.side=s.side,this.mesh&&(this.mesh.material=this.material)},updateFont:function(){var e,t=this.data,n=this.el,i=this.geometry,s=this;t.font||d("No font specified. Using the default font."),this.mesh&&(this.mesh.visible=!1),e=this.lookupFont(t.font||f)||t.font,E.get(e,(function(){return n=e,i=t.yOffset,new Promise((function(e,t){r(n,(function(r,s){if(r)return c("Error loading font",n),void t(r);n.indexOf("/Roboto-msdf.json")>=0&&(i=30),i&&s.chars.map((function(e){e.yoffset+=i})),e(s)}))}));var n,i})).then((function(r){var o;if(1!==r.pages.length)throw new Error("Currently only single-page bitmap fonts are supported.");x[e]||(r.widthFactor=x[r]=function(e){var t=0,n=0,i=0;return e.chars.map((function(e){t+=e.xadvance,e.id>=48&&e.id<=57&&(i++,n+=e.xadvance)})),i?n/i:t/e.chars.length}(r)),s.currentFont=r,o=s.getFontImageSrc(),E.get(o,(function(){return e=o,new Promise((function(t,n){(new a.ImageLoader).load(e,(function(e){t(e)}),void 0,(function(){c("Error loading font image",e),n(null)}))}));var e})).then((function(e){var o=s.texture;o&&(o.image=e,o.needsUpdate=!0,b[t.font]=o,s.texture=o,s.initMesh(),s.currentFont=r,s.updateGeometry(i,r),s.updateLayout(),s.mesh.visible=!0,n.emit("textfontset",{font:t.font,fontObj:r}))})).catch((function(e){c(e.message),c(e.stack)}))})).catch((function(e){c(e.message),c(e.stack)}))},initMesh:function(){this.mesh||(this.mesh=new a.Mesh(this.geometry,this.material),this.el.setObject3D(this.attrName,this.mesh))},getFontImageSrc:function(){if(this.data.fontImage)return this.data.fontImage;var e=this.lookupFont(this.data.font||f)||this.data.font,t=this.currentFont.pages[0];return t.match(C)&&0!==t.indexOf("http")?e.replace(/(\.fnt)|(\.json)/,".png"):a.LoaderUtils.extractUrlBase(e)+t},updateLayout:function(){var e,t,n,i,r,s,o,a,l,c=this.el,h=this.data,d=this.geometry,u=this.mesh;if(u&&d.layout){if(n=c.getAttribute("geometry"),i=(s=(o=h.width||n&&n.width||1)/w(h.wrapPixels,h.wrapCount,this.currentFont.widthFactor))*((r=d.layout).height+r.descender),n&&"plane"===n.primitive&&(this.explicitGeoDimensionsChecked||(this.explicitGeoDimensionsChecked=!0,this.hasExplicitGeoWidth=!!n.width,this.hasExplicitGeoHeight=!!n.height),this.hasExplicitGeoWidth||c.setAttribute("geometry","width",o),this.hasExplicitGeoHeight||c.setAttribute("geometry","height",i)),"left"===(e="align"===h.anchor?h.align:h.anchor))a=0;else if("right"===e)a=-1*r.width;else{if("center"!==e)throw new TypeError("Invalid text.anchor property value",e);a=-1*r.width/2}if("bottom"===(t=h.baseline))l=0;else if("top"===t)l=-1*r.height+r.ascender;else{if("center"!==t)throw new TypeError("Invalid text.baseline property value",t);l=-1*r.height/2}u.position.x=a*s+h.xOffset,u.position.y=l*s,u.position.z=h.zOffset,u.scale.set(s,-1*s,s)}},lookupFont:function(e){return p[e]},updateGeometry:(m={},g={},v=/\\n/g,y=/\\t/g,function(e,t){var n=this.data;g.font=t,g.lineHeight=n.lineHeight&&isFinite(n.lineHeight)?n.lineHeight:t.common.lineHeight,g.text=n.value.toString().replace(v,"\n").replace(y,"\t"),g.width=w(n.wrapPixels,n.wrapCount,t.widthFactor),e.update(l.extend(m,n,g))})})},6547:(e,t,n)=>{var i=n(7960),r=n(8190).registerComponent;e.exports.Component=r("tracked-controls",{schema:{id:{type:"string",default:""},controller:{default:-1},autoHide:{default:!0},hand:{type:"string",default:""},handTrackingEnabled:{default:!1},iterateControllerProfiles:{default:!1}},init:function(){this.buttonEventDetails={},this.buttonStates=this.el.components["tracked-controls"].buttonStates={},this.axis=this.el.components["tracked-controls"].axis=[0,0,0],this.changedAxes=[],this.axisMoveEventDetail={axis:this.axis,changed:this.changedAxes},this.updateController=this.updateController.bind(this)},update:function(){this.updateController()},play:function(){var e=this.el.sceneEl;this.updateController(),e.addEventListener("controllersupdated",this.updateController)},pause:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.updateController)},isControllerPresent:function(e){return!(!this.controller||this.controller.gamepad||"none"!==e.inputSource.handedness&&e.inputSource.handedness!==this.data.hand)},updateController:function(){this.controller=i.findMatchingControllerWebXR(this.system.controllers,this.data.id,this.data.hand,this.data.controller,this.data.iterateControllerProfiles,this.data.handTrackingEnabled),this.el.components["tracked-controls"].controller=this.controller},tick:function(){var e=this.el.sceneEl,t=this.controller,n=e.frame;this.data.autoHide&&(this.el.object3D.visible=!!t),t&&e.frame&&this.system.referenceSpace&&(t.hand||(this.pose=n.getPose(t.gripSpace,this.system.referenceSpace),this.updatePose(),this.updateButtons()))},updatePose:function(){var e=this.el.object3D,t=this.pose;t&&(e.matrix.elements=t.transform.matrix,e.matrix.decompose(e.position,e.rotation,e.scale))},updateButtons:function(){var e,t,n,i=this.controller;if(i&&i.gamepad){for(n=i.gamepad,t=0;t<n.buttons.length;++t)this.buttonStates[t]||(this.buttonStates[t]={pressed:!1,touched:!1,value:0}),this.buttonEventDetails[t]||(this.buttonEventDetails[t]={id:t,state:this.buttonStates[t]}),e=n.buttons[t],this.handleButton(t,e);this.handleAxes()}},handleButton:function(e,t){return!!(this.handlePress(e,t)|this.handleTouch(e,t)|this.handleValue(e,t))&&(this.el.emit("buttonchanged",this.buttonEventDetails[e],!1),!0)},handleAxes:function(){var e,t=!1,n=this.controller.gamepad.axes,i=this.axis,r=this.changedAxes;for(this.changedAxes.splice(0,this.changedAxes.length),e=0;e<n.length;++e)r.push(i[e]!==n[e]),r[e]&&(t=!0);if(!t)return!1;for(this.axis.splice(0,this.axis.length),e=0;e<n.length;e++)this.axis.push(n[e]);return this.el.emit("axismove",this.axisMoveEventDetail,!1),!0},handlePress:function(e,t){var n,i=this.buttonStates[e];return t.pressed!==i.pressed&&(n=t.pressed?"buttondown":"buttonup",this.el.emit(n,this.buttonEventDetails[e],!1),i.pressed=t.pressed,!0)},handleTouch:function(e,t){var n,i=this.buttonStates[e];return t.touched!==i.touched&&(n=t.touched?"touchstart":"touchend",this.el.emit(n,this.buttonEventDetails[e],!1),i.touched=t.touched,!0)},handleValue:function(e,t){var n=this.buttonStates[e];return t.value!==n.value&&(n.value=t.value,!0)}})},7360:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c=n(1343).AFRAME_CDN_ROOT+"controllers/valve/index/valve-index-",h={left:c+"left.glb",right:c+"right.glb"},d="valve",u={left:{x:0,y:-.05,z:.06},right:{x:0,y:-.05,z:.06}},p={left:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"},right:{_x:Math.PI/3,_y:0,_z:0,_order:"XYZ"}};e.exports.Component=i("valve-index-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{trackpad:[0,1],thumbstick:[2,3]},buttons:["trigger","grip","trackpad","thumbstick","abutton"]},init:function(){var e=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.bindMethods()},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data,t="right"===e.hand?0:"left"===e.hand?1:2;o(this,d,{index:t,iterateControllerProfiles:!0,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:d,controller:"right"===t.hand?1:"left"===t.hand?0:2,hand:t.hand}),this.loadModel()},loadModel:function(){var e=this.data;e.model&&this.el.setAttribute("gltf-model",""+h[e.hand])},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(t=e.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=this.triggerOriginalRotationX-t*(Math.PI/40))),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t,n=e.detail.model,i=this;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},t.menu=n.getObjectByName("menubutton"),t.system=n.getObjectByName("systembutton"),t.trackpad=n.getObjectByName("touchpad"),t.trigger=n.getObjectByName("trigger"),this.triggerOriginalRotationX=t.trigger.rotation.x,Object.keys(t).forEach((function(e){i.setButtonColor(e,i.data.buttonColor)})),n.position.copy(p[this.data.hand]),n.rotation.copy(u[this.data.hand]),this.el.emit("controllermodelready",{name:"valve-index-controls",model:this.data.model,rayOrigin:new r.Vector3(0,0,0)}))},onAxisMoved:function(e){a(this,this.mapping.axes,e)},updateModel:function(e,t){var n;this.data.model&&(-1!==t.indexOf("touch")||(n="up"===t?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(e,n)))},setButtonColor:function(e,t){}})},5300:(e,t,n)=>{var i=n(8190).registerComponent;e.exports.Component=i("visible",{schema:{default:!0},update:function(){this.el.object3D.visible=this.data}})},1507:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l=n(1343).AFRAME_CDN_ROOT,c=l+"controllers/vive/vr_controller_vive.obj",h=l+"controllers/vive/vr_controller_vive.mtl",d="htc-vive";e.exports.Component=i("vive-controls",{schema:{hand:{default:"left"},buttonColor:{type:"color",default:"#FAFAFA"},buttonHighlightColor:{type:"color",default:"#22D1EE"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1]},buttons:["trigger","grip","touchpad","none"]},init:function(){var e=this;this.controllerPresent=!1,this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.previousButtonValues={},this.bindMethods()},update:function(){var e=this.data;this.controllerIndex="right"===e.hand?0:"left"===e.hand?1:2},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1},checkIfControllerPresent:function(){var e=this.data;s(this,d,{index:this.controllerIndex,hand:e.hand})},injectTrackedControls:function(){var e=this.el,t=this.data;e.setAttribute("tracked-controls",{idPrefix:d,hand:t.hand,controller:this.controllerIndex}),this.data.model&&this.el.setAttribute("obj-model",{obj:c,mtl:h})},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onButtonChanged:function(e){var t,n=this.mapping.buttons[e.detail.id],i=this.buttonMeshes;n&&("trigger"===n&&(t=e.detail.state.value,i&&i.trigger&&(i.trigger.rotation.x=-t*(Math.PI/12))),this.el.emit(n+"changed",e.detail.state))},onModelLoaded:function(e){var t,n=e.detail.model,i=this;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).grip={left:n.getObjectByName("leftgrip"),right:n.getObjectByName("rightgrip")},t.menu=n.getObjectByName("menubutton"),t.system=n.getObjectByName("systembutton"),t.trackpad=n.getObjectByName("touchpad"),t.touchpad=n.getObjectByName("touchpad"),t.trigger=n.getObjectByName("trigger"),Object.keys(t).forEach((function(e){i.setButtonColor(e,i.data.buttonColor)})),n.position.set(0,-.015,.04))},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){var n;this.data.model&&(-1!==t.indexOf("touch")||(n="up"===t?this.data.buttonColor:this.data.buttonHighlightColor,this.setButtonColor(e,n)))},setButtonColor:function(e,t){var n=this.buttonMeshes;if(n)return"grip"===e?(n.grip.left.material.color.set(t),void n.grip.right.material.color.set(t)):void n[e].material.color.set(t)}})},4592:(e,t,n)=>{var i=n(8190).registerComponent,r=n(7960),s=r.checkControllerPresentAndSetup,o=r.emitIfAxesChanged,a=r.onButtonEvent,l=n(1343).AFRAME_CDN_ROOT+"controllers/vive/focus-controller/focus-controller.gltf",c="htc-vive-focus";e.exports.Component=i("vive-focus-controls",{schema:{hand:{default:""},buttonTouchedColor:{type:"color",default:"#BBBBBB"},buttonHighlightColor:{type:"color",default:"#7A7A7A"},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1]},buttons:["trigger","none","touchpad","none","menu"]},bindMethods:function(){this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.removeControllersUpdateListener=this.removeControllersUpdateListener.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){a(t.detail.id,"down",e)},this.onButtonUp=function(t){a(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){a(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){a(t.detail.id,"touchend",e)},this.controllerPresent=!1,this.bindMethods()},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("model-loaded",this.onModelLoaded),e.addEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!0,this.addControllersUpdateListener()},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("model-loaded",this.onModelLoaded),e.removeEventListener("axismove",this.onAxisMoved),this.controllerEventsActive=!1,this.removeControllersUpdateListener()},checkIfControllerPresent:function(){s(this,c,this.data.hand?{hand:this.data.hand}:{})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},injectTrackedControls:function(){var e=this.el;this.data,e.setAttribute("tracked-controls",{idPrefix:c}),this.data.model&&this.el.setAttribute("gltf-model",l)},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelLoaded:function(e){var t,n=e.detail.model;e.target===this.el&&this.data.model&&((t=this.buttonMeshes={}).trigger=n.getObjectByName("BumperKey"),t.triggerPressed=n.getObjectByName("BumperKey_Press"),t.triggerPressed&&(t.triggerPressed.visible=!1),t.touchpad=n.getObjectByName("TouchPad"),t.touchpadPressed=n.getObjectByName("TouchPad_Press"),t.trackpad=n.getObjectByName("TouchPad"),t.trackpadPressed=n.getObjectByName("TouchPad_Press"),t.trackpadPressed&&(t.trackpadPressed.visible=!1))},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&this.el.emit(t+"changed",e.detail.state)},onAxisMoved:function(e){o(this,this.mapping.axes,e)},updateModel:function(e,t){this.data.model&&this.updateButtonModel(e,t)},updateButtonModel:function(e,t){var n=this.buttonMeshes,i=e+"Pressed";if(n&&n[e]&&n[i]){var r;switch(t){case"down":r=this.data.buttonHighlightColor;break;case"touchstart":r=this.data.buttonTouchedColor}r&&n[i].material.color.set(r),n[i].visible=!!r,n[e].visible=!r}}})},6458:(e,t,n)=>{var i,r,s=n(1343).keyboardevent.KEYCODE_TO_CODE,o=n(8190).registerComponent,a=n(9437),l=n(7427).shouldCaptureKeyEvent,c=1e-5,h=["KeyW","KeyA","KeyS","KeyD","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"];e.exports.Component=o("wasd-controls",{schema:{acceleration:{default:65},adAxis:{default:"x",oneOf:["x","y","z"]},adEnabled:{default:!0},adInverted:{default:!1},enabled:{default:!0},fly:{default:!1},wsAxis:{default:"z",oneOf:["x","y","z"]},wsEnabled:{default:!0},wsInverted:{default:!1}},after:["look-controls"],init:function(){this.keys={},this.easing=1.1,this.velocity=new a.Vector3,this.onBlur=this.onBlur.bind(this),this.onContextMenu=this.onContextMenu.bind(this),this.onFocus=this.onFocus.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onVisibilityChange=this.onVisibilityChange.bind(this),this.attachVisibilityEventListeners()},tick:function(e,t){var n=this.data,i=this.el,r=this.velocity;(r[n.adAxis]||r[n.wsAxis]||!function(e){var t;for(t in e)return!1;return!0}(this.keys))&&(t/=1e3,this.updateVelocity(t),(r[n.adAxis]||r[n.wsAxis])&&i.object3D.position.add(this.getMovementVector(t)))},update:function(e){e.adAxis!==this.data.adAxis&&(this.velocity[e.adAxis]=0),e.wsAxis!==this.data.wsAxis&&(this.velocity[e.wsAxis]=0)},remove:function(){this.removeKeyEventListeners(),this.removeVisibilityEventListeners()},play:function(){this.attachKeyEventListeners()},pause:function(){this.keys={},this.removeKeyEventListeners()},updateVelocity:function(e){var t,n,i,r,s,o=this.data,a=this.keys,l=this.velocity;if(n=o.adAxis,r=o.wsAxis,e>.2)return l[n]=0,void(l[r]=0);var h=Math.pow(1/this.easing,60*e);0!==l[n]&&(l[n]=l[n]*h),0!==l[r]&&(l[r]=l[r]*h),Math.abs(l[n])<c&&(l[n]=0),Math.abs(l[r])<c&&(l[r]=0),o.enabled&&(t=o.acceleration,o.adEnabled&&(i=o.adInverted?-1:1,(a.KeyA||a.ArrowLeft)&&(l[n]-=i*t*e),(a.KeyD||a.ArrowRight)&&(l[n]+=i*t*e)),o.wsEnabled&&(s=o.wsInverted?-1:1,(a.KeyW||a.ArrowUp)&&(l[r]-=s*t*e),(a.KeyS||a.ArrowDown)&&(l[r]+=s*t*e)))},getMovementVector:(i=new a.Vector3(0,0,0),r=new a.Euler(0,0,0,"YXZ"),function(e){var t,n=this.el.getAttribute("rotation"),s=this.velocity;return i.copy(s),i.multiplyScalar(e),n?(t=this.data.fly?n.x:0,r.set(a.MathUtils.degToRad(t),a.MathUtils.degToRad(n.y),0),i.applyEuler(r),i):i}),attachVisibilityEventListeners:function(){window.oncontextmenu=this.onContextMenu,window.addEventListener("blur",this.onBlur),window.addEventListener("focus",this.onFocus),document.addEventListener("visibilitychange",this.onVisibilityChange)},removeVisibilityEventListeners:function(){window.removeEventListener("blur",this.onBlur),window.removeEventListener("focus",this.onFocus),document.removeEventListener("visibilitychange",this.onVisibilityChange)},attachKeyEventListeners:function(){window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp)},removeKeyEventListeners:function(){window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp)},onContextMenu:function(){for(var e=Object.keys(this.keys),t=0;t<e.length;t++)delete this.keys[e[t]]},onBlur:function(){this.pause()},onFocus:function(){this.play()},onVisibilityChange:function(){document.hidden?this.onBlur():this.onFocus()},onKeyDown:function(e){var t;l(e)&&(t=e.code||s[e.keyCode],-1!==h.indexOf(t)&&(this.keys[t]=!0))},onKeyUp:function(e){var t;t=e.code||s[e.keyCode],delete this.keys[t]}})},221:(e,t,n)=>{var i,r=n(8190).registerComponent,s=n(7960),o=s.checkControllerPresentAndSetup,a=s.emitIfAxesChanged,l=s.onButtonEvent,c=n(7427),h=c.debug("components:windows-motion-controls:debug"),d=c.debug("components:windows-motion-controls:warn"),u=n(1343).DEFAULT_HANDEDNESS,p=n(1343).AFRAME_CDN_ROOT+"controllers/microsoft/",A={left:"left.glb",right:"right.glb",default:"universal.glb"},f="windows-mixed-reality";e.exports.Component=r("windows-motion-controls",{schema:{hand:{default:u},pair:{default:0},model:{default:!0}},after:["tracked-controls"],mapping:{axes:{touchpad:[0,1],thumbstick:[2,3]},buttons:["trigger","squeeze","touchpad","thumbstick","menu"],axisMeshNames:["TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_X","THUMBSTICK_X","THUMBSTICK_Y"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",squeeze:"GRASP",thumbstick:"THUMBSTICK_PRESS",touchpad:"TOUCHPAD_PRESS"},pointingPoseMeshName:"POINTING_POSE"},bindMethods:function(){this.onModelError=this.onModelError.bind(this),this.onModelLoaded=this.onModelLoaded.bind(this),this.onControllersUpdate=this.onControllersUpdate.bind(this),this.checkIfControllerPresent=this.checkIfControllerPresent.bind(this),this.onAxisMoved=this.onAxisMoved.bind(this)},init:function(){var e=this,t=this.el;this.onButtonChanged=this.onButtonChanged.bind(this),this.onButtonDown=function(t){l(t.detail.id,"down",e)},this.onButtonUp=function(t){l(t.detail.id,"up",e)},this.onButtonTouchStart=function(t){l(t.detail.id,"touchstart",e)},this.onButtonTouchEnd=function(t){l(t.detail.id,"touchend",e)},this.onControllerConnected=function(){e.setModelVisibility(!0)},this.onControllerDisconnected=function(){e.setModelVisibility(!1)},this.controllerPresent=!1,this.previousButtonValues={},this.bindMethods(),this.loadedMeshInfo={buttonMeshes:null,axisMeshes:null},this.rayOrigin={origin:new THREE.Vector3,direction:new THREE.Vector3(0,0,-1),createdFromMesh:!1},t.addEventListener("controllerconnected",this.onControllerConnected),t.addEventListener("controllerdisconnected",this.onControllerDisconnected)},addEventListeners:function(){var e=this.el;e.addEventListener("buttonchanged",this.onButtonChanged),e.addEventListener("buttondown",this.onButtonDown),e.addEventListener("buttonup",this.onButtonUp),e.addEventListener("touchstart",this.onButtonTouchStart),e.addEventListener("touchend",this.onButtonTouchEnd),e.addEventListener("axismove",this.onAxisMoved),e.addEventListener("model-error",this.onModelError),e.addEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!0},removeEventListeners:function(){var e=this.el;e.removeEventListener("buttonchanged",this.onButtonChanged),e.removeEventListener("buttondown",this.onButtonDown),e.removeEventListener("buttonup",this.onButtonUp),e.removeEventListener("touchstart",this.onButtonTouchStart),e.removeEventListener("touchend",this.onButtonTouchEnd),e.removeEventListener("axismove",this.onAxisMoved),e.removeEventListener("model-error",this.onModelError),e.removeEventListener("model-loaded",this.onModelLoaded),this.controllerEventsActive=!1},checkIfControllerPresent:function(){o(this,f,{hand:this.data.hand,index:this.data.pair,iterateControllerProfiles:!0})},play:function(){this.checkIfControllerPresent(),this.addControllersUpdateListener()},pause:function(){this.removeEventListeners(),this.removeControllersUpdateListener()},updateControllerModel:function(){if(this.data.model&&!this.rayOrigin.createdFromMesh){var e=this.createControllerModelUrl();this.loadModel(e)}else this.modelReady()},createControllerModelUrl:function(e){var t=this.data.hand;return p+"default/"+(A[t]||A.default)},injectTrackedControls:function(){var e=this.data;this.el.setAttribute("tracked-controls",{idPrefix:f,controller:e.pair,hand:e.hand}),this.updateControllerModel()},addControllersUpdateListener:function(){this.el.sceneEl.addEventListener("controllersupdated",this.onControllersUpdate,!1)},removeControllersUpdateListener:function(){this.el.sceneEl.removeEventListener("controllersupdated",this.onControllersUpdate,!1)},onControllersUpdate:function(){this.checkIfControllerPresent()},onModelError:function(e){var t=this.createControllerModelUrl(!0);e.detail.src!==t?(d("Failed to load controller model for device, attempting to load default."),this.loadModel(t)):d("Failed to load default controller model.")},loadModel:function(e){this.el.setAttribute("gltf-model","url("+e+")")},onModelLoaded:function(e){var t,n,i,r,s=this.controllerModel=e.detail.model,o=this.loadedMeshInfo;if(e.target===this.el){if(h("Processing model"),o.buttonMeshes={},o.axisMeshes={},s){for(t=0;t<this.mapping.buttons.length;t++)(n=this.mapping.buttonMeshNames[this.mapping.buttons[t]])?(i=s.getObjectByName(n))?(r={index:t,value:a(i,"VALUE"),pressed:a(i,"PRESSED"),unpressed:a(i,"UNPRESSED")}).value&&r.pressed&&r.unpressed?o.buttonMeshes[this.mapping.buttons[t]]=r:d("Missing button submesh under mesh with name: "+n+"(VALUE: "+!!r.value+", PRESSED: "+!!r.pressed+", UNPRESSED:"+!!r.unpressed+")"):d("Missing button mesh with name: "+n):h("Skipping unknown button at index: "+t+" with mapped name: "+this.mapping.buttons[t]);for(t=0;t<this.mapping.axisMeshNames.length;t++)(n=this.mapping.axisMeshNames[t])?(i=s.getObjectByName(n))?(r={index:t,value:a(i,"VALUE"),min:a(i,"MIN"),max:a(i,"MAX")}).value&&r.min&&r.max?o.axisMeshes[t]=r:d("Missing axis submesh under mesh with name: "+n+"(VALUE: "+!!r.value+", MIN: "+!!r.min+", MAX:"+!!r.max+")"):d("Missing axis mesh with name: "+n):h("Skipping unknown axis at index: "+t);this.calculateRayOriginFromMesh(s),this.setModelVisibility()}h("Model load complete.")}function a(e,t){for(var n=0,i=e.children.length;n<i;n++){var r=e.children[n];if(r&&r.name===t)return r}}},calculateRayOriginFromMesh:(i=new THREE.Quaternion,function(e){var t;if(this.rayOrigin.origin.set(0,0,0),this.rayOrigin.direction.set(0,0,-1),this.rayOrigin.createdFromMesh=!0,t=e.getObjectByName(this.mapping.pointingPoseMeshName)){var n=e.parent;n&&(e.parent=null,e.updateMatrixWorld(!0),e.parent=n),t.getWorldPosition(this.rayOrigin.origin),t.getWorldQuaternion(i),this.rayOrigin.direction.applyQuaternion(i),n&&e.updateMatrixWorld(!0)}else h("Mesh does not contain pointing origin data, defaulting to none.");this.modelReady()}),lerpAxisTransform:function(){var e=new THREE.Quaternion;return function(t,n){var i=this.loadedMeshInfo.axisMeshes[t];if(i){var r=i.min,s=i.max,o=i.value,a=.5*n+.5;o.setRotationFromQuaternion(e.copy(r.quaternion).slerp(s.quaternion,a)),o.position.lerpVectors(r.position,s.position,a)}}}(),lerpButtonTransform:function(){var e=new THREE.Quaternion;return function(t,n){var i=this.loadedMeshInfo.buttonMeshes[t];if(i){var r=i.unpressed,s=i.pressed,o=i.value;o.setRotationFromQuaternion(e.copy(r.quaternion).slerp(s.quaternion,n)),o.position.lerpVectors(r.position,s.position,n)}}}(),modelReady:function(){this.el.emit("controllermodelready",{name:"windows-motion-controls",model:this.data.model,rayOrigin:this.rayOrigin})},onButtonChanged:function(e){var t=this.mapping.buttons[e.detail.id];t&&(this.loadedMeshInfo&&this.loadedMeshInfo.buttonMeshes&&this.lerpButtonTransform(t,e.detail.state.value),this.el.emit(t+"changed",e.detail.state))},onAxisMoved:function(e){var t=this.mapping.axisMeshNames.length;if(this.loadedMeshInfo&&this.loadedMeshInfo.axisMeshes)for(var n=0;n<t;n++)this.lerpAxisTransform(n,e.detail.axis[n]||0);a(this,this.mapping.axes,e)},setModelVisibility:function(e){var t=this.el.getObject3D("mesh");this.controllerPresent&&(e=void 0!==e?e:this.modelVisible,this.modelVisible=e,t&&(t.visible=e))}})},1343:(e,t,n)=>{e.exports={AFRAME_CDN_ROOT:window.AFRAME_CDN_ROOT||"https://cdn.aframe.io/",AFRAME_INJECTED:"aframe-injected",DEFAULT_CAMERA_HEIGHT:1.6,DEFAULT_HANDEDNESS:"right",keyboardevent:n(5440)}},5440:e=>{e.exports={KEYCODE_TO_CODE:{38:"ArrowUp",37:"ArrowLeft",40:"ArrowDown",39:"ArrowRight",87:"KeyW",65:"KeyA",83:"KeyS",68:"KeyD"}}},842:(e,t,n)=>{var i=n(2203).a,r=n(8940),s=n(9437),o=new s.FileLoader,a=r("core:a-assets:warn");function l(e){if(e.hasAttribute("autoplay")||"auto"===e.getAttribute("preload"))return new Promise((function(t,n){if(4===e.readyState)return t();if(e.error)return n();function i(){for(var n=0,i=0;i<e.buffered.length;i++)n+=e.buffered.end(i)-e.buffered.start(i);n>=e.duration&&("VIDEO"===e.tagName&&s.Cache.add(e.getAttribute("src"),e),t())}e.addEventListener("loadeddata",i,!1),e.addEventListener("progress",i,!1),e.addEventListener("error",n,!1)}))}function c(e){var t=function(e){var t,n,i;if(e.hasAttribute("crossorigin"))return e;if(null!==(t=e.getAttribute("src"))){if(-1===t.indexOf("://"))return e;if((i=(n=t).indexOf("://")>-1?n.split("/")[2]:n.split("/")[0]).substring(0,i.indexOf(":"))===window.location.host)return e}return a('Cross-origin element (e.g., <img>) was requested without `crossorigin` set. A-Frame will re-request the asset with `crossorigin` attribute set. Please set `crossorigin` on the element (e.g., <img crossorigin="anonymous">)',t),e.crossOrigin="anonymous",e.cloneNode(!0)}(e);return t.tagName&&"video"===t.tagName.toLowerCase()&&(t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline","")),t!==e&&(e.parentNode.appendChild(t),e.parentNode.removeChild(e)),t}function h(e){var t=d(e),n=t.lastIndexOf(".");return n>=0&&".glb"===t.slice(n,e.search(/\?|#|$/))?"arraybuffer":"text"}function d(e){var t=document.createElement("a");t.href=e;var n=t.search.replace(/^\?/,""),i=e.replace(n,"").replace("?","");return i.substring(i.lastIndexOf("/")+1)}customElements.define("a-assets",class extends i{constructor(){super(),this.isAssets=!0,this.fileLoader=o,this.timeout=null}doConnectedCallback(){var e,t,n,i,r,o,h=this,d=[];if(super.doConnectedCallback(),!this.parentNode.isScene)throw new Error("<a-assets> must be a child of a <a-scene>.");for(r=this.querySelectorAll("img"),e=0;e<r.length;e++)i=c(r[e]),d.push(new Promise((function(t,n){s.Cache.add(r[e].getAttribute("src"),i),i.complete?t():(i.onload=t,i.onerror=n)})));for(n=this.querySelectorAll("audio, video"),e=0;e<n.length;e++)(t=c(n[e])).src||t.srcObject||a("Audio/video asset has neither `src` nor `srcObject` attributes."),d.push(l(t));this.getChildren().forEach((function(e){e.isAssetItem&&e.hasAttribute("src")&&d.push(new Promise((function(t,n){if(e.hasLoaded)return t();e.addEventListener("loaded",t),e.addEventListener("error",n)})))})),Promise.allSettled(d).then((function(){null!==h.timeout&&h.load()})),o=parseInt(this.getAttribute("timeout"),10)||3e3,this.timeout=setTimeout((function(){h.hasLoaded||(a("Asset loading timed out in",o,"ms"),h.timeout=null,h.emit("timeout"),h.load())}),o)}disconnectedCallback(){super.disconnectedCallback(),this.timeout&&clearTimeout(this.timeout)}load(){super.load.call(this,null,(function(){return!1}))}}),customElements.define("a-asset-item",class extends i{constructor(){super(),this.data=null,this.isAssetItem=!0}connectedCallback(){var e=this,t=this.getAttribute("src");o.setResponseType(this.getAttribute("response-type")||h(t)),o.load(t,(function(t){e.data=t,i.prototype.load.call(e)}),(function(t){e.emit("progress",{loadedBytes:t.loaded,totalBytes:t.total,xhr:t})}),(function(t){e.emit("error",{xhr:t},!1)}))}}),e.exports.inferResponseType=h,e.exports.getFileNameFromURL=d},6178:(e,t,n)=>{var i=n(8940)("core:cubemap:warn");class r extends HTMLElement{constructor(e){return super(e)}onReadyStateChange(){"complete"===document.readyState&&this.doConnectedCallback()}connectedCallback(){"complete"===document.readyState?r.prototype.doConnectedCallback.call(this):document.addEventListener("readystatechange",this.onReadyStateChange.bind(this))}doConnectedCallback(){this.srcs=this.validate()}validate(){var e,t=this.querySelectorAll("[src]"),n=[];if(6===t.length){for(e=0;e<t.length;e++)"IMG"===t[e].tagName?n.push(t[e]):n.push(t[e].getAttribute("src"));return n}i("<a-cubemap> did not contain exactly six elements each with a `src` attribute.")}}customElements.define("a-cubemap",r)},4056:(e,t,n)=>{var i=n(2203).a,r=n(8190).components,s=n(9437),o=n(7427),a=o.debug("core:a-entity:debug"),l=o.debug("core:a-entity:warn"),c="__",h=["position","rotation","scale","visible"],d={once:!0};class u extends i{constructor(){super(),this.components={},this.initializingComponents={},this.componentsToUpdate={},this.isEntity=!0,this.isPlaying=!1,this.object3D=new s.Group,this.object3D.rotation.order="YXZ",this.object3D.el=this,this.object3DMap={},this.parentEl=null,this.rotationObj={},this.states=[]}attributeChangedCallback(e,t,n){var i=this.components[e];super.attributeChangedCallback(),i&&i.justInitialized&&""===n?delete i.justInitialized:(i||null!==n)&&this.setEntityAttribute(e,t,n)}doConnectedCallback(){var e,t,n=this;super.doConnectedCallback(),t=this.sceneEl,this.addToParent(),this.isScene||(t?!(e=t.querySelector("a-assets"))||e.hasLoaded?this.load():e.addEventListener("loaded",(function(){n.load()})):this.load())}disconnectedCallback(){var e;if(this.parentEl){for(e in this.components)this.removeComponent(e,!1);this.isScene||(this.removeFromParent(),super.disconnectedCallback(),this.object3D.el=null)}}getObject3D(e){return this.object3DMap[e]}setObject3D(e,t){var n,i=this;if(!(t instanceof s.Object3D))throw new Error("`Entity.setObject3D` was called with an object that was not an instance of THREE.Object3D.");(n=this.getObject3D(e))&&this.object3D.remove(n),t.el=this,t.children.length&&t.traverse((function(e){e.el=i})),this.object3D.add(t),this.object3DMap[e]=t,this.emit("object3dset",{object:t,type:e})}removeObject3D(e){var t=this.getObject3D(e);t?(this.object3D.remove(t),delete this.object3DMap[e],this.emit("object3dremove",{type:e})):l("Tried to remove `Object3D` of type:",e,"which was not defined.")}getOrCreateObject3D(e,t){var n=this.getObject3D(e);return!n&&t&&(n=new t,this.setObject3D(e,n)),l("`getOrCreateObject3D` has been deprecated. Use `setObject3D()` and `object3dset` event instead."),n}add(e){if(!e.object3D)throw new Error("Trying to add an element that doesn't have an `object3D`");this.object3D.add(e.object3D),this.emit("child-attached",{el:e})}addToParent(){var e=this.parentEl=this.parentNode;e&&e.add&&!this.attachedToParent&&(e.add(this),this.attachedToParent=!0)}removeFromParent(){var e=this.parentEl;this.parentEl.remove(this),this.attachedToParent=!1,this.parentEl=null,e.emit("child-detached",{el:this})}load(){var e=this;!this.hasLoaded&&this.parentEl&&super.load.call(this,(function(){e.parentEl&&(e.updateComponents(),(e.isScene||e.parentEl.isPlaying)&&e.play())}))}remove(e){e?this.object3D.remove(e.object3D):this.parentNode.removeChild(this)}getChildEntities(){for(var e=this.children,t=[],n=0;n<e.length;n++){var i=e[n];i instanceof u&&t.push(i)}return t}initComponent(e,t,n){var i,s,l,h;h=(l=o.split(e,c))[0],s=l.length>2?l.slice(1).join("__"):l[1],r[h]&&(p(this,e)||void 0!==t||n)&&(e in this.components||(this.initComponentDependencies(h),i=new r[h].Component(this,t,s),this.isPlaying&&i.play(),this.hasAttribute(e)||(i.justInitialized=!0,window.HTMLElement.prototype.setAttribute.call(this,e,"")),a("Component initialized: %s",e)))}initComponentDependencies(e){var t,n;if(r[e]&&(t=r[e].dependencies))for(n=0;n<t.length;n++)this.initComponent(t[n],window.HTMLElement.prototype.getAttribute.call(this,t[n])||void 0,!0)}removeComponent(e,t){var n;(n=this.components[e])&&(n.initialized?(n.pause(),n.remove(),t&&(n.destroy(),delete this.components[e],this.hasAttribute(e)&&window.HTMLElement.prototype.removeAttribute.call(this,e)),this.emit("componentremoved",n.evtDetail,!1)):this.addEventListener("componentinitialized",(function n(i){i.detail.name===e&&(this.removeComponent(e,t),this.removeEventListener("componentinitialized",n))})))}updateComponents(){var e,t,n,i,r,s,a=this.componentsToUpdate;if(this.hasLoaded||this.isLoading){for(n=0;n<this.mixinEls.length;n++)for(i in this.mixinEls[n].componentCache)A(i)&&(a[i]=!0);if(this.getExtraComponents)for(i in t=this.getExtraComponents())A(i)&&(a[i]=!0);for(n=0;n<this.attributes.length;++n)i=this.attributes[n].name,-1===h.indexOf(i)&&A(i)&&(a[i]=!0);for(n=0;n<h.length;n++)i=h[n],this.hasAttribute(i)&&this.updateComponent(i,this.getDOMAttribute(i));for(i in a)r=this.getDOMAttribute(i),e=(s=t&&t[i])?s.constructor===Object?o.extend(s,o.styleParser.parse(r||{})):r||s:r,this.updateComponent(i,e),delete a[i]}}updateComponent(e,t,n){var i=this.components[e];if(i)return null!==t||p(this,e)?void i.updateProperties(t,n):void this.removeComponent(e,!0);this.initComponent(e,t,!1)}removeAttribute(e,t){var n=this.components[e];n&&void 0===t&&this.removeComponent(e,!0),n&&void 0!==t?n.resetProperty(t):("mixin"===e&&this.mixinUpdate(""),window.HTMLElement.prototype.removeAttribute.call(this,e))}play(){var e,t,n;if(!this.isPlaying&&(this.hasLoaded||this.isLoading)){for(n in this.isPlaying=!0,this.components)this.components[n].play();for(e=this.getChildEntities(),t=0;t<e.length;t++)e[t].play();this.emit("play")}}pause(){var e,t,n;if(this.isPlaying){for(n in this.isPlaying=!1,this.components)this.components[n].pause();for(e=this.getChildEntities(),t=0;t<e.length;t++)e[t].pause();this.emit("pause")}}setEntityAttribute(e,t,n){if(r[e]||this.components[e])this.updateComponent(e,n);else if("mixin"===e){if(n===this.computedMixinStr)return;this.mixinUpdate(n,t)}}mixinUpdate(e,t,n){var i,r,s,o,a=u.componentsUpdated,l=this;if(n||(t=t||this.getAttribute("mixin")),this.hasLoaded){for(s=this.updateMixins(e,t),a.length=0,o=0;o<this.mixinEls.length;o++)for(i in this.mixinEls[o].componentCache)-1===a.indexOf(i)&&(this.components[i]?this.components[i].handleMixinUpdate():this.initComponent(i,null),a.push(i));for(o=0;o<s.oldMixinIds.length;o++)if(r=document.getElementById(s.oldMixinIds[o]))for(i in r.componentCache)-1===a.indexOf(i)&&this.components[i]&&(this.getDOMAttribute(i)?this.components[i].handleMixinUpdate():this.removeComponent(i,!0))}else this.addEventListener("loaded-private",(function(){l.mixinUpdate(e,t,!0)}),d)}setAttribute(e,t,n){var i,s,a,l,h,d=u.singlePropUpdate;if(a=(l=e.indexOf(c))>0?e.substring(0,l):e,!r[a])return"mixin"===e&&this.mixinUpdate(t),void super.setAttribute.call(this,e,t);if(!this.components[e]&&this.hasAttribute(e)&&this.updateComponent(e,window.HTMLElement.prototype.getAttribute.call(this,e)),void 0!==n&&"string"==typeof t&&t.length>0&&"string"==typeof o.styleParser.parse(t)){for(h in d)delete d[h];(i=d)[t]=n,s=!1}else i=t,s=!0===n;this.updateComponent(e,i,s),this.sceneEl&&this.sceneEl.getAttribute("debug")&&this.components[e].flushToDOM()}flushToDOM(e){var t,n,i,r=this.components,s=this.children;for(i in r)r[i].flushToDOM();if(e)for(n=0;n<s.length;++n)(t=s[n]).flushToDOM&&t.flushToDOM(e)}getAttribute(e){var t,n,i,r;return"position"===e?this.object3D.position:"rotation"===e?(n=s.MathUtils.radToDeg,i=this.object3D.rotation,(r=this.rotationObj).x=n(i.x),r.y=n(i.y),r.z=n(i.z),r):"scale"===e?this.object3D.scale:"visible"===e?this.object3D.visible:(t=this.components[e])?t.data:window.HTMLElement.prototype.getAttribute.call(this,e)}getDOMAttribute(e){var t=this.components[e];return t?t.attrValue:window.HTMLElement.prototype.getAttribute.call(this,e)}addState(e){this.is(e)||(this.states.push(e),this.emit("stateadded",e))}removeState(e){var t=this.states.indexOf(e);-1!==t&&(this.states.splice(t,1),this.emit("stateremoved",e))}is(e){return-1!==this.states.indexOf(e)}inspect(){this.sceneEl.components.inspector.openInspector(this)}destroy(){var e;if(this.parentNode)l("Entity can only be destroyed if detached from scenegraph.");else for(e in this.components)this.components[e].destroy()}}function p(e,t){return!(!e.components[t]||!e.components[t].attrValue)||function(e,t){var n,i=!1;for(n=0;n<t.length&&!(i=t[n].hasAttribute(e));++n);return i}(t,e.mixinEls)}function A(e){return-1!==e.indexOf(c)&&(e=o.split(e,c)[0]),!!r[e]}u.componentsUpdated=[],u.singlePropUpdate={},customElements.define("a-entity",u),e.exports.P=u},5890:(e,t,n)=>{var i=n(2203).a,r=n(8190).components,s=n(7427),o=s.styleParser;customElements.define("a-mixin",class extends i{constructor(){super(),this.componentCache={},this.rawAttributeCache={},this.isMixin=!0}doConnectedCallback(){super.doConnectedCallback(),this.sceneEl=this.closestScene(),this.id=this.getAttribute("id"),this.cacheAttributes(),this.updateEntities(),this.load()}attributeChangedCallback(e,t,n){super.attributeChangedCallback(),this.cacheAttribute(e,n),this.updateEntities()}setAttribute(e,t){window.HTMLElement.prototype.setAttribute.call(this,e,t),this.cacheAttribute(e,t)}cacheAttribute(e,t){var n,i;i=s.split(e,"__")[0],n=r[i],void 0===t&&(t=window.HTMLElement.prototype.getAttribute.call(this,e)),this.rawAttributeCache[e]=t,n&&(this.componentCache[e]=this.parseComponentAttrValue(n,t))}parseComponentAttrValue(e,t){var n;return"string"!=typeof t?t:(e.isSingleProperty?"string"==typeof(n=e.schema.parse(t))&&(n=t):n=o.parse(t),n)}getAttribute(e){return this.componentCache[e]||window.HTMLElement.prototype.getAttribute.call(this,e)}cacheAttributes(){var e,t,n=this.attributes;for(t=0;t<n.length;t++)e=n[t].name,this.cacheAttribute(e)}updateEntities(){var e,t,n;if(this.sceneEl)for(t=this.sceneEl.querySelectorAll("[mixin~="+this.id+"]"),n=0;n<t.length;n++)(e=t[n]).hasLoaded&&!e.isMixin&&e.mixinUpdate(this.id)}})},2203:(e,t,n)=>{var i=n(7427),r=n(2849),s=i.debug("core:a-node:warn"),o={"a-scene":!0,"a-assets":!0,"a-assets-items":!0,"a-cubemap":!0,"a-mixin":!0,"a-node":!0,"a-entity":!0};function a(e){return e.tagName.toLowerCase()in o||e.isNode}class l extends HTMLElement{constructor(){super(),this.computedMixinStr="",this.hasLoaded=!1,this.isNode=!0,this.mixinEls=[]}connectedCallback(){r.canInitializeElements?this.doConnectedCallback():document.addEventListener("aframeready",this.connectedCallback.bind(this))}doConnectedCallback(){var e;this.sceneEl=this.closestScene(),this.sceneEl||s("You are attempting to attach <"+this.tagName+"> outside of an A-Frame scene. Append this element to `<a-scene>` instead."),this.hasLoaded=!1,this.emit("nodeready",void 0,!1),this.isMixin||(e=this.getAttribute("mixin"))&&this.updateMixins(e)}attributeChangedCallback(e,t,n){n!==this.computedMixinStr&&("mixin"!==e||this.isMixin||this.updateMixins(n,t))}closestScene(){for(var e=this;e&&!e.isScene;)e=e.parentElement;return e}closest(e){for(var t=this.matches||this.mozMatchesSelector||this.msMatchesSelector||this.oMatchesSelector||this.webkitMatchesSelector,n=this;n&&!t.call(n,e);)n=n.parentElement;return n}disconnectedCallback(){this.hasLoaded=!1}load(e,t){var n,i=this;this.hasLoaded||(t=t||a,n=this.getChildren().filter(t).map((function(e){return new Promise((function(t,n){if(e.hasLoaded)return t();e.addEventListener("loaded",t),e.addEventListener("error",n)}))})),Promise.allSettled(n).then((function(t){t.forEach((function(e){"rejected"===e.status&&s("Rendering scene with errors on node: ",e.reason.target)})),i.isLoading=!0,i.setupMutationObserver(),e&&e(),i.isLoading=!1,i.hasLoaded=!0,i.emit("loaded-private",void 0,!1),i.emit("loaded",void 0,!1)})))}setupMutationObserver(){var e=this;new MutationObserver((function(t){var n;for(n=0;n<t.length;n++)if("attributes"===t[n].type){var i=t[n].attributeName,r=window.HTMLElement.prototype.getAttribute.call(e,i),s=t[n].oldValue;e.attributeChangedCallback(i,s,r)}})).observe(this,{attributes:!0,attributeOldValue:!0})}getChildren(){return Array.prototype.slice.call(this.children,0)}updateMixins(e,t){var n,r,s,o=l.newMixinIdArray,a=l.oldMixinIdArray,c=l.mixinIds;for(o.length=0,a.length=0,r=e?i.split(e.trim(),/\s+/):o,s=t?i.split(t.trim(),/\s+/):a,c.newMixinIds=r,c.oldMixinIds=s,n=0;n<s.length;n++)-1===r.indexOf(s[n])&&this.unregisterMixin(s[n]);for(this.computedMixinStr="",this.mixinEls.length=0,n=0;n<r.length;n++)this.registerMixin(r[n]);return this.computedMixinStr&&(this.computedMixinStr=this.computedMixinStr.trim(),window.HTMLElement.prototype.setAttribute.call(this,"mixin",this.computedMixinStr)),0===r.length&&window.HTMLElement.prototype.removeAttribute.call(this,"mixin"),c}registerMixin(e){var t,n,r,o=document.getElementById(e);if(o){if(r=o.getAttribute("mixin"))for(t=i.split(r.trim(),/\s+/),n=0;n<t.length;n++)this.registerMixin(t[n]);this.computedMixinStr=this.computedMixinStr+" "+o.id,this.mixinEls.push(o)}else s("No mixin was found with id `%s`",e)}setAttribute(e,t){"mixin"===e&&this.updateMixins(t),window.HTMLElement.prototype.setAttribute.call(this,e,t)}unregisterMixin(e){var t,n=this.mixinEls;for(t=0;t<n.length;++t)if(e===n[t].id){n.splice(t,1);break}}emit(e,t,n,r){var s=l.evtData;void 0===n&&(n=!0),s.bubbles=!!n,s.detail=t,r&&(s=i.extend({},r,s)),this.dispatchEvent(new CustomEvent(e,s))}}l.evtData={},l.newMixinIdArray=[],l.oldMixinIdArray=[],l.mixinIds={},customElements.define("a-node",l),e.exports.a=l,e.exports.$=o},8190:(e,t,n)=>{var i=n(7282),r=n(8313),s=n(1876),o=n(7427),a=e.exports.components={},l=i.parseProperty,c=i.process,h=i.isSingleProperty,d=i.stringifyProperties,u=i.stringifyProperty,p=o.styleParser,A=o.debug("core:component:warn"),f=document.currentScript,m=new RegExp("[A-Z]+"),g={},v=Object.freeze({}),y=[],E={get:function(e,t){return e.getComputedPropertyValue(t)},set:function(e,t,n){return t in e.schema?e.recomputeProperty(t,n):void 0!==n&&e.handleUnknownProperty(t,n),!0}},x=e.exports.Component=function(e,t,n){var i=this;if(this.sceneOnly&&!e.isScene)throw new Error("Component `"+this.name+"` can only be applied to <a-scene>");if(n&&!this.multiple)throw new Error("Trying to initialize multiple components of type `"+this.name+"`. There can only be one component of this type per entity.");this.el=e,this.id=n,this.attrName=this.name+(n?"__"+n:""),this.evtDetail={id:this.id,name:this.name},this.initialized=!1,this.el.components[this.attrName]=this,this.objectPool=g[this.name];var r=this.events;this.events={},function(e,t){var n;for(n in t)e.events[n]=t[n].bind(e)}(this,r),this.attrValue=void 0,this.isObjectBased?(this.data=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.data,this.schema),this.oldData=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.oldData,this.schema),this.attrValueProxy=new Proxy(this,E)):(this.data=void 0,this.oldData=void 0,this.attrValueProxy=void 0),this.deferUnknownPropertyWarnings=!!this.updateSchema,this.throttledEmitComponentChanged=o.throttleLeadingAndTrailing((function(){e.emit("componentchanged",i.evtDetail,!1)}),200),this.updateProperties(t,!0)};if(x.prototype={schema:{},init:function(){},events:{},update:function(e){},updateSchema:void 0,tick:void 0,tock:void 0,play:function(){},pause:function(){},remove:function(){},stringify:function(e){var t=this.schema;return"string"==typeof e?e:this.isSingleProperty?u(e,t):(e=d(e,t),p.stringify(e))},flushToDOM:function(e){var t=e?this.data:this.attrValue;null!=t&&window.HTMLElement.prototype.setAttribute.call(this.el,this.attrName,this.stringify(t))},updateProperties:function(e,t){var n=this.el;this.updateData(e,t),(n.hasLoaded||n.isLoading)&&(this.initialized?this.callUpdateHandler():this.initComponent())},initComponent:function(){var e,t=this.el;t.initializingComponents[this.name]||(t.initializingComponents[this.name]=!0,this.init(),this.initialized=!0,delete t.initializingComponents[this.name],e=this.isObjectBased?v:void 0,this.dataChanged=!1,this.storeOldData(),this.update(e),t.isPlaying&&this.play(),t.emit("componentinitialized",this.evtDetail,!1))},updateData:function(e,t){this.isSingleProperty?this.recomputeProperty(void 0,e):(t?(o.objectPool.clearObject(this.attrValue),this.recomputeData(e),this.schemaChangeRequired=!!this.updateSchema):"string"==typeof e?p.parse(e,this.attrValueProxy):o.extend(this.attrValueProxy,e),this.updateSchemaIfNeeded(e))},updateSchemaIfNeeded:function(e){if(this.schemaChangeRequired&&this.updateSchema)for(var t in y.length=0,this.updateSchema(this.data),o.objectPool.removeUnusedKeys(this.data,this.schema),this.recomputeData(e),this.schemaChangeRequired=!1,this.attrValue)void 0!==this.attrValue[t]&&-1===y.indexOf(t)&&(t in this.schema||A("Unknown property `"+t+"` for component `"+this.name+"`."));for(var n=0;n<y.length;n++)A("Unknown property `"+y[n]+"` for component `"+this.name+"`.");y.length=0},callUpdateHandler:function(){if(this.isPositionRotationScale||this.dataChanged){this.dataChanged=!1;var e=this.oldData;this.oldDataInUse=!0,this.update(e),e!==this.oldData&&this.objectPool.recycle(e),this.oldDataInUse=!1,this.storeOldData(),this.throttledEmitComponentChanged()}},handleMixinUpdate:function(){this.recomputeData(),this.updateSchemaIfNeeded(),this.callUpdateHandler()},resetProperty:function(e){(this.isSingleProperty||e in this.schema)&&(e?this.attrValue[e]=void 0:(this.isObjectBased&&this.objectPool.recycle(this.attrValue),this.attrValue=void 0),this.recomputeProperty(e,void 0),this.updateSchemaIfNeeded(),this.callUpdateHandler())},extendSchema:function(e){var t;t=o.extend({},a[this.name].schema),o.extend(t,e),this.schema=c(t),this.el.emit("schemachanged",this.evtDetail)},getComputedPropertyValue:function(e){var t=this.el.mixinEls,n=this.attrValue&&e?this.attrValue[e]:this.attrValue;if(void 0!==n)return n;for(var i=t.length-1;i>=0;i--){var r=t[i].getAttribute(this.attrName);if(null!==r&&(!e||e in r))return e?r[e]:r}return e?this.schema[e].default:this.schema.default},recomputeProperty:function(e,t){var n=e?this.schema[e]:this.schema;if(null!=t){void 0===this.attrValue&&this.isObjectBased&&(this.attrValue=this.objectPool.use());var i=e?this.attrValue[e]:this.attrValue;"string"==typeof(i=n.isCacheable?l(t,n,i):t)&&(i=""===t?void 0:t),e?this.attrValue[e]=i:this.attrValue=i}this.oldDataInUse&&(this.oldData=this.objectPool.use(),o.objectPool.removeUnusedKeys(this.oldData,this.schema),this.storeOldData(),this.oldDataInUse=!1);var r=e?this.oldData[e]:this.oldData,s=e?this.data[e]:this.data,a=l(this.getComputedPropertyValue(e),n,s);return"array"!==n.type||e||(a=o.clone(a)),n.equals(a,r)||(this.dataChanged=!0,n.schemaChange&&(this.schemaChangeRequired=!0)),e?this.data[e]=a:this.data=a,a},handleUnknownProperty:function(e,t){void 0===this.attrValue&&(this.attrValue=this.objectPool.use()),this.attrValue[e]=t,this.deferUnknownPropertyWarnings?y.push(e):this.silenceUnknownPropertyWarnings||A("Unknown property `"+e+"` for component `"+this.name+"`.")},storeOldData:function(){var e;if(this.isObjectBased)if(this.isSingleProperty)this.oldData=l(this.data,this.schema,this.oldData);else for(e in this.schema)void 0!==this.data[e]&&(this.data[e]&&"object"==typeof this.data[e]?this.oldData[e]=l(this.data[e],this.schema[e],this.oldData[e]):this.oldData[e]=this.data[e]);else this.oldData=this.data},recomputeData:function(e){var t;if(this.isSingleProperty)this.recomputeProperty(void 0,e);else{for(t in this.schema)this.attrValueProxy[t]=void 0;e&&"object"==typeof e?o.extend(this.attrValueProxy,e):"string"==typeof e&&p.parse(e,this.attrValueProxy)}},eventsAttach:function(){var e;for(e in this.eventsDetach(),this.events)this.el.addEventListener(e,this.events[e])},eventsDetach:function(){var e;for(e in this.events)this.el.removeEventListener(e,this.events[e])},destroy:function(){this.objectPool.recycle(this.attrValue),this.objectPool.recycle(this.data),this.objectPool.recycle(this.oldData),this.attrValue=this.data=this.oldData=this.attrValueProxy=void 0}},window.debug)var b=e.exports.registrationOrderWarnings={};function C(e){return e.tick||e.tock}function w(e){return e&&e.constructor===Object&&!(e instanceof window.HTMLElement)}e.exports.registerComponent=function(e,t){var n,i,d,u,p,v={};if(document.currentScript&&document.currentScript!==f&&r.forEach((function(t){t.hasLoaded||document.currentScript.compareDocumentPosition(t)!==Node.DOCUMENT_POSITION_FOLLOWING&&(A("The component `"+e+"` was registered in a <script> tag after the scene. Component <script> tags in an HTML file should be declared *before* the scene such that the component is available to entities during scene initialization."),window.debug&&(b[e]=!0))})),!0===m.test(e)&&A("The component name `"+e+"` contains uppercase characters, but HTML will ignore the capitalization of attribute names. Change the name to be lowercase: `"+e.toLowerCase()+"`"),-1!==e.indexOf("__"))throw new Error("The component name `"+e+"` is not allowed. The sequence __ (double underscore) is reserved to specify an id for multiple components of the same type");if(Object.keys(t).forEach((function(e){v[e]={value:t[e],writable:!0}})),a[e])throw new Error("The component `"+e+"` has been already registered. Check that you are not loading two versions of the same component or two different components of the same name.");((n=function(e,t,n){x.call(this,e,t,n)}).prototype=Object.create(x.prototype,v)).name=e,n.prototype.isPositionRotationScale="position"===e||"rotation"===e||"scale"===e,n.prototype.constructor=n,n.prototype.system=s&&s.systems[e],n.prototype.play=(u=n.prototype.play,function(){var e=this.el.sceneEl,t=this.el.isPlaying&&!this.isPlaying;this.initialized&&t&&(u.call(this),this.isPlaying=!0,this.eventsAttach(),C(this)&&e.addBehavior(this))}),n.prototype.pause=(p=n.prototype.pause,function(){var e=this.el.sceneEl;this.isPlaying&&(p.call(this),this.isPlaying=!1,this.eventsDetach(),C(this)&&e.removeBehavior(this))}),i=o.extend(c(n.prototype.schema,n.prototype.name)),n.prototype.isSingleProperty=d=h(n.prototype.schema),n.prototype.isObjectBased=!d||d&&(w(i.default)||w(l(void 0,i))),g[e]=o.objectPool.createPool(),a[e]={Component:n,dependencies:n.prototype.dependencies,before:n.prototype.before,after:n.prototype.after,isSingleProperty:n.prototype.isSingleProperty,isObjectBased:n.prototype.isObjectBased,multiple:n.prototype.multiple,sceneOnly:n.prototype.sceneOnly,name:e,schema:i,stringify:n.prototype.stringify};for(var y=0;y<r.length;y++)r[y].emit("componentregistered",{name:e},!1);return n}},7045:(e,t,n)=>{var i=n(7282).process,r=e.exports.to={},s=e.exports.Ls=[],o=n(9437),a=function(){};a.prototype={schema:{},init:function(e){return this.geometry=new o.BufferGeometry,this.geometry},update:function(e){}},e.exports.Az=function(e,t){var n,o={};if(Object.keys(t).forEach((function(e){o[e]={value:t[e],writable:!0}})),r[e])throw new Error("The geometry `"+e+"` has been already registered");return((n=function(){a.call(this)}).prototype=Object.create(a.prototype,o)).name=e,n.prototype.constructor=n,r[e]={Geometry:n,schema:i(n.prototype.schema)},s.push(e),n}},1551:(e,t,n)=>{var i=n(676),r=n(8878)("core:propertyTypes:warn"),s=e.exports.propertyTypes={},o=/[,> .[\]:]/,a=/url\((.+)\)/;function l(e,t,n,i,r,o){if(e in s)throw new Error("Property type "+e+" is already registered.");s[e]={default:t,parse:n||u,stringify:i||p,equals:r||A,isCacheable:!1!==o}}function c(e,t){if(!Array.isArray(e)||!Array.isArray(t))return e===t;if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function h(e){var t,n;return"string"!=typeof e?e:(n=e.match(a))?n[1]:"#"===e.charAt(0)?(t=document.getElementById(e.substring(1)))?"CANVAS"===t.tagName||"VIDEO"===t.tagName||"IMG"===t.tagName?t:t.getAttribute("src"):void r('"'+e+'" asset not found.'):e}function d(e){return e.getAttribute?e.getAttribute("id")?"#"+e.getAttribute("id"):e.getAttribute("src"):p(e)}function u(e){return e}function p(e){return null===e?"null":e.toString()}function A(e,t){return e===t}function f(e){return parseInt(e,10)}function m(e,t,n){return i.parse(e,t,n)}function g(e,t){if(null===e)return!0;if("object"!=typeof e)return!1;if(Object.keys(e).length!==t)return!1;var n=e.x,i=e.y,r=e.z,s=e.w;return!("number"!=typeof n||"number"!=typeof i||t>2&&"number"!=typeof r||t>3&&"number"!=typeof s)}l("audio","",h,d),l("array",[],(function(e){return Array.isArray(e)?e:e&&"string"==typeof e?e.split(",").map((function(e){return e.trim()})):[]}),(function(e){return e.join(", ")}),c),l("asset","",h,d),l("boolean",!1,(function(e){return"false"!==e&&!1!==e})),l("color","#FFF"),l("int",0,f),l("number",0,(function(e){return parseFloat(e,10)})),l("map","",h,d),l("model","",h,d),l("selector",null,(function(e){return e?"string"!=typeof e?e:"#"!==e[0]||o.test(e)?document.querySelector(e):document.getElementById(e.substring(1)):null}),(function(e){return e.getAttribute?"#"+e.getAttribute("id"):p(e)}),A,!1),l("selectorAll",null,(function(e){return e?"string"!=typeof e?e:Array.prototype.slice.call(document.querySelectorAll(e),0):null}),(function(e){return e instanceof Array?e.map((function(e){return"#"+e.getAttribute("id")})).join(", "):p(e)}),c,!1),l("src","",(function(e){return r("`src` property type is deprecated. Use `asset` instead."),h(e)}),d),l("string",""),l("time",0,f),l("vec2",{x:0,y:0},m,i.stringify,i.equals),l("vec3",{x:0,y:0,z:0},m,i.stringify,i.equals),l("vec4",{x:0,y:0,z:0,w:1},m,i.stringify,i.equals),e.exports.registerPropertyType=l,e.exports.isValidDefaultValue=function(e,t){return("audio"!==e||"string"==typeof t)&&!("array"===e&&!Array.isArray(t))&&("asset"!==e||"string"==typeof t)&&("boolean"!==e||"boolean"==typeof t)&&("color"!==e||"string"==typeof t)&&("int"!==e||"number"==typeof t)&&("number"!==e||"number"==typeof t)&&("map"!==e||"string"==typeof t)&&("model"!==e||"string"==typeof t)&&("selector"!==e||"string"==typeof t||null===t)&&("selectorAll"!==e||"string"==typeof t||null===t)&&("src"!==e||"string"==typeof t)&&("string"!==e||"string"==typeof t)&&("time"!==e||"number"==typeof t)&&("vec2"===e?g(t,2):"vec3"===e?g(t,3):"vec4"!==e||g(t,4))},e.exports.isValidDefaultCoordinate=g},2849:e=>{function t(){e.exports.canInitializeElements||(e.exports.canInitializeElements=!0,setTimeout((function(){document.dispatchEvent(new CustomEvent("aframeready"))})))}e.exports.canInitializeElements=!1,e.exports.waitForDocumentReadyState=function(){"complete"!==document.readyState?document.addEventListener("readystatechange",(function e(){"complete"===document.readyState&&(document.removeEventListener("readystatechange",e),t())})):t()},e.exports.emitReady=t},5076:(e,t,n)=>{var i=n(8316).W,r=n(6147),s=n(9762),o=n(8313),a=n(1876).systems,l=n(8190).components,c=n(9437),h=n(7427),d=h.debug("core:a-scene:warn"),u=n(4056).P,p=n(2203).a,A=n(8371),f=h.device.isIOS(),m=h.device.isMobile(),g=h.device.isWebXRAvailable;f&&n(1957);class v extends u{constructor(){var e;super(),(e=this).clock=new c.Clock,e.isIOS=f,e.isMobile=m,e.hasWebXR=g,e.isAR=!1,e.isScene=!0,e.object3D=new c.Scene,e.object3D.onAfterRender=function(t,n,i){e.isPlaying&&e.tock(e.time,e.delta,i)},e.resize=e.resize.bind(e),e.render=e.render.bind(e),e.systems={},e.systemNames=[],e.time=e.delta=0,e.usedOfferSession=!1,e.componentOrder=[],e.behaviors={},e.hasLoaded=!1,e.isPlaying=!1,e.originalHTML=e.innerHTML}addFullScreenStyles(){document.documentElement.classList.add("a-fullscreen")}removeFullScreenStyles(){document.documentElement.classList.remove("a-fullscreen")}doConnectedCallback(){var e=this,t=this.hasAttribute("embedded");this.setAttribute("inspector",""),this.setAttribute("keyboard-shortcuts",""),this.setAttribute("screenshot",""),this.setAttribute("xr-mode-ui",""),this.setAttribute("device-orientation-permission-ui",""),super.doConnectedCallback(),function(e){var t;function n(){document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||e.exitVR(),document.activeElement.blur(),document.body.focus()}(t=document.createElement("canvas")).classList.add("a-canvas"),t.dataset.aframeCanvas=!0,e.appendChild(t),document.addEventListener("fullscreenchange",n),document.addEventListener("mozfullscreenchange",n),document.addEventListener("webkitfullscreenchange",n),document.addEventListener("MSFullscreenChange",n),t.addEventListener("touchmove",(function(e){e.preventDefault()}),{passive:!1}),e.canvas=t,e.emit("render-target-loaded",{target:t}),setTimeout(e.resize.bind(e),0)}(this),this.setupRenderer(),s.setup(this,x),this.resize(),t||this.addFullScreenStyles(),A(this),i(this),r(this),this.enterVRBound=function(){e.enterVR()},this.exitVRBound=function(){e.exitVR()},window.addEventListener("sessionend",this.resize),this.addEventListener("cameraready",(function(){e.attachedCallbackPostCamera()})),this.initSystems(),this.componentOrder=y(l,this.componentOrder),this.addEventListener("componentregistered",(function(){e.componentOrder=y(l,e.componentOrder)})),this.hasWebXR&&navigator.xr&&navigator.xr.addEventListener&&navigator.xr.addEventListener("sessiongranted",(function(){e.enterVR()}))}attachedCallbackPostCamera(){var e=this;window.addEventListener("load",void 0),window.addEventListener("resize",(function(){e.isIOS?setTimeout(e.resize,100):e.resize()})),this.play(),o.push(this)}initSystems(){var e;for(e in this.initSystem("camera"),a)"camera"!==e&&this.initSystem(e)}initSystem(e){this.systems[e]||(this.systems[e]=new a[e](this),this.systemNames.push(e))}disconnectedCallback(){var e=o.indexOf(this);super.disconnectedCallback(),o.splice(e,1),window.removeEventListener("sessionend",this.resize),this.removeFullScreenStyles(),this.renderer.dispose()}addBehavior(e){var t,n,i=this.behaviors[e.name];for(n in i||(i=this.behaviors[e.name]={tick:{inUse:!1,array:[],markedForRemoval:[]},tock:{inUse:!1,array:[],markedForRemoval:[]}}),i)if(e[n]){if((t=i[n]).inUse){var r=t.markedForRemoval.indexOf(e);-1!==r&&t.markedForRemoval.splice(r,1)}-1===t.array.indexOf(e)&&t.array.push(e)}}getPointerLockElement(){return document.pointerLockElement}checkHeadsetConnected(){return h.device.checkHeadsetConnected()}enterAR(){var e;if(!this.hasWebXR)throw e="Failed to enter AR mode, WebXR not supported.",new Error(e);if(!h.device.checkARSupport())throw e="Failed to enter AR, WebXR immersive-ar mode not supported in your browser or device.",new Error(e);return this.enterVR(!0)}enterVR(e,t){var n,i=this,r=i.renderer.xr;if(t&&(!navigator.xr||!navigator.xr.offerSession))return Promise.resolve("OfferSession is not supported.");if(i.usedOfferSession&&t)return Promise.resolve("OfferSession was already called.");if(this.is("vr-mode"))return Promise.resolve("Already in VR.");if(this.checkHeadsetConnected()||this.isMobile){var s=i.getAttribute("renderer");if(r.enabled=!0,this.hasWebXR){this.xrSession&&this.xrSession.removeEventListener("end",this.exitVRBound);var o=this.sceneEl.systems.webxr.sessionReferenceSpaceType;r.setReferenceSpaceType(o);var a=e?"immersive-ar":"immersive-vr";return n=this.sceneEl.systems.webxr.sessionConfiguration,new Promise((function(e,o){var c=t?navigator.xr.offerSession.bind(navigator.xr):navigator.xr.requestSession.bind(navigator.xr);i.usedOfferSession|=t,c(a,n).then((function(o){t&&(i.usedOfferSession=!1),r.layersEnabled=-1!==n.requiredFeatures.indexOf("layers"),r.setSession(o).then((function(){r.setFoveation(s.foveationLevel),i.xrSession=o,i.systems.renderer.setWebXRFrameRate(o),o.addEventListener("end",i.exitVRBound),l(e)}))}),(function(e){o(new Error("Failed to enter "+("immersive-ar"===a?"AR":"VR")+" mode (`requestSession`)",{cause:e}))}))}))}throw new Error("Failed to enter "+(e?"AR":"VR")+" no WebXR")}return l(),Promise.resolve();function l(t){var n;e?i.addState("ar-mode"):i.addState("vr-mode"),i.emit("enter-vr",{target:i}),!i.hasWebXR&&i.isMobile&&screen.orientation&&screen.orientation.lock&&screen.orientation.lock("landscape"),i.addFullScreenStyles(),i.isMobile||i.checkHeadsetConnected()||((n=i.canvas).requestFullscreen||n.webkitRequestFullscreen||n.mozRequestFullScreen||n.msRequestFullscreen).apply(n,[{navigationUI:"hide"}]),i.resize(),t&&t()}}exitVR(){var e=this,t=this.renderer.xr;if(!this.is("vr-mode")&&!this.is("ar-mode"))return Promise.resolve("Not in immersive mode.");if(this.checkHeadsetConnected()||this.isMobile){if(t.enabled=!1,!this.hasWebXR)throw Error("Failed to exit VR - no WebXR");this.xrSession.removeEventListener("end",this.exitVRBound),this.xrSession.end().then((function(){}),(function(){})),this.xrSession=void 0}else(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen());return e.removeState("vr-mode"),e.removeState("ar-mode"),e.isMobile&&screen.orientation&&screen.orientation.unlock&&screen.orientation.unlock(),e.hasAttribute("embedded")&&e.removeFullScreenStyles(),e.resize(),e.isIOS&&h.forceCanvasResizeSafariMobile(e.canvas),e.renderer.setPixelRatio(window.devicePixelRatio),e.emit("exit-vr",{target:e}),Promise.resolve()}getAttribute(e){var t=this.systems[e];return t?t.data:u.prototype.getAttribute.call(this,e)}getDOMAttribute(e){var t=this.systems[e];return t?t.data:u.prototype.getDOMAttribute.call(this,e)}setAttribute(e,t,n){if(a[e]){p.prototype.setAttribute.call(this,e,t);var i=this.systems[e];i&&i.updateProperties(t)}else u.prototype.setAttribute.call(this,e,t,n)}removeBehavior(e){var t,n,i,r=this.behaviors[e.name];for(n in r)e[n]&&-1!==(i=(t=r[n]).array.indexOf(e))&&(t.inUse?-1===t.markedForRemoval.indexOf(e)&&t.markedForRemoval.push(e):(t.array[i]=t.array[t.array.length-1],t.array.pop()))}resize(){var e,t,n=this.camera,i=this.canvas,r=this.renderer.xr.isPresenting;e=this.renderer.xr.enabled&&r,!n||!i||this.is("vr-mode")&&(this.isMobile||e)||(t=x(i,this.getAttribute("embedded")&&!this.is("vr-mode"),this.maxCanvasSize,this.is("vr-mode")),n.aspect=t.width/t.height,n.updateProjectionMatrix(),this.renderer.setSize(t.width,t.height,!1),this.emit("rendererresize",null,!1))}setupRenderer(){var e,t,n,i,r=this;i={alpha:!0,antialias:!m,canvas:this.canvas,logarithmicDepthBuffer:!1,powerPreference:"high-performance"},this.maxCanvasSize={height:-1,width:-1},this.hasAttribute("renderer")&&(n=this.getAttribute("renderer"),(t=h.styleParser.parse(n)).precision&&(i.precision=t.precision+"p"),t.antialias&&"auto"!==t.antialias&&(i.antialias="true"===t.antialias),t.logarithmicDepthBuffer&&"auto"!==t.logarithmicDepthBuffer&&(i.logarithmicDepthBuffer="true"===t.logarithmicDepthBuffer),t.alpha&&(i.alpha="true"===t.alpha),t.stencil&&(i.stencil="true"===t.stencil),t.multiviewStereo&&(i.multiviewStereo="true"===t.multiviewStereo),this.maxCanvasSize={width:t.maxCanvasWidth?parseInt(t.maxCanvasWidth):this.maxCanvasSize.width,height:t.maxCanvasHeight?parseInt(t.maxCanvasHeight):this.maxCanvasSize.height}),(e=this.renderer=new c.WebGLRenderer(i)).setPixelRatio(window.devicePixelRatio),this.camera&&e.xr.setPoseTarget(this.camera.el.object3D),this.addEventListener("camera-set-active",(function(){e.xr.setPoseTarget(r.camera.el.object3D)}))}play(){var e=this,t=this;this.renderStarted?u.prototype.play.call(this):(this.addEventListener("loaded",(function(){var e=this.renderer;u.prototype.play.call(this),t.renderStarted||(t.resize(),t.renderer&&(window.performance&&window.performance.mark("render-started"),s.remove(),e.setAnimationLoop(this.render),t.renderStarted=!0,t.emit("renderstart")))})),setTimeout((function(){u.prototype.load.call(e)})))}updateComponent(e){e in a||u.prototype.updateComponent.apply(this,arguments)}tick(e,t){var n,i=this.systems;for(this.callComponentBehaviors("tick",e,t),n=0;n<this.systemNames.length;n++)i[this.systemNames[n]].tick&&i[this.systemNames[n]].tick(e,t)}tock(e,t,n){var i,r=this.systems;for(this.callComponentBehaviors("tock",e,t),i=0;i<this.systemNames.length;i++)r[this.systemNames[i]].tock&&r[this.systemNames[i]].tock(e,t,n)}render(e,t){var n=this.renderer;this.frame=t,this.delta=1e3*this.clock.getDelta(),this.time=1e3*this.clock.elapsedTime,this.isPlaying&&this.tick(this.time,this.delta);var i=null;this.is("ar-mode")&&(i=this.object3D.background,this.object3D.background=null),n.render(this.object3D,this.camera),i&&(this.object3D.background=i)}callComponentBehaviors(e,t,n){for(var i,r=0;r<this.componentOrder.length;r++){var s=this.behaviors[this.componentOrder[r]];if(s){var o=s[e];for(o.inUse=!0,i=0;i<o.array.length;i++)o.array[i].isPlaying&&o.array[i][e](t,n);for(o.inUse=!1,i=0;i<o.markedForRemoval.length;i++)this.removeBehavior(o.markedForRemoval[i]);o.markedForRemoval.length=0}}}}function y(e,t){var n,i,r={},s=t||[];for(i in s.length=0,e){var o=e[i];if(void 0!==o){var a=o.before?o.before.slice(0):[],l=o.after?o.after.slice(0):[];r[i]={before:a,after:l,visited:!1,done:!1}}}for(i in r)for(n=0;n<r[i].before.length;n++){var c=r[i].before[n];c in r?r[c].after.push(i):d("Invalid ordering constraint, no component named `"+c+"` referenced by `"+i+"`")}function h(e){if(e in r&&!r[e].done)if(r[e].visited)d("Cycle detected, ignoring one or more before/after constraints. The resulting order might be incorrect");else{r[e].visited=!0;for(var t=0;t<r[e].after.length;t++){var n=r[e].after[t];n in r||d("Invalid before/after constraint, no component named `"+n+"` referenced in `"+e+"`"),h(n)}r[e].done=!0,s.push(e)}}for(i in r)r[i].done||h(i);return s}function E(e,t){var n,i=window.devicePixelRatio;return!t||-1===t.width&&-1===t.height||e.width*i<t.width&&e.height*i<t.height||(n=e.width/e.height,e.width*i>t.width&&-1!==t.width&&(e.width=Math.round(t.width/i),e.height=Math.round(t.width/n/i)),e.height*i>t.height&&-1!==t.height&&(e.height=Math.round(t.height/i),e.width=Math.round(t.height*n/i))),e}function x(e,t,n,i){return e.parentElement?t?E({height:e.parentElement.offsetHeight,width:e.parentElement.offsetWidth},n):function(e,t){var n;return n={height:document.body.offsetHeight,width:document.body.offsetWidth},t?n:E(n,e)}(n,i):{height:0,width:0}}customElements.define("a-scene",v),e.exports.aQ=v},9762:(e,t,n)=>{var i,r,s,o=n(1343).AFRAME_INJECTED,a=n(7427).styleParser,l="loading-screen";function c(e){var t=i.hasAttribute("embedded"),n=s(i.canvas,t,i.maxCanvasSize,i.is("vr-mode"));e.aspect=n.width/n.height,e.updateProjectionMatrix(),i.renderer.setSize(n.width,n.height,!1)}e.exports.setup=function(e,t){s=t;var n,h,d,u,p,A,f,m,g,v,y=(i=e).hasAttribute(l)?a.parse(i.getAttribute(l)):void 0,E=y&&y.dotsColor||"white",x=y&&y.backgroundColor||"#24CAFF";(void 0===y||"true"===y.enabled||void 0===y.enabled)&&(n=new THREE.Scene,h=new THREE.SphereGeometry(.2,36,18,0,2*Math.PI,0,Math.PI),d=new THREE.MeshBasicMaterial({color:E}),u=new THREE.Mesh(h,d),p=u.clone(),A=u.clone(),f=new THREE.PerspectiveCamera(80,window.innerWidth/window.innerHeight,5e-4,1e4),m=new THREE.Clock,g=0,v=function(){i.renderer.render(n,f),g=m.getElapsedTime()%4,u.visible=g>=1,p.visible=g>=2,A.visible=g>=3},n.background=new THREE.Color(x),n.add(f),u.position.set(-1,0,-15),p.position.set(0,0,-15),A.position.set(1,0,-15),f.add(u),f.add(p),f.add(A),(r=document.createElement("div")).className="a-loader-title",r.innerHTML=document.title,r.style.display="none",r.setAttribute(o,""),i.appendChild(r),setTimeout((function(){i.hasLoaded||(c(f),r.style.display="block",window.addEventListener("resize",(function(){c(f)})),i.renderer.setAnimationLoop(v))}),200))},e.exports.remove=function(){window.removeEventListener("resize",c),r&&(r.style.display="none")}},8316:(e,t,n)=>{var i,r=n(1343),s=n(7427).extend,o=[l({name:"viewport",content:"width=device-width,initial-scale=1,maximum-scale=1,shrink-to-fit=no,user-scalable=no,minimal-ui,viewport-fit=cover"}),l({name:"mobile-web-app-capable",content:"yes"}),l({name:"theme-color",content:"black"})],a=[l({name:"apple-mobile-web-app-capable",content:"yes"}),l({name:"apple-mobile-web-app-status-bar-style",content:"black"}),(i={rel:"apple-touch-icon",href:"https://aframe.io/images/aframe-logo-152.png"},{tagName:"link",attributes:i,exists:function(){return document.querySelector('link[rel="'+i.rel+'"]')}})];function l(e){return{tagName:"meta",attributes:e,exists:function(){return document.querySelector('meta[name="'+e.name+'"]')}}}e.exports.W=function(e){var t,n=document.head,i=n.querySelector("script"),l=[];return o.forEach(c),e.isIOS&&a.forEach(c),l;function c(e){e&&!e.exists()&&(t=function(e){if(e&&e.tagName){var t=document.createElement(e.tagName);return t.setAttribute(r.AFRAME_INJECTED,""),s(t,e.attributes)}}(e),t&&(i?i.parentNode.insertBefore(t,i):n.appendChild(t),l.push(t)))}}},8371:(e,t,n)=>{var i=n(7427).isIframed;function r(e){if(e.data&&"vr"===e.data.type)switch(e.data.data){case"enter":this.enterVR();break;case"exit":this.exitVR()}}e.exports=function(e){i()&&window.addEventListener("message",r.bind(e))}},8313:e=>{e.exports=[]},6147:(e,t,n)=>{var i=n(5928);e.exports=function(e){if(e.isMobile){var t=e.wakelock=new i;e.addEventListener("enter-vr",(function(){t.request()})),e.addEventListener("exit-vr",(function(){t.release()}))}}},7282:(e,t,n)=>{var i,r=n(7427),s=n(1551),o=r.debug,a=s.isValidDefaultValue,l=s.propertyTypes,c=o("core:schema:warn");function h(e){return"type"in e?"string"==typeof e.type:"default"in e}function d(e,t){var n,i,r=e.default,s=e.type;return e.type?"bool"===e.type?s="boolean":"float"===e.type&&(s="number"):s=void 0===r||"boolean"!=typeof r&&"number"!=typeof r?Array.isArray(r)?"array":"string":typeof r,(i=l[s])||c("Unknown property type for component `"+t+"`: "+s),n=!!e.parse,e.parse=e.parse||i.parse,e.stringify=e.stringify||i.stringify,e.equals=e.equals||i.equals,e.isCacheable=!0===e.isCacheable||i.isCacheable,e.type=s,"default"in e?n||a(s,r)||c("Default value `"+r+"` does not match type `"+s+"` in component `"+t+"`"):e.default=i.default,e}function u(e,t,n){return null!=e&&""!==e||(e=t.default,Array.isArray(e)&&(e=e.slice())),t.parse(e,t.default,n)}function p(e,t){return"object"!=typeof e?e:t&&null!==e?t.stringify(e):JSON.stringify(e)}e.exports.isSingleProperty=h,e.exports.process=function(e,t){var n;if(h(e))return d(e,t);for(n in e)e[n]=d(e[n],t);return e},e.exports.processPropertyDefinition=d,e.exports.parseProperties=(i=[],function(e,t,n,r,s){var o,a,l,h;for(a in i.length=0,n?e:t)n&&void 0===e[a]||i.push(a);if(null===e||"object"!=typeof e)return e;for(a in e)void 0===e[a]||t[a]||s||c("Unknown property `"+a+"` for component/system `"+r+"`.");for(o=0;o<i.length;o++){if(l=t[a=i[o]],h=e[a],!t[a])return;e[a]=u(h,l)}return e}),e.exports.parseProperty=u,e.exports.stringifyProperties=function(e,t){var n,i,r,s,o={};for(n in e)i=t[n],"object"==typeof(s=r=e[n])&&(s=p(r,i),i||c("Unknown component property: "+n)),void 0!==s&&(o[n]=s);return o},e.exports.stringifyProperty=p},5892:(e,t,n)=>{var i=n(7282).process,r=e.exports.shaders={},s=e.exports.shaderNames=[],o=n(9437),a=n(7427),l={array:"v3",color:"v3",int:"i",number:"f",map:"t",time:"f",vec2:"v2",vec3:"v3",vec4:"v4"},c=e.exports.Shader=function(){};c.prototype={schema:{},vertexShader:"void main() {gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);}",fragmentShader:"void main() {gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);}",init:function(e){return this.uniforms=this.initUniforms(),this.material=new(this.raw?o.RawShaderMaterial:o.ShaderMaterial)({uniforms:this.uniforms,glslVersion:this.raw||this.glsl3?o.GLSL3:null,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader}),this.material},initUniforms:function(){var e,t,n=this.schema,i={};for(e in n)"uniform"===n[e].is&&(t=l[n[e].type],i[e]={type:t,value:void 0});return i},update:function(e){var t,n,i=this.schema,r=this.uniforms;for(t in e)if(i[t]&&"uniform"===i[t].is)if("map"!==i[t].type)r[t].value=this.parseValue(i[t].type,e[t]),r[t].needsUpdate=!0;else{if(!r[t]||r[t].value===e[t])continue;n="_texture_"+t,this.setMapOnTextureLoad(r,t,n),a.material.updateMapMaterialFromData(n,t,this,e)}},parseValue:function(e,t){var n;switch(e){case"vec2":return new o.Vector2(t.x,t.y);case"vec3":return new o.Vector3(t.x,t.y,t.z);case"vec4":return new o.Vector4(t.x,t.y,t.z,t.w);case"color":return n=new o.Color(t),new o.Vector3(n.r,n.g,n.b);default:return t}},setMapOnTextureLoad:function(e,t,n){var i=this;this.el.addEventListener("materialtextureloaded",(function(){e[t].value=i.material[n],e[t].needsUpdate=!0}))}},e.exports.registerShader=function(e,t){var n,o={};if(Object.keys(t).forEach((function(e){o[e]={value:t[e],writable:!0}})),r[e])throw new Error("The shader "+e+" has already been registered");return((n=function(){c.call(this)}).prototype=Object.create(c.prototype,o)).name=e,n.prototype.constructor=n,r[e]={Shader:n,schema:i(n.prototype.schema)},s.push(e),n}},1876:(e,t,n)=>{var i=n(8190),r=n(7282),s=n(7427),o=n(2849),a=r.parseProperties,l=r.parseProperty,c=r.process,h=r.isSingleProperty,d=s.styleParser,u=e.exports.systems={},p=e.exports.System=function(e){var t=i&&i.components[this.name];this.el=e,this.sceneEl=e,t&&(t.Component.prototype.system=this),this.buildData(),this.init(),this.update({})};p.prototype={schema:{},init:function(){},update:function(e){},updateProperties:function(e){var t=this.data;Object.keys(r).length&&(this.buildData(e),this.update(t))},buildData:function(e){var t=this.schema;Object.keys(t).length&&(e=e||window.HTMLElement.prototype.getAttribute.call(this.sceneEl,this.name),h(t)?this.data=l(e,t):this.data=a(d.parse(e)||{},t,!1,this.name))},tick:void 0,tock:void 0,play:function(){},pause:function(){}},e.exports.registerSystem=function(e,t){var n,i,r={},a=s.findAllScenes(document);if(Object.keys(t).forEach((function(e){r[e]={value:t[e],writable:!0}})),u[e])throw new Error("The system `"+e+"` has been already registered. Check that you are not loading two versions of the same system or two different systems of the same name.");if(((i=function(e){p.call(this,e)}).prototype=Object.create(p.prototype,r)).name=e,i.prototype.constructor=i,i.prototype.schema=s.extend(c(i.prototype.schema)),u[e]=i,o.canInitializeElements)for(n=0;n<a.length;n++)a[n].initSystem(e)}},258:(e,t,n)=>{n(4530)},4530:(e,t,n)=>{var i=n(8190).registerComponent,r=n(9437),s=new r.Vector3,o=new r.Vector3;i("pivot",{dependencies:["position"],schema:{type:"vec3"},init:function(){var e=this.data,t=this.el,n=t.object3D.parent,i=t.object3D,a=new r.Group;s.copy(i.position),o.copy(i.rotation),n.remove(i),a.add(i),n.add(a),t.object3D=a,i.position.set(-1*e.x,-1*e.y,-1*e.z),a.position.set(e.x+s.x,e.y+s.y,e.z+s.z),a.rotation.copy(i.rotation),i.rotation.set(0,0,0)}})},1028:(e,t,n)=>{var i=n(8190).components,r=n(5892).shaders,s=n(7427),o={};function a(e){var t=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();"fog"===e&&(t="material-fog"),"visible"===e&&(t="material-visible"),o[t]="material."+e}Object.keys(i.material.schema).forEach(a),Object.keys(r.standard.schema).forEach(a),e.exports=function(){return{defaultComponents:{material:{}},mappings:s.extend({},o)}}},196:(e,t,n)=>{n(5702),n(9099),n(1907),n(3200),n(3120),n(9357),n(7161),n(9172),n(9012),n(4814),n(542),n(2414),n(1199),n(6672)},5920:(e,t,n)=>{var i=n(2203).$,r=n(4056).P,s=n(8190).components,o=n(7427),a=o.debug,l=o.entity.setComponentProperty,c=a("extras:primitives:debug"),h=a("extras:primitives:warn"),d=a("extras:primitives:error"),u=e.exports.primitives={};function p(e,t,n){var i=o.entity.getComponentPropertyPath(e);i.constructor===Array?(n[i[0]]=n[i[0]]||{},n[i[0]][i[1]]=t.trim()):n[i]=t.trim()}e.exports.registerPrimitive=function(e,t){if(e=e.toLowerCase(),!i[e]){i[e]=!0,c("Registering <%s>",e),t.defaultAttributes&&h("The 'defaultAttributes' object is deprecated. Use 'defaultComponents' instead.");var n=t.mappings||{},a=class extends r{constructor(){super(),this.defaultComponentsFromPrimitive=t.defaultComponents||t.defaultAttributes||{},this.deprecated=t.deprecated||null,this.deprecatedMappings=t.deprecatedMappings||{},this.mappings=n,t.deprecated&&console.warn(t.deprecated),this.resolveMappingCollisions()}resolveMappingCollisions(){var e=this.mappings,t=this;Object.keys(e).forEach((function(n){var i;n!==n.toLowerCase()&&h("Mapping keys should be specified in lower case. The mapping key "+n+" may not be recognized"),s[n]&&(i=e[n].replace(".","-"),e[i]=e[n],delete e[n],console.warn("The primitive "+t.tagName.toLowerCase()+" has a mapping collision. The attribute "+n+" has the same name as a registered component and has been renamed to "+i))}))}getExtraComponents(){var e,t,n,i,r,s=this;for(t=o.clone(this.defaultComponentsFromPrimitive),(r=this.getAttribute("mixin"))&&(r=o.split(r.trim(),/\s+/)).forEach((function(e){var n,r,h=document.getElementById(e);if(h){var d=h.rawAttributeCache,u=h.componentCache;for(var A in d){if(i=s.mappings[A])return void p(i,d[A],t);A in u&&(t[A]=(n=t[A],r=u[A],a(n)?l(r):a(r)?l(n):c(n)&&c(r)?o.extendDeep(n,r):l(r)))}}})),n=0;n<this.attributes.length;n++)e=this.attributes[n],(i=this.mappings[e.name])&&p(i,e.value,t);return t;function a(e){return void 0===e}function l(e){return c(e)?o.extendDeep({},e):e}function c(e){return null!==e&&e.constructor===Object}}attributeChangedCallback(e,t,n){var i=this.mappings[e];e in this.deprecatedMappings&&console.warn(this.deprecatedMappings[e]),e&&i?l(this,i,n):super.attributeChangedCallback(e,t,n)}};return customElements.define(e,a),a.mappings=n,u[e]=a,a}d("Trying to register primitive "+e+" that has been already previously registered")},e.exports.definePrimitive=function(t,n,i){i=i||{},Object.keys(n).map((function(e){!function(e,t){var n=s[e].schema;Object.keys(n).map((function(n){var i=n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();void 0!==t[i]&&(i=e+"-"+n),t[i]=e+"."+n}))}(e,i)})),e.exports.registerPrimitive(t,o.extendDeep({},null,{defaultComponents:n,mappings:i}))}},5702:(e,t,n)=>{(0,n(5920).registerPrimitive)("a-camera",{defaultComponents:{camera:{},"look-controls":{},"wasd-controls":{},position:{x:0,y:1.6,z:0}},mappings:{active:"camera.active",far:"camera.far",fov:"camera.fov","look-controls-enabled":"look-controls.enabled",near:"camera.near","pointer-lock-enabled":"look-controls.pointerLockEnabled","wasd-controls-enabled":"wasd-controls.enabled","reverse-mouse-drag":"look-controls.reverseMouseDrag",zoom:"camera.zoom"}})},9099:(e,t,n)=>{var i=n(1028);(0,n(5920).registerPrimitive)("a-cursor",n(7427).extendDeep({},i(),{defaultComponents:{cursor:{},geometry:{primitive:"ring",radiusOuter:.016,radiusInner:.01,segmentsTheta:32},material:{color:"#000",shader:"flat",opacity:.8},position:{x:0,y:0,z:-1}},mappings:{far:"raycaster.far",fuse:"cursor.fuse","fuse-timeout":"cursor.fuseTimeout",interval:"raycaster.interval",objects:"raycaster.objects"}}))},1907:(e,t,n)=>{var i=n(1028);(0,n(5920).registerPrimitive)("a-curvedimage",n(7427).extendDeep({},i(),{defaultComponents:{geometry:{height:1,primitive:"cylinder",radius:2,segmentsRadial:48,thetaLength:270,openEnded:!0,thetaStart:0},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0,repeat:"-1 1"}},mappings:{height:"geometry.height","open-ended":"geometry.openEnded",radius:"geometry.radius",segments:"geometry.segmentsRadial",start:"geometry.thetaStart","theta-length":"geometry.thetaLength","theta-start":"geometry.thetaStart",width:"geometry.thetaLength"}}))},3200:(e,t,n)=>{(0,n(5920).registerPrimitive)("a-gltf-model",{mappings:{src:"gltf-model"}})},3120:(e,t,n)=>{var i=n(1028);(0,n(5920).registerPrimitive)("a-image",n(7427).extendDeep({},i(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}}))},9357:(e,t,n)=>{(0,n(5920).registerPrimitive)("a-light",{defaultComponents:{light:{}},mappings:{angle:"light.angle",color:"light.color","ground-color":"light.groundColor",decay:"light.decay",distance:"light.distance",intensity:"light.intensity",penumbra:"light.penumbra",type:"light.type",target:"light.target",envmap:"light.envMap","shadow-camera-automatic":"light.shadowCameraAutomatic"}})},7161:(e,t,n)=>{(0,n(5920).registerPrimitive)("a-link",{defaultComponents:{link:{visualAspectEnabled:!0}},mappings:{href:"link.href",image:"link.image",title:"link.title"}})},9172:(e,t,n)=>{var i=n(1028)();(0,n(5920).registerPrimitive)("a-obj-model",n(7427).extendDeep({},i,{defaultComponents:{"obj-model":{}},mappings:{src:"obj-model.obj",mtl:"obj-model.mtl"}}))},9012:(e,t,n)=>{var i=n(1028),r=n(5920).registerPrimitive,s=n(7427),o=n(6672);r("a-sky",s.extendDeep({},i(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",side:"back",shader:"flat",npot:!0},scale:"-1 1 1"},mappings:s.extendDeep({},o["a-sphere"].mappings)}))},4814:(e,t,n)=>{(0,n(5920).registerPrimitive)("a-sound",{defaultComponents:{sound:{}},mappings:{src:"sound.src",on:"sound.on",autoplay:"sound.autoplay",loop:"sound.loop",volume:"sound.volume"}})},542:(e,t,n)=>{(0,n(5920).definePrimitive)("a-text",{text:{anchor:"align",width:5}})},2414:(e,t,n)=>{var i=n(1028);(0,n(5920).registerPrimitive)("a-video",n(7427).extendDeep({},i(),{defaultComponents:{geometry:{primitive:"plane"},material:{color:"#FFF",shader:"flat",side:"double",transparent:!0}},mappings:{height:"geometry.height",width:"geometry.width"}}))},1199:(e,t,n)=>{var i=n(1028);(0,n(5920).registerPrimitive)("a-videosphere",n(7427).extendDeep({},i(),{defaultComponents:{geometry:{primitive:"sphere",radius:500,segmentsWidth:64,segmentsHeight:32},material:{color:"#FFF",shader:"flat",side:"back",npot:!0},scale:"-1 1 1"},mappings:{radius:"geometry.radius","segments-height":"geometry.segmentsHeight","segments-width":"geometry.segmentsWidth"}}))},6672:(e,t,n)=>{var i=n(1028),r=n(7045).to,s=n(7045).Ls,o=n(5920).registerPrimitive,a=n(7427),l=e.exports={};function c(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}s.forEach((function(e){var t=r[e],n=c(e),s={};Object.keys(t.schema).forEach((function(e){s[c(e)]="geometry."+e}));var h="a-"+n,d=o(h,a.extendDeep({},i(),{defaultComponents:{geometry:{primitive:e}},mappings:s}));l[h]=d}))},5459:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("box",{schema:{depth:{default:1,min:0},height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"},segmentsDepth:{default:1,min:1,max:20,type:"int"}},init:function(e){this.geometry=new r.BoxGeometry(e.width,e.height,e.depth,e.segmentsWidth,e.segmentsHeight,e.segmentsDepth)}})},2328:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("circle",{schema:{radius:{default:1,min:0},segments:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new r.CircleGeometry(e.radius,e.segments,s(e.thetaStart),s(e.thetaLength))}})},4907:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("cone",{schema:{height:{default:1,min:0},openEnded:{default:!1},radiusBottom:{default:1,min:0},radiusTop:{default:.01,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new r.CylinderGeometry(e.radiusTop,e.radiusBottom,e.height,e.segmentsRadial,e.segmentsHeight,e.openEnded,s(e.thetaStart),s(e.thetaLength))}})},6362:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("cylinder",{schema:{height:{default:1,min:0},openEnded:{default:!1},radius:{default:1,min:0},segmentsHeight:{default:18,min:1,type:"int"},segmentsRadial:{default:36,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new r.CylinderGeometry(e.radius,e.radius,e.height,e.segmentsRadial,e.segmentsHeight,e.openEnded,s(e.thetaStart),s(e.thetaLength))}})},3934:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("dodecahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new r.DodecahedronGeometry(e.radius,e.detail)}})},4763:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("icosahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new r.IcosahedronGeometry(e.radius,e.detail)}})},6394:(e,t,n)=>{n(5459),n(2328),n(4907),n(6362),n(3934),n(4763),n(7049),n(6184),n(4110),n(7313),n(1394),n(6103),n(5553),n(7020)},7049:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("octahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new r.OctahedronGeometry(e.radius,e.detail)}})},6184:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("plane",{schema:{height:{default:1,min:0},width:{default:1,min:0},segmentsHeight:{default:1,min:1,max:20,type:"int"},segmentsWidth:{default:1,min:1,max:20,type:"int"}},init:function(e){this.geometry=new r.PlaneGeometry(e.width,e.height,e.segmentsWidth,e.segmentsHeight)}})},4110:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("ring",{schema:{radiusInner:{default:.8,min:0},radiusOuter:{default:1.2,min:0},segmentsPhi:{default:10,min:1,type:"int"},segmentsTheta:{default:32,min:3,type:"int"},thetaLength:{default:360,min:0},thetaStart:{default:0}},init:function(e){this.geometry=new r.RingGeometry(e.radiusInner,e.radiusOuter,e.segmentsTheta,e.segmentsPhi,s(e.thetaStart),s(e.thetaLength))}})},7313:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("sphere",{schema:{radius:{default:1,min:0},phiLength:{default:360},phiStart:{default:0,min:0},thetaLength:{default:180,min:0},thetaStart:{default:0},segmentsHeight:{default:18,min:2,type:"int"},segmentsWidth:{default:36,min:3,type:"int"}},init:function(e){this.geometry=new r.SphereGeometry(e.radius,e.segmentsWidth,e.segmentsHeight,s(e.phiStart),s(e.phiLength),s(e.thetaStart),s(e.thetaLength))}})},1394:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("tetrahedron",{schema:{detail:{default:0,min:0,max:5,type:"int"},radius:{default:1,min:0}},init:function(e){this.geometry=new r.TetrahedronGeometry(e.radius,e.detail)}})},6103:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=r.MathUtils.degToRad;i("torus",{schema:{arc:{default:360},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:36,min:2,type:"int"},segmentsTubular:{default:32,min:3,type:"int"}},init:function(e){this.geometry=new r.TorusGeometry(e.radius,2*e.radiusTubular,e.segmentsRadial,e.segmentsTubular,s(e.arc))}})},5553:(e,t,n)=>{var i=n(7045).Az,r=n(9437);i("torusKnot",{schema:{p:{default:2,min:1},q:{default:3,min:1},radius:{default:1,min:0},radiusTubular:{default:.2,min:0},segmentsRadial:{default:8,min:3,type:"int"},segmentsTubular:{default:100,min:3,type:"int"}},init:function(e){this.geometry=new r.TorusKnotGeometry(e.radius,2*e.radiusTubular,e.segmentsTubular,e.segmentsRadial,e.p,e.q)}})},7020:(e,t,n)=>{var i=n(7045).Az,r=n(9437),s=new r.Quaternion,o=new r.Vector3(0,0,1),a=new r.Vector2,l=new r.Vector2,c=new r.Vector2;i("triangle",{schema:{vertexA:{type:"vec3",default:{x:0,y:.5,z:0}},vertexB:{type:"vec3",default:{x:-.5,y:-.5,z:0}},vertexC:{type:"vec3",default:{x:.5,y:-.5,z:0}}},init:function(e){var t,n,i,h,d,u,p,A,f;(i=new r.Triangle).a.set(e.vertexA.x,e.vertexA.y,e.vertexA.z),i.b.set(e.vertexB.x,e.vertexB.y,e.vertexB.z),i.c.set(e.vertexC.x,e.vertexC.y,e.vertexC.z),n=i.getNormal(new r.Vector3),s.setFromUnitVectors(n,o),h=i.a.clone().applyQuaternion(s),d=i.b.clone().applyQuaternion(s),u=i.c.clone().applyQuaternion(s),a.set(Math.min(h.x,d.x,u.x),Math.min(h.y,d.y,u.y)),l.set(Math.max(h.x,d.x,u.x),Math.max(h.y,d.y,u.y)),c.set(0,0).subVectors(l,a),h=(new r.Vector2).subVectors(h,a).divide(c),d=(new r.Vector2).subVectors(d,a).divide(c),u=(new r.Vector2).subVectors(u,a).divide(c),t=this.geometry=new r.BufferGeometry,p=[i.a.x,i.a.y,i.a.z,i.b.x,i.b.y,i.b.z,i.c.x,i.c.y,i.c.z],A=[n.x,n.y,n.z,n.x,n.y,n.z,n.x,n.y,n.z],f=[h.x,h.y,d.x,d.y,u.x,u.y],t.setAttribute("position",new r.Float32BufferAttribute(p,3)),t.setAttribute("normal",new r.Float32BufferAttribute(A,3)),t.setAttribute("uv",new r.Float32BufferAttribute(f,2))}})},4497:(e,t,n)=>{var i=n(7427),r=i.debug,s=r("A-Frame:error"),o=r("A-Frame:warn");window.document.currentScript&&window.document.currentScript.parentNode!==window.document.head&&!window.debug&&o("Put the A-Frame <script> tag in the <head> of the HTML *before* the scene to ensure everything for A-Frame is properly registered before they are used from HTML."),window.cordova||"file:"!==window.location.protocol||s("This HTML file is currently being served via the file:// protocol. Assets, textures, and models WILL NOT WORK due to cross-origin policy! Please use a local or hosted server: https://aframe.io/docs/1.4.0/introduction/installation.html#use-a-local-server."),i.device.isBrowserEnvironment&&(n(7180),n(9379));var a=n(5076).aQ,l=n(8190).components,c=n(8190).registerComponent,h=n(7045).Az,d=n(5920).registerPrimitive,u=n(5892).registerShader,p=n(1876).registerSystem,A=n(5892).shaders,f=n(1876).systems,m=window.THREE=n(9437),g=n(2849),v=n(8330);n(8850),n(6394),n(344),n(3072);var y=n(2203).a,E=n(4056).P;n(842),n(6178),n(5890),n(258),n(196),console.log("A-Frame Version: 1.6.0 (Date 2025-01-10, Commit #24c2bad)"),console.log("THREE Version (https://github.com/supermedium/three.js):",m.REVISION),window.AFRAME_ASYNC||g.waitForDocumentReadyState(),e.exports=window.AFRAME={AComponent:n(8190).Component,AEntity:E,ANode:y,ANIME:n(4635).A,AScene:a,components:l,coreComponents:Object.keys(l),geometries:n(7045).to,registerComponent:c,registerGeometry:h,registerPrimitive:d,registerShader:u,registerSystem:p,primitives:{getMeshMixin:n(1028),primitives:n(5920).primitives},scenes:n(8313),schema:n(7282),shaders:A,systems:f,emitReady:g.emitReady,THREE:m,utils:i,version:v.version}},8132:e=>{window.aframeStats=function(e){var t=null,n=e;return{update:function(){var e;t("te").set((e=n.querySelectorAll("*"),Array.prototype.slice.call(e).filter((function(e){return e.isEntity})),e.length)),window.performance.getEntriesByName&&t("lt").set(window.performance.getEntriesByName("render-started")[0].startTime.toFixed(0))},start:function(){},end:function(){},attach:function(e){t=e},values:{te:{caption:"Entities"},lt:{caption:"Load Time"}},groups:[{caption:"A-Frame",values:["te","lt"]}],fractions:[]}},e.exports={aframeStats:window.aframeStats}},9437:(e,t,n)=>{var i=n(7496).A;n.g.THREE=i,n(7469),i.Cache&&(i.Cache.enabled=!0),e.exports=i},2621:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437),s=n(7427);function o(e,t){return t.color.set(e.color),t.fog=e.fog,t.wireframe=e.wireframe,t.toneMapped=e.toneMapped,t.wireframeLinewidth=e.wireframeLinewidth,t}e.exports.Shader=i("flat",{schema:{color:{type:"color"},fog:{default:!0},height:{default:256},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},src:{type:"map"},width:{default:512},wireframe:{default:!1},wireframeLinewidth:{default:2},toneMapped:{default:!0}},init:function(e){this.materialData={color:new r.Color},o(e,this.materialData),this.material=new r.MeshBasicMaterial(this.materialData)},update:function(e){this.updateMaterial(e),s.material.updateMap(this,e)},updateMaterial:function(e){var t;for(t in o(e,this.materialData),this.materialData)this.material[t]=this.materialData[t]}})},344:(e,t,n)=>{n(2621),n(9583),n(8318),n(6419),n(1152),n(7002)},1152:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437),s=["#include <common>","#include <fog_pars_vertex>","#include <logdepthbuf_pars_vertex>","out vec2 vUV;","void main(void) {"," vUV = uv;"," #include <begin_vertex>"," #include <project_vertex>"," #include <logdepthbuf_vertex>"," #include <fog_vertex>","}"].join("\n"),o=["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","uniform bool negate;","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","float median(float r, float g, float b) {"," return max(min(r, g), min(max(r, g), b));","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec3 sampleColor = texture(map, vUV).rgb;"," if (negate) { sampleColor = 1.0 - sampleColor; }"," float sigDist = median(sampleColor.r, sampleColor.g, sampleColor.b) - 0.5;"," float alpha = clamp(sigDist / fwidth(sigDist) + 0.5, 0.0, 1.0);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(vUV) + dFdy(vUV));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," // Do modified alpha test."," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * (sigDist + 0.5);"," }"," // Do modified alpha test."," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," gl_FragColor = vec4(color.xyz, alpha * opacity);"," #include <logdepthbuf_fragment>"," #include <tonemapping_fragment>"," #include <colorspace_fragment>"," #include <fog_fragment>","}"].join("\n");e.exports.Shader=i("msdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},negate:{type:"boolean",is:"uniform",default:!0},opacity:{type:"number",is:"uniform",default:1}},vertexShader:s,fragmentShader:o,init:function(){return this.uniforms=r.UniformsUtils.merge([r.UniformsLib.fog,this.initUniforms()]),this.material=new r.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,fog:!0}),this.material}})},8318:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437),s=n(7427);function o(e,t){switch(t.color.set(e.color),t.specular.set(e.specular),t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity,t.fog=e.fog,t.transparent=e.transparent,t.wireframe=e.wireframe,t.wireframeLinewidth=e.wireframeLinewidth,t.shininess=e.shininess,t.flatShading=e.flatShading,t.wireframe=e.wireframe,t.wireframeLinewidth=e.wireframeLinewidth,t.reflectivity=e.reflectivity,t.refractionRatio=e.refractionRatio,e.combine){case"mix":t.combine=r.MixOperation;break;case"multiply":t.combine=r.MultiplyOperation;break;case"add":t.combine=r.AddOperation}return e.normalMap&&(t.normalScale=e.normalScale),e.ambientOcclusionMap&&(t.aoMapIntensity=e.ambientOcclusionMapIntensity),e.bumpMap&&(t.bumpScale=e.bumpMapScale),e.displacementMap&&(t.displacementScale=e.displacementScale,t.displacementBias=e.displacementBias),t}e.exports.Shader=i("phong",{schema:{color:{type:"color"},emissive:{type:"color",default:"black"},emissiveIntensity:{default:1},specular:{type:"color",default:"#111111"},transparent:{default:!1},fog:{default:!0},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},src:{type:"map"},envMap:{default:""},sphericalEnvMap:{type:"map"},shininess:{default:30},flatShading:{default:!1},wireframe:{default:!1},wireframeLinewidth:{default:2},combine:{oneOF:["multiply","mix","add"],default:"mix"},reflectivity:{default:.9},refractionRatio:{default:.98},refract:{default:!1},normalMap:{type:"map"},normalScale:{type:"vec2",default:{x:1,y:1}},normalTextureOffset:{type:"vec2"},normalTextureRepeat:{type:"vec2",default:{x:1,y:1}},ambientOcclusionMap:{type:"map"},ambientOcclusionMapIntensity:{default:1},displacementMap:{type:"map"},displacementScale:{default:1},displacementBias:{default:.5},displacementTextureOffset:{type:"vec2"},displacementTextureRepeat:{type:"vec2",default:{x:1,y:1}},bumpMap:{type:"map"},bumpMapScale:{default:1},bumpTextureOffset:{type:"vec2"},bumpTextureRepeat:{type:"vec2",default:{x:1,y:1}}},init:function(e){this.materialData={color:new r.Color,specular:new r.Color,emissive:new r.Color},o(e,this.materialData),this.material=new r.MeshPhongMaterial(this.materialData);var t=this.el.sceneEl;Object.defineProperty(this.material,"envMap",{get:function(){return this._envMap||t.object3D.environment},set:function(e){this._envMap=e}})},update:function(e){this.updateMaterial(e),s.material.updateMap(this,e),s.material.updateDistortionMap("normal",this,e),s.material.updateDistortionMap("displacement",this,e),s.material.updateDistortionMap("ambientOcclusion",this,e),s.material.updateDistortionMap("bump",this,e),s.material.updateEnvMap(this,e)},updateMaterial:function(e){var t;for(t in o(e,this.materialData),this.materialData)this.material[t]=this.materialData[t]}})},6419:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437),s=["#include <common>","#include <fog_pars_vertex>","#include <logdepthbuf_pars_vertex>","out vec2 vUV;","void main(void) {"," vUV = uv;"," #include <begin_vertex>"," #include <project_vertex>"," #include <logdepthbuf_vertex>"," #include <fog_vertex>","}"].join("\n"),o=["#include <common>","#include <fog_pars_fragment>","#include <logdepthbuf_pars_fragment>","uniform float alphaTest;","uniform float opacity;","uniform sampler2D map;","uniform vec3 color;","in vec2 vUV;","float contour(float width, float value) {"," return smoothstep(0.5 - value, 0.5 + value, width);","}","#define BIG_ENOUGH 0.001","#define MODIFIED_ALPHATEST (0.02 * isBigEnough / BIG_ENOUGH)","void main() {"," vec2 uv = vUV;"," vec4 texColor = texture(map, uv);"," float dist = texColor.a;"," float width = fwidth(dist);"," float alpha = contour(dist, width);"," float dscale = 0.353505;"," vec2 duv = dscale * (dFdx(uv) + dFdy(uv));"," float isBigEnough = max(abs(duv.x), abs(duv.y));"," if (isBigEnough > BIG_ENOUGH) {"," float ratio = BIG_ENOUGH / isBigEnough;"," alpha = ratio * alpha + (1.0 - ratio) * dist;"," }"," if (isBigEnough <= BIG_ENOUGH) {"," vec4 box = vec4 (uv - duv, uv + duv);"," alpha = (alpha + 0.5 * ("," contour(texture(map, box.xy).a, width)"," + contour(texture(map, box.zw).a, width)"," + contour(texture(map, box.xw).a, width)"," + contour(texture(map, box.zy).a, width)"," )) / 3.0;"," }"," if (alpha < alphaTest * MODIFIED_ALPHATEST) { discard; return; }"," gl_FragColor = vec4(color, opacity * alpha);"," #include <logdepthbuf_fragment>"," #include <tonemapping_fragment>"," #include <colorspace_fragment>"," #include <fog_fragment>","}"].join("\n");e.exports.Shader=i("sdf",{schema:{alphaTest:{type:"number",is:"uniform",default:.5},color:{type:"color",is:"uniform",default:"white"},map:{type:"map",is:"uniform"},opacity:{type:"number",is:"uniform",default:1}},vertexShader:s,fragmentShader:o,init:function(){return this.uniforms=r.UniformsUtils.merge([r.UniformsLib.fog,this.initUniforms()]),this.material=new r.ShaderMaterial({uniforms:this.uniforms,vertexShader:this.vertexShader,fragmentShader:this.fragmentShader,fog:!0}),this.material}})},7002:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437);e.exports.Shader=i("shadow",{schema:{opacity:{default:.5},transparent:{default:!0},alphaToCoverage:{default:!0}},init:function(e){this.material=new r.ShadowMaterial},update:function(e){this.material.opacity=e.opacity,this.material.alphaToCoverage=e.alphaToCoverage,this.material.transparent=e.transparent}})},9583:(e,t,n)=>{var i=n(5892).registerShader,r=n(9437),s=n(7427);function o(e,t){return t.color.set(e.color),t.emissive.set(e.emissive),t.emissiveIntensity=e.emissiveIntensity,t.fog=e.fog,t.metalness=e.metalness,t.roughness=e.roughness,t.wireframe=e.wireframe,t.wireframeLinewidth=e.wireframeLinewidth,e.normalMap&&(t.normalScale=e.normalScale),e.ambientOcclusionMap&&(t.aoMapIntensity=e.ambientOcclusionMapIntensity),e.displacementMap&&(t.displacementScale=e.displacementScale,t.displacementBias=e.displacementBias),t}e.exports.Shader=i("standard",{schema:{ambientOcclusionMap:{type:"map"},ambientOcclusionMapIntensity:{default:1},ambientOcclusionTextureOffset:{type:"vec2"},ambientOcclusionTextureRepeat:{type:"vec2",default:{x:1,y:1}},color:{type:"color"},displacementMap:{type:"map"},displacementScale:{default:1},displacementBias:{default:.5},displacementTextureOffset:{type:"vec2"},displacementTextureRepeat:{type:"vec2",default:{x:1,y:1}},emissive:{type:"color",default:"#000"},emissiveIntensity:{default:1},envMap:{default:""},fog:{default:!0},height:{default:256},metalness:{default:0,min:0,max:1},metalnessMap:{type:"map"},metalnessTextureOffset:{type:"vec2"},metalnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},normalMap:{type:"map"},normalScale:{type:"vec2",default:{x:1,y:1}},normalTextureOffset:{type:"vec2"},normalTextureRepeat:{type:"vec2",default:{x:1,y:1}},offset:{type:"vec2",default:{x:0,y:0}},repeat:{type:"vec2",default:{x:1,y:1}},roughness:{default:.5,min:0,max:1},roughnessMap:{type:"map"},roughnessTextureOffset:{type:"vec2"},roughnessTextureRepeat:{type:"vec2",default:{x:1,y:1}},sphericalEnvMap:{type:"map"},src:{type:"map"},width:{default:512},wireframe:{default:!1},wireframeLinewidth:{default:2}},init:function(e){this.materialData={color:new r.Color,emissive:new r.Color},o(e,this.materialData),this.material=new r.MeshStandardMaterial(this.materialData)},update:function(e){this.updateMaterial(e),s.material.updateMap(this,e),s.material.updateDistortionMap("normal",this,e),s.material.updateDistortionMap("displacement",this,e),s.material.updateDistortionMap("ambientOcclusion",this,e),s.material.updateDistortionMap("metalness",this,e),s.material.updateDistortionMap("roughness",this,e),s.material.updateEnvMap(this,e)},updateMaterial:function(e){var t,n=this.material;for(t in o(e,this.materialData),this.materialData)n[t]=this.materialData[t]}})},409:(e,t,n)=>{var i=n(1343),r=n(1876).registerSystem,s="data-aframe-default-camera";e.exports.System=r("camera",{init:function(){this.activeCameraEl=null,this.render=this.render.bind(this),this.unwrapRender=this.unwrapRender.bind(this),this.wrapRender=this.wrapRender.bind(this),this.initialCameraFound=!1,this.numUserCameras=0,this.numUserCamerasChecked=0,this.setupInitialCamera()},setupInitialCamera:function(){var e,t,n=this.sceneEl,i=this;if(!n.camera||n.camera.el.getAttribute("camera").spectator)if((e=n.querySelectorAll("a-camera, :not(a-mixin)[camera]")).length)for(this.numUserCameras=e.length,t=0;t<e.length;t++)e[t].addEventListener("object3dset",(function(e){"camera"===e.detail.type&&i.checkUserCamera(this)})),e[t].isNode?e[t].load():e[t].addEventListener("nodeready",(function(){this.load()}));else this.createDefaultCamera();else n.emit("cameraready",{cameraEl:n.camera.el})},checkUserCamera:function(e){var t,n=this.el.sceneEl;this.numUserCamerasChecked++,this.initialCameraFound||((t=e.getAttribute("camera")).active&&!t.spectator?(this.initialCameraFound=!0,n.camera=e.getObject3D("camera"),n.emit("cameraready",{cameraEl:e})):this.numUserCamerasChecked===this.numUserCameras&&this.createDefaultCamera())},createDefaultCamera:function(){var e,t=this.sceneEl;(e=document.createElement("a-entity")).setAttribute("camera",{active:!0}),e.setAttribute("position",{x:0,y:i.DEFAULT_CAMERA_HEIGHT,z:0}),e.setAttribute("wasd-controls",""),e.setAttribute("look-controls",""),e.setAttribute(i.AFRAME_INJECTED,""),e.addEventListener("object3dset",(function(n){"camera"===n.detail.type&&(t.camera=n.detail.object,t.emit("cameraready",{cameraEl:e}))})),t.appendChild(e)},disableActiveCamera:function(){var e;(e=this.sceneEl.querySelectorAll(":not(a-mixin)[camera]"))[e.length-1].setAttribute("camera","active",!0)},setActiveCamera:function(e){var t,n,i,r,o=this.activeCameraEl,a=this.sceneEl;if((r=e.getObject3D("camera"))&&e!==this.activeCameraEl){var l=a.querySelector("["+s+"]");for(e!==(l&&l.querySelector(":not(a-mixin)[camera]"))&&function(e){var t;e.camera&&(t=e.querySelector("["+s+"]"))&&e.removeChild(t)}(a),this.activeCameraEl=e,this.activeCameraEl.play(),a.camera=r,o&&o.setAttribute("camera","active",!1),n=a.querySelectorAll(":not(a-mixin)[camera]"),i=0;i<n.length;i++)(t=n[i]).isEntity&&e!==t&&(t.setAttribute("camera","active",!1),t.pause());a.emit("camera-set-active",{cameraEl:e})}},setSpectatorCamera:function(e){var t,n=this.spectatorCameraEl,i=this.sceneEl;e.getObject3D("camera")&&e!==this.spectatorCameraEl&&(n&&n.setAttribute("camera","spectator",!1),t=this.spectatorCameraEl=e,i.addEventListener("enter-vr",this.wrapRender),i.addEventListener("exit-vr",this.unwrapRender),t.setAttribute("camera","active",!1),t.play(),i.emit("camera-set-spectator",{cameraEl:e}))},disableSpectatorCamera:function(){this.spectatorCameraEl=void 0},wrapRender:function(){this.spectatorCameraEl&&!this.originalRender&&(this.originalRender=this.sceneEl.renderer.render,this.sceneEl.renderer.render=this.render)},unwrapRender:function(){this.originalRender&&(this.sceneEl.renderer.render=this.originalRender,this.originalRender=void 0)},render:function(e,t){var n,i,r=this.sceneEl;n=r.renderer.xr.enabled,this.originalRender.call(r.renderer,e,t),this.spectatorCameraEl&&!r.isMobile&&n&&(i=this.spectatorCameraEl.components.camera.camera,r.renderer.xr.enabled=!1,this.originalRender.call(r.renderer,e,i),r.renderer.xr.enabled=n)}})},810:(e,t,n)=>{var i=n(7045).to,r=n(1876).registerSystem;function s(e){var t=e.primitive,n=i[t]&&i[t].Geometry,r=new n;if(!n)throw new Error("Unknown geometry `"+t+"`");return r.init(e),r.geometry}e.exports.System=r("geometry",{init:function(){this.cache={},this.cacheCount={}},clearCache:function(){this.cache={},this.cacheCount={}},getOrCreateGeometry:function(e){var t,n,i=this.cache;return e.skipCache?s(e):(t=i[n=this.hash(e)],function(e,t){e[t]=void 0===e[t]?1:e[t]+1}(this.cacheCount,n),t||(t=s(e),i[n]=t,t))},unuseGeometry:function(e){var t,n=this.cache,i=this.cacheCount;e.skipCache||n[t=this.hash(e)]&&(function(e,t){e[t]--}(i,t),i[t]>0||(n[t].dispose(),delete n[t],delete i[t]))},hash:function(e){return JSON.stringify(e)}})},4211:(e,t,n)=>{var i=n(1876).registerSystem,r=n(9437);e.exports.System=i("gltf-model",{schema:{dracoDecoderPath:{default:"https://www.gstatic.com/draco/versioned/decoders/1.5.7/"},basisTranscoderPath:{default:""},meshoptDecoderPath:{default:""}},init:function(){this.update()},update:function(){var e,t=this.data.dracoDecoderPath,n=this.data.basisTranscoderPath,i=this.data.meshoptDecoderPath;!this.dracoLoader&&t&&(this.dracoLoader=new r.DRACOLoader,this.dracoLoader.setDecoderPath(t)),!this.ktx2Loader&&n&&(this.ktx2Loader=new r.KTX2Loader,this.ktx2Loader.setTranscoderPath(n).detectSupport(this.el.renderer)),!this.meshoptDecoder&&i&&(this.meshoptDecoder=(e=i,new Promise((function(t,n){var i=document.createElement("script");document.body.appendChild(i),i.onload=t,i.onerror=n,i.async=!0,i.src=e}))).then((function(){return window.MeshoptDecoder.ready})).then((function(){return window.MeshoptDecoder})))},getDRACOLoader:function(){return this.dracoLoader},getKTX2Loader:function(){return this.ktx2Loader},getMeshoptDecoder:function(){return this.meshoptDecoder}})},3072:(e,t,n)=>{n(409),n(810),n(4211),n(6540),n(1855),n(2382),n(6769),n(5426),n(2941),n(6696)},6540:(e,t,n)=>{var i=n(1876).registerSystem,r=n(1343),s="data-aframe-default-light";e.exports.System=i("light",{schema:{defaultLightsEnabled:{default:!0}},init:function(){this.defaultLights=!1,this.userDefinedLights=!1,this.sceneEl.addEventListener("loaded",this.setupDefaultLights.bind(this))},registerLight:function(e){e.hasAttribute(s)||(this.removeDefaultLights(),this.userDefinedLights=!0)},removeDefaultLights:function(){var e,t=this.sceneEl;if(this.defaultLights){e=document.querySelectorAll("["+s+"]");for(var n=0;n<e.length;n++)t.removeChild(e[n]);this.defaultLights=!1}},setupDefaultLights:function(){var e,t,n=this.sceneEl;this.userDefinedLights||this.defaultLights||!this.data.defaultLightsEnabled||((e=document.createElement("a-entity")).setAttribute("light",{color:"#BBB",type:"ambient"}),e.setAttribute(s,""),e.setAttribute(r.AFRAME_INJECTED,""),n.appendChild(e),(t=document.createElement("a-entity")).setAttribute("light",{color:"#FFF",intensity:1.884,castShadow:!0}),t.setAttribute("position",{x:-.5,y:1,z:1}),t.setAttribute(s,""),t.setAttribute(r.AFRAME_INJECTED,""),n.appendChild(t),this.defaultLights=!0)}})},1855:(e,t,n)=>{var i=n(1876).registerSystem,r=n(9437),s=n(7427),o=n(8066).setTextureProperties,a=n(8066).createCompatibleTexture,l=s.debug,c=l("components:texture:error"),h=l("components:texture:warn"),d=new r.ImageLoader;e.exports.System=i("material",{init:function(){this.materials={},this.sourceCache={}},clearTextureSourceCache:function(){this.sourceCache={}},loadTexture:function(e,t,n){this.loadTextureSource(e,(function(e){var i=a(e);o(i,t),n(i)}))},loadTextureSource:function(e,t){var n=this,i=this.sourceCache,o=this.hash(e);function a(e){i[o]=Promise.resolve(e),i[o].then(t)}i[o]?i[o].then(t):"CANVAS"!==e.tagName?a(new Promise((function(t,i){s.srcLoader.validateSrc(e,(function(e){n.loadImage(e,t)}),(function(e){n.loadVideo(e,t)}))}))):a(new r.Source(e))},loadCubeMapTexture:function(e,t){var n=this,i=0,s=new r.CubeTexture;function o(r){n.loadTextureSource(e[r],(function(e){s.images[r]=e.data,6==++i&&(s.needsUpdate=!0,t(s))}))}if(s.colorSpace=r.SRGBColorSpace,6===e.length)for(var a=0;a<e.length;a++)o(a);else h("Cube map texture requires exactly 6 sources, got only %s sources",e.length)},loadImage:function(e,t){t("string"==typeof e?function(e){return new Promise((function(t,n){d.load(e,(function(e){t(new r.Source(e))}),(function(){}),(function(e){c("`$s` could not be fetched (Error code: %s; Response: %s)",e.status,e.statusText)}))}))}(e):new r.Source(e))},loadVideo:function(e,t){var n;"string"!=typeof e&&function(e){e.autoplay=e.hasAttribute("autoplay")&&"false"!==e.getAttribute("autoplay"),e.controls=e.hasAttribute("controls")&&"false"!==e.getAttribute("controls"),"false"===e.getAttribute("loop")&&e.removeAttribute("loop"),"false"===e.getAttribute("preload")&&(e.preload="none"),e.crossOrigin=e.crossOrigin||"anonymous",e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline","")}(n=e),n=n||function(e){var t=document.createElement("video");return t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline",""),t.autoplay=!0,t.loop=!0,t.crossOrigin="anonymous",t.addEventListener("error",(function(){h("`%s` is not a valid video",e)}),!0),t.src=e,t}(e),t(new r.Source(n))},hash:function(e){return e.tagName&&(e.id||e.src)||e},registerMaterial:function(e){this.materials[e.uuid]=e},unregisterMaterial:function(e){delete this.materials[e.uuid]}})},2382:(e,t,n)=>{(0,n(1876).registerSystem)("obb-collider",{schema:{showColliders:{default:!1}},init:function(){this.collisions=[],this.colliderEls=[]},addCollider:function(e){this.colliderEls.push(e),this.data.showColliders?e.components["obb-collider"].showCollider():e.components["obb-collider"].hideCollider(),this.tick=this.detectCollisions},removeCollider:function(e){var t=this.colliderEls,n=t.indexOf(e);e.components["obb-collider"].hideCollider(),n>-1&&t.splice(n,1),0===t.length&&(this.tick=void 0)},registerCollision:function(e,t){var n=this.collisions,i=!1,r=e.obb,s=t.obb,o=e.renderColliderMesh,a=t.renderColliderMesh;o&&o.material.color.set(16711680),a&&a.material.color.set(16711680);for(var l=0;l<n.length;l++)if(n[l].componentA.obb===r&&n[l].componentB.obb===s||n[l].componentA.obb===s&&n[l].componentB.obb===r){i=!0,n[l].detected=!0;break}i||(n.push({componentA:e,componentB:t,detected:!0}),e.el.emit("obbcollisionstarted",{trackedObject3D:e.trackedObject3D,withEl:t.el}),t.el.emit("obbcollisionstarted",{trackedObject3D:t.trackedObject3D,withEl:e.el}))},resetCollisions:function(){for(var e=this.collisions,t=0;t<e.length;t++)e[t].detected=!1},clearCollisions:function(){for(var e,t,n,i,r=this.collisions,s=[],o=0;o<r.length;o++)r[o].detected?s.push(r[o]):(e=r[o].componentA,t=r[o].componentB,n=e.renderColliderMesh,i=t.renderColliderMesh,n&&n.material.color.set(65280),e.el.emit("obbcollisionended",{trackedObject3D:this.trackedObject3D,withEl:t.el}),i&&i.material.color.set(65280),t.el.emit("obbcollisionended",{trackedObject3D:this.trackedObject3D,withEl:e.el}));this.collisions=s},detectCollisions:function(){var e,t,n,i,r=this.colliderEls;if(!(r.length<2)){this.resetCollisions();for(var s=0;s<r.length;s++)if(n=r[s].components["obb-collider"],0!==(e=r[s].components["obb-collider"].obb).halfSize.x&&0!==e.halfSize.y&&0!==e.halfSize.z)for(var o=s+1;o<r.length;o++)0!==(t=(i=r[o].components["obb-collider"]).obb).halfSize.x&&0!==t.halfSize.y&&0!==t.halfSize.z&&e.intersectsOBB(t)&&this.registerCollision(n,i);this.clearCollisions()}}})},6769:(e,t,n)=>{var i=n(1876).registerSystem,r=n(7427),s=n(9437),o=(0,r.debug)("components:renderer:warn");function a(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z-t.z}function l(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder-t.renderOrder}function c(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:t.z-e.z}e.exports.System=i("renderer",{schema:{antialias:{default:"auto",oneOf:["true","false","auto"]},highRefreshRate:{default:r.device.isOculusBrowser()},logarithmicDepthBuffer:{default:"auto",oneOf:["true","false","auto"]},maxCanvasWidth:{default:-1},maxCanvasHeight:{default:-1},multiviewStereo:{default:!1},exposure:{default:1,if:{toneMapping:["ACESFilmic","linear","reinhard","cineon","AgX","neutral"]}},toneMapping:{default:"no",oneOf:["no","ACESFilmic","linear","reinhard","cineon","AgX","neutral"]},precision:{default:"high",oneOf:["high","medium","low"]},anisotropy:{default:1},sortTransparentObjects:{default:!1},colorManagement:{default:!0},alpha:{default:!0},stencil:{default:!1},foveationLevel:{default:1}},init:function(){var e=this.data,t=this.el,n=this.data.toneMapping.charAt(0).toUpperCase()+this.data.toneMapping.slice(1),i=t.renderer;i.toneMapping=s[n+"ToneMapping"],s.Texture.DEFAULT_ANISOTROPY=e.anisotropy,s.ColorManagement.enabled=e.colorManagement,i.outputColorSpace=e.colorManagement?s.SRGBColorSpace:s.LinearSRGBColorSpace,t.hasAttribute("antialias")&&o('Component `antialias` is deprecated. Use `renderer="antialias: true"` instead.'),t.hasAttribute("logarithmicDepthBuffer")&&o('Component `logarithmicDepthBuffer` is deprecated. Use `renderer="logarithmicDepthBuffer: true"` instead.'),i.sortObjects=!0,i.setOpaqueSort(a)},update:function(){var e=this.data,t=this.el.renderer,n=this.data.toneMapping.charAt(0).toUpperCase()+this.data.toneMapping.slice(1);t.toneMapping=s[n+"ToneMapping"],t.toneMappingExposure=e.exposure,t.xr.setFoveation(e.foveationLevel),e.sortObjects&&o('`sortObjects` property is deprecated. Use `renderer="sortTransparentObjects: true"` instead.'),e.sortTransparentObjects?t.setTransparentSort(c):t.setTransparentSort(l)},applyColorCorrection:function(e){this.data.colorManagement&&e&&e.isTexture&&e.colorSpace!==s.SRGBColorSpace&&(e.colorSpace=s.SRGBColorSpace,e.needsUpdate=!0)},setWebXRFrameRate:function(e){var t,n=this.data,i=e.supportedFrameRates;i&&e.updateTargetFrameRate&&(t=i.includes(90)?n.highRefreshRate?90:72:n.highRefreshRate?72:60,e.updateTargetFrameRate(t).catch((function(e){console.warn("failed to set target frame rate of "+t+". Error info: "+e)})))}}),e.exports.sortFrontToBack=a,e.exports.sortRenderOrderOnly=l,e.exports.sortBackToFront=c},5426:(e,t,n)=>{var i=n(1876).registerSystem,r=n(9437),s={basic:r.BasicShadowMap,pcf:r.PCFShadowMap,pcfsoft:r.PCFSoftShadowMap};e.exports.System=i("shadow",{schema:{enabled:{default:!0},autoUpdate:{default:!0},type:{default:"pcf",oneOf:["basic","pcf","pcfsoft"]}},init:function(){var e=this.sceneEl,t=this.data;this.shadowMapEnabled=!1,e.renderer.shadowMap.type=s[t.type],e.renderer.shadowMap.autoUpdate=t.autoUpdate},update:function(e){e.enabled!==this.data.enabled&&this.setShadowMapEnabled(this.shadowMapEnabled)},setShadowMapEnabled:function(e){var t=this.sceneEl,n=this.sceneEl.renderer;this.shadowMapEnabled=e;var i=this.data.enabled&&this.shadowMapEnabled;n&&i!==n.shadowMap.enabled&&(n.shadowMap.enabled=i,function(e){e.hasLoaded&&e.object3D.traverse((function(e){if(e.material)for(var t=Array.isArray(e.material)?e.material:[e.material],n=0;n<t.length;n++)t[n].needsUpdate=!0}))}(t))}})},2941:(e,t,n)=>{var i=n(1876).registerSystem;n(7427),e.exports.System=i("tracked-controls",{init:function(){this.controllers=[],this.onInputSourcesChange=this.onInputSourcesChange.bind(this),this.onEnterVR=this.onEnterVR.bind(this),this.el.addEventListener("enter-vr",this.onEnterVR),this.onExitVR=this.onExitVR.bind(this),this.el.addEventListener("exit-vr",this.onExitVR)},onEnterVR:function(){this.el.xrSession.addEventListener("inputsourceschange",this.onInputSourcesChange)},onExitVR:function(){this.referenceSpace=void 0,this.controllers=[],this.el.emit("controllersupdated",void 0,!1)},onInputSourcesChange:function(){var e=this,t=this.el.xrSession,n=this.el.sceneEl.systems.webxr.sessionReferenceSpaceType;t.requestReferenceSpace(n).then((function(t){e.referenceSpace=t})).catch((function(t){throw e.el.sceneEl.systems.webxr.warnIfFeatureNotRequested(n,'tracked-controls uses reference space "'+n+'".'),t})),this.controllers=t.inputSources,this.el.emit("controllersupdated",void 0,!1)}})},6696:(e,t,n)=>{var i=n(1876).registerSystem,r=n(7427).debug("systems:webxr:warn");e.exports.System=i("webxr",{schema:{referenceSpaceType:{type:"string",default:"local-floor"},requiredFeatures:{type:"array",default:["local-floor"]},optionalFeatures:{type:"array",default:["bounded-floor"]},overlayElement:{type:"selector"}},update:function(){var e=this.data;this.sessionConfiguration={requiredFeatures:e.requiredFeatures,optionalFeatures:e.optionalFeatures},this.sessionReferenceSpaceType=e.referenceSpaceType,e.overlayElement&&(e.overlayElement.classList.remove("a-dom-overlay"),e.optionalFeatures.includes("dom-overlay")||(e.optionalFeatures.push("dom-overlay"),this.el.setAttribute("webxr",e)),this.warnIfFeatureNotRequested("dom-overlay"),this.sessionConfiguration.domOverlay={root:e.overlayElement},e.overlayElement.classList.add("a-dom-overlay"))},wasFeatureRequested:function(e){return"viewer"===e||"local"===e||!(!this.sessionConfiguration.requiredFeatures.includes(e)&&!this.sessionConfiguration.optionalFeatures.includes(e))},warnIfFeatureNotRequested:function(e,t){this.wasFeatureRequested(e)||r((t?t+" ":"")+'Please add the feature "'+e+"\" to a-scene's webxr system options in requiredFeatures/optionalFeatures.")}})},676:(e,t,n)=>{var i=n(8940)("utils:coordinates:warn"),r=["x","y","z","w"],s=/^\s*((-?\d*\.{0,1}\d+(e-?\d+)?)\s+){2,3}(-?\d*\.{0,1}\d+(e-?\d+)?)\s*$/;e.exports.regex=s;var o=/\s+/g;function a(e){return s.test(e)}function l(e){return null!=e&&e.constructor===String?parseFloat(e,10):e}e.exports.parse=function(e,t,n){var i,s,a,c,h,d,u,p,A=n&&"object"==typeof n?n:{};if(e&&e instanceof Object)return h=void 0===e.x?t&&t.x:e.x,d=void 0===e.y?t&&t.y:e.y,u=void 0===e.z?t&&t.z:e.z,p=void 0===e.w?t&&t.w:e.w,null!=h&&(A.x=l(h)),null!=d&&(A.y=l(d)),null!=u&&(A.z=l(u)),null!=p&&(A.w=l(p)),A;if(null==e)return"object"==typeof t?Object.assign(A,t):t;for(i=e.trim().split(o),c=0;c<r.length;c++)if(a=r[c],i[c])A[a]=parseFloat(i[c],10);else{if(void 0===(s=t&&t[a]))continue;A[a]=l(s)}return A},e.exports.stringify=function(e){var t;return"object"!=typeof e?e:(t=e.x+" "+e.y,null!=e.z&&(t+=" "+e.z),null!=e.w&&(t+=" "+e.w),t)},e.exports.equals=function(e,t){return"object"!=typeof e||"object"!=typeof t?e===t:e.x===t.x&&e.y===t.y&&e.z===t.z&&e.w===t.w},e.exports.isCoordinates=a,e.exports.isCoordinate=function(e){return i("`AFRAME.utils.isCoordinate` has been renamed to `AFRAME.utils.isCoordinates`"),a(e)},e.exports.toVector3=function(e){return new THREE.Vector3(e.x,e.y,e.z)}},8940:(e,t,n)=>{var i=n(8878),r=n(9485).isBrowserEnvironment,s={colors:{debug:"gray",error:"red",info:"gray",warn:"orange"}};i.formatArgs=function(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" "),this.useColors){var t;this.color=(t=function(e){var t=e.split(":");return t[t.length-1]}(this.namespace),s.colors&&s.colors[t]||null);var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var i=0,r=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(i++,"%c"===e&&(r=i))})),e.splice(r,0,n)}};var o=function(){try{return window.localStorage}catch(e){}}();o&&(parseInt(o.logs,10)||"true"===o.logs)?i.enable("*"):i.enable("*:error,*:info,*:warn"),r&&(window.logs=i),e.exports=i},9485:(e,t,n)=>{var i=n(8878)("device:error"),r=!1,s=!1,o=e.exports.isWebXRAvailable=void 0!==navigator.xr;if(o){var a=function(){var e=document.querySelector("a-scene");e?e.hasLoaded?e.components["xr-mode-ui"].updateEnterInterfaces():e.addEventListener("loaded",a):window.addEventListener("DOMContentLoaded",a)},l=function(e){i("WebXR session support error: "+e.message)};navigator.xr.isSessionSupported?(navigator.xr.isSessionSupported("immersive-vr").then((function(e){r=e,a()})).catch(l),navigator.xr.isSessionSupported("immersive-ar").then((function(e){s=e,a()})).catch((function(){}))):navigator.xr.supportsSession?(navigator.xr.supportsSession("immersive-vr").then((function(){r=!0,a()})).catch(l),navigator.xr.supportsSession("immersive-ar").then((function(){s=!0,a()})).catch((function(){}))):i("WebXR has neither isSessionSupported or supportsSession?!")}e.exports.checkHeadsetConnected=function(){return r||s},e.exports.checkARSupport=function(){return s},e.exports.checkVRSupport=function(){return r};var c,h,d=(h=!1,c=window.navigator.userAgent||window.navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(c)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(c.substr(0,4)))&&(h=!0),(f()||u()||y())&&(h=!0),v()&&(h=!1),function(){return h});function u(e){var t=e||window.navigator.userAgent;return/Nexus (7|9)|xoom|sch-i800|playbook|tablet|kindle/i.test(t)||p()}function p(e,t,n){var i=e||window.navigator.userAgent,r=t||window.navigator.platform,s=n||window.navigator.maxTouchPoints||0;return("iPad"===r||"MacIntel"===r)&&s>0&&/Macintosh|Intel|iPad|ipad/i.test(i)&&!window.MSStream}function A(){var e=navigator.userAgent.includes("Macintosh"),t=5===navigator.maxTouchPoints;return e&&t&&o}function f(){return/iPad|iPhone|iPod/.test(window.navigator.platform)}function m(){return/(OculusBrowser)/i.test(window.navigator.userAgent)}function g(){return/(Mobile VR)/i.test(window.navigator.userAgent)}function v(){return m()||g()||A()}function y(){return/R7 Build/.test(window.navigator.userAgent)}e.exports.isMobile=d,e.exports.isTablet=u,e.exports.isIpad=p,e.exports.isAppleVisionPro=A,e.exports.isIOS=f,e.exports.isMobileDeviceRequestingDesktopSite=function(){return!d()&&!v()&&void 0!==window.orientation},e.exports.isOculusBrowser=m,e.exports.isFirefoxReality=g,e.exports.isMobileVR=v,e.exports.isR7=y,e.exports.isLandscape=function(){var e=window.orientation;return y()&&(e+=90),90===e||-90===e},e.exports.isBrowserEnvironment="undefined"==typeof process||!0===process.browser,e.exports.isNodeEnvironment=!e.exports.isBrowserEnvironment},7264:(e,t,n)=>{var i=n(8183).split;function r(e,t){var n=i(e,t=t||".");return 1===n.length?n[0]:n}e.exports.getComponentPropertyPath=r,e.exports.getComponentProperty=function(e,t,n){var i;return n=n||".",-1!==t.indexOf(n)?(i=r(t,n)).constructor===String?e.getAttribute(i):e.getAttribute(i[0])[i[1]]:e.getAttribute(t)},e.exports.setComponentProperty=function(e,t,n,i){var s;i=i||".",-1===t.indexOf(i)?e.setAttribute(t,n):(s=r(t,i)).constructor===String?e.setAttribute(s,n):e.setAttribute(s[0],s[1],n)}},9202:e=>{e.exports=function(e){var t=e.style.width,n=e.style.height;e.style.width=parseInt(t,10)+1+"px",e.style.height=parseInt(n,10)+1+"px",setTimeout((function(){e.style.width=t,e.style.height=n}),200)}},7427:(e,t,n)=>{var i=n(8940),r=n(1124),s=n(9485),o=n(1451),a=i("utils:warn");e.exports.bind=function(e){return e.bind.apply(e,Array.prototype.slice.call(arguments,1))},e.exports.coordinates=n(676),e.exports.debug=i,e.exports.device=s,e.exports.entity=n(7264),e.exports.forceCanvasResizeSafariMobile=n(9202),e.exports.material=n(8066),e.exports.objectPool=o,e.exports.split=n(8183).split,e.exports.styleParser=n(3845),e.exports.trackedControls=n(7960),e.exports.checkHeadsetConnected=function(){return a("`utils.checkHeadsetConnected` has moved to `utils.device.checkHeadsetConnected`"),s.checkHeadsetConnected(arguments)},e.exports.isGearVR=e.exports.device.isGearVR=function(){a("`utils.isGearVR` has been deprecated, use `utils.device.isMobileVR`")},e.exports.isIOS=function(){return a("`utils.isIOS` has moved to `utils.device.isIOS`"),s.isIOS(arguments)},e.exports.isOculusGo=e.exports.device.isOculusGo=function(){a("`utils.isOculusGo` has been deprecated, use `utils.device.isMobileVR`")},e.exports.isMobile=function(){return a("`utils.isMobile has moved to `utils.device.isMobile`"),s.isMobile(arguments)},e.exports.throttle=function(e,t,n){var i;return n&&(e=e.bind(n)),function(){var n=Date.now();(void 0===i||(void 0===i?t:n-i)>=t)&&(i=n,e.apply(null,arguments))}},e.exports.throttleLeadingAndTrailing=function(e,t,n){var i,r,s;n&&(e=e.bind(n));var o=function(){i=Date.now(),e.apply(this,s),r=void 0};return function(){var n=Date.now(),a=void 0===i?t:n-i;a>=t?(clearTimeout(r),r=void 0,i=n,e.apply(null,arguments)):(r=r||setTimeout(o,t-a),s=arguments)}},e.exports.throttleTick=function(e,t,n){var i;return n&&(e=e.bind(n)),function(n,r){var s=void 0===i?r:n-i;(void 0===i||s>=t)&&(i=n,e(n,s))}},e.exports.debounce=function(e,t,n){var i;return function(){var r=this,s=arguments,o=n&&!i;clearTimeout(i),i=setTimeout((function(){i=null,n||e.apply(r,s)}),t),o&&e.apply(r,s)}},e.exports.extend=Object.assign,e.exports.extendDeep=r,e.exports.clone=function(e){return JSON.parse(JSON.stringify(e))};var l,c,h=(l=o.createPool((function(){return[]})),function(e,t){var n,i,r,s,o,a;if(void 0===e||void 0===t||null===e||null===t||!(e&&t&&e.constructor===Object&&t.constructor===Object||e.constructor===Array&&t.constructor===Array))return e===t;for(n in i=l.use(),r=l.use(),i.length=0,r.length=0,e)i.push(n);for(n in t)r.push(n);if(i.length!==r.length)return l.recycle(i),l.recycle(r),!1;for(s=0;s<i.length;++s)if(o=e[i[s]],a=t[i[s]],"object"==typeof o||"object"==typeof a||Array.isArray(o)&&Array.isArray(a)){if(o===a)continue;if(!h(o,a))return l.recycle(i),l.recycle(r),!1}else if(o!==a)return l.recycle(i),l.recycle(r),!1;return l.recycle(i),l.recycle(r),!0});e.exports.deepEqual=h,e.exports.diff=(c=[],function(e,t,n){var i,r,s,o,a,l,d;for(a in o=n||{},c.length=0,e)c.push(a);if(!t)return o;for(s in t)-1===c.indexOf(s)&&c.push(s);for(l=0;l<c.length;l++)i=e[a=c[l]],r=t[a],((d=i&&r&&i.constructor===Object&&r.constructor===Object)&&!h(i,r)||!d&&i!==r)&&(o[a]=r);return o}),e.exports.shouldCaptureKeyEvent=function(e){return!e.metaKey&&document.activeElement===document.body},e.exports.splitString=function(e,t){void 0===t&&(t=" ");var n=new RegExp(t,"g");return(e=(e||"").replace(n,t)).split(t)},e.exports.getElData=function(e,t){t=t||{};var n={};return Object.keys(t).forEach((function(t){e.hasAttribute(t)&&(n[t]=e.getAttribute(t))})),n},e.exports.getUrlParameter=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},e.exports.isIframed=function(){return window.top!==window.self},e.exports.findAllScenes=function(e){for(var t=[],n=e.getElementsByTagName("*"),i=0,r=n.length;i<r;i++)n[i].isScene&&t.push(n[i]);return t},e.exports.srcLoader=n(1857)},1957:()=>{window.addEventListener("orientationchange",(function(){document.documentElement.style.height="initial",setTimeout((function(){document.documentElement.style.height="100%",setTimeout((function(){window.scrollTo(0,1)}),500)}),500)}))},8066:(e,t,n)=>{var i=n(9437),r=n(1857),s=n(8940)("utils:material:warn"),o=new Set(["emissiveMap","envMap","map","specularMap"]);function a(e,t){var n=t.offset||{x:0,y:0},r=t.repeat||{x:1,y:1},s=t.npot||!1,o=t.anisotropy||i.Texture.DEFAULT_ANISOTROPY,a=e.wrapS,l=e.wrapT,c=e.magFilter,h=e.minFilter;s&&(a=i.ClampToEdgeWrapping,l=i.ClampToEdgeWrapping,c=i.LinearFilter,h=i.LinearFilter),1===r.x&&1===r.y||(a=i.RepeatWrapping,l=i.RepeatWrapping),e.offset.set(n.x,n.y),e.repeat.set(r.x,r.y),e.wrapS===a&&e.wrapT===l&&e.magFilter===c&&e.minFilter===h&&e.anisotropy===o||(e.wrapS=a,e.wrapT=l,e.magFilter=c,e.minFilter=h,e.anisotropy=o,e.needsUpdate=!0)}e.exports.setTextureProperties=a,e.exports.updateMapMaterialFromData=function(e,t,n,r){var s=n.el,l=n.material,u=s.sceneEl.systems.renderer,p=r[t];if(n.materialSrcs||(n.materialSrcs={}),!p)return delete n.materialSrcs[e],void A(null);function A(t){l[e]!==t&&(l[e]&&l[e].dispose(),l[e]=t,l.needsUpdate=!0,c(s,t))}p===n.materialSrcs[e]&&l[e]?a(l[e],r):(n.materialSrcs[e]=p,p instanceof i.Texture?A(p):s.sceneEl.systems.material.loadTextureSource(p,(function(t){if(n.materialSrcs[e]===p){var i=l[e];!i||null!==t&&h(i,t)||(i=null),!i&&t&&(i=d(t)),i&&(i.source!==t&&(i.source=t,i.needsUpdate=!0),o.has(e)&&u.applyColorCorrection(i),a(i,r)),A(i)}})))},e.exports.updateMap=function(t,n){return e.exports.updateMapMaterialFromData("map","src",t,n)},e.exports.updateDistortionMap=function(t,n,i){var r=t;"ambientOcclusion"===t&&(r="ao");var s={};return s.src=i[t+"Map"],s.offset=i[t+"TextureOffset"],s.repeat=i[t+"TextureRepeat"],s.wrap=i[t+"TextureWrap"],e.exports.updateMapMaterialFromData(r+"Map","src",n,s)};var l={};function c(e,t){function n(){e.emit("materialvideoloadeddata",{src:t.image,texture:t})}function i(){e.emit("materialvideoended",{src:t.image,texture:t})}t&&(e.emit("materialtextureloaded",{src:t.image,texture:t}),t.image&&"VIDEO"===t.image.tagName&&(t.image.addEventListener("loadeddata",n),t.image.addEventListener("ended",i),t.addEventListener("dispose",(function(){t.image.removeEventListener("loadeddata",n),t.image.removeEventListener("ended",i)}))))}function h(e,t){return e.source===t&&(t.data instanceof HTMLCanvasElement?e.isCanvasTexture:t.data instanceof HTMLVideoElement?e.isVideoTexture:e.isTexture&&!e.isCanvasTexture&&!e.isVideoTexture)}function d(e){var t;return(t=e.data instanceof HTMLCanvasElement?new i.CanvasTexture:e.data instanceof HTMLVideoElement?new i.VideoTexture(e.data):new i.Texture).source=e,t.needsUpdate=!0,t}e.exports.updateEnvMap=function(e,t){var n=e.material,o=e.el,a="envMap",h=t.envMap,d=t.sphericalEnvMap,u=t.refract;if(d&&(h=d,s("`sphericalEnvMap` property is deprecated, using spherical map as equirectangular map instead. Use `envMap` property with a CubeMap or Equirectangular image instead.")),e.materialSrcs||(e.materialSrcs={}),!h)return delete e.materialSrcs[a],n.envMap=null,void(n.needsUpdate=!0);function p(t){e.materialSrcs[a]===h&&(n.envMap=t,n.needsUpdate=!0,c(o,t))}e.materialSrcs[a]=h,l[h]?l[h].then(p):l[h]=new Promise((function(e){r.validateEnvMapSrc(h,(function(t){o.sceneEl.systems.material.loadCubeMapTexture(t,(function(t){t.mapping=u?i.CubeRefractionMapping:i.CubeReflectionMapping,p(t),e(t)}))}),(function(t){o.sceneEl.systems.material.loadTexture(t,{src:t},(function(t){t.mapping=u?i.EquirectangularRefractionMapping:i.EquirectangularReflectionMapping,p(t),e(t)}))}))}))},e.exports.handleTextureEvents=c,e.exports.isCompatibleTexture=h,e.exports.createCompatibleTexture=d},3657:e=>{function t(e,t,n){return(t.dot(e)-t.dot(n))/t.length()}e.exports.distanceOfPointFromPlane=t,e.exports.nearestPointInPlane=function(e,n,i,r){var s=t(e,n,i);return r.copy(n),r.multiplyScalar(s),r.add(i),r}},1451:e=>{var t=Object.freeze(Object.create(null));function n(){return{}}function i(e){var t;if(e&&e.constructor===Object)for(t in e)e[t]=void 0}e.exports.createPool=function(e){var r=[],s=null;function o(t){var n,i;if((t=void 0===t?r.length:t)>0&&null==s&&(s=0),t>0)for(n=r.length,r.length+=Number(t),i=n;i<r.length;i++)r[i]=e();return r.length}return e=e||n,{grow:o,pool:r,recycle:function(e){e instanceof Object&&(null!==s&&-1!==s?r[--s]=e:r[r.length]=e)},size:function(){return r.length},use:function(){var e;return null!==s&&s!==r.length||o(r.length||5),e=r[s],r[s++]=t,i(e),e}}},e.exports.clearObject=i,e.exports.removeUnusedKeys=function(e,t){var n;if(e&&e.constructor===Object)for(n in e)n in t||delete e[n]}},8183:e=>{var t;e.exports.split=(t={},function(e,n){return n in t||(t[n]={}),e in t[n]||(t[n][e]=e.split(n)),t[n][e]})},1857:(e,t,n)=>{var i=n(8940)("utils:src-loader:warn");function r(e,t,n){!function(e,t){var n;e.tagName?t("IMG"===e.tagName):((n=new XMLHttpRequest).open("HEAD",e),n.addEventListener("load",(function(i){var r;n.status>=200&&n.status<300?null==(r=n.getResponseHeader("Content-Type"))?a(e,t):r.startsWith("image")?t(!0):t(!1):a(e,t),n.abort()})),n.send())}(e,(function(i){i?t(e):n(e)}))}function s(e,t,n){var s,a,l,c="",h=[];if("string"==typeof e){for(a=0;a<5;a++)c+="(url\\((?:[^\\)]+)\\),\\s*)";function d(e){h.push(e),6===h.length&&t(h)}if(c+="(url\\((?:[^\\)]+)\\)\\s*)",l=e.match(new RegExp(c))){for(a=1;a<7;a++)r(o(l[a]),d);return}if(!e.startsWith("#"))return void r(o(e)||e,n)}if(s=e.tagName?e:function(e){try{var t=document.querySelector(e);return t||i('No element was found matching the selector: "%s"',e),t}catch(t){return void i('"%s" is not a valid selector',e)}}(e))return"A-CUBEMAP"===s.tagName&&s.srcs?t(s.srcs):"IMG"===s.tagName?n(s):void i('Selector "%s" does not point to <a-cubemap> or <img>',e)}function o(e){var t=e.match(/url\((.+)\)/);if(t)return t[1]}function a(e,t){var n=new Image;n.addEventListener("load",(function(){t(!0)})),n.addEventListener("error",(function(){t(!1)})),n.src=e}e.exports={parseUrl:o,validateSrc:r,validateCubemapSrc:function(e,t){return s(e,t,(function(){i("Expected cubemap but got image")}))},validateEnvMapSrc:s}},3845:e=>{var t=/-([a-z])/g;function n(e){return e.replace(t,o)}e.exports.parse=function(e,t){var i;return"string"!=typeof e?e:(i=function(e,t){var i,r,o,a,l,c;for(t=t||{},i=s(e),r=0;r<i.length;r++)(o=i[r])&&(a=o.indexOf(":"),l=o.substr(0,a).trim(),c=o.substr(a+1).trim(),t[n(l)]=c);return t}(e,t),i[""]?e:i)},e.exports.stringify=function(e){return"string"==typeof e?e:function(e){var t,n=0,i=0,r="";for(t in e)n++;for(t in e)r+=t+": "+e[t],i<n-1&&(r+="; "),i++;return r}(e)},e.exports.toCamelCase=n;var i,r,s=(i=[],r=/url\([^)]+$/,function(e){var t,n="",s=0;for(i.length=0;s<e.length;)-1===(t=e.indexOf(";",s))&&(t=e.length),n+=e.substring(s,t),r.test(n)?(n+=";",s=t+1):(i.push(n.trim()),n="",s=t+1);return i});function o(e){return e[1].toUpperCase()}},7960:e=>{var t=["x","y","z","w"];function n(e,t,n){var r,s=e.el.sceneEl,o=s&&s.systems["tracked-controls"];return!!o&&!(!(r=o.controllers)||!r.length)&&i(r,t,n.hand,n.index,n.iterateControllerProfiles,n.handTracking)}function i(e,t,n,i,r,s){var o,a,l,c,h=!1;for(o=0;o<e.length;o++){if(c=(l=e[o]).profiles,s)h=l.hand;else if(r)for(a=0;a<c.length&&!(h=c[a].startsWith(t));a++);else h=c.length>0&&c[0].startsWith(t);if(h)if("right"===l.handedness||"left"===l.handedness){if(l.handedness===n)return e[o]}else if(o===i)return e[o]}}e.exports.checkControllerPresentAndSetup=function(e,t,i){var r,s,o=e.el;if((s=!!(r=n(e,t,i)))===e.controllerPresent)return s;e.controllerPresent=s,s?(e.addEventListeners(),e.injectTrackedControls(r),o.emit("controllerconnected",{name:e.name,component:e})):(e.removeEventListeners(),o.emit("controllerdisconnected",{name:e.name,component:e}))},e.exports.isControllerPresentWebXR=n,e.exports.findMatchingControllerWebXR=i,e.exports.emitIfAxesChanged=function(e,n,i){var r,s,o,a,l;for(s in n){for(r=n[s],o=!1,l=0;l<r.length;l++)i.detail.changed[r[l]]&&(o=!0);if(o){for(a={},l=0;l<r.length;l++)a[t[l]]=i.detail.axis[r[l]];e.el.emit(s+"moved",a)}}},e.exports.onButtonEvent=function(e,t,n,i){var r=(i?n.mapping[i]:n.mapping).buttons[e];n.el.emit(r+t),n.updateModel&&n.updateModel(r,t)}},7469:()=>{THREE.DeviceOrientationControls=function(e){var t=this;this.object=e,this.object.rotation.reorder("YXZ"),this.enabled=!0,this.deviceOrientation={},this.screenOrientation=0,this.alphaOffset=0;var n,i,r,s,o=function(e){t.deviceOrientation=e},a=function(){t.screenOrientation=window.orientation||0},l=(n=new THREE.Vector3(0,0,1),i=new THREE.Euler,r=new THREE.Quaternion,s=new THREE.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),function(e,t,o,a,l){i.set(o,t,-a,"YXZ"),e.setFromEuler(i),e.multiply(s),e.multiply(r.setFromAxisAngle(n,-l))});this.connect=function(){a(),window.addEventListener("orientationchange",a,!1),window.addEventListener("deviceorientation",o,!1),t.enabled=!0},this.disconnect=function(){window.removeEventListener("orientationchange",a,!1),window.removeEventListener("deviceorientation",o,!1),t.enabled=!1},this.update=function(){if(!1!==t.enabled){var e=t.deviceOrientation;if(e){var n=e.alpha?THREE.MathUtils.degToRad(e.alpha)+t.alphaOffset:0,i=e.beta?THREE.MathUtils.degToRad(e.beta):0,r=e.gamma?THREE.MathUtils.degToRad(e.gamma):0,s=t.screenOrientation?THREE.MathUtils.degToRad(t.screenOrientation):0;l(t.object.quaternion,n,i,r,s)}}},this.dispose=function(){t.disconnect()},this.connect()}},3729:e=>{window.glStats=function(){var e=null,t=0,n=0,i=0,r=0,s=0,o=0,a=0;function l(e,t){return function(){t.apply(this,arguments),e.apply(this,arguments)}}return WebGLRenderingContext.prototype.drawArrays=l(WebGLRenderingContext.prototype.drawArrays,(function(){t++,arguments[0]==this.POINTS?o+=arguments[2]:s+=arguments[2]})),WebGLRenderingContext.prototype.drawElements=l(WebGLRenderingContext.prototype.drawElements,(function(){n++,r+=arguments[1]/3,s+=arguments[1]})),WebGLRenderingContext.prototype.useProgram=l(WebGLRenderingContext.prototype.useProgram,(function(){i++})),WebGLRenderingContext.prototype.bindTexture=l(WebGLRenderingContext.prototype.bindTexture,(function(){a++})),{update:function(){e("allcalls").set(t+n),e("drawElements").set(n),e("drawArrays").set(t),e("bindTexture").set(a),e("useProgram").set(i),e("glfaces").set(r),e("glvertices").set(s),e("glpoints").set(o)},start:function(){t=0,n=0,i=0,r=0,s=0,o=0,a=0},end:function(){},attach:function(t){e=t},values:{allcalls:{over:3e3,caption:"Calls (hook)"},drawelements:{caption:"drawElements (hook)"},drawarrays:{caption:"drawArrays (hook)"}},groups:[{caption:"WebGL",values:["allcalls","drawelements","drawarrays","useprogram","bindtexture","glfaces","glvertices","glpoints"]}],fractions:[{base:"allcalls",steps:["drawelements","drawarrays"]}]}},window.threeStats=function(e){var t=null;return{update:function(){t("renderer.info.memory.geometries").set(e.info.memory.geometries),t("renderer.info.programs").set(e.info.programs.length),t("renderer.info.memory.textures").set(e.info.memory.textures),t("renderer.info.render.calls").set(e.info.render.calls),t("renderer.info.render.triangles").set(e.info.render.triangles),t("renderer.info.render.points").set(e.info.render.points)},start:function(){},end:function(){},attach:function(e){t=e},values:{"renderer.info.memory.geometries":{caption:"Geometries"},"renderer.info.memory.textures":{caption:"Textures"},"renderer.info.programs":{caption:"Programs"},"renderer.info.render.calls":{caption:"Calls"},"renderer.info.render.triangles":{caption:"Triangles",over:1e3},"renderer.info.render.points":{caption:"Points"}},groups:[{caption:"Three.js - Memory",values:["renderer.info.memory.geometries","renderer.info.programs","renderer.info.memory.textures"]},{caption:"Three.js - Render",values:["renderer.info.render.calls","renderer.info.render.triangles","renderer.info.render.points"]}],fractions:[]}},window.BrowserStats=function(){var e=null,t=0,n=0;window.performance&&!performance.memory&&(performance.memory={usedJSHeapSize:0,totalJSHeapSize:0}),0===performance.memory.totalJSHeapSize&&console.warn("totalJSHeapSize === 0... performance.memory is only available in Chrome .");var i=Math.log(1024);function r(e){var t=Math.floor(Math.log(e)/i);return Math.round(100*e/Math.pow(1024,t))/100}return{update:function(){t=r(performance.memory.usedJSHeapSize),n=r(performance.memory.totalJSHeapSize),e("memory").set(t),e("total").set(n)},start:function(){t=0},end:function(){},attach:function(t){e=t},values:{memory:{caption:"Used Memory",average:!0,avgMs:1e3,over:22},total:{caption:"Total Memory"}},groups:[{caption:"Browser",values:["memory","total"]}],fractions:[{base:"total",steps:["memory"]}]}},e.exports={glStats:window.glStats,threeStats:window.threeStats,BrowserStats:window.BrowserStats}},282:e=>{"use strict";!function(){"performance"in window==0&&(window.performance={});var e=window.performance;if("now"in e==0){var t=Date.now();e.timing&&e.timing.navigationStart&&(t=e.timing.navigationStart),e.now=function(){return Date.now()-t}}e.mark||(e.mark=function(){}),e.measure||(e.measure=function(){})}(),window.rStats=function(e){function t(e,t){for(var n=Object.keys(e),i=0,r=n.length;i<r;i++)t(n[i])}var n=e||{},i=n.colours||["#850700","#c74900","#fcb300","#284280","#4c7c0c"],r=(n.CSSPath?n.CSSPath:"")+"rStats.css";(n.css||["https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300",r]).forEach((function(e){var t,n;t=e,(n=document.createElement("link")).href=t,n.rel="stylesheet",n.type="text/css",document.getElementsByTagName("head")[0].appendChild(n)})),n.values||(n.values={});var s,o,a=10,l={};function c(e,t,n){var i=n||{},r=document.createElement("canvas"),s=r.getContext("2d"),o=0,l=0,c=i.color?i.color:"#666666",h=document.createElement("canvas"),d=h.getContext("2d");h.width=1,h.height=20,d.fillStyle="#444444",d.fillRect(0,0,1,20),d.fillStyle=c,d.fillRect(0,a,1,a),d.fillStyle="#ffffff",d.globalAlpha=.5,d.fillRect(0,a,1,1),d.globalAlpha=1;var u=document.createElement("canvas"),p=u.getContext("2d");return u.width=1,u.height=20,p.fillStyle="#444444",p.fillRect(0,0,1,20),p.fillStyle="#b70000",p.fillRect(0,a,1,a),p.globalAlpha=.5,p.fillStyle="#ffffff",p.fillRect(0,a,1,1),p.globalAlpha=1,r.width=200,r.height=a,r.style.width=r.width+"px",r.style.height=r.height+"px",r.className="rs-canvas",e.appendChild(r),s.fillStyle="#444444",s.fillRect(0,0,r.width,r.height),{draw:function(e,t){(l+=.1*(e-l))>(o*=.99)&&(o=l),s.drawImage(r,1,0,r.width-1,r.height,0,0,r.width-1,r.height),t?s.drawImage(u,r.width-1,r.height-l*r.height/o-a):s.drawImage(h,r.width-1,r.height-l*r.height/o-a)}}}function h(e,n){var r=document.createElement("canvas"),s=r.getContext("2d");return r.width=200,r.height=a*n,r.style.width=r.width+"px",r.style.height=r.height+"px",r.className="rs-canvas",e.appendChild(r),s.fillStyle="#444444",s.fillRect(0,0,r.width,r.height),{draw:function(e){s.drawImage(r,1,0,r.width-1,r.height,0,0,r.width-1,r.height);var n=0;t(e,(function(t){var o=e[t]*r.height;s.fillStyle=i[t],s.fillRect(r.width-1,n,1,o),n+=o}))}}}function d(e,t){var i,r=e,s=0,a=0,l=0,h=0,d=performance.now(),u=0,p=document.createElement("div"),A=document.createElement("span"),f=document.createElement("div"),m=document.createTextNode(""),g=n?n.values[r.toLowerCase()]:null,v=new c(p,r,g),y=!1;function E(e){if(g&&g.average){h+=e,u++;var t=performance.now();t-d>=(g.avgMs||1e3)&&(l=h/u,h=0,d=t,u=0)}}function x(){i=performance.now(),n.userTimingAPI&&performance.mark(r+"-start"),y=!0}function b(){s=performance.now()-i,n.userTimingAPI&&(performance.mark(r+"-end"),y&&performance.measure(r,r+"-start",r+"-end")),E(s)}return A.className="rs-counter-id",A.textContent=g&&g.caption?g.caption:r,f.className="rs-counter-value",f.appendChild(m),p.appendChild(A),p.appendChild(f),t?t.div.appendChild(p):o.appendChild(p),i=performance.now(),{set:function(e){E(s=e)},start:x,tick:function(){b(),x()},end:b,frame:function(){var e=performance.now(),t=e-i;a++,t>1e3&&(s=g&&!1===g.interpolate?a:1e3*a/t,a=0,i=e,E(s))},value:function(){return s},draw:function(){var e=g&&g.average?l:s;m.nodeValue=Math.round(100*e)/100;var t=g&&(g.below&&s<g.below||g.over&&s>g.over);v.draw(s,t),p.className=t?"rs-counter-base alarm":"rs-counter-base"}}}function u(e){var i=e.toLowerCase();if(void 0===i&&(i="default"),l[i])return l[i];var r=null;n&&n.groups&&t(n.groups,(function(e){var t=n.groups[parseInt(e,10)];r||-1===t.values.indexOf(i.toLowerCase())||(r=t)}));var s=new d(i,r);return l[i]=s,s}function p(){t(n.plugins,(function(e){n.plugins[e].update()})),t(l,(function(e){l[e].draw()})),n&&n.fractions&&t(n.fractions,(function(e){var i=n.fractions[parseInt(e,10)],r=[],s=l[i.base.toLowerCase()];s&&(s=s.value(),t(n.fractions[e].steps,(function(t){var i=n.fractions[e].steps[parseInt(t,10)].toLowerCase(),o=l[i];o&&r.push(o.value()/s)}))),i.graph.draw(r)}))}return function(){if(n.plugins){n.values||(n.values={}),n.groups||(n.groups=[]),n.fractions||(n.fractions=[]);for(var e=0;e<n.plugins.length;e++)n.plugins[e].attach(u),t(n.plugins[e].values,(function(t){n.values[t]=n.plugins[e].values[t]})),n.groups=n.groups.concat(n.plugins[e].groups),n.fractions=n.fractions.concat(n.plugins[e].fractions)}else n.plugins={};(s=document.createElement("div")).className="rs-base",(o=document.createElement("div")).className="rs-container",o.style.height="auto",s.appendChild(o),document.body.appendChild(s),n&&(n.groups&&t(n.groups,(function(e){var t=n.groups[parseInt(e,10)],i=document.createElement("div");i.className="rs-group",t.div=i;var r=document.createElement("h1");r.textContent=t.caption,r.addEventListener("click",function(e){this.classList.toggle("hidden"),e.preventDefault()}.bind(i)),o.appendChild(r),o.appendChild(i)})),n.fractions&&t(n.fractions,(function(e){var r=n.fractions[parseInt(e,10)],s=document.createElement("div");s.className="rs-fraction";var l=document.createElement("div");l.className="rs-legend";var c=0;t(n.fractions[e].steps,(function(t){var r=document.createElement("p");r.textContent=n.fractions[e].steps[t],r.style.color=i[c],l.appendChild(r),c++})),s.appendChild(l),s.style.height=c*a+"px",r.div=s;var d=new h(s,c);r.graph=d,o.appendChild(s)})))}(),function(e){return e?u(e):{element:s,update:p}}},e.exports=window.rStats},2535:e=>{var t={base64:function(e,t){return"data:"+e+";base64,"+t},isMobile:function(){var e,t=!1;return e=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0),t},isIOS:function(){return/(iPad|iPhone|iPod)/g.test(navigator.userAgent)},isIFrame:function(){try{return window.self!==window.top}catch(e){return!0}},appendQueryParameter:function(e,t,n){var i=e.indexOf("?")<0?"?":"&";return e+(i+t+"=")+n},getQueryParameter:function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},isLandscapeMode:function(){return 90==window.orientation||-90==window.orientation}};e.exports=t},5928:(e,t,n)=>{var i,r=n(2535);e.exports=(i=navigator.userAgent||navigator.vendor||window.opera).match(/iPhone/i)||i.match(/iPod/i)?function(){var e=null;this.request=function(){e||(e=setInterval((function(){window.location.href="/",setTimeout(window.stop,0)}),15e3))},this.release=function(){e&&(clearInterval(e),e=null)}}:function(){var e=document.createElement("video");e.addEventListener("ended",(function(){e.play()})),this.request=function(){e.paused&&(e.src=r.base64("video/webm","GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4ECQoWBAhhTgGcBAAAAAAAH4xFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsggfG7AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU2LjQwLjEwMVdBjUxhdmY1Ni40MC4xMDFzpJAGSJTMbsLpDt/ySkipgX1fRImIQO1MAAAAAAAWVK5rAQAAAAAAADuuAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDmDgQEj44OEO5rKAOABAAAAAAAABrCBsLqBkB9DtnUBAAAAAAAAo+eBAKOmgQAAgKJJg0IAAV4BHsAHBIODCoAACmH2MAAAZxgz4dPSTFi5JACjloED6ACmAECSnABMQAADYAAAWi0quoCjloEH0ACmAECSnABNwAADYAAAWi0quoCjloELuACmAECSnABNgAADYAAAWi0quoCjloEPoACmAECSnABNYAADYAAAWi0quoCjloETiACmAECSnABNIAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTnghdwo5aBAAAApgBAkpwATOAAA2AAAFotKrqAo5aBA+gApgBAkpwATMAAA2AAAFotKrqAo5aBB9AApgBAkpwATIAAA2AAAFotKrqAo5aBC7gApgBAkpwATEAAA2AAAFotKrqAo5aBD6AApgDAkpwAQ2AAA2AAAFotKrqAo5aBE4gApgBAkpwATCAAA2AAAFotKrqAH0O2dQEAAAAAAACU54Iu4KOWgQAAAKYAQJKcAEvAAANgAABaLSq6gKOWgQPoAKYAQJKcAEtgAANgAABaLSq6gKOWgQfQAKYAQJKcAEsAAANgAABaLSq6gKOWgQu4AKYAQJKcAEqAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEogAANgAABaLSq6gKOWgROIAKYAQJKcAEnAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCRlCjloEAAACmAECSnABJgAADYAAAWi0quoCjloED6ACmAECSnABJIAADYAAAWi0quoCjloEH0ACmAMCSnABDYAADYAAAWi0quoCjloELuACmAECSnABI4AADYAAAWi0quoCjloEPoACmAECSnABIoAADYAAAWi0quoCjloETiACmAECSnABIYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngl3Ao5aBAAAApgBAkpwASCAAA2AAAFotKrqAo5aBA+gApgBAkpwASAAAA2AAAFotKrqAo5aBB9AApgBAkpwAR8AAA2AAAFotKrqAo5aBC7gApgBAkpwAR4AAA2AAAFotKrqAo5aBD6AApgBAkpwAR2AAA2AAAFotKrqAo5aBE4gApgBAkpwARyAAA2AAAFotKrqAH0O2dQEAAAAAAACU54J1MKOWgQAAAKYAwJKcAENgAANgAABaLSq6gKOWgQPoAKYAQJKcAEbgAANgAABaLSq6gKOWgQfQAKYAQJKcAEagAANgAABaLSq6gKOWgQu4AKYAQJKcAEaAAANgAABaLSq6gKOWgQ+gAKYAQJKcAEZAAANgAABaLSq6gKOWgROIAKYAQJKcAEYAAANgAABaLSq6gB9DtnUBAAAAAAAAlOeCjKCjloEAAACmAECSnABF4AADYAAAWi0quoCjloED6ACmAECSnABFwAADYAAAWi0quoCjloEH0ACmAECSnABFoAADYAAAWi0quoCjloELuACmAECSnABFgAADYAAAWi0quoCjloEPoACmAMCSnABDYAADYAAAWi0quoCjloETiACmAECSnABFYAADYAAAWi0quoAfQ7Z1AQAAAAAAAJTngqQQo5aBAAAApgBAkpwARUAAA2AAAFotKrqAo5aBA+gApgBAkpwARSAAA2AAAFotKrqAo5aBB9AApgBAkpwARQAAA2AAAFotKrqAo5aBC7gApgBAkpwARQAAA2AAAFotKrqAo5aBD6AApgBAkpwAROAAA2AAAFotKrqAo5aBE4gApgBAkpwARMAAA2AAAFotKrqAH0O2dQEAAAAAAACU54K7gKOWgQAAAKYAQJKcAESgAANgAABaLSq6gKOWgQPoAKYAQJKcAESAAANgAABaLSq6gKOWgQfQAKYAwJKcAENgAANgAABaLSq6gKOWgQu4AKYAQJKcAERgAANgAABaLSq6gKOWgQ+gAKYAQJKcAERAAANgAABaLSq6gKOWgROIAKYAQJKcAEQgAANgAABaLSq6gB9DtnUBAAAAAAAAlOeC0vCjloEAAACmAECSnABEIAADYAAAWi0quoCjloED6ACmAECSnABEAAADYAAAWi0quoCjloEH0ACmAECSnABD4AADYAAAWi0quoCjloELuACmAECSnABDwAADYAAAWi0quoCjloEPoACmAECSnABDoAADYAAAWi0quoCjloETiACmAECSnABDgAADYAAAWi0quoAcU7trAQAAAAAAABG7j7OBALeK94EB8YIBd/CBAw=="),e.play())},this.release=function(){e.pause(),e.src=""}}},8217:(e,t,n)=>{"use strict";n.d(t,{A:()=>E});var i=n(963),r=n.n(i),s=n(9089),o=n.n(s),a=n(6492),l=n.n(a),c=new URL(n(9169),n.b),h=new URL(n(6085),n.b),d=new URL(n(3931),n.b),u=new URL(n(7889),n.b),p=new URL(n(6517),n.b),A=o()(r()),f=l()(c),m=l()(h),g=l()(d),v=l()(u),y=l()(p);A.push([e.id,`/* .a-fullscreen means not embedded. */\nhtml.a-fullscreen {\n bottom: 0;\n left: 0;\n position: fixed;\n right: 0;\n top: 0;\n}\n\nhtml.a-fullscreen body {\n height: 100%;\n margin: 0;\n overflow: hidden;\n padding: 0;\n width: 100%;\n}\n\n/* Class is removed when doing <a-scene embedded>. */\nhtml.a-fullscreen .a-canvas {\n width: 100% !important;\n height: 100% !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n position: fixed !important;\n}\n\nhtml:not(.a-fullscreen) .a-enter-vr,\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 5px;\n bottom: 5px;\n}\n\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 60px;\n}\n\n/* In chrome mobile the user agent stylesheet set it to white */\n:-webkit-full-screen {\n background-color: transparent;\n}\n\n.a-hidden {\n display: none !important;\n}\n\n.a-canvas {\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.a-canvas.a-grab-cursor:hover {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\ncanvas.a-canvas.a-mouse-cursor-hover:hover {\n cursor: pointer;\n}\n\n.a-inspector-loader {\n background-color: #ed3160;\n position: fixed;\n left: 3px;\n top: 3px;\n padding: 6px 10px;\n color: #fff;\n text-decoration: none;\n font-size: 12px;\n font-family: Roboto,sans-serif;\n text-align: center;\n z-index: 99999;\n width: 204px;\n}\n\n/* Inspector loader animation */\n@keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n@-webkit-keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@-webkit-keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@-webkit-keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n\n.a-inspector-loader .dots span {\n animation: dots-1 2s infinite steps(1);\n -webkit-animation: dots-1 2s infinite steps(1);\n}\n\n.a-inspector-loader .dots span:first-child + span {\n animation-name: dots-2;\n -webkit-animation-name: dots-2;\n}\n\n.a-inspector-loader .dots span:first-child + span + span {\n animation-name: dots-3;\n -webkit-animation-name: dots-3;\n}\n\na-scene {\n display: block;\n position: relative;\n height: 100%;\n width: 100%;\n}\n\na-assets,\na-scene video,\na-scene img,\na-scene audio {\n display: none;\n}\n\n.a-enter-vr-modal,\n.a-orientation-modal {\n font-family: Consolas, Andale Mono, Courier New, monospace;\n}\n\n.a-enter-vr-modal a {\n border-bottom: 1px solid #fff;\n padding: 2px 0;\n text-decoration: none;\n transition: .1s color ease-in;\n}\n\n.a-enter-vr-modal a:hover {\n background-color: #fff;\n color: #111;\n padding: 2px 4px;\n position: relative;\n left: -4px;\n}\n\n.a-enter-vr,\n.a-enter-ar {\n font-family: sans-serif, monospace;\n font-size: 13px;\n width: 100%;\n font-weight: 200;\n line-height: 16px;\n position: absolute;\n right: 20px;\n bottom: 20px;\n}\n\n.a-enter-ar.xr {\n right: 90px;\n}\n\n.a-enter-vr-button,\n.a-enter-vr-modal,\n.a-enter-vr-modal a {\n color: #fff;\n user-select: none;\n outline: none;\n}\n\n.a-enter-vr-button {\n background: rgba(0, 0, 0, 0.35) url(${f}) 50% 50% no-repeat;\n}\n\n.a-enter-ar-button {\n background: rgba(0, 0, 0, 0.20) url(${m}) 50% 50% no-repeat;\n}\n\n.a-enter-vr.fullscreen .a-enter-vr-button {\n background-image: url(${g});\n}\n\n.a-enter-vr-button,\n.a-enter-ar-button {\n background-size: 90% 90%;\n border: 0;\n bottom: 0;\n cursor: pointer;\n min-width: 58px;\n min-height: 34px;\n /* 1.74418604651 */\n /*\n In order to keep the aspect ratio when resizing\n padding-top percentages are relative to the containing block's width.\n http://stackoverflow.com/questions/12121090/responsively-change-div-size-keeping-aspect-ratio\n */\n padding-right: 0;\n padding-top: 0;\n position: absolute;\n right: 0;\n transition: background-color .05s ease;\n -webkit-transition: background-color .05s ease;\n z-index: 9999;\n border-radius: 8px;\n touch-action: manipulation; /* Prevent iOS double tap zoom on the button */\n}\n\n.a-enter-ar-button {\n background-size: 100% 90%;\n border-radius: 7px;\n}\n\n.a-enter-ar-button:active,\n.a-enter-ar-button:hover,\n.a-enter-vr-button:active,\n.a-enter-vr-button:hover {\n background-color: #ef2d5e;\n}\n\n.a-enter-vr-button.resethover {\n background-color: rgba(0, 0, 0, 0.35);\n}\n\n.a-enter-vr-modal {\n background-color: #666;\n border-radius: 0;\n display: none;\n min-height: 32px;\n margin-right: 70px;\n padding: 9px;\n width: 280px;\n right: 2%;\n position: absolute;\n}\n\n.a-enter-vr-modal:after {\n border-bottom: 10px solid transparent;\n border-left: 10px solid #666;\n border-top: 10px solid transparent;\n display: inline-block;\n content: '';\n position: absolute;\n right: -5px;\n top: 5px;\n width: 0;\n height: 0;\n}\n\n.a-enter-vr-modal p,\n.a-enter-vr-modal a {\n display: inline;\n}\n\n.a-enter-vr-modal p {\n margin: 0;\n}\n\n.a-enter-vr-modal p:after {\n content: ' ';\n}\n\n.a-orientation-modal {\n background: rgba(244, 244, 244, 1) url(${v}) center no-repeat;\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-orientation-modal:after {\n color: #666;\n content: "Insert phone into Cardboard holder.";\n display: block;\n position: absolute;\n text-align: center;\n top: 70%;\n transform: translateY(-70%);\n width: 100%;\n}\n\n.a-orientation-modal button {\n background: url(${y}) no-repeat;\n border: none;\n height: 50px;\n text-indent: -9999px;\n width: 50px;\n}\n\n.a-loader-title {\n background-color: rgba(0, 0, 0, 0.6);\n font-family: sans-serif, monospace;\n text-align: center;\n font-size: 20px;\n height: 50px;\n font-weight: 300;\n line-height: 50px;\n position: absolute;\n right: 0px;\n left: 0px;\n top: 0px;\n color: white;\n}\n\n.a-modal {\n position: absolute;\n background: rgba(0, 0, 0, 0.60);\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-dialog {\n position: relative;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n z-index: 199995;\n width: 300px;\n height: 200px;\n background-size: contain;\n background-color: white;\n font-family: sans-serif, monospace;\n font-size: 20px;\n border-radius: 3px;\n padding: 6px;\n}\n\n.a-dialog-text-container {\n width: 100%;\n height: 70%;\n align-self: flex-start;\n display: flex;\n justify-content: center;\n align-content: center;\n flex-direction: column;\n}\n\n.a-dialog-text {\n display: inline-block;\n font-weight: normal;\n font-size: 14pt;\n margin: 8px;\n}\n\n.a-dialog-buttons-container {\n display: inline-flex;\n align-self: flex-end;\n width: 100%;\n height: 30%;\n}\n\n.a-dialog-button {\n cursor: pointer;\n align-self: center;\n opacity: 0.9;\n height: 80%;\n width: 50%;\n font-size: 12pt;\n margin: 4px;\n border-radius: 2px;\n text-align:center;\n border: none;\n display: inline-block;\n -webkit-transition: all 0.25s ease-in-out;\n transition: all 0.25s ease-in-out;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.20);\n user-select: none;\n}\n\n.a-dialog-permission-button:hover {\n box-shadow: 0 7px 14px rgba(0,0,0,0.20), 0 2px 2px rgba(0,0,0,0.20);\n}\n\n.a-dialog-allow-button {\n background-color: #00ceff;\n}\n\n.a-dialog-deny-button {\n background-color: #ff005b;\n}\n\n.a-dialog-ok-button {\n background-color: #00ceff;\n width: 100%;\n}\n\n.a-dom-overlay:not(.a-no-style) {\n overflow: hidden;\n position: absolute;\n pointer-events: none;\n box-sizing: border-box;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n padding: 1em;\n}\n\n.a-dom-overlay:not(.a-no-style)>* {\n pointer-events: auto;\n}\n`,"",{version:3,sources:["webpack://./src/style/aframe.css"],names:[],mappings:"AAAA,sCAAsC;AACtC;EACE,SAAS;EACT,OAAO;EACP,eAAe;EACf,QAAQ;EACR,MAAM;AACR;;AAEA;EACE,YAAY;EACZ,SAAS;EACT,gBAAgB;EAChB,UAAU;EACV,WAAW;AACb;;AAEA,oDAAoD;AACpD;EACE,sBAAsB;EACtB,uBAAuB;EACvB,iBAAiB;EACjB,kBAAkB;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,0BAA0B;AAC5B;;AAEA;;EAEE,UAAU;EACV,WAAW;AACb;;AAEA;EACE,WAAW;AACb;;AAEA,gEAAgE;AAChE;EACE,6BAA6B;AAC/B;;AAEA;EACE,wBAAwB;AAC1B;;AAEA;EACE,YAAY;EACZ,OAAO;EACP,kBAAkB;EAClB,MAAM;EACN,WAAW;AACb;;AAEA;EACE,YAAY;EACZ,iBAAiB;EACjB,oBAAoB;AACtB;;AAEA;EACE,eAAe;AACjB;;AAEA;EACE,yBAAyB;EACzB,eAAe;EACf,SAAS;EACT,QAAQ;EACR,iBAAiB;EACjB,WAAW;EACX,qBAAqB;EACrB,eAAe;EACf,8BAA8B;EAC9B,kBAAkB;EAClB,cAAc;EACd,YAAY;AACd;;AAEA,+BAA+B;AAC/B,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,oBAAoB,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AAC7D,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AACrE,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;AACrE,4BAA4B,OAAO,UAAU,EAAE,EAAE,MAAM,UAAU,EAAE,EAAE;;AAErE;EACE,sCAAsC;EACtC,8CAA8C;AAChD;;AAEA;EACE,sBAAsB;EACtB,8BAA8B;AAChC;;AAEA;EACE,sBAAsB;EACtB,8BAA8B;AAChC;;AAEA;EACE,cAAc;EACd,kBAAkB;EAClB,YAAY;EACZ,WAAW;AACb;;AAEA;;;;EAIE,aAAa;AACf;;AAEA;;EAEE,0DAA0D;AAC5D;;AAEA;EACE,6BAA6B;EAC7B,cAAc;EACd,qBAAqB;EACrB,6BAA6B;AAC/B;;AAEA;EACE,sBAAsB;EACtB,WAAW;EACX,gBAAgB;EAChB,kBAAkB;EAClB,UAAU;AACZ;;AAEA;;EAEE,kCAAkC;EAClC,eAAe;EACf,WAAW;EACX,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EAClB,WAAW;EACX,YAAY;AACd;;AAEA;EACE,WAAW;AACb;;AAEA;;;EAGE,WAAW;EACX,iBAAiB;EACjB,aAAa;AACf;;AAEA;EACE,yFAA4qB;AAC9qB;;AAEA;EACE,yFAAkzB;AACpzB;;AAEA;EACE,yDAA2qK;AAC7qK;;AAEA;;EAEE,wBAAwB;EACxB,SAAS;EACT,SAAS;EACT,eAAe;EACf,eAAe;EACf,gBAAgB;EAChB,kBAAkB;EAClB;;;;GAIC;EACD,gBAAgB;EAChB,cAAc;EACd,kBAAkB;EAClB,QAAQ;EACR,sCAAsC;EACtC,8CAA8C;EAC9C,aAAa;EACb,kBAAkB;EAClB,0BAA0B,EAAE,8CAA8C;AAC5E;;AAEA;EACE,yBAAyB;EACzB,kBAAkB;AACpB;;AAEA;;;;EAIE,yBAAyB;AAC3B;;AAEA;EACE,qCAAqC;AACvC;;AAEA;EACE,sBAAsB;EACtB,gBAAgB;EAChB,aAAa;EACb,gBAAgB;EAChB,kBAAkB;EAClB,YAAY;EACZ,YAAY;EACZ,SAAS;EACT,kBAAkB;AACpB;;AAEA;EACE,qCAAqC;EACrC,4BAA4B;EAC5B,kCAAkC;EAClC,qBAAqB;EACrB,WAAW;EACX,kBAAkB;EAClB,WAAW;EACX,QAAQ;EACR,QAAQ;EACR,SAAS;AACX;;AAEA;;EAEE,eAAe;AACjB;;AAEA;EACE,SAAS;AACX;;AAEA;EACE,YAAY;AACd;;AAEA;EACE,2FAAivF;EACjvF,wBAAwB;EACxB,SAAS;EACT,eAAe;EACf,gBAAgB;EAChB,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,eAAe;EACf,MAAM;EACN,gBAAgB;AAClB;;AAEA;EACE,WAAW;EACX,8CAA8C;EAC9C,cAAc;EACd,kBAAkB;EAClB,kBAAkB;EAClB,QAAQ;EACR,2BAA2B;EAC3B,WAAW;AACb;;AAEA;EACE,6DAA25B;EAC35B,YAAY;EACZ,YAAY;EACZ,oBAAoB;EACpB,WAAW;AACb;;AAEA;EACE,oCAAoC;EACpC,kCAAkC;EAClC,kBAAkB;EAClB,eAAe;EACf,YAAY;EACZ,gBAAgB;EAChB,iBAAiB;EACjB,kBAAkB;EAClB,UAAU;EACV,SAAS;EACT,QAAQ;EACR,YAAY;AACd;;AAEA;EACE,kBAAkB;EAClB,+BAA+B;EAC/B,wBAAwB;EACxB,SAAS;EACT,eAAe;EACf,gBAAgB;EAChB,OAAO;EACP,iBAAiB;EACjB,QAAQ;EACR,eAAe;EACf,MAAM;EACN,gBAAgB;AAClB;;AAEA;EACE,kBAAkB;EAClB,SAAS;EACT,QAAQ;EACR,gCAAgC;EAChC,eAAe;EACf,YAAY;EACZ,aAAa;EACb,wBAAwB;EACxB,uBAAuB;EACvB,kCAAkC;EAClC,eAAe;EACf,kBAAkB;EAClB,YAAY;AACd;;AAEA;EACE,WAAW;EACX,WAAW;EACX,sBAAsB;EACtB,aAAa;EACb,uBAAuB;EACvB,qBAAqB;EACrB,sBAAsB;AACxB;;AAEA;EACE,qBAAqB;EACrB,mBAAmB;EACnB,eAAe;EACf,WAAW;AACb;;AAEA;EACE,oBAAoB;EACpB,oBAAoB;EACpB,WAAW;EACX,WAAW;AACb;;AAEA;EACE,eAAe;EACf,kBAAkB;EAClB,YAAY;EACZ,WAAW;EACX,UAAU;EACV,eAAe;EACf,WAAW;EACX,kBAAkB;EAClB,iBAAiB;EACjB,YAAY;EACZ,qBAAqB;EACrB,yCAAyC;EACzC,iCAAiC;EACjC,wEAAwE;EACxE,iBAAiB;AACnB;;AAEA;EACE,mEAAmE;AACrE;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,yBAAyB;AAC3B;;AAEA;EACE,yBAAyB;EACzB,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,kBAAkB;EAClB,oBAAoB;EACpB,sBAAsB;EACtB,SAAS;EACT,OAAO;EACP,QAAQ;EACR,MAAM;EACN,YAAY;AACd;;AAEA;EACE,oBAAoB;AACtB",sourcesContent:["/* .a-fullscreen means not embedded. */\nhtml.a-fullscreen {\n bottom: 0;\n left: 0;\n position: fixed;\n right: 0;\n top: 0;\n}\n\nhtml.a-fullscreen body {\n height: 100%;\n margin: 0;\n overflow: hidden;\n padding: 0;\n width: 100%;\n}\n\n/* Class is removed when doing <a-scene embedded>. */\nhtml.a-fullscreen .a-canvas {\n width: 100% !important;\n height: 100% !important;\n top: 0 !important;\n left: 0 !important;\n right: 0 !important;\n bottom: 0 !important;\n position: fixed !important;\n}\n\nhtml:not(.a-fullscreen) .a-enter-vr,\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 5px;\n bottom: 5px;\n}\n\nhtml:not(.a-fullscreen) .a-enter-ar {\n right: 60px;\n}\n\n/* In chrome mobile the user agent stylesheet set it to white */\n:-webkit-full-screen {\n background-color: transparent;\n}\n\n.a-hidden {\n display: none !important;\n}\n\n.a-canvas {\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n}\n\n.a-canvas.a-grab-cursor:hover {\n cursor: grab;\n cursor: -moz-grab;\n cursor: -webkit-grab;\n}\n\ncanvas.a-canvas.a-mouse-cursor-hover:hover {\n cursor: pointer;\n}\n\n.a-inspector-loader {\n background-color: #ed3160;\n position: fixed;\n left: 3px;\n top: 3px;\n padding: 6px 10px;\n color: #fff;\n text-decoration: none;\n font-size: 12px;\n font-family: Roboto,sans-serif;\n text-align: center;\n z-index: 99999;\n width: 204px;\n}\n\n/* Inspector loader animation */\n@keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n@-webkit-keyframes dots-1 { from { opacity: 0; } 25% { opacity: 1; } }\n@-webkit-keyframes dots-2 { from { opacity: 0; } 50% { opacity: 1; } }\n@-webkit-keyframes dots-3 { from { opacity: 0; } 75% { opacity: 1; } }\n\n.a-inspector-loader .dots span {\n animation: dots-1 2s infinite steps(1);\n -webkit-animation: dots-1 2s infinite steps(1);\n}\n\n.a-inspector-loader .dots span:first-child + span {\n animation-name: dots-2;\n -webkit-animation-name: dots-2;\n}\n\n.a-inspector-loader .dots span:first-child + span + span {\n animation-name: dots-3;\n -webkit-animation-name: dots-3;\n}\n\na-scene {\n display: block;\n position: relative;\n height: 100%;\n width: 100%;\n}\n\na-assets,\na-scene video,\na-scene img,\na-scene audio {\n display: none;\n}\n\n.a-enter-vr-modal,\n.a-orientation-modal {\n font-family: Consolas, Andale Mono, Courier New, monospace;\n}\n\n.a-enter-vr-modal a {\n border-bottom: 1px solid #fff;\n padding: 2px 0;\n text-decoration: none;\n transition: .1s color ease-in;\n}\n\n.a-enter-vr-modal a:hover {\n background-color: #fff;\n color: #111;\n padding: 2px 4px;\n position: relative;\n left: -4px;\n}\n\n.a-enter-vr,\n.a-enter-ar {\n font-family: sans-serif, monospace;\n font-size: 13px;\n width: 100%;\n font-weight: 200;\n line-height: 16px;\n position: absolute;\n right: 20px;\n bottom: 20px;\n}\n\n.a-enter-ar.xr {\n right: 90px;\n}\n\n.a-enter-vr-button,\n.a-enter-vr-modal,\n.a-enter-vr-modal a {\n color: #fff;\n user-select: none;\n outline: none;\n}\n\n.a-enter-vr-button {\n background: rgba(0, 0, 0, 0.35) url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-vrmode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M68.81,21.56H64.23v8.27h4.58a4.13,4.13,0,0,0,3.1-1.09,4.2,4.2,0,0,0,1-3,4.24,4.24,0,0,0-1-3A4.05,4.05,0,0,0,68.81,21.56Z' fill='%23fff'/%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0ZM41.9,46H34L24,16h8l6,21.84,6-21.84H52Zm39.29,0H73.44L68.15,35.39H64.23V46H57V16H68.81q5.32,0,8.34,2.37a8,8,0,0,1,3,6.69,9.68,9.68,0,0,1-1.27,5.18,8.9,8.9,0,0,1-4,3.34l6.26,12.11Z' fill='%23fff'/%3E%3C/svg%3E\") 50% 50% no-repeat;\n}\n\n.a-enter-ar-button {\n background: rgba(0, 0, 0, 0.20) url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='108' height='62' viewBox='0 0 108 62'%3E%3Ctitle%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0Zm8,50a8,8,0,0,1-8,8H12a8,8,0,0,1-8-8V12a8,8,0,0,1,8-8H96a8,8,0,0,1,8,8Z' fill='%23fff'/%3E%3Cpath d='M43.35,39.82H32.51L30.45,46H23.88L35,16h5.73L52,46H45.43Zm-9.17-5h7.5L37.91,23.58Z' fill='%23fff'/%3E%3Cpath d='M68.11,35H63.18V46H57V16H68.15q5.31,0,8.2,2.37a8.18,8.18,0,0,1,2.88,6.7,9.22,9.22,0,0,1-1.33,5.12,9.09,9.09,0,0,1-4,3.26l6.49,12.26V46H73.73Zm-4.93-5h5a5.09,5.09,0,0,0,3.6-1.18,4.21,4.21,0,0,0,1.28-3.27,4.56,4.56,0,0,0-1.2-3.34A5,5,0,0,0,68.15,21h-5Z' fill='%23fff'/%3E%3C/svg%3E\") 50% 50% no-repeat;\n}\n\n.a-enter-vr.fullscreen .a-enter-vr-button {\n background-image: url(\"data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8' standalone='no'%3F%3E%3Csvg width='108' height='62' viewBox='0 0 108 62' version='1.1' id='svg320' sodipodi:docname='fullscreen-aframe.svg' xml:space='preserve' inkscape:version='1.2.1 (9c6d41e 2022-07-14)' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/'%3E%3Cdefs id='defs324' /%3E%3Csodipodi:namedview id='namedview322' pagecolor='%23ffffff' bordercolor='%23000000' borderopacity='0.25' inkscape:showpageshadow='2' inkscape:pageopacity='0.0' inkscape:pagecheckerboard='0' inkscape:deskcolor='%23d1d1d1' showgrid='false' inkscape:zoom='3.8064516' inkscape:cx='91.423729' inkscape:cy='-1.4449153' inkscape:window-width='1440' inkscape:window-height='847' inkscape:window-x='32' inkscape:window-y='25' inkscape:window-maximized='0' inkscape:current-layer='svg320' /%3E%3Ctitle id='title312'%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d='M96 0H12A12 12 0 0 0 0 12V50A12 12 0 0 0 12 62H96a12 12 0 0 0 12-12V12A12 12 0 0 0 96 0Zm8 50a8 8 0 0 1-8 8H12a8 8 0 0 1-8-8V12a8 8 0 0 1 8-8H96a8 8 0 0 1 8 8Z' fill='%23fff' id='path314' style='fill:%23ffffff' /%3E%3Cg id='g356' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g358' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g360' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g362' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g364' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g366' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g368' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g370' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g372' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g374' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g376' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g378' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g380' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g382' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cg id='g384' transform='translate(-206.61017 -232.61864)'%3E%3C/g%3E%3Cmetadata id='metadata561'%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=''%3E%3Cdc:title%3Eaframe-armode-noborder-reduced-tracking%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cpath d='m 98.168511 40.083649 c 0 -1.303681 -0.998788 -2.358041 -2.239389 -2.358041 -1.230088 0.0031 -2.240892 1.05436 -2.240892 2.358041 v 4.881296 l -9.041661 -9.041662 c -0.874129 -0.875631 -2.288954 -0.875631 -3.16308 0 -0.874129 0.874126 -0.874129 2.293459 0 3.167585 l 8.995101 8.992101 h -4.858767 c -1.323206 0.0031 -2.389583 1.004796 -2.389583 2.239386 0 1.237598 1.066377 2.237888 2.389583 2.237888 h 10.154599 c 1.323206 0 2.388082 -0.998789 2.392587 -2.237888 -0.0044 -0.03305 -0.009 -0.05858 -0.0134 -0.09161 0.0046 -0.04207 0.0134 -0.08712 0.0134 -0.13066 V 40.085172 h -1.52e-4' id='path596' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 23.091002 35.921781 -9.026643 9.041662 v -4.881296 c 0 -1.303681 -1.009302 -2.355037 -2.242393 -2.358041 -1.237598 0 -2.237888 1.05436 -2.237888 2.358041 l -0.0031 10.016421 c 0 0.04356 0.01211 0.08862 0.0015 0.130659 -0.0031 0.03153 -0.009 0.05709 -0.01211 0.09161 0.0031 1.239099 1.069379 2.237888 2.391085 2.237888 h 10.156101 c 1.320202 0 2.388079 -1.000291 2.388079 -2.237888 0 -1.234591 -1.067877 -2.236383 -2.388079 -2.239387 h -4.858767 l 8.995101 -8.9921 c 0.871126 -0.874127 0.871126 -2.293459 0 -3.167586 -0.875628 -0.877132 -2.291957 -0.877132 -3.169087 -1.52e-4' id='path598' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 84.649572 25.978033 9.041662 -9.041664 v 4.881298 c 0 1.299176 1.010806 2.350532 2.240891 2.355037 1.240601 0 2.23939 -1.055861 2.23939 -2.355037 V 11.798242 c 0 -0.04356 -0.009 -0.08862 -0.0134 -0.127671 0.0044 -0.03153 0.009 -0.06157 0.0134 -0.09313 -0.0044 -1.240598 -1.069379 -2.2393873 -2.391085 -2.2393873 h -10.1546 c -1.323205 0 -2.38958 0.9987893 -2.38958 2.2393873 0 1.233091 1.066375 2.237887 2.38958 2.240891 h 4.858768 l -8.995102 8.9921 c -0.874129 0.872625 -0.874129 2.288954 0 3.161578 0.874127 0.880137 2.288951 0.880137 3.16308 1.5e-4' id='path600' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3Cpath d='m 17.264988 13.822853 h 4.857265 c 1.320202 -0.0031 2.388079 -1.0078 2.388079 -2.240889 0 -1.240601 -1.067877 -2.2393893 -2.388079 -2.2393893 H 11.967654 c -1.321707 0 -2.388082 0.9987883 -2.391085 2.2393893 0.0031 0.03153 0.009 0.06157 0.01211 0.09313 -0.0031 0.03905 -0.0015 0.08262 -0.0015 0.127671 l 0.0031 10.020926 c 0 1.299176 1.00029 2.355038 2.237887 2.355038 1.233092 -0.0044 2.242393 -1.055862 2.242393 -2.355038 v -4.881295 l 9.026644 9.041661 c 0.877132 0.878635 2.293459 0.878635 3.169087 0 0.871125 -0.872624 0.871125 -2.288953 0 -3.161577 l -8.995282 -8.993616' id='path602' style='fill:%23ffffff%3Bstroke-width:1.50194' /%3E%3C/svg%3E\");\n}\n\n.a-enter-vr-button,\n.a-enter-ar-button {\n background-size: 90% 90%;\n border: 0;\n bottom: 0;\n cursor: pointer;\n min-width: 58px;\n min-height: 34px;\n /* 1.74418604651 */\n /*\n In order to keep the aspect ratio when resizing\n padding-top percentages are relative to the containing block's width.\n http://stackoverflow.com/questions/12121090/responsively-change-div-size-keeping-aspect-ratio\n */\n padding-right: 0;\n padding-top: 0;\n position: absolute;\n right: 0;\n transition: background-color .05s ease;\n -webkit-transition: background-color .05s ease;\n z-index: 9999;\n border-radius: 8px;\n touch-action: manipulation; /* Prevent iOS double tap zoom on the button */\n}\n\n.a-enter-ar-button {\n background-size: 100% 90%;\n border-radius: 7px;\n}\n\n.a-enter-ar-button:active,\n.a-enter-ar-button:hover,\n.a-enter-vr-button:active,\n.a-enter-vr-button:hover {\n background-color: #ef2d5e;\n}\n\n.a-enter-vr-button.resethover {\n background-color: rgba(0, 0, 0, 0.35);\n}\n\n.a-enter-vr-modal {\n background-color: #666;\n border-radius: 0;\n display: none;\n min-height: 32px;\n margin-right: 70px;\n padding: 9px;\n width: 280px;\n right: 2%;\n position: absolute;\n}\n\n.a-enter-vr-modal:after {\n border-bottom: 10px solid transparent;\n border-left: 10px solid #666;\n border-top: 10px solid transparent;\n display: inline-block;\n content: '';\n position: absolute;\n right: -5px;\n top: 5px;\n width: 0;\n height: 0;\n}\n\n.a-enter-vr-modal p,\n.a-enter-vr-modal a {\n display: inline;\n}\n\n.a-enter-vr-modal p {\n margin: 0;\n}\n\n.a-enter-vr-modal p:after {\n content: ' ';\n}\n\n.a-orientation-modal {\n background: rgba(244, 244, 244, 1) url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E) center no-repeat;\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-orientation-modal:after {\n color: #666;\n content: \"Insert phone into Cardboard holder.\";\n display: block;\n position: absolute;\n text-align: center;\n top: 70%;\n transform: translateY(-70%);\n width: 100%;\n}\n\n.a-orientation-modal button {\n background: url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E) no-repeat;\n border: none;\n height: 50px;\n text-indent: -9999px;\n width: 50px;\n}\n\n.a-loader-title {\n background-color: rgba(0, 0, 0, 0.6);\n font-family: sans-serif, monospace;\n text-align: center;\n font-size: 20px;\n height: 50px;\n font-weight: 300;\n line-height: 50px;\n position: absolute;\n right: 0px;\n left: 0px;\n top: 0px;\n color: white;\n}\n\n.a-modal {\n position: absolute;\n background: rgba(0, 0, 0, 0.60);\n background-size: 50% 50%;\n bottom: 0;\n font-size: 14px;\n font-weight: 600;\n left: 0;\n line-height: 20px;\n right: 0;\n position: fixed;\n top: 0;\n z-index: 9999999;\n}\n\n.a-dialog {\n position: relative;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n z-index: 199995;\n width: 300px;\n height: 200px;\n background-size: contain;\n background-color: white;\n font-family: sans-serif, monospace;\n font-size: 20px;\n border-radius: 3px;\n padding: 6px;\n}\n\n.a-dialog-text-container {\n width: 100%;\n height: 70%;\n align-self: flex-start;\n display: flex;\n justify-content: center;\n align-content: center;\n flex-direction: column;\n}\n\n.a-dialog-text {\n display: inline-block;\n font-weight: normal;\n font-size: 14pt;\n margin: 8px;\n}\n\n.a-dialog-buttons-container {\n display: inline-flex;\n align-self: flex-end;\n width: 100%;\n height: 30%;\n}\n\n.a-dialog-button {\n cursor: pointer;\n align-self: center;\n opacity: 0.9;\n height: 80%;\n width: 50%;\n font-size: 12pt;\n margin: 4px;\n border-radius: 2px;\n text-align:center;\n border: none;\n display: inline-block;\n -webkit-transition: all 0.25s ease-in-out;\n transition: all 0.25s ease-in-out;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.20);\n user-select: none;\n}\n\n.a-dialog-permission-button:hover {\n box-shadow: 0 7px 14px rgba(0,0,0,0.20), 0 2px 2px rgba(0,0,0,0.20);\n}\n\n.a-dialog-allow-button {\n background-color: #00ceff;\n}\n\n.a-dialog-deny-button {\n background-color: #ff005b;\n}\n\n.a-dialog-ok-button {\n background-color: #00ceff;\n width: 100%;\n}\n\n.a-dom-overlay:not(.a-no-style) {\n overflow: hidden;\n position: absolute;\n pointer-events: none;\n box-sizing: border-box;\n bottom: 0;\n left: 0;\n right: 0;\n top: 0;\n padding: 1em;\n}\n\n.a-dom-overlay:not(.a-no-style)>* {\n pointer-events: auto;\n}\n"],sourceRoot:""}]);const E=A},2470:(e,t,n)=>{"use strict";n.d(t,{A:()=>a});var i=n(963),r=n.n(i),s=n(9089),o=n.n(s)()(r());o.push([e.id,".rs-base {\n background-color: #333;\n color: #fafafa;\n border-radius: 0;\n font: 10px monospace;\n left: 5px;\n line-height: 1em;\n opacity: 0.85;\n overflow: hidden;\n padding: 10px;\n position: fixed;\n top: 5px;\n width: 300px;\n z-index: 10000;\n}\n\n.rs-base div.hidden {\n display: none;\n}\n\n.rs-base h1 {\n color: #fff;\n cursor: pointer;\n font-size: 1.4em;\n font-weight: 300;\n margin: 0 0 5px;\n padding: 0;\n}\n\n.rs-group {\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n -webkit-flex-direction: column-reverse;\n flex-direction: column-reverse;\n margin-bottom: 5px;\n}\n\n.rs-group:last-child {\n margin-bottom: 0;\n}\n\n.rs-counter-base {\n align-items: center;\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n height: 10px;\n -webkit-justify-content: space-between;\n justify-content: space-between;\n margin: 2px 0;\n}\n\n.rs-counter-base.alarm {\n color: #b70000;\n text-shadow: 0 0 0 #b70000,\n 0 0 1px #fff,\n 0 0 1px #fff,\n 0 0 2px #fff,\n 0 0 2px #fff,\n 0 0 3px #fff,\n 0 0 3px #fff,\n 0 0 4px #fff,\n 0 0 4px #fff;\n}\n\n.rs-counter-id {\n font-weight: 300;\n -webkit-box-ordinal-group: 0;\n -webkit-order: 0;\n order: 0;\n width: 54px;\n}\n\n.rs-counter-value {\n font-weight: 300;\n -webkit-box-ordinal-group: 1;\n -webkit-order: 1;\n order: 1;\n text-align: right;\n width: 35px;\n}\n\n.rs-canvas {\n -webkit-box-ordinal-group: 2;\n -webkit-order: 2;\n order: 2;\n}\n\n@media (min-width: 480px) {\n .rs-base {\n left: 20px;\n top: 20px;\n }\n}\n","",{version:3,sources:["webpack://./src/style/rStats.css"],names:[],mappings:"AAAA;EACE,sBAAsB;EACtB,cAAc;EACd,gBAAgB;EAChB,oBAAoB;EACpB,SAAS;EACT,gBAAgB;EAChB,aAAa;EACb,gBAAgB;EAChB,aAAa;EACb,eAAe;EACf,QAAQ;EACR,YAAY;EACZ,cAAc;AAChB;;AAEA;EACE,aAAa;AACf;;AAEA;EACE,WAAW;EACX,eAAe;EACf,gBAAgB;EAChB,gBAAgB;EAChB,eAAe;EACf,UAAU;AACZ;;AAEA;EACE,oBAAoB;EACpB,qBAAqB;EACrB,aAAa;EACb,sCAAsC;EACtC,8BAA8B;EAC9B,kBAAkB;AACpB;;AAEA;EACE,gBAAgB;AAClB;;AAEA;EACE,mBAAmB;EACnB,oBAAoB;EACpB,qBAAqB;EACrB,aAAa;EACb,YAAY;EACZ,sCAAsC;EACtC,8BAA8B;EAC9B,aAAa;AACf;;AAEA;EACE,cAAc;EACd;;;;;;;;2BAQyB;AAC3B;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;EACR,WAAW;AACb;;AAEA;EACE,gBAAgB;EAChB,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;EACR,iBAAiB;EACjB,WAAW;AACb;;AAEA;EACE,4BAA4B;EAC5B,gBAAgB;EAChB,QAAQ;AACV;;AAEA;EACE;IACE,UAAU;IACV,SAAS;EACX;AACF",sourcesContent:[".rs-base {\n background-color: #333;\n color: #fafafa;\n border-radius: 0;\n font: 10px monospace;\n left: 5px;\n line-height: 1em;\n opacity: 0.85;\n overflow: hidden;\n padding: 10px;\n position: fixed;\n top: 5px;\n width: 300px;\n z-index: 10000;\n}\n\n.rs-base div.hidden {\n display: none;\n}\n\n.rs-base h1 {\n color: #fff;\n cursor: pointer;\n font-size: 1.4em;\n font-weight: 300;\n margin: 0 0 5px;\n padding: 0;\n}\n\n.rs-group {\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n -webkit-flex-direction: column-reverse;\n flex-direction: column-reverse;\n margin-bottom: 5px;\n}\n\n.rs-group:last-child {\n margin-bottom: 0;\n}\n\n.rs-counter-base {\n align-items: center;\n display: -webkit-box;\n display: -webkit-flex;\n display: flex;\n height: 10px;\n -webkit-justify-content: space-between;\n justify-content: space-between;\n margin: 2px 0;\n}\n\n.rs-counter-base.alarm {\n color: #b70000;\n text-shadow: 0 0 0 #b70000,\n 0 0 1px #fff,\n 0 0 1px #fff,\n 0 0 2px #fff,\n 0 0 2px #fff,\n 0 0 3px #fff,\n 0 0 3px #fff,\n 0 0 4px #fff,\n 0 0 4px #fff;\n}\n\n.rs-counter-id {\n font-weight: 300;\n -webkit-box-ordinal-group: 0;\n -webkit-order: 0;\n order: 0;\n width: 54px;\n}\n\n.rs-counter-value {\n font-weight: 300;\n -webkit-box-ordinal-group: 1;\n -webkit-order: 1;\n order: 1;\n text-align: right;\n width: 35px;\n}\n\n.rs-canvas {\n -webkit-box-ordinal-group: 2;\n -webkit-order: 2;\n order: 2;\n}\n\n@media (min-width: 480px) {\n .rs-base {\n left: 20px;\n top: 20px;\n }\n}\n"],sourceRoot:""}]);const a=o},7180:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>g});var i=n(5072),r=n.n(i),s=n(7825),o=n.n(s),a=n(7659),l=n.n(a),c=n(5056),h=n.n(c),d=n(540),u=n.n(d),p=n(1113),A=n.n(p),f=n(8217),m={};m.styleTagTransform=A(),m.setAttributes=h(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=u(),r()(f.A,m);const g=f.A&&f.A.locals?f.A.locals:void 0},9379:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>g});var i=n(5072),r=n.n(i),s=n(7825),o=n.n(s),a=n(7659),l=n.n(a),c=n(5056),h=n.n(c),d=n(540),u=n.n(d),p=n(1113),A=n.n(p),f=n(2470),m={};m.styleTagTransform=A(),m.setAttributes=h(),m.insert=l().bind(null,"head"),m.domAPI=o(),m.insertStyleElement=u(),r()(f.A,m);const g=f.A&&f.A.locals?f.A.locals:void 0},5072:e=>{"use strict";var t=[];function n(e){for(var n=-1,i=0;i<t.length;i++)if(t[i].identifier===e){n=i;break}return n}function i(e,i){for(var s={},o=[],a=0;a<e.length;a++){var l=e[a],c=i.base?l[0]+i.base:l[0],h=s[c]||0,d="".concat(c," ").concat(h);s[c]=h+1;var u=n(d),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==u)t[u].references++,t[u].updater(p);else{var A=r(p,i);i.byIndex=a,t.splice(a,0,{identifier:d,updater:A,references:1})}o.push(d)}return o}function r(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var s=i(e=e||[],r=r||{});return function(e){e=e||[];for(var o=0;o<s.length;o++){var a=n(s[o]);t[a].references--}for(var l=i(e,r),c=0;c<s.length;c++){var h=n(s[c]);0===t[h].references&&(t[h].updater(),t.splice(h,1))}s=l}}},7659:e=>{"use strict";var t={};e.exports=function(e,n){var i=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540:e=>{"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},5056:(e,t,n)=>{"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},7825:e=>{"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(i,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},1113:e=>{"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},3931:e=>{"use strict";e.exports="data:image/svg+xml,%3C%3Fxml version=%271.0%27 encoding=%27UTF-8%27 standalone=%27no%27%3F%3E%3Csvg width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27 version=%271.1%27 id=%27svg320%27 sodipodi:docname=%27fullscreen-aframe.svg%27 xml:space=%27preserve%27 inkscape:version=%271.2.1 %289c6d41e 2022-07-14%29%27 xmlns:inkscape=%27http://www.inkscape.org/namespaces/inkscape%27 xmlns:sodipodi=%27http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd%27 xmlns=%27http://www.w3.org/2000/svg%27 xmlns:svg=%27http://www.w3.org/2000/svg%27 xmlns:rdf=%27http://www.w3.org/1999/02/22-rdf-syntax-ns%23%27 xmlns:cc=%27http://creativecommons.org/ns%23%27 xmlns:dc=%27http://purl.org/dc/elements/1.1/%27%3E%3Cdefs id=%27defs324%27 /%3E%3Csodipodi:namedview id=%27namedview322%27 pagecolor=%27%23ffffff%27 bordercolor=%27%23000000%27 borderopacity=%270.25%27 inkscape:showpageshadow=%272%27 inkscape:pageopacity=%270.0%27 inkscape:pagecheckerboard=%270%27 inkscape:deskcolor=%27%23d1d1d1%27 showgrid=%27false%27 inkscape:zoom=%273.8064516%27 inkscape:cx=%2791.423729%27 inkscape:cy=%27-1.4449153%27 inkscape:window-width=%271440%27 inkscape:window-height=%27847%27 inkscape:window-x=%2732%27 inkscape:window-y=%2725%27 inkscape:window-maximized=%270%27 inkscape:current-layer=%27svg320%27 /%3E%3Ctitle id=%27title312%27%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M96 0H12A12 12 0 0 0 0 12V50A12 12 0 0 0 12 62H96a12 12 0 0 0 12-12V12A12 12 0 0 0 96 0Zm8 50a8 8 0 0 1-8 8H12a8 8 0 0 1-8-8V12a8 8 0 0 1 8-8H96a8 8 0 0 1 8 8Z%27 fill=%27%23fff%27 id=%27path314%27 style=%27fill:%23ffffff%27 /%3E%3Cg id=%27g356%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g358%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g360%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g362%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g364%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g366%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g368%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g370%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g372%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g374%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g376%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g378%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g380%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g382%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cg id=%27g384%27 transform=%27translate%28-206.61017 -232.61864%29%27%3E%3C/g%3E%3Cmetadata id=%27metadata561%27%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=%27%27%3E%3Cdc:title%3Eaframe-armode-noborder-reduced-tracking%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cpath d=%27m 98.168511 40.083649 c 0 -1.303681 -0.998788 -2.358041 -2.239389 -2.358041 -1.230088 0.0031 -2.240892 1.05436 -2.240892 2.358041 v 4.881296 l -9.041661 -9.041662 c -0.874129 -0.875631 -2.288954 -0.875631 -3.16308 0 -0.874129 0.874126 -0.874129 2.293459 0 3.167585 l 8.995101 8.992101 h -4.858767 c -1.323206 0.0031 -2.389583 1.004796 -2.389583 2.239386 0 1.237598 1.066377 2.237888 2.389583 2.237888 h 10.154599 c 1.323206 0 2.388082 -0.998789 2.392587 -2.237888 -0.0044 -0.03305 -0.009 -0.05858 -0.0134 -0.09161 0.0046 -0.04207 0.0134 -0.08712 0.0134 -0.13066 V 40.085172 h -1.52e-4%27 id=%27path596%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 23.091002 35.921781 -9.026643 9.041662 v -4.881296 c 0 -1.303681 -1.009302 -2.355037 -2.242393 -2.358041 -1.237598 0 -2.237888 1.05436 -2.237888 2.358041 l -0.0031 10.016421 c 0 0.04356 0.01211 0.08862 0.0015 0.130659 -0.0031 0.03153 -0.009 0.05709 -0.01211 0.09161 0.0031 1.239099 1.069379 2.237888 2.391085 2.237888 h 10.156101 c 1.320202 0 2.388079 -1.000291 2.388079 -2.237888 0 -1.234591 -1.067877 -2.236383 -2.388079 -2.239387 h -4.858767 l 8.995101 -8.9921 c 0.871126 -0.874127 0.871126 -2.293459 0 -3.167586 -0.875628 -0.877132 -2.291957 -0.877132 -3.169087 -1.52e-4%27 id=%27path598%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 84.649572 25.978033 9.041662 -9.041664 v 4.881298 c 0 1.299176 1.010806 2.350532 2.240891 2.355037 1.240601 0 2.23939 -1.055861 2.23939 -2.355037 V 11.798242 c 0 -0.04356 -0.009 -0.08862 -0.0134 -0.127671 0.0044 -0.03153 0.009 -0.06157 0.0134 -0.09313 -0.0044 -1.240598 -1.069379 -2.2393873 -2.391085 -2.2393873 h -10.1546 c -1.323205 0 -2.38958 0.9987893 -2.38958 2.2393873 0 1.233091 1.066375 2.237887 2.38958 2.240891 h 4.858768 l -8.995102 8.9921 c -0.874129 0.872625 -0.874129 2.288954 0 3.161578 0.874127 0.880137 2.288951 0.880137 3.16308 1.5e-4%27 id=%27path600%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3Cpath d=%27m 17.264988 13.822853 h 4.857265 c 1.320202 -0.0031 2.388079 -1.0078 2.388079 -2.240889 0 -1.240601 -1.067877 -2.2393893 -2.388079 -2.2393893 H 11.967654 c -1.321707 0 -2.388082 0.9987883 -2.391085 2.2393893 0.0031 0.03153 0.009 0.06157 0.01211 0.09313 -0.0031 0.03905 -0.0015 0.08262 -0.0015 0.127671 l 0.0031 10.020926 c 0 1.299176 1.00029 2.355038 2.237887 2.355038 1.233092 -0.0044 2.242393 -1.055862 2.242393 -2.355038 v -4.881295 l 9.026644 9.041661 c 0.877132 0.878635 2.293459 0.878635 3.169087 0 0.871125 -0.872624 0.871125 -2.288953 0 -3.161577 l -8.995282 -8.993616%27 id=%27path602%27 style=%27fill:%23ffffff%3Bstroke-width:1.50194%27 /%3E%3C/svg%3E"},6085:e=>{"use strict";e.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27%3E%3Ctitle%3Eaframe-armode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0Zm8,50a8,8,0,0,1-8,8H12a8,8,0,0,1-8-8V12a8,8,0,0,1,8-8H96a8,8,0,0,1,8,8Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M43.35,39.82H32.51L30.45,46H23.88L35,16h5.73L52,46H45.43Zm-9.17-5h7.5L37.91,23.58Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M68.11,35H63.18V46H57V16H68.15q5.31,0,8.2,2.37a8.18,8.18,0,0,1,2.88,6.7,9.22,9.22,0,0,1-1.33,5.12,9.09,9.09,0,0,1-4,3.26l6.49,12.26V46H73.73Zm-4.93-5h5a5.09,5.09,0,0,0,3.6-1.18,4.21,4.21,0,0,0,1.28-3.27,4.56,4.56,0,0,0-1.2-3.34A5,5,0,0,0,68.15,21h-5Z%27 fill=%27%23fff%27/%3E%3C/svg%3E"},9169:e=>{"use strict";e.exports="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%27108%27 height=%2762%27 viewBox=%270 0 108 62%27%3E%3Ctitle%3Eaframe-vrmode-noborder-reduced-tracking%3C/title%3E%3Cpath d=%27M68.81,21.56H64.23v8.27h4.58a4.13,4.13,0,0,0,3.1-1.09,4.2,4.2,0,0,0,1-3,4.24,4.24,0,0,0-1-3A4.05,4.05,0,0,0,68.81,21.56Z%27 fill=%27%23fff%27/%3E%3Cpath d=%27M96,0H12A12,12,0,0,0,0,12V50A12,12,0,0,0,12,62H96a12,12,0,0,0,12-12V12A12,12,0,0,0,96,0ZM41.9,46H34L24,16h8l6,21.84,6-21.84H52Zm39.29,0H73.44L68.15,35.39H64.23V46H57V16H68.81q5.32,0,8.34,2.37a8,8,0,0,1,3,6.69,9.68,9.68,0,0,1-1.27,5.18,8.9,8.9,0,0,1-4,3.34l6.26,12.11Z%27 fill=%27%23fff%27/%3E%3C/svg%3E"},6517:e=>{"use strict";e.exports="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%20100%20100%22%20enable-background%3D%22new%200%200%20100%20100%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpath%20fill%3D%22%23000000%22%20d%3D%22M55.209%2C50l17.803-17.803c1.416-1.416%2C1.416-3.713%2C0-5.129c-1.416-1.417-3.713-1.417-5.129%2C0L50.08%2C44.872%20%20L32.278%2C27.069c-1.416-1.417-3.714-1.417-5.129%2C0c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129L44.951%2C50L27.149%2C67.803%20%20c-1.417%2C1.416-1.417%2C3.713%2C0%2C5.129c0.708%2C0.708%2C1.636%2C1.062%2C2.564%2C1.062c0.928%2C0%2C1.856-0.354%2C2.564-1.062L50.08%2C55.13l17.803%2C17.802%20%20c0.708%2C0.708%2C1.637%2C1.062%2C2.564%2C1.062s1.856-0.354%2C2.564-1.062c1.416-1.416%2C1.416-3.713%2C0-5.129L55.209%2C50z%22%3E%3C/path%3E%3C/svg%3E"},7889:e=>{"use strict";e.exports="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20xmlns%3Axlink%3D%22http%3A//www.w3.org/1999/xlink%22%20version%3D%221.1%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3D%220%200%2090%2090%22%20enable-background%3D%22new%200%200%2090%2090%22%20xml%3Aspace%3D%22preserve%22%3E%3Cpolygon%20points%3D%220%2C0%200%2C0%200%2C0%20%22%3E%3C/polygon%3E%3Cg%3E%3Cpath%20d%3D%22M71.545%2C48.145h-31.98V20.743c0-2.627-2.138-4.765-4.765-4.765H18.456c-2.628%2C0-4.767%2C2.138-4.767%2C4.765v42.789%20%20%20c0%2C2.628%2C2.138%2C4.766%2C4.767%2C4.766h5.535v0.959c0%2C2.628%2C2.138%2C4.765%2C4.766%2C4.765h42.788c2.628%2C0%2C4.766-2.137%2C4.766-4.765V52.914%20%20%20C76.311%2C50.284%2C74.173%2C48.145%2C71.545%2C48.145z%20M18.455%2C16.935h16.344c2.1%2C0%2C3.808%2C1.708%2C3.808%2C3.808v27.401H37.25V22.636%20%20%20c0-0.264-0.215-0.478-0.479-0.478H16.482c-0.264%2C0-0.479%2C0.214-0.479%2C0.478v36.585c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h7.507v7.644%20%20%20h-5.534c-2.101%2C0-3.81-1.709-3.81-3.81V20.743C14.645%2C18.643%2C16.354%2C16.935%2C18.455%2C16.935z%20M16.96%2C23.116h19.331v25.031h-7.535%20%20%20c-2.628%2C0-4.766%2C2.139-4.766%2C4.768v5.828h-7.03V23.116z%20M71.545%2C73.064H28.757c-2.101%2C0-3.81-1.708-3.81-3.808V52.914%20%20%20c0-2.102%2C1.709-3.812%2C3.81-3.812h42.788c2.1%2C0%2C3.809%2C1.71%2C3.809%2C3.812v16.343C75.354%2C71.356%2C73.645%2C73.064%2C71.545%2C73.064z%22%3E%3C/path%3E%3Cpath%20d%3D%22M28.919%2C58.424c-1.466%2C0-2.659%2C1.193-2.659%2C2.66c0%2C1.466%2C1.193%2C2.658%2C2.659%2C2.658c1.468%2C0%2C2.662-1.192%2C2.662-2.658%20%20%20C31.581%2C59.617%2C30.387%2C58.424%2C28.919%2C58.424z%20M28.919%2C62.786c-0.939%2C0-1.703-0.764-1.703-1.702c0-0.939%2C0.764-1.704%2C1.703-1.704%20%20%20c0.94%2C0%2C1.705%2C0.765%2C1.705%2C1.704C30.623%2C62.022%2C29.858%2C62.786%2C28.919%2C62.786z%22%3E%3C/path%3E%3Cpath%20d%3D%22M69.654%2C50.461H33.069c-0.264%2C0-0.479%2C0.215-0.479%2C0.479v20.288c0%2C0.264%2C0.215%2C0.478%2C0.479%2C0.478h36.585%20%20%20c0.263%2C0%2C0.477-0.214%2C0.477-0.478V50.939C70.131%2C50.676%2C69.917%2C50.461%2C69.654%2C50.461z%20M69.174%2C51.417V70.75H33.548V51.417H69.174z%22%3E%3C/path%3E%3Cpath%20d%3D%22M45.201%2C30.296c6.651%2C0%2C12.233%2C5.351%2C12.551%2C11.977l-3.033-2.638c-0.193-0.165-0.507-0.142-0.675%2C0.048%20%20%20c-0.174%2C0.198-0.153%2C0.501%2C0.045%2C0.676l3.883%2C3.375c0.09%2C0.075%2C0.198%2C0.115%2C0.312%2C0.115c0.141%2C0%2C0.273-0.061%2C0.362-0.166%20%20%20l3.371-3.877c0.173-0.2%2C0.151-0.502-0.047-0.675c-0.194-0.166-0.508-0.144-0.676%2C0.048l-2.592%2C2.979%20%20%20c-0.18-3.417-1.629-6.605-4.099-9.001c-2.538-2.461-5.877-3.817-9.404-3.817c-0.264%2C0-0.479%2C0.215-0.479%2C0.479%20%20%20C44.72%2C30.083%2C44.936%2C30.296%2C45.201%2C30.296z%22%3E%3C/path%3E%3C/g%3E%3C/svg%3E"},7496:(e,t,n)=>{"use strict";n.d(t,{A:()=>qg});var i={};n.r(i),n.d(i,{ACESFilmicToneMapping:()=>oe,AddEquation:()=>_,AddOperation:()=>te,AdditiveAnimationBlendMode:()=>Vt,AdditiveBlending:()=>x,AgXToneMapping:()=>le,AlphaFormat:()=>He,AlwaysCompare:()=>Bn,AlwaysDepth:()=>W,AlwaysStencilFunc:()=>xn,AmbientLight:()=>Th,AnimationAction:()=>Ed,AnimationClip:()=>$c,AnimationLoader:()=>lh,AnimationMixer:()=>bd,AnimationObjectGroup:()=>yd,AnimationUtils:()=>Qc,ArcCurve:()=>nl,ArrayCamera:()=>Jh,ArrowHelper:()=>fu,AttachedBindMode:()=>he,Audio:()=>rd,AudioAnalyser:()=>hd,AudioContext:()=>Vh,AudioListener:()=>id,AudioLoader:()=>jh,AxesHelper:()=>mu,BackSide:()=>g,BasicDepthPacking:()=>Xt,BasicShadowMap:()=>u,BatchedMesh:()=>wa,Bone:()=>Qo,BooleanKeyframeTrack:()=>Wc,Box2:()=>Od,Box3:()=>Ui,Box3Helper:()=>hu,BoxGeometry:()=>Hs,BoxHelper:()=>cu,BufferAttribute:()=>us,BufferGeometry:()=>Bs,BufferGeometryLoader:()=>Fh,ByteType:()=>Le,Cache:()=>th,Camera:()=>Ys,CameraHelper:()=>ou,CanvasTexture:()=>Za,CapsuleGeometry:()=>Cl,CatmullRomCurve3:()=>ll,CineonToneMapping:()=>se,CircleGeometry:()=>wl,ClampToEdgeWrapping:()=>ye,Clock:()=>Kh,Color:()=>es,ColorKeyframeTrack:()=>qc,ColorManagement:()=>Ai,CompressedArrayTexture:()=>Ja,CompressedCubeTexture:()=>Ka,CompressedTexture:()=>Ya,CompressedTextureLoader:()=>ch,ConeGeometry:()=>Ml,ConstantAlphaFactor:()=>H,ConstantColorFactor:()=>G,Controls:()=>vu,CubeCamera:()=>to,CubeReflectionMapping:()=>pe,CubeRefractionMapping:()=>Ae,CubeTexture:()=>no,CubeTextureLoader:()=>dh,CubeUVReflectionMapping:()=>ge,CubicBezierCurve:()=>ul,CubicBezierCurve3:()=>pl,CubicInterpolant:()=>zc,CullFaceBack:()=>c,CullFaceFront:()=>h,CullFaceFrontBack:()=>d,CullFaceNone:()=>l,Curve:()=>el,CurvePath:()=>El,CustomBlending:()=>w,CustomToneMapping:()=>ae,CylinderGeometry:()=>_l,Cylindrical:()=>Dd,Data3DTexture:()=>Bi,DataArrayTexture:()=>Si,DataTexture:()=>Go,DataTextureLoader:()=>uh,DataUtils:()=>cs,DecrementStencilOp:()=>hn,DecrementWrapStencilOp:()=>un,DefaultLoadingManager:()=>ih,DepthFormat:()=>Xe,DepthStencilFormat:()=>Ye,DepthTexture:()=>$a,DetachedBindMode:()=>de,DirectionalLight:()=>Bh,DirectionalLightHelper:()=>iu,DiscreteInterpolant:()=>Vc,DodecahedronGeometry:()=>Il,DoubleSide:()=>v,DstAlphaFactor:()=>O,DstColorFactor:()=>k,DynamicCopyUsage:()=>Fn,DynamicDrawUsage:()=>Rn,DynamicReadUsage:()=>Pn,EdgesGeometry:()=>Dl,EllipseCurve:()=>tl,EqualCompare:()=>wn,EqualDepth:()=>Y,EqualStencilFunc:()=>mn,EquirectangularReflectionMapping:()=>fe,EquirectangularRefractionMapping:()=>me,Euler:()=>vr,EventDispatcher:()=>Hn,ExtrudeGeometry:()=>lc,FileLoader:()=>ah,Float16BufferAttribute:()=>Es,Float32BufferAttribute:()=>xs,FloatType:()=>Fe,Fog:()=>so,FogExp2:()=>ro,FramebufferTexture:()=>Xa,FrontSide:()=>m,Frustum:()=>oa,GLBufferAttribute:()=>Sd,GLSL1:()=>Nn,GLSL3:()=>Qn,GreaterCompare:()=>Mn,GreaterDepth:()=>K,GreaterEqualCompare:()=>In,GreaterEqualDepth:()=>J,GreaterEqualStencilFunc:()=>En,GreaterStencilFunc:()=>vn,GridHelper:()=>Zd,Group:()=>Wa,HalfFloatType:()=>ke,HemisphereLight:()=>fh,HemisphereLightHelper:()=>Kd,IcosahedronGeometry:()=>hc,ImageBitmapLoader:()=>zh,ImageLoader:()=>hh,ImageUtils:()=>vi,IncrementStencilOp:()=>cn,IncrementWrapStencilOp:()=>dn,InstancedBufferAttribute:()=>jo,InstancedBufferGeometry:()=>Oh,InstancedInterleavedBuffer:()=>Md,InstancedMesh:()=>$o,Int16BufferAttribute:()=>ms,Int32BufferAttribute:()=>vs,Int8BufferAttribute:()=>ps,IntType:()=>Ue,InterleavedBuffer:()=>ao,InterleavedBufferAttribute:()=>co,Interpolant:()=>Gc,InterpolateDiscrete:()=>Ft,InterpolateLinear:()=>kt,InterpolateSmooth:()=>Nt,InvertStencilOp:()=>pn,KeepStencilOp:()=>an,KeyframeTrack:()=>jc,LOD:()=>Bo,LatheGeometry:()=>bl,Layers:()=>yr,LessCompare:()=>Cn,LessDepth:()=>q,LessEqualCompare:()=>_n,LessEqualDepth:()=>X,LessEqualStencilFunc:()=>gn,LessStencilFunc:()=>fn,Light:()=>Ah,LightProbe:()=>Dh,Line:()=>Da,Line3:()=>Nd,LineBasicMaterial:()=>_a,LineCurve:()=>Al,LineCurve3:()=>fl,LineDashedMaterial:()=>Pc,LineLoop:()=>ka,LineSegments:()=>Fa,LinearFilter:()=>Me,LinearInterpolant:()=>Hc,LinearMipMapLinearFilter:()=>Te,LinearMipMapNearestFilter:()=>Ie,LinearMipmapLinearFilter:()=>Be,LinearMipmapNearestFilter:()=>Se,LinearSRGBColorSpace:()=>nn,LinearToneMapping:()=>ie,LinearTransfer:()=>rn,Loader:()=>rh,LoaderUtils:()=>Uh,LoadingManager:()=>nh,LoopOnce:()=>Pt,LoopPingPong:()=>Ot,LoopRepeat:()=>Ut,LuminanceAlphaFormat:()=>qe,LuminanceFormat:()=>We,MOUSE:()=>o,Material:()=>is,MaterialLoader:()=>Ph,MathUtils:()=>ei,Matrix2:()=>Pd,Matrix3:()=>ni,Matrix4:()=>lr,MaxEquation:()=>B,Mesh:()=>Gs,MeshBasicMaterial:()=>rs,MeshDepthMaterial:()=>Rc,MeshDistanceMaterial:()=>Lc,MeshLambertMaterial:()=>Tc,MeshMatcapMaterial:()=>Dc,MeshNormalMaterial:()=>Bc,MeshPhongMaterial:()=>Sc,MeshPhysicalMaterial:()=>Mc,MeshStandardMaterial:()=>_c,MeshToonMaterial:()=>Ic,MinEquation:()=>I,MirroredRepeatWrapping:()=>Ee,MixOperation:()=>ee,MultiplyBlending:()=>C,MultiplyOperation:()=>$,NearestFilter:()=>xe,NearestMipMapLinearFilter:()=>_e,NearestMipMapNearestFilter:()=>Ce,NearestMipmapLinearFilter:()=>we,NearestMipmapNearestFilter:()=>be,NeutralToneMapping:()=>ce,NeverCompare:()=>bn,NeverDepth:()=>j,NeverStencilFunc:()=>An,NoBlending:()=>y,NoColorSpace:()=>en,NoToneMapping:()=>ne,NormalAnimationBlendMode:()=>Ht,NormalBlending:()=>E,NotEqualCompare:()=>Sn,NotEqualDepth:()=>Z,NotEqualStencilFunc:()=>yn,NumberKeyframeTrack:()=>Xc,Object3D:()=>Ur,ObjectLoader:()=>kh,ObjectSpaceNormalMap:()=>$t,OctahedronGeometry:()=>dc,OneFactor:()=>R,OneMinusConstantAlphaFactor:()=>V,OneMinusConstantColorFactor:()=>z,OneMinusDstAlphaFactor:()=>F,OneMinusDstColorFactor:()=>N,OneMinusSrcAlphaFactor:()=>U,OneMinusSrcColorFactor:()=>D,OrthographicCamera:()=>Sh,PCFShadowMap:()=>p,PCFSoftShadowMap:()=>A,PMREMGenerator:()=>Wu,Path:()=>xl,PerspectiveCamera:()=>$s,Plane:()=>ia,PlaneGeometry:()=>uc,PlaneHelper:()=>du,PointLight:()=>Mh,PointLightHelper:()=>qd,Points:()=>Va,PointsMaterial:()=>Na,PolarGridHelper:()=>$d,PolyhedronGeometry:()=>Sl,PositionalAudio:()=>cd,PropertyBinding:()=>vd,PropertyMixer:()=>dd,QuadraticBezierCurve:()=>ml,QuadraticBezierCurve3:()=>gl,Quaternion:()=>Ri,QuaternionKeyframeTrack:()=>Jc,QuaternionLinearInterpolant:()=>Yc,RED_GREEN_RGTC2_Format:()=>Lt,RED_RGTC1_Format:()=>Tt,REVISION:()=>s,RGBADepthPacking:()=>Yt,RGBAFormat:()=>je,RGBAIntegerFormat:()=>tt,RGBA_ASTC_10x10_Format:()=>wt,RGBA_ASTC_10x5_Format:()=>xt,RGBA_ASTC_10x6_Format:()=>bt,RGBA_ASTC_10x8_Format:()=>Ct,RGBA_ASTC_12x10_Format:()=>_t,RGBA_ASTC_12x12_Format:()=>Mt,RGBA_ASTC_4x4_Format:()=>pt,RGBA_ASTC_5x4_Format:()=>At,RGBA_ASTC_5x5_Format:()=>ft,RGBA_ASTC_6x5_Format:()=>mt,RGBA_ASTC_6x6_Format:()=>gt,RGBA_ASTC_8x5_Format:()=>vt,RGBA_ASTC_8x6_Format:()=>yt,RGBA_ASTC_8x8_Format:()=>Et,RGBA_BPTC_Format:()=>St,RGBA_ETC2_EAC_Format:()=>ut,RGBA_PVRTC_2BPPV1_Format:()=>ct,RGBA_PVRTC_4BPPV1_Format:()=>lt,RGBA_S3TC_DXT1_Format:()=>it,RGBA_S3TC_DXT3_Format:()=>rt,RGBA_S3TC_DXT5_Format:()=>st,RGBDepthPacking:()=>Jt,RGBFormat:()=>Ve,RGBIntegerFormat:()=>et,RGB_BPTC_SIGNED_Format:()=>It,RGB_BPTC_UNSIGNED_Format:()=>Bt,RGB_ETC1_Format:()=>ht,RGB_ETC2_Format:()=>dt,RGB_PVRTC_2BPPV1_Format:()=>at,RGB_PVRTC_4BPPV1_Format:()=>ot,RGB_S3TC_DXT1_Format:()=>nt,RGDepthPacking:()=>Kt,RGFormat:()=>Ze,RGIntegerFormat:()=>$e,RawShaderMaterial:()=>wc,Ray:()=>ar,Raycaster:()=>Bd,RectAreaLight:()=>Rh,RedFormat:()=>Je,RedIntegerFormat:()=>Ke,ReinhardToneMapping:()=>re,RenderTarget:()=>_i,RepeatWrapping:()=>ve,ReplaceStencilOp:()=>ln,ReverseSubtractEquation:()=>S,RingGeometry:()=>pc,SIGNED_RED_GREEN_RGTC2_Format:()=>Dt,SIGNED_RED_RGTC1_Format:()=>Rt,SRGBColorSpace:()=>tn,SRGBTransfer:()=>sn,Scene:()=>oo,ShaderChunk:()=>wu,ShaderLib:()=>Mu,ShaderMaterial:()=>Xs,ShadowMaterial:()=>Cc,Shape:()=>Pl,ShapeGeometry:()=>Ac,ShapePath:()=>gu,ShapeUtils:()=>sc,ShortType:()=>De,Skeleton:()=>Vo,SkeletonHelper:()=>jd,SkinnedMesh:()=>No,Source:()=>Ei,Sphere:()=>$i,SphereGeometry:()=>fc,Spherical:()=>Ld,SphericalHarmonics3:()=>Lh,SplineCurve:()=>vl,SpotLight:()=>xh,SpotLightHelper:()=>Gd,Sprite:()=>_o,SpriteMaterial:()=>ho,SrcAlphaFactor:()=>P,SrcAlphaSaturateFactor:()=>Q,SrcColorFactor:()=>L,StaticCopyUsage:()=>On,StaticDrawUsage:()=>Tn,StaticReadUsage:()=>Dn,StereoCamera:()=>Yh,StreamCopyUsage:()=>kn,StreamDrawUsage:()=>Ln,StreamReadUsage:()=>Un,StringKeyframeTrack:()=>Kc,SubtractEquation:()=>M,SubtractiveBlending:()=>b,TOUCH:()=>a,TangentSpaceNormalMap:()=>Zt,TetrahedronGeometry:()=>mc,Texture:()=>Ci,TextureLoader:()=>ph,TextureUtils:()=>Eu,TorusGeometry:()=>gc,TorusKnotGeometry:()=>vc,Triangle:()=>Yr,TriangleFanDrawMode:()=>qt,TriangleStripDrawMode:()=>Wt,TrianglesDrawMode:()=>jt,TubeGeometry:()=>yc,UVMapping:()=>ue,Uint16BufferAttribute:()=>gs,Uint32BufferAttribute:()=>ys,Uint8BufferAttribute:()=>As,Uint8ClampedBufferAttribute:()=>fs,Uniform:()=>Cd,UniformsGroup:()=>_d,UniformsLib:()=>_u,UniformsUtils:()=>qs,UnsignedByteType:()=>Re,UnsignedInt248Type:()=>Ge,UnsignedInt5999Type:()=>ze,UnsignedIntType:()=>Oe,UnsignedShort4444Type:()=>Ne,UnsignedShort5551Type:()=>Qe,UnsignedShortType:()=>Pe,VSMShadowMap:()=>f,Vector2:()=>ti,Vector3:()=>Li,Vector4:()=>wi,VectorKeyframeTrack:()=>Zc,VideoTexture:()=>qa,WebGL3DRenderTarget:()=>Ti,WebGLArrayRenderTarget:()=>Ii,WebGLCoordinateSystem:()=>Gn,WebGLCubeRenderTarget:()=>io,WebGLMultipleRenderTargets:()=>xu,WebGLRenderTarget:()=>Mi,WebGLRenderer:()=>sf,WebGLUtils:()=>XA,WebGPUCoordinateSystem:()=>zn,WireframeGeometry:()=>Ec,WrapAroundEnding:()=>zt,ZeroCurvatureEnding:()=>Qt,ZeroFactor:()=>T,ZeroSlopeEnding:()=>Gt,ZeroStencilOp:()=>on,createCanvasElement:()=>li});var r={};n.r(r),n.d(r,{computeMikkTSpaceTangents:()=>lf,computeMorphedAttributes:()=>vf,deepCloneAttribute:()=>df,deinterleaveAttribute:()=>pf,deinterleaveGeometry:()=>Af,estimateBytesUsed:()=>ff,interleaveAttributes:()=>uf,mergeAttributes:()=>hf,mergeGeometries:()=>cf,mergeGroups:()=>yf,mergeVertices:()=>mf,toCreasedNormals:()=>Ef,toTrianglesDrawMode:()=>gf});const s="171",o={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},a={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},l=0,c=1,h=2,d=3,u=0,p=1,A=2,f=3,m=0,g=1,v=2,y=0,E=1,x=2,b=3,C=4,w=5,_=100,M=101,S=102,I=103,B=104,T=200,R=201,L=202,D=203,P=204,U=205,O=206,F=207,k=208,N=209,Q=210,G=211,z=212,H=213,V=214,j=0,W=1,q=2,X=3,Y=4,J=5,K=6,Z=7,$=0,ee=1,te=2,ne=0,ie=1,re=2,se=3,oe=4,ae=5,le=6,ce=7,he="attached",de="detached",ue=300,pe=301,Ae=302,fe=303,me=304,ge=306,ve=1e3,ye=1001,Ee=1002,xe=1003,be=1004,Ce=1004,we=1005,_e=1005,Me=1006,Se=1007,Ie=1007,Be=1008,Te=1008,Re=1009,Le=1010,De=1011,Pe=1012,Ue=1013,Oe=1014,Fe=1015,ke=1016,Ne=1017,Qe=1018,Ge=1020,ze=35902,He=1021,Ve=1022,je=1023,We=1024,qe=1025,Xe=1026,Ye=1027,Je=1028,Ke=1029,Ze=1030,$e=1031,et=1032,tt=1033,nt=33776,it=33777,rt=33778,st=33779,ot=35840,at=35841,lt=35842,ct=35843,ht=36196,dt=37492,ut=37496,pt=37808,At=37809,ft=37810,mt=37811,gt=37812,vt=37813,yt=37814,Et=37815,xt=37816,bt=37817,Ct=37818,wt=37819,_t=37820,Mt=37821,St=36492,It=36494,Bt=36495,Tt=36283,Rt=36284,Lt=36285,Dt=36286,Pt=2200,Ut=2201,Ot=2202,Ft=2300,kt=2301,Nt=2302,Qt=2400,Gt=2401,zt=2402,Ht=2500,Vt=2501,jt=0,Wt=1,qt=2,Xt=3200,Yt=3201,Jt=3202,Kt=3203,Zt=0,$t=1,en="",tn="srgb",nn="srgb-linear",rn="linear",sn="srgb",on=0,an=7680,ln=7681,cn=7682,hn=7683,dn=34055,un=34056,pn=5386,An=512,fn=513,mn=514,gn=515,vn=516,yn=517,En=518,xn=519,bn=512,Cn=513,wn=514,_n=515,Mn=516,Sn=517,In=518,Bn=519,Tn=35044,Rn=35048,Ln=35040,Dn=35045,Pn=35049,Un=35041,On=35046,Fn=35050,kn=35042,Nn="100",Qn="300 es",Gn=2e3,zn=2001;class Hn{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<i;t++)n[t].call(this,e);e.target=null}}}const Vn=["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 jn=1234567;const Wn=Math.PI/180,qn=180/Math.PI;function Xn(){const e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(Vn[255&e]+Vn[e>>8&255]+Vn[e>>16&255]+Vn[e>>24&255]+"-"+Vn[255&t]+Vn[t>>8&255]+"-"+Vn[t>>16&15|64]+Vn[t>>24&255]+"-"+Vn[63&n|128]+Vn[n>>8&255]+"-"+Vn[n>>16&255]+Vn[n>>24&255]+Vn[255&i]+Vn[i>>8&255]+Vn[i>>16&255]+Vn[i>>24&255]).toLowerCase()}function Yn(e,t,n){return Math.max(t,Math.min(n,e))}function Jn(e,t){return(e%t+t)%t}function Kn(e,t,n){return(1-n)*e+n*t}function Zn(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function $n(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const ei={DEG2RAD:Wn,RAD2DEG:qn,generateUUID:Xn,clamp:Yn,euclideanModulo:Jn,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:Kn,damp:function(e,t,n,i){return Kn(e,t,1-Math.exp(-n*i))},pingpong:function(e,t=1){return t-Math.abs(Jn(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(jn=e);let t=jn+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*Wn},radToDeg:function(e){return e*qn},isPowerOfTwo:function(e){return!(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((t+i)/2),h=o((t+i)/2),d=s((t-i)/2),u=o((t-i)/2),p=s((i-t)/2),A=o((i-t)/2);switch(r){case"XYX":e.set(a*h,l*d,l*u,a*c);break;case"YZY":e.set(l*u,a*h,l*d,a*c);break;case"ZXZ":e.set(l*d,l*u,a*h,a*c);break;case"XZX":e.set(a*h,l*A,l*p,a*c);break;case"YXY":e.set(l*p,a*h,l*A,a*c);break;case"ZYZ":e.set(l*A,l*p,a*h,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:$n,denormalize:Zn};class ti{constructor(e=0,t=0){ti.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,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=Yn(this.x,e.x,t.x),this.y=Yn(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Yn(this.x,e,t),this.y=Yn(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Yn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Yn(n,-1,1))}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){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,s=this.y-e.y;return this.x=r*n-s*i+e.x,this.y=r*i+s*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ni{constructor(e,t,n,i,r,s,o,a,l){ni.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,s,o,a,l)}set(e,t,n,i,r,s,o,a,l){const c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=a,c[6]=n,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[3],a=n[6],l=n[1],c=n[4],h=n[7],d=n[2],u=n[5],p=n[8],A=i[0],f=i[3],m=i[6],g=i[1],v=i[4],y=i[7],E=i[2],x=i[5],b=i[8];return r[0]=s*A+o*g+a*E,r[3]=s*f+o*v+a*x,r[6]=s*m+o*y+a*b,r[1]=l*A+c*g+h*E,r[4]=l*f+c*v+h*x,r[7]=l*m+c*y+h*b,r[2]=d*A+u*g+p*E,r[5]=d*f+u*v+p*x,r[8]=d*m+u*y+p*b,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8];return t*s*c-t*o*l-n*r*c+n*o*a+i*r*l-i*s*a}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=c*s-o*l,d=o*a-c*r,u=l*r-s*a,p=t*h+n*d+i*u;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const A=1/p;return e[0]=h*A,e[1]=(i*l-c*n)*A,e[2]=(o*n-i*s)*A,e[3]=d*A,e[4]=(c*t-i*a)*A,e[5]=(i*r-o*t)*A,e[6]=u*A,e[7]=(n*a-l*t)*A,e[8]=(s*t-n*r)*A,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,s,o){const a=Math.cos(r),l=Math.sin(r);return this.set(n*a,n*l,-n*(a*s+l*o)+s+e,-i*l,i*a,-i*(-l*s+a*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(ii.makeScale(e,t)),this}rotate(e){return this.premultiply(ii.makeRotation(-e)),this}translate(e,t){return this.premultiply(ii.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,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)}}const ii=new ni;function ri(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}const si={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function oi(e,t){return new si[e](t)}function ai(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}function li(){const e=ai("canvas");return e.style.display="block",e}const ci={};function hi(e){e in ci||(ci[e]=!0,console.warn(e))}const di=(new ni).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ui=(new ni).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function pi(){const e={enabled:!0,workingColorSpace:nn,spaces:{},convert:function(e,t,n){return!1!==this.enabled&&t!==n&&t&&n?(this.spaces[t].transfer===sn&&(e.r=fi(e.r),e.g=fi(e.g),e.b=fi(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===sn&&(e.r=mi(e.r),e.g=mi(e.g),e.b=mi(e.b)),e):e},fromWorkingColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===en?rn:this.spaces[e].transfer},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return e.define({[nn]:{primaries:t,whitePoint:i,transfer:rn,toXYZ:di,fromXYZ:ui,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:tn},outputColorSpaceConfig:{drawingBufferColorSpace:tn}},[tn]:{primaries:t,whitePoint:i,transfer:sn,toXYZ:di,fromXYZ:ui,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:tn}}}),e}const Ai=pi();function fi(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function mi(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let gi;class vi{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===gi&&(gi=ai("canvas")),gi.width=e.width,gi.height=e.height;const n=gi.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=gi}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")}static sRGBToLinear(e){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const t=ai("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e<r.length;e++)r[e]=255*fi(r[e]/255);return n.putImageData(i,0,0),t}if(e.data){const t=e.data.slice(0);for(let e=0;e<t.length;e++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[e]=Math.floor(255*fi(t[e]/255)):t[e]=fi(t[e]);return{data:t,width:e.width,height:e.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let yi=0;class Ei{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:yi++}),this.uuid=Xn(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t<n;t++)i[t].isDataTexture?e.push(xi(i[t].image)):e.push(xi(i[t]))}else e=xi(i);n.url=e}return t||(e.images[this.uuid]=n),n}}function xi(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap?vi.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let bi=0;class Ci extends Hn{constructor(e=Ci.DEFAULT_IMAGE,t=Ci.DEFAULT_MAPPING,n=ye,i=ye,r=Me,s=Be,o=je,a=Re,l=Ci.DEFAULT_ANISOTROPY,c=en){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:bi++}),this.uuid=Xn(),this.name="",this.source=new Ei(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=s,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=a,this.offset=new ti(0,0),this.repeat=new ti(1,1),this.center=new ti(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ni,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.pmremVersion=0}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ue)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ve:e.x=e.x-Math.floor(e.x);break;case ye:e.x=e.x<0?0:1;break;case Ee: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 ve:e.y=e.y-Math.floor(e.y);break;case ye:e.y=e.y<0?0:1;break;case Ee:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}Ci.DEFAULT_IMAGE=null,Ci.DEFAULT_MAPPING=ue,Ci.DEFAULT_ANISOTROPY=1;class wi{constructor(e=0,t=0,n=0,i=1){wi.prototype.isVector4=!0,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){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,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}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const s=.01,o=.1,a=e.elements,l=a[0],c=a[4],h=a[8],d=a[1],u=a[5],p=a[9],A=a[2],f=a[6],m=a[10];if(Math.abs(c-d)<s&&Math.abs(h-A)<s&&Math.abs(p-f)<s){if(Math.abs(c+d)<o&&Math.abs(h+A)<o&&Math.abs(p+f)<o&&Math.abs(l+u+m-3)<o)return this.set(1,0,0,0),this;t=Math.PI;const e=(l+1)/2,a=(u+1)/2,g=(m+1)/2,v=(c+d)/4,y=(h+A)/4,E=(p+f)/4;return e>a&&e>g?e<s?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(e),i=v/n,r=y/n):a>g?a<s?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(a),n=v/i,r=E/i):g<s?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(g),n=y/r,i=E/r),this.set(n,i,r,t),this}let g=Math.sqrt((f-p)*(f-p)+(h-A)*(h-A)+(d-c)*(d-c));return Math.abs(g)<.001&&(g=1),this.x=(f-p)/g,this.y=(h-A)/g,this.z=(d-c)/g,this.w=Math.acos((l+u+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Yn(this.x,e.x,t.x),this.y=Yn(this.y,e.y,t.y),this.z=Yn(this.z,e.z,t.z),this.w=Yn(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Yn(this.x,e,t),this.y=Yn(this.y,e,t),this.z=Yn(this.z,e,t),this.w=Yn(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Yn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,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.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class _i extends Hn{constructor(e=1,t=1,n={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new wi(0,0,e,t),this.scissorTest=!1,this.viewport=new wi(0,0,e,t);const i={width:e,height:t,depth:1};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Me,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},n);const r=new Ci(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const s=n.count;for(let e=0;e<s;e++)this.textures[e]=r.clone(),this.textures[e].isRenderTargetTexture=!0;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this.depthTexture=n.depthTexture,this.samples=n.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++)this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Ei(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Mi extends _i{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class Si extends Ci{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xe,this.minFilter=xe,this.wrapR=ye,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ii extends Mi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Si(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Bi extends Ci{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=xe,this.minFilter=xe,this.wrapR=ye,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ti extends Mi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new Bi(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class Ri{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,s,o){let a=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3];const d=r[s+0],u=r[s+1],p=r[s+2],A=r[s+3];if(0===o)return e[t+0]=a,e[t+1]=l,e[t+2]=c,void(e[t+3]=h);if(1===o)return e[t+0]=d,e[t+1]=u,e[t+2]=p,void(e[t+3]=A);if(h!==A||a!==d||l!==u||c!==p){let e=1-o;const t=a*d+l*u+c*p+h*A,n=t>=0?1:-1,i=1-t*t;if(i>Number.EPSILON){const r=Math.sqrt(i),s=Math.atan2(r,t*n);e=Math.sin(e*s)/r,o=Math.sin(o*s)/r}const r=o*n;if(a=a*e+d*r,l=l*e+u*r,c=c*e+p*r,h=h*e+A*r,e===1-o){const e=1/Math.sqrt(a*a+l*l+c*c+h*h);a*=e,l*=e,c*=e,h*=e}}e[t]=a,e[t+1]=l,e[t+2]=c,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,r,s){const o=n[i],a=n[i+1],l=n[i+2],c=n[i+3],h=r[s],d=r[s+1],u=r[s+2],p=r[s+3];return e[t]=o*p+c*h+a*u-l*d,e[t+1]=a*p+c*d+l*h-o*u,e[t+2]=l*p+c*u+o*d-a*h,e[t+3]=c*p-o*h-a*d-l*u,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=!0){const n=e._x,i=e._y,r=e._z,s=e._order,o=Math.cos,a=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),d=a(n/2),u=a(i/2),p=a(r/2);switch(s){case"XYZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"YXZ":this._x=d*c*h+l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"ZXY":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h-d*u*p;break;case"ZYX":this._x=d*c*h-l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h+d*u*p;break;case"YZX":this._x=d*c*h+l*u*p,this._y=l*u*h+d*c*p,this._z=l*c*p-d*u*h,this._w=l*c*h-d*u*p;break;case"XZY":this._x=d*c*h-l*u*p,this._y=l*u*h-d*c*p,this._z=l*c*p+d*u*h,this._w=l*c*h+d*u*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],s=t[1],o=t[5],a=t[9],l=t[2],c=t[6],h=t[10],d=n+o+h;if(d>0){const e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(c-a)*e,this._y=(r-l)*e,this._z=(s-i)*e}else if(n>o&&n>h){const e=2*Math.sqrt(1+n-o-h);this._w=(c-a)/e,this._x=.25*e,this._y=(i+s)/e,this._z=(r+l)/e}else if(o>h){const e=2*Math.sqrt(1+o-n-h);this._w=(r-l)/e,this._x=(i+s)/e,this._y=.25*e,this._z=(a+c)/e}else{const e=2*Math.sqrt(1+h-n-o);this._w=(s-i)/e,this._x=(r+l)/e,this._y=(a+c)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<Number.EPSILON?(n=0,Math.abs(e.x)>Math.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(Yn(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){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,s=e._w,o=t._x,a=t._y,l=t._z,c=t._w;return this._x=n*c+s*o+i*l-r*a,this._y=i*c+s*a+r*o-n*l,this._z=r*c+s*l+n*a-i*o,this._w=s*c-n*o-i*a-r*l,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);const n=this._x,i=this._y,r=this._z,s=this._w;let o=s*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=s,this._x=n,this._y=i,this._z=r,this;const a=1-o*o;if(a<=Number.EPSILON){const e=1-t;return this._w=e*s+t*this._w,this._x=e*n+t*this._x,this._y=e*i+t*this._y,this._z=e*r+t*this._z,this.normalize(),this}const l=Math.sqrt(a),c=Math.atan2(l,o),h=Math.sin((1-t)*c)/l,d=Math.sin(t*c)/l;return this._w=s*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Li{constructor(e=0,t=0,n=0){Li.prototype.isVector3=!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){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Pi.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Pi.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,s=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*s,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*s,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*s,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,s=e.y,o=e.z,a=e.w,l=2*(s*i-o*n),c=2*(o*t-r*i),h=2*(r*n-s*t);return this.x=t+a*l+s*h-o*c,this.y=n+a*c+o*l-r*h,this.z=i+a*h+r*c-s*l,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=Yn(this.x,e.x,t.x),this.y=Yn(this.y,e.y,t.y),this.z=Yn(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Yn(this.x,e,t),this.y=Yn(this.y,e,t),this.z=Yn(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Yn(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,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){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,s=t.x,o=t.y,a=t.z;return this.x=i*a-r*o,this.y=r*s-n*a,this.z=n*o-i*s,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Di.copy(this).projectOnVector(e),this.sub(Di)}reflect(e){return this.sub(Di.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(Yn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Di=new Li,Pi=new Ri;class Ui{constructor(e=new Li(1/0,1/0,1/0),t=new Li(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Fi.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Fi.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Fi.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===t&&void 0!==i&&!0!==e.isInstancedMesh)for(let t=0,n=i.count;t<n;t++)!0===e.isMesh?e.getVertexPosition(t,Fi):Fi.fromBufferAttribute(i,t),Fi.applyMatrix4(e.matrixWorld),this.expandByPoint(Fi);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),ki.copy(e.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),ki.copy(n.boundingBox)),ki.applyMatrix4(e.matrixWorld),this.union(ki)}const i=e.children;for(let e=0,n=i.length;e<n;e++)this.expandByObject(i[e],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Fi),Fi.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(ji),Wi.subVectors(this.max,ji),Ni.subVectors(e.a,ji),Qi.subVectors(e.b,ji),Gi.subVectors(e.c,ji),zi.subVectors(Qi,Ni),Hi.subVectors(Gi,Qi),Vi.subVectors(Ni,Gi);let t=[0,-zi.z,zi.y,0,-Hi.z,Hi.y,0,-Vi.z,Vi.y,zi.z,0,-zi.x,Hi.z,0,-Hi.x,Vi.z,0,-Vi.x,-zi.y,zi.x,0,-Hi.y,Hi.x,0,-Vi.y,Vi.x,0];return!!Yi(t,Ni,Qi,Gi,Wi)&&(t=[1,0,0,0,1,0,0,0,1],!!Yi(t,Ni,Qi,Gi,Wi)&&(qi.crossVectors(zi,Hi),t=[qi.x,qi.y,qi.z],Yi(t,Ni,Qi,Gi,Wi)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Fi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(Fi).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()||(Oi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Oi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Oi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Oi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Oi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Oi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Oi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Oi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Oi)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Oi=[new Li,new Li,new Li,new Li,new Li,new Li,new Li,new Li],Fi=new Li,ki=new Ui,Ni=new Li,Qi=new Li,Gi=new Li,zi=new Li,Hi=new Li,Vi=new Li,ji=new Li,Wi=new Li,qi=new Li,Xi=new Li;function Yi(e,t,n,i,r){for(let s=0,o=e.length-3;s<=o;s+=3){Xi.fromArray(e,s);const o=r.x*Math.abs(Xi.x)+r.y*Math.abs(Xi.y)+r.z*Math.abs(Xi.z),a=t.dot(Xi),l=n.dot(Xi),c=i.dot(Xi);if(Math.max(-Math.max(a,l,c),Math.min(a,l,c))>o)return!1}return!0}const Ji=new Ui,Ki=new Li,Zi=new Li;class $i{constructor(e=new Li,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):Ji.setFromPoints(e).getCenter(n);let i=0;for(let t=0,r=e.length;t<r;t++)i=Math.max(i,n.distanceToSquared(e[t]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ki.subVectors(e,this.center);const t=Ki.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(Ki,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(Zi.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ki.copy(e.center).add(Zi)),this.expandByPoint(Ki.copy(e.center).sub(Zi))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const er=new Li,tr=new Li,nr=new Li,ir=new Li,rr=new Li,sr=new Li,or=new Li;class ar{constructor(e=new Li,t=new Li(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,er)),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.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=er.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(er.copy(this.origin).addScaledVector(this.direction,t),er.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){tr.copy(e).add(t).multiplyScalar(.5),nr.copy(t).sub(e).normalize(),ir.copy(this.origin).sub(tr);const r=.5*e.distanceTo(t),s=-this.direction.dot(nr),o=ir.dot(this.direction),a=-ir.dot(nr),l=ir.lengthSq(),c=Math.abs(1-s*s);let h,d,u,p;if(c>0)if(h=s*a-o,d=s*o-a,p=r*c,h>=0)if(d>=-p)if(d<=p){const e=1/c;h*=e,d*=e,u=h*(h+s*d+2*o)+d*(s*h+d+2*a)+l}else d=r,h=Math.max(0,-(s*d+o)),u=-h*h+d*(d+2*a)+l;else d=-r,h=Math.max(0,-(s*d+o)),u=-h*h+d*(d+2*a)+l;else d<=-p?(h=Math.max(0,-(-s*r+o)),d=h>0?-r:Math.min(Math.max(-r,-a),r),u=-h*h+d*(d+2*a)+l):d<=p?(h=0,d=Math.min(Math.max(-r,-a),r),u=d*(d+2*a)+l):(h=Math.max(0,-(s*r+o)),d=h>0?r:Math.min(Math.max(-r,-a),r),u=-h*h+d*(d+2*a)+l);else d=s>0?-r:r,h=Math.max(0,-(s*d+o)),u=-h*h+d*(d+2*a)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(tr).addScaledVector(nr,d),u}intersectSphere(e,t){er.subVectors(e.center,this.origin);const n=er.dot(this.direction),i=er.dot(er)-n*n,r=e.radius*e.radius;if(i>r)return null;const s=Math.sqrt(r-i),o=n-s,a=n+s;return a<0?null:o<0?this.at(a,t):this.at(o,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,s,o,a;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),c>=0?(r=(e.min.y-d.y)*c,s=(e.max.y-d.y)*c):(r=(e.max.y-d.y)*c,s=(e.min.y-d.y)*c),n>s||r>i?null:((r>n||isNaN(n))&&(n=r),(s<i||isNaN(i))&&(i=s),h>=0?(o=(e.min.z-d.z)*h,a=(e.max.z-d.z)*h):(o=(e.max.z-d.z)*h,a=(e.min.z-d.z)*h),n>a||o>i?null:((o>n||n!=n)&&(n=o),(a<i||i!=i)&&(i=a),i<0?null:this.at(n>=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,er)}intersectTriangle(e,t,n,i,r){rr.subVectors(t,e),sr.subVectors(n,e),or.crossVectors(rr,sr);let s,o=this.direction.dot(or);if(o>0){if(i)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}ir.subVectors(this.origin,e);const a=s*this.direction.dot(sr.crossVectors(ir,sr));if(a<0)return null;const l=s*this.direction.dot(rr.cross(ir));if(l<0)return null;if(a+l>o)return null;const c=-s*ir.dot(or);return c<0?null:this.at(c/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class lr{constructor(e,t,n,i,r,s,o,a,l,c,h,d,u,p,A,f){lr.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,s,o,a,l,c,h,d,u,p,A,f)}set(e,t,n,i,r,s,o,a,l,c,h,d,u,p,A,f){const m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=i,m[1]=r,m[5]=s,m[9]=o,m[13]=a,m[2]=l,m[6]=c,m[10]=h,m[14]=d,m[3]=u,m[7]=p,m[11]=A,m[15]=f,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 lr).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/cr.setFromMatrixColumn(e,0).length(),r=1/cr.setFromMatrixColumn(e,1).length(),s=1/cr.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){const t=this.elements,n=e.x,i=e.y,r=e.z,s=Math.cos(n),o=Math.sin(n),a=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){const e=s*c,n=s*h,i=o*c,r=o*h;t[0]=a*c,t[4]=-a*h,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-o*a,t[2]=r-e*l,t[6]=i+n*l,t[10]=s*a}else if("YXZ"===e.order){const e=a*c,n=a*h,i=l*c,r=l*h;t[0]=e+r*o,t[4]=i*o-n,t[8]=s*l,t[1]=s*h,t[5]=s*c,t[9]=-o,t[2]=n*o-i,t[6]=r+e*o,t[10]=s*a}else if("ZXY"===e.order){const e=a*c,n=a*h,i=l*c,r=l*h;t[0]=e-r*o,t[4]=-s*h,t[8]=i+n*o,t[1]=n+i*o,t[5]=s*c,t[9]=r-e*o,t[2]=-s*l,t[6]=o,t[10]=s*a}else if("ZYX"===e.order){const e=s*c,n=s*h,i=o*c,r=o*h;t[0]=a*c,t[4]=i*l-n,t[8]=e*l+r,t[1]=a*h,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=o*a,t[10]=s*a}else if("YZX"===e.order){const e=s*a,n=s*l,i=o*a,r=o*l;t[0]=a*c,t[4]=r-e*h,t[8]=i*h+n,t[1]=h,t[5]=s*c,t[9]=-o*c,t[2]=-l*c,t[6]=n*h+i,t[10]=e-r*h}else if("XZY"===e.order){const e=s*a,n=s*l,i=o*a,r=o*l;t[0]=a*c,t[4]=-h,t[8]=l*c,t[1]=e*h+r,t[5]=s*c,t[9]=n*h-i,t[2]=i*h-n,t[6]=o*c,t[10]=r*h+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(dr,e,ur)}lookAt(e,t,n){const i=this.elements;return fr.subVectors(e,t),0===fr.lengthSq()&&(fr.z=1),fr.normalize(),pr.crossVectors(n,fr),0===pr.lengthSq()&&(1===Math.abs(n.z)?fr.x+=1e-4:fr.z+=1e-4,fr.normalize(),pr.crossVectors(n,fr)),pr.normalize(),Ar.crossVectors(fr,pr),i[0]=pr.x,i[4]=Ar.x,i[8]=fr.x,i[1]=pr.y,i[5]=Ar.y,i[9]=fr.y,i[2]=pr.z,i[6]=Ar.z,i[10]=fr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,s=n[0],o=n[4],a=n[8],l=n[12],c=n[1],h=n[5],d=n[9],u=n[13],p=n[2],A=n[6],f=n[10],m=n[14],g=n[3],v=n[7],y=n[11],E=n[15],x=i[0],b=i[4],C=i[8],w=i[12],_=i[1],M=i[5],S=i[9],I=i[13],B=i[2],T=i[6],R=i[10],L=i[14],D=i[3],P=i[7],U=i[11],O=i[15];return r[0]=s*x+o*_+a*B+l*D,r[4]=s*b+o*M+a*T+l*P,r[8]=s*C+o*S+a*R+l*U,r[12]=s*w+o*I+a*L+l*O,r[1]=c*x+h*_+d*B+u*D,r[5]=c*b+h*M+d*T+u*P,r[9]=c*C+h*S+d*R+u*U,r[13]=c*w+h*I+d*L+u*O,r[2]=p*x+A*_+f*B+m*D,r[6]=p*b+A*M+f*T+m*P,r[10]=p*C+A*S+f*R+m*U,r[14]=p*w+A*I+f*L+m*O,r[3]=g*x+v*_+y*B+E*D,r[7]=g*b+v*M+y*T+E*P,r[11]=g*C+v*S+y*R+E*U,r[15]=g*w+v*I+y*L+E*O,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],s=e[1],o=e[5],a=e[9],l=e[13],c=e[2],h=e[6],d=e[10],u=e[14];return e[3]*(+r*a*h-i*l*h-r*o*d+n*l*d+i*o*u-n*a*u)+e[7]*(+t*a*u-t*l*d+r*s*d-i*s*u+i*l*c-r*a*c)+e[11]*(+t*l*h-t*o*u-r*s*h+n*s*u+r*o*c-n*l*c)+e[15]*(-i*o*c-t*a*h+t*o*d+i*s*h-n*s*d+n*a*c)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],s=e[4],o=e[5],a=e[6],l=e[7],c=e[8],h=e[9],d=e[10],u=e[11],p=e[12],A=e[13],f=e[14],m=e[15],g=h*f*l-A*d*l+A*a*u-o*f*u-h*a*m+o*d*m,v=p*d*l-c*f*l-p*a*u+s*f*u+c*a*m-s*d*m,y=c*A*l-p*h*l+p*o*u-s*A*u-c*o*m+s*h*m,E=p*h*a-c*A*a-p*o*d+s*A*d+c*o*f-s*h*f,x=t*g+n*v+i*y+r*E;if(0===x)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/x;return e[0]=g*b,e[1]=(A*d*r-h*f*r-A*i*u+n*f*u+h*i*m-n*d*m)*b,e[2]=(o*f*r-A*a*r+A*i*l-n*f*l-o*i*m+n*a*m)*b,e[3]=(h*a*r-o*d*r-h*i*l+n*d*l+o*i*u-n*a*u)*b,e[4]=v*b,e[5]=(c*f*r-p*d*r+p*i*u-t*f*u-c*i*m+t*d*m)*b,e[6]=(p*a*r-s*f*r-p*i*l+t*f*l+s*i*m-t*a*m)*b,e[7]=(s*d*r-c*a*r+c*i*l-t*d*l-s*i*u+t*a*u)*b,e[8]=y*b,e[9]=(p*h*r-c*A*r-p*n*u+t*A*u+c*n*m-t*h*m)*b,e[10]=(s*A*r-p*o*r+p*n*l-t*A*l-s*n*m+t*o*m)*b,e[11]=(c*o*r-s*h*r-c*n*l+t*h*l+s*n*u-t*o*u)*b,e[12]=E*b,e[13]=(c*A*i-p*h*i+p*n*d-t*A*d-c*n*f+t*h*f)*b,e[14]=(p*o*i-s*A*i-p*n*a+t*A*a+s*n*f-t*o*f)*b,e[15]=(s*h*i-c*o*i+c*n*a-t*h*a-s*n*d+t*o*d)*b,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 e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,s=e.x,o=e.y,a=e.z,l=r*s,c=r*o;return this.set(l*s+n,l*o-i*a,l*a+i*o,0,l*o+i*a,c*o+n,c*a-i*s,0,l*a-i*o,c*a+i*s,r*a*a+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,s){return this.set(1,n,r,0,e,1,s,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,s=t._y,o=t._z,a=t._w,l=r+r,c=s+s,h=o+o,d=r*l,u=r*c,p=r*h,A=s*c,f=s*h,m=o*h,g=a*l,v=a*c,y=a*h,E=n.x,x=n.y,b=n.z;return i[0]=(1-(A+m))*E,i[1]=(u+y)*E,i[2]=(p-v)*E,i[3]=0,i[4]=(u-y)*x,i[5]=(1-(d+m))*x,i[6]=(f+g)*x,i[7]=0,i[8]=(p+v)*b,i[9]=(f-g)*b,i[10]=(1-(d+A))*b,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=cr.set(i[0],i[1],i[2]).length();const s=cr.set(i[4],i[5],i[6]).length(),o=cr.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],hr.copy(this);const a=1/r,l=1/s,c=1/o;return hr.elements[0]*=a,hr.elements[1]*=a,hr.elements[2]*=a,hr.elements[4]*=l,hr.elements[5]*=l,hr.elements[6]*=l,hr.elements[8]*=c,hr.elements[9]*=c,hr.elements[10]*=c,t.setFromRotationMatrix(hr),n.x=r,n.y=s,n.z=o,this}makePerspective(e,t,n,i,r,s,o=Gn){const a=this.elements,l=2*r/(t-e),c=2*r/(n-i),h=(t+e)/(t-e),d=(n+i)/(n-i);let u,p;if(o===Gn)u=-(s+r)/(s-r),p=-2*s*r/(s-r);else{if(o!==zn)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);u=-s/(s-r),p=-s*r/(s-r)}return a[0]=l,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=c,a[9]=d,a[13]=0,a[2]=0,a[6]=0,a[10]=u,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,r,s,o=Gn){const a=this.elements,l=1/(t-e),c=1/(n-i),h=1/(s-r),d=(t+e)*l,u=(n+i)*c;let p,A;if(o===Gn)p=(s+r)*h,A=-2*h;else{if(o!==zn)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);p=r*h,A=-1*h}return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-d,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-u,a[2]=0,a[6]=0,a[10]=A,a[14]=-p,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}}const cr=new Li,hr=new lr,dr=new Li(0,0,0),ur=new Li(1,1,1),pr=new Li,Ar=new Li,fr=new Li,mr=new lr,gr=new Ri;class vr{constructor(e=0,t=0,n=0,i=vr.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,r=i[0],s=i[4],o=i[8],a=i[1],l=i[5],c=i[9],h=i[2],d=i[6],u=i[10];switch(t){case"XYZ":this._y=Math.asin(Yn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,u),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Yn(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(o,u),this._z=Math.atan2(a,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(Yn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,u),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(a,r));break;case"ZYX":this._y=Math.asin(-Yn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,u),this._z=Math.atan2(a,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(Yn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(o,u));break;case"XZY":this._z=Math.asin(-Yn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,r)):(this._x=Math.atan2(-c,u),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 mr.makeRotationFromQuaternion(e),this.setFromRotationMatrix(mr,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return gr.setFromEuler(this),this.setFromQuaternion(gr,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}vr.DEFAULT_ORDER="XYZ";class yr{constructor(){this.mask=1}set(e){this.mask=1<<e>>>0}enable(e){this.mask|=1<<e}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e}disable(e){this.mask&=~(1<<e)}disableAll(){this.mask=0}test(e){return!!(this.mask&e.mask)}isEnabled(e){return!!(this.mask&1<<e)}}let Er=0;const xr=new Li,br=new Ri,Cr=new lr,wr=new Li,_r=new Li,Mr=new Li,Sr=new Ri,Ir=new Li(1,0,0),Br=new Li(0,1,0),Tr=new Li(0,0,1),Rr={type:"added"},Lr={type:"removed"},Dr={type:"childadded",child:null},Pr={type:"childremoved",child:null};class Ur extends Hn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Er++}),this.uuid=Xn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Ur.DEFAULT_UP.clone();const e=new Li,t=new vr,n=new Ri,i=new Li(1,1,1);t._onChange((function(){n.setFromEuler(t,!1)})),n._onChange((function(){t.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new lr},normalMatrix:{value:new ni}}),this.matrix=new lr,this.matrixWorld=new lr,this.matrixAutoUpdate=Ur.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Ur.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new yr,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return br.setFromAxisAngle(e,t),this.quaternion.multiply(br),this}rotateOnWorldAxis(e,t){return br.setFromAxisAngle(e,t),this.quaternion.premultiply(br),this}rotateX(e){return this.rotateOnAxis(Ir,e)}rotateY(e){return this.rotateOnAxis(Br,e)}rotateZ(e){return this.rotateOnAxis(Tr,e)}translateOnAxis(e,t){return xr.copy(e).applyQuaternion(this.quaternion),this.position.add(xr.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Ir,e)}translateY(e){return this.translateOnAxis(Br,e)}translateZ(e){return this.translateOnAxis(Tr,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Cr.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?wr.copy(e):wr.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),_r.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Cr.lookAt(_r,wr,this.up):Cr.lookAt(wr,_r,this.up),this.quaternion.setFromRotationMatrix(Cr),i&&(Cr.extractRotation(i.matrixWorld),br.setFromRotationMatrix(Cr),this.quaternion.premultiply(br.invert()))}add(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Rr),Dr.child=e,this.dispatchEvent(Dr),Dr.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.remove(arguments[e]);return this}const t=this.children.indexOf(e);return-1!==t&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(Lr),Pr.child=e,this.dispatchEvent(Pr),Pr.child=null),this}removeFromParent(){const e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Cr.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),Cr.multiply(e.parent.matrixWorld)),e.applyMatrix4(Cr),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Rr),Dr.child=e,this.dispatchEvent(Dr),Dr.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(e,t);if(void 0!==i)return i}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let r=0,s=i.length;r<s;r++)i[r].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_r,e,Mr),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(_r,Sr,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(!0===e&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===t){const e=this.children;for(let t=0,n=e.length;t<n;t++)e[t].updateWorldMatrix(!1,!0)}}toJSON(e){const t=void 0===e||"string"==typeof e,n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(t,n){return void 0===t[n.uuid]&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map((e=>({boxInitialized:e.boxInitialized,boxMin:e.box.min.toArray(),boxMax:e.box.max.toArray(),sphereInitialized:e.sphereInitialized,sphereRadius:e.sphere.radius,sphereCenter:e.sphere.center.toArray()}))),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const i=n[t];r(e.shapes,i)}else r(e.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const t=[];for(let n=0,i=this.material.length;n<i;n++)t.push(r(e.materials,this.material[n]));i.material=t}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(let t=0;t<this.children.length;t++)i.children.push(this.children[t].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let t=0;t<this.animations.length;t++){const n=this.animations[t];i.animations.push(r(e.animations,n))}}if(t){const t=s(e.geometries),i=s(e.materials),r=s(e.textures),o=s(e.images),a=s(e.shapes),l=s(e.skeletons),c=s(e.animations),h=s(e.nodes);t.length>0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),o.length>0&&(n.images=o),a.length>0&&(n.shapes=a),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),h.length>0&&(n.nodes=h)}return n.object=i,n;function s(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let t=0;t<e.children.length;t++){const n=e.children[t];this.add(n.clone())}return this}}Ur.DEFAULT_UP=new Li(0,1,0),Ur.DEFAULT_MATRIX_AUTO_UPDATE=!0,Ur.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Or=new Li,Fr=new Li,kr=new Li,Nr=new Li,Qr=new Li,Gr=new Li,zr=new Li,Hr=new Li,Vr=new Li,jr=new Li,Wr=new wi,qr=new wi,Xr=new wi;class Yr{constructor(e=new Li,t=new Li,n=new Li){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),Or.subVectors(e,t),i.cross(Or);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){Or.subVectors(i,t),Fr.subVectors(n,t),kr.subVectors(e,t);const s=Or.dot(Or),o=Or.dot(Fr),a=Or.dot(kr),l=Fr.dot(Fr),c=Fr.dot(kr),h=s*l-o*o;if(0===h)return r.set(0,0,0),null;const d=1/h,u=(l*a-o*c)*d,p=(s*c-o*a)*d;return r.set(1-u-p,p,u)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,Nr)&&Nr.x>=0&&Nr.y>=0&&Nr.x+Nr.y<=1}static getInterpolation(e,t,n,i,r,s,o,a){return null===this.getBarycoord(e,t,n,i,Nr)?(a.x=0,a.y=0,"z"in a&&(a.z=0),"w"in a&&(a.w=0),null):(a.setScalar(0),a.addScaledVector(r,Nr.x),a.addScaledVector(s,Nr.y),a.addScaledVector(o,Nr.z),a)}static getInterpolatedAttribute(e,t,n,i,r,s){return Wr.setScalar(0),qr.setScalar(0),Xr.setScalar(0),Wr.fromBufferAttribute(e,t),qr.fromBufferAttribute(e,n),Xr.fromBufferAttribute(e,i),s.setScalar(0),s.addScaledVector(Wr,r.x),s.addScaledVector(qr,r.y),s.addScaledVector(Xr,r.z),s}static isFrontFacing(e,t,n,i){return Or.subVectors(n,t),Fr.subVectors(e,t),Or.cross(Fr).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Or.subVectors(this.c,this.b),Fr.subVectors(this.a,this.b),.5*Or.cross(Fr).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Yr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Yr.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return Yr.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return Yr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Yr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let s,o;Qr.subVectors(i,n),Gr.subVectors(r,n),Hr.subVectors(e,n);const a=Qr.dot(Hr),l=Gr.dot(Hr);if(a<=0&&l<=0)return t.copy(n);Vr.subVectors(e,i);const c=Qr.dot(Vr),h=Gr.dot(Vr);if(c>=0&&h<=c)return t.copy(i);const d=a*h-c*l;if(d<=0&&a>=0&&c<=0)return s=a/(a-c),t.copy(n).addScaledVector(Qr,s);jr.subVectors(e,r);const u=Qr.dot(jr),p=Gr.dot(jr);if(p>=0&&u<=p)return t.copy(r);const A=u*l-a*p;if(A<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(n).addScaledVector(Gr,o);const f=c*p-u*h;if(f<=0&&h-c>=0&&u-p>=0)return zr.subVectors(r,i),o=(h-c)/(h-c+(u-p)),t.copy(i).addScaledVector(zr,o);const m=1/(f+A+d);return s=A*m,o=d*m,t.copy(n).addScaledVector(Qr,s).addScaledVector(Gr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const Jr={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},Kr={h:0,s:0,l:0},Zr={h:0,s:0,l:0};function $r(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}class es{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"==typeof t?this.setHex(t):"string"==typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=tn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,Ai.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Ai.workingColorSpace){return this.r=e,this.g=t,this.b=n,Ai.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Ai.workingColorSpace){if(e=Jn(e,1),t=Yn(t,0,1),n=Yn(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=$r(r,i,e+1/3),this.g=$r(r,i,e),this.b=$r(r,i,e-1/3)}return Ai.toWorkingColorSpace(this,i),this}setStyle(e,t=tn){function n(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const s=i[1],o=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,t);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(6===r)return this.setHex(parseInt(n,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=tn){const n=Jr[e.toLowerCase()];return void 0!==n?this.setHex(n,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=fi(e.r),this.g=fi(e.g),this.b=fi(e.b),this}copyLinearToSRGB(e){return this.r=mi(e.r),this.g=mi(e.g),this.b=mi(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=tn){return Ai.fromWorkingColorSpace(ts.copy(this),e),65536*Math.round(Yn(255*ts.r,0,255))+256*Math.round(Yn(255*ts.g,0,255))+Math.round(Yn(255*ts.b,0,255))}getHexString(e=tn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ai.workingColorSpace){Ai.fromWorkingColorSpace(ts.copy(this),t);const n=ts.r,i=ts.g,r=ts.b,s=Math.max(n,i,r),o=Math.min(n,i,r);let a,l;const c=(o+s)/2;if(o===s)a=0,l=0;else{const e=s-o;switch(l=c<=.5?e/(s+o):e/(2-s-o),s){case n:a=(i-r)/e+(i<r?6:0);break;case i:a=(r-n)/e+2;break;case r:a=(n-i)/e+4}a/=6}return e.h=a,e.s=l,e.l=c,e}getRGB(e,t=Ai.workingColorSpace){return Ai.fromWorkingColorSpace(ts.copy(this),t),e.r=ts.r,e.g=ts.g,e.b=ts.b,e}getStyle(e=tn){Ai.fromWorkingColorSpace(ts.copy(this),e);const t=ts.r,n=ts.g,i=ts.b;return e!==tn?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(e,t,n){return this.getHSL(Kr),this.setHSL(Kr.h+e,Kr.s+t,Kr.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Kr),e.getHSL(Zr);const n=Kn(Kr.h,Zr.h,t),i=Kn(Kr.s,Zr.s,t),r=Kn(Kr.l,Zr.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const ts=new es;es.NAMES=Jr;let ns=0;class is extends Hn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ns++}),this.uuid=Xn(),this.name="",this.type="Material",this.blending=E,this.side=m,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=P,this.blendDst=U,this.blendEquation=_,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new es(0,0,0),this.blendAlpha=0,this.depthFunc=X,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=xn,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=an,this.stencilZFail=an,this.stencilZPass=an,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);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.Material: '${t}' is not a property of THREE.${this.type}.`)}}toJSON(e){const t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),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&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==E&&(n.blending=this.blending),this.side!==m&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==P&&(n.blendSrc=this.blendSrc),this.blendDst!==U&&(n.blendDst=this.blendDst),this.blendEquation!==_&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==X&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==xn&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==an&&(n.stencilFail=this.stencilFail),this.stencilZFail!==an&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==an&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),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=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let 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.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class rs extends is{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new es(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vr,this.combine=$,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const ss=os();function os(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let e=0;e<256;++e){const t=e-127;t<-27?(i[e]=0,i[256|e]=32768,r[e]=24,r[256|e]=24):t<-14?(i[e]=1024>>-t-14,i[256|e]=1024>>-t-14|32768,r[e]=-t-1,r[256|e]=-t-1):t<=15?(i[e]=t+15<<10,i[256|e]=t+15<<10|32768,r[e]=13,r[256|e]=13):t<128?(i[e]=31744,i[256|e]=64512,r[e]=24,r[256|e]=24):(i[e]=31744,i[256|e]=64512,r[e]=13,r[256|e]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let e=1;e<1024;++e){let t=e<<13,n=0;for(;!(8388608&t);)t<<=1,n-=8388608;t&=-8388609,n+=947912704,s[e]=t|n}for(let e=1024;e<2048;++e)s[e]=939524096+(e-1024<<13);for(let e=1;e<31;++e)o[e]=e<<23;o[31]=1199570944,o[32]=2147483648;for(let e=33;e<63;++e)o[e]=2147483648+(e-32<<23);o[63]=3347054592;for(let e=1;e<64;++e)32!==e&&(a[e]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function as(e){Math.abs(e)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),e=Yn(e,-65504,65504),ss.floatView[0]=e;const t=ss.uint32View[0],n=t>>23&511;return ss.baseTable[n]+((8388607&t)>>ss.shiftTable[n])}function ls(e){const t=e>>10;return ss.uint32View[0]=ss.mantissaTable[ss.offsetTable[t]+(1023&e)]+ss.exponentTable[t],ss.floatView[0]}const cs={toHalfFloat:as,fromHalfFloat:ls},hs=new Li,ds=new ti;class us{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=Tn,this.updateRanges=[],this.gpuType=Fe,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,n=this.count;t<n;t++)ds.fromBufferAttribute(this,t),ds.applyMatrix3(e),this.setXY(t,ds.x,ds.y);else if(3===this.itemSize)for(let t=0,n=this.count;t<n;t++)hs.fromBufferAttribute(this,t),hs.applyMatrix3(e),this.setXYZ(t,hs.x,hs.y,hs.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)hs.fromBufferAttribute(this,t),hs.applyMatrix4(e),this.setXYZ(t,hs.x,hs.y,hs.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)hs.fromBufferAttribute(this,t),hs.applyNormalMatrix(e),this.setXYZ(t,hs.x,hs.y,hs.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)hs.fromBufferAttribute(this,t),hs.transformDirection(e),this.setXYZ(t,hs.x,hs.y,hs.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Zn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=$n(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Zn(t,this.array)),t}setX(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Zn(t,this.array)),t}setY(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Zn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Zn(t,this.array)),t}setW(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array),r=$n(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==Tn&&(e.usage=this.usage),e}}class ps extends us{constructor(e,t,n){super(new Int8Array(e),t,n)}}class As extends us{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class fs extends us{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class ms extends us{constructor(e,t,n){super(new Int16Array(e),t,n)}}class gs extends us{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class vs extends us{constructor(e,t,n){super(new Int32Array(e),t,n)}}class ys extends us{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class Es extends us{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=ls(this.array[e*this.itemSize]);return this.normalized&&(t=Zn(t,this.array)),t}setX(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize]=as(t),this}getY(e){let t=ls(this.array[e*this.itemSize+1]);return this.normalized&&(t=Zn(t,this.array)),t}setY(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+1]=as(t),this}getZ(e){let t=ls(this.array[e*this.itemSize+2]);return this.normalized&&(t=Zn(t,this.array)),t}setZ(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+2]=as(t),this}getW(e){let t=ls(this.array[e*this.itemSize+3]);return this.normalized&&(t=Zn(t,this.array)),t}setW(e,t){return this.normalized&&(t=$n(t,this.array)),this.array[e*this.itemSize+3]=as(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array)),this.array[e+0]=as(t),this.array[e+1]=as(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array)),this.array[e+0]=as(t),this.array[e+1]=as(n),this.array[e+2]=as(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array),r=$n(r,this.array)),this.array[e+0]=as(t),this.array[e+1]=as(n),this.array[e+2]=as(i),this.array[e+3]=as(r),this}}class xs extends us{constructor(e,t,n){super(new Float32Array(e),t,n)}}let bs=0;const Cs=new lr,ws=new Ur,_s=new Li,Ms=new Ui,Ss=new Ui,Is=new Li;class Bs extends Hn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:bs++}),this.uuid=Xn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=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(ri(e)?ys:gs)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}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 ni).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 Cs.makeRotationFromQuaternion(e),this.applyMatrix4(Cs),this}rotateX(e){return Cs.makeRotationX(e),this.applyMatrix4(Cs),this}rotateY(e){return Cs.makeRotationY(e),this.applyMatrix4(Cs),this}rotateZ(e){return Cs.makeRotationZ(e),this.applyMatrix4(Cs),this}translate(e,t,n){return Cs.makeTranslation(e,t,n),this.applyMatrix4(Cs),this}scale(e,t,n){return Cs.makeScale(e,t,n),this.applyMatrix4(Cs),this}lookAt(e){return ws.lookAt(e),ws.updateMatrix(),this.applyMatrix4(ws.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(_s).negate(),this.translate(_s.x,_s.y,_s.z),this}setFromPoints(e){const t=this.getAttribute("position");if(void 0===t){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n];t.push(i.x,i.y,i.z||0)}this.setAttribute("position",new xs(t,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const n=e[i];t.setXYZ(i,n.x,n.y,n.z||0)}e.length>t.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Ui);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Li(-1/0,-1/0,-1/0),new Li(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];Ms.setFromBufferAttribute(n),this.morphTargetsRelative?(Is.addVectors(this.boundingBox.min,Ms.min),this.boundingBox.expandByPoint(Is),Is.addVectors(this.boundingBox.max,Ms.max),this.boundingBox.expandByPoint(Is)):(this.boundingBox.expandByPoint(Ms.min),this.boundingBox.expandByPoint(Ms.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new $i);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new Li,1/0);if(e){const n=this.boundingSphere.center;if(Ms.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e<n;e++){const n=t[e];Ss.setFromBufferAttribute(n),this.morphTargetsRelative?(Is.addVectors(Ms.min,Ss.min),Ms.expandByPoint(Is),Is.addVectors(Ms.max,Ss.max),Ms.expandByPoint(Is)):(Ms.expandByPoint(Ss.min),Ms.expandByPoint(Ss.max))}Ms.getCenter(n);let i=0;for(let t=0,r=e.count;t<r;t++)Is.fromBufferAttribute(e,t),i=Math.max(i,n.distanceToSquared(Is));if(t)for(let r=0,s=t.length;r<s;r++){const s=t[r],o=this.morphTargetsRelative;for(let t=0,r=s.count;t<r;t++)Is.fromBufferAttribute(s,t),o&&(_s.fromBufferAttribute(e,t),Is.add(_s)),i=Math.max(i,n.distanceToSquared(Is))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=t.position,i=t.normal,r=t.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new us(new Float32Array(4*n.count),4));const s=this.getAttribute("tangent"),o=[],a=[];for(let e=0;e<n.count;e++)o[e]=new Li,a[e]=new Li;const l=new Li,c=new Li,h=new Li,d=new ti,u=new ti,p=new ti,A=new Li,f=new Li;function m(e,t,i){l.fromBufferAttribute(n,e),c.fromBufferAttribute(n,t),h.fromBufferAttribute(n,i),d.fromBufferAttribute(r,e),u.fromBufferAttribute(r,t),p.fromBufferAttribute(r,i),c.sub(l),h.sub(l),u.sub(d),p.sub(d);const s=1/(u.x*p.y-p.x*u.y);isFinite(s)&&(A.copy(c).multiplyScalar(p.y).addScaledVector(h,-u.y).multiplyScalar(s),f.copy(h).multiplyScalar(u.x).addScaledVector(c,-p.x).multiplyScalar(s),o[e].add(A),o[t].add(A),o[i].add(A),a[e].add(f),a[t].add(f),a[i].add(f))}let g=this.groups;0===g.length&&(g=[{start:0,count:e.count}]);for(let t=0,n=g.length;t<n;++t){const n=g[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)m(e.getX(t+0),e.getX(t+1),e.getX(t+2))}const v=new Li,y=new Li,E=new Li,x=new Li;function b(e){E.fromBufferAttribute(i,e),x.copy(E);const t=o[e];v.copy(t),v.sub(E.multiplyScalar(E.dot(t))).normalize(),y.crossVectors(x,t);const n=y.dot(a[e])<0?-1:1;s.setXYZW(e,v.x,v.y,v.z,n)}for(let t=0,n=g.length;t<n;++t){const n=g[t],i=n.start;for(let t=i,r=i+n.count;t<r;t+=3)b(e.getX(t+0)),b(e.getX(t+1)),b(e.getX(t+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(void 0!==t){let n=this.getAttribute("normal");if(void 0===n)n=new us(new Float32Array(3*t.count),3),this.setAttribute("normal",n);else for(let e=0,t=n.count;e<t;e++)n.setXYZ(e,0,0,0);const i=new Li,r=new Li,s=new Li,o=new Li,a=new Li,l=new Li,c=new Li,h=new Li;if(e)for(let d=0,u=e.count;d<u;d+=3){const u=e.getX(d+0),p=e.getX(d+1),A=e.getX(d+2);i.fromBufferAttribute(t,u),r.fromBufferAttribute(t,p),s.fromBufferAttribute(t,A),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),o.fromBufferAttribute(n,u),a.fromBufferAttribute(n,p),l.fromBufferAttribute(n,A),o.add(c),a.add(c),l.add(c),n.setXYZ(u,o.x,o.y,o.z),n.setXYZ(p,a.x,a.y,a.z),n.setXYZ(A,l.x,l.y,l.z)}else for(let e=0,o=t.count;e<o;e+=3)i.fromBufferAttribute(t,e+0),r.fromBufferAttribute(t,e+1),s.fromBufferAttribute(t,e+2),c.subVectors(s,r),h.subVectors(i,r),c.cross(h),n.setXYZ(e+0,c.x,c.y,c.z),n.setXYZ(e+1,c.x,c.y,c.z),n.setXYZ(e+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)Is.fromBufferAttribute(e,t),Is.normalize(),e.setXYZ(t,Is.x,Is.y,Is.z)}toNonIndexed(){function e(e,t){const n=e.array,i=e.itemSize,r=e.normalized,s=new n.constructor(t.length*i);let o=0,a=0;for(let r=0,l=t.length;r<l;r++){o=e.isInterleavedBufferAttribute?t[r]*e.data.stride+e.offset:t[r]*i;for(let e=0;e<i;e++)s[a++]=n[o++]}return new us(s,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Bs,n=this.index.array,i=this.attributes;for(const r in i){const s=e(i[r],n);t.setAttribute(r,s)}const r=this.morphAttributes;for(const i in r){const s=[],o=r[i];for(let t=0,i=o.length;t<i;t++){const i=e(o[t],n);s.push(i)}t.morphAttributes[i]=s}t.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let e=0,n=s.length;e<n;e++){const n=s[e];t.addGroup(n.start,n.count,n.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const 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;t<i;t++){const i=n[t];s.push(i.toJSON(e.data))}s.length>0&&(i[t]=s,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return null!==o&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.radius}),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone(t));const i=e.attributes;for(const e in i){const n=i[e];this.setAttribute(e,n.clone(t))}const r=e.morphAttributes;for(const e in r){const n=[],i=r[e];for(let e=0,r=i.length;e<r;e++)n.push(i[e].clone(t));this.morphAttributes[e]=n}this.morphTargetsRelative=e.morphTargetsRelative;const s=e.groups;for(let e=0,t=s.length;e<t;e++){const t=s[e];this.addGroup(t.start,t.count,t.materialIndex)}const o=e.boundingBox;null!==o&&(this.boundingBox=o.clone());const a=e.boundingSphere;return null!==a&&(this.boundingSphere=a.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Ts=new lr,Rs=new ar,Ls=new $i,Ds=new Li,Ps=new Li,Us=new Li,Os=new Li,Fs=new Li,ks=new Li,Ns=new Li,Qs=new Li;class Gs extends Ur{constructor(e=new Bs,t=new rs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,s=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(r&&o){ks.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=o[n],a=r[n];0!==i&&(Fs.fromBufferAttribute(a,e),s?ks.addScaledVector(Fs,i):ks.addScaledVector(Fs.sub(t),i))}t.add(ks)}return t}raycast(e,t){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),Ls.copy(n.boundingSphere),Ls.applyMatrix4(r),Rs.copy(e.ray).recast(e.near),!1===Ls.containsPoint(Rs.origin)){if(null===Rs.intersectSphere(Ls,Ds))return;if(Rs.origin.distanceToSquared(Ds)>(e.far-e.near)**2)return}Ts.copy(r).invert(),Rs.copy(e.ray).applyMatrix4(Ts),null!==n.boundingBox&&!1===Rs.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,Rs)}}_computeIntersections(e,t,n){let i;const r=this.geometry,s=this.material,o=r.index,a=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,d=r.groups,u=r.drawRange;if(null!==o)if(Array.isArray(s))for(let r=0,a=d.length;r<a;r++){const a=d[r],p=s[a.materialIndex];for(let r=Math.max(a.start,u.start),s=Math.min(o.count,Math.min(a.start+a.count,u.start+u.count));r<s;r+=3)i=zs(this,p,e,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=a.materialIndex,t.push(i))}else for(let r=Math.max(0,u.start),a=Math.min(o.count,u.start+u.count);r<a;r+=3)i=zs(this,s,e,n,l,c,h,o.getX(r),o.getX(r+1),o.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),t.push(i));else if(void 0!==a)if(Array.isArray(s))for(let r=0,o=d.length;r<o;r++){const o=d[r],p=s[o.materialIndex];for(let r=Math.max(o.start,u.start),s=Math.min(a.count,Math.min(o.start+o.count,u.start+u.count));r<s;r+=3)i=zs(this,p,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,t.push(i))}else for(let r=Math.max(0,u.start),o=Math.min(a.count,u.start+u.count);r<o;r+=3)i=zs(this,s,e,n,l,c,h,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),t.push(i))}}function zs(e,t,n,i,r,s,o,a,l,c){e.getVertexPosition(a,Ps),e.getVertexPosition(l,Us),e.getVertexPosition(c,Os);const h=function(e,t,n,i,r,s,o,a){let l;if(l=t.side===g?i.intersectTriangle(o,s,r,!0,a):i.intersectTriangle(r,s,o,t.side===m,a),null===l)return null;Qs.copy(a),Qs.applyMatrix4(e.matrixWorld);const c=n.ray.origin.distanceTo(Qs);return c<n.near||c>n.far?null:{distance:c,point:Qs.clone(),object:e}}(e,t,n,i,Ps,Us,Os,Ns);if(h){const e=new Li;Yr.getBarycoord(Ns,Ps,Us,Os,e),r&&(h.uv=Yr.getInterpolatedAttribute(r,a,l,c,e,new ti)),s&&(h.uv1=Yr.getInterpolatedAttribute(s,a,l,c,e,new ti)),o&&(h.normal=Yr.getInterpolatedAttribute(o,a,l,c,e,new Li),h.normal.dot(i.direction)>0&&h.normal.multiplyScalar(-1));const t={a,b:l,c,normal:new Li,materialIndex:0};Yr.getNormal(Ps,Us,Os,t.normal),h.face=t,h.barycoord=e}return h}class Hs extends Bs{constructor(e=1,t=1,n=1,i=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:s};const o=this;i=Math.floor(i),r=Math.floor(r),s=Math.floor(s);const a=[],l=[],c=[],h=[];let d=0,u=0;function p(e,t,n,i,r,s,p,A,f,m,g){const v=s/f,y=p/m,E=s/2,x=p/2,b=A/2,C=f+1,w=m+1;let _=0,M=0;const S=new Li;for(let s=0;s<w;s++){const o=s*y-x;for(let a=0;a<C;a++){const d=a*v-E;S[e]=d*i,S[t]=o*r,S[n]=b,l.push(S.x,S.y,S.z),S[e]=0,S[t]=0,S[n]=A>0?1:-1,c.push(S.x,S.y,S.z),h.push(a/f),h.push(1-s/m),_+=1}}for(let e=0;e<m;e++)for(let t=0;t<f;t++){const n=d+t+C*e,i=d+t+C*(e+1),r=d+(t+1)+C*(e+1),s=d+(t+1)+C*e;a.push(n,i,s),a.push(i,r,s),M+=6}o.addGroup(u,M,g),u+=M,d+=_}p("z","y","x",-1,-1,n,t,e,s,r,0),p("z","y","x",1,-1,n,t,-e,s,r,1),p("x","z","y",1,1,e,n,t,i,s,2),p("x","z","y",1,-1,e,n,-t,i,s,3),p("x","y","z",1,-1,e,t,n,i,r,4),p("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(a),this.setAttribute("position",new xs(l,3)),this.setAttribute("normal",new xs(c,3)),this.setAttribute("uv",new xs(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Hs(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Vs(e){const t={};for(const n in e){t[n]={};for(const i in e[n]){const r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[n][i]=null):t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}}return t}function js(e){const t={};for(let n=0;n<e.length;n++){const i=Vs(e[n]);for(const e in i)t[e]=i[e]}return t}function Ws(e){const t=e.getRenderTarget();return null===t?e.outputColorSpace:!0===t.isXRRenderTarget?t.texture.colorSpace:Ai.workingColorSpace}const qs={clone:Vs,merge:js};class Xs extends is{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Vs(e.uniforms),this.uniformsGroups=function(e){const t=[];for(let n=0;n<e.length;n++)t.push(e[n].clone());return t}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?t.uniforms[n]={type:"t",value:i.toJSON(e).uuid}:i&&i.isColor?t.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?t.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?t.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?t.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?t.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?t.uniforms[n]={type:"m4",value:i.toArray()}:t.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const e in this.extensions)!0===this.extensions[e]&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Ys extends Ur{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new lr,this.projectionMatrix=new lr,this.projectionMatrixInverse=new lr,this.coordinateSystem=Gn}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const Js=new Li,Ks=new ti,Zs=new ti;class $s extends Ys{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,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*qn*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Wn*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*qn*Math.atan(Math.tan(.5*Wn*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Js.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Js.x,Js.y).multiplyScalar(-e/Js.z),Js.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Js.x,Js.y).multiplyScalar(-e/Js.z)}getViewSize(e,t){return this.getViewBounds(e,Ks,Zs),t.subVectors(Zs,Ks)}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*Wn*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const s=this.view;if(null!==this.view&&this.view.enabled){const e=s.fullWidth,o=s.fullHeight;r+=s.offsetX*i/e,t-=s.offsetY*n/o,i*=s.width/e,n*=s.height/o}const o=this.filmOffset;0!==o&&(r+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const eo=-90;class to extends Ur{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new $s(eo,1,e,t);i.layers=this.layers,this.add(i);const r=new $s(eo,1,e,t);r.layers=this.layers,this.add(r);const s=new $s(eo,1,e,t);s.layers=this.layers,this.add(s);const o=new $s(eo,1,e,t);o.layers=this.layers,this.add(o);const a=new $s(eo,1,e,t);a.layers=this.layers,this.add(a);const l=new $s(eo,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,r,s,o,a]=t;for(const e of t)this.remove(e);if(e===Gn)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),a.up.set(0,1,0),a.lookAt(0,0,-1);else{if(e!==zn)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),a.up.set(0,-1,0),a.lookAt(0,0,-1)}for(const e of t)this.add(e),e.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,s,o,a,l,c]=this.children,h=e.getRenderTarget(),d=e.getActiveCubeFace(),u=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const A=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,i),e.render(t,r),e.setRenderTarget(n,1,i),e.render(t,s),e.setRenderTarget(n,2,i),e.render(t,o),e.setRenderTarget(n,3,i),e.render(t,a),e.setRenderTarget(n,4,i),e.render(t,l),n.texture.generateMipmaps=A,e.setRenderTarget(n,5,i),e.render(t,c),e.setRenderTarget(h,d,u),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class no extends Ci{constructor(e,t,n,i,r,s,o,a,l,c){super(e=void 0!==e?e:[],t=void 0!==t?t:pe,n,i,r,s,o,a,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class io extends Mi{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new no(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:Me}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const 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 <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\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 <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",s=new Hs(5,5,5),o=new Xs({name:"CubemapFromEquirect",uniforms:Vs(n),vertexShader:i,fragmentShader:r,side:g,blending:y});o.uniforms.tEquirect.value=t;const a=new Gs(s,o),l=t.minFilter;return t.minFilter===Be&&(t.minFilter=Me),new to(1,10,this).update(e,a),t.minFilter=l,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,n,i){const r=e.getRenderTarget();for(let r=0;r<6;r++)e.setRenderTarget(this,r),e.clear(t,n,i);e.setRenderTarget(r)}}class ro{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new es(e),this.density=t}clone(){return new ro(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class so{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new es(e),this.near=t,this.far=n}clone(){return new so(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class oo extends Ur{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new vr,this.environmentIntensity=1,this.environmentRotation=new vr,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class ao{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=Tn,this.updateRanges=[],this.version=0,this.uuid=Xn()}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Xn()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Xn()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const lo=new Li;class co{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)lo.fromBufferAttribute(this,t),lo.applyMatrix4(e),this.setXYZ(t,lo.x,lo.y,lo.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)lo.fromBufferAttribute(this,t),lo.applyNormalMatrix(e),this.setXYZ(t,lo.x,lo.y,lo.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)lo.fromBufferAttribute(this,t),lo.transformDirection(e),this.setXYZ(t,lo.x,lo.y,lo.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=Zn(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=$n(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=$n(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=$n(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=$n(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=$n(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=Zn(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=Zn(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=Zn(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=Zn(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=$n(t,this.array),n=$n(n,this.array),i=$n(i,this.array),r=$n(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}clone(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return new us(new this.array.constructor(e),this.itemSize,this.normalized)}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new co(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(void 0===e){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const e=[];for(let t=0;t<this.count;t++){const n=t*this.data.stride+this.offset;for(let t=0;t<this.itemSize;t++)e.push(this.data.array[n+t])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}return void 0===e.interleavedBuffers&&(e.interleavedBuffers={}),void 0===e.interleavedBuffers[this.data.uuid]&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class ho extends is{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new es(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let uo;const po=new Li,Ao=new Li,fo=new Li,mo=new ti,go=new ti,vo=new lr,yo=new Li,Eo=new Li,xo=new Li,bo=new ti,Co=new ti,wo=new ti;class _o extends Ur{constructor(e=new ho){if(super(),this.isSprite=!0,this.type="Sprite",void 0===uo){uo=new Bs;const e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),t=new ao(e,5);uo.setIndex([0,1,2,0,2,3]),uo.setAttribute("position",new co(t,3,0,!1)),uo.setAttribute("uv",new co(t,2,3,!1))}this.geometry=uo,this.material=e,this.center=new ti(.5,.5)}raycast(e,t){null===e.camera&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Ao.setFromMatrixScale(this.matrixWorld),vo.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),fo.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&Ao.multiplyScalar(-fo.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const s=this.center;Mo(yo.set(-.5,-.5,0),fo,s,Ao,i,r),Mo(Eo.set(.5,-.5,0),fo,s,Ao,i,r),Mo(xo.set(.5,.5,0),fo,s,Ao,i,r),bo.set(0,0),Co.set(1,0),wo.set(1,1);let o=e.ray.intersectTriangle(yo,Eo,xo,!1,po);if(null===o&&(Mo(Eo.set(-.5,.5,0),fo,s,Ao,i,r),Co.set(0,1),o=e.ray.intersectTriangle(yo,xo,Eo,!1,po),null===o))return;const a=e.ray.origin.distanceTo(po);a<e.near||a>e.far||t.push({distance:a,point:po.clone(),uv:Yr.getInterpolation(po,yo,Eo,xo,bo,Co,wo,new ti),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function Mo(e,t,n,i,r,s){mo.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(go.x=s*mo.x-r*mo.y,go.y=r*mo.x+s*mo.y):go.copy(mo),e.copy(t),e.x+=go.x,e.y+=go.y,e.applyMatrix4(vo)}const So=new Li,Io=new Li;class Bo extends Ur{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;e<n;e++){const n=t[e];this.addLevel(n.object.clone(),n.distance,n.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,n=0){t=Math.abs(t);const i=this.levels;let r;for(r=0;r<i.length&&!(t<i[r].distance);r++);return i.splice(r,0,{distance:t,hysteresis:n,object:e}),this.add(e),this}removeLevel(e){const t=this.levels;for(let n=0;n<t.length;n++)if(t[n].distance===e){const e=t.splice(n,1);return this.remove(e[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let n,i;for(n=1,i=t.length;n<i;n++){let i=t[n].distance;if(t[n].object.visible&&(i-=i*t[n].hysteresis),e<i)break}return t[n-1].object}return null}raycast(e,t){if(this.levels.length>0){So.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(So);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){So.setFromMatrixPosition(e.matrixWorld),Io.setFromMatrixPosition(this.matrixWorld);const n=So.distanceTo(Io)/e.zoom;let i,r;for(t[0].object.visible=!0,i=1,r=t.length;i<r;i++){let e=t[i].distance;if(t[i].object.visible&&(e-=e*t[i].hysteresis),!(n>=e))break;t[i-1].object.visible=!1,t[i].object.visible=!0}for(this._currentLevel=i-1;i<r;i++)t[i].object.visible=!1}}toJSON(e){const t=super.toJSON(e);!1===this.autoUpdate&&(t.object.autoUpdate=!1),t.object.levels=[];const n=this.levels;for(let e=0,i=n.length;e<i;e++){const i=n[e];t.object.levels.push({object:i.object.uuid,distance:i.distance,hysteresis:i.hysteresis})}return t}}const To=new Li,Ro=new wi,Lo=new wi,Do=new Li,Po=new lr,Uo=new Li,Oo=new $i,Fo=new lr,ko=new ar;class No extends Gs{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=he,this.bindMatrix=new lr,this.bindMatrixInverse=new lr,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;null===this.boundingBox&&(this.boundingBox=new Ui),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,Uo),this.boundingBox.expandByPoint(Uo)}computeBoundingSphere(){const e=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new $i),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let e=0;e<t.count;e++)this.getVertexPosition(e,Uo),this.boundingSphere.expandByPoint(Uo)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;void 0!==n&&(null===this.boundingSphere&&this.computeBoundingSphere(),Oo.copy(this.boundingSphere),Oo.applyMatrix4(i),!1!==e.ray.intersectsSphere(Oo)&&(Fo.copy(i).invert(),ko.copy(e.ray).applyMatrix4(Fo),null!==this.boundingBox&&!1===ko.intersectsBox(this.boundingBox)||this._computeIntersections(e,t,ko)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new wi,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const i=1/e.manhattanLength();i!==1/0?e.multiplyScalar(i):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===he?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===de?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;Ro.fromBufferAttribute(i.attributes.skinIndex,e),Lo.fromBufferAttribute(i.attributes.skinWeight,e),To.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){const i=Lo.getComponent(e);if(0!==i){const r=Ro.getComponent(e);Po.multiplyMatrices(n.bones[r].matrixWorld,n.boneInverses[r]),t.addScaledVector(Do.copy(To).applyMatrix4(Po),i)}}return t.applyMatrix4(this.bindMatrixInverse)}}class Qo extends Ur{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Go extends Ci{constructor(e=null,t=1,n=1,i,r,s,o,a,l=xe,c=xe,h,d){super(null,s,o,a,l,c,i,r,h,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const zo=new lr,Ho=new lr;class Vo{constructor(e=[],t=[]){this.uuid=Xn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e<t;e++)this.boneInverses.push(new lr)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const t=new lr;this.bones[e]&&t.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(t)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&t.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const t=this.bones[e];t&&(t.parent&&t.parent.isBone?(t.matrix.copy(t.parent.matrixWorld).invert(),t.matrix.multiply(t.matrixWorld)):t.matrix.copy(t.matrixWorld),t.matrix.decompose(t.position,t.quaternion,t.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let i=0,r=e.length;i<r;i++){const r=e[i]?e[i].matrixWorld:Ho;zo.multiplyMatrices(r,t[i]),zo.toArray(n,16*i)}null!==i&&(i.needsUpdate=!0)}clone(){return new Vo(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(4*this.bones.length);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Go(t,e,e,je,Fe);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const n=this.bones[t];if(n.name===e)return n}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const i=e.bones[n];let r=t[i];void 0===r&&(console.warn("THREE.Skeleton: No bone found with UUID:",i),r=new Qo),this.bones.push(r),this.boneInverses.push((new lr).fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,r=t.length;i<r;i++){const r=t[i];e.bones.push(r.uuid);const s=n[i];e.boneInverses.push(s.toArray())}return e}}class jo extends us{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Wo=new lr,qo=new lr,Xo=[],Yo=new Ui,Jo=new lr,Ko=new Gs,Zo=new $i;class $o extends Gs{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new jo(new Float32Array(16*n),16),this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let e=0;e<n;e++)this.setMatrixAt(e,Jo)}computeBoundingBox(){const e=this.geometry,t=this.count;null===this.boundingBox&&(this.boundingBox=new Ui),null===e.boundingBox&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Wo),Yo.copy(e.boundingBox).applyMatrix4(Wo),this.boundingBox.union(Yo)}computeBoundingSphere(){const e=this.geometry,t=this.count;null===this.boundingSphere&&(this.boundingSphere=new $i),null===e.boundingSphere&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,Wo),Zo.copy(e.boundingSphere).applyMatrix4(Wo),this.boundingSphere.union(Zo)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),null!==e.morphTexture&&(this.morphTexture=e.morphTexture.clone()),null!==e.instanceColor&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,3*e)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,16*e)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,r=e*(n.length+1)+1;for(let e=0;e<n.length;e++)n[e]=i[r+e]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Ko.geometry=this.geometry,Ko.material=this.material,void 0!==Ko.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),Zo.copy(this.boundingSphere),Zo.applyMatrix4(n),!1!==e.ray.intersectsSphere(Zo)))for(let r=0;r<i;r++){this.getMatrixAt(r,Wo),qo.multiplyMatrices(n,Wo),Ko.matrixWorld=qo,Ko.raycast(e,Xo);for(let e=0,n=Xo.length;e<n;e++){const n=Xo[e];n.instanceId=r,n.object=this,t.push(n)}Xo.length=0}}setColorAt(e,t){null===this.instanceColor&&(this.instanceColor=new jo(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),t.toArray(this.instanceColor.array,3*e)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,16*e)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;null===this.morphTexture&&(this.morphTexture=new Go(new Float32Array(i*this.count),i,this.count,Je,Fe));const r=this.morphTexture.source.data.data;let s=0;for(let e=0;e<n.length;e++)s+=n[e];const o=this.geometry.morphTargetsRelative?1:1-s,a=i*e;r[a]=o,r.set(n,a+1)}updateMorphTargets(){}dispose(){return this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null),this}}const ea=new Li,ta=new Li,na=new ni;class ia{constructor(e=new Li(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,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=ea.subVectors(n,t).cross(ta.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(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(ea),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(e.start).addScaledVector(n,r)}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||na.getNormalMatrix(e),i=this.coplanarPoint(ea).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)}}const ra=new $i,sa=new Li;class oa{constructor(e=new ia,t=new ia,n=new ia,i=new ia,r=new ia,s=new ia){this.planes=[e,t,n,i,r,s]}set(e,t,n,i,r,s){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(s),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Gn){const n=this.planes,i=e.elements,r=i[0],s=i[1],o=i[2],a=i[3],l=i[4],c=i[5],h=i[6],d=i[7],u=i[8],p=i[9],A=i[10],f=i[11],m=i[12],g=i[13],v=i[14],y=i[15];if(n[0].setComponents(a-r,d-l,f-u,y-m).normalize(),n[1].setComponents(a+r,d+l,f+u,y+m).normalize(),n[2].setComponents(a+s,d+c,f+p,y+g).normalize(),n[3].setComponents(a-s,d-c,f-p,y-g).normalize(),n[4].setComponents(a-o,d-h,f-A,y-v).normalize(),t===Gn)n[5].setComponents(a+o,d+h,f+A,y+v).normalize();else{if(t!==zn)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);n[5].setComponents(o,h,A,v).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),ra.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),ra.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(ra)}intersectsSprite(e){return ra.center.set(0,0,0),ra.radius=.7071067811865476,ra.applyMatrix4(e.matrixWorld),this.intersectsSphere(ra)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(sa.x=i.normal.x>0?e.max.x:e.min.x,sa.y=i.normal.y>0?e.max.y:e.min.y,sa.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(sa)<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 aa(e,t){return e-t}function la(e,t){return e.z-t.z}function ca(e,t){return t.z-e.z}class ha{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t,n,i){const r=this.pool,s=this.list;this.index>=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const o=r[this.index];s.push(o),this.index++,o.start=e,o.count=t,o.z=n,o.index=i}reset(){this.list.length=0,this.index=0}}const da=new lr,ua=new es(1,1,1),pa=new oa,Aa=new Ui,fa=new $i,ma=new Li,ga=new Li,va=new Li,ya=new ha,Ea=new Gs,xa=[];function ba(e,t,n=0){const i=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){const r=e.count;for(let s=0;s<r;s++)for(let r=0;r<i;r++)t.setComponent(s+n,r,e.getComponent(s,r))}else t.array.set(e.array,n*i);t.needsUpdate=!0}function Ca(e,t){if(e.constructor!==t.constructor){const n=Math.min(e.length,t.length);for(let i=0;i<n;i++)t[i]=e[i]}else{const n=Math.min(e.length,t.length);t.set(new e.constructor(e.buffer,0,n))}}class wa extends Gs{get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}constructor(e,t,n=2*t,i){super(new Bs,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}_initMatricesTexture(){let e=Math.sqrt(4*this._maxInstanceCount);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new Go(t,e,e,je,Fe);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new Go(t,e,e,Ke,Oe);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new Go(t,e,e,je,Fe);n.colorSpace=Ai.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(!1===this._geometryInitialized){for(const i in e.attributes){const r=e.getAttribute(i),{array:s,itemSize:o,normalized:a}=r,l=new s.constructor(n*o),c=new us(l,o,a);t.setAttribute(i,c)}if(null!==e.getIndex()){const e=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new us(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(Boolean(e.getIndex())!==Boolean(t.getIndex()))throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error(`THREE.BatchedMesh: Added geometry missing "${n}". All geometries must have consistent attributes.`);const i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||!1===t[e].active)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${e}. Instance is either out of range or has been deleted.`)}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||!1===t[e].active)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${e}. Geometry is either out of range or has been deleted.`)}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Ui);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(!1===t[n].active)continue;const i=t[n].geometryIndex;this.getMatrixAt(n,da),this.getBoundingBoxAt(i,Aa).applyMatrix4(da),e.union(Aa)}}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new $i);const e=this.boundingSphere,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n<i;n++){if(!1===t[n].active)continue;const i=t[n].geometryIndex;this.getMatrixAt(n,da),this.getBoundingSphereAt(i,fa).applyMatrix4(da),e.union(fa)}}addInstance(e){if(this._instanceInfo.length>=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const t={visible:!0,active:!0,geometryIndex:e};let n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(aa),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));const i=this._matricesTexture;da.identity().toArray(i.image.data,16*n),i.needsUpdate=!0;const r=this._colorsTexture;return r&&(ua.toArray(r.image.data,4*n),r.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e,t=-1,n=-1){this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=-1===t?e.getAttribute("position").count:t;const s=e.getIndex();if(null!==s&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=-1===n?s.count:n),-1!==i.indexStart&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let o;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(aa),o=this._availableGeometryIds.shift(),r[o]=i):(o=this._geometryCount,this._geometryCount++,r.push(i)),this.setGeometryAt(o,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,o}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=null!==n.getIndex(),r=n.getIndex(),s=t.getIndex(),o=this._geometryInfo[e];if(i&&s.count>o.reservedIndexCount||t.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const a=o.vertexStart,l=o.reservedVertexCount;o.vertexCount=t.getAttribute("position").count;for(const e in n.attributes){const i=t.getAttribute(e),r=n.getAttribute(e);ba(i,r,a);const s=i.itemSize;for(let e=i.count,t=l;e<t;e++){const t=a+e;for(let e=0;e<s;e++)r.setComponent(t,e,0)}r.needsUpdate=!0,r.addUpdateRange(a*s,l*s)}if(i){const e=o.indexStart,n=o.reservedIndexCount;o.indexCount=t.getIndex().count;for(let t=0;t<s.count;t++)r.setX(e+t,a+s.getX(t));for(let t=s.count,i=n;t<i;t++)r.setX(e+t,a);r.needsUpdate=!0,r.addUpdateRange(e,o.reservedIndexCount)}return o.start=i?o.indexStart:o.vertexStart,o.count=i?o.indexCount:o.vertexCount,o.boundingBox=null,null!==t.boundingBox&&(o.boundingBox=t.boundingBox.clone()),o.boundingSphere=null,null!==t.boundingSphere&&(o.boundingSphere=t.boundingSphere.clone()),this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._geometryInfo;if(e>=t.length||!1===t[e].active)return this;const n=this._instanceInfo;for(let t=0,i=n.length;t<i;t++)n[t].geometryIndex===e&&this.deleteInstance(t);return t[e].active=!1,this._availableGeometryIds.push(e),this._visibilityChanged=!0,this}deleteInstance(e){return this.validateInstanceId(e),this._instanceInfo[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this}optimize(){let e=0,t=0;const n=this._geometryInfo,i=n.map(((e,t)=>t)).sort(((e,t)=>n[e].vertexStart-n[t].vertexStart)),r=this.geometry;for(let s=0,o=n.length;s<o;s++){const o=i[s],a=n[o];if(!1!==a.active){if(null!==r.index){if(a.indexStart!==t){const{indexStart:n,vertexStart:i,reservedIndexCount:s}=a,o=r.index,l=o.array,c=e-i;for(let e=n;e<n+s;e++)l[e]=l[e]+c;o.array.copyWithin(t,n,n+s),o.addUpdateRange(t,s),a.indexStart=t}t+=a.reservedIndexCount}if(a.vertexStart!==e){const{vertexStart:t,reservedVertexCount:n}=a,i=r.attributes;for(const r in i){const s=i[r],{array:o,itemSize:a}=s;o.copyWithin(e*a,t*a,(t+n)*a),s.addUpdateRange(e*a,n*a)}a.vertexStart=e}e+=a.reservedVertexCount,a.start=r.index?a.indexStart:a.vertexStart,this._nextIndexStart=r.index?a.indexStart+a.reservedIndexCount:0,this._nextVertexStart=a.vertexStart+a.reservedVertexCount}}return this}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(null===i.boundingBox){const e=new Ui,t=n.index,r=n.attributes.position;for(let n=i.start,s=i.start+i.count;n<s;n++){let i=n;t&&(i=t.getX(i)),e.expandByPoint(ma.fromBufferAttribute(r,i))}i.boundingBox=e}return t.copy(i.boundingBox),t}getBoundingSphereAt(e,t){if(e>=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(null===i.boundingSphere){const t=new $i;this.getBoundingBoxAt(e,Aa),Aa.getCenter(t.center);const r=n.index,s=n.attributes.position;let o=0;for(let e=i.start,n=i.start+i.count;e<n;e++){let n=e;r&&(n=r.getX(n)),ma.fromBufferAttribute(s,n),o=Math.max(o,t.center.distanceToSquared(ma))}t.radius=Math.sqrt(o),i.boundingSphere=t}return t.copy(i.boundingSphere),t}setMatrixAt(e,t){this.validateInstanceId(e);const n=this._matricesTexture,i=this._matricesTexture.image.data;return t.toArray(i,16*e),n.needsUpdate=!0,this}getMatrixAt(e,t){return this.validateInstanceId(e),t.fromArray(this._matricesTexture.image.data,16*e)}setColorAt(e,t){return this.validateInstanceId(e),null===this._colorsTexture&&this._initColorsTexture(),t.toArray(this._colorsTexture.image.data,4*e),this._colorsTexture.needsUpdate=!0,this}getColorAt(e,t){return this.validateInstanceId(e),t.fromArray(this._colorsTexture.image.data,4*e)}setVisibleAt(e,t){return this.validateInstanceId(e),this._instanceInfo[e].visible===t||(this._instanceInfo[e].visible=t,this._visibilityChanged=!0),this}getVisibleAt(e){return this.validateInstanceId(e),this._instanceInfo[e].visible}setGeometryIdAt(e,t){return this.validateInstanceId(e),this.validateGeometryId(t),this._instanceInfo[e].geometryIndex=t,this}getGeometryIdAt(e){return this.validateInstanceId(e),this._instanceInfo[e].geometryIndex}getGeometryRangeAt(e,t={}){this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(aa);t[t.length-1]===n.length;)n.pop(),t.pop();if(e<n.length)throw new Error(`BatchedMesh: Instance ids outside the range ${e} are being used. Cannot shrink instance count.`);const i=new Int32Array(e),r=new Int32Array(e);Ca(this._multiDrawCounts,i),Ca(this._multiDrawStarts,r),this._multiDrawCounts=i,this._multiDrawStarts=r,this._maxInstanceCount=e;const s=this._indirectTexture,o=this._matricesTexture,a=this._colorsTexture;s.dispose(),this._initIndirectTexture(),Ca(s.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),Ca(o.image.data,this._matricesTexture.image.data),a&&(a.dispose(),this._initColorsTexture(),Ca(a.image.data,this._colorsTexture.image.data))}setGeometrySize(e,t){const n=[...this._geometryInfo].filter((e=>e.active));if(Math.max(...n.map((e=>e.vertexStart+e.reservedVertexCount)))>e)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${t}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...n.map((e=>e.indexStart+e.reservedIndexCount)))>t)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${t}. Cannot shrink further.`);const i=this.geometry;i.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new Bs,this._initializeGeometry(i));const r=this.geometry;i.index&&Ca(i.index.array,r.index.array);for(const e in i.attributes)Ca(i.attributes[e].array,r.attributes[e].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,s=this.geometry;Ea.material=this.material,Ea.geometry.index=s.index,Ea.geometry.attributes=s.attributes,null===Ea.geometry.boundingBox&&(Ea.geometry.boundingBox=new Ui),null===Ea.geometry.boundingSphere&&(Ea.geometry.boundingSphere=new $i);for(let s=0,o=n.length;s<o;s++){if(!n[s].visible||!n[s].active)continue;const o=n[s].geometryIndex,a=i[o];Ea.geometry.setDrawRange(a.start,a.count),this.getMatrixAt(s,Ea.matrixWorld).premultiply(r),this.getBoundingBoxAt(o,Ea.geometry.boundingBox),this.getBoundingSphereAt(o,Ea.geometry.boundingSphere),Ea.raycast(e,xa);for(let e=0,n=xa.length;e<n;e++){const n=xa[e];n.object=this,n.batchId=s,t.push(n)}xa.length=0}Ea.material=null,Ea.geometry.index=null,Ea.geometry.attributes={},Ea.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=null!==e.boundingBox?e.boundingBox.clone():null,this.boundingSphere=null!==e.boundingSphere?e.boundingSphere.clone():null,this._geometryInfo=e._geometryInfo.map((e=>({...e,boundingBox:null!==e.boundingBox?e.boundingBox.clone():null,boundingSphere:null!==e.boundingSphere?e.boundingSphere.clone():null}))),this._instanceInfo=e._instanceInfo.map((e=>({...e}))),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const s=i.getIndex(),o=null===s?1:s.array.BYTES_PER_ELEMENT,a=this._instanceInfo,l=this._multiDrawStarts,c=this._multiDrawCounts,h=this._geometryInfo,d=this.perObjectFrustumCulled,u=this._indirectTexture,p=u.image.data;d&&(da.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),pa.setFromProjectionMatrix(da,e.coordinateSystem));let A=0;if(this.sortObjects){da.copy(this.matrixWorld).invert(),ma.setFromMatrixPosition(n.matrixWorld).applyMatrix4(da),ga.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(da);for(let e=0,t=a.length;e<t;e++)if(a[e].visible&&a[e].active){const t=a[e].geometryIndex;this.getMatrixAt(e,da),this.getBoundingSphereAt(t,fa).applyMatrix4(da);let n=!1;if(d&&(n=!pa.intersectsSphere(fa)),!n){const n=h[t],i=va.subVectors(fa.center,ma).dot(ga);ya.push(n.start,n.count,i,e)}}const e=ya.list,t=this.customSort;null===t?e.sort(r.transparent?ca:la):t.call(this,e,n);for(let t=0,n=e.length;t<n;t++){const n=e[t];l[A]=n.start*o,c[A]=n.count,p[A]=n.index,A++}ya.reset()}else for(let e=0,t=a.length;e<t;e++)if(a[e].visible&&a[e].active){const t=a[e].geometryIndex;let n=!1;if(d&&(this.getMatrixAt(e,da),this.getBoundingSphereAt(t,fa).applyMatrix4(da),n=!pa.intersectsSphere(fa)),!n){const n=h[t];l[A]=n.start*o,c[A]=n.count,p[A]=e,A++}}u.needsUpdate=!0,this._multiDrawCount=A,this._visibilityChanged=!1}onBeforeShadow(e,t,n,i,r,s){this.onBeforeRender(e,null,i,r,s)}}class _a extends is{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new es(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Ma=new Li,Sa=new Li,Ia=new lr,Ba=new ar,Ta=new $i,Ra=new Li,La=new Li;class Da extends Ur{constructor(e=new Bs,t=new _a){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,i=t.count;e<i;e++)Ma.fromBufferAttribute(t,e-1),Sa.fromBufferAttribute(t,e),n[e]=n[e-1],n[e]+=Ma.distanceTo(Sa);e.setAttribute("lineDistance",new xs(n,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Line.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Ta.copy(n.boundingSphere),Ta.applyMatrix4(i),Ta.radius+=r,!1===e.ray.intersectsSphere(Ta))return;Ia.copy(i).invert(),Ba.copy(e.ray).applyMatrix4(Ia);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,l=this.isLineSegments?2:1,c=n.index,h=n.attributes.position;if(null!==c){const n=Math.max(0,s.start),i=Math.min(c.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=c.getX(r),i=c.getX(r+1),s=Pa(this,e,Ba,a,n,i);s&&t.push(s)}if(this.isLineLoop){const r=c.getX(i-1),s=c.getX(n),o=Pa(this,e,Ba,a,r,s);o&&t.push(o)}}else{const n=Math.max(0,s.start),i=Math.min(h.count,s.start+s.count);for(let r=n,s=i-1;r<s;r+=l){const n=Pa(this,e,Ba,a,r,r+1);n&&t.push(n)}if(this.isLineLoop){const r=Pa(this,e,Ba,a,i-1,n);r&&t.push(r)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function Pa(e,t,n,i,r,s){const o=e.geometry.attributes.position;if(Ma.fromBufferAttribute(o,r),Sa.fromBufferAttribute(o,s),n.distanceSqToSegment(Ma,Sa,Ra,La)>i)return;Ra.applyMatrix4(e.matrixWorld);const a=t.ray.origin.distanceTo(Ra);return a<t.near||a>t.far?void 0:{distance:a,point:La.clone().applyMatrix4(e.matrixWorld),index:r,face:null,faceIndex:null,barycoord:null,object:e}}const Ua=new Li,Oa=new Li;class Fa extends Da{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e<i;e+=2)Ua.fromBufferAttribute(t,e),Oa.fromBufferAttribute(t,e+1),n[e]=0===e?0:n[e-1],n[e+1]=n[e]+Ua.distanceTo(Oa);e.setAttribute("lineDistance",new xs(n,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class ka extends Da{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class Na extends is{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new es(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const Qa=new lr,Ga=new ar,za=new $i,Ha=new Li;class Va extends Ur{constructor(e=new Bs,t=new Na){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,s=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),za.copy(n.boundingSphere),za.applyMatrix4(i),za.radius+=r,!1===e.ray.intersectsSphere(za))return;Qa.copy(i).invert(),Ga.copy(e.ray).applyMatrix4(Qa);const o=r/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,l=n.index,c=n.attributes.position;if(null!==l)for(let n=Math.max(0,s.start),r=Math.min(l.count,s.start+s.count);n<r;n++){const r=l.getX(n);Ha.fromBufferAttribute(c,r),ja(Ha,r,a,i,e,t,this)}else for(let n=Math.max(0,s.start),r=Math.min(c.count,s.start+s.count);n<r;n++)Ha.fromBufferAttribute(c,n),ja(Ha,n,a,i,e,t,this)}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e<t;e++){const t=n[e].name||String(e);this.morphTargetInfluences.push(0),this.morphTargetDictionary[t]=e}}}}}function ja(e,t,n,i,r,s,o){const a=Ga.distanceSqToPoint(e);if(a<n){const n=new Li;Ga.closestPointToPoint(e,n),n.applyMatrix4(i);const l=r.ray.origin.distanceTo(n);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}class Wa extends Ur{constructor(){super(),this.isGroup=!0,this.type="Group"}}class qa extends Ci{constructor(e,t,n,i,r,s,o,a,l){super(e,t,n,i,r,s,o,a,l),this.isVideoTexture=!0,this.minFilter=void 0!==s?s:Me,this.magFilter=void 0!==r?r:Me,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)}}class Xa extends Ci{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=xe,this.minFilter=xe,this.generateMipmaps=!1,this.needsUpdate=!0}}class Ya extends Ci{constructor(e,t,n,i,r,s,o,a,l,c,h,d){super(null,s,o,a,l,c,i,r,h,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Ja extends Ya{constructor(e,t,n,i,r,s){super(e,t,n,r,s),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=ye,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Ka extends Ya{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,pe),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Za extends Ci{constructor(e,t,n,i,r,s,o,a,l){super(e,t,n,i,r,s,o,a,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class $a extends Ci{constructor(e,t,n,i,r,s,o,a,l,c=Xe){if(c!==Xe&&c!==Ye)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Xe&&(n=Oe),void 0===n&&c===Ye&&(n=Ge),super(null,i,r,s,o,a,c,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==o?o:xe,this.minFilter=void 0!==a?a:xe,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class el{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let s=1;s<=e;s++)n=this.getPoint(s/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const r=n.length;let s;s=t||e*n[r-1];let o,a=0,l=r-1;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),o=n[i]-s,o<0)a=i+1;else{if(!(o>0)){l=i;break}l=i-1}if(i=l,n[i]===s)return i/(r-1);const c=n[i];return(i+(s-c)/(n[i+1]-c))/(r-1)}getTangent(e,t){const n=1e-4;let i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);const s=this.getPoint(i),o=this.getPoint(r),a=t||(s.isVector2?new ti:new Li);return a.copy(o).sub(s).normalize(),a}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new Li,i=[],r=[],s=[],o=new Li,a=new lr;for(let t=0;t<=e;t++){const n=t/e;i[t]=this.getTangentAt(n,new Li)}r[0]=new Li,s[0]=new Li;let l=Number.MAX_VALUE;const c=Math.abs(i[0].x),h=Math.abs(i[0].y),d=Math.abs(i[0].z);c<=l&&(l=c,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),d<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),s[0].crossVectors(i[0],r[0]);for(let t=1;t<=e;t++){if(r[t]=r[t-1].clone(),s[t]=s[t-1].clone(),o.crossVectors(i[t-1],i[t]),o.length()>Number.EPSILON){o.normalize();const e=Math.acos(Yn(i[t-1].dot(i[t]),-1,1));r[t].applyMatrix4(a.makeRotationAxis(o,e))}s[t].crossVectors(i[t],r[t])}if(!0===t){let t=Math.acos(Yn(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(a.makeRotationAxis(i[n],t*n)),s[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class tl extends el{constructor(e=0,t=0,n=1,i=1,r=0,s=2*Math.PI,o=!1,a=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=o,this.aRotation=a}getPoint(e,t=new ti){const n=t,i=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(r=s?0:i),!0!==this.aClockwise||s||(r===i?r=-i:r-=i);const o=this.aStartAngle+e*r;let a=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(0!==this.aRotation){const e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=a-this.aX,i=l-this.aY;a=n*e-i*t+this.aX,l=n*t+i*e+this.aY}return n.set(a,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class nl extends tl{constructor(e,t,n,i,r,s){super(e,t,n,n,i,r,s),this.isArcCurve=!0,this.type="ArcCurve"}}function il(){let e=0,t=0,n=0,i=0;function r(r,s,o,a){e=r,t=o,n=-3*r+3*s-2*o-a,i=2*r-2*s+o+a}return{initCatmullRom:function(e,t,n,i,s){r(t,n,s*(n-e),s*(i-t))},initNonuniformCatmullRom:function(e,t,n,i,s,o,a){let l=(t-e)/s-(n-e)/(s+o)+(n-t)/o,c=(n-t)/o-(i-t)/(o+a)+(i-n)/a;l*=o,c*=o,r(t,n,l,c)},calc:function(r){const s=r*r;return e+t*r+n*s+i*(s*r)}}}const rl=new Li,sl=new il,ol=new il,al=new il;class ll extends el{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new Li){const n=t,i=this.points,r=i.length,s=(r-(this.closed?0:1))*e;let o,a,l=Math.floor(s),c=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?o=i[(l-1)%r]:(rl.subVectors(i[0],i[1]).add(i[0]),o=rl);const h=i[l%r],d=i[(l+1)%r];if(this.closed||l+2<r?a=i[(l+2)%r]:(rl.subVectors(i[r-1],i[r-2]).add(i[r-1]),a=rl),"centripetal"===this.curveType||"chordal"===this.curveType){const e="chordal"===this.curveType?.5:.25;let t=Math.pow(o.distanceToSquared(h),e),n=Math.pow(h.distanceToSquared(d),e),i=Math.pow(d.distanceToSquared(a),e);n<1e-4&&(n=1),t<1e-4&&(t=n),i<1e-4&&(i=n),sl.initNonuniformCatmullRom(o.x,h.x,d.x,a.x,t,n,i),ol.initNonuniformCatmullRom(o.y,h.y,d.y,a.y,t,n,i),al.initNonuniformCatmullRom(o.z,h.z,d.z,a.z,t,n,i)}else"catmullrom"===this.curveType&&(sl.initCatmullRom(o.x,h.x,d.x,a.x,this.tension),ol.initCatmullRom(o.y,h.y,d.y,a.y,this.tension),al.initCatmullRom(o.z,h.z,d.z,a.z,this.tension));return n.set(sl.calc(c),ol.calc(c),al.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new Li).fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function cl(e,t,n,i,r){const s=.5*(i-t),o=.5*(r-n),a=e*e;return(2*n-2*i+s+o)*(e*a)+(-3*n+3*i-2*s-o)*a+s*e+n}function hl(e,t,n,i){return function(e,t){const n=1-e;return n*n*t}(e,t)+function(e,t){return 2*(1-e)*e*t}(e,n)+function(e,t){return e*e*t}(e,i)}function dl(e,t,n,i,r){return function(e,t){const n=1-e;return n*n*n*t}(e,t)+function(e,t){const n=1-e;return 3*n*n*e*t}(e,n)+function(e,t){return 3*(1-e)*e*e*t}(e,i)+function(e,t){return e*e*e*t}(e,r)}class ul extends el{constructor(e=new ti,t=new ti,n=new ti,i=new ti){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new ti){const n=t,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(dl(e,i.x,r.x,s.x,o.x),dl(e,i.y,r.y,s.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class pl extends el{constructor(e=new Li,t=new Li,n=new Li,i=new Li){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new Li){const n=t,i=this.v0,r=this.v1,s=this.v2,o=this.v3;return n.set(dl(e,i.x,r.x,s.x,o.x),dl(e,i.y,r.y,s.y,o.y),dl(e,i.z,r.z,s.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Al extends el{constructor(e=new ti,t=new ti){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ti){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ti){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class fl extends el{constructor(e=new Li,t=new Li){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new Li){const n=t;return 1===e?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new Li){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class ml extends el{constructor(e=new ti,t=new ti,n=new ti){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new ti){const n=t,i=this.v0,r=this.v1,s=this.v2;return n.set(hl(e,i.x,r.x,s.x),hl(e,i.y,r.y,s.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class gl extends el{constructor(e=new Li,t=new Li,n=new Li){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new Li){const n=t,i=this.v0,r=this.v1,s=this.v2;return n.set(hl(e,i.x,r.x,s.x),hl(e,i.y,r.y,s.y),hl(e,i.z,r.z,s.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class vl extends el{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ti){const n=t,i=this.points,r=(i.length-1)*e,s=Math.floor(r),o=r-s,a=i[0===s?s:s-1],l=i[s],c=i[s>i.length-2?i.length-1:s+1],h=i[s>i.length-3?i.length-1:s+2];return n.set(cl(o,a.x,l.x,c.x,h.x),cl(o,a.y,l.y,c.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const n=e.points[t];this.points.push((new ti).fromArray(n))}return this}}var yl=Object.freeze({__proto__:null,ArcCurve:nl,CatmullRomCurve3:ll,CubicBezierCurve:ul,CubicBezierCurve3:pl,EllipseCurve:tl,LineCurve:Al,LineCurve3:fl,QuadraticBezierCurve:ml,QuadraticBezierCurve3:gl,SplineCurve:vl});class El extends el{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);if(!e.equals(t)){const n=!0===e.isVector2?"LineCurve":"LineCurve3";this.curves.push(new yl[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let r=0;for(;r<i.length;){if(i[r]>=n){const e=i[r]-n,s=this.curves[r],o=s.getLength(),a=0===o?0:1-e/o;return s.getPointAt(a,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,r=this.curves;i<r.length;i++){const s=r[i],o=s.isEllipseCurve?2*e:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?e*s.points.length:e,a=s.getPoints(o);for(let e=0;e<a.length;e++){const i=a[e];n&&n.equals(i)||(t.push(i),n=i)}}return this.autoClose&&t.length>1&&!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;t<n;t++){const n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const n=e.curves[t];this.curves.push((new yl[n.type]).fromJSON(n))}return this}}class xl extends El{constructor(e){super(),this.type="Path",this.currentPoint=new ti,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new Al(this.currentPoint.clone(),new ti(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const r=new ml(this.currentPoint.clone(),new ti(e,t),new ti(n,i));return this.curves.push(r),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,r,s){const o=new ul(this.currentPoint.clone(),new ti(e,t),new ti(n,i),new ti(r,s));return this.curves.push(o),this.currentPoint.set(r,s),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new vl(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,r,s){const o=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(e+o,t+a,n,i,r,s),this}absarc(e,t,n,i,r,s){return this.absellipse(e,t,n,n,i,r,s),this}ellipse(e,t,n,i,r,s,o,a){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(e+l,t+c,n,i,r,s,o,a),this}absellipse(e,t,n,i,r,s,o,a){const l=new tl(e,t,n,i,r,s,o,a);if(this.curves.length>0){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 bl extends Bs{constructor(e=[new ti(0,-.5),new ti(.5,0),new ti(0,.5)],t=12,n=0,i=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Yn(i,0,2*Math.PI);const r=[],s=[],o=[],a=[],l=[],c=1/t,h=new Li,d=new ti,u=new Li,p=new Li,A=new Li;let f=0,m=0;for(let t=0;t<=e.length-1;t++)switch(t){case 0:f=e[t+1].x-e[t].x,m=e[t+1].y-e[t].y,u.x=1*m,u.y=-f,u.z=0*m,A.copy(u),u.normalize(),a.push(u.x,u.y,u.z);break;case e.length-1:a.push(A.x,A.y,A.z);break;default:f=e[t+1].x-e[t].x,m=e[t+1].y-e[t].y,u.x=1*m,u.y=-f,u.z=0*m,p.copy(u),u.x+=A.x,u.y+=A.y,u.z+=A.z,u.normalize(),a.push(u.x,u.y,u.z),A.copy(p)}for(let r=0;r<=t;r++){const u=n+r*c*i,p=Math.sin(u),A=Math.cos(u);for(let n=0;n<=e.length-1;n++){h.x=e[n].x*p,h.y=e[n].y,h.z=e[n].x*A,s.push(h.x,h.y,h.z),d.x=r/t,d.y=n/(e.length-1),o.push(d.x,d.y);const i=a[3*n+0]*p,c=a[3*n+1],u=a[3*n+0]*A;l.push(i,c,u)}}for(let n=0;n<t;n++)for(let t=0;t<e.length-1;t++){const i=t+n*e.length,s=i,o=i+e.length,a=i+e.length+1,l=i+1;r.push(s,o,l),r.push(a,l,o)}this.setIndex(r),this.setAttribute("position",new xs(s,3)),this.setAttribute("uv",new xs(o,2)),this.setAttribute("normal",new xs(l,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new bl(e.points,e.segments,e.phiStart,e.phiLength)}}class Cl extends bl{constructor(e=1,t=1,n=4,i=8){const r=new xl;r.absarc(0,-t/2,e,1.5*Math.PI,0),r.absarc(0,t/2,e,0,.5*Math.PI),super(r.getPoints(n),i),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:n,radialSegments:i}}static fromJSON(e){return new Cl(e.radius,e.length,e.capSegments,e.radialSegments)}}class wl extends Bs{constructor(e=1,t=32,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=[],o=[],a=[],l=new Li,c=new ti;s.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let r=0,h=3;r<=t;r++,h+=3){const d=n+r/t*i;l.x=e*Math.cos(d),l.y=e*Math.sin(d),s.push(l.x,l.y,l.z),o.push(0,0,1),c.x=(s[h]/e+1)/2,c.y=(s[h+1]/e+1)/2,a.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 xs(s,3)),this.setAttribute("normal",new xs(o,3)),this.setAttribute("uv",new xs(a,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new wl(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class _l extends Bs{constructor(e=1,t=1,n=1,i=32,r=1,s=!1,o=0,a=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a};const l=this;i=Math.floor(i),r=Math.floor(r);const c=[],h=[],d=[],u=[];let p=0;const A=[],f=n/2;let m=0;function g(n){const r=p,s=new ti,A=new Li;let g=0;const v=!0===n?e:t,y=!0===n?1:-1;for(let e=1;e<=i;e++)h.push(0,f*y,0),d.push(0,y,0),u.push(.5,.5),p++;const E=p;for(let e=0;e<=i;e++){const t=e/i*a+o,n=Math.cos(t),r=Math.sin(t);A.x=v*r,A.y=f*y,A.z=v*n,h.push(A.x,A.y,A.z),d.push(0,y,0),s.x=.5*n+.5,s.y=.5*r*y+.5,u.push(s.x,s.y),p++}for(let e=0;e<i;e++){const t=r+e,i=E+e;!0===n?c.push(i,i+1,t):c.push(i+1,i,t),g+=3}l.addGroup(m,g,!0===n?1:2),m+=g}!function(){const s=new Li,g=new Li;let v=0;const y=(t-e)/n;for(let l=0;l<=r;l++){const c=[],m=l/r,v=m*(t-e)+e;for(let e=0;e<=i;e++){const t=e/i,r=t*a+o,l=Math.sin(r),A=Math.cos(r);g.x=v*l,g.y=-m*n+f,g.z=v*A,h.push(g.x,g.y,g.z),s.set(l,y,A).normalize(),d.push(s.x,s.y,s.z),u.push(t,1-m),c.push(p++)}A.push(c)}for(let n=0;n<i;n++)for(let i=0;i<r;i++){const s=A[i][n],o=A[i+1][n],a=A[i+1][n+1],l=A[i][n+1];(e>0||0!==i)&&(c.push(s,o,l),v+=3),(t>0||i!==r-1)&&(c.push(o,a,l),v+=3)}l.addGroup(m,v,0),m+=v}(),!1===s&&(e>0&&g(!0),t>0&&g(!1)),this.setIndex(c),this.setAttribute("position",new xs(h,3)),this.setAttribute("normal",new xs(d,3)),this.setAttribute("uv",new xs(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new _l(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Ml extends _l{constructor(e=1,t=1,n=32,i=1,r=!1,s=0,o=2*Math.PI){super(0,e,t,n,i,r,s,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:s,thetaLength:o}}static fromJSON(e){return new Ml(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Sl extends Bs{constructor(e=[],t=[],n=1,i=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],s=[];function o(e,t,n,i){const r=i+1,s=[];for(let i=0;i<=r;i++){s[i]=[];const o=e.clone().lerp(n,i/r),a=t.clone().lerp(n,i/r),l=r-i;for(let e=0;e<=l;e++)s[i][e]=0===e&&i===r?o:o.clone().lerp(a,e/l)}for(let e=0;e<r;e++)for(let t=0;t<2*(r-e)-1;t++){const n=Math.floor(t/2);t%2==0?(a(s[e][n+1]),a(s[e+1][n]),a(s[e][n])):(a(s[e][n+1]),a(s[e+1][n+1]),a(s[e+1][n]))}}function a(e){r.push(e.x,e.y,e.z)}function l(t,n){const i=3*t;n.x=e[i+0],n.y=e[i+1],n.z=e[i+2]}function c(e,t,n,i){i<0&&1===e.x&&(s[t]=e.x-1),0===n.x&&0===n.z&&(s[t]=i/2/Math.PI+.5)}function h(e){return Math.atan2(e.z,-e.x)}!function(e){const n=new Li,i=new Li,r=new Li;for(let s=0;s<t.length;s+=3)l(t[s+0],n),l(t[s+1],i),l(t[s+2],r),o(n,i,r,e)}(i),function(e){const t=new Li;for(let n=0;n<r.length;n+=3)t.x=r[n+0],t.y=r[n+1],t.z=r[n+2],t.normalize().multiplyScalar(e),r[n+0]=t.x,r[n+1]=t.y,r[n+2]=t.z}(n),function(){const e=new Li;for(let n=0;n<r.length;n+=3){e.x=r[n+0],e.y=r[n+1],e.z=r[n+2];const i=h(e)/2/Math.PI+.5,o=(t=e,Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5);s.push(i,1-o)}var t;(function(){const e=new Li,t=new Li,n=new Li,i=new Li,o=new ti,a=new ti,l=new ti;for(let d=0,u=0;d<r.length;d+=9,u+=6){e.set(r[d+0],r[d+1],r[d+2]),t.set(r[d+3],r[d+4],r[d+5]),n.set(r[d+6],r[d+7],r[d+8]),o.set(s[u+0],s[u+1]),a.set(s[u+2],s[u+3]),l.set(s[u+4],s[u+5]),i.copy(e).add(t).add(n).divideScalar(3);const p=h(i);c(o,u+0,e,p),c(a,u+2,t,p),c(l,u+4,n,p)}})(),function(){for(let e=0;e<s.length;e+=6){const t=s[e+0],n=s[e+2],i=s[e+4],r=Math.max(t,n,i),o=Math.min(t,n,i);r>.9&&o<.1&&(t<.2&&(s[e+0]+=1),n<.2&&(s[e+2]+=1),i<.2&&(s[e+4]+=1))}}()}(),this.setAttribute("position",new xs(r,3)),this.setAttribute("normal",new xs(r.slice(),3)),this.setAttribute("uv",new xs(s,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Sl(e.vertices,e.indices,e.radius,e.details)}}class Il extends Sl{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 Il(e.radius,e.detail)}}const Bl=new Li,Tl=new Li,Rl=new Li,Ll=new Yr;class Dl extends Bs{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const n=4,i=Math.pow(10,n),r=Math.cos(Wn*t),s=e.getIndex(),o=e.getAttribute("position"),a=s?s.count:o.count,l=[0,0,0],c=["a","b","c"],h=new Array(3),d={},u=[];for(let e=0;e<a;e+=3){s?(l[0]=s.getX(e),l[1]=s.getX(e+1),l[2]=s.getX(e+2)):(l[0]=e,l[1]=e+1,l[2]=e+2);const{a:t,b:n,c:a}=Ll;if(t.fromBufferAttribute(o,l[0]),n.fromBufferAttribute(o,l[1]),a.fromBufferAttribute(o,l[2]),Ll.getNormal(Rl),h[0]=`${Math.round(t.x*i)},${Math.round(t.y*i)},${Math.round(t.z*i)}`,h[1]=`${Math.round(n.x*i)},${Math.round(n.y*i)},${Math.round(n.z*i)}`,h[2]=`${Math.round(a.x*i)},${Math.round(a.y*i)},${Math.round(a.z*i)}`,h[0]!==h[1]&&h[1]!==h[2]&&h[2]!==h[0])for(let e=0;e<3;e++){const t=(e+1)%3,n=h[e],i=h[t],s=Ll[c[e]],o=Ll[c[t]],a=`${n}_${i}`,p=`${i}_${n}`;p in d&&d[p]?(Rl.dot(d[p].normal)<=r&&(u.push(s.x,s.y,s.z),u.push(o.x,o.y,o.z)),d[p]=null):a in d||(d[a]={index0:l[e],index1:l[t],normal:Rl.clone()})}}for(const e in d)if(d[e]){const{index0:t,index1:n}=d[e];Bl.fromBufferAttribute(o,t),Tl.fromBufferAttribute(o,n),u.push(Bl.x,Bl.y,Bl.z),u.push(Tl.x,Tl.y,Tl.z)}this.setAttribute("position",new xs(u,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Pl extends xl{constructor(e){super(e),this.uuid=Xn(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const n=e.holes[t];this.holes.push((new xl).fromJSON(n))}return this}}function Ul(e,t,n,i,r){let s,o;if(r===function(e,t,n,i){let r=0;for(let s=t,o=n-i;s<n;s+=i)r+=(e[o]-e[s])*(e[s+1]+e[o+1]),o=s;return r}(e,t,n,i)>0)for(s=t;s<n;s+=i)o=nc(s,e[s],e[s+1],o);else for(s=n-i;s>=t;s-=i)o=nc(s,e[s],e[s+1],o);return o&&Jl(o,o.next)&&(ic(o),o=o.next),o}function Ol(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!Jl(i,i.next)&&0!==Yl(i.prev,i,i.next))i=i.next;else{if(ic(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function Fl(e,t,n,i,r,s,o){if(!e)return;!o&&s&&function(e,t,n,i){let r=e;do{0===r.z&&(r.z=jl(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n,i,r,s,o,a,l,c=1;do{for(n=e,e=null,s=null,o=0;n;){for(o++,i=n,a=0,t=0;t<c&&(a++,i=i.nextZ,i);t++);for(l=c;a>0||l>0&&i;)0!==a&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:e=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(o>1)}(r)}(e,i,r,s);let a,l,c=e;for(;e.prev!==e.next;)if(a=e.prev,l=e.next,s?Nl(e,i,r,s):kl(e))t.push(a.i/n|0),t.push(e.i/n|0),t.push(l.i/n|0),ic(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?Fl(e=Ql(Ol(e),t,n),t,n,i,r,s,2):2===o&&Gl(e,t,n,i,r,s):Fl(Ol(e),t,n,i,r,s,1);break}}function kl(e){const t=e.prev,n=e,i=e.next;if(Yl(t,n,i)>=0)return!1;const r=t.x,s=n.x,o=i.x,a=t.y,l=n.y,c=i.y,h=r<s?r<o?r:o:s<o?s:o,d=a<l?a<c?a:c:l<c?l:c,u=r>s?r>o?r:o:s>o?s:o,p=a>l?a>c?a:c:l>c?l:c;let A=i.next;for(;A!==t;){if(A.x>=h&&A.x<=u&&A.y>=d&&A.y<=p&&ql(r,a,s,l,o,c,A.x,A.y)&&Yl(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function Nl(e,t,n,i){const r=e.prev,s=e,o=e.next;if(Yl(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,h=r.y,d=s.y,u=o.y,p=a<l?a<c?a:c:l<c?l:c,A=h<d?h<u?h:u:d<u?d:u,f=a>l?a>c?a:c:l>c?l:c,m=h>d?h>u?h:u:d>u?d:u,g=jl(p,A,t,n,i),v=jl(f,m,t,n,i);let y=e.prevZ,E=e.nextZ;for(;y&&y.z>=g&&E&&E.z<=v;){if(y.x>=p&&y.x<=f&&y.y>=A&&y.y<=m&&y!==r&&y!==o&&ql(a,h,l,d,c,u,y.x,y.y)&&Yl(y.prev,y,y.next)>=0)return!1;if(y=y.prevZ,E.x>=p&&E.x<=f&&E.y>=A&&E.y<=m&&E!==r&&E!==o&&ql(a,h,l,d,c,u,E.x,E.y)&&Yl(E.prev,E,E.next)>=0)return!1;E=E.nextZ}for(;y&&y.z>=g;){if(y.x>=p&&y.x<=f&&y.y>=A&&y.y<=m&&y!==r&&y!==o&&ql(a,h,l,d,c,u,y.x,y.y)&&Yl(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;E&&E.z<=v;){if(E.x>=p&&E.x<=f&&E.y>=A&&E.y<=m&&E!==r&&E!==o&&ql(a,h,l,d,c,u,E.x,E.y)&&Yl(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function Ql(e,t,n){let i=e;do{const r=i.prev,s=i.next.next;!Jl(r,s)&&Kl(r,i,i.next,s)&&ec(r,s)&&ec(s,r)&&(t.push(r.i/n|0),t.push(i.i/n|0),t.push(s.i/n|0),ic(i),ic(i.next),i=e=s),i=i.next}while(i!==e);return Ol(i)}function Gl(e,t,n,i,r,s){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&Xl(o,e)){let a=tc(o,e);return o=Ol(o,o.next),a=Ol(a,a.next),Fl(o,t,n,i,r,s,0),void Fl(a,t,n,i,r,s,0)}e=e.next}o=o.next}while(o!==e)}function zl(e,t){return e.x-t.x}function Hl(e,t){const n=function(e,t){let n,i=t,r=-1/0;const s=e.x,o=e.y;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){const e=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(e<=s&&e>r&&(r=e,n=i.x<i.next.x?i:i.next,e===s))return n}i=i.next}while(i!==t);if(!n)return null;const a=n,l=n.x,c=n.y;let h,d=1/0;i=n;do{s>=i.x&&i.x>=l&&s!==i.x&&ql(o<c?s:r,o,l,c,o<c?r:s,o,i.x,i.y)&&(h=Math.abs(o-i.y)/(s-i.x),ec(i,e)&&(h<d||h===d&&(i.x>n.x||i.x===n.x&&Vl(n,i)))&&(n=i,d=h)),i=i.next}while(i!==a);return n}(e,t);if(!n)return t;const i=tc(n,e);return Ol(i,i.next),Ol(n,n.next)}function Vl(e,t){return Yl(e.prev,e,t.prev)<0&&Yl(t.next,e,e.next)<0}function jl(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Wl(e){let t=e,n=e;do{(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next}while(t!==e);return n}function ql(e,t,n,i,r,s,o,a){return(r-o)*(t-a)>=(e-o)*(s-a)&&(e-o)*(i-a)>=(n-o)*(t-a)&&(n-o)*(s-a)>=(r-o)*(i-a)}function Xl(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&&Kl(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(ec(e,t)&&ec(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)&&(Yl(e.prev,e,t.prev)||Yl(e,t.prev,t))||Jl(e,t)&&Yl(e.prev,e,e.next)>0&&Yl(t.prev,t,t.next)>0)}function Yl(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Jl(e,t){return e.x===t.x&&e.y===t.y}function Kl(e,t,n,i){const r=$l(Yl(e,t,n)),s=$l(Yl(e,t,i)),o=$l(Yl(n,i,e)),a=$l(Yl(n,i,t));return r!==s&&o!==a||!(0!==r||!Zl(e,n,t))||!(0!==s||!Zl(e,i,t))||!(0!==o||!Zl(n,e,i))||!(0!==a||!Zl(n,t,i))}function Zl(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 $l(e){return e>0?1:e<0?-1:0}function ec(e,t){return Yl(e.prev,e,e.next)<0?Yl(e,t,e.next)>=0&&Yl(e,e.prev,t)>=0:Yl(e,t,e.prev)<0||Yl(e,e.next,t)<0}function tc(e,t){const n=new rc(e.i,e.x,e.y),i=new rc(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 nc(e,t,n,i){const r=new rc(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 ic(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 rc(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}class sc{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return.5*n}static isClockWise(e){return sc.area(e)<0}static triangulateShape(e,t){const n=[],i=[],r=[];oc(e),ac(n,e);let s=e.length;t.forEach(oc);for(let e=0;e<t.length;e++)i.push(s),s+=t[e].length,ac(n,t[e]);const o=function(e,t,n=2){const i=t&&t.length,r=i?t[0]*n:e.length;let s=Ul(e,0,r,n,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,h,d,u,p;if(i&&(s=function(e,t,n,i){const r=[];let s,o,a,l,c;for(s=0,o=t.length;s<o;s++)a=t[s]*i,l=s<o-1?t[s+1]*i:e.length,c=Ul(e,a,l,i,!1),c===c.next&&(c.steiner=!0),r.push(Wl(c));for(r.sort(zl),s=0;s<r.length;s++)n=Hl(r[s],n);return n}(e,t,s,n)),e.length>80*n){a=c=e[0],l=h=e[1];for(let t=n;t<r;t+=n)d=e[t],u=e[t+1],d<a&&(a=d),u<l&&(l=u),d>c&&(c=d),u>h&&(h=u);p=Math.max(c-a,h-l),p=0!==p?32767/p:0}return Fl(s,o,n,a,l,p,0),o}(n,i);for(let e=0;e<o.length;e+=3)r.push(o.slice(e,e+3));return r}}function oc(e){const t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function ac(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}class lc extends Bs{constructor(e=new Pl([new ti(.5,.5),new ti(-.5,.5),new ti(-.5,-.5),new ti(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let t=0,n=e.length;t<n;t++)s(e[t]);function s(e){const s=[],o=void 0!==t.curveSegments?t.curveSegments:12,a=void 0!==t.steps?t.steps:1,l=void 0!==t.depth?t.depth:1;let c=void 0===t.bevelEnabled||t.bevelEnabled,h=void 0!==t.bevelThickness?t.bevelThickness:.2,d=void 0!==t.bevelSize?t.bevelSize:h-.1,u=void 0!==t.bevelOffset?t.bevelOffset:0,p=void 0!==t.bevelSegments?t.bevelSegments:3;const A=t.extrudePath,f=void 0!==t.UVGenerator?t.UVGenerator:cc;let m,g,v,y,E,x=!1;A&&(m=A.getSpacedPoints(a),x=!0,c=!1,g=A.computeFrenetFrames(a,!1),v=new Li,y=new Li,E=new Li),c||(p=0,h=0,d=0,u=0);const b=e.extractPoints(o);let C=b.shape;const w=b.holes;if(!sc.isClockWise(C)){C=C.reverse();for(let e=0,t=w.length;e<t;e++){const t=w[e];sc.isClockWise(t)&&(w[e]=t.reverse())}}const _=sc.triangulateShape(C,w),M=C;for(let e=0,t=w.length;e<t;e++){const t=w[e];C=C.concat(t)}function S(e,t,n){return t||console.error("THREE.ExtrudeGeometry: vec does not exist"),e.clone().addScaledVector(t,n)}const I=C.length,B=_.length;function T(e,t,n){let i,r,s;const o=e.x-t.x,a=e.y-t.y,l=n.x-e.x,c=n.y-e.y,h=o*o+a*a,d=o*c-a*l;if(Math.abs(d)>Number.EPSILON){const d=Math.sqrt(h),u=Math.sqrt(l*l+c*c),p=t.x-a/d,A=t.y+o/d,f=((n.x-c/u-p)*c-(n.y+l/u-A)*l)/(o*c-a*l);i=p+o*f-e.x,r=A+a*f-e.y;const m=i*i+r*r;if(m<=2)return new ti(i,r);s=Math.sqrt(m/2)}else{let e=!1;o>Number.EPSILON?l>Number.EPSILON&&(e=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(a)===Math.sign(c)&&(e=!0),e?(i=-a,r=o,s=Math.sqrt(h)):(i=o,r=a,s=Math.sqrt(h/2))}return new ti(i/s,r/s)}const R=[];for(let e=0,t=M.length,n=t-1,i=e+1;e<t;e++,n++,i++)n===t&&(n=0),i===t&&(i=0),R[e]=T(M[e],M[n],M[i]);const L=[];let D,P=R.concat();for(let e=0,t=w.length;e<t;e++){const t=w[e];D=[];for(let e=0,n=t.length,i=n-1,r=e+1;e<n;e++,i++,r++)i===n&&(i=0),r===n&&(r=0),D[e]=T(t[e],t[i],t[r]);L.push(D),P=P.concat(D)}for(let e=0;e<p;e++){const t=e/p,n=h*Math.cos(t*Math.PI/2),i=d*Math.sin(t*Math.PI/2)+u;for(let e=0,t=M.length;e<t;e++){const t=S(M[e],R[e],i);F(t.x,t.y,-n)}for(let e=0,t=w.length;e<t;e++){const t=w[e];D=L[e];for(let e=0,r=t.length;e<r;e++){const r=S(t[e],D[e],i);F(r.x,r.y,-n)}}}const U=d+u;for(let e=0;e<I;e++){const t=c?S(C[e],P[e],U):C[e];x?(y.copy(g.normals[0]).multiplyScalar(t.x),v.copy(g.binormals[0]).multiplyScalar(t.y),E.copy(m[0]).add(y).add(v),F(E.x,E.y,E.z)):F(t.x,t.y,0)}for(let e=1;e<=a;e++)for(let t=0;t<I;t++){const n=c?S(C[t],P[t],U):C[t];x?(y.copy(g.normals[e]).multiplyScalar(n.x),v.copy(g.binormals[e]).multiplyScalar(n.y),E.copy(m[e]).add(y).add(v),F(E.x,E.y,E.z)):F(n.x,n.y,l/a*e)}for(let e=p-1;e>=0;e--){const t=e/p,n=h*Math.cos(t*Math.PI/2),i=d*Math.sin(t*Math.PI/2)+u;for(let e=0,t=M.length;e<t;e++){const t=S(M[e],R[e],i);F(t.x,t.y,l+n)}for(let e=0,t=w.length;e<t;e++){const t=w[e];D=L[e];for(let e=0,r=t.length;e<r;e++){const r=S(t[e],D[e],i);x?F(r.x,r.y+m[a-1].y,m[a-1].x+n):F(r.x,r.y,l+n)}}}function O(e,t){let n=e.length;for(;--n>=0;){const i=n;let r=n-1;r<0&&(r=e.length-1);for(let e=0,n=a+2*p;e<n;e++){const n=I*e,s=I*(e+1);N(t+i+n,t+r+n,t+r+s,t+i+s)}}}function F(e,t,n){s.push(e),s.push(t),s.push(n)}function k(e,t,r){Q(e),Q(t),Q(r);const s=i.length/3,o=f.generateTopUV(n,i,s-3,s-2,s-1);G(o[0]),G(o[1]),G(o[2])}function N(e,t,r,s){Q(e),Q(t),Q(s),Q(t),Q(r),Q(s);const o=i.length/3,a=f.generateSideWallUV(n,i,o-6,o-3,o-2,o-1);G(a[0]),G(a[1]),G(a[3]),G(a[1]),G(a[2]),G(a[3])}function Q(e){i.push(s[3*e+0]),i.push(s[3*e+1]),i.push(s[3*e+2])}function G(e){r.push(e.x),r.push(e.y)}!function(){const e=i.length/3;if(c){let e=0,t=I*e;for(let e=0;e<B;e++){const n=_[e];k(n[2]+t,n[1]+t,n[0]+t)}e=a+2*p,t=I*e;for(let e=0;e<B;e++){const n=_[e];k(n[0]+t,n[1]+t,n[2]+t)}}else{for(let e=0;e<B;e++){const t=_[e];k(t[2],t[1],t[0])}for(let e=0;e<B;e++){const t=_[e];k(t[0]+I*a,t[1]+I*a,t[2]+I*a)}}n.addGroup(e,i.length/3-e,0)}(),function(){const e=i.length/3;let t=0;O(M,t),t+=M.length;for(let e=0,n=w.length;e<n;e++){const n=w[e];O(n,t),t+=n.length}n.addGroup(e,i.length/3-e,1)}()}this.setAttribute("position",new xs(i,3)),this.setAttribute("uv",new xs(r,2)),this.computeVertexNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return function(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,i=e.length;t<i;t++){const i=e[t];n.shapes.push(i.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),void 0!==t.extrudePath&&(n.options.extrudePath=t.extrudePath.toJSON()),n}(this.parameters.shapes,this.parameters.options,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const r=t[e.shapes[i]];n.push(r)}const i=e.options.extrudePath;return void 0!==i&&(e.options.extrudePath=(new yl[i.type]).fromJSON(i)),new lc(n,e.options)}}const cc={generateTopUV:function(e,t,n,i,r){const s=t[3*n],o=t[3*n+1],a=t[3*i],l=t[3*i+1],c=t[3*r],h=t[3*r+1];return[new ti(s,o),new ti(a,l),new ti(c,h)]},generateSideWallUV:function(e,t,n,i,r,s){const o=t[3*n],a=t[3*n+1],l=t[3*n+2],c=t[3*i],h=t[3*i+1],d=t[3*i+2],u=t[3*r],p=t[3*r+1],A=t[3*r+2],f=t[3*s],m=t[3*s+1],g=t[3*s+2];return Math.abs(a-h)<Math.abs(o-c)?[new ti(o,1-l),new ti(c,1-d),new ti(u,1-A),new ti(f,1-g)]:[new ti(a,1-l),new ti(h,1-d),new ti(p,1-A),new ti(m,1-g)]}};class hc extends Sl{constructor(e=1,t=0){const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new hc(e.radius,e.detail)}}class dc extends Sl{constructor(e=1,t=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new dc(e.radius,e.detail)}}class uc extends Bs{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,s=t/2,o=Math.floor(n),a=Math.floor(i),l=o+1,c=a+1,h=e/o,d=t/a,u=[],p=[],A=[],f=[];for(let e=0;e<c;e++){const t=e*d-s;for(let n=0;n<l;n++){const i=n*h-r;p.push(i,-t,0),A.push(0,0,1),f.push(n/o),f.push(1-e/a)}}for(let e=0;e<a;e++)for(let t=0;t<o;t++){const n=t+l*e,i=t+l*(e+1),r=t+1+l*(e+1),s=t+1+l*e;u.push(n,i,s),u.push(i,r,s)}this.setIndex(u),this.setAttribute("position",new xs(p,3)),this.setAttribute("normal",new xs(A,3)),this.setAttribute("uv",new xs(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new uc(e.width,e.height,e.widthSegments,e.heightSegments)}}class pc extends Bs{constructor(e=.5,t=1,n=32,i=1,r=0,s=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:s},n=Math.max(3,n);const o=[],a=[],l=[],c=[];let h=e;const d=(t-e)/(i=Math.max(1,i)),u=new Li,p=new ti;for(let e=0;e<=i;e++){for(let e=0;e<=n;e++){const i=r+e/n*s;u.x=h*Math.cos(i),u.y=h*Math.sin(i),a.push(u.x,u.y,u.z),l.push(0,0,1),p.x=(u.x/t+1)/2,p.y=(u.y/t+1)/2,c.push(p.x,p.y)}h+=d}for(let e=0;e<i;e++){const t=e*(n+1);for(let e=0;e<n;e++){const i=e+t,r=i,s=i+n+1,a=i+n+2,l=i+1;o.push(r,s,l),o.push(s,a,l)}}this.setIndex(o),this.setAttribute("position",new xs(a,3)),this.setAttribute("normal",new xs(l,3)),this.setAttribute("uv",new xs(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new pc(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class Ac extends Bs{constructor(e=new Pl([new ti(0,.5),new ti(-.5,-.5),new ti(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],s=[];let o=0,a=0;if(!1===Array.isArray(e))l(e);else for(let t=0;t<e.length;t++)l(e[t]),this.addGroup(o,a,t),o+=a,a=0;function l(e){const o=i.length/3,l=e.extractPoints(t);let c=l.shape;const h=l.holes;!1===sc.isClockWise(c)&&(c=c.reverse());for(let e=0,t=h.length;e<t;e++){const t=h[e];!0===sc.isClockWise(t)&&(h[e]=t.reverse())}const d=sc.triangulateShape(c,h);for(let e=0,t=h.length;e<t;e++){const t=h[e];c=c.concat(t)}for(let e=0,t=c.length;e<t;e++){const t=c[e];i.push(t.x,t.y,0),r.push(0,0,1),s.push(t.x,t.y)}for(let e=0,t=d.length;e<t;e++){const t=d[e],i=t[0]+o,r=t[1]+o,s=t[2]+o;n.push(i,r,s),a+=3}}this.setIndex(n),this.setAttribute("position",new xs(i,3)),this.setAttribute("normal",new xs(r,3)),this.setAttribute("uv",new xs(s,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return function(e,t){if(t.shapes=[],Array.isArray(e))for(let n=0,i=e.length;n<i;n++){const i=e[n];t.shapes.push(i.uuid)}else t.shapes.push(e.uuid);return t}(this.parameters.shapes,e)}static fromJSON(e,t){const n=[];for(let i=0,r=e.shapes.length;i<r;i++){const r=t[e.shapes[i]];n.push(r)}return new Ac(n,e.curveSegments)}}class fc extends Bs{constructor(e=1,t=32,n=16,i=0,r=2*Math.PI,s=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:s,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const a=Math.min(s+o,Math.PI);let l=0;const c=[],h=new Li,d=new Li,u=[],p=[],A=[],f=[];for(let u=0;u<=n;u++){const m=[],g=u/n;let v=0;0===u&&0===s?v=.5/t:u===n&&a===Math.PI&&(v=-.5/t);for(let n=0;n<=t;n++){const a=n/t;h.x=-e*Math.cos(i+a*r)*Math.sin(s+g*o),h.y=e*Math.cos(s+g*o),h.z=e*Math.sin(i+a*r)*Math.sin(s+g*o),p.push(h.x,h.y,h.z),d.copy(h).normalize(),A.push(d.x,d.y,d.z),f.push(a+v,1-g),m.push(l++)}c.push(m)}for(let e=0;e<n;e++)for(let i=0;i<t;i++){const t=c[e][i+1],r=c[e][i],o=c[e+1][i],l=c[e+1][i+1];(0!==e||s>0)&&u.push(t,r,l),(e!==n-1||a<Math.PI)&&u.push(r,o,l)}this.setIndex(u),this.setAttribute("position",new xs(p,3)),this.setAttribute("normal",new xs(A,3)),this.setAttribute("uv",new xs(f,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fc(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class mc extends Sl{constructor(e=1,t=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new mc(e.radius,e.detail)}}class gc extends Bs{constructor(e=1,t=.4,n=12,i=48,r=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},n=Math.floor(n),i=Math.floor(i);const s=[],o=[],a=[],l=[],c=new Li,h=new Li,d=new Li;for(let s=0;s<=n;s++)for(let u=0;u<=i;u++){const p=u/i*r,A=s/n*Math.PI*2;h.x=(e+t*Math.cos(A))*Math.cos(p),h.y=(e+t*Math.cos(A))*Math.sin(p),h.z=t*Math.sin(A),o.push(h.x,h.y,h.z),c.x=e*Math.cos(p),c.y=e*Math.sin(p),d.subVectors(h,c).normalize(),a.push(d.x,d.y,d.z),l.push(u/i),l.push(s/n)}for(let e=1;e<=n;e++)for(let t=1;t<=i;t++){const n=(i+1)*e+t-1,r=(i+1)*(e-1)+t-1,o=(i+1)*(e-1)+t,a=(i+1)*e+t;s.push(n,r,a),s.push(r,o,a)}this.setIndex(s),this.setAttribute("position",new xs(o,3)),this.setAttribute("normal",new xs(a,3)),this.setAttribute("uv",new xs(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new gc(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class vc extends Bs{constructor(e=1,t=.4,n=64,i=8,r=2,s=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:s},n=Math.floor(n),i=Math.floor(i);const o=[],a=[],l=[],c=[],h=new Li,d=new Li,u=new Li,p=new Li,A=new Li,f=new Li,m=new Li;for(let o=0;o<=n;++o){const v=o/n*r*Math.PI*2;g(v,r,s,e,u),g(v+.01,r,s,e,p),f.subVectors(p,u),m.addVectors(p,u),A.crossVectors(f,m),m.crossVectors(A,f),A.normalize(),m.normalize();for(let e=0;e<=i;++e){const r=e/i*Math.PI*2,s=-t*Math.cos(r),p=t*Math.sin(r);h.x=u.x+(s*m.x+p*A.x),h.y=u.y+(s*m.y+p*A.y),h.z=u.z+(s*m.z+p*A.z),a.push(h.x,h.y,h.z),d.subVectors(h,u).normalize(),l.push(d.x,d.y,d.z),c.push(o/n),c.push(e/i)}}for(let e=1;e<=n;e++)for(let t=1;t<=i;t++){const n=(i+1)*(e-1)+(t-1),r=(i+1)*e+(t-1),s=(i+1)*e+t,a=(i+1)*(e-1)+t;o.push(n,r,a),o.push(r,s,a)}function g(e,t,n,i,r){const s=Math.cos(e),o=Math.sin(e),a=n/t*e,l=Math.cos(a);r.x=i*(2+l)*.5*s,r.y=i*(2+l)*o*.5,r.z=i*Math.sin(a)*.5}this.setIndex(o),this.setAttribute("position",new xs(a,3)),this.setAttribute("normal",new xs(l,3)),this.setAttribute("uv",new xs(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new vc(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class yc extends Bs{constructor(e=new gl(new Li(-1,-1,0),new Li(-1,1,0),new Li(1,1,0)),t=64,n=1,i=8,r=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const s=e.computeFrenetFrames(t,r);this.tangents=s.tangents,this.normals=s.normals,this.binormals=s.binormals;const o=new Li,a=new Li,l=new ti;let c=new Li;const h=[],d=[],u=[],p=[];function A(r){c=e.getPointAt(r/t,c);const l=s.normals[r],u=s.binormals[r];for(let e=0;e<=i;e++){const t=e/i*Math.PI*2,r=Math.sin(t),s=-Math.cos(t);a.x=s*l.x+r*u.x,a.y=s*l.y+r*u.y,a.z=s*l.z+r*u.z,a.normalize(),d.push(a.x,a.y,a.z),o.x=c.x+n*a.x,o.y=c.y+n*a.y,o.z=c.z+n*a.z,h.push(o.x,o.y,o.z)}}!function(){for(let e=0;e<t;e++)A(e);A(!1===r?t:0),function(){for(let e=0;e<=t;e++)for(let n=0;n<=i;n++)l.x=e/t,l.y=n/i,u.push(l.x,l.y)}(),function(){for(let e=1;e<=t;e++)for(let t=1;t<=i;t++){const n=(i+1)*(e-1)+(t-1),r=(i+1)*e+(t-1),s=(i+1)*e+t,o=(i+1)*(e-1)+t;p.push(n,r,o),p.push(r,s,o)}}()}(),this.setIndex(p),this.setAttribute("position",new xs(h,3)),this.setAttribute("normal",new xs(d,3)),this.setAttribute("uv",new xs(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new yc((new yl[e.path.type]).fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class Ec extends Bs{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},null!==e){const t=[],n=new Set,i=new Li,r=new Li;if(null!==e.index){const s=e.attributes.position,o=e.index;let a=e.groups;0===a.length&&(a=[{start:0,count:o.count,materialIndex:0}]);for(let e=0,l=a.length;e<l;++e){const l=a[e],c=l.start;for(let e=c,a=c+l.count;e<a;e+=3)for(let a=0;a<3;a++){const l=o.getX(e+a),c=o.getX(e+(a+1)%3);i.fromBufferAttribute(s,l),r.fromBufferAttribute(s,c),!0===xc(i,r,n)&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}}else{const s=e.attributes.position;for(let e=0,o=s.count/3;e<o;e++)for(let o=0;o<3;o++){const a=3*e+o,l=3*e+(o+1)%3;i.fromBufferAttribute(s,a),r.fromBufferAttribute(s,l),!0===xc(i,r,n)&&(t.push(i.x,i.y,i.z),t.push(r.x,r.y,r.z))}}this.setAttribute("position",new xs(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function xc(e,t,n){const i=`${e.x},${e.y},${e.z}-${t.x},${t.y},${t.z}`,r=`${t.x},${t.y},${t.z}-${e.x},${e.y},${e.z}`;return!0!==n.has(i)&&!0!==n.has(r)&&(n.add(i),n.add(r),!0)}var bc=Object.freeze({__proto__:null,BoxGeometry:Hs,CapsuleGeometry:Cl,CircleGeometry:wl,ConeGeometry:Ml,CylinderGeometry:_l,DodecahedronGeometry:Il,EdgesGeometry:Dl,ExtrudeGeometry:lc,IcosahedronGeometry:hc,LatheGeometry:bl,OctahedronGeometry:dc,PlaneGeometry:uc,PolyhedronGeometry:Sl,RingGeometry:pc,ShapeGeometry:Ac,SphereGeometry:fc,TetrahedronGeometry:mc,TorusGeometry:gc,TorusKnotGeometry:vc,TubeGeometry:yc,WireframeGeometry:Ec});class Cc extends is{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new es(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class wc extends Xs{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class _c extends is{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new es(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new es(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vr,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Mc extends _c{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new ti(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Yn(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new es(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new es(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new es(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Sc extends is{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new es(16777215),this.specular=new es(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new es(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vr,this.combine=$,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Ic extends is{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new es(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new es(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class Bc extends is{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Tc extends is{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new es(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new es(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vr,this.combine=$,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Rc extends is{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Xt,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Lc extends is{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class Dc extends is{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new es(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Zt,this.normalScale=new ti(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Pc extends _a{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Uc(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)}function Oc(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Fc(e){const t=e.length,n=new Array(t);for(let e=0;e!==t;++e)n[e]=e;return n.sort((function(t,n){return e[t]-e[n]})),n}function kc(e,t,n){const i=e.length,r=new e.constructor(i);for(let s=0,o=0;o!==i;++s){const i=n[s]*t;for(let n=0;n!==t;++n)r[o++]=e[i+n]}return r}function Nc(e,t,n,i){let r=1,s=e[0];for(;void 0!==s&&void 0===s[i];)s=e[r++];if(void 0===s)return;let o=s[i];if(void 0!==o)if(Array.isArray(o))do{o=s[i],void 0!==o&&(t.push(s.time),n.push.apply(n,o)),s=e[r++]}while(void 0!==s);else if(void 0!==o.toArray)do{o=s[i],void 0!==o&&(t.push(s.time),o.toArray(n,n.length)),s=e[r++]}while(void 0!==s);else do{o=s[i],void 0!==o&&(t.push(s.time),n.push(o)),s=e[r++]}while(void 0!==s)}const Qc={convertArray:Uc,isTypedArray:Oc,getKeyframeOrder:Fc,sortedArray:kc,flattenJSON:Nc,subclip:function(e,t,n,i,r=30){const s=e.clone();s.name=t;const o=[];for(let e=0;e<s.tracks.length;++e){const t=s.tracks[e],a=t.getValueSize(),l=[],c=[];for(let e=0;e<t.times.length;++e){const s=t.times[e]*r;if(!(s<n||s>=i)){l.push(t.times[e]);for(let n=0;n<a;++n)c.push(t.values[e*a+n])}}0!==l.length&&(t.times=Uc(l,t.times.constructor),t.values=Uc(c,t.values.constructor),o.push(t))}s.tracks=o;let a=1/0;for(let e=0;e<s.tracks.length;++e)a>s.tracks[e].times[0]&&(a=s.tracks[e].times[0]);for(let e=0;e<s.tracks.length;++e)s.tracks[e].shift(-1*a);return s.resetDuration(),s},makeClipAdditive:function(e,t=0,n=e,i=30){i<=0&&(i=30);const r=n.tracks.length,s=t/i;for(let t=0;t<r;++t){const i=n.tracks[t],r=i.ValueTypeName;if("bool"===r||"string"===r)continue;const o=e.tracks.find((function(e){return e.name===i.name&&e.ValueTypeName===r}));if(void 0===o)continue;let a=0;const l=i.getValueSize();i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(a=l/3);let c=0;const h=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=h/3);const d=i.times.length-1;let u;if(s<=i.times[0]){const e=a,t=l-a;u=i.values.slice(e,t)}else if(s>=i.times[d]){const e=d*l+a,t=e+l-a;u=i.values.slice(e,t)}else{const e=i.createInterpolant(),t=a,n=l-a;e.evaluate(s),u=e.resultBuffer.slice(t,n)}"quaternion"===r&&(new Ri).fromArray(u).normalize().conjugate().toArray(u);const p=o.times.length;for(let e=0;e<p;++e){const t=e*h+c;if("quaternion"===r)Ri.multiplyQuaternionsFlat(o.values,t,u,0,o.values,t);else{const e=h-2*c;for(let n=0;n<e;++n)o.values[t+n]-=u[n]}}}return e.blendMode=Vt,e}};class Gc{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let s;n:{i:if(!(e<i)){for(let s=n+2;;){if(void 0===i){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===s)break;if(r=i,i=t[++n],e<i)break t}s=t.length;break n}if(e>=r)break e;{const o=t[1];e<o&&(n=2,r=o);for(let s=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===s)break;if(i=r,r=t[--n-1],e>=r)break t}s=n,n=0}}for(;n<s;){const i=n+s>>>1;e<t[i]?s=i:n=i+1}if(i=t[n],r=t[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i;for(let e=0;e!==i;++e)t[e]=n[r+e];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class zc extends Gc{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Qt,endingEnd:Qt}}intervalChanged_(e,t,n){const i=this.parameterPositions;let r=e-2,s=e+1,o=i[r],a=i[s];if(void 0===o)switch(this.getSettings_().endingStart){case Gt:r=e,o=2*t-n;break;case zt:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(void 0===a)switch(this.getSettings_().endingEnd){case Gt:s=e,a=2*n-t;break;case zt:s=1,a=n+i[1]-i[0];break;default:s=e-1,a=t}const l=.5*(n-t),c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(a-n),this._offsetPrev=r*c,this._offsetNext=s*c}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,l=a-o,c=this._offsetPrev,h=this._offsetNext,d=this._weightPrev,u=this._weightNext,p=(n-t)/(i-t),A=p*p,f=A*p,m=-d*f+2*d*A-d*p,g=(1+d)*f+(-1.5-2*d)*A+(-.5+d)*p+1,v=(-1-u)*f+(1.5+u)*A+.5*p,y=u*f-u*A;for(let e=0;e!==o;++e)r[e]=m*s[c+e]+g*s[l+e]+v*s[a+e]+y*s[h+e];return r}}class Hc extends Gc{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=e*o,l=a-o,c=(n-t)/(i-t),h=1-c;for(let e=0;e!==o;++e)r[e]=s[l+e]*h+s[a+e]*c;return r}}class Vc extends Gc{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class jc{constructor(e,t,n,i){if(void 0===e)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===t||0===t.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Uc(t,this.TimeBufferType),this.values=Uc(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Uc(e.times,Array),values:Uc(e.values,Array)};const t=e.getInterpolation();t!==e.DefaultInterpolation&&(n.interpolation=t)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new Vc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Hc(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new zc(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Ft:t=this.InterpolantFactoryMethodDiscrete;break;case kt:t=this.InterpolantFactoryMethodLinear;break;case Nt:t=this.InterpolantFactoryMethodSmooth}if(void 0===t){const t="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(e===this.DefaultInterpolation)throw new Error(t);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",t),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Ft;case this.InterpolantFactoryMethodLinear:return kt;case this.InterpolantFactoryMethodSmooth:return Nt}}getValueSize(){return this.values.length/this.times.length}shift(e){if(0!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(1!==e){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let r=0,s=i-1;for(;r!==i&&n[r]<e;)++r;for(;-1!==s&&n[s]>t;)--s;if(++s,0!==r||s!==i){r>=s&&(s=Math.max(s,1),r=s-1);const e=this.getValueSize();this.times=n.slice(r,s),this.values=this.values.slice(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&&Oc(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=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Nt,r=e.length-1;let s=1;for(let o=1;o<r;++o){let r=!1;const a=e[o];if(a!==e[o+1]&&(1!==o||a!==e[0]))if(i)r=!0;else{const e=o*n,i=e-n,s=e+n;for(let o=0;o!==n;++o){const n=t[e+o];if(n!==t[i+o]||n!==t[s+o]){r=!0;break}}}if(r){if(o!==s){e[s]=e[o];const i=o*n,r=s*n;for(let e=0;e!==n;++e)t[r+e]=t[i+e]}++s}}if(r>0){e[s]=e[r];for(let e=r*n,i=s*n,o=0;o!==n;++o)t[i+o]=t[e+o];++s}return s!==e.length?(this.times=e.slice(0,s),this.values=t.slice(0,s*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}jc.prototype.TimeBufferType=Float32Array,jc.prototype.ValueBufferType=Float32Array,jc.prototype.DefaultInterpolation=kt;class Wc extends jc{constructor(e,t,n){super(e,t,n)}}Wc.prototype.ValueTypeName="bool",Wc.prototype.ValueBufferType=Array,Wc.prototype.DefaultInterpolation=Ft,Wc.prototype.InterpolantFactoryMethodLinear=void 0,Wc.prototype.InterpolantFactoryMethodSmooth=void 0;class qc extends jc{}qc.prototype.ValueTypeName="color";class Xc extends jc{}Xc.prototype.ValueTypeName="number";class Yc extends Gc{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=(n-t)/(i-t);let l=e*o;for(let e=l+o;l!==e;l+=4)Ri.slerpFlat(r,0,s,l-o,s,l,a);return r}}class Jc extends jc{InterpolantFactoryMethodLinear(e){return new Yc(this.times,this.values,this.getValueSize(),e)}}Jc.prototype.ValueTypeName="quaternion",Jc.prototype.InterpolantFactoryMethodSmooth=void 0;class Kc extends jc{constructor(e,t,n){super(e,t,n)}}Kc.prototype.ValueTypeName="string",Kc.prototype.ValueBufferType=Array,Kc.prototype.DefaultInterpolation=Ft,Kc.prototype.InterpolantFactoryMethodLinear=void 0,Kc.prototype.InterpolantFactoryMethodSmooth=void 0;class Zc extends jc{}Zc.prototype.ValueTypeName="vector";class $c{constructor(e="",t=-1,n=[],i=Ht){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Xn(),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(eh(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(jc.toJSON(n[e]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,s=[];for(let e=0;e<r;e++){let o=[],a=[];o.push((e+r-1)%r,e,(e+1)%r),a.push(0,1,0);const l=Fc(o);o=kc(o,1,l),a=kc(a,1,l),i||0!==o[0]||(o.push(r),a.push(a[0])),s.push(new Xc(".morphTargetInfluences["+t[e].name+"]",o,a).scale(1/n))}return new this(e,-1,s)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const t=e;n=t.geometry&&t.geometry.animations||t.animations}for(let e=0;e<n.length;e++)if(n[e].name===t)return n[e];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},r=/^([\w-]*?)([\d]+)$/;for(let t=0,n=e.length;t<n;t++){const n=e[t],s=n.name.match(r);if(s&&s.length>1){const e=s[1];let t=i[e];t||(i[e]=t=[]),t.push(n)}}const s=[];for(const e in i)s.push(this.CreateFromMorphTargetSequence(e,i[e],t,n));return s}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const s=[],o=[];Nc(n,s,o,i),0!==s.length&&r.push(new e(t,s,o))}},i=[],r=e.name||"default",s=e.fps||30,o=e.blendMode;let a=e.length||-1;const l=e.hierarchy||[];for(let e=0;e<l.length;e++){const r=l[e].keys;if(r&&0!==r.length)if(r[0].morphTargets){const e={};let t;for(t=0;t<r.length;t++)if(r[t].morphTargets)for(let n=0;n<r[t].morphTargets.length;n++)e[r[t].morphTargets[n]]=-1;for(const n in e){const e=[],s=[];for(let i=0;i!==r[t].morphTargets.length;++i){const i=r[t];e.push(i.time),s.push(i.morphTarget===n?1:0)}i.push(new Xc(".morphTargetInfluence["+n+"]",e,s))}a=e.length*s}else{const s=".bones["+t[e].name+"]";n(Zc,s+".position",r,"pos",i),n(Jc,s+".quaternion",r,"rot",i),n(Zc,s+".scale",r,"scl",i)}}return 0===i.length?null:new this(r,a,i,o)}resetDuration(){let e=0;for(let t=0,n=this.tracks.length;t!==n;++t){const n=this.tracks[t];e=Math.max(e,n.times[n.times.length-1])}return this.duration=e,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function eh(e){if(void 0===e.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Xc;case"vector":case"vector2":case"vector3":case"vector4":return Zc;case"color":return qc;case"quaternion":return Jc;case"bool":case"boolean":return Wc;case"string":return Kc}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}(e.type);if(void 0===e.times){const t=[],n=[];Nc(e.keys,t,n,"value"),e.times=t,e.values=n}return void 0!==t.parse?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}const th={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};class nh{constructor(e,t,n){const i=this;let r,s=!1,o=0,a=0;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(e){a++,!1===s&&void 0!==i.onStart&&i.onStart(e,o,a),s=!0},this.itemEnd=function(e){o++,void 0!==i.onProgress&&i.onProgress(e,o,a),o===a&&(s=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(e){void 0!==i.onError&&i.onError(e)},this.resolveURL=function(e){return r?r(e):e},this.setURLModifier=function(e){return r=e,this},this.addHandler=function(e,t){return l.push(e,t),this},this.removeHandler=function(e){const t=l.indexOf(e);return-1!==t&&l.splice(t,2),this},this.getHandler=function(e){for(let t=0,n=l.length;t<n;t+=2){const n=l[t],i=l[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return i}return null}}}const ih=new nh;class rh{constructor(e){this.manager=void 0!==e?e:ih,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const n=this;return new Promise((function(i,r){n.load(e,i,t,r)}))}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}rh.DEFAULT_MATERIAL_NAME="__DEFAULT";const sh={};class oh extends Error{constructor(e,t){super(e),this.response=t}}class ah extends rh{constructor(e){super(e)}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=th.get(e);if(void 0!==r)return this.manager.itemStart(e),setTimeout((()=>{t&&t(r),this.manager.itemEnd(e)}),0),r;if(void 0!==sh[e])return void sh[e].push({onLoad:t,onProgress:n,onError:i});sh[e]=[],sh[e].push({onLoad:t,onProgress:n,onError:i});const s=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,a=this.responseType;fetch(s).then((t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=sh[e],i=t.body.getReader(),r=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),s=r?parseInt(r):0,o=0!==s;let a=0;const l=new ReadableStream({start(e){!function t(){i.read().then((({done:i,value:r})=>{if(i)e.close();else{a+=r.byteLength;const i=new ProgressEvent("progress",{lengthComputable:o,loaded:a,total:s});for(let e=0,t=n.length;e<t;e++){const t=n[e];t.onProgress&&t.onProgress(i)}e.enqueue(r),t()}}),(t=>{e.error(t)}))}()}});return new Response(l)}throw new oh(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)})).then((e=>{switch(a){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then((e=>(new DOMParser).parseFromString(e,o)));case"json":return e.json();default:if(void 0===o)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then((e=>i.decode(e)))}}})).then((t=>{th.add(e,t);const n=sh[e];delete sh[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onLoad&&i.onLoad(t)}})).catch((t=>{const n=sh[e];if(void 0===n)throw this.manager.itemError(e),t;delete sh[e];for(let e=0,i=n.length;e<i;e++){const i=n[e];i.onError&&i.onError(t)}this.manager.itemError(e)})).finally((()=>{this.manager.itemEnd(e)})),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class lh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new ah(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t=[];for(let n=0;n<e.length;n++){const i=$c.parse(e[n]);t.push(i)}return t}}class ch extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=[],o=new Ya,a=new ah(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(r.withCredentials);let l=0;function c(c){a.load(e[c],(function(e){const n=r.parse(e,!0);s[c]={width:n.width,height:n.height,format:n.format,mipmaps:n.mipmaps},l+=1,6===l&&(1===n.mipmapCount&&(o.minFilter=Me),o.image=s,o.format=n.format,o.needsUpdate=!0,t&&t(o))}),n,i)}if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)c(t);else a.load(e,(function(e){const n=r.parse(e,!0);if(n.isCubemap){const e=n.mipmaps.length/n.mipmapCount;for(let t=0;t<e;t++){s[t]={mipmaps:[]};for(let e=0;e<n.mipmapCount;e++)s[t].mipmaps.push(n.mipmaps[t*n.mipmapCount+e]),s[t].format=n.format,s[t].width=n.width,s[t].height=n.height}o.image=s}else o.image.width=n.width,o.image.height=n.height,o.mipmaps=n.mipmaps;1===n.mipmapCount&&(o.minFilter=Me),o.format=n.format,o.needsUpdate=!0,t&&t(o)}),n,i);return o}}class hh extends rh{constructor(e){super(e)}load(e,t,n,i){void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=th.get(e);if(void 0!==s)return r.manager.itemStart(e),setTimeout((function(){t&&t(s),r.manager.itemEnd(e)}),0),s;const o=ai("img");function a(){c(),th.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(t){c(),i&&i(t),r.manager.itemError(e),r.manager.itemEnd(e)}function c(){o.removeEventListener("load",a,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",a,!1),o.addEventListener("error",l,!1),"data:"!==e.slice(0,5)&&void 0!==this.crossOrigin&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o}}class dh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=new no;r.colorSpace=tn;const s=new hh(this.manager);s.setCrossOrigin(this.crossOrigin),s.setPath(this.path);let o=0;function a(n){s.load(e[n],(function(e){r.images[n]=e,o++,6===o&&(r.needsUpdate=!0,t&&t(r))}),void 0,i)}for(let t=0;t<e.length;++t)a(t);return r}}class uh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new Go,o=new ah(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(r.withCredentials),o.load(e,(function(e){let n;try{n=r.parse(e)}catch(e){if(void 0===i)return void console.error(e);i(e)}void 0!==n.image?s.image=n.image:void 0!==n.data&&(s.image.width=n.width,s.image.height=n.height,s.image.data=n.data),s.wrapS=void 0!==n.wrapS?n.wrapS:ye,s.wrapT=void 0!==n.wrapT?n.wrapT:ye,s.magFilter=void 0!==n.magFilter?n.magFilter:Me,s.minFilter=void 0!==n.minFilter?n.minFilter:Me,s.anisotropy=void 0!==n.anisotropy?n.anisotropy:1,void 0!==n.colorSpace&&(s.colorSpace=n.colorSpace),void 0!==n.flipY&&(s.flipY=n.flipY),void 0!==n.format&&(s.format=n.format),void 0!==n.type&&(s.type=n.type),void 0!==n.mipmaps&&(s.mipmaps=n.mipmaps,s.minFilter=Be),1===n.mipmapCount&&(s.minFilter=Me),void 0!==n.generateMipmaps&&(s.generateMipmaps=n.generateMipmaps),s.needsUpdate=!0,t&&t(s,n)}),n,i),s}}class ph extends rh{constructor(e){super(e)}load(e,t,n,i){const r=new Ci,s=new hh(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(e,(function(e){r.image=e,r.needsUpdate=!0,void 0!==t&&t(r)}),n,i),r}}class Ah extends Ur{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new es(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,void 0!==this.groundColor&&(t.object.groundColor=this.groundColor.getHex()),void 0!==this.distance&&(t.object.distance=this.distance),void 0!==this.angle&&(t.object.angle=this.angle),void 0!==this.decay&&(t.object.decay=this.decay),void 0!==this.penumbra&&(t.object.penumbra=this.penumbra),void 0!==this.shadow&&(t.object.shadow=this.shadow.toJSON()),void 0!==this.target&&(t.object.target=this.target.uuid),t}}class fh extends Ah{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(Ur.DEFAULT_UP),this.updateMatrix(),this.groundColor=new es(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const mh=new lr,gh=new Li,vh=new Li;class yh{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ti(512,512),this.map=null,this.mapPass=null,this.matrix=new lr,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new oa,this._frameExtents=new ti(1,1),this._viewportCount=1,this._viewports=[new wi(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;gh.setFromMatrixPosition(e.matrixWorld),t.position.copy(gh),vh.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(vh),t.updateMatrixWorld(),mh.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(mh),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(mh)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Eh extends yh{constructor(){super(new $s(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,n=2*qn*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class xh extends Ah{constructor(e,t,n=0,i=Math.PI/3,r=0,s=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ur.DEFAULT_UP),this.updateMatrix(),this.target=new Ur,this.distance=n,this.angle=i,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new Eh}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const bh=new lr,Ch=new Li,wh=new Li;class _h extends yh{constructor(){super(new $s(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new ti(4,2),this._viewportCount=6,this._viewports=[new wi(2,1,1,1),new wi(0,1,1,1),new wi(3,1,1,1),new wi(1,1,1,1),new wi(3,0,1,1),new wi(1,0,1,1)],this._cubeDirections=[new Li(1,0,0),new Li(-1,0,0),new Li(0,0,1),new Li(0,0,-1),new Li(0,1,0),new Li(0,-1,0)],this._cubeUps=[new Li(0,1,0),new Li(0,1,0),new Li(0,1,0),new Li(0,1,0),new Li(0,0,1),new Li(0,0,-1)]}updateMatrices(e,t=0){const n=this.camera,i=this.matrix,r=e.distance||n.far;r!==n.far&&(n.far=r,n.updateProjectionMatrix()),Ch.setFromMatrixPosition(e.matrixWorld),n.position.copy(Ch),wh.copy(n.position),wh.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(wh),n.updateMatrixWorld(),i.makeTranslation(-Ch.x,-Ch.y,-Ch.z),bh.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(bh)}}class Mh extends Ah{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new _h}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Sh extends Ys{constructor(e=-1,t=1,n=1,i=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,s=n+e,o=i+t,a=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,s=r+e*this.view.width,o-=t*this.view.offsetY,a=o-t*this.view.height}this.projectionMatrix.makeOrthographic(r,s,o,a,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}class Ih extends yh{constructor(){super(new Sh(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Bh extends Ah{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ur.DEFAULT_UP),this.updateMatrix(),this.target=new Ur,this.shadow=new Ih}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Th extends Ah{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Rh extends Ah{constructor(e,t,n=10,i=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Lh{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new Li)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,r=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.282095),t.addScaledVector(s[1],.488603*i),t.addScaledVector(s[2],.488603*r),t.addScaledVector(s[3],.488603*n),t.addScaledVector(s[4],n*i*1.092548),t.addScaledVector(s[5],i*r*1.092548),t.addScaledVector(s[6],.315392*(3*r*r-1)),t.addScaledVector(s[7],n*r*1.092548),t.addScaledVector(s[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,s=this.coefficients;return t.copy(s[0]).multiplyScalar(.886227),t.addScaledVector(s[1],1.023328*i),t.addScaledVector(s[2],1.023328*r),t.addScaledVector(s[3],1.023328*n),t.addScaledVector(s[4],.858086*n*i),t.addScaledVector(s[5],.858086*i*r),t.addScaledVector(s[6],.743125*r*r-.247708),t.addScaledVector(s[7],.858086*n*r),t.addScaledVector(s[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+3*i);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+3*i);return e}static getBasisAt(e,t){const n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}class Dh extends Ah{constructor(e=new Lh,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Ph extends rh{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,s=new ah(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t=this.textures;function n(e){return void 0===t[e]&&console.warn("THREE.MaterialLoader: Undefined texture",e),t[e]}const i=this.createMaterialFromType(e.type);if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=e.sheen),void 0!==e.sheenColor&&(i.sheenColor=(new es).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(i.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.specular&&i.specular.setHex(e.specular),void 0!==e.specularIntensity&&(i.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(i.dispersion=e.dispersion),void 0!==e.iridescence&&(i.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(i.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(i.transmission=e.transmission),void 0!==e.thickness&&(i.thickness=e.thickness),void 0!==e.attenuationDistance&&(i.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(i.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(i.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.shadowSide&&(i.shadowSide=e.shadowSide),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(i.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(i.depthFunc=e.depthFunc),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(i.blendSrc=e.blendSrc),void 0!==e.blendDst&&(i.blendDst=e.blendDst),void 0!==e.blendEquation&&(i.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(i.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&(i.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(i.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==i.blendColor&&i.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(i.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),void 0!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(i.forceSinglePass=e.forceSinglePass),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"==typeof e.vertexColors?i.vertexColors=e.vertexColors>0: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 es).setHex(r.value);break;case"v2":i.uniforms[t].value=(new ti).fromArray(r.value);break;case"v3":i.uniforms[t].value=(new Li).fromArray(r.value);break;case"v4":i.uniforms[t].value=(new wi).fromArray(r.value);break;case"m3":i.uniforms[t].value=(new ni).fromArray(r.value);break;case"m4":i.uniforms[t].value=(new lr).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.glslVersion&&(i.glslVersion=e.glslVersion),void 0!==e.extensions)for(const t in e.extensions)i.extensions[t]=e.extensions[t];if(void 0!==e.lights&&(i.lights=e.lights),void 0!==e.clipping&&(i.clipping=e.clipping),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 ti).fromArray(t)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapRotation&&i.envMapRotation.fromArray(e.envMapRotation),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 ti).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(i.iridescenceMap=n(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=n(e.thicknessMap)),void 0!==e.anisotropyMap&&(i.anisotropyMap=n(e.anisotropyMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Ph.createMaterialFromType(e)}static createMaterialFromType(e){return new{ShadowMaterial:Cc,SpriteMaterial:ho,RawShaderMaterial:wc,ShaderMaterial:Xs,PointsMaterial:Na,MeshPhysicalMaterial:Mc,MeshStandardMaterial:_c,MeshPhongMaterial:Sc,MeshToonMaterial:Ic,MeshNormalMaterial:Bc,MeshLambertMaterial:Tc,MeshDepthMaterial:Rc,MeshDistanceMaterial:Lc,MeshBasicMaterial:rs,MeshMatcapMaterial:Dc,LineDashedMaterial:Pc,LineBasicMaterial:_a,Material:is}[e]}}class Uh{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch(e){return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!=typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Oh extends Bs{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class Fh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new ah(r.manager);s.setPath(r.path),s.setRequestHeader(r.requestHeader),s.setWithCredentials(r.withCredentials),s.load(e,(function(n){try{t(r.parse(JSON.parse(n)))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}parse(e){const t={},n={};function i(e,i){if(void 0!==t[i])return t[i];const r=e.interleavedBuffers[i],s=function(e,t){if(void 0!==n[t])return n[t];const i=e.arrayBuffers[t],r=new Uint32Array(i).buffer;return n[t]=r,r}(e,r.buffer),o=oi(r.type,s),a=new ao(o,r.stride);return a.uuid=r.uuid,t[i]=a,a}const r=e.isInstancedBufferGeometry?new Oh:new Bs,s=e.data.index;if(void 0!==s){const e=oi(s.type,s.array);r.setIndex(new us(e,1))}const o=e.data.attributes;for(const t in o){const n=o[t];let s;if(n.isInterleavedBufferAttribute){const t=i(e.data,n.data);s=new co(t,n.itemSize,n.offset,n.normalized)}else{const e=oi(n.type,n.array);s=new(n.isInstancedBufferAttribute?jo:us)(e,n.itemSize,n.normalized)}void 0!==n.name&&(s.name=n.name),void 0!==n.usage&&s.setUsage(n.usage),r.setAttribute(t,s)}const a=e.data.morphAttributes;if(a)for(const t in a){const n=a[t],s=[];for(let t=0,r=n.length;t<r;t++){const r=n[t];let o;if(r.isInterleavedBufferAttribute){const t=i(e.data,r.data);o=new co(t,r.itemSize,r.offset,r.normalized)}else{const e=oi(r.type,r.array);o=new us(e,r.itemSize,r.normalized)}void 0!==r.name&&(o.name=r.name),s.push(o)}r.morphAttributes[t]=s}e.data.morphTargetsRelative&&(r.morphTargetsRelative=!0);const l=e.data.groups||e.data.drawcalls||e.data.offsets;if(void 0!==l)for(let e=0,t=l.length;e!==t;++e){const t=l[e];r.addGroup(t.start,t.count,t.materialIndex)}const c=e.data.boundingSphere;if(void 0!==c){const e=new Li;void 0!==c.center&&e.fromArray(c.center),r.boundingSphere=new $i(e,c.radius)}return e.name&&(r.name=e.name),e.userData&&(r.userData=e.userData),r}}class kh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=""===this.path?Uh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||s;const o=new ah(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){let s=null;try{s=JSON.parse(n)}catch(t){return void 0!==i&&i(t),void console.error("THREE:ObjectLoader: Can't parse "+e+".",t.message)}const o=s.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())return void 0!==i&&i(new Error("THREE.ObjectLoader: Can't load "+e)),void console.error("THREE.ObjectLoader: Can't load "+e);r.parse(s,t)}),n,i)}async loadAsync(e,t){const n=""===this.path?Uh.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||n;const i=new ah(this.manager);i.setPath(this.path),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials);const r=await i.loadAsync(e,t),s=JSON.parse(r),o=s.metadata;if(void 0===o||void 0===o.type||"geometry"===o.type.toLowerCase())throw new Error("THREE.ObjectLoader: Can't load "+e);return await this.parseAsync(s)}parse(e,t){const n=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=this.parseImages(e.images,(function(){void 0!==t&&t(l)})),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,r,a,o,n),c=this.parseSkeletons(e.skeletons,l);if(this.bindSkeletons(l,c),this.bindLightTargets(l),void 0!==t){let e=!1;for(const t in s)if(s[t].data instanceof HTMLImageElement){e=!0;break}!1===e&&t(l)}return l}async parseAsync(e){const t=this.parseAnimations(e.animations),n=this.parseShapes(e.shapes),i=this.parseGeometries(e.geometries,n),r=await this.parseImagesAsync(e.images),s=this.parseTextures(e.textures,r),o=this.parseMaterials(e.materials,s),a=this.parseObject(e.object,i,o,s,t),l=this.parseSkeletons(e.skeletons,a);return this.bindSkeletons(a,l),this.bindLightTargets(a),a}parseShapes(e){const t={};if(void 0!==e)for(let n=0,i=e.length;n<i;n++){const i=(new Pl).fromJSON(e[n]);t[i.uuid]=i}return t}parseSkeletons(e,t){const n={},i={};if(t.traverse((function(e){e.isBone&&(i[e.uuid]=e)})),void 0!==e)for(let t=0,r=e.length;t<r;t++){const r=(new Vo).fromJSON(e[t],i);n[r.uuid]=r}return n}parseGeometries(e,t){const n={};if(void 0!==e){const i=new Fh;for(let r=0,s=e.length;r<s;r++){let s;const o=e[r];switch(o.type){case"BufferGeometry":case"InstancedBufferGeometry":s=i.parse(o);break;case"Geometry":"THREE"in window&&"LegacyJSONLoader"in THREE?s=(new THREE.LegacyJSONLoader).parse(o,this.resourcePath).geometry:console.error('THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".');break;default:o.type in bc?s=bc[o.type].fromJSON(o,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${o.type}"`)}s.uuid=o.uuid,void 0!==o.name&&(s.name=o.name),void 0!==o.userData&&(s.userData=o.userData),n[o.uuid]=s}}return n}parseMaterials(e,t){const n={},i={};if(void 0!==e){const r=new Ph;r.setTextures(t);for(let t=0,s=e.length;t<s;t++){const s=e[t];void 0===n[s.uuid]&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i}parseAnimations(e){const t={};if(void 0!==e)for(let n=0;n<e.length;n++){const i=e[n],r=$c.parse(i);t[r.uuid]=r}return t}parseImages(e,t){const n=this,i={};let r;function s(e){if("string"==typeof e){const t=e;return function(e){return n.manager.itemStart(e),r.load(e,(function(){n.manager.itemEnd(e)}),void 0,(function(){n.manager.itemError(e),n.manager.itemEnd(e)}))}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(t)?t:n.resourcePath+t)}return e.data?{data:oi(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){const n=new nh(t);r=new hh(n),r.setCrossOrigin(this.crossOrigin);for(let t=0,n=e.length;t<n;t++){const n=e[t],r=n.url;if(Array.isArray(r)){const e=[];for(let t=0,n=r.length;t<n;t++){const n=s(r[t]);null!==n&&(n instanceof HTMLImageElement?e.push(n):e.push(new Go(n.data,n.width,n.height)))}i[n.uuid]=new Ei(e)}else{const e=s(n.url);i[n.uuid]=new Ei(e)}}}return i}async parseImagesAsync(e){const t=this,n={};let i;async function r(e){if("string"==typeof e){const n=e,r=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(n)?n:t.resourcePath+n;return await i.loadAsync(r)}return e.data?{data:oi(e.type,e.data),width:e.width,height:e.height}:null}if(void 0!==e&&e.length>0){i=new hh(this.manager),i.setCrossOrigin(this.crossOrigin);for(let t=0,i=e.length;t<i;t++){const i=e[t],s=i.url;if(Array.isArray(s)){const e=[];for(let t=0,n=s.length;t<n;t++){const n=s[t],i=await r(n);null!==i&&(i instanceof HTMLImageElement?e.push(i):e.push(new Go(i.data,i.width,i.height)))}n[i.uuid]=new Ei(e)}else{const e=await r(i.url);n[i.uuid]=new Ei(e)}}}return n}parseTextures(e,t){function n(e,t){return"number"==typeof e?e:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",e),t[e])}const i={};if(void 0!==e)for(let r=0,s=e.length;r<s;r++){const s=e[r];void 0===s.image&&console.warn('THREE.ObjectLoader: No "image" specified for',s.uuid),void 0===t[s.image]&&console.warn("THREE.ObjectLoader: Undefined image",s.image);const o=t[s.image],a=o.data;let l;Array.isArray(a)?(l=new no,6===a.length&&(l.needsUpdate=!0)):(l=a&&a.data?new Go:new Ci,a&&(l.needsUpdate=!0)),l.source=o,l.uuid=s.uuid,void 0!==s.name&&(l.name=s.name),void 0!==s.mapping&&(l.mapping=n(s.mapping,Nh)),void 0!==s.channel&&(l.channel=s.channel),void 0!==s.offset&&l.offset.fromArray(s.offset),void 0!==s.repeat&&l.repeat.fromArray(s.repeat),void 0!==s.center&&l.center.fromArray(s.center),void 0!==s.rotation&&(l.rotation=s.rotation),void 0!==s.wrap&&(l.wrapS=n(s.wrap[0],Qh),l.wrapT=n(s.wrap[1],Qh)),void 0!==s.format&&(l.format=s.format),void 0!==s.internalFormat&&(l.internalFormat=s.internalFormat),void 0!==s.type&&(l.type=s.type),void 0!==s.colorSpace&&(l.colorSpace=s.colorSpace),void 0!==s.minFilter&&(l.minFilter=n(s.minFilter,Gh)),void 0!==s.magFilter&&(l.magFilter=n(s.magFilter,Gh)),void 0!==s.anisotropy&&(l.anisotropy=s.anisotropy),void 0!==s.flipY&&(l.flipY=s.flipY),void 0!==s.generateMipmaps&&(l.generateMipmaps=s.generateMipmaps),void 0!==s.premultiplyAlpha&&(l.premultiplyAlpha=s.premultiplyAlpha),void 0!==s.unpackAlignment&&(l.unpackAlignment=s.unpackAlignment),void 0!==s.compareFunction&&(l.compareFunction=s.compareFunction),void 0!==s.userData&&(l.userData=s.userData),i[s.uuid]=l}return i}parseObject(e,t,n,i,r){let s,o,a;function l(e){return void 0===t[e]&&console.warn("THREE.ObjectLoader: Undefined geometry",e),t[e]}function c(e){if(void 0!==e){if(Array.isArray(e)){const t=[];for(let i=0,r=e.length;i<r;i++){const r=e[i];void 0===n[r]&&console.warn("THREE.ObjectLoader: Undefined material",r),t.push(n[r])}return t}return void 0===n[e]&&console.warn("THREE.ObjectLoader: Undefined material",e),n[e]}}function h(e){return void 0===i[e]&&console.warn("THREE.ObjectLoader: Undefined texture",e),i[e]}switch(e.type){case"Scene":s=new oo,void 0!==e.background&&(Number.isInteger(e.background)?s.background=new es(e.background):s.background=h(e.background)),void 0!==e.environment&&(s.environment=h(e.environment)),void 0!==e.fog&&("Fog"===e.fog.type?s.fog=new so(e.fog.color,e.fog.near,e.fog.far):"FogExp2"===e.fog.type&&(s.fog=new ro(e.fog.color,e.fog.density)),""!==e.fog.name&&(s.fog.name=e.fog.name)),void 0!==e.backgroundBlurriness&&(s.backgroundBlurriness=e.backgroundBlurriness),void 0!==e.backgroundIntensity&&(s.backgroundIntensity=e.backgroundIntensity),void 0!==e.backgroundRotation&&s.backgroundRotation.fromArray(e.backgroundRotation),void 0!==e.environmentIntensity&&(s.environmentIntensity=e.environmentIntensity),void 0!==e.environmentRotation&&s.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":s=new $s(e.fov,e.aspect,e.near,e.far),void 0!==e.focus&&(s.focus=e.focus),void 0!==e.zoom&&(s.zoom=e.zoom),void 0!==e.filmGauge&&(s.filmGauge=e.filmGauge),void 0!==e.filmOffset&&(s.filmOffset=e.filmOffset),void 0!==e.view&&(s.view=Object.assign({},e.view));break;case"OrthographicCamera":s=new Sh(e.left,e.right,e.top,e.bottom,e.near,e.far),void 0!==e.zoom&&(s.zoom=e.zoom),void 0!==e.view&&(s.view=Object.assign({},e.view));break;case"AmbientLight":s=new Th(e.color,e.intensity);break;case"DirectionalLight":s=new Bh(e.color,e.intensity),s.target=e.target||"";break;case"PointLight":s=new Mh(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":s=new Rh(e.color,e.intensity,e.width,e.height);break;case"SpotLight":s=new xh(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay),s.target=e.target||"";break;case"HemisphereLight":s=new fh(e.color,e.groundColor,e.intensity);break;case"LightProbe":s=(new Dh).fromJSON(e);break;case"SkinnedMesh":o=l(e.geometry),a=c(e.material),s=new No(o,a),void 0!==e.bindMode&&(s.bindMode=e.bindMode),void 0!==e.bindMatrix&&s.bindMatrix.fromArray(e.bindMatrix),void 0!==e.skeleton&&(s.skeleton=e.skeleton);break;case"Mesh":o=l(e.geometry),a=c(e.material),s=new Gs(o,a);break;case"InstancedMesh":o=l(e.geometry),a=c(e.material);const t=e.count,n=e.instanceMatrix,i=e.instanceColor;s=new $o(o,a,t),s.instanceMatrix=new jo(new Float32Array(n.array),16),void 0!==i&&(s.instanceColor=new jo(new Float32Array(i.array),i.itemSize));break;case"BatchedMesh":o=l(e.geometry),a=c(e.material),s=new wa(e.maxInstanceCount,e.maxVertexCount,e.maxIndexCount,a),s.geometry=o,s.perObjectFrustumCulled=e.perObjectFrustumCulled,s.sortObjects=e.sortObjects,s._drawRanges=e.drawRanges,s._reservedRanges=e.reservedRanges,s._visibility=e.visibility,s._active=e.active,s._bounds=e.bounds.map((e=>{const t=new Ui;t.min.fromArray(e.boxMin),t.max.fromArray(e.boxMax);const n=new $i;return n.radius=e.sphereRadius,n.center.fromArray(e.sphereCenter),{boxInitialized:e.boxInitialized,box:t,sphereInitialized:e.sphereInitialized,sphere:n}})),s._maxInstanceCount=e.maxInstanceCount,s._maxVertexCount=e.maxVertexCount,s._maxIndexCount=e.maxIndexCount,s._geometryInitialized=e.geometryInitialized,s._geometryCount=e.geometryCount,s._matricesTexture=h(e.matricesTexture.uuid),void 0!==e.colorsTexture&&(s._colorsTexture=h(e.colorsTexture.uuid));break;case"LOD":s=new Bo;break;case"Line":s=new Da(l(e.geometry),c(e.material));break;case"LineLoop":s=new ka(l(e.geometry),c(e.material));break;case"LineSegments":s=new Fa(l(e.geometry),c(e.material));break;case"PointCloud":case"Points":s=new Va(l(e.geometry),c(e.material));break;case"Sprite":s=new _o(c(e.material));break;case"Group":s=new Wa;break;case"Bone":s=new Qo;break;default:s=new Ur}if(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.up&&s.up.fromArray(e.up),void 0!==e.castShadow&&(s.castShadow=e.castShadow),void 0!==e.receiveShadow&&(s.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.intensity&&(s.shadow.intensity=e.shadow.intensity),void 0!==e.shadow.bias&&(s.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(s.shadow.normalBias=e.shadow.normalBias),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.userData&&(s.userData=e.userData),void 0!==e.layers&&(s.layers.mask=e.layers),void 0!==e.children){const o=e.children;for(let e=0;e<o.length;e++)s.add(this.parseObject(o[e],t,n,i,r))}if(void 0!==e.animations){const t=e.animations;for(let e=0;e<t.length;e++){const n=t[e];s.animations.push(r[n])}}if("LOD"===e.type){void 0!==e.autoUpdate&&(s.autoUpdate=e.autoUpdate);const t=e.levels;for(let e=0;e<t.length;e++){const n=t[e],i=s.getObjectByProperty("uuid",n.object);void 0!==i&&s.addLevel(i,n.distance,n.hysteresis)}}return s}bindSkeletons(e,t){0!==Object.keys(t).length&&e.traverse((function(e){if(!0===e.isSkinnedMesh&&void 0!==e.skeleton){const n=t[e.skeleton];void 0===n?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",e.skeleton):e.bind(n,e.bindMatrix)}}))}bindLightTargets(e){e.traverse((function(t){if(t.isDirectionalLight||t.isSpotLight){const n=t.target,i=e.getObjectByProperty("uuid",n);t.target=void 0!==i?i:new Ur}}))}}const Nh={UVMapping:ue,CubeReflectionMapping:pe,CubeRefractionMapping:Ae,EquirectangularReflectionMapping:fe,EquirectangularRefractionMapping:me,CubeUVReflectionMapping:ge},Qh={RepeatWrapping:ve,ClampToEdgeWrapping:ye,MirroredRepeatWrapping:Ee},Gh={NearestFilter:xe,NearestMipmapNearestFilter:be,NearestMipmapLinearFilter:we,LinearFilter:Me,LinearMipmapNearestFilter:Se,LinearMipmapLinearFilter:Be};class zh extends rh{constructor(e){super(e),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,n,i){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,s=th.get(e);if(void 0!==s)return r.manager.itemStart(e),s.then?void s.then((n=>{t&&t(n),r.manager.itemEnd(e)})).catch((e=>{i&&i(e)})):(setTimeout((function(){t&&t(s),r.manager.itemEnd(e)}),0),s);const o={};o.credentials="anonymous"===this.crossOrigin?"same-origin":"include",o.headers=this.requestHeader;const a=fetch(e,o).then((function(e){return e.blob()})).then((function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))})).then((function(n){return th.add(e,n),t&&t(n),r.manager.itemEnd(e),n})).catch((function(t){i&&i(t),th.remove(e),r.manager.itemError(e),r.manager.itemEnd(e)}));th.add(e,a),r.manager.itemStart(e)}}let Hh;class Vh{static getContext(){return void 0===Hh&&(Hh=new(window.AudioContext||window.webkitAudioContext)),Hh}static setContext(e){Hh=e}}class jh extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=new ah(this.manager);function o(t){i?i(t):console.error(t),r.manager.itemError(e)}s.setResponseType("arraybuffer"),s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(e){try{const n=e.slice(0);Vh.getContext().decodeAudioData(n,(function(e){t(e)})).catch(o)}catch(e){o(e)}}),n,i)}}const Wh=new lr,qh=new lr,Xh=new lr;class Yh{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new $s,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new $s,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Xh.copy(e.projectionMatrix);const n=t.eyeSep/2,i=n*t.near/t.focus,r=t.near*Math.tan(Wn*t.fov*.5)/t.zoom;let s,o;qh.elements[12]=-n,Wh.elements[12]=n,s=-r*t.aspect+i,o=r*t.aspect+i,Xh.elements[0]=2*t.near/(o-s),Xh.elements[8]=(o+s)/(o-s),this.cameraL.projectionMatrix.copy(Xh),s=-r*t.aspect-i,o=r*t.aspect-i,Xh.elements[0]=2*t.near/(o-s),Xh.elements[8]=(o+s)/(o-s),this.cameraR.projectionMatrix.copy(Xh)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(qh),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Wh)}}class Jh extends $s{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Kh{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Zh(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=Zh();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function Zh(){return performance.now()}const $h=new Li,ed=new Ri,td=new Li,nd=new Li;class id extends Ur{constructor(){super(),this.type="AudioListener",this.context=Vh.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Kh}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose($h,ed,td),nd.set(0,0,-1).applyQuaternion(ed),t.positionX){const e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime($h.x,e),t.positionY.linearRampToValueAtTime($h.y,e),t.positionZ.linearRampToValueAtTime($h.z,e),t.forwardX.linearRampToValueAtTime(nd.x,e),t.forwardY.linearRampToValueAtTime(nd.y,e),t.forwardZ.linearRampToValueAtTime(nd.z,e),t.upX.linearRampToValueAtTime(n.x,e),t.upY.linearRampToValueAtTime(n.y,e),t.upZ.linearRampToValueAtTime(n.z,e)}else t.setPosition($h.x,$h.y,$h.z),t.setOrientation(nd.x,nd.y,nd.z,n.x,n.y,n.z)}}class rd extends Ur{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(!0===this.isPlaying)return void console.warn("THREE.Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(e=0){if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,!0===this.isPlaying&&void 0!==this.source.detune&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(!1!==this.hasPlaybackControl)return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(!1!==this.hasPlaybackControl)return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}copy(e,t){return super.copy(e,t),"buffer"!==e.sourceType?(console.warn("THREE.Audio: Audio source type cannot be copied."),this):(this.autoplay=e.autoplay,this.buffer=e.buffer,this.detune=e.detune,this.loop=e.loop,this.loopStart=e.loopStart,this.loopEnd=e.loopEnd,this.offset=e.offset,this.duration=e.duration,this.playbackRate=e.playbackRate,this.hasPlaybackControl=e.hasPlaybackControl,this.sourceType=e.sourceType,this.filters=e.filters.slice(),this)}clone(e){return new this.constructor(this.listener).copy(this,e)}}const sd=new Li,od=new Ri,ad=new Li,ld=new Li;class cd extends rd{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),!0===this.hasPlaybackControl&&!1===this.isPlaying)return;this.matrixWorld.decompose(sd,od,ad),ld.set(0,0,1).applyQuaternion(od);const t=this.panner;if(t.positionX){const e=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(sd.x,e),t.positionY.linearRampToValueAtTime(sd.y,e),t.positionZ.linearRampToValueAtTime(sd.z,e),t.orientationX.linearRampToValueAtTime(ld.x,e),t.orientationY.linearRampToValueAtTime(ld.y,e),t.orientationZ.linearRampToValueAtTime(ld.z,e)}else t.setPosition(sd.x,sd.y,sd.z),t.setOrientation(ld.x,ld.y,ld.z)}}class hd{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n<t.length;n++)e+=t[n];return e/t.length}}class dd{constructor(e,t,n){let i,r,s;switch(this.binding=e,this.valueSize=n,t){case"quaternion":i=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*n),this._workIndex=5;break;case"string":case"bool":i=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*n);break;default:i=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*n)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,r=e*i+i;let s=this.cumulativeWeight;if(0===s){for(let e=0;e!==i;++e)n[r+e]=n[e];s=t}else{s+=t;const e=t/s;this._mixBufferRegion(n,r,0,e,i)}this.cumulativeWeight=s}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const e=t*this._origIndex;this._mixBufferRegion(n,i,e,1-r,t)}s>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let e=t,r=t+t;e!==r;++e)if(n[e]!==n[e+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let e=n,r=i;e!==r;++e)t[e]=t[i+e%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,r){if(i>=.5)for(let i=0;i!==r;++i)e[t+i]=e[n+i]}_slerp(e,t,n,i){Ri.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const s=this._workIndex*r;Ri.multiplyQuaternionsFlat(e,s,e,t,e,n),Ri.slerpFlat(e,t,e,t,e,s,i)}_lerp(e,t,n,i,r){const s=1-i;for(let o=0;o!==r;++o){const r=t+o;e[r]=e[r]*s+e[n+o]*i}}_lerpAdditive(e,t,n,i,r){for(let s=0;s!==r;++s){const r=t+s;e[r]=e[r]+e[n+s]*i}}}const ud="\\[\\]\\.:\\/",pd=new RegExp("["+ud+"]","g"),Ad="[^"+ud+"]",fd="[^"+ud.replace("\\.","")+"]",md=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Ad)+/(WCOD+)?/.source.replace("WCOD",fd)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Ad)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Ad)+"$"),gd=["material","materials","bones","map"];class vd{constructor(e,t,n){this.path=t,this.parsedPath=n||vd.parseTrackName(t),this.node=vd.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new vd.Composite(e,t,n):new vd(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(pd,"")}static parseTrackName(e){const t=md.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==gd.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i<e.length;i++){const r=e[i];if(r.name===t||r.uuid===t)return r;const s=n(r.children);if(s)return s}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let r=t.propertyIndex;if(e||(e=vd.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(n){let i=t.objectIndex;switch(n){case"materials":if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);e=e.material.materials;break;case"bones":if(!e.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);e=e.skeleton.bones;for(let t=0;t<e.length;t++)if(e[t].name===i){i=t;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!e.material.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);e=e.material.map;break;default:if(void 0===e[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);e=e[n]}if(void 0!==i){if(void 0===e[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);e=e[i]}}const s=e[i];if(void 0===s){const n=t.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",e)}let o=this.Versioning.None;this.targetObject=e,void 0!==e.needsUpdate?o=this.Versioning.NeedsUpdate:void 0!==e.matrixWorldNeedsUpdate&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){if(!e.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!e.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==e.morphTargetDictionary[r]&&(r=e.morphTargetDictionary[r])}a=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(a=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(a=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}vd.Composite=class{constructor(e,t,n){const i=n||vd.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},vd.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},vd.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},vd.prototype.GetterByBindingType=[vd.prototype._getValue_direct,vd.prototype._getValue_array,vd.prototype._getValue_arrayElement,vd.prototype._getValue_toArray],vd.prototype.SetterByBindingTypeAndVersioning=[[vd.prototype._setValue_direct,vd.prototype._setValue_direct_setNeedsUpdate,vd.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[vd.prototype._setValue_array,vd.prototype._setValue_array_setNeedsUpdate,vd.prototype._setValue_array_setMatrixWorldNeedsUpdate],[vd.prototype._setValue_arrayElement,vd.prototype._setValue_arrayElement_setNeedsUpdate,vd.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[vd.prototype._setValue_fromArray,vd.prototype._setValue_fromArray_setNeedsUpdate,vd.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class yd{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Xn(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,n=this._paths,i=this._parsedPaths,r=this._bindings,s=r.length;let o,a=e.length,l=this.nCachedObjects_;for(let c=0,h=arguments.length;c!==h;++c){const h=arguments[c],d=h.uuid;let u=t[d];if(void 0===u){u=a++,t[d]=u,e.push(h);for(let e=0,t=s;e!==t;++e)r[e].push(new vd(h,n[e],i[e]))}else if(u<l){o=e[u];const a=--l,c=e[a];t[c.uuid]=u,e[u]=c,t[d]=a,e[a]=h;for(let e=0,t=s;e!==t;++e){const t=r[e],s=t[a];let o=t[u];t[u]=s,void 0===o&&(o=new vd(h,n[e],i[e])),t[a]=o}}else e[u]!==o&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=l}remove(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_;for(let s=0,o=arguments.length;s!==o;++s){const o=arguments[s],a=o.uuid,l=t[a];if(void 0!==l&&l>=r){const s=r++,c=e[s];t[c.uuid]=l,e[l]=c,t[a]=s,e[s]=o;for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[s],r=t[l];t[l]=i,t[s]=r}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,s=e.length;for(let o=0,a=arguments.length;o!==a;++o){const a=arguments[o].uuid,l=t[a];if(void 0!==l)if(delete t[a],l<r){const o=--r,a=e[o],c=--s,h=e[c];t[a.uuid]=l,e[l]=a,t[h.uuid]=o,e[o]=h,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[o],r=t[c];t[l]=i,t[o]=r,t.pop()}}else{const r=--s,o=e[r];r>0&&(t[o.uuid]=l),e[l]=o,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e];t[l]=t[r],t.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(void 0!==i)return r[i];const s=this._paths,o=this._parsedPaths,a=this._objects,l=a.length,c=this.nCachedObjects_,h=new Array(l);i=r.length,n[e]=i,s.push(e),o.push(t),r.push(h);for(let n=c,i=a.length;n!==i;++n){const i=a[n];h[n]=new vd(i,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length-1,a=s[o];t[e[o]]=n,s[n]=a,s.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}}class Ed{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,s=r.length,o=new Array(s),a={endingStart:Qt,endingEnd:Qt};for(let e=0;e!==s;++e){const t=r[e].createInterpolant(null);o[e]=t,t.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Ut,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){const n=this._clip.duration,i=e._clip.duration,r=i/n,s=n/i;e.warp(1,r,t),this.warp(s,1,t)}return this}crossFadeTo(e,t,n){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,s=this.timeScale;let o=this._timeScaleInterpolant;null===o&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,a[1]=r+n,l[0]=e/s,l[1]=t/s,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled)return void this._updateWeight(e);const r=this._startTime;if(null!==r){const i=(e-r)*n;i<0||0===n?t=0:(this._startTime=null,t=n*i)}t*=this._updateTimeScale(e);const s=this._updateTime(t),o=this._updateWeight(e);if(o>0){const e=this._interpolants,t=this._propertyBindings;if(this.blendMode===Vt)for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(s),t[n].accumulateAdditive(o);else for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(s),t[n].accumulate(i,o)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;null!==n&&(t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const s=n===Ot;if(0===e)return-1===r||!s||1&~r?i:t-i;if(n===Pt){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),i>=t||i<0){const n=Math.floor(i/t);i-=t*n,r+=Math.abs(n);const o=this.repetitions-r;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===o){const t=e<0;this._setEndings(t,!t,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this.time=i;if(s&&!(1&~r))return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Gt,i.endingEnd=Gt):(i.endingStart=e?this.zeroSlopeAtStart?Gt:Qt:zt,i.endingEnd=t?this.zeroSlopeAtEnd?Gt:Qt:zt)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let s=this._weightInterpolant;null===s&&(s=i._lendControlInterpolant(),this._weightInterpolant=s);const o=s.parameterPositions,a=s.sampleValues;return o[0]=r,a[0]=t,o[1]=r+e,a[1]=n,this}}const xd=new Float32Array(1);class bd extends Hn{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,s=e._propertyBindings,o=e._interpolants,a=n.uuid,l=this._bindingsByRootAndName;let c=l[a];void 0===c&&(c={},l[a]=c);for(let e=0;e!==r;++e){const r=i[e],l=r.name;let h=c[l];if(void 0!==h)++h.referenceCount,s[e]=h;else{if(h=s[e],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,a,l));continue}const i=t&&t._propertyBindings[e].binding.parsedPath;h=new dd(vd.create(n,l,i),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,a,l),s[e]=h}o[e].resultBuffer=h.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return null!==t&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,r=this._actionsByClip;let s=r[t];if(void 0===s)s={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=s;else{const t=s.knownActions;e._byClipCacheIndex=t.length,t.push(e)}e._cacheIndex=i.length,i.push(e),s.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const r=e._clip.uuid,s=this._actionsByClip,o=s[r],a=o.knownActions,l=a[a.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,a[c]=l,a.pop(),e._byClipCacheIndex=null,delete o.actionByRoot[(e._localRoot||this._root).uuid],0===a.length&&delete s[r],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0==--n.referenceCount&&this._removeInactiveBinding(n)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,r=this._bindings;let s=i[t];void 0===s&&(s={},i[t]=s),s[n]=e,e._cacheIndex=r.length,r.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,s=this._bindingsByRootAndName,o=s[i],a=t[t.length-1],l=e._cacheIndex;a._cacheIndex=l,t[l]=a,t.pop(),delete o[r],0===Object.keys(o).length&&delete s[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return void 0===n&&(n=new Hc(new Float32Array(2),new Float32Array(2),1,xd),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r}clipAction(e,t,n){const i=t||this._root,r=i.uuid;let s="string"==typeof e?$c.findByName(i,e):e;const o=null!==s?s.uuid:e,a=this._actionsByClip[o];let l=null;if(void 0===n&&(n=null!==s?s.blendMode:Ht),void 0!==a){const e=a.actionByRoot[r];if(void 0!==e&&e.blendMode===n)return e;l=a.knownActions[0],null===s&&(s=l._clip)}if(null===s)return null;const c=new Ed(this,s,t,n);return this._bindAction(c,l),this._addInactiveAction(c,o,r),c}existingAction(e,t){const n=t||this._root,i=n.uuid,r="string"==typeof e?$c.findByName(n,e):e,s=r?r.uuid:e,o=this._actionsByClip[s];return void 0!==o&&o.actionByRoot[i]||null}stopAllAction(){const e=this._actions;for(let t=this._nActiveActions-1;t>=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),s=this._accuIndex^=1;for(let o=0;o!==n;++o)t[o]._update(i,e,r,s);const o=this._bindings,a=this._nActiveBindings;for(let e=0;e!==a;++e)o[e].apply(s);return this}setTime(e){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(void 0!==r){const e=r.knownActions;for(let n=0,i=e.length;n!==i;++n){const i=e[n];this._deactivateAction(i);const r=i._cacheIndex,s=t[t.length-1];i._cacheIndex=null,i._byClipCacheIndex=null,s._cacheIndex=r,t[r]=s,t.pop(),this._removeInactiveBindingsForAction(i)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const e in n){const i=n[e].actionByRoot[t];void 0!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}const i=this._bindingsByRootAndName[t];if(void 0!==i)for(const e in i){const t=i[e];t.restoreOriginalState(),this._removeInactiveBinding(t)}}uncacheAction(e,t){const n=this.existingAction(e,t);null!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class Cd{constructor(e){this.value=e}clone(){return new Cd(void 0===this.value.clone?this.value:this.value.clone())}}let wd=0;class _d extends Hn{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:wd++}),this.name="",this.usage=Tn,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let e=0,n=t.length;e<n;e++){const n=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0;e<n.length;e++)this.uniforms.push(n[e].clone())}return this}clone(){return(new this.constructor).copy(this)}}class Md extends ao{constructor(e,t,n=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class Sd{constructor(e,t,n,i,r){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.version=0}set needsUpdate(e){!0===e&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Id=new lr;class Bd{constructor(e,t,n=0,i=1/0){this.ray=new ar(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new yr,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Id.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Id),this}intersectObject(e,t=!0,n=[]){return Rd(e,this,n,t),n.sort(Td),n}intersectObjects(e,t=!0,n=[]){for(let i=0,r=e.length;i<r;i++)Rd(e[i],this,n,t);return n.sort(Td),n}}function Td(e,t){return e.distance-t.distance}function Rd(e,t,n,i){let r=!0;if(e.layers.test(t.layers)&&!1===e.raycast(t,n)&&(r=!1),!0===r&&!0===i){const i=e.children;for(let e=0,r=i.length;e<r;e++)Rd(i[e],t,n,!0)}}class Ld{constructor(e=1,t=0,n=0){return this.radius=e,this.phi=t,this.theta=n,this}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){const e=1e-6;return this.phi=Yn(this.phi,e,Math.PI-e),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Yn(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class Dd{constructor(e=1,t=0,n=0){return this.radius=e,this.theta=t,this.y=n,this}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return(new this.constructor).copy(this)}}class Pd{constructor(e,t,n,i){Pd.prototype.isMatrix2=!0,this.elements=[1,0,0,1],void 0!==e&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e,t=0){for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}const Ud=new ti;class Od{constructor(e=new ti(1/0,1/0),t=new ti(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Ud.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.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.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ud).distanceTo(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}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Fd=new Li,kd=new Li;class Nd{constructor(e=new Li,t=new Li){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){Fd.subVectors(e,this.start),kd.subVectors(this.end,this.start);const n=kd.dot(kd);let i=kd.dot(Fd)/n;return t&&(i=Yn(i,0,1)),i}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const Qd=new Li;class Gd extends Ur{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new Bs,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<n;e++,t++){const r=e/n*Math.PI*2,s=t/n*Math.PI*2;i.push(Math.cos(r),Math.sin(r),1,Math.cos(s),Math.sin(s),1)}n.setAttribute("position",new xs(i,3));const r=new _a({fog:!1,toneMapped:!1});this.cone=new Fa(n,r),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),Qd.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Qd),void 0!==this.color?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const zd=new Li,Hd=new lr,Vd=new lr;class jd extends Fa{constructor(e){const t=Wd(e),n=new Bs,i=[],r=[],s=new es(0,0,1),o=new es(0,1,0);for(let e=0;e<t.length;e++){const n=t[e];n.parent&&n.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(s.r,s.g,s.b),r.push(o.r,o.g,o.b))}n.setAttribute("position",new xs(i,3)),n.setAttribute("color",new xs(r,3)),super(n,new _a({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,n=this.geometry,i=n.getAttribute("position");Vd.copy(this.root.matrixWorld).invert();for(let e=0,n=0;e<t.length;e++){const r=t[e];r.parent&&r.parent.isBone&&(Hd.multiplyMatrices(Vd,r.matrixWorld),zd.setFromMatrixPosition(Hd),i.setXYZ(n,zd.x,zd.y,zd.z),Hd.multiplyMatrices(Vd,r.parent.matrixWorld),zd.setFromMatrixPosition(Hd),i.setXYZ(n+1,zd.x,zd.y,zd.z),n+=2)}n.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function Wd(e){const t=[];!0===e.isBone&&t.push(e);for(let n=0;n<e.children.length;n++)t.push.apply(t,Wd(e.children[n]));return t}class qd extends Gs{constructor(e,t,n){super(new fc(t,4,2),new rs({wireframe:!0,fog:!1,toneMapped:!1})),this.light=e,this.color=n,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),void 0!==this.color?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const Xd=new Li,Yd=new es,Jd=new es;class Kd extends Ur{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="HemisphereLightHelper";const i=new dc(t);i.rotateY(.5*Math.PI),this.material=new rs({wireframe:!0,fog:!1,toneMapped:!1}),void 0===this.color&&(this.material.vertexColors=!0);const r=i.getAttribute("position"),s=new Float32Array(3*r.count);i.setAttribute("color",new us(s,3)),this.add(new Gs(i,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(void 0!==this.color)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");Yd.copy(this.light.color),Jd.copy(this.light.groundColor);for(let e=0,n=t.count;e<n;e++){const i=e<n/2?Yd:Jd;t.setXYZ(e,i.r,i.g,i.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(Xd.setFromMatrixPosition(this.light.matrixWorld).negate())}}class Zd extends Fa{constructor(e=10,t=10,n=4473924,i=8947848){n=new es(n),i=new es(i);const r=t/2,s=e/t,o=e/2,a=[],l=[];for(let e=0,c=0,h=-o;e<=t;e++,h+=s){a.push(-o,0,h,o,0,h),a.push(h,0,-o,h,0,o);const t=e===r?n:i;t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3,t.toArray(l,c),c+=3}const c=new Bs;c.setAttribute("position",new xs(a,3)),c.setAttribute("color",new xs(l,3)),super(c,new _a({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class $d extends Fa{constructor(e=10,t=16,n=8,i=64,r=4473924,s=8947848){r=new es(r),s=new es(s);const o=[],a=[];if(t>1)for(let n=0;n<t;n++){const i=n/t*(2*Math.PI),l=Math.sin(i)*e,c=Math.cos(i)*e;o.push(0,0,0),o.push(l,0,c);const h=1&n?r:s;a.push(h.r,h.g,h.b),a.push(h.r,h.g,h.b)}for(let t=0;t<n;t++){const l=1&t?r:s,c=e-e/n*t;for(let e=0;e<i;e++){let t=e/i*(2*Math.PI),n=Math.sin(t)*c,r=Math.cos(t)*c;o.push(n,0,r),a.push(l.r,l.g,l.b),t=(e+1)/i*(2*Math.PI),n=Math.sin(t)*c,r=Math.cos(t)*c,o.push(n,0,r),a.push(l.r,l.g,l.b)}}const l=new Bs;l.setAttribute("position",new xs(o,3)),l.setAttribute("color",new xs(a,3)),super(l,new _a({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const eu=new Li,tu=new Li,nu=new Li;class iu extends Ur{constructor(e,t,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="DirectionalLightHelper",void 0===t&&(t=1);let i=new Bs;i.setAttribute("position",new xs([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const r=new _a({fog:!1,toneMapped:!1});this.lightPlane=new Da(i,r),this.add(this.lightPlane),i=new Bs,i.setAttribute("position",new xs([0,0,0,0,0,1],3)),this.targetLine=new Da(i,r),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),eu.setFromMatrixPosition(this.light.matrixWorld),tu.setFromMatrixPosition(this.light.target.matrixWorld),nu.subVectors(tu,eu),this.lightPlane.lookAt(tu),void 0!==this.color?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(tu),this.targetLine.scale.z=nu.length()}}const ru=new Li,su=new Ys;class ou extends Fa{constructor(e){const t=new Bs,n=new _a({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],r=[],s={};function o(e,t){a(e),a(t)}function a(e){i.push(0,0,0),r.push(0,0,0),void 0===s[e]&&(s[e]=[]),s[e].push(i.length/3-1)}o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4"),t.setAttribute("position",new xs(i,3)),t.setAttribute("color",new xs(r,3)),super(t,n),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update();const l=new es(16755200),c=new es(16711680),h=new es(43775),d=new es(16777215),u=new es(3355443);this.setColors(l,c,h,d,u)}setColors(e,t,n,i,r){const s=this.geometry.getAttribute("color");s.setXYZ(0,e.r,e.g,e.b),s.setXYZ(1,e.r,e.g,e.b),s.setXYZ(2,e.r,e.g,e.b),s.setXYZ(3,e.r,e.g,e.b),s.setXYZ(4,e.r,e.g,e.b),s.setXYZ(5,e.r,e.g,e.b),s.setXYZ(6,e.r,e.g,e.b),s.setXYZ(7,e.r,e.g,e.b),s.setXYZ(8,e.r,e.g,e.b),s.setXYZ(9,e.r,e.g,e.b),s.setXYZ(10,e.r,e.g,e.b),s.setXYZ(11,e.r,e.g,e.b),s.setXYZ(12,e.r,e.g,e.b),s.setXYZ(13,e.r,e.g,e.b),s.setXYZ(14,e.r,e.g,e.b),s.setXYZ(15,e.r,e.g,e.b),s.setXYZ(16,e.r,e.g,e.b),s.setXYZ(17,e.r,e.g,e.b),s.setXYZ(18,e.r,e.g,e.b),s.setXYZ(19,e.r,e.g,e.b),s.setXYZ(20,e.r,e.g,e.b),s.setXYZ(21,e.r,e.g,e.b),s.setXYZ(22,e.r,e.g,e.b),s.setXYZ(23,e.r,e.g,e.b),s.setXYZ(24,t.r,t.g,t.b),s.setXYZ(25,t.r,t.g,t.b),s.setXYZ(26,t.r,t.g,t.b),s.setXYZ(27,t.r,t.g,t.b),s.setXYZ(28,t.r,t.g,t.b),s.setXYZ(29,t.r,t.g,t.b),s.setXYZ(30,t.r,t.g,t.b),s.setXYZ(31,t.r,t.g,t.b),s.setXYZ(32,n.r,n.g,n.b),s.setXYZ(33,n.r,n.g,n.b),s.setXYZ(34,n.r,n.g,n.b),s.setXYZ(35,n.r,n.g,n.b),s.setXYZ(36,n.r,n.g,n.b),s.setXYZ(37,n.r,n.g,n.b),s.setXYZ(38,i.r,i.g,i.b),s.setXYZ(39,i.r,i.g,i.b),s.setXYZ(40,r.r,r.g,r.b),s.setXYZ(41,r.r,r.g,r.b),s.setXYZ(42,r.r,r.g,r.b),s.setXYZ(43,r.r,r.g,r.b),s.setXYZ(44,r.r,r.g,r.b),s.setXYZ(45,r.r,r.g,r.b),s.setXYZ(46,r.r,r.g,r.b),s.setXYZ(47,r.r,r.g,r.b),s.setXYZ(48,r.r,r.g,r.b),s.setXYZ(49,r.r,r.g,r.b),s.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap;su.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),au("c",t,e,su,0,0,-1),au("t",t,e,su,0,0,1),au("n1",t,e,su,-1,-1,-1),au("n2",t,e,su,1,-1,-1),au("n3",t,e,su,-1,1,-1),au("n4",t,e,su,1,1,-1),au("f1",t,e,su,-1,-1,1),au("f2",t,e,su,1,-1,1),au("f3",t,e,su,-1,1,1),au("f4",t,e,su,1,1,1),au("u1",t,e,su,.7,1.1,-1),au("u2",t,e,su,-.7,1.1,-1),au("u3",t,e,su,0,2,-1),au("cf1",t,e,su,-1,0,1),au("cf2",t,e,su,1,0,1),au("cf3",t,e,su,0,-1,1),au("cf4",t,e,su,0,1,1),au("cn1",t,e,su,-1,0,-1),au("cn2",t,e,su,1,0,-1),au("cn3",t,e,su,0,-1,-1),au("cn4",t,e,su,0,1,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function au(e,t,n,i,r,s,o){ru.set(r,s,o).unproject(i);const a=t[e];if(void 0!==a){const e=n.getAttribute("position");for(let t=0,n=a.length;t<n;t++)e.setXYZ(a[t],ru.x,ru.y,ru.z)}}const lu=new Ui;class cu extends Fa{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new Bs;r.setIndex(new us(n,1)),r.setAttribute("position",new us(i,3)),super(r,new _a({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(void 0!==e&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),void 0!==this.object&&lu.setFromObject(this.object),lu.isEmpty())return;const t=lu.min,n=lu.max,i=this.geometry.attributes.position,r=i.array;r[0]=n.x,r[1]=n.y,r[2]=n.z,r[3]=t.x,r[4]=n.y,r[5]=n.z,r[6]=t.x,r[7]=t.y,r[8]=n.z,r[9]=n.x,r[10]=t.y,r[11]=n.z,r[12]=n.x,r[13]=n.y,r[14]=t.z,r[15]=t.x,r[16]=n.y,r[17]=t.z,r[18]=t.x,r[19]=t.y,r[20]=t.z,r[21]=n.x,r[22]=t.y,r[23]=t.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class hu extends Fa{constructor(e,t=16776960){const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Bs;i.setIndex(new us(n,1)),i.setAttribute("position",new xs([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new _a({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class du extends Da{constructor(e,t=1,n=16776960){const i=n,r=new Bs;r.setAttribute("position",new xs([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),r.computeBoundingSphere(),super(r,new _a({color:i,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const s=new Bs;s.setAttribute("position",new xs([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),s.computeBoundingSphere(),this.add(new Gs(s,new rs({color:i,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const uu=new Li;let pu,Au;class fu extends Ur{constructor(e=new Li(0,0,1),t=new Li(0,0,0),n=1,i=16776960,r=.2*n,s=.2*r){super(),this.type="ArrowHelper",void 0===pu&&(pu=new Bs,pu.setAttribute("position",new xs([0,0,0,0,1,0],3)),Au=new _l(0,.5,1,5,1),Au.translate(0,-.5,0)),this.position.copy(t),this.line=new Da(pu,new _a({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Gs(Au,new rs({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,s)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{uu.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(uu,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}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class mu extends Fa{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 Bs;n.setAttribute("position",new xs(t,3)),n.setAttribute("color",new xs([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(n,new _a({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,n){const i=new es,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class gu{constructor(){this.type="ShapePath",this.color=new es,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new xl,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,s){return this.currentPath.bezierCurveTo(e,t,n,i,r,s),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(e,t){const n=t.length;let i=!1;for(let r=n-1,s=0;s<n;r=s++){let n=t[r],o=t[s],a=o.x-n.x,l=o.y-n.y;if(Math.abs(l)>Number.EPSILON){if(l<0&&(n=t[s],a=-a,o=t[r],l=-l),e.y<n.y||e.y>o.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-a*(e.y-n.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==n.y)continue;if(o.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=o.x)return!0}}return i}const n=sc.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,s,o;const a=[];if(1===i.length)return s=i[0],o=new Pl,o.curves=s.curves,a.push(o),a;let l=!n(i[0].getPoints());l=e?!l:l;const c=[],h=[];let d,u,p=[],A=0;h[A]=void 0,p[A]=[];for(let t=0,o=i.length;t<o;t++)s=i[t],d=s.getPoints(),r=n(d),r=e?!r:r,r?(!l&&h[A]&&A++,h[A]={s:new Pl,p:d},h[A].s.curves=s.curves,l&&A++,p[A]=[]):p[A].push({h:s,p:d[0]});if(!h[0])return function(e){const t=[];for(let n=0,i=e.length;n<i;n++){const i=e[n],r=new Pl;r.curves=i.curves,t.push(r)}return t}(i);if(h.length>1){let e=!1,n=0;for(let e=0,t=h.length;e<t;e++)c[e]=[];for(let i=0,r=h.length;i<r;i++){const r=p[i];for(let s=0;s<r.length;s++){const o=r[s];let a=!0;for(let r=0;r<h.length;r++)t(o.p,h[r].p)&&(i!==r&&n++,a?(a=!1,c[r].push(o)):e=!0);a&&c[i].push(o)}}n>0&&!1===e&&(p=c)}for(let e=0,t=h.length;e<t;e++){o=h[e].s,a.push(o),u=p[e];for(let e=0,t=u.length;e<t;e++)o.holes.push(u[e].h)}return a}}class vu extends Hn{constructor(e,t=null){super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(){}disconnect(){}dispose(){}update(){}}function yu(e,t,n,i){const r=function(e){switch(e){case Re:case Le:return{byteLength:1,components:1};case Pe:case De:case ke:return{byteLength:2,components:1};case Ne:case Qe:return{byteLength:2,components:4};case Oe:case Ue:case Fe:return{byteLength:4,components:1};case ze:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${e}.`)}(i);switch(n){case He:case We:return e*t;case qe:return e*t*2;case Je:case Ke:return e*t/r.components*r.byteLength;case Ze:case $e:return e*t*2/r.components*r.byteLength;case Ve:return e*t*3/r.components*r.byteLength;case je:case tt:return e*t*4/r.components*r.byteLength;case nt:case it:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case rt:case st:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case at:case ct:return Math.max(e,16)*Math.max(t,8)/4;case ot:case lt:return Math.max(e,8)*Math.max(t,8)/2;case ht:case dt:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case ut:case pt:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case At:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case ft:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case mt:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case gt:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case vt:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case yt:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case Et:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case xt:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case bt:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case Ct:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case wt:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case _t:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case Mt:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case St:case It:case Bt:return Math.ceil(e/4)*Math.ceil(t/4)*16;case Tt:case Rt:return Math.ceil(e/4)*Math.ceil(t/4)*8;case Lt:case Dt:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}const Eu={contain:function(e,t){const n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e},cover:function(e,t){const n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e},fill:function(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e},getByteLength:yu};class xu extends Mi{constructor(e=1,t=1,n=1,i={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,t,{...i,count:n}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}function bu(){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 Cu(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.version<n.version)&&t.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}const r=t.get(n);if(void 0===r)t.set(n,function(t,n){const i=t.array,r=t.usage,s=i.byteLength,o=e.createBuffer();let a;if(e.bindBuffer(n,o),e.bufferData(n,i,r),t.onUploadCallback(),i instanceof Float32Array)a=e.FLOAT;else if(i instanceof Uint16Array)a=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(i instanceof Int16Array)a=e.SHORT;else if(i instanceof Uint32Array)a=e.UNSIGNED_INT;else if(i instanceof Int32Array)a=e.INT;else if(i instanceof Int8Array)a=e.BYTE;else if(i instanceof Uint8Array)a=e.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);a=e.UNSIGNED_BYTE}return{buffer:o,type:a,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version,size:s}}(n,i));else if(r.version<n.version){if(r.size!==n.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(t,n,i){const r=n.array,s=n.updateRanges;if(e.bindBuffer(i,t),0===s.length)e.bufferSubData(i,0,r);else{s.sort(((e,t)=>e.start-t.start));let t=0;for(let e=1;e<s.length;e++){const n=s[t],i=s[e];i.start<=n.start+n.count+1?n.count=Math.max(n.count,i.start+i.count-n.start):(++t,s[t]=i)}s.length=t+1;for(let t=0,n=s.length;t<n;t++){const n=s[t];e.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:s}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=s);const wu={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_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 ) || defined( USE_BATCHING_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\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( 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 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in 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( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\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 shadowIntensity;\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\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 shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, 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.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t\n\t\t#else\n\t\t\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},_u={common:{diffuse:{value:new es(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ni},alphaMap:{value:null},alphaMapTransform:{value:new ni},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ni}},envmap:{envMap:{value:null},envMapRotation:{value:new ni},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ni}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ni}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ni},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ni},normalScale:{value:new ti(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ni},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ni}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ni}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ni}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new es(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 es(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ni},alphaTest:{value:0},uvTransform:{value:new ni}},sprite:{diffuse:{value:new es(16777215)},opacity:{value:1},center:{value:new ti(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ni},alphaMap:{value:null},alphaMapTransform:{value:new ni},alphaTest:{value:0}}},Mu={basic:{uniforms:js([_u.common,_u.specularmap,_u.envmap,_u.aomap,_u.lightmap,_u.fog]),vertexShader:wu.meshbasic_vert,fragmentShader:wu.meshbasic_frag},lambert:{uniforms:js([_u.common,_u.specularmap,_u.envmap,_u.aomap,_u.lightmap,_u.emissivemap,_u.bumpmap,_u.normalmap,_u.displacementmap,_u.fog,_u.lights,{emissive:{value:new es(0)}}]),vertexShader:wu.meshlambert_vert,fragmentShader:wu.meshlambert_frag},phong:{uniforms:js([_u.common,_u.specularmap,_u.envmap,_u.aomap,_u.lightmap,_u.emissivemap,_u.bumpmap,_u.normalmap,_u.displacementmap,_u.fog,_u.lights,{emissive:{value:new es(0)},specular:{value:new es(1118481)},shininess:{value:30}}]),vertexShader:wu.meshphong_vert,fragmentShader:wu.meshphong_frag},standard:{uniforms:js([_u.common,_u.envmap,_u.aomap,_u.lightmap,_u.emissivemap,_u.bumpmap,_u.normalmap,_u.displacementmap,_u.roughnessmap,_u.metalnessmap,_u.fog,_u.lights,{emissive:{value:new es(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:wu.meshphysical_vert,fragmentShader:wu.meshphysical_frag},toon:{uniforms:js([_u.common,_u.aomap,_u.lightmap,_u.emissivemap,_u.bumpmap,_u.normalmap,_u.displacementmap,_u.gradientmap,_u.fog,_u.lights,{emissive:{value:new es(0)}}]),vertexShader:wu.meshtoon_vert,fragmentShader:wu.meshtoon_frag},matcap:{uniforms:js([_u.common,_u.bumpmap,_u.normalmap,_u.displacementmap,_u.fog,{matcap:{value:null}}]),vertexShader:wu.meshmatcap_vert,fragmentShader:wu.meshmatcap_frag},points:{uniforms:js([_u.points,_u.fog]),vertexShader:wu.points_vert,fragmentShader:wu.points_frag},dashed:{uniforms:js([_u.common,_u.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:wu.linedashed_vert,fragmentShader:wu.linedashed_frag},depth:{uniforms:js([_u.common,_u.displacementmap]),vertexShader:wu.depth_vert,fragmentShader:wu.depth_frag},normal:{uniforms:js([_u.common,_u.bumpmap,_u.normalmap,_u.displacementmap,{opacity:{value:1}}]),vertexShader:wu.meshnormal_vert,fragmentShader:wu.meshnormal_frag},sprite:{uniforms:js([_u.sprite,_u.fog]),vertexShader:wu.sprite_vert,fragmentShader:wu.sprite_frag},background:{uniforms:{uvTransform:{value:new ni},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:wu.background_vert,fragmentShader:wu.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ni}},vertexShader:wu.backgroundCube_vert,fragmentShader:wu.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:wu.cube_vert,fragmentShader:wu.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:wu.equirect_vert,fragmentShader:wu.equirect_frag},distanceRGBA:{uniforms:js([_u.common,_u.displacementmap,{referencePosition:{value:new Li},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:wu.distanceRGBA_vert,fragmentShader:wu.distanceRGBA_frag},shadow:{uniforms:js([_u.lights,_u.fog,{color:{value:new es(0)},opacity:{value:1}}]),vertexShader:wu.shadow_vert,fragmentShader:wu.shadow_frag}};Mu.physical={uniforms:js([Mu.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ni},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ni},clearcoatNormalScale:{value:new ti(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ni},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ni},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ni},sheen:{value:0},sheenColor:{value:new es(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ni},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ni},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ni},transmissionSamplerSize:{value:new ti},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ni},attenuationDistance:{value:0},attenuationColor:{value:new es(0)},specularColor:{value:new es(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ni},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ni},anisotropyVector:{value:new ti},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ni}}]),vertexShader:wu.meshphysical_vert,fragmentShader:wu.meshphysical_frag};const Su={r:0,b:0,g:0},Iu=new vr,Bu=new lr;function Tu(e,t,n,i,r,s,o){const a=new es(0);let l,c,h=!0===s?0:1,d=null,u=0,p=null;function A(e){let i=!0===e.isScene?e.background:null;return i&&i.isTexture&&(i=(e.backgroundBlurriness>0?n:t).get(i)),i}function f(t,n){t.getRGB(Su,Ws(e)),i.buffers.color.setClear(Su.r,Su.g,Su.b,n,o)}return{getClearColor:function(){return a},setClearColor:function(e,t=1){a.set(e),h=t,f(a,h)},getClearAlpha:function(){return h},setClearAlpha:function(e){h=e,f(a,h)},render:function(t){let n=!1;const r=A(t);null===r?f(a,h):r&&r.isColor&&(f(r,1),n=!0);const s=e.xr.getEnvironmentBlendMode();"additive"===s?i.buffers.color.setClear(0,0,0,1,o):"alpha-blend"===s&&i.buffers.color.setClear(0,0,0,0,o),(e.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const i=A(n);i&&(i.isCubeTexture||i.mapping===ge)?(void 0===c&&(c=new Gs(new Hs(1e4,1e4,1e4),new Xs({name:"BackgroundCubeMaterial",uniforms:Vs(Mu.backgroundCube.uniforms),vertexShader:Mu.backgroundCube.vertexShader,fragmentShader:Mu.backgroundCube.fragmentShader,side:g,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),Iu.copy(n.backgroundRotation),Iu.x*=-1,Iu.y*=-1,Iu.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(Iu.y*=-1,Iu.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(Bu.makeRotationFromEuler(Iu)),c.material.toneMapped=Ai.getTransfer(i.colorSpace)!==sn,d===i&&u===i.version&&p===e.toneMapping||(c.material.needsUpdate=!0,d=i,u=i.version,p=e.toneMapping),c.layers.enableAll(),t.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new Gs(new uc(2,2),new Xs({name:"BackgroundMaterial",uniforms:Vs(Mu.background.uniforms),vertexShader:Mu.background.vertexShader,fragmentShader:Mu.background.fragmentShader,side:m,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=Ai.getTransfer(i.colorSpace)!==sn,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),d===i&&u===i.version&&p===e.toneMapping||(l.material.needsUpdate=!0,d=i,u=i.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==c&&(c.geometry.dispose(),c.material.dispose()),void 0!==l&&(l.geometry.dispose(),l.material.dispose())}}}function Ru(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=c(null);let s=r,o=!1;function a(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function c(e){const t=[],i=[],r=[];for(let e=0;e<n;e++)t[e]=0,i[e]=0,r[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:i,attributeDivisors:r,object:e,attributes:{},index:null}}function h(){const e=s.newAttributes;for(let t=0,n=e.length;t<n;t++)e[t]=0}function d(e){u(e,0)}function u(t,n){const i=s.newAttributes,r=s.enabledAttributes,o=s.attributeDivisors;i[t]=1,0===r[t]&&(e.enableVertexAttribArray(t),r[t]=1),o[t]!==n&&(e.vertexAttribDivisor(t,n),o[t]=n)}function p(){const t=s.newAttributes,n=s.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==t[i]&&(e.disableVertexAttribArray(i),n[i]=0)}function A(t,n,i,r,s,o,a){!0===a?e.vertexAttribIPointer(t,n,i,s,o):e.vertexAttribPointer(t,n,i,r,s,o)}function f(){m(),o=!0,s!==r&&(s=r,a(s.object))}function m(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,f,m){let g=!1;const v=function(t,n,r){const s=!0===r.wireframe;let o=i[t.id];void 0===o&&(o={},i[t.id]=o);let a=o[n.id];void 0===a&&(a={},o[n.id]=a);let l=a[s];return void 0===l&&(l=c(e.createVertexArray()),a[s]=l),l}(f,l,r);s!==v&&(s=v,a(s.object)),g=function(e,t,n,i){const r=s.attributes,o=t.attributes;let a=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){const n=r[t];let i=o[t];if(void 0===i&&("instanceMatrix"===t&&e.instanceMatrix&&(i=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(i=e.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;a++}return s.attributesNum!==a||s.index!==i}(n,f,l,m),g&&function(e,t,n,i){const r={},o=t.attributes;let a=0;const l=n.getAttributes();for(const t in l)if(l[t].location>=0){let n=o[t];void 0===n&&("instanceMatrix"===t&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(n=e.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[t]=i,a++}s.attributes=r,s.attributesNum=a,s.index=i}(n,f,l,m),null!==m&&t.update(m,e.ELEMENT_ARRAY_BUFFER),(g||o)&&(o=!1,function(n,i,r,s){h();const o=s.attributes,a=r.getAttributes(),l=i.defaultAttributeValues;for(const i in a){const r=a[i];if(r.location>=0){let a=o[i];if(void 0===a&&("instanceMatrix"===i&&n.instanceMatrix&&(a=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(a=n.instanceColor)),void 0!==a){const i=a.normalized,o=a.itemSize,l=t.get(a);if(void 0===l)continue;const c=l.buffer,h=l.type,p=l.bytesPerElement,f=h===e.INT||h===e.UNSIGNED_INT||a.gpuType===Ue;if(a.isInterleavedBufferAttribute){const t=a.data,l=t.stride,m=a.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<r.locationSize;e++)u(r.location+e,t.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<r.locationSize;e++)d(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)A(r.location+e,o/r.locationSize,h,i,l*p,(m+o/r.locationSize*e)*p,f)}else{if(a.isInstancedBufferAttribute){for(let e=0;e<r.locationSize;e++)u(r.location+e,a.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=a.meshPerAttribute*a.count)}else for(let e=0;e<r.locationSize;e++)d(r.location+e);e.bindBuffer(e.ARRAY_BUFFER,c);for(let e=0;e<r.locationSize;e++)A(r.location+e,o/r.locationSize,h,i,o*p,o/r.locationSize*e*p,f)}}else if(void 0!==l){const t=l[i];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(r.location,t);break;case 3:e.vertexAttrib3fv(r.location,t);break;case 4:e.vertexAttrib4fv(r.location,t);break;default:e.vertexAttrib1fv(r.location,t)}}}}p()}(n,r,l,f),null!==m&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(m).buffer))},reset:f,resetDefaultState:m,dispose:function(){f();for(const e in i){const t=i[e];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e]}},releaseStatesOfGeometry:function(e){if(void 0===i[e.id])return;const t=i[e.id];for(const e in t){const n=t[e];for(const e in n)l(n[e].object),delete n[e];delete t[e]}delete i[e.id]},releaseStatesOfProgram:function(e){for(const t in i){const n=i[t];if(void 0===n[e.id])continue;const r=n[e.id];for(const e in r)l(r[e].object),delete r[e];delete n[e.id]}},initAttributes:h,enableAttribute:d,disableUnusedAttributes:p}}function Lu(e,t,n){let i;function r(t,r,s){0!==s&&(e.drawArraysInstanced(i,t,r,s),n.update(r,i,s))}this.setMode=function(e){i=e},this.render=function(t,r){e.drawArrays(i,t,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(e,r,s){if(0===s)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,e,0,r,0,s);let o=0;for(let e=0;e<s;e++)o+=r[e];n.update(o,i,1)},this.renderMultiDrawInstances=function(e,s,o,a){if(0===o)return;const l=t.get("WEBGL_multi_draw");if(null===l)for(let t=0;t<e.length;t++)r(e[t],s[t],a[t]);else{l.multiDrawArraysInstancedWEBGL(i,e,0,s,0,a,0,o);let t=0;for(let e=0;e<o;e++)t+=s[e]*a[e];n.update(t,i,1)}}}function Du(e,t,n,i){let r;function s(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o=void 0!==n.precision?n.precision:"highp";const a=s(o);a!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",a,"instead."),o=a);const l=!0===n.logarithmicDepthBuffer,c=!0===n.reverseDepthBuffer&&t.has("EXT_clip_control"),h=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),d=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:s,textureFormatReadable:function(t){return t===je||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===ke&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==Re&&i.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==Fe&&!r)},precision:o,logarithmicDepthBuffer:l,reverseDepthBuffer:c,maxTextures:h,maxVertexTextures:d,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:d>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function Pu(e){const t=this;let n=null,i=0,r=!1,s=!1;const o=new ia,a=new ni,l={value:null,needsUpdate:!1};function c(e,n,i,r){const s=null!==e?e.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const t=i+4*s,r=n.matrixWorldInverse;a.getNormalMatrix(r),(null===c||c.length<t)&&(c=new Float32Array(t));for(let t=0,n=i;t!==s;++t,n+=4)o.copy(e[t]).applyMatrix4(r,a),o.normal.toArray(c,n),c[n+3]=o.constant}l.value=c,l.needsUpdate=!0}return t.numPlanes=s,t.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){const n=0!==e.length||t||0!==i||r;return r=t,i=e.length,n},this.beginShadows=function(){s=!0,c(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(e,t){n=c(e,t,0)},this.setState=function(o,a,h){const d=o.clippingPlanes,u=o.clipIntersection,p=o.clipShadows,A=e.get(o);if(!r||null===d||0===d.length||s&&!p)s?c(null):(l.value!==n&&(l.value=n,l.needsUpdate=i>0),t.numPlanes=i,t.numIntersection=0);else{const e=s?0:i,t=4*e;let r=A.clippingState||null;l.value=r,r=c(d,a,t,h);for(let e=0;e!==t;++e)r[e]=n[e];A.clippingState=r,this.numIntersection=u?this.numPlanes:0,this.numPlanes+=e}}}function Uu(e){let t=new WeakMap;function n(e,t){return t===fe?e.mapping=pe:t===me&&(e.mapping=Ae),e}function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping;if(s===fe||s===me){if(t.has(r))return n(t.get(r).texture,r.mapping);{const s=r.image;if(s&&s.height>0){const o=new io(s.height);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener("dispose",i),n(o.texture,r.mapping)}return null}}}return r},dispose:function(){t=new WeakMap}}}const Ou=[.125,.215,.35,.446,.526,.582],Fu=new Sh,ku=new es;let Nu=null,Qu=0,Gu=0,zu=!1;const Hu=(1+Math.sqrt(5))/2,Vu=1/Hu,ju=[new Li(-Hu,Vu,0),new Li(Hu,Vu,0),new Li(-Vu,0,Hu),new Li(Vu,0,Hu),new Li(0,Hu,-Vu),new Li(0,Hu,Vu),new Li(-1,1,-1),new Li(1,1,-1),new Li(-1,1,1),new Li(1,1,1)];class Wu{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){Nu=this._renderer.getRenderTarget(),Qu=this._renderer.getActiveCubeFace(),Gu=this._renderer.getActiveMipmapLevel(),zu=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,n,i,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Ju(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Yu(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Nu,Qu,Gu),this._renderer.xr.enabled=zu,e.scissorTest=!1,Xu(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===pe||e.mapping===Ae?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Nu=this._renderer.getRenderTarget(),Qu=this._renderer.getActiveCubeFace(),Gu=this._renderer.getActiveMipmapLevel(),zu=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:Me,minFilter:Me,generateMipmaps:!1,type:ke,format:je,colorSpace:nn,depthBuffer:!1},i=qu(e,t,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=qu(e,t,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(e){const t=[],n=[],i=[];let r=e;const s=e-4+1+Ou.length;for(let o=0;o<s;o++){const s=Math.pow(2,r);n.push(s);let a=1/s;o>e-4?a=Ou[o-e+4-1]:0===o&&(a=0),i.push(a);const l=1/(s-2),c=-l,h=1+l,d=[c,c,h,c,h,h,c,c,h,h,c,h],u=6,p=6,A=3,f=2,m=1,g=new Float32Array(A*p*u),v=new Float32Array(f*p*u),y=new Float32Array(m*p*u);for(let e=0;e<u;e++){const t=e%3*2/3-1,n=e>2?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,A*p*e),v.set(d,f*p*e);const r=[e,e,e,e,e,e];y.set(r,m*p*e)}const E=new Bs;E.setAttribute("position",new us(g,A)),E.setAttribute("uv",new us(v,f)),E.setAttribute("faceIndex",new us(y,m)),t.push(E),r>4&&r--}return{lodPlanes:t,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(e,t,n){const i=new Float32Array(20),r=new Li(0,1,0);return new Xs({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:y,depthTest:!1,depthWrite:!1})}(i,e,t)}return i}_compileMaterial(e){const t=new Gs(this._lodPlanes[0],e);this._renderer.compile(t,Fu)}_sceneToCubeUV(e,t,n,i){const r=new $s(90,1,t,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],a=this._renderer,l=a.autoClear,c=a.toneMapping;a.getClearColor(ku),a.toneMapping=ne,a.autoClear=!1;const h=new rs({name:"PMREM.Background",side:g,depthWrite:!1,depthTest:!1}),d=new Gs(new Hs,h);let u=!1;const p=e.background;p?p.isColor&&(h.color.copy(p),e.background=null,u=!0):(h.color.copy(ku),u=!0);for(let t=0;t<6;t++){const n=t%3;0===n?(r.up.set(0,s[t],0),r.lookAt(o[t],0,0)):1===n?(r.up.set(0,0,s[t]),r.lookAt(0,o[t],0)):(r.up.set(0,s[t],0),r.lookAt(0,0,o[t]));const l=this._cubeSize;Xu(i,n*l,t>2?l:0,l,l),a.setRenderTarget(i),u&&a.render(d,r),a.render(e,r)}d.geometry.dispose(),d.material.dispose(),a.toneMapping=c,a.autoClear=l,e.background=p}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===pe||e.mapping===Ae;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Ju()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Yu());const r=i?this._cubemapMaterial:this._equirectMaterial,s=new Gs(this._lodPlanes[0],r);r.uniforms.envMap.value=e;const o=this._cubeSize;Xu(t,0,0,3*o,2*o),n.setRenderTarget(t),n.render(s,Fu)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let t=1;t<i;t++){const n=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),r=ju[(i-t-1)%ju.length];this._blur(e,t-1,t,n,r)}t.autoClear=n}_blur(e,t,n,i,r){const s=this._pingPongRenderTarget;this._halfBlur(e,s,t,n,i,"latitudinal",r),this._halfBlur(s,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,s,o){const a=this._renderer,l=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Gs(this._lodPlanes[i],l),h=l.uniforms,d=this._sizeLods[n]-1,u=isFinite(r)?Math.PI/(2*d):2*Math.PI/39,p=r/u,A=isFinite(r)?1+Math.floor(3*p):20;A>20&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${A} samples when the maximum is set to 20`);const f=[];let m=0;for(let e=0;e<20;++e){const t=e/p,n=Math.exp(-t*t/2);f.push(n),0===e?m+=n:e<A&&(m+=2*n)}for(let e=0;e<f.length;e++)f[e]=f[e]/m;h.envMap.value=e.texture,h.samples.value=A,h.weights.value=f,h.latitudinal.value="latitudinal"===s,o&&(h.poleAxis.value=o);const{_lodMax:g}=this;h.dTheta.value=u,h.mipInt.value=g-n;const v=this._sizeLods[i];Xu(t,3*v*(i>g-4?i-g+4:0),4*(this._cubeSize-v),3*v,2*v),a.setRenderTarget(t),a.render(c,Fu)}}function qu(e,t,n){const i=new Mi(e,t,n);return i.texture.mapping=ge,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Xu(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function Yu(){return new Xs({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:y,depthTest:!1,depthWrite:!1})}function Ju(){return new Xs({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:y,depthTest:!1,depthWrite:!1})}function Ku(e){let t=new WeakMap,n=null;function i(e){const n=e.target;n.removeEventListener("dispose",i);const r=t.get(n);void 0!==r&&(t.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const s=r.mapping,o=s===fe||s===me,a=s===pe||s===Ae;if(o||a){let s=t.get(r);const l=void 0!==s?s.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new Wu(e)),s=o?n.fromEquirectangular(r,s):n.fromCubemap(r,s),s.texture.pmremVersion=r.pmremVersion,t.set(r,s),s.texture;if(void 0!==s)return s.texture;{const l=r.image;return o&&l&&l.height>0||a&&l&&function(e){let t=0;for(let n=0;n<6;n++)void 0!==e[n]&&t++;return 6===t}(l)?(null===n&&(n=new Wu(e)),s=o?n.fromEquirectangular(r):n.fromCubemap(r),s.texture.pmremVersion=r.pmremVersion,t.set(r,s),r.addEventListener("dispose",i),s.texture):null}}}return r},dispose:function(){t=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Zu(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(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){const t=n(e);return null===t&&hi("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function $u(e,t,n,i){const r={},s=new WeakMap;function o(e){const a=e.target;null!==a.index&&t.remove(a.index);for(const e in a.attributes)t.remove(a.attributes[e]);a.removeEventListener("dispose",o),delete r[a.id];const l=s.get(a);l&&(t.remove(l),s.delete(a)),i.releaseStatesOfGeometry(a),!0===a.isInstancedBufferGeometry&&delete a._maxInstanceCount,n.memory.geometries--}function a(e){const n=[],i=e.index,r=e.attributes.position;let o=0;if(null!==i){const e=i.array;o=i.version;for(let t=0,i=e.length;t<i;t+=3){const i=e[t+0],r=e[t+1],s=e[t+2];n.push(i,r,r,s,s,i)}}else{if(void 0===r)return;{const e=r.array;o=r.version;for(let t=0,i=e.length/3-1;t<i;t+=3){const e=t+0,i=t+1,r=t+2;n.push(e,i,i,r,r,e)}}}const a=new(ri(n)?ys:gs)(n,1);a.version=o;const l=s.get(e);l&&t.remove(l),s.set(e,a)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",o),r[t.id]=!0,n.memory.geometries++),t},update:function(n){const i=n.attributes;for(const n in i)t.update(i[n],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){const t=s.get(e);if(t){const n=e.index;null!==n&&t.version<n.version&&a(e)}else a(e);return s.get(e)}}}function ep(e,t,n){let i,r,s;function o(t,o,a){0!==a&&(e.drawElementsInstanced(i,o,r,t*s,a),n.update(o,i,a))}this.setMode=function(e){i=e},this.setIndex=function(e){r=e.type,s=e.bytesPerElement},this.render=function(t,o){e.drawElements(i,o,r,t*s),n.update(o,i,1)},this.renderInstances=o,this.renderMultiDraw=function(e,s,o){if(0===o)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,s,0,r,e,0,o);let a=0;for(let e=0;e<o;e++)a+=s[e];n.update(a,i,1)},this.renderMultiDrawInstances=function(e,a,l,c){if(0===l)return;const h=t.get("WEBGL_multi_draw");if(null===h)for(let t=0;t<e.length;t++)o(e[t]/s,a[t],c[t]);else{h.multiDrawElementsInstancedWEBGL(i,a,0,r,e,0,c,0,l);let t=0;for(let e=0;e<l;e++)t+=a[e]*c[e];n.update(t,i,1)}}}function tp(e){const t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function(n,i,r){switch(t.calls++,i){case e.TRIANGLES:t.triangles+=r*(n/3);break;case e.LINES:t.lines+=r*(n/2);break;case e.LINE_STRIP:t.lines+=r*(n-1);break;case e.LINE_LOOP:t.lines+=r*n;break;case e.POINTS:t.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function np(e,t,n){const i=new WeakMap,r=new wi;return{update:function(s,o,a){const l=s.morphTargetInfluences,c=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,h=void 0!==c?c.length:0;let d=i.get(o);if(void 0===d||d.count!==h){void 0!==d&&d.texture.dispose();const u=void 0!==o.morphAttributes.position,p=void 0!==o.morphAttributes.normal,A=void 0!==o.morphAttributes.color,f=o.morphAttributes.position||[],m=o.morphAttributes.normal||[],g=o.morphAttributes.color||[];let v=0;!0===u&&(v=1),!0===p&&(v=2),!0===A&&(v=3);let y=o.attributes.position.count*v,E=1;y>t.maxTextureSize&&(E=Math.ceil(y/t.maxTextureSize),y=t.maxTextureSize);const x=new Float32Array(y*E*4*h),b=new Si(x,y,E,h);b.type=Fe,b.needsUpdate=!0;const C=4*v;for(let _=0;_<h;_++){const M=f[_],S=m[_],I=g[_],B=y*E*4*_;for(let T=0;T<M.count;T++){const R=T*C;!0===u&&(r.fromBufferAttribute(M,T),x[B+R+0]=r.x,x[B+R+1]=r.y,x[B+R+2]=r.z,x[B+R+3]=0),!0===p&&(r.fromBufferAttribute(S,T),x[B+R+4]=r.x,x[B+R+5]=r.y,x[B+R+6]=r.z,x[B+R+7]=0),!0===A&&(r.fromBufferAttribute(I,T),x[B+R+8]=r.x,x[B+R+9]=r.y,x[B+R+10]=r.z,x[B+R+11]=4===I.itemSize?r.w:1)}}function w(){b.dispose(),i.delete(o),o.removeEventListener("dispose",w)}d={count:h,texture:b,size:new ti(y,E)},i.set(o,d),o.addEventListener("dispose",w)}if(!0===s.isInstancedMesh&&null!==s.morphTexture)a.getUniforms().setValue(e,"morphTexture",s.morphTexture,n);else{let L=0;for(let P=0;P<l.length;P++)L+=l[P];const D=o.morphTargetsRelative?1:1-L;a.getUniforms().setValue(e,"morphTargetBaseInfluence",D),a.getUniforms().setValue(e,"morphTargetInfluences",l)}a.getUniforms().setValue(e,"morphTargetsTexture",d.texture,n),a.getUniforms().setValue(e,"morphTargetsTextureSize",d.size)}}}class ip{constructor(e,t,n){if(this.renderer=e,this.DEFAULT_NUMVIEWS=2,this.maxNumViews=0,this.gl=n,this.extensions=t,this.available=this.extensions.has("OCULUS_multiview"),this.available){const e=this.extensions.get("OCULUS_multiview");this.maxNumViews=this.gl.getParameter(e.MAX_VIEWS_OVR),this.mat4=[],this.mat3=[],this.cameraArray=[];for(var i=0;i<this.maxNumViews;i++)this.mat4[i]=new lr,this.mat3[i]=new ni}}getCameraArray(e){return e.isArrayCamera?e.cameras:(this.cameraArray[0]=e,this.cameraArray)}updateCameraProjectionMatricesUniform(e,t){for(var n=this.getCameraArray(e),i=0;i<n.length;i++)this.mat4[i].copy(n[i].projectionMatrix);t.setValue(this.gl,"projectionMatrices",this.mat4)}updateCameraViewMatricesUniform(e,t){for(var n=this.getCameraArray(e),i=0;i<n.length;i++)this.mat4[i].copy(n[i].matrixWorldInverse);t.setValue(this.gl,"viewMatrices",this.mat4)}updateObjectMatricesUniforms(e,t,n){for(var i=this.getCameraArray(t),r=0;r<i.length;r++)this.mat4[r].multiplyMatrices(i[r].matrixWorldInverse,e.matrixWorld),this.mat3[r].getNormalMatrix(this.mat4[r]);n.setValue(this.gl,"modelViewMatrices",this.mat4),n.setValue(this.gl,"normalMatrices",this.mat3)}}function rp(e,t,n,i){let r=new WeakMap;function s(e){const t=e.target;t.removeEventListener("dispose",s),n.remove(t.instanceMatrix),null!==t.instanceColor&&n.remove(t.instanceColor)}return{update:function(o){const a=i.render.frame,l=o.geometry,c=t.get(o,l);if(r.get(c)!==a&&(t.update(c),r.set(c,a)),o.isInstancedMesh&&(!1===o.hasEventListener("dispose",s)&&o.addEventListener("dispose",s),r.get(o)!==a&&(n.update(o.instanceMatrix,e.ARRAY_BUFFER),null!==o.instanceColor&&n.update(o.instanceColor,e.ARRAY_BUFFER),r.set(o,a))),o.isSkinnedMesh){const e=o.skeleton;r.get(e)!==a&&(e.update(),r.set(e,a))}return c},dispose:function(){r=new WeakMap}}}const sp=new Ci,op=new $a(1,1),ap=new Si,lp=new Bi,cp=new no,hp=[],dp=[],up=new Float32Array(16),pp=new Float32Array(9),Ap=new Float32Array(4);function fp(e,t,n){const i=e[0];if(i<=0||i>0)return e;const r=t*n;let s=hp[r];if(void 0===s&&(s=new Float32Array(r),hp[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 mp(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function gp(e,t){for(let n=0,i=t.length;n<i;n++)e[n]=t[n]}function vp(e,t){let n=dp[t];void 0===n&&(n=new Int32Array(t),dp[t]=n);for(let i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function yp(e,t){const n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Ep(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(mp(n,t))return;e.uniform2fv(this.addr,t),gp(n,t)}}function xp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(void 0!==t.r)n[0]===t.r&&n[1]===t.g&&n[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if(mp(n,t))return;e.uniform3fv(this.addr,t),gp(n,t)}}function bp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(mp(n,t))return;e.uniform4fv(this.addr,t),gp(n,t)}}function Cp(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(mp(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),gp(n,t)}else{if(mp(n,i))return;Ap.set(i),e.uniformMatrix2fv(this.addr,!1,Ap),gp(n,i)}}function wp(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(mp(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),gp(n,t)}else{if(mp(n,i))return;pp.set(i),e.uniformMatrix3fv(this.addr,!1,pp),gp(n,i)}}function _p(e,t){const n=this.cache,i=t.elements;if(void 0===i){if(mp(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),gp(n,t)}else{if(mp(n,i))return;up.set(i),e.uniformMatrix4fv(this.addr,!1,up),gp(n,i)}}function Mp(e,t){const n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Sp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(mp(n,t))return;e.uniform2iv(this.addr,t),gp(n,t)}}function Ip(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(mp(n,t))return;e.uniform3iv(this.addr,t),gp(n,t)}}function Bp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(mp(n,t))return;e.uniform4iv(this.addr,t),gp(n,t)}}function Tp(e,t){const n=this.cache;n[0]!==t&&(e.uniform1ui(this.addr,t),n[0]=t)}function Rp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if(mp(n,t))return;e.uniform2uiv(this.addr,t),gp(n,t)}}function Lp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else{if(mp(n,t))return;e.uniform3uiv(this.addr,t),gp(n,t)}}function Dp(e,t){const n=this.cache;if(void 0!==t.x)n[0]===t.x&&n[1]===t.y&&n[2]===t.z&&n[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if(mp(n,t))return;e.uniform4uiv(this.addr,t),gp(n,t)}}function Pp(e,t,n){const i=this.cache,r=n.allocateTextureUnit();let s;i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),this.type===e.SAMPLER_2D_SHADOW?(op.compareFunction=_n,s=op):s=sp,n.setTexture2D(t||s,r)}function Up(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||lp,r)}function Op(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(t||cp,r)}function Fp(e,t,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||ap,r)}function kp(e,t){e.uniform1fv(this.addr,t)}function Np(e,t){const n=fp(t,this.size,2);e.uniform2fv(this.addr,n)}function Qp(e,t){const n=fp(t,this.size,3);e.uniform3fv(this.addr,n)}function Gp(e,t){const n=fp(t,this.size,4);e.uniform4fv(this.addr,n)}function zp(e,t){const n=fp(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Hp(e,t){const n=fp(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Vp(e,t){const n=fp(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function jp(e,t){e.uniform1iv(this.addr,t)}function Wp(e,t){e.uniform2iv(this.addr,t)}function qp(e,t){e.uniform3iv(this.addr,t)}function Xp(e,t){e.uniform4iv(this.addr,t)}function Yp(e,t){e.uniform1uiv(this.addr,t)}function Jp(e,t){e.uniform2uiv(this.addr,t)}function Kp(e,t){e.uniform3uiv(this.addr,t)}function Zp(e,t){e.uniform4uiv(this.addr,t)}function $p(e,t,n){const i=this.cache,r=t.length,s=vp(n,r);mp(i,s)||(e.uniform1iv(this.addr,s),gp(i,s));for(let e=0;e!==r;++e)n.setTexture2D(t[e]||sp,s[e])}function eA(e,t,n){const i=this.cache,r=t.length,s=vp(n,r);mp(i,s)||(e.uniform1iv(this.addr,s),gp(i,s));for(let e=0;e!==r;++e)n.setTexture3D(t[e]||lp,s[e])}function tA(e,t,n){const i=this.cache,r=t.length,s=vp(n,r);mp(i,s)||(e.uniform1iv(this.addr,s),gp(i,s));for(let e=0;e!==r;++e)n.setTextureCube(t[e]||cp,s[e])}function nA(e,t,n){const i=this.cache,r=t.length,s=vp(n,r);mp(i,s)||(e.uniform1iv(this.addr,s),gp(i,s));for(let e=0;e!==r;++e)n.setTexture2DArray(t[e]||ap,s[e])}class iA{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=function(e){switch(e){case 5126:return yp;case 35664:return Ep;case 35665:return xp;case 35666:return bp;case 35674:return Cp;case 35675:return wp;case 35676:return _p;case 5124:case 35670:return Mp;case 35667:case 35671:return Sp;case 35668:case 35672:return Ip;case 35669:case 35673:return Bp;case 5125:return Tp;case 36294:return Rp;case 36295:return Lp;case 36296:return Dp;case 35678:case 36198:case 36298:case 36306:case 35682:return Pp;case 35679:case 36299:case 36307:return Up;case 35680:case 36300:case 36308:case 36293:return Op;case 36289:case 36303:case 36311:case 36292:return Fp}}(t.type)}}class rA{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function(e){switch(e){case 5126:return kp;case 35664:return Np;case 35665:return Qp;case 35666:return Gp;case 35674:return zp;case 35675:return Hp;case 35676:return Vp;case 5124:case 35670:return jp;case 35667:case 35671:return Wp;case 35668:case 35672:return qp;case 35669:case 35673:return Xp;case 5125:return Yp;case 36294:return Jp;case 36295:return Kp;case 36296:return Zp;case 35678:case 36198:case 36298:case 36306:case 35682:return $p;case 35679:case 36299:case 36307:return eA;case 35680:case 36300:case 36308:case 36293:return tA;case 36289:case 36303:case 36311:case 36292:return nA}}(t.type)}}class sA{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let r=0,s=i.length;r!==s;++r){const s=i[r];s.setValue(e,t[s.id],n)}}}const oA=/(\w+)(\])?(\[|\.)?/g;function aA(e,t){e.seq.push(t),e.map[t.id]=t}function lA(e,t,n){const i=e.name,r=i.length;for(oA.lastIndex=0;;){const s=oA.exec(i),o=oA.lastIndex;let a=s[1];const l="]"===s[2],c=s[3];if(l&&(a|=0),void 0===c||"["===c&&o+2===r){aA(n,void 0===c?new iA(a,e,t):new rA(a,e,t));break}{let e=n.map[a];void 0===e&&(e=new sA(a),aA(n,e)),n=e}}}class cA{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=e.getActiveUniform(t,i);lA(n,e.getUniformLocation(t,n.name),this)}}setValue(e,t,n,i){const r=this.map[t];void 0!==r&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];void 0!==i&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,s=t.length;r!==s;++r){const s=t[r],o=n[s.id];!1!==o.needsUpdate&&s.setValue(e,o.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const r=e[i];r.id in t&&n.push(r)}return n}}function hA(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}let dA=0;const uA=new ni;function pA(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=e.getShaderInfoLog(t).trim();if(i&&""===r)return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const i=parseInt(s[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){const n=e.split("\n"),i=[],r=Math.max(t-6,0),s=Math.min(t+6,n.length);for(let e=r;e<s;e++){const r=e+1;i.push(`${r===t?">":" "} ${r}: ${n[e]}`)}return i.join("\n")}(e.getShaderSource(t),i)}return r}function AA(e,t){const n=function(e){Ai._getMatrix(uA,Ai.workingColorSpace,e);const t=`mat3( ${uA.elements.map((e=>e.toFixed(4)))} )`;switch(Ai.getTransfer(e)){case rn:return[t,"LinearTransferOETF"];case sn:return[t,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(t);return[`vec4 ${e}( vec4 value ) {`,`\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join("\n")}function fA(e,t){let n;switch(t){case ie:n="Linear";break;case re:n="Reinhard";break;case se:n="Cineon";break;case oe:n="ACESFilmic";break;case le:n="AgX";break;case ce:n="Neutral";break;case ae:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),n="Linear"}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const mA=new Li;function gA(e){return""!==e}function vA(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function yA(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const EA=/^[ \t]*#include +<([\w\d./]+)>/gm;function xA(e){return e.replace(EA,CA)}const bA=new Map;function CA(e,t){let n=wu[t];if(void 0===n){const e=bA.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=wu[e],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return xA(n)}const wA=/#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 _A(e){return e.replace(wA,MA)}function MA(e,t,n,i){let r="";for(let e=parseInt(t);e<parseInt(n);e++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return r}function SA(e){let t=`precision ${e.precision} float;\n\tprecision ${e.precision} int;\n\tprecision ${e.precision} sampler2D;\n\tprecision ${e.precision} samplerCube;\n\tprecision ${e.precision} sampler3D;\n\tprecision ${e.precision} sampler2DArray;\n\tprecision ${e.precision} sampler2DShadow;\n\tprecision ${e.precision} samplerCubeShadow;\n\tprecision ${e.precision} sampler2DArrayShadow;\n\tprecision ${e.precision} isampler2D;\n\tprecision ${e.precision} isampler3D;\n\tprecision ${e.precision} isamplerCube;\n\tprecision ${e.precision} isampler2DArray;\n\tprecision ${e.precision} usampler2D;\n\tprecision ${e.precision} usampler3D;\n\tprecision ${e.precision} usamplerCube;\n\tprecision ${e.precision} usampler2DArray;\n\t`;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function IA(e,t,n,i){const r=e.getContext(),s=n.defines;let o=n.vertexShader,a=n.fragmentShader;const l=function(e){let t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===p?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===A?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===f&&(t="SHADOWMAP_TYPE_VSM"),t}(n),c=function(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case pe:case Ae:t="ENVMAP_TYPE_CUBE";break;case ge:t="ENVMAP_TYPE_CUBE_UV"}return t}(n),h=function(e){let t="ENVMAP_MODE_REFLECTION";return e.envMap&&e.envMapMode===Ae&&(t="ENVMAP_MODE_REFRACTION"),t}(n),d=function(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case $:t="ENVMAP_BLENDING_MULTIPLY";break;case ee:t="ENVMAP_BLENDING_MIX";break;case te:t="ENVMAP_BLENDING_ADD"}return t}(n),u=function(e){const t=e.envMapCubeUVHeight;if(null===t)return null;const n=Math.log2(t)-2,i=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),m=function(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(gA).join("\n")}(n),g=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),v=r.createProgram();let y,E,x=n.glslVersion?"#version "+n.glslVersion+"\n":"";const b=n.numMultiviewViews;n.isRawShaderMaterial?(y=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g].filter(gA).join("\n"),y.length>0&&(y+="\n"),E=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g].filter(gA).join("\n"),E.length>0&&(E+="\n")):(y=[SA(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",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.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(gA).join("\n"),E=[SA(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",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 "+d:"",u?"#define CUBEUV_TEXEL_WIDTH "+u.texelWidth:"",u?"#define CUBEUV_TEXEL_HEIGHT "+u.texelHeight:"",u?"#define CUBEUV_MAX_MIP "+u.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",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.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==ne?"#define TONE_MAPPING":"",n.toneMapping!==ne?wu.tonemapping_pars_fragment:"",n.toneMapping!==ne?fA("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",wu.colorspace_pars_fragment,AA("linearToOutputTexel",n.outputColorSpace),(Ai.getLuminanceCoefficients(mA),["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${mA.x.toFixed(4)}, ${mA.y.toFixed(4)}, ${mA.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(gA).join("\n")),o=xA(o),o=vA(o,n),o=yA(o,n),a=xA(a),a=vA(a,n),a=yA(a,n),o=_A(o),a=_A(a),!0!==n.isRawShaderMaterial&&(x="#version 300 es\n",y=[m,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+y,E=["#define varying in",n.glslVersion===Qn?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Qn?"":"#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"+E,b>0&&(y=["#extension GL_OVR_multiview : require","layout(num_views = "+b+") in;","#define VIEW_ID gl_ViewID_OVR"].join("\n")+"\n"+y,y=y.replace(["uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;"].join("\n"),["uniform mat4 modelViewMatrices["+b+"];","uniform mat4 projectionMatrices["+b+"];","uniform mat4 viewMatrices["+b+"];","uniform mat3 normalMatrices["+b+"];","#define modelViewMatrix modelViewMatrices[VIEW_ID]","#define projectionMatrix projectionMatrices[VIEW_ID]","#define viewMatrix viewMatrices[VIEW_ID]","#define normalMatrix normalMatrices[VIEW_ID]"].join("\n")),E=["#extension GL_OVR_multiview : require","#define VIEW_ID gl_ViewID_OVR"].join("\n")+"\n"+E,E=E.replace("uniform mat4 viewMatrix;",["uniform mat4 viewMatrices["+b+"];","#define viewMatrix viewMatrices[VIEW_ID]"].join("\n"))));const C=x+y+o,w=x+E+a,_=hA(r,r.VERTEX_SHADER,C),M=hA(r,r.FRAGMENT_SHADER,w);function S(t){if(e.debug.checkShaderErrors){const n=r.getProgramInfoLog(v).trim(),i=r.getShaderInfoLog(_).trim(),s=r.getShaderInfoLog(M).trim();let o=!0,a=!0;if(!1===r.getProgramParameter(v,r.LINK_STATUS))if(o=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(r,v,_,M);else{const e=pA(r,_,"vertex"),i=pA(r,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(v,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+n+"\n"+e+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==s||(a=!1);a&&(t.diagnostics={runnable:o,programLog:n,vertexShader:{log:i,prefix:y},fragmentShader:{log:s,prefix:E}})}r.deleteShader(_),r.deleteShader(M),I=new cA(r,v),B=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=e.getActiveAttrib(t,r),s=i.name;let o=1;i.type===e.FLOAT_MAT2&&(o=2),i.type===e.FLOAT_MAT3&&(o=3),i.type===e.FLOAT_MAT4&&(o=4),n[s]={type:i.type,location:e.getAttribLocation(t,s),locationSize:o}}return n}(r,v)}let I,B;r.attachShader(v,_),r.attachShader(v,M),void 0!==n.index0AttributeName?r.bindAttribLocation(v,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(v,0,"position"),r.linkProgram(v),this.getUniforms=function(){return void 0===I&&S(this),I},this.getAttributes=function(){return void 0===B&&S(this),B};let T=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===T&&(T=r.getProgramParameter(v,37297)),T},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(v),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=dA++,this.cacheKey=t,this.usedTimes=1,this.program=v,this.vertexShader=_,this.fragmentShader=M,this.numMultiviewViews=b,this}let BA=0;class TA{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),r=this._getShaderStage(n),s=this._getShaderCacheForMaterial(e);return!1===s.has(i)&&(s.add(i),i.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return void 0===n&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return void 0===n&&(n=new RA(e),t.set(e,n)),n}}class RA{constructor(e){this.id=BA++,this.code=e,this.usedTimes=0}}function LA(e,t,n,i,r,s,o){const a=new yr,l=new TA,c=new Set,h=[],d=r.logarithmicDepthBuffer,u=r.vertexTextures;let p=r.precision;const A={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function f(e){return c.add(e),0===e?"uv":`uv${e}`}return{getParameters:function(s,a,h,m,y){const x=m.fog,b=y.geometry,C=s.isMeshStandardMaterial?m.environment:null,w=(s.isMeshStandardMaterial?n:t).get(s.envMap||C),_=w&&w.mapping===ge?w.image.height:null,M=A[s.type];null!==s.precision&&(p=r.getMaxPrecision(s.precision),p!==s.precision&&console.warn("THREE.WebGLProgram.getParameters:",s.precision,"not supported, using",p,"instead."));const S=b.morphAttributes.position||b.morphAttributes.normal||b.morphAttributes.color,I=void 0!==S?S.length:0;let B,T,R,L,D=0;if(void 0!==b.morphAttributes.position&&(D=1),void 0!==b.morphAttributes.normal&&(D=2),void 0!==b.morphAttributes.color&&(D=3),M){const e=Mu[M];B=e.vertexShader,T=e.fragmentShader}else B=s.vertexShader,T=s.fragmentShader,l.update(s),R=l.getVertexShaderID(s),L=l.getFragmentShaderID(s);const P=e.getRenderTarget(),U=e.state.buffers.depth.getReversed(),O=P&&P.isWebGLMultiviewRenderTarget?P.numViews:0,F=!0===y.isInstancedMesh,k=!0===y.isBatchedMesh,N=!!s.map,Q=!!s.matcap,G=!!w,z=!!s.aoMap,H=!!s.lightMap,V=!!s.bumpMap,j=!!s.normalMap,W=!!s.displacementMap,q=!!s.emissiveMap,X=!!s.metalnessMap,Y=!!s.roughnessMap,J=s.anisotropy>0,K=s.clearcoat>0,Z=s.dispersion>0,$=s.iridescence>0,ee=s.sheen>0,te=s.transmission>0,ie=J&&!!s.anisotropyMap,re=K&&!!s.clearcoatMap,se=K&&!!s.clearcoatNormalMap,oe=K&&!!s.clearcoatRoughnessMap,ae=$&&!!s.iridescenceMap,le=$&&!!s.iridescenceThicknessMap,ce=ee&&!!s.sheenColorMap,he=ee&&!!s.sheenRoughnessMap,de=!!s.specularMap,ue=!!s.specularColorMap,pe=!!s.specularIntensityMap,Ae=te&&!!s.transmissionMap,fe=te&&!!s.thicknessMap,me=!!s.gradientMap,ve=!!s.alphaMap,ye=s.alphaTest>0,Ee=!!s.alphaHash,xe=!!s.extensions;let be=ne;s.toneMapped&&(null!==P&&!0!==P.isXRRenderTarget||(be=e.toneMapping));const Ce={shaderID:M,shaderType:s.type,shaderName:s.name,vertexShader:B,fragmentShader:T,defines:s.defines,customVertexShaderID:R,customFragmentShaderID:L,isRawShaderMaterial:!0===s.isRawShaderMaterial,glslVersion:s.glslVersion,precision:p,batching:k,batchingColor:k&&null!==y._colorsTexture,instancing:F,instancingColor:F&&null!==y.instanceColor,instancingMorph:F&&null!==y.morphTexture,supportsVertexTextures:u,numMultiviewViews:O,outputColorSpace:null===P?e.outputColorSpace:!0===P.isXRRenderTarget?P.texture.colorSpace:nn,alphaToCoverage:!!s.alphaToCoverage,map:N,matcap:Q,envMap:G,envMapMode:G&&w.mapping,envMapCubeUVHeight:_,aoMap:z,lightMap:H,bumpMap:V,normalMap:j,displacementMap:u&&W,emissiveMap:q,normalMapObjectSpace:j&&s.normalMapType===$t,normalMapTangentSpace:j&&s.normalMapType===Zt,metalnessMap:X,roughnessMap:Y,anisotropy:J,anisotropyMap:ie,clearcoat:K,clearcoatMap:re,clearcoatNormalMap:se,clearcoatRoughnessMap:oe,dispersion:Z,iridescence:$,iridescenceMap:ae,iridescenceThicknessMap:le,sheen:ee,sheenColorMap:ce,sheenRoughnessMap:he,specularMap:de,specularColorMap:ue,specularIntensityMap:pe,transmission:te,transmissionMap:Ae,thicknessMap:fe,gradientMap:me,opaque:!1===s.transparent&&s.blending===E&&!1===s.alphaToCoverage,alphaMap:ve,alphaTest:ye,alphaHash:Ee,combine:s.combine,mapUv:N&&f(s.map.channel),aoMapUv:z&&f(s.aoMap.channel),lightMapUv:H&&f(s.lightMap.channel),bumpMapUv:V&&f(s.bumpMap.channel),normalMapUv:j&&f(s.normalMap.channel),displacementMapUv:W&&f(s.displacementMap.channel),emissiveMapUv:q&&f(s.emissiveMap.channel),metalnessMapUv:X&&f(s.metalnessMap.channel),roughnessMapUv:Y&&f(s.roughnessMap.channel),anisotropyMapUv:ie&&f(s.anisotropyMap.channel),clearcoatMapUv:re&&f(s.clearcoatMap.channel),clearcoatNormalMapUv:se&&f(s.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:oe&&f(s.clearcoatRoughnessMap.channel),iridescenceMapUv:ae&&f(s.iridescenceMap.channel),iridescenceThicknessMapUv:le&&f(s.iridescenceThicknessMap.channel),sheenColorMapUv:ce&&f(s.sheenColorMap.channel),sheenRoughnessMapUv:he&&f(s.sheenRoughnessMap.channel),specularMapUv:de&&f(s.specularMap.channel),specularColorMapUv:ue&&f(s.specularColorMap.channel),specularIntensityMapUv:pe&&f(s.specularIntensityMap.channel),transmissionMapUv:Ae&&f(s.transmissionMap.channel),thicknessMapUv:fe&&f(s.thicknessMap.channel),alphaMapUv:ve&&f(s.alphaMap.channel),vertexTangents:!!b.attributes.tangent&&(j||J),vertexColors:s.vertexColors,vertexAlphas:!0===s.vertexColors&&!!b.attributes.color&&4===b.attributes.color.itemSize,pointsUvs:!0===y.isPoints&&!!b.attributes.uv&&(N||ve),fog:!!x,useFog:!0===s.fog,fogExp2:!!x&&x.isFogExp2,flatShading:!0===s.flatShading,sizeAttenuation:!0===s.sizeAttenuation,logarithmicDepthBuffer:d,reverseDepthBuffer:U,skinning:!0===y.isSkinnedMesh,morphTargets:void 0!==b.morphAttributes.position,morphNormals:void 0!==b.morphAttributes.normal,morphColors:void 0!==b.morphAttributes.color,morphTargetsCount:I,morphTextureStride:D,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numSpotLightMaps:a.spotLightMap.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numSpotLightShadowsWithMaps:a.numSpotLightShadowsWithMaps,numLightProbes:a.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:s.dithering,shadowMapEnabled:e.shadowMap.enabled&&h.length>0,shadowMapType:e.shadowMap.type,toneMapping:be,decodeVideoTexture:N&&!0===s.map.isVideoTexture&&Ai.getTransfer(s.map.colorSpace)===sn,decodeVideoTextureEmissive:q&&!0===s.emissiveMap.isVideoTexture&&Ai.getTransfer(s.emissiveMap.colorSpace)===sn,premultipliedAlpha:s.premultipliedAlpha,doubleSided:s.side===v,flipSided:s.side===g,useDepthPacking:s.depthPacking>=0,depthPacking:s.depthPacking||0,index0AttributeName:s.index0AttributeName,extensionClipCullDistance:xe&&!0===s.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(xe&&!0===s.extensions.multiDraw||k)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:s.customProgramCacheKey()};return Ce.vertexUv1s=c.has(1),Ce.vertexUv2s=c.has(2),Ce.vertexUv3s=c.has(3),c.clear(),Ce},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){a.disableAll(),t.supportsVertexTextures&&a.enable(0),t.instancing&&a.enable(1),t.instancingColor&&a.enable(2),t.instancingMorph&&a.enable(3),t.matcap&&a.enable(4),t.envMap&&a.enable(5),t.normalMapObjectSpace&&a.enable(6),t.normalMapTangentSpace&&a.enable(7),t.clearcoat&&a.enable(8),t.iridescence&&a.enable(9),t.alphaTest&&a.enable(10),t.vertexColors&&a.enable(11),t.vertexAlphas&&a.enable(12),t.vertexUv1s&&a.enable(13),t.vertexUv2s&&a.enable(14),t.vertexUv3s&&a.enable(15),t.vertexTangents&&a.enable(16),t.anisotropy&&a.enable(17),t.alphaHash&&a.enable(18),t.batching&&a.enable(19),t.dispersion&&a.enable(20),t.batchingColor&&a.enable(21),e.push(a.mask),a.disableAll(),t.fog&&a.enable(0),t.useFog&&a.enable(1),t.flatShading&&a.enable(2),t.logarithmicDepthBuffer&&a.enable(3),t.reverseDepthBuffer&&a.enable(4),t.skinning&&a.enable(5),t.morphTargets&&a.enable(6),t.morphNormals&&a.enable(7),t.morphColors&&a.enable(8),t.premultipliedAlpha&&a.enable(9),t.shadowMapEnabled&&a.enable(10),t.doubleSided&&a.enable(11),t.flipSided&&a.enable(12),t.useDepthPacking&&a.enable(13),t.dithering&&a.enable(14),t.transmission&&a.enable(15),t.sheen&&a.enable(16),t.opaque&&a.enable(17),t.pointsUvs&&a.enable(18),t.decodeVideoTexture&&a.enable(19),t.decodeVideoTextureEmissive&&a.enable(20),t.alphaToCoverage&&a.enable(21),t.numMultiviewViews&&a.enable(21),e.push(a.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=A[e.type];let n;if(t){const e=Mu[t];n=qs.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i;for(let e=0,t=h.length;e<t;e++){const t=h[e];if(t.cacheKey===n){i=t,++i.usedTimes;break}}return void 0===i&&(i=new IA(e,n,t,s),h.push(i)),i},releaseProgram:function(e){if(0==--e.usedTimes){const t=h.indexOf(e);h[t]=h[h.length-1],h.pop(),e.destroy()}},releaseShaderCache:function(e){l.remove(e)},programs:h,dispose:function(){l.dispose()}}}function DA(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function PA(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function UA(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function OA(){const e=[];let t=0;const n=[],i=[],r=[];function s(n,i,r,s,o,a){let l=e[t];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:s,renderOrder:n.renderOrder,z:o,group:a},e[t]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=s,l.renderOrder=n.renderOrder,l.z=o,l.group=a),t++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,o,a,l,c){const h=s(e,t,o,a,l,c);o.transmission>0?i.push(h):!0===o.transparent?r.push(h):n.push(h)},unshift:function(e,t,o,a,l,c){const h=s(e,t,o,a,l,c);o.transmission>0?i.unshift(h):!0===o.transparent?r.unshift(h):n.unshift(h)},finish:function(){for(let n=t,i=e.length;n<i;n++){const t=e[n];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function(e,t){n.length>1&&n.sort(e||PA),i.length>1&&i.sort(t||UA),r.length>1&&r.sort(t||UA)}}}function FA(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let r;return void 0===i?(r=new OA,e.set(t,[r])):n>=i.length?(r=new OA,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function kA(){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 Li,color:new es};break;case"SpotLight":n={position:new Li,direction:new Li,color:new es,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Li,color:new es,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Li,skyColor:new es,groundColor:new es};break;case"RectAreaLight":n={color:new es,position:new Li,halfWidth:new Li,halfHeight:new Li}}return e[t.id]=n,n}}}let NA=0;function QA(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function GA(e){const t=new kA,n=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={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ti};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ti,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)i.probe.push(new Li);const r=new Li,s=new lr,o=new lr;return{setup:function(r){let s=0,o=0,a=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let l=0,c=0,h=0,d=0,u=0,p=0,A=0,f=0,m=0,g=0,v=0;r.sort(QA);for(let e=0,y=r.length;e<y;e++){const y=r[e],E=y.color,x=y.intensity,b=y.distance,C=y.shadow&&y.shadow.map?y.shadow.map.texture:null;if(y.isAmbientLight)s+=E.r*x,o+=E.g*x,a+=E.b*x;else if(y.isLightProbe){for(let e=0;e<9;e++)i.probe[e].addScaledVector(y.sh.coefficients[e],x);v++}else if(y.isDirectionalLight){const e=t.get(y);if(e.color.copy(y.color).multiplyScalar(y.intensity),y.castShadow){const e=y.shadow,t=n.get(y);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,i.directionalShadow[l]=t,i.directionalShadowMap[l]=C,i.directionalShadowMatrix[l]=y.shadow.matrix,p++}i.directional[l]=e,l++}else if(y.isSpotLight){const e=t.get(y);e.position.setFromMatrixPosition(y.matrixWorld),e.color.copy(E).multiplyScalar(x),e.distance=b,e.coneCos=Math.cos(y.angle),e.penumbraCos=Math.cos(y.angle*(1-y.penumbra)),e.decay=y.decay,i.spot[h]=e;const r=y.shadow;if(y.map&&(i.spotLightMap[m]=y.map,m++,r.updateMatrices(y),y.castShadow&&g++),i.spotLightMatrix[h]=r.matrix,y.castShadow){const e=n.get(y);e.shadowIntensity=r.intensity,e.shadowBias=r.bias,e.shadowNormalBias=r.normalBias,e.shadowRadius=r.radius,e.shadowMapSize=r.mapSize,i.spotShadow[h]=e,i.spotShadowMap[h]=C,f++}h++}else if(y.isRectAreaLight){const e=t.get(y);e.color.copy(E).multiplyScalar(x),e.halfWidth.set(.5*y.width,0,0),e.halfHeight.set(0,.5*y.height,0),i.rectArea[d]=e,d++}else if(y.isPointLight){const e=t.get(y);if(e.color.copy(y.color).multiplyScalar(y.intensity),e.distance=y.distance,e.decay=y.decay,y.castShadow){const e=y.shadow,t=n.get(y);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,i.pointShadow[c]=t,i.pointShadowMap[c]=C,i.pointShadowMatrix[c]=y.shadow.matrix,A++}i.point[c]=e,c++}else if(y.isHemisphereLight){const e=t.get(y);e.skyColor.copy(y.color).multiplyScalar(x),e.groundColor.copy(y.groundColor).multiplyScalar(x),i.hemi[u]=e,u++}}d>0&&(!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=_u.LTC_FLOAT_1,i.rectAreaLTC2=_u.LTC_FLOAT_2):(i.rectAreaLTC1=_u.LTC_HALF_1,i.rectAreaLTC2=_u.LTC_HALF_2)),i.ambient[0]=s,i.ambient[1]=o,i.ambient[2]=a;const y=i.hash;y.directionalLength===l&&y.pointLength===c&&y.spotLength===h&&y.rectAreaLength===d&&y.hemiLength===u&&y.numDirectionalShadows===p&&y.numPointShadows===A&&y.numSpotShadows===f&&y.numSpotMaps===m&&y.numLightProbes===v||(i.directional.length=l,i.spot.length=h,i.rectArea.length=d,i.point.length=c,i.hemi.length=u,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=A,i.pointShadowMap.length=A,i.spotShadow.length=f,i.spotShadowMap.length=f,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=A,i.spotLightMatrix.length=f+m-g,i.spotLightMap.length=m,i.numSpotLightShadowsWithMaps=g,i.numLightProbes=v,y.directionalLength=l,y.pointLength=c,y.spotLength=h,y.rectAreaLength=d,y.hemiLength=u,y.numDirectionalShadows=p,y.numPointShadows=A,y.numSpotShadows=f,y.numSpotMaps=m,y.numLightProbes=v,i.version=NA++)},setupView:function(e,t){let n=0,a=0,l=0,c=0,h=0;const d=t.matrixWorldInverse;for(let t=0,u=e.length;t<u;t++){const u=e[t];if(u.isDirectionalLight){const e=i.directional[n];e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(d),n++}else if(u.isSpotLight){const e=i.spot[l];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(d),e.direction.setFromMatrixPosition(u.matrixWorld),r.setFromMatrixPosition(u.target.matrixWorld),e.direction.sub(r),e.direction.transformDirection(d),l++}else if(u.isRectAreaLight){const e=i.rectArea[c];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(d),o.identity(),s.copy(u.matrixWorld),s.premultiply(d),o.extractRotation(s),e.halfWidth.set(.5*u.width,0,0),e.halfHeight.set(0,.5*u.height,0),e.halfWidth.applyMatrix4(o),e.halfHeight.applyMatrix4(o),c++}else if(u.isPointLight){const e=i.point[a];e.position.setFromMatrixPosition(u.matrixWorld),e.position.applyMatrix4(d),a++}else if(u.isHemisphereLight){const e=i.hemi[h];e.direction.setFromMatrixPosition(u.matrixWorld),e.direction.transformDirection(d),h++}}},state:i}}function zA(e){const t=new GA(e),n=[],i=[],r={lightsArray:n,shadowsArray:i,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function(e){r.camera=e,n.length=0,i.length=0},state:r,setupLights:function(){t.setup(n)},setupLightsView:function(e){t.setupView(n,e)},pushLight:function(e){n.push(e)},pushShadow:function(e){i.push(e)}}}function HA(e){let t=new WeakMap;return{get:function(n,i=0){const r=t.get(n);let s;return void 0===r?(s=new zA(e),t.set(n,[s])):i>=r.length?(s=new zA(e),r.push(s)):s=r[i],s},dispose:function(){t=new WeakMap}}}function VA(e,t,n){let i=new oa;const r=new ti,s=new ti,o=new wi,a=new Rc({depthPacking:Yt}),l=new Lc,c={},h=n.maxTextureSize,d={[m]:g,[g]:m,[v]:v},u=new Xs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ti},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),A=u.clone();A.defines.HORIZONTAL_PASS=1;const E=new Bs;E.setAttribute("position",new us(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Gs(E,u),b=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=p;let C=this.type;function w(n,i){const s=t.update(x);u.defines.VSM_SAMPLES!==n.blurSamples&&(u.defines.VSM_SAMPLES=n.blurSamples,A.defines.VSM_SAMPLES=n.blurSamples,u.needsUpdate=!0,A.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Mi(r.x,r.y)),u.uniforms.shadow_pass.value=n.map.texture,u.uniforms.resolution.value=n.mapSize,u.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,s,u,x,null),A.uniforms.shadow_pass.value=n.mapPass.texture,A.uniforms.resolution.value=n.mapSize,A.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,s,A,x,null)}function _(t,n,i,r){let s=null;const o=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==o)s=o;else if(s=!0===i.isPointLight?l:a,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0){const e=s.uuid,t=n.uuid;let i=c[e];void 0===i&&(i={},c[e]=i);let r=i[t];void 0===r&&(r=s.clone(),i[t]=r,n.addEventListener("dispose",S)),s=r}return s.visible=n.visible,s.wireframe=n.wireframe,s.side=r===f?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:d[n.side],s.alphaMap=n.alphaMap,s.alphaTest=n.alphaTest,s.map=n.map,s.clipShadows=n.clipShadows,s.clippingPlanes=n.clippingPlanes,s.clipIntersection=n.clipIntersection,s.displacementMap=n.displacementMap,s.displacementScale=n.displacementScale,s.displacementBias=n.displacementBias,s.wireframeLinewidth=n.wireframeLinewidth,s.linewidth=n.linewidth,!0===i.isPointLight&&!0===s.isMeshDistanceMaterial&&(e.properties.get(s).light=i),s}function M(n,r,s,o,a){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&a===f)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,n.matrixWorld);const i=t.update(n),l=n.material;if(Array.isArray(l)){const t=i.groups;for(let c=0,h=t.length;c<h;c++){const h=t[c],d=l[h.materialIndex];if(d&&d.visible){const t=_(n,d,o,a);n.onBeforeShadow(e,n,r,s,i,t,h),e.renderBufferDirect(s,null,i,t,n,h),n.onAfterShadow(e,n,r,s,i,t,h)}}}else if(l.visible){const t=_(n,l,o,a);n.onBeforeShadow(e,n,r,s,i,t,null),e.renderBufferDirect(s,null,i,t,n,null),n.onAfterShadow(e,n,r,s,i,t,null)}}const l=n.children;for(let e=0,t=l.length;e<t;e++)M(l[e],r,s,o,a)}function S(e){e.target.removeEventListener("dispose",S);for(const t in c){const n=c[t],i=e.target.uuid;i in n&&(n[i].dispose(),delete n[i])}}this.render=function(t,n,a){if(!1===b.enabled)return;if(!1===b.autoUpdate&&!1===b.needsUpdate)return;if(0===t.length)return;const l=e.getRenderTarget(),c=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),u=e.state;u.setBlending(y),u.buffers.color.setClear(1,1,1,1),u.buffers.depth.setTest(!0),u.setScissorTest(!1);const p=C!==f&&this.type===f,A=C===f&&this.type!==f;for(let l=0,c=t.length;l<c;l++){const c=t[l],d=c.shadow;if(void 0===d){console.warn("THREE.WebGLShadowMap:",c,"has no shadow.");continue}if(!1===d.autoUpdate&&!1===d.needsUpdate)continue;r.copy(d.mapSize);const m=d.getFrameExtents();if(r.multiply(m),s.copy(d.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/m.x),r.x=s.x*m.x,d.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/m.y),r.y=s.y*m.y,d.mapSize.y=s.y)),null===d.map||!0===p||!0===A){const e=this.type!==f?{minFilter:xe,magFilter:xe}:{};null!==d.map&&d.map.dispose(),d.map=new Mi(r.x,r.y,e),d.map.texture.name=c.name+".shadowMap",d.camera.updateProjectionMatrix()}e.setRenderTarget(d.map),e.clear();const g=d.getViewportCount();for(let e=0;e<g;e++){const t=d.getViewport(e);o.set(s.x*t.x,s.y*t.y,s.x*t.z,s.y*t.w),u.viewport(o),d.updateMatrices(c,e),i=d.getFrustum(),M(n,a,d.camera,c,this.type)}!0!==d.isPointLightShadow&&this.type===f&&w(d,a),d.needsUpdate=!1}C=this.type,b.needsUpdate=!1,e.setRenderTarget(l,c,d)}}const jA={[j]:W,[q]:K,[Y]:Z,[X]:J,[W]:j,[K]:q,[Z]:Y,[J]:X};function WA(e,t){const n=new function(){let t=!1;const n=new wi;let i=null;const r=new wi(0,0,0,0);return{setMask:function(n){i===n||t||(e.colorMask(n,n,n,n),i=n)},setLocked:function(e){t=e},setClear:function(t,i,s,o,a){!0===a&&(t*=o,i*=o,s*=o),n.set(t,i,s,o),!1===r.equals(n)&&(e.clearColor(t,i,s,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},i=new function(){let n=!1,i=!1,r=null,s=null,o=null;return{setReversed:function(e){if(i!==e){const e=t.get("EXT_clip_control");i?e.clipControlEXT(e.LOWER_LEFT_EXT,e.ZERO_TO_ONE_EXT):e.clipControlEXT(e.LOWER_LEFT_EXT,e.NEGATIVE_ONE_TO_ONE_EXT);const n=o;o=null,this.setClear(n)}i=e},getReversed:function(){return i},setTest:function(t){t?_e(e.DEPTH_TEST):Me(e.DEPTH_TEST)},setMask:function(t){r===t||n||(e.depthMask(t),r=t)},setFunc:function(t){if(i&&(t=jA[t]),s!==t){switch(t){case j:e.depthFunc(e.NEVER);break;case W:e.depthFunc(e.ALWAYS);break;case q:e.depthFunc(e.LESS);break;case X:e.depthFunc(e.LEQUAL);break;case Y:e.depthFunc(e.EQUAL);break;case J:e.depthFunc(e.GEQUAL);break;case K:e.depthFunc(e.GREATER);break;case Z:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}s=t}},setLocked:function(e){n=e},setClear:function(t){o!==t&&(i&&(t=1-t),e.clearDepth(t),o=t)},reset:function(){n=!1,r=null,s=null,o=null,i=!1}}},r=new function(){let t=!1,n=null,i=null,r=null,s=null,o=null,a=null,l=null,c=null;return{setTest:function(n){t||(n?_e(e.STENCIL_TEST):Me(e.STENCIL_TEST))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&s===o||(e.stencilFunc(t,n,o),i=t,r=n,s=o)},setOp:function(t,n,i){o===t&&a===n&&l===i||(e.stencilOp(t,n,i),o=t,a=n,l=i)},setLocked:function(e){t=e},setClear:function(t){c!==t&&(e.clearStencil(t),c=t)},reset:function(){t=!1,n=null,i=null,r=null,s=null,o=null,a=null,l=null,c=null}}},s=new WeakMap,o=new WeakMap;let a={},d={},u=new WeakMap,p=[],A=null,f=!1,m=null,$=null,ee=null,te=null,ne=null,ie=null,re=null,se=new es(0,0,0),oe=0,ae=!1,le=null,ce=null,he=null,de=null,ue=null;const pe=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let Ae=!1,fe=0;const me=e.getParameter(e.VERSION);-1!==me.indexOf("WebGL")?(fe=parseFloat(/^WebGL (\d)/.exec(me)[1]),Ae=fe>=1):-1!==me.indexOf("OpenGL ES")&&(fe=parseFloat(/^OpenGL ES (\d)/.exec(me)[1]),Ae=fe>=2);let ge=null,ve={};const ye=e.getParameter(e.SCISSOR_BOX),Ee=e.getParameter(e.VIEWPORT),xe=(new wi).fromArray(ye),be=(new wi).fromArray(Ee);function Ce(t,n,i,r){const s=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o<i;o++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(n,0,e.RGBA,1,1,r,0,e.RGBA,e.UNSIGNED_BYTE,s):e.texImage2D(n+o,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,s);return o}const we={};function _e(t){!0!==a[t]&&(e.enable(t),a[t]=!0)}function Me(t){!1!==a[t]&&(e.disable(t),a[t]=!1)}we[e.TEXTURE_2D]=Ce(e.TEXTURE_2D,e.TEXTURE_2D,1),we[e.TEXTURE_CUBE_MAP]=Ce(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),we[e.TEXTURE_2D_ARRAY]=Ce(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),we[e.TEXTURE_3D]=Ce(e.TEXTURE_3D,e.TEXTURE_3D,1,1),n.setClear(0,0,0,1),i.setClear(1),r.setClear(0),_e(e.DEPTH_TEST),i.setFunc(X),Te(!1),Re(c),_e(e.CULL_FACE),Be(y);const Se={[_]:e.FUNC_ADD,[M]:e.FUNC_SUBTRACT,[S]:e.FUNC_REVERSE_SUBTRACT};Se[I]=e.MIN,Se[B]=e.MAX;const Ie={[T]:e.ZERO,[R]:e.ONE,[L]:e.SRC_COLOR,[P]:e.SRC_ALPHA,[Q]:e.SRC_ALPHA_SATURATE,[k]:e.DST_COLOR,[O]:e.DST_ALPHA,[D]:e.ONE_MINUS_SRC_COLOR,[U]:e.ONE_MINUS_SRC_ALPHA,[N]:e.ONE_MINUS_DST_COLOR,[F]:e.ONE_MINUS_DST_ALPHA,[G]:e.CONSTANT_COLOR,[z]:e.ONE_MINUS_CONSTANT_COLOR,[H]:e.CONSTANT_ALPHA,[V]:e.ONE_MINUS_CONSTANT_ALPHA};function Be(t,n,i,r,s,o,a,l,c,h){if(t!==y){if(!1===f&&(_e(e.BLEND),f=!0),t===w)s=s||n,o=o||i,a=a||r,n===$&&s===ne||(e.blendEquationSeparate(Se[n],Se[s]),$=n,ne=s),i===ee&&r===te&&o===ie&&a===re||(e.blendFuncSeparate(Ie[i],Ie[r],Ie[o],Ie[a]),ee=i,te=r,ie=o,re=a),!1!==l.equals(se)&&c===oe||(e.blendColor(l.r,l.g,l.b,c),se.copy(l),oe=c),m=t,ae=!1;else if(t!==m||h!==ae){if($===_&&ne===_||(e.blendEquation(e.FUNC_ADD),$=_,ne=_),h)switch(t){case E:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case x:e.blendFunc(e.ONE,e.ONE);break;case b:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case C:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case E:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case x:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case b:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case C:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}ee=null,te=null,ie=null,re=null,se.set(0,0,0),oe=0,m=t,ae=h}}else!0===f&&(Me(e.BLEND),f=!1)}function Te(t){le!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),le=t)}function Re(t){t!==l?(_e(e.CULL_FACE),t!==ce&&(t===c?e.cullFace(e.BACK):t===h?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):Me(e.CULL_FACE),ce=t}function Le(t,n,i){t?(_e(e.POLYGON_OFFSET_FILL),de===n&&ue===i||(e.polygonOffset(n,i),de=n,ue=i)):Me(e.POLYGON_OFFSET_FILL)}return{buffers:{color:n,depth:i,stencil:r},enable:_e,disable:Me,bindFramebuffer:function(t,n){return d[t]!==n&&(e.bindFramebuffer(t,n),d[t]=n,t===e.DRAW_FRAMEBUFFER&&(d[e.FRAMEBUFFER]=n),t===e.FRAMEBUFFER&&(d[e.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(t,n){let i=p,r=!1;if(t){i=u.get(n),void 0===i&&(i=[],u.set(n,i));const s=t.textures;if(i.length!==s.length||i[0]!==e.COLOR_ATTACHMENT0){for(let t=0,n=s.length;t<n;t++)i[t]=e.COLOR_ATTACHMENT0+t;i.length=s.length,r=!0}}else i[0]!==e.BACK&&(i[0]=e.BACK,r=!0);r&&e.drawBuffers(i)},useProgram:function(t){return A!==t&&(e.useProgram(t),A=t,!0)},setBlending:Be,setMaterial:function(t,s){t.side===v?Me(e.CULL_FACE):_e(e.CULL_FACE);let o=t.side===g;s&&(o=!o),Te(o),t.blending===E&&!1===t.transparent?Be(y):Be(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),i.setFunc(t.depthFunc),i.setTest(t.depthTest),i.setMask(t.depthWrite),n.setMask(t.colorWrite);const a=t.stencilWrite;r.setTest(a),a&&(r.setMask(t.stencilWriteMask),r.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),r.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),Le(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?_e(e.SAMPLE_ALPHA_TO_COVERAGE):Me(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:Te,setCullFace:Re,setLineWidth:function(t){t!==he&&(Ae&&e.lineWidth(t),he=t)},setPolygonOffset:Le,setScissorTest:function(t){t?_e(e.SCISSOR_TEST):Me(e.SCISSOR_TEST)},activeTexture:function(t){void 0===t&&(t=e.TEXTURE0+pe-1),ge!==t&&(e.activeTexture(t),ge=t)},bindTexture:function(t,n,i){void 0===i&&(i=null===ge?e.TEXTURE0+pe-1:ge);let r=ve[i];void 0===r&&(r={type:void 0,texture:void 0},ve[i]=r),r.type===t&&r.texture===n||(ge!==i&&(e.activeTexture(i),ge=i),e.bindTexture(t,n||we[t]),r.type=t,r.texture=n)},unbindTexture:function(){const t=ve[ge];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function(){try{e.compressedTexImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexImage3D:function(){try{e.compressedTexImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage2D:function(){try{e.texImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texImage3D:function(){try{e.texImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},updateUBOMapping:function(t,n){let i=o.get(n);void 0===i&&(i=new WeakMap,o.set(n,i));let r=i.get(t);void 0===r&&(r=e.getUniformBlockIndex(n,t.name),i.set(t,r))},uniformBlockBinding:function(t,n){const i=o.get(n).get(t);s.get(n)!==i&&(e.uniformBlockBinding(n,i,t.__bindingPointIndex),s.set(n,i))},texStorage2D:function(){try{e.texStorage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texStorage3D:function(){try{e.texStorage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage2D:function(){try{e.texSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},texSubImage3D:function(){try{e.texSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(e){console.error("THREE.WebGLState:",e)}},scissor:function(t){!1===xe.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),xe.copy(t))},viewport:function(t){!1===be.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),be.copy(t))},reset:function(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),i.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),a={},ge=null,ve={},d={},u=new WeakMap,p=[],A=null,f=!1,m=null,$=null,ee=null,te=null,ne=null,ie=null,re=null,se=new es(0,0,0),oe=0,ae=!1,le=null,ce=null,he=null,de=null,ue=null,xe.set(0,0,e.canvas.width,e.canvas.height),be.set(0,0,e.canvas.width,e.canvas.height),n.reset(),i.reset(),r.reset()}}}function qA(e,t,n,i,r,s,o){const a=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=t.has("OCULUS_multiview")?t.get("OCULUS_multiview"):null,h=new ti,d=new WeakMap;let u;const p=new WeakMap;let A=[],f=!1,m=!1;try{m="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function g(e,t){return m?new OffscreenCanvas(e,t):ai("canvas")}function v(e,t,n){let i=1;const r=W(e);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(i*r.width),s=Math.floor(i*r.height);void 0===u&&(u=g(n,s));const o=t?g(n,s):u;return o.width=n,o.height=s,o.getContext("2d").drawImage(e,0,0,n,s),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+s+")."),o}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),e}return e}function y(e){return e.generateMipmaps}function E(t){e.generateMipmap(t)}function x(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function b(n,i,r,s,o=!1){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 a=i;if(i===e.RED&&(r===e.FLOAT&&(a=e.R32F),r===e.HALF_FLOAT&&(a=e.R16F),r===e.UNSIGNED_BYTE&&(a=e.R8)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(a=e.R8UI),r===e.UNSIGNED_SHORT&&(a=e.R16UI),r===e.UNSIGNED_INT&&(a=e.R32UI),r===e.BYTE&&(a=e.R8I),r===e.SHORT&&(a=e.R16I),r===e.INT&&(a=e.R32I)),i===e.RG&&(r===e.FLOAT&&(a=e.RG32F),r===e.HALF_FLOAT&&(a=e.RG16F),r===e.UNSIGNED_BYTE&&(a=e.RG8)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(a=e.RG8UI),r===e.UNSIGNED_SHORT&&(a=e.RG16UI),r===e.UNSIGNED_INT&&(a=e.RG32UI),r===e.BYTE&&(a=e.RG8I),r===e.SHORT&&(a=e.RG16I),r===e.INT&&(a=e.RG32I)),i===e.RGB_INTEGER&&(r===e.UNSIGNED_BYTE&&(a=e.RGB8UI),r===e.UNSIGNED_SHORT&&(a=e.RGB16UI),r===e.UNSIGNED_INT&&(a=e.RGB32UI),r===e.BYTE&&(a=e.RGB8I),r===e.SHORT&&(a=e.RGB16I),r===e.INT&&(a=e.RGB32I)),i===e.RGBA_INTEGER&&(r===e.UNSIGNED_BYTE&&(a=e.RGBA8UI),r===e.UNSIGNED_SHORT&&(a=e.RGBA16UI),r===e.UNSIGNED_INT&&(a=e.RGBA32UI),r===e.BYTE&&(a=e.RGBA8I),r===e.SHORT&&(a=e.RGBA16I),r===e.INT&&(a=e.RGBA32I)),i===e.RGB&&r===e.UNSIGNED_INT_5_9_9_9_REV&&(a=e.RGB9_E5),i===e.RGBA){const t=o?rn:Ai.getTransfer(s);r===e.FLOAT&&(a=e.RGBA32F),r===e.HALF_FLOAT&&(a=e.RGBA16F),r===e.UNSIGNED_BYTE&&(a=t===sn?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT_4_4_4_4&&(a=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(a=e.RGB5_A1)}return a!==e.R16F&&a!==e.R32F&&a!==e.RG16F&&a!==e.RG32F&&a!==e.RGBA16F&&a!==e.RGBA32F||t.get("EXT_color_buffer_float"),a}function C(t,n){let i;return t?null===n||n===Oe||n===Ge?i=e.DEPTH24_STENCIL8:n===Fe?i=e.DEPTH32F_STENCIL8:n===Pe&&(i=e.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===Oe||n===Ge?i=e.DEPTH_COMPONENT24:n===Fe?i=e.DEPTH_COMPONENT32F:n===Pe&&(i=e.DEPTH_COMPONENT16),i}function w(e,t){return!0===y(e)||e.isFramebufferTexture&&e.minFilter!==xe&&e.minFilter!==Me?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function _(e){const t=e.target;t.removeEventListener("dispose",_),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=p.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&S(e),0===Object.keys(r).length&&p.delete(n)}i.remove(e)}(t),t.isVideoTexture&&d.delete(t)}function M(t){const n=t.target;n.removeEventListener("dispose",M),function(t){const n=i.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),i.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let i=0;i<n.__webglFramebuffer[t].length;i++)e.deleteFramebuffer(n.__webglFramebuffer[t][i]);else e.deleteFramebuffer(n.__webglFramebuffer[t]);n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[t])}else{if(Array.isArray(n.__webglFramebuffer))for(let t=0;t<n.__webglFramebuffer.length;t++)e.deleteFramebuffer(n.__webglFramebuffer[t]);else e.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&e.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let t=0;t<n.__webglColorRenderbuffer.length;t++)n.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(n.__webglColorRenderbuffer[t]);n.__webglDepthRenderbuffer&&e.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=t.textures;for(let t=0,n=r.length;t<n;t++){const n=i.get(r[t]);n.__webglTexture&&(e.deleteTexture(n.__webglTexture),o.memory.textures--),i.remove(r[t])}i.remove(t)}(n)}function S(t){const n=i.get(t);e.deleteTexture(n.__webglTexture);const r=t.source;delete p.get(r)[n.__cacheKey],o.memory.textures--}let I=0;function B(t,r){const s=i.get(t);if(t.isVideoTexture&&function(e){const t=o.render.frame;d.get(e)!==t&&(d.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&s.__version!==t.version){const e=t.image;if(null===e)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===e.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else if(O(s,t,r))return}n.bindTexture(e.TEXTURE_2D,s.__webglTexture,e.TEXTURE0+r)}function T(t,r){const s=i.get(t);t.version>0&&s.__version!==t.version?O(s,t,r):n.bindTexture(e.TEXTURE_2D_ARRAY,s.__webglTexture,e.TEXTURE0+r)}const R={[ve]:e.REPEAT,[ye]:e.CLAMP_TO_EDGE,[Ee]:e.MIRRORED_REPEAT},L={[xe]:e.NEAREST,[be]:e.NEAREST_MIPMAP_NEAREST,[we]:e.NEAREST_MIPMAP_LINEAR,[Me]:e.LINEAR,[Se]:e.LINEAR_MIPMAP_NEAREST,[Be]:e.LINEAR_MIPMAP_LINEAR},D={[bn]:e.NEVER,[Bn]:e.ALWAYS,[Cn]:e.LESS,[_n]:e.LEQUAL,[wn]:e.EQUAL,[In]:e.GEQUAL,[Mn]:e.GREATER,[Sn]:e.NOTEQUAL};function P(n,s){if(s.type!==Fe||!1!==t.has("OES_texture_float_linear")||s.magFilter!==Me&&s.magFilter!==Se&&s.magFilter!==we&&s.magFilter!==Be&&s.minFilter!==Me&&s.minFilter!==Se&&s.minFilter!==we&&s.minFilter!==Be||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,R[s.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,R[s.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,R[s.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,L[s.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,L[s.minFilter]),s.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,D[s.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(s.magFilter===xe)return;if(s.minFilter!==we&&s.minFilter!==Be)return;if(s.type===Fe&&!1===t.has("OES_texture_float_linear"))return;if(s.anisotropy>1||i.get(s).__currentAnisotropy){const o=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),i.get(s).__currentAnisotropy=s.anisotropy}}}function U(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",_));const r=n.source;let s=p.get(r);void 0===s&&(s={},p.set(r,s));const a=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(a!==t.__cacheKey){void 0===s[a]&&(s[a]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,i=!0),s[a].usedTimes++;const r=s[t.__cacheKey];void 0!==r&&(s[t.__cacheKey].usedTimes--,0===r.usedTimes&&S(n)),t.__cacheKey=a,t.__webglTexture=s[a].texture}return i}function O(t,o,a){if(f)return o.isPendingDeferredUpload||(o.isPendingDeferredUpload=!0,A.push({textureProperties:t,texture:o,slot:a})),!1;let l=e.TEXTURE_2D;(o.isDataArrayTexture||o.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),o.isData3DTexture&&(l=e.TEXTURE_3D);const c=U(t,o),h=o.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+a);const d=i.get(h);if(h.version!==d.__version||!0===c){n.activeTexture(e.TEXTURE0+a);const t=Ai.getPrimaries(Ai.workingColorSpace),i=o.colorSpace===en?null:Ai.getPrimaries(o.colorSpace),u=o.colorSpace===en||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);let p=v(o.image,!1,r.maxTextureSize);p=j(o,p);const A=s.convert(o.format,o.colorSpace),f=s.convert(o.type);let m,g=b(o.internalFormat,A,f,o.colorSpace,o.isVideoTexture);P(l,o);const x=o.mipmaps,_=!0!==o.isVideoTexture,M=void 0===d.__version||!0===c,S=h.dataReady,I=w(o,p);if(o.isDepthTexture)g=C(o.format===Ye,o.type),M&&(_?n.texStorage2D(e.TEXTURE_2D,1,g,p.width,p.height):n.texImage2D(e.TEXTURE_2D,0,g,p.width,p.height,0,A,f,null));else if(o.isDataTexture)if(x.length>0){_&&M&&n.texStorage2D(e.TEXTURE_2D,I,g,x[0].width,x[0].height);for(let t=0,i=x.length;t<i;t++)m=x[t],_?S&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,m.width,m.height,A,f,m.data):n.texImage2D(e.TEXTURE_2D,t,g,m.width,m.height,0,A,f,m.data);o.generateMipmaps=!1}else _?(M&&n.texStorage2D(e.TEXTURE_2D,I,g,p.width,p.height),S&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,p.width,p.height,A,f,p.data)):n.texImage2D(e.TEXTURE_2D,0,g,p.width,p.height,0,A,f,p.data);else if(o.isCompressedTexture)if(o.isCompressedArrayTexture){_&&M&&n.texStorage3D(e.TEXTURE_2D_ARRAY,I,g,x[0].width,x[0].height,p.depth);for(let t=0,i=x.length;t<i;t++)if(m=x[t],o.format!==je)if(null!==A)if(_){if(S)if(o.layerUpdates.size>0){const i=yu(m.width,m.height,o.format,o.type);for(const r of o.layerUpdates){const s=m.data.subarray(r*i/m.data.BYTES_PER_ELEMENT,(r+1)*i/m.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,r,m.width,m.height,1,A,s)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,m.width,m.height,p.depth,A,m.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,g,m.width,m.height,p.depth,0,m.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else _?S&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,m.width,m.height,p.depth,A,f,m.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,g,m.width,m.height,p.depth,0,A,f,m.data)}else{_&&M&&n.texStorage2D(e.TEXTURE_2D,I,g,x[0].width,x[0].height);for(let t=0,i=x.length;t<i;t++)m=x[t],o.format!==je?null!==A?_?S&&n.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,m.width,m.height,A,m.data):n.compressedTexImage2D(e.TEXTURE_2D,t,g,m.width,m.height,0,m.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):_?S&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,m.width,m.height,A,f,m.data):n.texImage2D(e.TEXTURE_2D,t,g,m.width,m.height,0,A,f,m.data)}else if(o.isDataArrayTexture)if(_){if(M&&n.texStorage3D(e.TEXTURE_2D_ARRAY,I,g,p.width,p.height,p.depth),S)if(o.layerUpdates.size>0){const t=yu(p.width,p.height,o.format,o.type);for(const i of o.layerUpdates){const r=p.data.subarray(i*t/p.data.BYTES_PER_ELEMENT,(i+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,i,p.width,p.height,1,A,f,r)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,A,f,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,g,p.width,p.height,p.depth,0,A,f,p.data);else if(o.isData3DTexture)_?(M&&n.texStorage3D(e.TEXTURE_3D,I,g,p.width,p.height,p.depth),S&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,A,f,p.data)):n.texImage3D(e.TEXTURE_3D,0,g,p.width,p.height,p.depth,0,A,f,p.data);else if(o.isFramebufferTexture){if(M)if(_)n.texStorage2D(e.TEXTURE_2D,I,g,p.width,p.height);else{let t=p.width,i=p.height;for(let r=0;r<I;r++)n.texImage2D(e.TEXTURE_2D,r,g,t,i,0,A,f,null),t>>=1,i>>=1}}else if(x.length>0){if(_&&M){const t=W(x[0]);n.texStorage2D(e.TEXTURE_2D,I,g,t.width,t.height)}for(let t=0,i=x.length;t<i;t++)m=x[t],_?S&&n.texSubImage2D(e.TEXTURE_2D,t,0,0,A,f,m):n.texImage2D(e.TEXTURE_2D,t,g,A,f,m);o.generateMipmaps=!1}else if(_){if(M){const t=W(p);n.texStorage2D(e.TEXTURE_2D,I,g,t.width,t.height)}S&&n.texSubImage2D(e.TEXTURE_2D,0,0,0,A,f,p)}else n.texImage2D(e.TEXTURE_2D,0,g,A,f,p);y(o)&&E(l),d.__version=h.version,o.onUpdate&&o.onUpdate(o)}return t.__version=o.version,!0}function F(t,r,o,l,h,d){const u=s.convert(o.format,o.colorSpace),p=s.convert(o.type),A=b(o.internalFormat,u,p,o.colorSpace),f=i.get(r),m=i.get(o);if(m.__renderTarget=r,!f.__hasExternalTextures){const t=Math.max(1,r.width>>d),i=Math.max(1,r.height>>d);!0===r.isWebGLMultiviewRenderTarget?n.texStorage3D(e.TEXTURE_2D_ARRAY,0,A,r.width,r.height,r.numViews):h===e.TEXTURE_3D||h===e.TEXTURE_2D_ARRAY?n.texImage3D(h,d,A,t,i,r.depth,0,u,p,null):n.texImage2D(h,d,A,t,i,0,u,p,null)}n.bindFramebuffer(e.FRAMEBUFFER,t);const g=V(r);!0===r.isWebGLMultiviewRenderTarget?g?c.framebufferTextureMultisampleMultiviewOVR(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,m.__webglTexture,0,H(r),0,r.numViews):c.framebufferTextureMultiviewOVR(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,m.__webglTexture,0,0,r.numViews):(h===e.TEXTURE_2D||h>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&h<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&(g?a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,h,m.__webglTexture,0,H(r)):e.framebufferTexture2D(e.FRAMEBUFFER,l,h,m.__webglTexture,d)),n.bindFramebuffer(e.FRAMEBUFFER,null)}function k(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),!0===n.isWebGLMultiviewRenderTarget){const t=V(n),r=n.numViews,s=n.depthTexture;let o=e.DEPTH_COMPONENT24,a=e.DEPTH_ATTACHMENT;s&&s.isDepthTexture&&(s.type===Fe?o=e.DEPTH_COMPONENT32F:s.type===Ge&&(o=e.DEPTH24_STENCIL8,a=e.DEPTH_STENCIL_ATTACHMENT));let l=i.get(n.depthTexture).__webglTexture;void 0===l&&(l=e.createTexture(),e.bindTexture(e.TEXTURE_2D_ARRAY,l),e.texStorage3D(e.TEXTURE_2D_ARRAY,1,o,n.width,n.height,r)),t?c.framebufferTextureMultisampleMultiviewOVR(e.FRAMEBUFFER,a,l,0,H(n),0,r):c.framebufferTextureMultiviewOVR(e.FRAMEBUFFER,a,l,0,0,r)}else if(n.depthBuffer&&!n.stencilBuffer){const i=n.depthTexture,s=i&&i.isDepthTexture?i.type:null,o=C(n.stencilBuffer,s),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=H(n);V(n)?a.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,c,o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,c,o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{const t=n.textures;for(let i=0;i<t.length;i++){const o=t[i],l=s.convert(o.format,o.colorSpace),c=s.convert(o.type),h=b(o.internalFormat,l,c,o.colorSpace),d=H(n);r&&!1===V(n)?e.renderbufferStorageMultisample(e.RENDERBUFFER,d,h,n.width,n.height):V(n)?a.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,d,h,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,h,n.width,n.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function N(t,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(e.FRAMEBUFFER,t),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const s=i.get(r.depthTexture);s.__renderTarget=r,s.__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),B(r.depthTexture,0),1!=r.depthTexture.image.depth?T(r.depthTexture,0):B(r.depthTexture,0);const o=s.__webglTexture,l=H(r);if(!0===r.isWebGLMultiviewRenderTarget){const t=V(r),n=r.numViews;if(r.depthTexture.format===Xe)t?c.framebufferTextureMultisampleMultiviewOVR(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,o,0,l,0,n):c.framebufferTextureMultiviewOVR(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,o,0,0,n);else{if(r.depthTexture.format!==Ye)throw new Error("Unknown depthTexture format");t?c.framebufferTextureMultisampleMultiviewOVR(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,o,0,l,0,n):c.framebufferTextureMultiviewOVR(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,o,0,0,n)}}else if(r.depthTexture.format===Xe)V(r)?a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,o,0,l):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,o,0);else{if(r.depthTexture.format!==Ye)throw new Error("Unknown depthTexture format");V(r)?a.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,o,0,l):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,o,0)}}function Q(t){const r=i.get(t),s=!0===t.isWebGLCubeRenderTarget;if(r.__boundDepthTexture!==t.depthTexture){const e=t.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),e){const t=()=>{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),r.__depthDisposeCallback=t}r.__boundDepthTexture=e}if(t.depthTexture&&!r.__autoAllocateDepthBuffer){if(s)throw new Error("target.depthTexture not supported in Cube render targets");N(r.__webglFramebuffer,t)}else if(s){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[i]),void 0===r.__webglDepthbuffer[i])r.__webglDepthbuffer[i]=e.createRenderbuffer(),k(r.__webglDepthbuffer[i],t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,s=r.__webglDepthbuffer[i];e.bindRenderbuffer(e.RENDERBUFFER,s),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,s)}}else if(n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=e.createRenderbuffer(),k(r.__webglDepthbuffer,t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,i=r.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,i)}n.bindFramebuffer(e.FRAMEBUFFER,null)}const G=[],z=[];function H(e){return Math.min(r.maxSamples,e.samples)}function V(e){const n=i.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function j(e,t){const n=e.colorSpace,i=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==nn&&n!==en&&(Ai.getTransfer(n)===sn?i===je&&r===Re||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),t}function W(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(h.width=e.naturalWidth||e.width,h.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(h.width=e.displayWidth,h.height=e.displayHeight):(h.width=e.width,h.height=e.height),h}this.allocateTextureUnit=function(){const e=I;return e>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),I+=1,e},this.resetTextureUnits=function(){I=0},this.setTexture2D=B,this.setTexture2DArray=T,this.setTexture3D=function(t,r){const s=i.get(t);t.version>0&&s.__version!==t.version?O(s,t,r):n.bindTexture(e.TEXTURE_3D,s.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,o){const a=i.get(t);t.version>0&&a.__version!==t.version?function(t,o,a){if(6!==o.image.length)return;const l=U(t,o),c=o.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+a);const h=i.get(c);if(c.version!==h.__version||!0===l){n.activeTexture(e.TEXTURE0+a);const t=Ai.getPrimaries(Ai.workingColorSpace),i=o.colorSpace===en?null:Ai.getPrimaries(o.colorSpace),d=o.colorSpace===en||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,o.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,o.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,o.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);const u=o.isCompressedTexture||o.image[0].isCompressedTexture,p=o.image[0]&&o.image[0].isDataTexture,A=[];for(let e=0;e<6;e++)A[e]=u||p?p?o.image[e].image:o.image[e]:v(o.image[e],!0,r.maxCubemapSize),A[e]=j(o,A[e]);const f=A[0],m=s.convert(o.format,o.colorSpace),g=s.convert(o.type),x=b(o.internalFormat,m,g,o.colorSpace),C=!0!==o.isVideoTexture,_=void 0===h.__version||!0===l,M=c.dataReady;let S,I=w(o,f);if(P(e.TEXTURE_CUBE_MAP,o),u){C&&_&&n.texStorage2D(e.TEXTURE_CUBE_MAP,I,x,f.width,f.height);for(let t=0;t<6;t++){S=A[t].mipmaps;for(let i=0;i<S.length;i++){const r=S[i];o.format!==je?null!==m?C?M&&n.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,m,r.data):n.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,x,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):C?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,0,0,r.width,r.height,m,g,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i,x,r.width,r.height,0,m,g,r.data)}}}else{if(S=o.mipmaps,C&&_){S.length>0&&I++;const t=W(A[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,I,x,t.width,t.height)}for(let t=0;t<6;t++)if(p){C?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,A[t].width,A[t].height,m,g,A[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,x,A[t].width,A[t].height,0,m,g,A[t].data);for(let i=0;i<S.length;i++){const r=S[i].image[t].image;C?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,r.width,r.height,m,g,r.data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,x,r.width,r.height,0,m,g,r.data)}}else{C?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m,g,A[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,x,m,g,A[t]);for(let i=0;i<S.length;i++){const r=S[i];C?M&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,0,0,m,g,r.image[t]):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,i+1,x,m,g,r.image[t])}}}y(o)&&E(e.TEXTURE_CUBE_MAP),h.__version=c.version,o.onUpdate&&o.onUpdate(o)}t.__version=o.version}(a,t,o):n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+o)},this.rebindTextures=function(t,n,r){const s=i.get(t);void 0!==n&&F(s.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==r&&Q(t)},this.uploadTexture=O,this.setupRenderTarget=function(t){const r=t.texture,a=i.get(t),l=i.get(r);t.addEventListener("dispose",M);const c=t.textures,h=!0===t.isWebGLCubeRenderTarget,d=c.length>1;if(d||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,o.memory.textures++),h){a.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){a.__webglFramebuffer[t]=[];for(let n=0;n<r.mipmaps.length;n++)a.__webglFramebuffer[t][n]=e.createFramebuffer()}else a.__webglFramebuffer[t]=e.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){a.__webglFramebuffer=[];for(let t=0;t<r.mipmaps.length;t++)a.__webglFramebuffer[t]=e.createFramebuffer()}else a.__webglFramebuffer=e.createFramebuffer();if(d)for(let t=0,n=c.length;t<n;t++){const n=i.get(c[t]);void 0===n.__webglTexture&&(n.__webglTexture=e.createTexture(),o.memory.textures++)}if(t.samples>0&&!1===V(t)){a.__webglMultisampledFramebuffer=e.createFramebuffer(),a.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,a.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const i=c[n];a.__webglColorRenderbuffer[n]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,a.__webglColorRenderbuffer[n]);const r=s.convert(i.format,i.colorSpace),o=s.convert(i.type),l=b(i.internalFormat,r,o,i.colorSpace,!0===t.isXRRenderTarget),h=H(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,h,l,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+n,e.RENDERBUFFER,a.__webglColorRenderbuffer[n])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(a.__webglDepthRenderbuffer=e.createRenderbuffer(),k(a.__webglDepthRenderbuffer,t,!0)),n.bindFramebuffer(e.FRAMEBUFFER,null)}}if(h){n.bindTexture(e.TEXTURE_CUBE_MAP,l.__webglTexture),P(e.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)F(a.__webglFramebuffer[n][i],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else F(a.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);y(r)&&E(e.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(d){for(let r=0,s=c.length;r<s;r++){const s=c[r],o=i.get(s);n.bindTexture(e.TEXTURE_2D,o.__webglTexture),P(e.TEXTURE_2D,s),F(a.__webglFramebuffer,t,s,e.COLOR_ATTACHMENT0+r,e.TEXTURE_2D,0),y(s)&&E(e.TEXTURE_2D)}n.unbindTexture()}else{let i=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(i=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),!0===t.isWebGLMultiviewRenderTarget&&(i=e.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),P(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)F(a.__webglFramebuffer[n],t,r,e.COLOR_ATTACHMENT0,i,n);else F(a.__webglFramebuffer,t,r,e.COLOR_ATTACHMENT0,i,0);y(r)&&E(i),n.unbindTexture()}(t.depthBuffer||!0===t.isWebGLMultiviewRenderTarget)&&this.setupDepthRenderbuffer(t)},this.updateRenderTargetMipmap=function(e){const t=e.textures;for(let r=0,s=t.length;r<s;r++){const s=t[r];if(y(s)){const t=x(e),r=i.get(s).__webglTexture;n.bindTexture(t,r),E(t),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(t){if(t.samples>0)if(!1===V(t)){const r=t.textures,s=t.width,o=t.height;let a=e.COLOR_BUFFER_BIT;const c=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=i.get(t),d=r.length>1;if(d)for(let t=0;t<r.length;t++)n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);n.bindFramebuffer(e.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let n=0;n<r.length;n++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(a|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(a|=e.STENCIL_BUFFER_BIT)),d){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,h.__webglColorRenderbuffer[n]);const t=i.get(r[n]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,s,o,0,0,s,o,a,e.NEAREST),!0===l&&(G.length=0,z.length=0,G.push(e.COLOR_ATTACHMENT0+n),t.depthBuffer&&!1===t.resolveDepthBuffer&&(G.push(c),z.push(c),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,z)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,G))}if(n.bindFramebuffer(e.READ_FRAMEBUFFER,null),n.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),d)for(let t=0;t<r.length;t++){n.bindFramebuffer(e.FRAMEBUFFER,h.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,h.__webglColorRenderbuffer[t]);const s=i.get(r[t]).__webglTexture;n.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,s,0)}n.bindFramebuffer(e.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&l){const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[n])}},this.setupDepthTexture=N,this.setupDepthRenderbuffer=Q,this.setupFrameBufferTexture=F,this.useMultisampledRTT=V,this.runDeferredUploads=function(){const e=f;f=!1;for(const e of A)O(e.textureProperties,e.texture,e.slot),e.texture.isPendingDeferredUpload=!1;A=[],f=e},this.setDeferTextureUploads=function(e){f=e}}function XA(e,t){return{convert:function(n,i=en){let r;const s=Ai.getTransfer(i);if(n===Re)return e.UNSIGNED_BYTE;if(n===Ne)return e.UNSIGNED_SHORT_4_4_4_4;if(n===Qe)return e.UNSIGNED_SHORT_5_5_5_1;if(n===ze)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===Le)return e.BYTE;if(n===De)return e.SHORT;if(n===Pe)return e.UNSIGNED_SHORT;if(n===Ue)return e.INT;if(n===Oe)return e.UNSIGNED_INT;if(n===Fe)return e.FLOAT;if(n===ke)return e.HALF_FLOAT;if(n===He)return e.ALPHA;if(n===Ve)return e.RGB;if(n===je)return e.RGBA;if(n===We)return e.LUMINANCE;if(n===qe)return e.LUMINANCE_ALPHA;if(n===Xe)return e.DEPTH_COMPONENT;if(n===Ye)return e.DEPTH_STENCIL;if(n===Je)return e.RED;if(n===Ke)return e.RED_INTEGER;if(n===Ze)return e.RG;if(n===$e)return e.RG_INTEGER;if(n===tt)return e.RGBA_INTEGER;if(n===nt||n===it||n===rt||n===st)if(s===sn){if(r=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===nt)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===it)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===rt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===st)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=t.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===nt)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===it)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===rt)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===st)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===ot||n===at||n===lt||n===ct){if(r=t.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===ot)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===at)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===lt)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===ct)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===ht||n===dt||n===ut){if(r=t.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===ht||n===dt)return s===sn?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===ut)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===pt||n===At||n===ft||n===mt||n===gt||n===vt||n===yt||n===Et||n===xt||n===bt||n===Ct||n===wt||n===_t||n===Mt){if(r=t.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===pt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===At)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===ft)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===mt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===gt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===vt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===yt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Et)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===xt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===bt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ct)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===wt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===_t)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Mt)return s===sn?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===St||n===It||n===Bt){if(r=t.get("EXT_texture_compression_bptc"),null===r)return null;if(n===St)return s===sn?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===It)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Bt)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===Tt||n===Rt||n===Lt||n===Dt){if(r=t.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===St)return r.COMPRESSED_RED_RGTC1_EXT;if(n===Rt)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Lt)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Dt)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===Ge?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}class YA extends Mi{constructor(e,t,n,i={}){super(e,t,i),this.depthBuffer=!1,this.stencilBuffer=!1,this.numViews=n}copy(e){return super.copy(e),this.numViews=e.numViews,this}}YA.prototype.isWebGLMultiviewRenderTarget=!0;const JA={type:"move"};class KA{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new Wa,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new Wa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Li,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Li),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new Wa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Li,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Li),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,n){let i=null,r=null,s=null;const o=this._targetRay,a=this._grip,l=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(l&&e.hand){s=!0;for(const i of e.hand.values()){const e=t.getJointPose(i,n),r=this._getHandJoint(l,i);null!==e&&(r.matrix.fromArray(e.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=e.radius),r.visible=null!==e}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],o=i.position.distanceTo(r.position),a=.02,c=.005;l.inputState.pinching&&o>a+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&o<=a-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==a&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1));null!==o&&(i=t.getPose(e.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(JA)))}return null!==o&&(o.visible=null!==i),null!==a&&(a.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new Wa;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class ZA{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(null===this.texture){const i=new Ci;e.properties.get(i).__webglTexture=t.texture,t.depthNear==n.depthNear&&t.depthFar==n.depthFar||(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(null!==this.texture&&null===this.mesh){const t=e.cameras[0].viewport,n=new Xs({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new Gs(new uc(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class $A extends Hn{constructor(e,t,n,i){super();const r=this;let s=null,o=1;var a=null;let l=null,c="local-floor",h=1,d=null,u=null;var p=[];let A=null,f=null,m=null,g=null;const v=new ZA,y=t.getContextAttributes();let E=null,x=null;const b=[],C=[],w=new ti;let _=null;const M=new $s;M.viewport=new wi;const S=new $s;S.viewport=new wi;const I=[M,S],B=new Jh;let T=null,R=null;function L(e){const t=C.indexOf(e.inputSource);if(-1===t)return;const n=b[t];void 0!==n&&(n.update(e.inputSource,e.frame,d||l),n.dispatchEvent({type:e.type,data:e.inputSource}))}function D(){s.removeEventListener("select",L),s.removeEventListener("selectstart",L),s.removeEventListener("selectend",L),s.removeEventListener("squeeze",L),s.removeEventListener("squeezestart",L),s.removeEventListener("squeezeend",L),s.removeEventListener("end",D),s.removeEventListener("inputsourceschange",P);for(let e=0;e<b.length;e++){const t=C[e];null!==t&&(C[e]=null,b[e].disconnect(t))}T=null,R=null,v.reset(),e.setRenderTarget(E),m=null,f=null,A=null,s=null,x=null,N.stop(),r.isPresenting=!1,e.setPixelRatio(_),e.setSize(w.width,w.height,!1),r.dispatchEvent({type:"sessionend"})}function P(e){for(let t=0;t<e.removed.length;t++){const n=e.removed[t],i=C.indexOf(n);i>=0&&(C[i]=null,b[i].disconnect(n))}for(let t=0;t<e.added.length;t++){const n=e.added[t];let i=C.indexOf(n);if(-1===i){for(let e=0;e<b.length;e++){if(e>=C.length){C.push(n),i=e;break}if(null===C[e]){C[e]=n,i=e;break}}if(-1===i)break}const r=b[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.layersEnabled=!1,this.enabled=!1,this.isPresenting=!1,this.isMultiview=!1,this.getCameraPose=function(){return u},this.getController=function(e){let t=b[e];return void 0===t&&(t=new KA,b[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=b[e];return void 0===t&&(t=new KA,b[e]=t),t.getGripSpace()},this.getHand=function(e){let t=b[e];return void 0===t&&(t=new KA,b[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){o=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){c=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||l},this.setReferenceSpace=function(e){d=e},this.getBaseLayer=function(){return null!==f?f:m},this.getBinding=function(){return A},this.getFrame=function(){return g},this.getSession=function(){return s},this.setSession=async function(a){if(s=a,null!==s){if(E=e.getRenderTarget(),s.addEventListener("select",L),s.addEventListener("selectstart",L),s.addEventListener("selectend",L),s.addEventListener("squeeze",L),s.addEventListener("squeezestart",L),s.addEventListener("squeezeend",L),s.addEventListener("end",D),s.addEventListener("inputsourceschange",P),!0!==y.xrCompatible&&await t.makeXRCompatible(),_=e.getPixelRatio(),e.getSize(w),void 0===s.renderState.layers){const n={antialias:y.antialias,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:o};m=new XRWebGLLayer(s,t,n),s.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),x=new Mi(m.framebufferWidth,m.framebufferHeight,{format:je,type:Re,colorSpace:e.outputColorSpace,stencilBuffer:y.stencil})}else{let a=null,l=null,c=null;y.depth&&(c=y.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,a=y.stencil?Ye:Xe,l=y.stencil?Ge:Oe),r.isMultiview=i&&n.has("OCULUS_multiview");const h={colorFormat:t.RGBA8,depthFormat:c,scaleFactor:o};r.isMultiview&&(h.textureType="texture-array"),A=new XRWebGLBinding(s,t),f=A.createProjectionLayer(h),s.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1);const d={format:je,type:Re,depthTexture:new $a(f.textureWidth,f.textureHeight,l,void 0,void 0,void 0,void 0,void 0,void 0,a),stencilBuffer:y.stencil,colorSpace:e.outputColorSpace,samples:y.antialias?4:0,resolveDepthBuffer:!1===f.ignoreDepthValues};if(r.isMultiview){const e=n.get("OCULUS_multiview");this.maxNumViews=t.getParameter(e.MAX_VIEWS_OVR),x=new YA(f.textureWidth,f.textureHeight,2,d)}else x=new Mi(f.textureWidth,f.textureHeight,d)}x.isXRRenderTarget=!0,this.setFoveation(h),d=null,l=await s.requestReferenceSpace(c),N.setContext(s),N.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==s)return s.environmentBlendMode},this.addLayer=function(e){window.XRWebGLBinding&&this.layersEnabled&&s&&(p.push(e),this.updateLayers())},this.removeLayer=function(e){p.splice(p.indexOf(e),1),window.XRWebGLBinding&&this.layersEnabled&&s&&this.updateLayers()},this.updateLayers=function(){var e=p.map((function(e){return e}));e.unshift(s.renderState.layers[0]),s.updateRenderState({layers:e})},this.getDepthTexture=function(){return v.getDepthTexture()};const U=new Li,O=new Li;function F(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.setPoseTarget=function(e){void 0!==e&&(a=e)},this.updateCamera=function(e){if(null===s)return;let t=e.near,n=e.far;null!==v.texture&&(v.depthNear>0&&(t=v.depthNear),v.depthFar>0&&(n=v.depthFar)),B.near=S.near=M.near=t,B.far=S.far=M.far=n,T===B.near&&R===B.far||(s.updateRenderState({depthNear:B.near,depthFar:B.far}),T=B.near,R=B.far),M.layers.mask=2|e.layers.mask,S.layers.mask=4|e.layers.mask,B.layers.mask=M.layers.mask|S.layers.mask;const i=B.cameras;var r=a||e;const o=r.parent;F(B,o);for(let e=0;e<i.length;e++)F(i[e],o);2===i.length?function(e,t,n){U.setFromMatrixPosition(t.matrixWorld),O.setFromMatrixPosition(n.matrixWorld);const i=U.distanceTo(O),r=t.projectionMatrix.elements,s=n.projectionMatrix.elements,o=r[14]/(r[10]-1),a=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],d=(s[8]+1)/s[0],u=o*h,p=o*d,A=i/(-h+d),f=A*-h;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(f),e.translateZ(A),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===r[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{const t=o+A,n=a+A,r=u-f,s=p+(i-f),h=l*a/n*t,d=c*a/n*t;e.projectionMatrix.makePerspective(r,s,h,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(B,M,S):B.projectionMatrix.copy(M.projectionMatrix),function(e,t,n){t.matrixWorld.decompose(t.position,t.quaternion,t.scale),null===n.parent?n.matrix.copy(t.matrixWorld):(n.matrix.copy(n.parent.matrixWorld),n.matrix.invert(),n.matrix.multiply(t.matrixWorld)),n.matrix.decompose(n.position,n.quaternion,n.scale),n.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*qn*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,B,r)},this.getCamera=function(){return B},this.getFoveation=function(){if(null!==f||null!==m)return h},this.setFoveation=function(e){h=e,null!==f&&(f.fixedFoveation=e),null!==m&&void 0!==m.fixedFoveation&&(m.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==v.texture},this.getDepthSensingMesh=function(){return v.getMesh(B)};let k=null;const N=new bu;N.setAnimationLoop((function(t,n){if(u=n.getViewerPose(d||l),g=n,null!==u){const t=u.views;null!==m&&(e.setRenderTargetFramebuffer(x,m.framebuffer),e.setRenderTarget(x));let n=!1;t.length!==B.cameras.length&&(B.cameras.length=0,n=!0);for(let i=0;i<t.length;i++){const r=t[i];let s=null;if(null!==m)s=m.getViewport(r);else{const t=A.getViewSubImage(f,r);s=t.viewport,0===i&&(e.setRenderTargetTextures(x,t.colorTexture,f.ignoreDepthValues?void 0:t.depthStencilTexture),e.setRenderTarget(x))}let o=I[i];void 0===o&&(o=new $s,o.layers.enable(i),o.viewport=new wi,I[i]=o),o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.quaternion,o.scale),o.projectionMatrix.fromArray(r.projectionMatrix),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),o.viewport.set(s.x,s.y,s.width,s.height),0===i&&(B.matrix.copy(o.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),!0===n&&B.cameras.push(o)}const i=s.enabledFeatures;if(i&&i.includes("depth-sensing")){const n=A.getDepthInformation(t[0]);n&&n.isValid&&n.texture&&v.init(e,n,s.renderState)}}for(let e=0;e<b.length;e++){const t=C[e],i=b[e];null!==t&&void 0!==i&&i.update(t,n,d||l)}k&&k(t,n),n.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:n}),g=null})),this.setAnimationLoop=function(e){k=e},this.dispose=function(){}}}const ef=new vr,tf=new lr;function nf(e,t){function n(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function i(e,i){e.opacity.value=i.opacity,i.color&&e.diffuse.value.copy(i.color),i.emissive&&e.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(e.map.value=i.map,n(i.map,e.mapTransform)),i.alphaMap&&(e.alphaMap.value=i.alphaMap,n(i.alphaMap,e.alphaMapTransform)),i.bumpMap&&(e.bumpMap.value=i.bumpMap,n(i.bumpMap,e.bumpMapTransform),e.bumpScale.value=i.bumpScale,i.side===g&&(e.bumpScale.value*=-1)),i.normalMap&&(e.normalMap.value=i.normalMap,n(i.normalMap,e.normalMapTransform),e.normalScale.value.copy(i.normalScale),i.side===g&&e.normalScale.value.negate()),i.displacementMap&&(e.displacementMap.value=i.displacementMap,n(i.displacementMap,e.displacementMapTransform),e.displacementScale.value=i.displacementScale,e.displacementBias.value=i.displacementBias),i.emissiveMap&&(e.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,e.emissiveMapTransform)),i.specularMap&&(e.specularMap.value=i.specularMap,n(i.specularMap,e.specularMapTransform)),i.alphaTest>0&&(e.alphaTest.value=i.alphaTest);const r=t.get(i),s=r.envMap,o=r.envMapRotation;s&&(e.envMap.value=s,ef.copy(o),ef.x*=-1,ef.y*=-1,ef.z*=-1,s.isCubeTexture&&!1===s.isRenderTargetTexture&&(ef.y*=-1,ef.z*=-1),e.envMapRotation.value.setFromMatrix4(tf.makeRotationFromEuler(ef)),e.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,Ws(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,s,o,a){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(e,r):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(i(e,r),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===g&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,a)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,s,o):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function rf(e,t,n,i){let r={},s={},o=[];const a=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,i){const r=e.value,s=t+"_"+n;if(void 0===i[s])return i[s]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const e=i[s];if("number"==typeof r||"boolean"==typeof r){if(e!==r)return i[s]=r,!0}else if(!1===e.equals(r))return e.copy(r),!0}return!1}function c(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function h(t){const n=t.target;n.removeEventListener("dispose",h);const i=o.indexOf(n.__bindingPointIndex);o.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete s[n.id]}return{bind:function(e,t){const n=t.program;i.uniformBlockBinding(e,n)},update:function(n,d){let u=r[n.id];void 0===u&&(function(e){const t=e.uniforms;let n=0;for(let e=0,i=t.length;e<i;e++){const i=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=i.length;e<t;e++){const t=i[e],r=Array.isArray(t.value)?t.value:[t.value];for(let e=0,i=r.length;e<i;e++){const i=c(r[e]),s=n%16,o=s%i.boundary,a=s+o;n+=o,0!==a&&16-a<i.storage&&(n+=16-a),t.__data=new Float32Array(i.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=n,n+=i.storage}}}const i=n%16;i>0&&(n+=16-i),e.__size=n,e.__cache={}}(n),u=function(t){const n=function(){for(let e=0;e<a;e++)if(-1===o.indexOf(e))return o.push(e),e;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=n;const i=e.createBuffer(),r=t.__size,s=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,i),e.bufferData(e.UNIFORM_BUFFER,r,s),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=u,n.addEventListener("dispose",h));const p=d.program;i.updateUBOMapping(n,p);const A=t.render.frame;s[n.id]!==A&&(function(t){const n=r[t.id],i=t.uniforms,s=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let t=0,n=i.length;t<n;t++){const n=Array.isArray(i[t])?i[t]:[i[t]];for(let i=0,r=n.length;i<r;i++){const r=n[i];if(!0===l(r,t,i,s)){const t=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let s=0;s<n.length;s++){const o=n[s],a=c(o);"number"==typeof o||"boolean"==typeof o?(r.__data[0]=o,e.bufferSubData(e.UNIFORM_BUFFER,t+i,r.__data)):o.isMatrix3?(r.__data[0]=o.elements[0],r.__data[1]=o.elements[1],r.__data[2]=o.elements[2],r.__data[3]=0,r.__data[4]=o.elements[3],r.__data[5]=o.elements[4],r.__data[6]=o.elements[5],r.__data[7]=0,r.__data[8]=o.elements[6],r.__data[9]=o.elements[7],r.__data[10]=o.elements[8],r.__data[11]=0):(o.toArray(r.__data,i),i+=a.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,r.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(n),s[n.id]=A)},dispose:function(){for(const t in r)e.deleteBuffer(r[t]);o=[],r={},s={}}}}class sf{constructor(e={}){const{canvas:t=li(),context:n=null,depth:i=!0,stencil:r=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1,reverseDepthBuffer:u=!1,multiviewStereo:p=!1}=e;let A;if(this.isWebGLRenderer=!0,null!==n){if("undefined"!=typeof WebGLRenderingContext&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");A=n.getContextAttributes().alpha}else A=o;const f=new Uint32Array(4),y=new Int32Array(4);let E=null,x=null;const b=[],C=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=tn,this.toneMapping=ne,this.toneMappingExposure=1;const w=this;let _=!1,M=0,S=0,I=null,B=-1,T=null;const R=new wi,L=new wi;let D=null;const P=new es(0);let U=0,O=t.width,F=t.height,k=1,N=null,Q=null;const G=new wi(0,0,O,F),z=new wi(0,0,O,F);let H=!1;const V=new oa;let j=!1,W=!1;const q=new lr,X=new lr,Y=new Li,J=new wi,K={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Z=!1;function $(){return null===I?k:1}let ee,te,ie,re,se,oe,ae,le,ce,he,de,ue,pe,Ae,fe,me,ge,ve,ye,Ee,xe,be,Ce,we,_e,Me=n;function Se(e,n){return t.getContext(e,n)}try{const e={alpha:!0,depth:i,stencil:r,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:h,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${s}`),t.addEventListener("webglcontextlost",Le,!1),t.addEventListener("webglcontextrestored",De,!1),t.addEventListener("webglcontextcreationerror",Ue,!1),null===Me){const t="webgl2";if(Me=Se(t,e),null===Me)throw Se(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(e){throw console.error("THREE.WebGLRenderer: "+e.message),e}function Ie(){ee=new Zu(Me),ee.init(),Ce=new XA(Me,ee),te=new Du(Me,ee,e,Ce),ie=new WA(Me,ee),te.reverseDepthBuffer&&u&&ie.buffers.depth.setReversed(!0),re=new tp(Me),se=new DA,oe=new qA(Me,ee,ie,se,te,Ce,re),ae=new Uu(w),le=new Ku(w),ce=new Cu(Me),we=new Ru(Me,ce),he=new $u(Me,ce,re,we),de=new rp(Me,he,ce,re),Ee=new np(Me,te,oe),me=new Pu(se),ue=new LA(w,ae,le,ee,te,we,me),pe=new nf(w,se),Ae=new FA,fe=new HA(ee),ye=new Tu(w,ae,le,ie,de,A,l),ve=new ip(w,ee,Me),ge=new VA(w,de,te),_e=new rf(Me,re,te,ie),xe=new Lu(Me,ee,re),be=new ep(Me,ee,re),re.programs=ue.programs,w.capabilities=te,w.extensions=ee,w.properties=se,w.renderLists=Ae,w.shadowMap=ge,w.state=ie,w.info=re}Ie();const Te=new $A(w,Me);function Le(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),_=!0}function De(){console.log("THREE.WebGLRenderer: Context Restored."),_=!1;const e=re.autoReset,t=ge.enabled,n=ge.autoUpdate,i=ge.needsUpdate,r=ge.type;Ie(),re.autoReset=e,ge.enabled=t,ge.autoUpdate=n,ge.needsUpdate=i,ge.type=r}function Ue(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function Fe(e){const t=e.target;t.removeEventListener("dispose",Fe),function(e){(function(e){const t=se.get(e).programs;void 0!==t&&(t.forEach((function(e){ue.releaseProgram(e)})),e.isShaderMaterial&&ue.releaseShaderCache(e))})(e),se.remove(e)}(t)}function ze(e,t,n){!0===e.transparent&&e.side===v&&!1===e.forceSinglePass?(e.side=g,e.needsUpdate=!0,et(e,t,n),e.side=m,e.needsUpdate=!0,et(e,t,n),e.side=v):et(e,t,n)}this.xr=Te,this.getContext=function(){return Me},this.getContextAttributes=function(){return Me.getContextAttributes()},this.forceContextLoss=function(){const e=ee.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=ee.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return k},this.setPixelRatio=function(e){void 0!==e&&(k=e,this.setSize(O,F,!1))},this.getSize=function(e){return e.set(O,F)},this.setSize=function(e,n,i=!0){Te.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(O=e,F=n,t.width=Math.floor(e*k),t.height=Math.floor(n*k),!0===i&&(t.style.width=e+"px",t.style.height=n+"px"),this.setViewport(0,0,e,n))},this.getDrawingBufferSize=function(e){return e.set(O*k,F*k).floor()},this.setDrawingBufferSize=function(e,n,i){O=e,F=n,k=i,t.width=Math.floor(e*i),t.height=Math.floor(n*i),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(R)},this.getViewport=function(e){return e.copy(G)},this.setViewport=function(e,t,n,i){e.isVector4?G.set(e.x,e.y,e.z,e.w):G.set(e,t,n,i),ie.viewport(R.copy(G).multiplyScalar(k).round())},this.getScissor=function(e){return e.copy(z)},this.setScissor=function(e,t,n,i){e.isVector4?z.set(e.x,e.y,e.z,e.w):z.set(e,t,n,i),ie.scissor(L.copy(z).multiplyScalar(k).round())},this.getScissorTest=function(){return H},this.setScissorTest=function(e){ie.setScissorTest(H=e)},this.setOpaqueSort=function(e){N=e},this.setTransparentSort=function(e){Q=e},this.getClearColor=function(e){return e.copy(ye.getClearColor())},this.setClearColor=function(){ye.setClearColor.apply(ye,arguments)},this.getClearAlpha=function(){return ye.getClearAlpha()},this.setClearAlpha=function(){ye.setClearAlpha.apply(ye,arguments)},this.clear=function(e=!0,t=!0,n=!0){let i=0;if(e){let e=!1;if(null!==I){const t=I.texture.format;e=t===tt||t===$e||t===Ke}if(e){const e=I.texture.type,t=e===Re||e===Oe||e===Pe||e===Ge||e===Ne||e===Qe,n=ye.getClearColor(),i=ye.getClearAlpha(),r=n.r,s=n.g,o=n.b;t?(f[0]=r,f[1]=s,f[2]=o,f[3]=i,Me.clearBufferuiv(Me.COLOR,0,f)):(y[0]=r,y[1]=s,y[2]=o,y[3]=i,Me.clearBufferiv(Me.COLOR,0,y))}else i|=Me.COLOR_BUFFER_BIT}t&&(i|=Me.DEPTH_BUFFER_BIT),n&&(i|=Me.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Me.clear(i)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Le,!1),t.removeEventListener("webglcontextrestored",De,!1),t.removeEventListener("webglcontextcreationerror",Ue,!1),ye.dispose(),Ae.dispose(),fe.dispose(),se.dispose(),ae.dispose(),le.dispose(),de.dispose(),we.dispose(),_e.dispose(),ue.dispose(),Te.dispose(),Te.removeEventListener("sessionstart",Ve),Te.removeEventListener("sessionend",je),We.stop()},this.renderBufferDirect=function(e,t,n,i,r,s){null===t&&(t=K);const o=r.isMesh&&r.matrixWorld.determinant()<0,a=function(e,t,n,i,r){!0!==t.isScene&&(t=K),oe.resetTextureUnits();const s=t.fog,o=i.isMeshStandardMaterial?t.environment:null,a=null===I?w.outputColorSpace:!0===I.isXRRenderTarget?I.texture.colorSpace:nn,l=(i.isMeshStandardMaterial?le:ae).get(i.envMap||o),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),d=!!n.morphAttributes.position,u=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let A=ne;i.toneMapped&&(null!==I&&!0!==I.isXRRenderTarget||(A=w.toneMapping));const f=I&&I.isWebGLMultiviewRenderTarget?I.numViews:0,m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,g=void 0!==m?m.length:0,v=se.get(i),y=x.state.lights;if(!0===j&&(!0===W||e!==T)){const t=e===T&&i.id===B;me.setState(i,e,t)}let E=!1;i.version===v.__version?v.needsLights&&v.lightsStateVersion!==y.state.version||v.outputColorSpace!==a||r.isBatchedMesh&&!1===v.batching?E=!0:r.isBatchedMesh||!0!==v.batching?r.isBatchedMesh&&!0===v.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===v.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===v.instancing?E=!0:r.isInstancedMesh||!0!==v.instancing?r.isSkinnedMesh&&!1===v.skinning?E=!0:r.isSkinnedMesh||!0!==v.skinning?r.isInstancedMesh&&!0===v.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===v.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===v.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===v.instancingMorph&&null!==r.morphTexture||v.envMap!==l||!0===i.fog&&v.fog!==s?E=!0:void 0===v.numClippingPlanes||v.numClippingPlanes===me.numPlanes&&v.numIntersection===me.numIntersection?(v.vertexAlphas!==c||v.vertexTangents!==h||v.morphTargets!==d||v.morphNormals!==u||v.morphColors!==p||v.toneMapping!==A||v.morphTargetsCount!==g||v.numMultiviewViews!==f)&&(E=!0):E=!0:E=!0:E=!0:E=!0:(E=!0,v.__version=i.version);let b=v.currentProgram;!0===E&&(b=et(i,t,r));let C=!1,_=!1,M=!1;const S=b.getUniforms(),R=v.uniforms;if(ie.useProgram(b.program)&&(C=!0,_=!0,M=!0),i.id!==B&&(B=i.id,_=!0),C||T!==e){b.numMultiviewViews>0?(ve.updateCameraProjectionMatricesUniform(e,S),ve.updateCameraViewMatricesUniform(e,S)):(ie.buffers.depth.getReversed()?(q.copy(e.projectionMatrix),function(e){const t=e.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}(q),function(e){const t=e.elements;-1===t[11]?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=1-t[14])}(q),S.setValue(Me,"projectionMatrix",q)):S.setValue(Me,"projectionMatrix",e.projectionMatrix),S.setValue(Me,"viewMatrix",e.matrixWorldInverse));const t=S.map.cameraPosition;void 0!==t&&t.setValue(Me,Y.setFromMatrixPosition(e.matrixWorld)),te.logarithmicDepthBuffer&&S.setValue(Me,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&S.setValue(Me,"isOrthographic",!0===e.isOrthographicCamera),T!==e&&(T=e,_=!0,M=!0)}if(r.isSkinnedMesh){S.setOptional(Me,r,"bindMatrix"),S.setOptional(Me,r,"bindMatrixInverse");const e=r.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),S.setValue(Me,"boneTexture",e.boneTexture,oe))}r.isBatchedMesh&&(S.setOptional(Me,r,"batchingTexture"),S.setValue(Me,"batchingTexture",r._matricesTexture,oe),S.setOptional(Me,r,"batchingIdTexture"),S.setValue(Me,"batchingIdTexture",r._indirectTexture,oe),S.setOptional(Me,r,"batchingColorTexture"),null!==r._colorsTexture&&S.setValue(Me,"batchingColorTexture",r._colorsTexture,oe));const L=n.morphAttributes;var D,P;if(void 0===L.position&&void 0===L.normal&&void 0===L.color||Ee.update(r,n,b),(_||v.receiveShadow!==r.receiveShadow)&&(v.receiveShadow=r.receiveShadow,S.setValue(Me,"receiveShadow",r.receiveShadow)),i.isMeshGouraudMaterial&&null!==i.envMap&&(R.envMap.value=l,R.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1),i.isMeshStandardMaterial&&null===i.envMap&&null!==t.environment&&(R.envMapIntensity.value=t.environmentIntensity),_&&(S.setValue(Me,"toneMappingExposure",w.toneMappingExposure),v.needsLights&&(P=M,(D=R).ambientLightColor.needsUpdate=P,D.lightProbe.needsUpdate=P,D.directionalLights.needsUpdate=P,D.directionalLightShadows.needsUpdate=P,D.pointLights.needsUpdate=P,D.pointLightShadows.needsUpdate=P,D.spotLights.needsUpdate=P,D.spotLightShadows.needsUpdate=P,D.rectAreaLights.needsUpdate=P,D.hemisphereLights.needsUpdate=P),s&&!0===i.fog&&pe.refreshFogUniforms(R,s),pe.refreshMaterialUniforms(R,i,k,F,x.state.transmissionRenderTarget[e.id]),cA.upload(Me,nt(v),R,oe)),i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(cA.upload(Me,nt(v),R,oe),i.uniformsNeedUpdate=!1),i.isSpriteMaterial&&S.setValue(Me,"center",r.center),b.numMultiviewViews>0?ve.updateObjectMatricesUniforms(r,e,S):(S.setValue(Me,"modelViewMatrix",r.modelViewMatrix),S.setValue(Me,"normalMatrix",r.normalMatrix)),S.setValue(Me,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const e=i.uniformsGroups;for(let t=0,n=e.length;t<n;t++){const n=e[t];_e.update(n,b),_e.bind(n,b)}}return b}(e,t,n,i,r);ie.setMaterial(i,o);let l=n.index,c=1;if(!0===i.wireframe){if(l=he.getWireframeAttribute(n),void 0===l)return;c=2}const h=n.drawRange,d=n.attributes.position;let u=h.start*c,p=(h.start+h.count)*c;null!==s&&(u=Math.max(u,s.start*c),p=Math.min(p,(s.start+s.count)*c)),null!==l?(u=Math.max(u,0),p=Math.min(p,l.count)):null!=d&&(u=Math.max(u,0),p=Math.min(p,d.count));const A=p-u;if(A<0||A===1/0)return;let f;we.setup(r,i,a,n,l);let m=xe;if(null!==l&&(f=ce.get(l),m=be,m.setIndex(f)),r.isMesh)!0===i.wireframe?(ie.setLineWidth(i.wireframeLinewidth*$()),m.setMode(Me.LINES)):m.setMode(Me.TRIANGLES);else if(r.isLine){let e=i.linewidth;void 0===e&&(e=1),ie.setLineWidth(e*$()),r.isLineSegments?m.setMode(Me.LINES):r.isLineLoop?m.setMode(Me.LINE_LOOP):m.setMode(Me.LINE_STRIP)}else r.isPoints?m.setMode(Me.POINTS):r.isSprite&&m.setMode(Me.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)m.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(ee.get("WEBGL_multi_draw"))m.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const e=r._multiDrawStarts,t=r._multiDrawCounts,n=r._multiDrawCount,s=l?ce.get(l).bytesPerElement:1,o=se.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)o.setValue(Me,"_gl_DrawID",i),m.render(e[i]/s,t[i])}else if(r.isInstancedMesh)m.renderInstances(u,A,r.count);else if(n.isInstancedBufferGeometry){const e=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,t=Math.min(n.instanceCount,e);m.renderInstances(u,A,t)}else m.render(u,A)},this.compile=function(e,t,n=null){null===n&&(n=e),x=fe.get(n),x.init(t),C.push(x),n.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(x.pushLight(e),e.castShadow&&x.pushShadow(e))})),e!==n&&e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(x.pushLight(e),e.castShadow&&x.pushShadow(e))})),x.setupLights();const i=new Set;return e.traverse((function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;const t=e.material;if(t)if(Array.isArray(t))for(let r=0;r<t.length;r++){const s=t[r];ze(s,n,e),i.add(s)}else ze(t,n,e),i.add(t)})),C.pop(),x=null,i},this.compileAsync=function(e,t,n=null){const i=this.compile(e,t,n);return new Promise((t=>{function n(){i.forEach((function(e){se.get(e).currentProgram.isReady()&&i.delete(e)})),0!==i.size?setTimeout(n,10):t(e)}null!==ee.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};let He=null;function Ve(){We.stop()}function je(){We.start()}const We=new bu;function qe(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)x.pushLight(e),e.castShadow&&x.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||V.intersectsSprite(e)){i&&J.setFromMatrixPosition(e.matrixWorld).applyMatrix4(X);const t=de.update(e),r=e.material;r.visible&&E.push(e,t,r,n,J.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||V.intersectsObject(e))){const t=de.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),J.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),J.copy(t.boundingSphere.center)),J.applyMatrix4(e.matrixWorld).applyMatrix4(X)),Array.isArray(r)){const i=t.groups;for(let s=0,o=i.length;s<o;s++){const o=i[s],a=r[o.materialIndex];a&&a.visible&&E.push(e,t,a,n,J.z,o)}}else r.visible&&E.push(e,t,r,n,J.z,null)}const r=e.children;for(let e=0,s=r.length;e<s;e++)qe(r[e],t,n,i)}function Xe(e,t,n,i){const r=e.opaque,s=e.transmissive,o=e.transparent;x.setupLightsView(n),!0===j&&me.setGlobalState(w.clippingPlanes,n),i&&ie.viewport(R.copy(i)),r.length>0&&Je(r,t,n),s.length>0&&Je(s,t,n),o.length>0&&Je(o,t,n),ie.buffers.depth.setTest(!0),ie.buffers.depth.setMask(!0),ie.buffers.color.setMask(!0),ie.setPolygonOffset(!1)}function Ye(e,t,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===x.state.transmissionRenderTarget[i.id]&&(x.state.transmissionRenderTarget[i.id]=new Mi(1,1,{generateMipmaps:!0,type:ee.has("EXT_color_buffer_half_float")||ee.has("EXT_color_buffer_float")?ke:Re,minFilter:Be,samples:4,stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ai.workingColorSpace}));const s=x.state.transmissionRenderTarget[i.id],o=i.viewport||R;s.setSize(o.z,o.w);const a=w.getRenderTarget();w.setRenderTarget(s),w.getClearColor(P),U=w.getClearAlpha(),U<1&&w.setClearColor(16777215,.5),w.clear(),Z&&ye.render(n);const l=w.toneMapping;w.toneMapping=ne;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),x.setupLightsView(i),!0===j&&me.setGlobalState(w.clippingPlanes,i),Je(e,n,i),oe.updateMultisampleRenderTarget(s),oe.updateRenderTargetMipmap(s),!1===ee.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,s=t.length;r<s;r++){const s=t[r],o=s.object,a=s.geometry,l=s.material,c=s.group;if(l.side===v&&o.layers.test(i.layers)){const t=l.side;l.side=g,l.needsUpdate=!0,Ze(o,n,i,a,l,c),l.side=t,l.needsUpdate=!0,e=!0}}!0===e&&(oe.updateMultisampleRenderTarget(s),oe.updateRenderTargetMipmap(s))}w.setRenderTarget(a),w.setClearColor(P,U),void 0!==c&&(i.viewport=c),w.toneMapping=l}function Je(e,t,n){const i=!0===t.isScene?t.overrideMaterial:null;for(let r=0,s=e.length;r<s;r++){const s=e[r],o=s.object,a=s.geometry,l=null===i?s.material:i,c=s.group;o.layers.test(n.layers)&&Ze(o,t,n,a,l,c)}}function Ze(e,t,n,i,r,s){e.onBeforeRender(w,t,n,i,r,s),e.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),r.onBeforeRender(w,t,n,i,e,s),!0===r.transparent&&r.side===v&&!1===r.forceSinglePass?(r.side=g,r.needsUpdate=!0,w.renderBufferDirect(n,t,i,r,e,s),r.side=m,r.needsUpdate=!0,w.renderBufferDirect(n,t,i,r,e,s),r.side=v):w.renderBufferDirect(n,t,i,r,e,s),e.onAfterRender(w,t,n,i,r,s)}function et(e,t,n){!0!==t.isScene&&(t=K);const i=se.get(e),r=x.state.lights,s=x.state.shadowsArray,o=r.state.version,a=ue.getParameters(e,r.state,s,t,n),l=ue.getProgramCacheKey(a);let c=i.programs;i.environment=e.isMeshStandardMaterial?t.environment:null,i.fog=t.fog,i.envMap=(e.isMeshStandardMaterial?le:ae).get(e.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===c&&(e.addEventListener("dispose",Fe),c=new Map,i.programs=c);let h=c.get(l);if(void 0!==h){if(i.currentProgram===h&&i.lightsStateVersion===o)return it(e,a),h}else a.uniforms=ue.getUniforms(e),e.onBeforeCompile(a,w),h=ue.acquireProgram(a,l),c.set(l,h),i.uniforms=a.uniforms;const d=i.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(d.clippingPlanes=me.uniform),it(e,a),i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=o,i.needsLights&&(d.ambientLightColor.value=r.state.ambient,d.lightProbe.value=r.state.probe,d.directionalLights.value=r.state.directional,d.directionalLightShadows.value=r.state.directionalShadow,d.spotLights.value=r.state.spot,d.spotLightShadows.value=r.state.spotShadow,d.rectAreaLights.value=r.state.rectArea,d.ltc_1.value=r.state.rectAreaLTC1,d.ltc_2.value=r.state.rectAreaLTC2,d.pointLights.value=r.state.point,d.pointLightShadows.value=r.state.pointShadow,d.hemisphereLights.value=r.state.hemi,d.directionalShadowMap.value=r.state.directionalShadowMap,d.directionalShadowMatrix.value=r.state.directionalShadowMatrix,d.spotShadowMap.value=r.state.spotShadowMap,d.spotLightMatrix.value=r.state.spotLightMatrix,d.spotLightMap.value=r.state.spotLightMap,d.pointShadowMap.value=r.state.pointShadowMap,d.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=h,i.uniformsList=null,h}function nt(e){if(null===e.uniformsList){const t=e.currentProgram.getUniforms();e.uniformsList=cA.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function it(e,t){const n=se.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping,n.numMultiviewViews=t.numMultiviewViews}var rt;We.setAnimationLoop((function(e){He&&He(e)})),"undefined"!=typeof self&&We.setContext(self),this.setAnimationLoop=function(e){He=e,Te.setAnimationLoop(e),null===e?We.stop():We.start()},Te.addEventListener("sessionstart",Ve),Te.addEventListener("sessionend",je),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===_)return;if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===Te.enabled&&!0===Te.isPresenting&&(!0===Te.cameraAutoUpdate&&Te.updateCamera(t),t=Te.getCamera()),!0===e.isScene&&e.onBeforeRender(w,e,t,I),x=fe.get(e,C.length),x.init(t),C.push(x),X.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),V.setFromProjectionMatrix(X),W=this.localClippingEnabled,j=me.init(this.clippingPlanes,W),E=Ae.get(e,b.length),E.init(),b.push(E),!0===Te.enabled&&!0===Te.isPresenting){const e=w.xr.getDepthSensingMesh();null!==e&&qe(e,t,-1/0,w.sortObjects)}qe(e,t,0,w.sortObjects),E.finish(),!0===w.sortObjects&&E.sort(N,Q),Z=!1===Te.enabled||!1===Te.isPresenting||!1===Te.hasDepthSensing(),Z&&ye.addToRenderList(E,e),this.info.render.frame++,!0===j&&me.beginShadows();const n=x.state.shadowsArray;ge.render(n,e,t),!0===j&&me.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=E.opaque,r=E.transmissive;if(x.setupLights(),t.isArrayCamera){const n=t.cameras;if(r.length>0)for(let t=0,s=n.length;t<s;t++)Ye(i,r,e,n[t]);if(Z&&ye.render(e),Te.enabled&&Te.isMultiview)oe.setDeferTextureUploads(!0),Xe(E,e,t,t.cameras[0].viewport);else for(let t=0,i=n.length;t<i;t++){const i=n[t];Xe(E,e,i,i.viewport)}}else r.length>0&&Ye(i,r,e,t),Z&&ye.render(e),Xe(E,e,t);null!==I&&(oe.updateMultisampleRenderTarget(I),oe.updateRenderTargetMipmap(I)),!0===e.isScene&&e.onAfterRender(w,e,t),we.resetDefaultState(),B=-1,T=null,C.pop(),C.length>0?(x=C[C.length-1],!0===j&&me.setGlobalState(w.clippingPlanes,x.state.camera)):x=null,b.pop(),E=b.length>0?b[b.length-1]:null},this.setTexture2D=(rt=!1,function(e,t){e&&e.isWebGLRenderTarget&&(rt||(console.warn("THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead."),rt=!0),e=e.texture),oe.setTexture2D(e,t)}),this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return S},this.getRenderTarget=function(){return I},this.setRenderTargetTextures=function(e,t,n){se.get(e.texture).__webglTexture=t,se.get(e.depthTexture).__webglTexture=n;const i=se.get(e);i.__hasExternalTextures=!0,i.__autoAllocateDepthBuffer=void 0===n,i.__autoAllocateDepthBuffer||I&&I.isWebGLMultiviewRenderTarget||!0===ee.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),i.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(e,t){const n=se.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,n=0){I=e,M=t,S=n;let i=!0,r=null,s=!1,o=!1;if(e){const a=se.get(e);if(void 0!==a.__useDefaultFramebuffer)ie.bindFramebuffer(Me.FRAMEBUFFER,null),i=!1;else if(void 0===a.__webglFramebuffer)oe.setupRenderTarget(e);else if(a.__hasExternalTextures)oe.rebindTextures(e,se.get(e.texture).__webglTexture,se.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){const t=e.depthTexture;if(a.__boundDepthTexture!==t){if(null!==t&&se.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");oe.setupDepthRenderbuffer(e)}}const l=e.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(o=!0);const c=se.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(r=Array.isArray(c[t])?c[t][n]:c[t],s=!0):r=e.samples>0&&!1===oe.useMultisampledRTT(e)?se.get(e).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,R.copy(e.viewport),L.copy(e.scissor),D=e.scissorTest}else R.copy(G).multiplyScalar(k).floor(),L.copy(z).multiplyScalar(k).floor(),D=H;if(ie.bindFramebuffer(Me.FRAMEBUFFER,r)&&i&&ie.drawBuffers(e,r),ie.viewport(R),ie.scissor(L),ie.setScissorTest(D),s){const i=se.get(e.texture);Me.framebufferTexture2D(Me.FRAMEBUFFER,Me.COLOR_ATTACHMENT0,Me.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(o){const i=se.get(e.texture),r=t||0;Me.framebufferTextureLayer(Me.FRAMEBUFFER,Me.COLOR_ATTACHMENT0,i.__webglTexture,n||0,r)}B=-1},this.readRenderTargetPixels=function(e,t,n,i,r,s,o){if(!e||!e.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=se.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){ie.bindFramebuffer(Me.FRAMEBUFFER,a);try{const o=e.texture,a=o.format,l=o.type;if(!te.textureFormatReadable(a))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!te.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&Me.readPixels(t,n,i,r,Ce.convert(a),Ce.convert(l),s)}finally{const e=null!==I?se.get(I).__webglFramebuffer:null;ie.bindFramebuffer(Me.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,r,s,o){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let a=se.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==o&&(a=a[o]),a){const o=e.texture,l=o.format,c=o.type;if(!te.textureFormatReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!te.textureTypeReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r){ie.bindFramebuffer(Me.FRAMEBUFFER,a);const e=Me.createBuffer();Me.bindBuffer(Me.PIXEL_PACK_BUFFER,e),Me.bufferData(Me.PIXEL_PACK_BUFFER,s.byteLength,Me.STREAM_READ),Me.readPixels(t,n,i,r,Ce.convert(l),Ce.convert(c),0);const o=null!==I?se.get(I).__webglFramebuffer:null;ie.bindFramebuffer(Me.FRAMEBUFFER,o);const h=Me.fenceSync(Me.SYNC_GPU_COMMANDS_COMPLETE,0);return Me.flush(),await function(e,t){return new Promise((function(n,i){setTimeout((function r(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(r,4);break;default:n()}}),4)}))}(Me,h),Me.bindBuffer(Me.PIXEL_PACK_BUFFER,e),Me.getBufferSubData(Me.PIXEL_PACK_BUFFER,0,s),Me.deleteBuffer(e),Me.deleteSync(h),s}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(e,t=null,n=0){!0!==e.isTexture&&(hi("WebGLRenderer: copyFramebufferToTexture function signature has changed."),t=arguments[0]||null,e=arguments[1]);const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),s=Math.floor(e.image.height*i),o=null!==t?t.x:0,a=null!==t?t.y:0;oe.setTexture2D(e,0),Me.copyTexSubImage2D(Me.TEXTURE_2D,n,0,0,o,a,r,s),ie.unbindTexture()};const st=Me.createFramebuffer(),ot=Me.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,i=null,r=0,s=null){let o,a,l,c,h,d,u,p,A;!0!==e.isTexture&&(hi("WebGLRenderer: copyTextureToTexture function signature has changed."),i=arguments[0]||null,e=arguments[1],t=arguments[2],s=arguments[3]||0,n=null),null===s&&(0!==r?(hi("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),s=r,r=0):s=0);const f=e.isCompressedTexture?e.mipmaps[s]:e.image;if(null!==n)o=n.max.x-n.min.x,a=n.max.y-n.min.y,l=n.isBox3?n.max.z-n.min.z:1,c=n.min.x,h=n.min.y,d=n.isBox3?n.min.z:0;else{const t=Math.pow(2,-r);o=Math.floor(f.width*t),a=Math.floor(f.height*t),l=e.isDataArrayTexture?f.depth:e.isData3DTexture?Math.floor(f.depth*t):1,c=0,h=0,d=0}null!==i?(u=i.x,p=i.y,A=i.z):(u=0,p=0,A=0);const m=Ce.convert(t.format),g=Ce.convert(t.type);let v;t.isData3DTexture?(oe.setTexture3D(t,0),v=Me.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(oe.setTexture2DArray(t,0),v=Me.TEXTURE_2D_ARRAY):(oe.setTexture2D(t,0),v=Me.TEXTURE_2D),Me.pixelStorei(Me.UNPACK_FLIP_Y_WEBGL,t.flipY),Me.pixelStorei(Me.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Me.pixelStorei(Me.UNPACK_ALIGNMENT,t.unpackAlignment);const y=Me.getParameter(Me.UNPACK_ROW_LENGTH),E=Me.getParameter(Me.UNPACK_IMAGE_HEIGHT),x=Me.getParameter(Me.UNPACK_SKIP_PIXELS),b=Me.getParameter(Me.UNPACK_SKIP_ROWS),C=Me.getParameter(Me.UNPACK_SKIP_IMAGES);Me.pixelStorei(Me.UNPACK_ROW_LENGTH,f.width),Me.pixelStorei(Me.UNPACK_IMAGE_HEIGHT,f.height),Me.pixelStorei(Me.UNPACK_SKIP_PIXELS,c),Me.pixelStorei(Me.UNPACK_SKIP_ROWS,h),Me.pixelStorei(Me.UNPACK_SKIP_IMAGES,d);const w=e.isDataArrayTexture||e.isData3DTexture,_=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){const n=se.get(e),i=se.get(t),f=se.get(n.__renderTarget),m=se.get(i.__renderTarget);ie.bindFramebuffer(Me.READ_FRAMEBUFFER,f.__webglFramebuffer),ie.bindFramebuffer(Me.DRAW_FRAMEBUFFER,m.__webglFramebuffer);for(let n=0;n<l;n++)w&&(Me.framebufferTextureLayer(Me.READ_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,se.get(e).__webglTexture,r,d+n),Me.framebufferTextureLayer(Me.DRAW_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,se.get(t).__webglTexture,s,A+n)),Me.blitFramebuffer(c,h,o,a,u,p,o,a,Me.DEPTH_BUFFER_BIT,Me.NEAREST);ie.bindFramebuffer(Me.READ_FRAMEBUFFER,null),ie.bindFramebuffer(Me.DRAW_FRAMEBUFFER,null)}else if(0!==r||e.isRenderTargetTexture||se.has(e)){const n=se.get(e),i=se.get(t);ie.bindFramebuffer(Me.READ_FRAMEBUFFER,st),ie.bindFramebuffer(Me.DRAW_FRAMEBUFFER,ot);for(let e=0;e<l;e++)w?Me.framebufferTextureLayer(Me.READ_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,n.__webglTexture,r,d+e):Me.framebufferTexture2D(Me.READ_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,Me.TEXTURE_2D,n.__webglTexture,r),_?Me.framebufferTextureLayer(Me.DRAW_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,i.__webglTexture,s,A+e):Me.framebufferTexture2D(Me.DRAW_FRAMEBUFFER,Me.COLOR_ATTACHMENT0,Me.TEXTURE_2D,i.__webglTexture,s),0!==r?Me.blitFramebuffer(c,h,o,a,u,p,o,a,Me.COLOR_BUFFER_BIT,Me.NEAREST):_?Me.copyTexSubImage3D(v,s,u,p,A+e,c,h,o,a):Me.copyTexSubImage2D(v,s,u,p,c,h,o,a);ie.bindFramebuffer(Me.READ_FRAMEBUFFER,null),ie.bindFramebuffer(Me.DRAW_FRAMEBUFFER,null)}else _?e.isDataTexture||e.isData3DTexture?Me.texSubImage3D(v,s,u,p,A,o,a,l,m,g,f.data):t.isCompressedArrayTexture?Me.compressedTexSubImage3D(v,s,u,p,A,o,a,l,m,f.data):Me.texSubImage3D(v,s,u,p,A,o,a,l,m,g,f):e.isDataTexture?Me.texSubImage2D(Me.TEXTURE_2D,s,u,p,o,a,m,g,f.data):e.isCompressedTexture?Me.compressedTexSubImage2D(Me.TEXTURE_2D,s,u,p,f.width,f.height,m,f.data):Me.texSubImage2D(Me.TEXTURE_2D,s,u,p,o,a,m,g,f);Me.pixelStorei(Me.UNPACK_ROW_LENGTH,y),Me.pixelStorei(Me.UNPACK_IMAGE_HEIGHT,E),Me.pixelStorei(Me.UNPACK_SKIP_PIXELS,x),Me.pixelStorei(Me.UNPACK_SKIP_ROWS,b),Me.pixelStorei(Me.UNPACK_SKIP_IMAGES,C),0===s&&t.generateMipmaps&&Me.generateMipmap(v),ie.unbindTexture()},this.copyTextureToTexture3D=function(e,t,n=null,i=null,r=0){return!0!==e.isTexture&&(hi("WebGLRenderer: copyTextureToTexture3D function signature has changed."),n=arguments[0]||null,i=arguments[1]||null,e=arguments[2],t=arguments[3],r=arguments[4]||0),hi('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(e,t,n,i,r)},this.initRenderTarget=function(e){void 0===se.get(e).__webglFramebuffer&&oe.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?oe.setTextureCube(e,0):e.isData3DTexture?oe.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?oe.setTexture2DArray(e,0):oe.setTexture2D(e,0),ie.unbindTexture()},this.resetState=function(){M=0,S=0,I=null,ie.reset(),we.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Gn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorspace=Ai._getDrawingBufferColorSpace(e),t.unpackColorSpace=Ai._getUnpackColorSpace()}}const of=new WeakMap;function af(){let e,t;function n(e,t,n,i,r,s){const o=s.num_components(),a=n.num_points()*o,l=a*r.BYTES_PER_ELEMENT,c=function(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,r),h=e._malloc(l);t.GetAttributeDataArrayForAllPoints(n,s,c,l,h);const d=new r(e.HEAPF32.buffer,h,a).slice();return e._free(h),{name:i,array:d,itemSize:o}}onmessage=function(i){const r=i.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":const i=r.buffer,s=r.taskConfig;t.then((e=>{const t=e.draco,o=new t.Decoder;try{const e=function(e,t,i,r){const s=r.attributeIDs,o=r.attributeTypes;let a,l;const c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)a=new e.Mesh,l=t.DecodeArrayToMesh(i,i.byteLength,a);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,l=t.DecodeArrayToPointCloud(i,i.byteLength,a)}if(!l.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const i in s){const l=self[o[i]];let c,d;if(r.useUniqueIDs)d=s[i],c=t.GetAttributeByUniqueId(a,d);else{if(d=t.GetAttributeId(a,e[s[i]]),-1===d)continue;c=t.GetAttribute(a,d)}const u=n(e,t,a,i,l,c);"color"===i&&(u.vertexColorSpace=r.vertexColorSpace),h.attributes.push(u)}return c===e.TRIANGULAR_MESH&&(h.index=function(e,t,n){const i=3*n.num_faces(),r=4*i,s=e._malloc(r);t.GetTrianglesUInt32Array(n,r,s);const o=new Uint32Array(e.HEAPF32.buffer,s,i).slice();return e._free(s),{array:o,itemSize:1}}(e,t,a)),e.destroy(a),h}(t,o,new Int8Array(i),s),a=e.attributes.map((e=>e.array.buffer));e.index&&a.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},a)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(o)}}))}}}function lf(e,t,n=!0){if(!t||!t.isReady)throw new Error("BufferGeometryUtils: Initialized MikkTSpace library required.");if(!e.hasAttribute("position")||!e.hasAttribute("normal")||!e.hasAttribute("uv"))throw new Error('BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.');function i(e){if(e.normalized||e.isInterleavedBufferAttribute){const t=new Float32Array(e.count*e.itemSize);for(let n=0,i=0;n<e.count;n++)t[i++]=e.getX(n),t[i++]=e.getY(n),e.itemSize>2&&(t[i++]=e.getZ(n));return t}return e.array instanceof Float32Array?e.array:new Float32Array(e.array)}const r=e.index?e.toNonIndexed():e,s=t.generateTangents(i(r.attributes.position),i(r.attributes.normal),i(r.attributes.uv));if(n)for(let e=3;e<s.length;e+=4)s[e]*=-1;return r.setAttribute("tangent",new us(s,4)),e!==r&&e.copy(r),e}function cf(e,t=!1){const n=null!==e[0].index,i=new Set(Object.keys(e[0].attributes)),r=new Set(Object.keys(e[0].morphAttributes)),s={},o={},a=e[0].morphTargetsRelative,l=new Bs;let c=0;for(let h=0;h<e.length;++h){const d=e[h];let u=0;if(n!==(null!==d.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(const e in d.attributes){if(!i.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+e+'" attribute exists among all geometries, or in none of them.'),null;void 0===s[e]&&(s[e]=[]),s[e].push(d.attributes[e]),u++}if(u!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==d.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(const e in d.morphAttributes){if(!r.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;void 0===o[e]&&(o[e]=[]),o[e].push(d.morphAttributes[e])}if(t){let e;if(n)e=d.index.count;else{if(void 0===d.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;e=d.attributes.position.count}l.addGroup(c,e,h),c+=e}}if(n){let t=0;const n=[];for(let i=0;i<e.length;++i){const r=e[i].index;for(let e=0;e<r.count;++e)n.push(r.getX(e)+t);t+=e[i].attributes.position.count}l.setIndex(n)}for(const e in s){const t=hf(s[e]);if(!t)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" attribute."),null;l.setAttribute(e,t)}for(const e in o){const t=o[e][0].length;if(0===t)break;l.morphAttributes=l.morphAttributes||{},l.morphAttributes[e]=[];for(let n=0;n<t;++n){const t=[];for(let i=0;i<o[e].length;++i)t.push(o[e][i][n]);const i=hf(t);if(!i)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" morphAttribute."),null;l.morphAttributes[e].push(i)}}return l}function hf(e){let t,n,i,r=-1,s=0;for(let o=0;o<e.length;++o){const a=e[o];if(void 0===t&&(t=a.array.constructor),t!==a.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===n&&(n=a.itemSize),n!==a.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===i&&(i=a.normalized),i!==a.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===r&&(r=a.gpuType),r!==a.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=a.count*n}const o=new t(s),a=new us(o,n,i);let l=0;for(let t=0;t<e.length;++t){const i=e[t];if(i.isInterleavedBufferAttribute){const e=l/n;for(let t=0,r=i.count;t<r;t++)for(let r=0;r<n;r++){const n=i.getComponent(t,r);a.setComponent(t+e,r,n)}}else o.set(i.array,l);l+=i.count*n}return void 0!==r&&(a.gpuType=r),a}function df(e){return e.isInstancedInterleavedBufferAttribute||e.isInterleavedBufferAttribute?pf(e):e.isInstancedBufferAttribute?(new jo).copy(e):(new us).copy(e)}function uf(e){let t,n=0,i=0;for(let r=0,s=e.length;r<s;++r){const s=e[r];if(void 0===t&&(t=s.array.constructor),t!==s.array.constructor)return console.error("AttributeBuffers of different types cannot be interleaved"),null;n+=s.array.length,i+=s.itemSize}const r=new ao(new t(n),i);let s=0;const o=[],a=["getX","getY","getZ","getW"],l=["setX","setY","setZ","setW"];for(let t=0,n=e.length;t<n;t++){const n=e[t],i=n.itemSize,c=n.count,h=new co(r,i,s,n.normalized);o.push(h),s+=i;for(let e=0;e<c;e++)for(let t=0;t<i;t++)h[l[t]](e,n[a[t]](e))}return o}function pf(e){const t=e.data.array.constructor,n=e.count,i=e.itemSize,r=e.normalized,s=new t(n*i);let o;o=e.isInstancedInterleavedBufferAttribute?new jo(s,i,r,e.meshPerAttribute):new us(s,i,r);for(let t=0;t<n;t++)o.setX(t,e.getX(t)),i>=2&&o.setY(t,e.getY(t)),i>=3&&o.setZ(t,e.getZ(t)),i>=4&&o.setW(t,e.getW(t));return o}function Af(e){const t=e.attributes,n=e.morphTargets,i=new Map;for(const e in t){const n=t[e];n.isInterleavedBufferAttribute&&(i.has(n)||i.set(n,pf(n)),t[e]=i.get(n))}for(const e in n){const t=n[e];t.isInterleavedBufferAttribute&&(i.has(t)||i.set(t,pf(t)),n[e]=i.get(t))}}function ff(e){let t=0;for(const n in e.attributes){const i=e.getAttribute(n);t+=i.count*i.itemSize*i.array.BYTES_PER_ELEMENT}const n=e.getIndex();return t+=n?n.count*n.itemSize*n.array.BYTES_PER_ELEMENT:0,t}function mf(e,t=1e-4){t=Math.max(t,Number.EPSILON);const n={},i=e.getIndex(),r=e.getAttribute("position"),s=i?i.count:r.count;let o=0;const a=Object.keys(e.attributes),l={},c={},h=[],d=["getX","getY","getZ","getW"],u=["setX","setY","setZ","setW"];for(let t=0,n=a.length;t<n;t++){const n=a[t],i=e.attributes[n];l[n]=new i.constructor(new i.array.constructor(i.count*i.itemSize),i.itemSize,i.normalized);const r=e.morphAttributes[n];r&&(c[n]||(c[n]=[]),r.forEach(((e,t)=>{const i=new e.array.constructor(e.count*e.itemSize);c[n][t]=new e.constructor(i,e.itemSize,e.normalized)})))}const p=.5*t,A=Math.log10(1/t),f=Math.pow(10,A),m=p*f;for(let t=0;t<s;t++){const r=i?i.getX(t):t;let s="";for(let t=0,n=a.length;t<n;t++){const n=a[t],i=e.getAttribute(n),o=i.itemSize;for(let e=0;e<o;e++)s+=~~(i[d[e]](r)*f+m)+","}if(s in n)h.push(n[s]);else{for(let t=0,n=a.length;t<n;t++){const n=a[t],i=e.getAttribute(n),s=e.morphAttributes[n],h=i.itemSize,p=l[n],A=c[n];for(let e=0;e<h;e++){const t=d[e],n=u[e];if(p[n](o,i[t](r)),s)for(let e=0,i=s.length;e<i;e++)A[e][n](o,s[e][t](r))}}n[s]=o,h.push(o),o++}}const g=e.clone();for(const t in e.attributes){const e=l[t];if(g.setAttribute(t,new e.constructor(e.array.slice(0,o*e.itemSize),e.itemSize,e.normalized)),t in c)for(let e=0;e<c[t].length;e++){const n=c[t][e];g.morphAttributes[t][e]=new n.constructor(n.array.slice(0,o*n.itemSize),n.itemSize,n.normalized)}}return g.setIndex(h),g}function gf(e,t){if(t===jt)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===qt||t===Wt){let n=e.getIndex();if(null===n){const t=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<i.count;e++)t.push(e);e.setIndex(t),n=e.getIndex()}const i=n.count-2,r=[];if(t===qt)for(let e=1;e<=i;e++)r.push(n.getX(0)),r.push(n.getX(e)),r.push(n.getX(e+1));else for(let e=0;e<i;e++)e%2==0?(r.push(n.getX(e)),r.push(n.getX(e+1)),r.push(n.getX(e+2))):(r.push(n.getX(e+2)),r.push(n.getX(e+1)),r.push(n.getX(e)));r.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=e.clone();return s.setIndex(r),s.clearGroups(),s}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}function vf(e){const t=new Li,n=new Li,i=new Li,r=new Li,s=new Li,o=new Li,a=new Li,l=new Li,c=new Li;function h(e,h,d,u,p,A,f,m){t.fromBufferAttribute(h,p),n.fromBufferAttribute(h,A),i.fromBufferAttribute(h,f);const g=e.morphTargetInfluences;if(d&&g){a.set(0,0,0),l.set(0,0,0),c.set(0,0,0);for(let e=0,h=d.length;e<h;e++){const h=g[e],m=d[e];0!==h&&(r.fromBufferAttribute(m,p),s.fromBufferAttribute(m,A),o.fromBufferAttribute(m,f),u?(a.addScaledVector(r,h),l.addScaledVector(s,h),c.addScaledVector(o,h)):(a.addScaledVector(r.sub(t),h),l.addScaledVector(s.sub(n),h),c.addScaledVector(o.sub(i),h)))}t.add(a),n.add(l),i.add(c)}e.isSkinnedMesh&&(e.applyBoneTransform(p,t),e.applyBoneTransform(A,n),e.applyBoneTransform(f,i)),m[3*p+0]=t.x,m[3*p+1]=t.y,m[3*p+2]=t.z,m[3*A+0]=n.x,m[3*A+1]=n.y,m[3*A+2]=n.z,m[3*f+0]=i.x,m[3*f+1]=i.y,m[3*f+2]=i.z}const d=e.geometry,u=e.material;let p,A,f;const m=d.index,g=d.attributes.position,v=d.morphAttributes.position,y=d.morphTargetsRelative,E=d.attributes.normal,x=d.morphAttributes.position,b=d.groups,C=d.drawRange;let w,_,M,S,I,B,T;const R=new Float32Array(g.count*g.itemSize),L=new Float32Array(E.count*E.itemSize);if(null!==m)if(Array.isArray(u))for(w=0,M=b.length;w<M;w++)for(I=b[w],B=Math.max(I.start,C.start),T=Math.min(I.start+I.count,C.start+C.count),_=B,S=T;_<S;_+=3)p=m.getX(_),A=m.getX(_+1),f=m.getX(_+2),h(e,g,v,y,p,A,f,R),h(e,E,x,y,p,A,f,L);else for(B=Math.max(0,C.start),T=Math.min(m.count,C.start+C.count),w=B,M=T;w<M;w+=3)p=m.getX(w),A=m.getX(w+1),f=m.getX(w+2),h(e,g,v,y,p,A,f,R),h(e,E,x,y,p,A,f,L);else if(Array.isArray(u))for(w=0,M=b.length;w<M;w++)for(I=b[w],B=Math.max(I.start,C.start),T=Math.min(I.start+I.count,C.start+C.count),_=B,S=T;_<S;_+=3)p=_,A=_+1,f=_+2,h(e,g,v,y,p,A,f,R),h(e,E,x,y,p,A,f,L);else for(B=Math.max(0,C.start),T=Math.min(g.count,C.start+C.count),w=B,M=T;w<M;w+=3)p=w,A=w+1,f=w+2,h(e,g,v,y,p,A,f,R),h(e,E,x,y,p,A,f,L);return{positionAttribute:g,normalAttribute:E,morphedPositionAttribute:new xs(R,3),morphedNormalAttribute:new xs(L,3)}}function yf(e){if(0===e.groups.length)return console.warn("THREE.BufferGeometryUtils.mergeGroups(): No groups are defined. Nothing to merge."),e;let t=e.groups;if(t=t.sort(((e,t)=>e.materialIndex!==t.materialIndex?e.materialIndex-t.materialIndex:e.start-t.start)),null===e.getIndex()){const t=e.getAttribute("position"),n=[];for(let e=0;e<t.count;e+=3)n.push(e,e+1,e+2);e.setIndex(n)}const n=e.getIndex(),i=[];for(let e=0;e<t.length;e++){const r=t[e],s=r.start,o=s+r.count;for(let e=s;e<o;e++)i.push(n.getX(e))}e.dispose(),e.setIndex(i);let r=0;for(let e=0;e<t.length;e++){const n=t[e];n.start=r,r+=n.count}let s=t[0];e.groups=[s];for(let n=1;n<t.length;n++){const i=t[n];s.materialIndex===i.materialIndex?s.count+=i.count:(s=i,e.groups.push(s))}return e}function Ef(e,t=Math.PI/3){const n=Math.cos(t),i=100*(1+1e-10),r=[new Li,new Li,new Li],s=new Li,o=new Li,a=new Li,l=new Li;function c(e){return`${~~(e.x*i)},${~~(e.y*i)},${~~(e.z*i)}`}const h=e.index?e.toNonIndexed():e,d=h.attributes.position,u={};for(let e=0,t=d.count/3;e<t;e++){const t=3*e,n=r[0].fromBufferAttribute(d,t+0),i=r[1].fromBufferAttribute(d,t+1),a=r[2].fromBufferAttribute(d,t+2);s.subVectors(a,i),o.subVectors(n,i);const l=(new Li).crossVectors(s,o).normalize();for(let e=0;e<3;e++){const t=c(r[e]);t in u||(u[t]=[]),u[t].push(l)}}const p=new Float32Array(3*d.count),A=new us(p,3,!1);for(let e=0,t=d.count/3;e<t;e++){const t=3*e,i=r[0].fromBufferAttribute(d,t+0),h=r[1].fromBufferAttribute(d,t+1),p=r[2].fromBufferAttribute(d,t+2);s.subVectors(p,h),o.subVectors(i,h),a.crossVectors(s,o).normalize();for(let e=0;e<3;e++){const i=u[c(r[e])];l.set(0,0,0);for(let e=0,t=i.length;e<t;e++){const t=i[e];a.dot(t)>n&&l.add(t)}l.normalize(),A.setXYZ(t+e,l.x,l.y,l.z)}}return h.setAttribute("normal",A),h}function xf(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const bf="KHR_binary_glTF",Cf="KHR_draco_mesh_compression",wf="KHR_lights_punctual",_f="KHR_materials_clearcoat",Mf="KHR_materials_dispersion",Sf="KHR_materials_ior",If="KHR_materials_sheen",Bf="KHR_materials_specular",Tf="KHR_materials_transmission",Rf="KHR_materials_iridescence",Lf="KHR_materials_anisotropy",Df="KHR_materials_unlit",Pf="KHR_materials_volume",Uf="KHR_texture_basisu",Of="KHR_texture_transform",Ff="KHR_mesh_quantization",kf="KHR_materials_emissive_strength",Nf="EXT_materials_bump",Qf="EXT_texture_webp",Gf="EXT_texture_avif",zf="EXT_meshopt_compression",Hf="EXT_mesh_gpu_instancing";class Vf{constructor(e){this.parser=e,this.name=wf,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n];i.extensions&&i.extensions[this.name]&&void 0!==i.extensions[this.name].light&&e._addNodeRef(this.cache,i.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const r=t.json,s=((r.extensions&&r.extensions[this.name]||{}).lights||[])[e];let o;const a=new es(16777215);void 0!==s.color&&a.setRGB(s.color[0],s.color[1],s.color[2],nn);const l=void 0!==s.range?s.range:0;switch(s.type){case"directional":o=new Bh(a),o.target.position.set(0,0,-1),o.add(o.target);break;case"point":o=new Mh(a),o.distance=l;break;case"spot":o=new xh(a),o.distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,o.angle=s.spot.outerConeAngle,o.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,o.target.position.set(0,0,-1),o.add(o.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return o.position.set(0,0,0),o.decay=2,_m(o,s),void 0!==s.intensity&&(o.intensity=s.intensity),o.name=t.createUniqueName(s.name||"light_"+e),i=Promise.resolve(o),t.cache.add(n,i),i}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,i=n.json.nodes[e],r=(i.extensions&&i.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then((function(e){return n._getNodeRef(t.cache,r,e)}))}}class jf{constructor(){this.name=Df}getMaterialType(){return rs}extendParams(e,t,n){const i=[];e.color=new es(1,1,1),e.opacity=1;const r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const t=r.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],nn),e.opacity=t[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture,tn))}return Promise.all(i)}}class Wf{constructor(e){this.parser=e,this.name=kf}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name].emissiveStrength;return void 0!==i&&(t.emissiveIntensity=i),Promise.resolve()}}class qf{constructor(e){this.parser=e,this.name=_f}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];if(void 0!==s.clearcoatFactor&&(t.clearcoat=s.clearcoatFactor),void 0!==s.clearcoatTexture&&r.push(n.assignTexture(t,"clearcoatMap",s.clearcoatTexture)),void 0!==s.clearcoatRoughnessFactor&&(t.clearcoatRoughness=s.clearcoatRoughnessFactor),void 0!==s.clearcoatRoughnessTexture&&r.push(n.assignTexture(t,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),void 0!==s.clearcoatNormalTexture&&(r.push(n.assignTexture(t,"clearcoatNormalMap",s.clearcoatNormalTexture)),void 0!==s.clearcoatNormalTexture.scale)){const e=s.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new ti(e,e)}return Promise.all(r)}}class Xf{constructor(e){this.parser=e,this.name=Mf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.dispersion=void 0!==i.dispersion?i.dispersion:0,Promise.resolve()}}class Yf{constructor(e){this.parser=e,this.name=Rf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.iridescenceFactor&&(t.iridescence=s.iridescenceFactor),void 0!==s.iridescenceTexture&&r.push(n.assignTexture(t,"iridescenceMap",s.iridescenceTexture)),void 0!==s.iridescenceIor&&(t.iridescenceIOR=s.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==s.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=s.iridescenceThicknessMinimum),void 0!==s.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=s.iridescenceThicknessMaximum),void 0!==s.iridescenceThicknessTexture&&r.push(n.assignTexture(t,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class Jf{constructor(e){this.parser=e,this.name=If}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[];t.sheenColor=new es(0,0,0),t.sheenRoughness=0,t.sheen=1;const s=i.extensions[this.name];if(void 0!==s.sheenColorFactor){const e=s.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],nn)}return void 0!==s.sheenRoughnessFactor&&(t.sheenRoughness=s.sheenRoughnessFactor),void 0!==s.sheenColorTexture&&r.push(n.assignTexture(t,"sheenColorMap",s.sheenColorTexture,tn)),void 0!==s.sheenRoughnessTexture&&r.push(n.assignTexture(t,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(r)}}class Kf{constructor(e){this.parser=e,this.name=Tf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.transmissionFactor&&(t.transmission=s.transmissionFactor),void 0!==s.transmissionTexture&&r.push(n.assignTexture(t,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class Zf{constructor(e){this.parser=e,this.name=Pf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];t.thickness=void 0!==s.thicknessFactor?s.thicknessFactor:0,void 0!==s.thicknessTexture&&r.push(n.assignTexture(t,"thicknessMap",s.thicknessTexture)),t.attenuationDistance=s.attenuationDistance||1/0;const o=s.attenuationColor||[1,1,1];return t.attenuationColor=(new es).setRGB(o[0],o[1],o[2],nn),Promise.all(r)}}class $f{constructor(e){this.parser=e,this.name=Sf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser.json.materials[e];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const i=n.extensions[this.name];return t.ior=void 0!==i.ior?i.ior:1.5,Promise.resolve()}}class em{constructor(e){this.parser=e,this.name=Bf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];t.specularIntensity=void 0!==s.specularFactor?s.specularFactor:1,void 0!==s.specularTexture&&r.push(n.assignTexture(t,"specularIntensityMap",s.specularTexture));const o=s.specularColorFactor||[1,1,1];return t.specularColor=(new es).setRGB(o[0],o[1],o[2],nn),void 0!==s.specularColorTexture&&r.push(n.assignTexture(t,"specularColorMap",s.specularColorTexture,tn)),Promise.all(r)}}class tm{constructor(e){this.parser=e,this.name=Nf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return t.bumpScale=void 0!==s.bumpFactor?s.bumpFactor:1,void 0!==s.bumpTexture&&r.push(n.assignTexture(t,"bumpMap",s.bumpTexture)),Promise.all(r)}}class nm{constructor(e){this.parser=e,this.name=Lf}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?Mc:null}extendMaterialParams(e,t){const n=this.parser,i=n.json.materials[e];if(!i.extensions||!i.extensions[this.name])return Promise.resolve();const r=[],s=i.extensions[this.name];return void 0!==s.anisotropyStrength&&(t.anisotropy=s.anisotropyStrength),void 0!==s.anisotropyRotation&&(t.anisotropyRotation=s.anisotropyRotation),void 0!==s.anisotropyTexture&&r.push(n.assignTexture(t,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class im{constructor(e){this.parser=e,this.name=Uf}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const r=i.extensions[this.name],s=t.options.ktx2Loader;if(!s){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,s)}}class rm{constructor(e){this.parser=e,this.name=Qf,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const s=r.extensions[t],o=i.images[s.source];let a=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(a=e)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(e,s.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class sm{constructor(e){this.parser=e,this.name=Gf,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const s=r.extensions[t],o=i.images[s.source];let a=n.textureLoader;if(o.uri){const e=n.options.manager.getHandler(o.uri);null!==e&&(a=e)}return this.detectSupport().then((function(r){if(r)return n.loadTextureImage(e,s.source,a);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class om{constructor(e){this.name=zf,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then((function(t){const n=e.byteOffset||0,i=e.byteLength||0,s=e.count,o=e.byteStride,a=new Uint8Array(t,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(s,o,a,e.mode,e.filter).then((function(e){return e.buffer})):r.ready.then((function(){const t=new ArrayBuffer(s*o);return r.decodeGltfBuffer(new Uint8Array(t),s,o,a,e.mode,e.filter),t}))}))}return null}}class am{constructor(e){this.name=Hf,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=t.meshes[n.mesh];for(const e of i.primitives)if(e.mode!==mm.TRIANGLES&&e.mode!==mm.TRIANGLE_STRIP&&e.mode!==mm.TRIANGLE_FAN&&void 0!==e.mode)return null;const r=n.extensions[this.name].attributes,s=[],o={};for(const e in r)s.push(this.parser.getDependency("accessor",r[e]).then((t=>(o[e]=t,o[e]))));return s.length<1?null:(s.push(this.parser.createNodeMesh(e)),Promise.all(s).then((e=>{const t=e.pop(),n=t.isGroup?t.children:[t],i=e[0].count,r=[];for(const e of n){const t=new lr,n=new Li,s=new Ri,a=new Li(1,1,1),l=new $o(e.geometry,e.material,i);for(let e=0;e<i;e++)o.TRANSLATION&&n.fromBufferAttribute(o.TRANSLATION,e),o.ROTATION&&s.fromBufferAttribute(o.ROTATION,e),o.SCALE&&a.fromBufferAttribute(o.SCALE,e),l.setMatrixAt(e,t.compose(n,s,a));for(const t in o)if("_COLOR_0"===t){const e=o[t];l.instanceColor=new jo(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,o[t]);Ur.prototype.copy.call(l,e),this.parser.assignFinalMaterial(l),r.push(l)}return t.isGroup?(t.clear(),t.add(...r),t):r[0]})))}}const lm="glTF";class cm{constructor(e){this.name=bf,this.content=null,this.body=null;const t=new DataView(e,0,12),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==lm)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-12,r=new DataView(e,12);let s=0;for(;s<i;){const t=r.getUint32(s,!0);s+=4;const i=r.getUint32(s,!0);if(s+=4,1313821514===i){const i=new Uint8Array(e,12+s,t);this.content=n.decode(i)}else if(5130562===i){const n=12+s;this.body=e.slice(n,n+t)}s+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class hm{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Cf,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,r=e.extensions[this.name].bufferView,s=e.extensions[this.name].attributes,o={},a={},l={};for(const e in s){const t=xm[e]||e.toLowerCase();o[t]=s[e]}for(const t in e.attributes){const i=xm[t]||t.toLowerCase();if(void 0!==s[t]){const r=n.accessors[e.attributes[t]],s=gm[r.componentType];l[i]=s.name,a[i]=!0===r.normalized}}return t.getDependency("bufferView",r).then((function(e){return new Promise((function(t,n){i.decodeDracoFile(e,(function(e){for(const t in e.attributes){const n=e.attributes[t],i=a[t];void 0!==i&&(n.normalized=i)}t(e)}),o,l,nn,n)}))}))}}class dm{constructor(){this.name=Of}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class um{constructor(){this.name=Ff}}class pm extends Gc{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i*3+i;for(let e=0;e!==i;e++)t[e]=n[r+e];return t}interpolate_(e,t,n,i){const r=this.resultBuffer,s=this.sampleValues,o=this.valueSize,a=2*o,l=3*o,c=i-t,h=(n-t)/c,d=h*h,u=d*h,p=e*l,A=p-l,f=-2*u+3*d,m=u-d,g=1-f,v=m-d+h;for(let e=0;e!==o;e++){const t=s[A+e+o],n=s[A+e+a]*c,i=s[p+e+o],l=s[p+e]*c;r[e]=g*t+v*n+f*i+m*l}return r}}const Am=new Ri;class fm extends pm{interpolate_(e,t,n,i){const r=super.interpolate_(e,t,n,i);return Am.fromArray(r).normalize().toArray(r),r}}const mm={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},gm={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},vm={9728:xe,9729:Me,9984:be,9985:Se,9986:we,9987:Be},ym={33071:ye,33648:Ee,10497:ve},Em={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},xm={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},bm={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Cm={CUBICSPLINE:void 0,LINEAR:kt,STEP:Ft};function wm(e,t,n){for(const i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function _m(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Mm(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,i=t.weights.length;n<i;n++)e.morphTargetInfluences[n]=t.weights[n];if(t.extras&&Array.isArray(t.extras.targetNames)){const n=t.extras.targetNames;if(e.morphTargetInfluences.length===n.length){e.morphTargetDictionary={};for(let t=0,i=n.length;t<i;t++)e.morphTargetDictionary[n[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Sm(e){let t;const n=e.extensions&&e.extensions[Cf];if(t=n?"draco:"+n.bufferView+":"+n.indices+":"+Im(n.attributes):e.indices+":"+Im(e.attributes)+":"+e.mode,void 0!==e.targets)for(let n=0,i=e.targets.length;n<i;n++)t+=":"+Im(e.targets[n]);return t}function Im(e){let t="";const n=Object.keys(e).sort();for(let i=0,r=n.length;i<r;i++)t+=n[i]+":"+e[n[i]]+";";return t}function Bm(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const Tm=new lr;class Rm{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new xf,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,r=!1,s=-1;if("undefined"!=typeof navigator){const e=navigator.userAgent;n=!0===/^((?!chrome|android).)*safari/i.test(e);const t=e.match(/Version\/(\d+)/);i=n&&t?parseInt(t[1],10):-1,r=e.indexOf("Firefox")>-1,s=r?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||n&&i<17||r&&s<98?this.textureLoader=new ph(this.options.manager):this.textureLoader=new zh(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ah(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])})).then((function(t){const s={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};return wm(r,s,i),_m(s,i),Promise.all(n._invokeAll((function(e){return e.afterRoot&&e.afterRoot(s)}))).then((function(){for(const e of s.scenes)e.updateMatrixWorld();e(s)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,i=t.length;n<i;n++){const i=t[n].joints;for(let t=0,n=i.length;t<n;t++)e[i[t]].isBone=!0}for(let t=0,i=e.length;t<i;t++){const i=e[t];void 0!==i.mesh&&(this._addNodeRef(this.meshCache,i.mesh),void 0!==i.skin&&(n[i.mesh].isSkinnedMesh=!0)),void 0!==i.camera&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),r=(e,t)=>{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const[n,i]of e.children.entries())r(i,t.children[n])};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const r=e(t[i]);r&&n.push(r)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":i=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":i=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne((function(n){return n!=this&&n.getDependency&&n.getDependency(e,t)})),!i)throw new Error("Unknown type: "+e)}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(i.map((function(t,i){return n.getDependency(e,i)}))),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[bf].body);const i=this.options;return new Promise((function(e,r){n.load(Uh.resolveURL(t.uri,i.path),e,void 0,(function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){const n=t.byteLength||0,i=t.byteOffset||0;return e.slice(i,i+n)}))}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(void 0===i.bufferView&&void 0===i.sparse){const e=Em[i.type],t=gm[i.componentType],n=!0===i.normalized,r=new t(i.count*e);return Promise.resolve(new us(r,e,n))}const r=[];return void 0!==i.bufferView?r.push(this.getDependency("bufferView",i.bufferView)):r.push(null),void 0!==i.sparse&&(r.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(r).then((function(e){const r=e[0],s=Em[i.type],o=gm[i.componentType],a=o.BYTES_PER_ELEMENT,l=a*s,c=i.byteOffset||0,h=void 0!==i.bufferView?n.bufferViews[i.bufferView].byteStride:void 0,d=!0===i.normalized;let u,p;if(h&&h!==l){const e=Math.floor(c/h),n="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+e+":"+i.count;let l=t.cache.get(n);l||(u=new o(r,e*h,i.count*h/a),l=new ao(u,h/a),t.cache.add(n,l)),p=new co(l,s,c%h/a,d)}else u=null===r?new o(i.count*s):new o(r,c,i.count*s),p=new us(u,s,d);if(void 0!==i.sparse){const t=Em.SCALAR,n=gm[i.sparse.indices.componentType],a=i.sparse.indices.byteOffset||0,l=i.sparse.values.byteOffset||0,c=new n(e[1],a,i.sparse.count*t),h=new o(e[2],l,i.sparse.count*s);null!==r&&(p=new us(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let e=0,t=c.length;e<t;e++){const t=c[e];if(p.setX(t,h[e*s]),s>=2&&p.setY(t,h[e*s+1]),s>=3&&p.setZ(t,h[e*s+2]),s>=4&&p.setW(t,h[e*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}p.normalized=d}return p}))}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,r=t.images[i];let s=this.textureLoader;if(r.uri){const e=n.manager.getHandler(r.uri);null!==e&&(s=e)}return this.loadTextureImage(e,i,s)}loadTextureImage(e,t,n){const i=this,r=this.json,s=r.textures[e],o=r.images[t],a=(o.uri||o.bufferView)+":"+s.sampler;if(this.textureCache[a])return this.textureCache[a];const l=this.loadImageSource(t,n).then((function(t){t.flipY=!1,t.name=s.name||o.name||"",""===t.name&&"string"==typeof o.uri&&!1===o.uri.startsWith("data:image/")&&(t.name=o.uri);const n=(r.samplers||{})[s.sampler]||{};return t.magFilter=vm[n.magFilter]||Me,t.minFilter=vm[n.minFilter]||Be,t.wrapS=ym[n.wrapS]||ve,t.wrapT=ym[n.wrapT]||ve,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==xe&&t.minFilter!==Me,i.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[a]=l,l}loadImageSource(e,t){const n=this.json,i=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const r=n.images[e],s=self.URL||self.webkitURL;let o=r.uri||"",a=!1;if(void 0!==r.bufferView)o=this.getDependency("bufferView",r.bufferView).then((function(e){a=!0;const t=new Blob([e],{type:r.mimeType});return o=s.createObjectURL(t),o}));else if(void 0===r.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const l=Promise.resolve(o).then((function(e){return new Promise((function(n,r){let s=n;!0===t.isImageBitmapLoader&&(s=function(e){const t=new Ci(e);t.needsUpdate=!0,n(t)}),t.load(Uh.resolveURL(e,i.path),s,void 0,r)}))})).then((function(e){var t;return!0===a&&s.revokeObjectURL(o),_m(e,r),e.userData.mimeType=r.mimeType||((t=r.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":t.search(/\.ktx2($|\?)/i)>0||0===t.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),e})).catch((function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e}));return this.sourceCache[e]=l,l}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then((function(s){if(!s)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((s=s.clone()).channel=n.texCoord),r.extensions[Of]){const e=void 0!==n.extensions?n.extensions[Of]:void 0;if(e){const t=r.associations.get(s);s=r.extensions[Of].extendTexture(s,e),r.associations.set(s,t)}}return void 0!==i&&(s.colorSpace=i),e[t]=s,s}))}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=void 0===t.attributes.tangent,r=void 0!==t.attributes.color,s=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new Na,is.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new _a,is.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(i||r||s){let e="ClonedMaterial:"+n.uuid+":";i&&(e+="derivative-tangents:"),r&&(e+="vertex-colors:"),s&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),r&&(t.vertexColors=!0),s&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return _c}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let s;const o={},a=[];if((r.extensions||{})[Df]){const e=i[Df];s=e.getMaterialType(),a.push(e.extendParams(o,r,t))}else{const n=r.pbrMetallicRoughness||{};if(o.color=new es(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],nn),o.opacity=e[3]}void 0!==n.baseColorTexture&&a.push(t.assignTexture(o,"map",n.baseColorTexture,tn)),o.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,o.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(a.push(t.assignTexture(o,"metalnessMap",n.metallicRoughnessTexture)),a.push(t.assignTexture(o,"roughnessMap",n.metallicRoughnessTexture))),s=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),a.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)}))))}!0===r.doubleSided&&(o.side=v);const l=r.alphaMode||"OPAQUE";if("BLEND"===l?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,"MASK"===l&&(o.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&s!==rs&&(a.push(t.assignTexture(o,"normalMap",r.normalTexture)),o.normalScale=new ti(1,1),void 0!==r.normalTexture.scale)){const e=r.normalTexture.scale;o.normalScale.set(e,e)}if(void 0!==r.occlusionTexture&&s!==rs&&(a.push(t.assignTexture(o,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(o.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&s!==rs){const e=r.emissiveFactor;o.emissive=(new es).setRGB(e[0],e[1],e[2],nn)}return void 0!==r.emissiveTexture&&s!==rs&&a.push(t.assignTexture(o,"emissiveMap",r.emissiveTexture,tn)),Promise.all(a).then((function(){const n=new s(o);return r.name&&(n.name=r.name),_m(n,r),t.associations.set(n,{materials:e}),r.extensions&&wm(i,n,r),n}))}createUniqueName(e){const t=vd.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(e){return n[Cf].decodePrimitive(e,t).then((function(n){return Lm(n,e,t)}))}const s=[];for(let n=0,o=e.length;n<o;n++){const o=e[n],a=Sm(o),l=i[a];if(l)s.push(l.promise);else{let e;e=o.extensions&&o.extensions[Cf]?r(o):Lm(new Bs,o,t),i[a]={primitive:o,promise:e},s.push(e)}}return Promise.all(s)}loadMesh(e){const t=this,n=this.json,i=this.extensions,r=n.meshes[e],s=r.primitives,o=[];for(let e=0,t=s.length;e<t;e++){const t=void 0===s[e].material?(void 0===(a=this.cache).DefaultMaterial&&(a.DefaultMaterial=new _c({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:m})),a.DefaultMaterial):this.getDependency("material",s[e].material);o.push(t)}var a;return o.push(t.loadGeometries(s)),Promise.all(o).then((function(n){const o=n.slice(0,n.length-1),a=n[n.length-1],l=[];for(let n=0,c=a.length;n<c;n++){const c=a[n],h=s[n];let d;const u=o[n];if(h.mode===mm.TRIANGLES||h.mode===mm.TRIANGLE_STRIP||h.mode===mm.TRIANGLE_FAN||void 0===h.mode)d=!0===r.isSkinnedMesh?new No(c,u):new Gs(c,u),!0===d.isSkinnedMesh&&d.normalizeSkinWeights(),h.mode===mm.TRIANGLE_STRIP?d.geometry=gf(d.geometry,Wt):h.mode===mm.TRIANGLE_FAN&&(d.geometry=gf(d.geometry,qt));else if(h.mode===mm.LINES)d=new Fa(c,u);else if(h.mode===mm.LINE_STRIP)d=new Da(c,u);else if(h.mode===mm.LINE_LOOP)d=new ka(c,u);else{if(h.mode!==mm.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);d=new Va(c,u)}Object.keys(d.geometry.morphAttributes).length>0&&Mm(d,r),d.name=t.createUniqueName(r.name||"mesh_"+e),_m(d,r),h.extensions&&wm(i,d,h),t.assignFinalMaterial(d),l.push(d)}for(let n=0,i=l.length;n<i;n++)t.associations.set(l[n],{meshes:e,primitives:n});if(1===l.length)return r.extensions&&wm(i,l[0],r),l[0];const c=new Wa;r.extensions&&wm(i,c,r),t.associations.set(c,{meshes:e});for(let e=0,t=l.length;e<t;e++)c.add(l[e]);return c}))}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(i)return"perspective"===n.type?t=new $s(ei.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):"orthographic"===n.type&&(t=new Sh(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),_m(t,n),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],n=[];for(let e=0,i=t.joints.length;e<i;e++)n.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then((function(e){const n=e.pop(),i=e,r=[],s=[];for(let e=0,o=i.length;e<o;e++){const o=i[e];if(o){r.push(o);const t=new lr;null!==n&&t.fromArray(n.array,16*e),s.push(t)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new Vo(r,s)}))}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],r=i.name?i.name:"animation_"+e,s=[],o=[],a=[],l=[],c=[];for(let e=0,t=i.channels.length;e<t;e++){const t=i.channels[e],n=i.samplers[t.sampler],r=t.target,h=r.node,d=void 0!==i.parameters?i.parameters[n.input]:n.input,u=void 0!==i.parameters?i.parameters[n.output]:n.output;void 0!==r.node&&(s.push(this.getDependency("node",h)),o.push(this.getDependency("accessor",d)),a.push(this.getDependency("accessor",u)),l.push(n),c.push(r))}return Promise.all([Promise.all(s),Promise.all(o),Promise.all(a),Promise.all(l),Promise.all(c)]).then((function(e){const t=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=[];for(let e=0,r=t.length;e<r;e++){const r=t[e],c=i[e],h=s[e],d=o[e],u=a[e];if(void 0===r)continue;r.updateMatrix&&r.updateMatrix();const p=n._createAnimationTracks(r,c,h,d,u);if(p)for(let e=0;e<p.length;e++)l.push(p[e])}return new $c(r,void 0,l)}))}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return void 0===i.mesh?null:n.getDependency("mesh",i.mesh).then((function(e){const t=n._getNodeRef(n.meshCache,i.mesh,e);return void 0!==i.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,n=i.weights.length;t<n;t++)e.morphTargetInfluences[t]=i.weights[t]})),t}))}loadNode(e){const t=this,n=this.json.nodes[e],i=t._loadNodeShallow(e),r=[],s=n.children||[];for(let e=0,n=s.length;e<n;e++)r.push(t.getDependency("node",s[e]));const o=void 0===n.skin?Promise.resolve(null):t.getDependency("skin",n.skin);return Promise.all([i,Promise.all(r),o]).then((function(e){const t=e[0],n=e[1],i=e[2];null!==i&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(i,Tm)}));for(let e=0,i=n.length;e<i;e++)t.add(n[e]);return t}))}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const r=t.nodes[e],s=r.name?i.createUniqueName(r.name):"",o=[],a=i._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return a&&o.push(a),void 0!==r.camera&&o.push(i.getDependency("camera",r.camera).then((function(e){return i._getNodeRef(i.cameraCache,r.camera,e)}))),i._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){o.push(e)})),this.nodeCache[e]=Promise.all(o).then((function(t){let o;if(o=!0===r.isBone?new Qo:t.length>1?new Wa:1===t.length?t[0]:new Ur,o!==t[0])for(let e=0,n=t.length;e<n;e++)o.add(t[e]);if(r.name&&(o.userData.name=r.name,o.name=s),_m(o,r),r.extensions&&wm(n,o,r),void 0!==r.matrix){const e=new lr;e.fromArray(r.matrix),o.applyMatrix4(e)}else void 0!==r.translation&&o.position.fromArray(r.translation),void 0!==r.rotation&&o.quaternion.fromArray(r.rotation),void 0!==r.scale&&o.scale.fromArray(r.scale);return i.associations.has(o)||i.associations.set(o,{}),i.associations.get(o).nodes=e,o})),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,r=new Wa;n.name&&(r.name=i.createUniqueName(n.name)),_m(r,n),n.extensions&&wm(t,r,n);const s=n.nodes||[],o=[];for(let e=0,t=s.length;e<t;e++)o.push(i.getDependency("node",s[e]));return Promise.all(o).then((function(e){for(let t=0,n=e.length;t<n;t++)r.add(e[t]);return i.associations=(e=>{const t=new Map;for(const[e,n]of i.associations)(e instanceof is||e instanceof Ci)&&t.set(e,n);return e.traverse((e=>{const n=i.associations.get(e);null!=n&&t.set(e,n)})),t})(r),r}))}_createAnimationTracks(e,t,n,i,r){const s=[],o=e.name?e.name:e.uuid,a=[];let l;switch(bm[r.path]===bm.weights?e.traverse((function(e){e.morphTargetInfluences&&a.push(e.name?e.name:e.uuid)})):a.push(o),bm[r.path]){case bm.weights:l=Xc;break;case bm.rotation:l=Jc;break;case bm.position:case bm.scale:l=Zc;break;default:l=1===n.itemSize?Xc:Zc}const c=void 0!==i.interpolation?Cm[i.interpolation]:kt,h=this._getArrayFromAccessor(n);for(let e=0,n=a.length;e<n;e++){const n=new l(a[e]+"."+bm[r.path],t.array,h,c);"CUBICSPLINE"===i.interpolation&&this._createCubicSplineTrackInterpolant(n),s.push(n)}return s}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=Bm(t.constructor),n=new Float32Array(t.length);for(let i=0,r=t.length;i<r;i++)n[i]=t[i]*e;t=n}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof Jc?fm:pm)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Lm(e,t,n){const i=t.attributes,r=[];function s(t,i){return n.getDependency("accessor",t).then((function(t){e.setAttribute(i,t)}))}for(const t in i){const n=xm[t]||t.toLowerCase();n in e.attributes||r.push(s(i[t],n))}if(void 0!==t.indices&&!e.index){const i=n.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));r.push(i)}return Ai.workingColorSpace!==nn&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ai.workingColorSpace}" not supported.`),_m(e,t),function(e,t,n){const i=t.attributes,r=new Ui;if(void 0===i.POSITION)return;{const e=n.json.accessors[i.POSITION],t=e.min,s=e.max;if(void 0===t||void 0===s)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new Li(t[0],t[1],t[2]),new Li(s[0],s[1],s[2])),e.normalized){const t=Bm(gm[e.componentType]);r.min.multiplyScalar(t),r.max.multiplyScalar(t)}}const s=t.targets;if(void 0!==s){const e=new Li,t=new Li;for(let i=0,r=s.length;i<r;i++){const r=s[i];if(void 0!==r.POSITION){const i=n.json.accessors[r.POSITION],s=i.min,o=i.max;if(void 0!==s&&void 0!==o){if(t.setX(Math.max(Math.abs(s[0]),Math.abs(o[0]))),t.setY(Math.max(Math.abs(s[1]),Math.abs(o[1]))),t.setZ(Math.max(Math.abs(s[2]),Math.abs(o[2]))),i.normalized){const e=Bm(gm[i.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(e)}e.boundingBox=r;const o=new $i;r.getCenter(o.center),o.radius=r.min.distanceTo(r.max)/2,e.boundingSphere=o}(e,t,n),Promise.all(r).then((function(){return void 0!==t.targets?function(e,t,n){let i=!1,r=!1,s=!1;for(let e=0,n=t.length;e<n;e++){const n=t[e];if(void 0!==n.POSITION&&(i=!0),void 0!==n.NORMAL&&(r=!0),void 0!==n.COLOR_0&&(s=!0),i&&r&&s)break}if(!i&&!r&&!s)return Promise.resolve(e);const o=[],a=[],l=[];for(let c=0,h=t.length;c<h;c++){const h=t[c];if(i){const t=void 0!==h.POSITION?n.getDependency("accessor",h.POSITION):e.attributes.position;o.push(t)}if(r){const t=void 0!==h.NORMAL?n.getDependency("accessor",h.NORMAL):e.attributes.normal;a.push(t)}if(s){const t=void 0!==h.COLOR_0?n.getDependency("accessor",h.COLOR_0):e.attributes.color;l.push(t)}}return Promise.all([Promise.all(o),Promise.all(a),Promise.all(l)]).then((function(t){const n=t[0],o=t[1],a=t[2];return i&&(e.morphAttributes.position=n),r&&(e.morphAttributes.normal=o),s&&(e.morphAttributes.color=a),e.morphTargetsRelative=!0,e}))}(e,t.targets,n):e}))}class Dm{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const n=this.workersResolve[e];if(n&&n(t),this.queue.length){const{resolve:t,msg:n,transfer:i}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(n,i)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise((n=>{const i=this._getIdleWorker();-1!==i?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=n,this.workers[i].postMessage(e,t)):this.queue.push({resolve:n,msg:e,transfer:t})}))}dispose(){this.workers.forEach((e=>e.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const Pm=9,Um=15,Om=16,Fm=22,km=37,Nm=43,Qm=76,Gm=83,zm=97,Hm=100,Vm=103,jm=109,Wm=165,qm=166,Xm=1000066e3;class Ym{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Jm{constructor(e,t,n,i){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,n),this._littleEndian=i,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t){void 0===t&&(t=0);const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}new Uint8Array([0]);const Km=[171,75,84,88,32,50,48,187,13,10,26,10];function Zm(e){return(new TextDecoder).decode(e)}var $m=n(9922).hp;let eg,tg,ng;const ig={env:{emscripten_notify_memory_growth:function(e){ng=new Uint8Array(tg.exports.memory.buffer)}}};class rg{init(){return eg||(eg="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+sg).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,ig))).then(this._init):WebAssembly.instantiate($m.from(sg,"base64"),ig).then(this._init),eg)}_init(e){tg=e.instance,ig.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!tg)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=e.byteLength,i=tg.exports.malloc(n);ng.set(e,i),t=t||Number(tg.exports.ZSTD_findDecompressedSize(i,n));const r=tg.exports.malloc(t),s=tg.exports.ZSTD_decompress(r,t,i,n),o=ng.slice(r,r+s);return tg.exports.free(i),tg.exports.free(r),o}}const sg="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",og=new WeakMap;let ag,lg=0;class cg extends rh{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new Dm,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const e=new ah(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),n=new ah(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,i]).then((([e,t])=>{const n=cg.BasisWorker.toString(),i=["/* constants */","let _EngineFormat = "+JSON.stringify(cg.EngineFormat),"let _EngineType = "+JSON.stringify(cg.EngineType),"let _TranscoderFormat = "+JSON.stringify(cg.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(cg.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([i])),this.transcoderBinary=t,this.workerPool.setWorkerCreator((()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e}))})),lg>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),lg++}return this.transcoderPending}load(e,t,n,i){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new ah(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(e,(e=>{this.parse(e,t,i)}),n,i)}parse(e,t,n){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(og.has(e))return og.get(e).promise.then(t).catch(n);this._createTexture(e).then((e=>t?t(e):null)).catch(n)}_createTextureFrom(e,t){const{type:n,error:i,data:{faces:r,width:s,height:o,format:a,type:l,dfdFlags:c}}=e;if("error"===n)return Promise.reject(i);let h;if(6===t.faceCount)h=new Ka(r,a,l);else{const e=r[0].mipmaps;h=t.layerCount>1?new Ja(e,s,o,t.layerCount,a,l):new Ya(e,s,o,a,l)}return h.minFilter=1===r[0].mipmaps.length?Me:Be,h.magFilter=Me,h.generateMipmaps=!1,h.needsUpdate=!0,h.colorSpace=pg(t),h.premultiplyAlpha=!!(1&c),h}async _createTexture(e,t={}){const n=function(e){const t=new Uint8Array(e.buffer,e.byteOffset,Km.length);if(t[0]!==Km[0]||t[1]!==Km[1]||t[2]!==Km[2]||t[3]!==Km[3]||t[4]!==Km[4]||t[5]!==Km[5]||t[6]!==Km[6]||t[7]!==Km[7]||t[8]!==Km[8]||t[9]!==Km[9]||t[10]!==Km[10]||t[11]!==Km[11])throw new Error("Missing KTX 2.0 identifier.");const n=new Ym,i=17*Uint32Array.BYTES_PER_ELEMENT,r=new Jm(e,Km.length,i,!0);n.vkFormat=r._nextUint32(),n.typeSize=r._nextUint32(),n.pixelWidth=r._nextUint32(),n.pixelHeight=r._nextUint32(),n.pixelDepth=r._nextUint32(),n.layerCount=r._nextUint32(),n.faceCount=r._nextUint32();const s=r._nextUint32();n.supercompressionScheme=r._nextUint32();const o=r._nextUint32(),a=r._nextUint32(),l=r._nextUint32(),c=r._nextUint32(),h=r._nextUint64(),d=r._nextUint64(),u=new Jm(e,Km.length+i,3*s*8,!0);for(let t=0;t<s;t++)n.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+u._nextUint64(),u._nextUint64()),uncompressedByteLength:u._nextUint64()});const p=new Jm(e,o,a,!0),A={vendorId:p._skip(4)._nextUint16(),descriptorType:p._nextUint16(),versionNumber:p._nextUint16(),descriptorBlockSize:p._nextUint16(),colorModel:p._nextUint8(),colorPrimaries:p._nextUint8(),transferFunction:p._nextUint8(),flags:p._nextUint8(),texelBlockDimension:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],bytesPlane:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],samples:[]},f=(A.descriptorBlockSize/4-6)/4;for(let e=0;e<f;e++){const t={bitOffset:p._nextUint16(),bitLength:p._nextUint8(),channelType:p._nextUint8(),samplePosition:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=p._nextInt32(),t.sampleUpper=p._nextInt32()):(t.sampleLower=p._nextUint32(),t.sampleUpper=p._nextUint32()),A.samples[e]=t}n.dataFormatDescriptor.length=0,n.dataFormatDescriptor.push(A);const m=new Jm(e,l,c,!0);for(;m._offset<c;){const e=m._nextUint32(),t=m._scan(e),i=Zm(t);if(n.keyValue[i]=m._nextUint8Array(e-t.byteLength-1),i.match(/^ktx/i)){const e=Zm(n.keyValue[i]);n.keyValue[i]=e.substring(0,e.lastIndexOf("\0"))}m._skip(e%4?4-e%4:0)}if(d<=0)return n;const g=new Jm(e,h,d,!0),v=g._nextUint16(),y=g._nextUint16(),E=g._nextUint32(),x=g._nextUint32(),b=g._nextUint32(),C=g._nextUint32(),w=[];for(let e=0;e<s;e++)w.push({imageFlags:g._nextUint32(),rgbSliceByteOffset:g._nextUint32(),rgbSliceByteLength:g._nextUint32(),alphaSliceByteOffset:g._nextUint32(),alphaSliceByteLength:g._nextUint32()});const _=h+g._offset,M=_+E,S=M+x,I=S+b,B=new Uint8Array(e.buffer,e.byteOffset+_,E),T=new Uint8Array(e.buffer,e.byteOffset+M,x),R=new Uint8Array(e.buffer,e.byteOffset+S,b),L=new Uint8Array(e.buffer,e.byteOffset+I,C);return n.globalData={endpointCount:v,selectorCount:y,imageDescs:w,endpointsData:B,selectorsData:T,tablesData:R,extendedData:L},n}(new Uint8Array(e)),i=n.vkFormat===Xm&&167===n.dataFormatDescriptor[0].colorModel;if(0!==n.vkFormat&&(!i||this.workerConfig.astcHDRSupported))return async function(e){const{vkFormat:t}=e;if(void 0===dg[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let n;2===e.supercompressionScheme&&(ag||(ag=new Promise((async e=>{const t=new rg;await t.init(),e(t)}))),n=await ag);const i=[];for(let r=0;r<e.levels.length;r++){const s=Math.max(1,e.pixelWidth>>r),o=Math.max(1,e.pixelHeight>>r),a=e.pixelDepth?Math.max(1,e.pixelDepth>>r):0,l=e.levels[r];let c,h;if(0===e.supercompressionScheme)c=l.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");c=n.decode(l.levelData,l.uncompressedByteLength)}h=ug[t]===Fe?new Float32Array(c.buffer,c.byteOffset,c.byteLength/Float32Array.BYTES_PER_ELEMENT):ug[t]===ke?new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT):c,i.push({data:h,width:s,height:o,depth:a})}let r;if(hg.has(dg[t]))r=0===e.pixelDepth?new Go(i[0].data,e.pixelWidth,e.pixelHeight):new Bi(i[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");r=new Ya(i,e.pixelWidth,e.pixelHeight),r.minFilter=1===i.length?Me:Be,r.magFilter=Me}return r.mipmaps=i,r.type=ug[t],r.format=dg[t],r.colorSpace=pg(e),r.needsUpdate=!0,Promise.resolve(r)}(n);const r=t,s=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:r},[e]))).then((e=>this._createTextureFrom(e.data,n)));return og.set(e,{promise:s}),s}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),lg--,this}}cg.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},cg.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25},cg.EngineFormat={RGBAFormat:je,RGBA_ASTC_4x4_Format:pt,RGB_BPTC_UNSIGNED_Format:Bt,RGBA_BPTC_Format:St,RGBA_ETC2_EAC_Format:ut,RGBA_PVRTC_4BPPV1_Format:lt,RGBA_S3TC_DXT5_Format:st,RGB_ETC1_Format:ht,RGB_ETC2_Format:dt,RGB_PVRTC_4BPPV1_Format:ot,RGBA_S3TC_DXT1_Format:it},cg.EngineType={UnsignedByteType:Re,HalfFloatType:ke,FloatType:Fe},cg.BasisWorker=function(){let e,t,n;const i=_EngineFormat,r=_EngineType,s=_TranscoderFormat,o=_BasisFormat;self.addEventListener("message",(function(i){const s=i.data;switch(s.type){case"init":e=s.config,a=s.transcoderBinary,t=new Promise((e=>{n={wasmBinary:a,onRuntimeInitialized:e},BASIS(n)})).then((()=>{n.initializeBasis(),void 0===n.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}));break;case"transcode":t.then((()=>{try{const{faces:t,buffers:i,width:a,height:d,hasAlpha:u,format:p,type:A,dfdFlags:f}=function(t){const i=new n.KTX2File(new Uint8Array(t));function s(){i.close(),i.delete()}if(!i.isValid())throw s(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");let a;if(i.isUASTC())a=o.UASTC;else if(i.isETC1S())a=o.ETC1S;else{if(!i.isHDR())throw new Error("THREE.KTX2Loader: Unknown Basis encoding");a=o.UASTC_HDR}const d=i.getWidth(),u=i.getHeight(),p=i.getLayers()||1,A=i.getLevels(),f=i.getFaces(),m=i.getHasAlpha(),g=i.getDFDFlags(),{transcoderFormat:v,engineFormat:y,engineType:E}=function(t,n,i,r){const s=l[t];for(let o=0;o<s.length;o++){const a=s[o];if((!a.if||e[a.if])&&(a.basisFormat.includes(t)&&!(r&&a.transcoderFormat.length<2)&&(!a.needsPowerOfTwo||c(n)&&c(i))))return{transcoderFormat:a.transcoderFormat[r?1:0],engineFormat:a.engineFormat[r?1:0],engineType:a.engineType[0]}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}(a,d,u,m);if(!d||!u||!A)throw s(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!i.startTranscoding())throw s(),new Error("THREE.KTX2Loader: .startTranscoding failed");const x=[],b=[];for(let e=0;e<f;e++){const t=[];for(let n=0;n<A;n++){const o=[];let a,l;for(let t=0;t<p;t++){const c=i.getImageLevelInfo(n,t,e);0!==e||0!==n||0!==t||c.origWidth%4==0&&c.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),A>1?(a=c.origWidth,l=c.origHeight):(a=c.width,l=c.height);let h=new Uint8Array(i.getImageTranscodedSizeInBytes(n,t,0,v));const d=i.transcodeImage(h,n,t,e,v,0,-1,-1);if(E===r.HalfFloatType&&(h=new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!d)throw s(),new Error("THREE.KTX2Loader: .transcodeImage failed.");o.push(h)}const c=h(o);t.push({data:c,width:a,height:l}),b.push(c.buffer)}x.push({mipmaps:t,width:d,height:u,format:y,type:E})}return s(),{faces:x,buffers:b,width:d,height:u,hasAlpha:m,dfdFlags:g,format:y,type:E}}(s.buffer);self.postMessage({type:"transcode",id:s.id,data:{faces:t,width:a,height:d,hasAlpha:u,format:p,type:A,dfdFlags:f}},i)}catch(e){console.error(e),self.postMessage({type:"error",id:s.id,error:e.message})}}))}var a}));const a=[{if:"astcSupported",basisFormat:[o.UASTC],transcoderFormat:[s.ASTC_4x4,s.ASTC_4x4],engineFormat:[i.RGBA_ASTC_4x4_Format,i.RGBA_ASTC_4x4_Format],engineType:[r.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC7_M5,s.BC7_M5],engineFormat:[i.RGBA_BPTC_Format,i.RGBA_BPTC_Format],engineType:[r.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.BC1,s.BC3],engineFormat:[i.RGBA_S3TC_DXT1_Format,i.RGBA_S3TC_DXT5_Format],engineType:[r.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1,s.ETC2],engineFormat:[i.RGB_ETC2_Format,i.RGBA_ETC2_EAC_Format],engineType:[r.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.ETC1],engineFormat:[i.RGB_ETC1_Format],engineType:[r.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.PVRTC1_4_RGB,s.PVRTC1_4_RGBA],engineFormat:[i.RGB_PVRTC_4BPPV1_Format,i.RGBA_PVRTC_4BPPV1_Format],engineType:[r.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[o.UASTC_HDR],transcoderFormat:[s.BC6H],engineFormat:[i.RGB_BPTC_UNSIGNED_Format],engineType:[r.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[o.ETC1S,o.UASTC],transcoderFormat:[s.RGBA32,s.RGBA32],engineFormat:[i.RGBAFormat,i.RGBAFormat],engineType:[r.UnsignedByteType,r.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[o.UASTC_HDR],transcoderFormat:[s.RGBA_HALF],engineFormat:[i.RGBAFormat],engineType:[r.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],l={[o.ETC1S]:a.filter((e=>e.basisFormat.includes(o.ETC1S))).sort(((e,t)=>e.priorityUASTC-t.priorityUASTC)),[o.UASTC]:a.filter((e=>e.basisFormat.includes(o.UASTC))).sort(((e,t)=>e.priorityUASTC-t.priorityUASTC)),[o.UASTC_HDR]:a.filter((e=>e.basisFormat.includes(o.UASTC_HDR))).sort(((e,t)=>e.priorityHDR-t.priorityHDR))};function c(e){return e<=2||!(e&e-1)&&0!==e}function h(e){if(1===e.length)return e[0];let t=0;for(let n=0;n<e.length;n++)t+=e[n].byteLength;const n=new Uint8Array(t);let i=0;for(let t=0;t<e.length;t++){const r=e[t];n.set(r,i),i+=r.byteLength}return n}};const hg=new Set([je,Ze,Je]),dg={[jm]:je,[zm]:je,[km]:je,[Nm]:je,[Vm]:Ze,[Gm]:Ze,[Om]:Ze,[Fm]:Ze,[Hm]:Je,[Qm]:Je,[Um]:Je,[Pm]:Je,[Xm]:pt,[qm]:gt,[Wm]:gt},ug={[jm]:Fe,[zm]:ke,[km]:Re,[Nm]:Re,[Vm]:Fe,[Gm]:ke,[Om]:Re,[Fm]:Re,[Hm]:Fe,[Qm]:ke,[Um]:Re,[Pm]:Re,[Xm]:ke,[qm]:Re,[Wm]:Re};function pg(e){const t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?tn:nn:10===t.colorPrimaries?2===t.transferFunction?"display-p3":"display-p3-linear":(0===t.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),en)}const Ag={c:null,u:[new Li,new Li,new Li],e:[]},fg={c:null,u:[new Li,new Li,new Li],e:[]},mg=[[],[],[]],gg=[[],[],[]],vg=[],yg=new Li,Eg=new Li,xg=new Li,bg=new Li,Cg=new Li,wg=new Li,_g=new ni,Mg=new Ui,Sg=new lr,Ig=new lr,Bg=new ar;class Tg{constructor(e=new Li,t=new Li,n=new ni){this.center=e,this.halfSize=t,this.rotation=n}set(e,t,n){return this.center=e,this.halfSize=t,this.rotation=n,this}copy(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this}clone(){return(new this.constructor).copy(this)}getSize(e){return e.copy(this.halfSize).multiplyScalar(2)}clampPoint(e,t){const n=this.halfSize;bg.subVectors(e,this.center),this.rotation.extractBasis(yg,Eg,xg),t.copy(this.center);const i=ei.clamp(bg.dot(yg),-n.x,n.x);t.add(yg.multiplyScalar(i));const r=ei.clamp(bg.dot(Eg),-n.y,n.y);t.add(Eg.multiplyScalar(r));const s=ei.clamp(bg.dot(xg),-n.z,n.z);return t.add(xg.multiplyScalar(s)),t}containsPoint(e){return bg.subVectors(e,this.center),this.rotation.extractBasis(yg,Eg,xg),Math.abs(bg.dot(yg))<=this.halfSize.x&&Math.abs(bg.dot(Eg))<=this.halfSize.y&&Math.abs(bg.dot(xg))<=this.halfSize.z}intersectsBox3(e){return this.intersectsOBB(Rg.fromBox3(e))}intersectsSphere(e){return this.clampPoint(e.center,wg),wg.distanceToSquared(e.center)<=e.radius*e.radius}intersectsOBB(e,t=Number.EPSILON){Ag.c=this.center,Ag.e[0]=this.halfSize.x,Ag.e[1]=this.halfSize.y,Ag.e[2]=this.halfSize.z,this.rotation.extractBasis(Ag.u[0],Ag.u[1],Ag.u[2]),fg.c=e.center,fg.e[0]=e.halfSize.x,fg.e[1]=e.halfSize.y,fg.e[2]=e.halfSize.z,e.rotation.extractBasis(fg.u[0],fg.u[1],fg.u[2]);for(let e=0;e<3;e++)for(let t=0;t<3;t++)mg[e][t]=Ag.u[e].dot(fg.u[t]);bg.subVectors(fg.c,Ag.c),vg[0]=bg.dot(Ag.u[0]),vg[1]=bg.dot(Ag.u[1]),vg[2]=bg.dot(Ag.u[2]);for(let e=0;e<3;e++)for(let n=0;n<3;n++)gg[e][n]=Math.abs(mg[e][n])+t;let n,i;for(let e=0;e<3;e++)if(n=Ag.e[e],i=fg.e[0]*gg[e][0]+fg.e[1]*gg[e][1]+fg.e[2]*gg[e][2],Math.abs(vg[e])>n+i)return!1;for(let e=0;e<3;e++)if(n=Ag.e[0]*gg[0][e]+Ag.e[1]*gg[1][e]+Ag.e[2]*gg[2][e],i=fg.e[e],Math.abs(vg[0]*mg[0][e]+vg[1]*mg[1][e]+vg[2]*mg[2][e])>n+i)return!1;return n=Ag.e[1]*gg[2][0]+Ag.e[2]*gg[1][0],i=fg.e[1]*gg[0][2]+fg.e[2]*gg[0][1],!(Math.abs(vg[2]*mg[1][0]-vg[1]*mg[2][0])>n+i||(n=Ag.e[1]*gg[2][1]+Ag.e[2]*gg[1][1],i=fg.e[0]*gg[0][2]+fg.e[2]*gg[0][0],Math.abs(vg[2]*mg[1][1]-vg[1]*mg[2][1])>n+i||(n=Ag.e[1]*gg[2][2]+Ag.e[2]*gg[1][2],i=fg.e[0]*gg[0][1]+fg.e[1]*gg[0][0],Math.abs(vg[2]*mg[1][2]-vg[1]*mg[2][2])>n+i||(n=Ag.e[0]*gg[2][0]+Ag.e[2]*gg[0][0],i=fg.e[1]*gg[1][2]+fg.e[2]*gg[1][1],Math.abs(vg[0]*mg[2][0]-vg[2]*mg[0][0])>n+i||(n=Ag.e[0]*gg[2][1]+Ag.e[2]*gg[0][1],i=fg.e[0]*gg[1][2]+fg.e[2]*gg[1][0],Math.abs(vg[0]*mg[2][1]-vg[2]*mg[0][1])>n+i||(n=Ag.e[0]*gg[2][2]+Ag.e[2]*gg[0][2],i=fg.e[0]*gg[1][1]+fg.e[1]*gg[1][0],Math.abs(vg[0]*mg[2][2]-vg[2]*mg[0][2])>n+i||(n=Ag.e[0]*gg[1][0]+Ag.e[1]*gg[0][0],i=fg.e[1]*gg[2][2]+fg.e[2]*gg[2][1],Math.abs(vg[1]*mg[0][0]-vg[0]*mg[1][0])>n+i||(n=Ag.e[0]*gg[1][1]+Ag.e[1]*gg[0][1],i=fg.e[0]*gg[2][2]+fg.e[2]*gg[2][0],Math.abs(vg[1]*mg[0][1]-vg[0]*mg[1][1])>n+i||(n=Ag.e[0]*gg[1][2]+Ag.e[1]*gg[0][2],i=fg.e[0]*gg[2][1]+fg.e[1]*gg[2][0],Math.abs(vg[1]*mg[0][2]-vg[0]*mg[1][2])>n+i)))))))))}intersectsPlane(e){this.rotation.extractBasis(yg,Eg,xg);const t=this.halfSize.x*Math.abs(e.normal.dot(yg))+this.halfSize.y*Math.abs(e.normal.dot(Eg))+this.halfSize.z*Math.abs(e.normal.dot(xg)),n=e.normal.dot(this.center)-e.constant;return Math.abs(n)<=t}intersectRay(e,t){return this.getSize(Cg),Mg.setFromCenterAndSize(bg.set(0,0,0),Cg),Sg.setFromMatrix3(this.rotation),Sg.setPosition(this.center),Ig.copy(Sg).invert(),Bg.copy(e).applyMatrix4(Ig),Bg.intersectBox(Mg,t)?t.applyMatrix4(Sg):null}intersectsRay(e){return null!==this.intersectRay(e,bg)}fromBox3(e){return e.getCenter(this.center),e.getSize(this.halfSize).multiplyScalar(.5),this.rotation.identity(),this}equals(e){return e.center.equals(this.center)&&e.halfSize.equals(this.halfSize)&&e.rotation.equals(this.rotation)}applyMatrix4(e){const t=e.elements;let n=bg.set(t[0],t[1],t[2]).length();const i=bg.set(t[4],t[5],t[6]).length(),r=bg.set(t[8],t[9],t[10]).length();e.determinant()<0&&(n=-n),_g.setFromMatrix4(e);const s=1/n,o=1/i,a=1/r;return _g.elements[0]*=s,_g.elements[1]*=s,_g.elements[2]*=s,_g.elements[3]*=o,_g.elements[4]*=o,_g.elements[5]*=o,_g.elements[6]*=a,_g.elements[7]*=a,_g.elements[8]*=a,this.rotation.multiply(_g),this.halfSize.x*=n,this.halfSize.y*=i,this.halfSize.z*=r,bg.setFromMatrixPosition(e),this.center.add(bg),this}}const Rg=new Tg,Lg=/^[og]\s*(.+)?/,Dg=/^mtllib /,Pg=/^usemtl /,Ug=/^usemap /,Og=/\s+/,Fg=new Li,kg=new Li,Ng=new Li,Qg=new Li,Gg=new Li,zg=new es;function Hg(){const e={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(e,t){if(this.object&&!1===this.object.fromDeclaration)return this.object.name=e,void(this.object.fromDeclaration=!1!==t);const n=this.object&&"function"==typeof this.object.currentMaterial?this.object.currentMaterial():void 0;if(this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0),this.object={name:e||"",fromDeclaration:!1!==t,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(e,t){const n=this._finalize(!1);n&&(n.inherited||n.groupCount<=0)&&this.materials.splice(n.index,1);const i={index:this.materials.length,name:e||"",mtllib:Array.isArray(t)&&t.length>0?t[t.length-1]:"",smooth:void 0!==n?n.smooth:this.smooth,groupStart:void 0!==n?n.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){const t={index:"number"==typeof e?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(i),i},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){const t=this.currentMaterial();if(t&&-1===t.groupEnd&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&0===this.materials.length&&this.materials.push({name:"",smooth:this.smooth}),t}},n&&n.name&&"function"==typeof n.clone){const e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&"function"==typeof this.object._finalize&&this.object._finalize(!0)},parseVertexIndex:function(e,t){const n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseNormalIndex:function(e,t){const n=parseInt(e,10);return 3*(n>=0?n-1:n+t/3)},parseUVIndex:function(e,t){const n=parseInt(e,10);return 2*(n>=0?n-1:n+t/2)},addVertex:function(e,t,n){const i=this.vertices,r=this.object.geometry.vertices;r.push(i[e+0],i[e+1],i[e+2]),r.push(i[t+0],i[t+1],i[t+2]),r.push(i[n+0],i[n+1],i[n+2])},addVertexPoint:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){const t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){const i=this.normals,r=this.object.geometry.normals;r.push(i[e+0],i[e+1],i[e+2]),r.push(i[t+0],i[t+1],i[t+2]),r.push(i[n+0],i[n+1],i[n+2])},addFaceNormal:function(e,t,n){const i=this.vertices,r=this.object.geometry.normals;Fg.fromArray(i,e),kg.fromArray(i,t),Ng.fromArray(i,n),Gg.subVectors(Ng,kg),Qg.subVectors(Fg,kg),Gg.cross(Qg),Gg.normalize(),r.push(Gg.x,Gg.y,Gg.z),r.push(Gg.x,Gg.y,Gg.z),r.push(Gg.x,Gg.y,Gg.z)},addColor:function(e,t,n){const i=this.colors,r=this.object.geometry.colors;void 0!==i[e]&&r.push(i[e+0],i[e+1],i[e+2]),void 0!==i[t]&&r.push(i[t+0],i[t+1],i[t+2]),void 0!==i[n]&&r.push(i[n+0],i[n+1],i[n+2])},addUV:function(e,t,n){const i=this.uvs,r=this.object.geometry.uvs;r.push(i[e+0],i[e+1]),r.push(i[t+0],i[t+1]),r.push(i[n+0],i[n+1])},addDefaultUV:function(){const e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){const t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,i,r,s,o,a,l){const c=this.vertices.length;let h=this.parseVertexIndex(e,c),d=this.parseVertexIndex(t,c),u=this.parseVertexIndex(n,c);if(this.addVertex(h,d,u),this.addColor(h,d,u),void 0!==o&&""!==o){const e=this.normals.length;h=this.parseNormalIndex(o,e),d=this.parseNormalIndex(a,e),u=this.parseNormalIndex(l,e),this.addNormal(h,d,u)}else this.addFaceNormal(h,d,u);if(void 0!==i&&""!==i){const e=this.uvs.length;h=this.parseUVIndex(i,e),d=this.parseUVIndex(r,e),u=this.parseUVIndex(s,e),this.addUV(h,d,u),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type="Points";const t=this.vertices.length;for(let n=0,i=e.length;n<i;n++){const i=this.parseVertexIndex(e[n],t);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(e,t){this.object.geometry.type="Line";const n=this.vertices.length,i=this.uvs.length;for(let t=0,i=e.length;t<i;t++)this.addVertexLine(this.parseVertexIndex(e[t],n));for(let e=0,n=t.length;e<n;e++)this.addUVLine(this.parseUVIndex(t[e],i))}};return e.startObject("",!1),e}class Vg{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:m,this.wrap=void 0!==this.options.wrap?this.options.wrap:ve}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],i={name:e,side:this.side};function r(e,n){if(i[e])return;const r=t.getTextureParams(n,i),s=t.loadTexture((o=t.baseUrl,"string"!=typeof(a=r.url)||""===a?"":/^https?:\/\//i.test(a)?a:o+a));var o,a;s.repeat.copy(r.scale),s.offset.copy(r.offset),s.wrapS=t.wrap,s.wrapT=t.wrap,"map"!==e&&"emissiveMap"!==e||(s.colorSpace=tn),i[e]=s}for(const e in n){const t=n[e];let s;if(""!==t)switch(e.toLowerCase()){case"kd":i.color=Ai.toWorkingColorSpace((new es).fromArray(t),tn);break;case"ks":i.specular=Ai.toWorkingColorSpace((new es).fromArray(t),tn);break;case"ke":i.emissive=Ai.toWorkingColorSpace((new es).fromArray(t),tn);break;case"map_kd":r("map",t);break;case"map_ks":r("specularMap",t);break;case"map_ke":r("emissiveMap",t);break;case"norm":r("normalMap",t);break;case"map_bump":case"bump":r("bumpMap",t);break;case"map_d":r("alphaMap",t),i.transparent=!0;break;case"ns":i.shininess=parseFloat(t);break;case"d":s=parseFloat(t),s<1&&(i.opacity=s,i.transparent=!0);break;case"tr":s=parseFloat(t),this.options&&this.options.invertTrProperty&&(s=1-s),s>0&&(i.opacity=1-s,i.transparent=!0)}}return this.materials[e]=new Sc(i),this.materials[e]}getTextureParams(e,t){const n={scale:new ti(1,1),offset:new ti(0,0)},i=e.split(/\s+/);let r;return r=i.indexOf("-bm"),r>=0&&(t.bumpScale=parseFloat(i[r+1]),i.splice(r,2)),r=i.indexOf("-s"),r>=0&&(n.scale.set(parseFloat(i[r+1]),parseFloat(i[r+2])),i.splice(r,4)),r=i.indexOf("-o"),r>=0&&(n.offset.set(parseFloat(i[r+1]),parseFloat(i[r+2])),i.splice(r,4)),n.url=i.join(" ").trim(),n}loadTexture(e,t,n,i,r){const s=void 0!==this.manager?this.manager:ih;let o=s.getHandler(e);null===o&&(o=new ph(s)),o.setCrossOrigin&&o.setCrossOrigin(this.crossOrigin);const a=o.load(e,n,i,r);return void 0!==t&&(a.mapping=t),a}}function jg(e,t){switch(t){case tn:e.convertSRGBToLinear();break;case nn:case en:break;default:console.warn("WARNING: LightProbeGenerator convertColorToLinear() encountered an unsupported color space.")}return e}var Wg={...i};Wg.DRACOLoader=class extends rh{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){const r=new ah(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,(e=>{this.parse(e,t,i)}),n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,tn,n).catch(n)}decodeDracoFile(e,t,n,i,r=nn,s=()=>{}){const o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:r};return this.decodeGeometry(e,o).then(t).catch(s)}decodeGeometry(e,t){const n=JSON.stringify(t);if(of.has(e)){const t=of.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,s=e.byteLength,o=this._getWorker(r,s).then((n=>(i=n,new Promise(((n,s)=>{i._callbacks[r]={resolve:n,reject:s},i.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return o.catch((()=>!0)).then((()=>{i&&r&&this._releaseTask(i,r)})),of.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new Bs;e.index&&t.setIndex(new us(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const i=e.attributes[n],r=i.name,s=i.array,o=i.itemSize,a=new us(s,o);"color"===r&&(this._assignVertexColorSpace(a,i.vertexColorSpace),a.normalized=s instanceof Float32Array==0),t.setAttribute(r,a)}return t}_assignVertexColorSpace(e,t){if(t!==tn)return;const n=new es;for(let t=0,i=e.count;t<i;t++)n.fromBufferAttribute(e,t),Ai.toWorkingColorSpace(n,tn),e.setXYZ(t,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new ah(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise(((t,i)=>{n.load(e,t,void 0,i)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const i=af.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const n=t.data;switch(n.type){case"decode":e._callbacks[n.id].resolve(n);break;case"error":e._callbacks[n.id].reject(n);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+n.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}},Wg.GLTFLoader=class extends rh{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new qf(e)})),this.register((function(e){return new Xf(e)})),this.register((function(e){return new im(e)})),this.register((function(e){return new rm(e)})),this.register((function(e){return new sm(e)})),this.register((function(e){return new Jf(e)})),this.register((function(e){return new Kf(e)})),this.register((function(e){return new Zf(e)})),this.register((function(e){return new $f(e)})),this.register((function(e){return new Wf(e)})),this.register((function(e){return new em(e)})),this.register((function(e){return new Yf(e)})),this.register((function(e){return new nm(e)})),this.register((function(e){return new tm(e)})),this.register((function(e){return new Vf(e)})),this.register((function(e){return new om(e)})),this.register((function(e){return new am(e)}))}load(e,t,n,i){const r=this;let s;if(""!==this.resourcePath)s=this.resourcePath;else if(""!==this.path){const t=Uh.extractUrlBase(e);s=Uh.resolveURL(t,this.path)}else s=Uh.extractUrlBase(e);this.manager.itemStart(e);const o=function(t){i?i(t):console.error(t),r.manager.itemError(e),r.manager.itemEnd(e)},a=new ah(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,(function(n){try{r.parse(n,s,(function(n){t(n),r.manager.itemEnd(e)}),o)}catch(e){o(e)}}),n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let r;const s={},o={},a=new TextDecoder;if("string"==typeof e)r=JSON.parse(e);else if(e instanceof ArrayBuffer)if(a.decode(new Uint8Array(e,0,4))===lm){try{s[bf]=new cm(e)}catch(e){return void(i&&i(e))}r=JSON.parse(s[bf].content)}else r=JSON.parse(a.decode(e));else r=e;if(void 0===r.asset||r.asset.version[0]<2)return void(i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new Rm(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](l);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[t.name]=t,s[t.name]=!0}if(r.extensionsUsed)for(let e=0;e<r.extensionsUsed.length;++e){const t=r.extensionsUsed[e],n=r.extensionsRequired||[];switch(t){case Df:s[t]=new jf;break;case Cf:s[t]=new hm(r,this.dracoLoader);break;case Of:s[t]=new dm;break;case Ff:s[t]=new um;break;default:n.indexOf(t)>=0&&void 0===o[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}l.setExtensions(s),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise((function(i,r){n.parse(e,t,i,r)}))}},Wg.KTX2Loader=cg,Wg.OBJLoader=class extends rh{constructor(e){super(e),this.materials=null}load(e,t,n,i){const r=this,s=new ah(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,(function(n){try{t(r.parse(n))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}setMaterials(e){return this.materials=e,this}parse(e){const t=new Hg;-1!==e.indexOf("\r\n")&&(e=e.replace(/\r\n/g,"\n")),-1!==e.indexOf("\\\n")&&(e=e.replace(/\\\n/g,""));const n=e.split("\n");let i=[];for(let e=0,r=n.length;e<r;e++){const r=n[e].trimStart();if(0===r.length)continue;const s=r.charAt(0);if("#"!==s)if("v"===s){const e=r.split(Og);switch(e[0]){case"v":t.vertices.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3])),e.length>=7?(zg.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6]),tn),t.colors.push(zg.r,zg.g,zg.b)):t.colors.push(void 0,void 0,void 0);break;case"vn":t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case"vt":t.uvs.push(parseFloat(e[1]),parseFloat(e[2]))}}else if("f"===s){const e=r.slice(1).trim().split(Og),n=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];if(i.length>0){const e=i.split("/");n.push(e)}}const i=n[0];for(let e=1,r=n.length-1;e<r;e++){const r=n[e],s=n[e+1];t.addFace(i[0],r[0],s[0],i[1],r[1],s[1],i[2],r[2],s[2])}}else if("l"===s){const e=r.substring(1).trim().split(" ");let n=[];const i=[];if(-1===r.indexOf("/"))n=e;else for(let t=0,r=e.length;t<r;t++){const r=e[t].split("/");""!==r[0]&&n.push(r[0]),""!==r[1]&&i.push(r[1])}t.addLineGeometry(n,i)}else if("p"===s){const e=r.slice(1).trim().split(" ");t.addPointGeometry(e)}else if(null!==(i=Lg.exec(r))){const e=(" "+i[0].slice(1).trim()).slice(1);t.startObject(e)}else if(Pg.test(r))t.object.startMaterial(r.substring(7).trim(),t.materialLibraries);else if(Dg.test(r))t.materialLibraries.push(r.substring(7).trim());else if(Ug.test(r))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if("s"===s){if(i=r.split(" "),i.length>1){const e=i[1].trim().toLowerCase();t.object.smooth="0"!==e&&"off"!==e}else t.object.smooth=!0;const e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if("\0"===r)continue;console.warn('THREE.OBJLoader: Unexpected line: "'+r+'"')}}t.finalize();const r=new Wa;if(r.materialLibraries=[].concat(t.materialLibraries),!0==!(1===t.objects.length&&0===t.objects[0].geometry.vertices.length))for(let e=0,n=t.objects.length;e<n;e++){const n=t.objects[e],i=n.geometry,s=n.materials,o="Line"===i.type,a="Points"===i.type;let l=!1;if(0===i.vertices.length)continue;const c=new Bs;c.setAttribute("position",new xs(i.vertices,3)),i.normals.length>0&&c.setAttribute("normal",new xs(i.normals,3)),i.colors.length>0&&(l=!0,c.setAttribute("color",new xs(i.colors,3))),!0===i.hasUVIndices&&c.setAttribute("uv",new xs(i.uvs,2));const h=[];for(let e=0,n=s.length;e<n;e++){const n=s[e],i=n.name+"_"+n.smooth+"_"+l;let r=t.materials[i];if(null!==this.materials)if(r=this.materials.create(n.name),!o||!r||r instanceof _a){if(a&&r&&!(r instanceof Na)){const e=new Na({size:10,sizeAttenuation:!1});is.prototype.copy.call(e,r),e.color.copy(r.color),e.map=r.map,r=e}}else{const e=new _a;is.prototype.copy.call(e,r),e.color.copy(r.color),r=e}void 0===r&&(r=o?new _a:a?new Na({size:1,sizeAttenuation:!1}):new Sc,r.name=n.name,r.flatShading=!n.smooth,r.vertexColors=l,t.materials[i]=r),h.push(r)}let d;if(h.length>1){for(let e=0,t=s.length;e<t;e++){const t=s[e];c.addGroup(t.groupStart,t.groupCount,e)}d=o?new Fa(c,h):a?new Va(c,h):new Gs(c,h)}else d=o?new Fa(c,h[0]):a?new Va(c,h[0]):new Gs(c,h[0]);d.name=n.name,r.add(d)}else if(t.vertices.length>0){const e=new Na({size:1,sizeAttenuation:!1}),n=new Bs;n.setAttribute("position",new xs(t.vertices,3)),t.colors.length>0&&void 0!==t.colors[0]&&(n.setAttribute("color",new xs(t.colors,3)),e.vertexColors=!0);const i=new Va(n,e);r.add(i)}return r}},Wg.MTLLoader=class extends rh{constructor(e){super(e)}load(e,t,n,i){const r=this,s=""===this.path?Uh.extractUrlBase(e):this.path,o=new ah(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,(function(n){try{t(r.parse(n,s))}catch(t){i?i(t):console.error(t),r.manager.itemError(e)}}),n,i)}setMaterialOptions(e){return this.materialOptions=e,this}parse(e,t){const n=e.split("\n");let i={};const r=/\s+/,s={};for(let e=0;e<n.length;e++){let t=n[e];if(t=t.trim(),0===t.length||"#"===t.charAt(0))continue;const o=t.indexOf(" ");let a=o>=0?t.substring(0,o):t;a=a.toLowerCase();let l=o>=0?t.substring(o+1):"";if(l=l.trim(),"newmtl"===a)i={name:l},s[l]=i;else if("ka"===a||"kd"===a||"ks"===a||"ke"===a){const e=l.split(r,3);i[a]=[parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2])]}else i[a]=l}const o=new Vg(this.resourcePath||t,this.materialOptions);return o.setCrossOrigin(this.crossOrigin),o.setManager(this.manager),o.setMaterials(s),o}},Wg.OBB=Tg,Wg.BufferGeometryUtils=r,Wg.LightProbeGenerator=class{static fromCubeTexture(e){let t=0;const n=new Li,i=new Li,r=new es,s=[0,0,0,0,0,0,0,0,0],o=new Lh,a=o.coefficients;for(let o=0;o<6;o++){const l=e.image[o],c=l.width,h=l.height,d=document.createElement("canvas");d.width=c,d.height=h;const u=d.getContext("2d");u.drawImage(l,0,0,c,h);const p=u.getImageData(0,0,c,h),A=p.data,f=p.width,m=2/f;for(let l=0,c=A.length;l<c;l+=4){r.setRGB(A[l]/255,A[l+1]/255,A[l+2]/255),jg(r,e.colorSpace);const c=l/4,h=(c%f+.5)*m-1,d=1-(Math.floor(c/f)+.5)*m;switch(o){case 0:n.set(-1,d,-h);break;case 1:n.set(1,d,h);break;case 2:n.set(-h,1,-d);break;case 3:n.set(-h,-1,d);break;case 4:n.set(-h,d,1);break;case 5:n.set(h,d,-1)}const u=n.lengthSq(),p=4/(Math.sqrt(u)*u);t+=p,i.copy(n).normalize(),Lh.getBasisAt(i,s);for(let e=0;e<9;e++)a[e].x+=s[e]*r.r*p,a[e].y+=s[e]*r.g*p,a[e].z+=s[e]*r.b*p}}const l=4*Math.PI/t;for(let e=0;e<9;e++)a[e].x*=l,a[e].y*=l,a[e].z*=l;return new Dh(o)}static async fromCubeRenderTarget(e,t){const n=e.coordinateSystem===Gn?-1:1;let i=0;const r=new Li,s=new Li,o=new es,a=[0,0,0,0,0,0,0,0,0],l=new Lh,c=l.coefficients,h=t.texture.type,d=t.width;let u;e.isWebGLRenderer&&(u=h===ke?new Uint16Array(d*d*4):new Uint8Array(d*d*4));for(let l=0;l<6;l++){e.isWebGLRenderer?await e.readRenderTargetPixelsAsync(t,0,0,d,d,u,l):u=await e.readRenderTargetPixelsAsync(t,0,0,d,d,0,l);const p=2/d;for(let e=0,A=u.length;e<A;e+=4){let A,f,m;h===ke?(A=cs.fromHalfFloat(u[e]),f=cs.fromHalfFloat(u[e+1]),m=cs.fromHalfFloat(u[e+2])):(A=u[e]/255,f=u[e+1]/255,m=u[e+2]/255),o.setRGB(A,f,m),jg(o,t.texture.colorSpace);const g=e/4,v=(1-(g%d+.5)*p)*n,y=1-(Math.floor(g/d)+.5)*p;switch(l){case 0:r.set(-1*n,y,v*n);break;case 1:r.set(1*n,y,-v*n);break;case 2:r.set(v,1,-y);break;case 3:r.set(v,-1,y);break;case 4:r.set(v,y,1);break;case 5:r.set(-v,y,-1)}const E=r.lengthSq(),x=4/(Math.sqrt(E)*E);i+=x,s.copy(r).normalize(),Lh.getBasisAt(s,a);for(let e=0;e<9;e++)c[e].x+=a[e]*o.r*x,c[e].y+=a[e]*o.g*x,c[e].z+=a[e]*o.b*x}}const p=4*Math.PI/i;for(let e=0;e<9;e++)c[e].x*=p,c[e].y*=p,c[e].z*=p;return new Dh(l)}};const qg=Wg},8330:e=>{"use strict";e.exports=JSON.parse('{"name":"aframe","version":"1.6.0","description":"A web framework for building virtual reality experiences.","homepage":"https://aframe.io/","main":"dist/aframe-master.js","scripts":{"dev":"cross-env INSPECTOR_VERSION=dev webpack serve --port 8080","dist":"node scripts/updateVersionLog.js && npm run dist:min && npm run dist:max","dist:max":"webpack --config webpack.config.js","dist:min":"webpack --config webpack.prod.config.js","docs":"markserv --dir docs --port 9001","preghpages":"node ./scripts/preghpages.js","ghpages":"ghpages -p gh-pages/","lint":"standardx -v | snazzy","lint:fix":"standardx --fix","precommit":"npm run lint","prepush":"node scripts/testOnlyCheck.js","prerelease":"node scripts/release.js 1.5.0 1.6.0","start":"npm run dev","start:https":"npm run dev -- --server-type https","test":"karma start ./tests/karma.conf.js","test:docs":"node scripts/docsLint.js","test:firefox":"npm test -- --browsers Firefox","test:chrome":"npm test -- --browsers Chrome","test:nobrowser":"NO_BROWSER=true npm test","test:node":"node --experimental-require-module ./node_modules/mocha/bin/mocha --ui tdd tests/node"},"repository":"aframevr/aframe","license":"MIT","files":["dist/*","docs/**/*","src/**/*","vendor/**/*"],"dependencies":{"buffer":"^6.0.3","debug":"^4.3.4","deep-assign":"^2.0.0","load-bmfont":"^1.2.3","super-animejs":"^3.1.0","three":"npm:super-three@0.171.0","three-bmfont-text":"dmarcos/three-bmfont-text#eed4878795be9b3e38cf6aec6b903f56acd1f695"},"devDependencies":{"@babel/core":"^7.24.0","babel-loader":"^9.1.3","babel-plugin-istanbul":"^6.1.1","chai":"^4.3.6","chai-shallow-deep-equal":"^1.4.0","chalk":"^1.1.3","cross-env":"^7.0.3","css-loader":"^7.1.2","eslint":"^8.45.0","eslint-config-semistandard":"^17.0.0","eslint-config-standard-jsx":"^11.0.0","ghpages":"0.0.8","git-rev":"^0.2.1","glob":"^8.0.3","husky":"^0.11.7","jsdom":"^24.0.0","jsdom-global":"^3.0.2","karma":"^6.4.0","karma-chai-shallow-deep-equal":"0.0.4","karma-chrome-launcher":"^3.1.1","karma-coverage":"^2.2.0","karma-env-preprocessor":"^0.1.1","karma-firefox-launcher":"^2.1.2","karma-mocha":"^2.0.1","karma-mocha-reporter":"^2.2.5","karma-sinon-chai":"^2.0.2","karma-webpack":"^5.0.0","markserv":"github:sukima/markserv#feature/fix-broken-websoketio-link","mocha":"^10.0.0","replace-in-file":"^2.5.3","shelljs":"^0.8.5","shx":"^0.2.2","sinon":"<12.0.0","sinon-chai":"^3.7.0","snazzy":"^5.0.0","standardx":"^7.0.0","style-loader":"^4.0.0","too-wordy":"ngokevin/too-wordy","webpack":"^5.91.0","webpack-cli":"^5.1.4","webpack-dev-server":"^5.0.4","write-good":"^1.0.8"},"link":true,"standardx":{"ignore":["build/**","dist/**","examples/**/shaders/*.js","**/vendor/**"]},"keywords":["3d","aframe","cardboard","components","oculus","three","three.js","rift","vive","vr","quest","meta","web-components","webvr","webxr"],"engines":{"node":">= 4.6.0","npm":">= 2.15.9"}}')}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={id:i,exports:{}};return e[i](s,s.exports,n),s.exports}return n.m=e,n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.b=document.baseURI||self.location.href,n.nc=void 0,n(4497)})())); -//# sourceMappingURL=aframe-master.min.js.map(()=>{if(AFRAME.registerGeometry("prism",{schema:{depth:{default:1,min:0},height:{default:1,min:0},width:{default:1,min:0}},init:function(t){const i=new THREE.Shape;i.moveTo(t.width/2,0),i.lineTo(0,t.height),i.lineTo(-t.width/2,0),i.lineTo(t.width/2,0);const e={steps:2,depth:t.depth,bevelEnabled:!1};this.geometry=new THREE.ExtrudeGeometry(i,e)}}),"undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("blink-controls",{schema:{button:{default:"",oneOf:["trackpad","trigger","grip","menu","thumbstick"]},startEvents:{type:"array",default:[]},endEvents:{type:"array",default:[]},cancelEvents:{type:"array",default:[]},collisionEntities:{default:""},hitEntity:{type:"selector"},cameraRig:{type:"selector",default:"#player"},teleportOrigin:{type:"selector",default:"#camera"},hitCylinderColor:{type:"color",default:"#4d93fd"},hitCylinderRadius:{default:.25,min:0},hitCylinderHeight:{default:.3,min:0},interval:{default:0},curveNumberPoints:{default:60,min:2},curveLineWidth:{default:.025},curveHitColor:{type:"color",default:"#4d93fd"},curveMissColor:{type:"color",default:"#ff0000"},curveShootingSpeed:{default:10,min:0},defaultPlaneSize:{default:100},landingNormal:{type:"vec3",default:{x:0,y:1,z:0}},landingMaxAngle:{default:"45",min:0,max:360},drawIncrementally:{default:!0},incrementalDrawMs:{default:300},missOpacity:{default:.8},hitOpacity:{default:.8},snapTurn:{default:!0},rotateOnTeleport:{default:!0}},init:function(){const t=this.data,i=this.el;let e;this.active=!1,this.obj=i.object3D,this.controllerPosition=new THREE.Vector3,this.hitEntityQuaternion=new THREE.Quaternion,this.teleportOriginQuaternion=new THREE.Quaternion,this.hitPoint=new THREE.Vector3,this.collisionObjectNormalMatrix=new THREE.Matrix3,this.collisionWorldNormal=new THREE.Vector3,this.rigWorldPosition=new THREE.Vector3,this.newRigWorldPosition=new THREE.Vector3,this.teleportEventDetail={oldPosition:this.rigWorldPosition,newPosition:this.newRigWorldPosition,hitPoint:this.hitPoint,rotationQuaternion:this.hitEntityQuaternion},this.hit=!1,this.prevCheckTime=void 0,this.referenceNormal=new THREE.Vector3,this.curveMissColor=new THREE.Color,this.curveHitColor=new THREE.Color,this.raycaster=new THREE.Raycaster,this.defaultPlane=this.createDefaultPlane(this.data.defaultPlaneSize),this.defaultCollisionMeshes=[this.defaultPlane];const n=this.teleportEntity=document.createElement("a-entity");if(n.classList.add("teleportRay"),n.setAttribute("visible",!1),i.sceneEl.appendChild(this.teleportEntity),this.onButtonDown=this.onButtonDown.bind(this),this.onButtonUp=this.onButtonUp.bind(this),this.cancel=this.cancel.bind(this),this.handleThumbstickAxis=this.handleThumbstickAxis.bind(this),this.teleportOrigin=this.data.teleportOrigin,this.cameraRig=this.data.cameraRig,this.snapturnRotation=THREE.MathUtils.degToRad(45),this.canSnapturn=!0,this.addedEvents=[],this.data.startEvents.length&&this.data.endEvents.length){for(e=0;e<this.data.startEvents.length;e++)this.addedEvents.push([this.data.startEvents[e],this.onButtonDown]),i.addEventListener(this.data.startEvents[e],this.onButtonDown);for(e=0;e<this.data.endEvents.length;e++)this.addedEvents.push([this.data.endEvents[e],this.onButtonUp]),i.addEventListener(this.data.endEvents[e],this.onButtonUp)}else t.button?(this.addedEvents.push([t.button+"down",this.onButtonDown]),this.addedEvents.push([t.button+"up",this.onButtonUp]),i.addEventListener(t.button+"down",this.onButtonDown),i.addEventListener(t.button+"up",this.onButtonUp)):this.thumbstickAxisActivation=!0;for(e=0;e<this.data.cancelEvents.length;e++)this.addedEvents.push([this.data.cancelEvents[e],this.cancel]),i.addEventListener(this.data.cancelEvents[e],this.cancel);this.addedEvents.push(["thumbstickmoved",this.handleThumbstickAxis]),i.addEventListener("thumbstickmoved",this.handleThumbstickAxis),this.queryCollisionEntities()},handleSnapturn:function(t,i){i<.5&&(this.canSnapturn=!0),this.canSnapturn&&i>.95&&(Math.abs(t-Math.PI/2)<.6?(this.cameraRig.object3D.rotateY(+this.snapturnRotation),this.canSnapturn=!1):Math.abs(t-1.5*Math.PI)<.6&&(this.cameraRig.object3D.rotateY(-this.snapturnRotation),this.canSnapturn=!1))},handleThumbstickAxis:function(t){if(void 0!==t.detail.x&&void 0!==t.detail.y){const i=Math.atan2(t.detail.x,t.detail.y)+Math.PI,e=Math.sqrt(t.detail.x**2+t.detail.y**2);this.active?(e>.95&&(this.obj.getWorldPosition(this.controllerPosition),this.controllerPosition.setComponent(1,this.hitEntity.object3D.position.y),this.hitEntity.object3D.visible=!1,this.hitEntity.object3D.lookAt(this.controllerPosition),this.hitEntity.object3D.rotateY(i),this.hitEntity.object3D.visible=!0,this.hitEntity.object3D.getWorldQuaternion(this.hitEntityQuaternion)),0===Math.abs(t.detail.x)&&0===Math.abs(t.detail.y)&&this.onButtonUp()):this.thumbstickAxisActivation&&e>.95&&(i<.5||i>5.78)?this.onButtonDown():this.data.snapTurn&&this.handleSnapturn(i,e)}},update:function(t){const i=this.data,e=AFRAME.utils.diff(i,t);this.referenceNormal.copy(i.landingNormal),this.curveMissColor.set(i.curveMissColor),this.curveHitColor.set(i.curveHitColor),(!this.line||"curveLineWidth"in e||"curveNumberPoints"in e||"type"in e)&&(this.line=this.createLine(i),this.line.material.opacity=this.data.hitOpacity,this.line.material.transparent=this.data.hitOpacity<1,this.numActivePoints=i.curveNumberPoints,this.teleportEntity.setObject3D("mesh",this.line.mesh)),i.hitEntity?this.hitEntity=i.hitEntity:(!this.hitEntity||"hitCylinderColor"in e||"hitCylinderHeight"in e||"hitCylinderRadius"in e)&&(this.hitEntity&&this.hitEntity.parentNode.removeChild(this.hitEntity),this.hitEntity=this.createHitEntity(i),this.el.sceneEl.appendChild(this.hitEntity)),this.hitEntity.setAttribute("visible",!1),i.hitEntity||this.hitEntity.lastElementChild.setAttribute("visible",i.rotateOnTeleport),"collisionEntities"in e&&this.queryCollisionEntities()},remove:function(){const t=this.el,i=this.hitEntity,e=this.teleportEntity;i&&i.parentNode.removeChild(i),e&&e.parentNode.removeChild(e),t.sceneEl.removeEventListener("child-attached",this.childAttachHandler),t.sceneEl.removeEventListener("child-detached",this.childDetachHandler);for(const[i,e]of this.addedEvents)t.removeEventListener(i,e)},tick:function(){const t=new THREE.Vector3,i=new THREE.Vector3,e=new THREE.Vector3(0,-9.8,0),n=new THREE.Vector3,s=new THREE.Vector3,o=new THREE.Quaternion,r=new THREE.Vector3,a=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,c=new THREE.Vector3;let d=0;return function(u,E){if(!this.active)return;if(this.data.drawIncrementally&&this.redrawLine&&(this.redrawLine=!1,d=0),d+=E,this.numActivePoints=this.data.curveNumberPoints*d/this.data.incrementalDrawMs,this.numActivePoints>this.data.curveNumberPoints&&(this.numActivePoints=this.data.curveNumberPoints),this.prevCheckTime&&u-this.prevCheckTime<this.data.interval)return;this.prevCheckTime=u;this.obj.matrixWorld.decompose(r,o,a);const p=h.set(0,0,-1).applyQuaternion(o).normalize();this.line.setDirection(c.copy(p)),this.obj.getWorldPosition(t),s.copy(t),this.teleportEntity.setAttribute("visible",!0),d<this.data.incrementalDrawMs?this.line.material.color.set(this.curveHitColor):this.line.material.color.set(this.curveMissColor),this.line.material.opacity=this.data.missOpacity,this.line.material.transparent=this.data.missOpacity<1,this.hitEntity.setAttribute("visible",!1),this.hit=!1,i.copy(p).multiplyScalar(this.data.curveShootingSpeed),this.lastDrawnIndex=0;const A=this.data.drawIncrementally?this.numActivePoints:this.line.numPoints;for(let o=0;o<A+1;o++){let r;r=o===Math.floor(A+1)?A/(this.line.numPoints-1):o/(this.line.numPoints-1);const a=this.parabolicCurveMaxRoot(t,i,e);r*=Math.max(1,1.5*a),this.parabolicCurve(t,i,e,r,n);const h=l.copy(n).sub(s).normalize();if(this.raycaster.far=h.length(),this.raycaster.set(s,h),this.lastDrawnPoint=n,this.lastDrawnIndex=o,this.checkMeshCollisions(o,s,n))break;s.copy(n)}for(let t=this.lastDrawnIndex+1;t<this.line.numPoints;t++)this.line.setPoint(t,this.lastDrawnPoint,this.lastDrawnPoint)}}(),queryCollisionEntities:function(){const t=this.data,i=this.el;if(!t.collisionEntities)return void(this.collisionEntities=[]);const e=[].slice.call(i.sceneEl.querySelectorAll(t.collisionEntities));this.collisionEntities=e,this.childAttachHandler=function(i){i.detail.el.matches(t.collisionEntities)&&e.push(i.detail.el)},i.sceneEl.addEventListener("child-attached",this.childAttachHandler),this.childDetachHandler=function(i){if(!i.detail.el.matches(t.collisionEntities))return;const n=e.indexOf(i.detail.el);-1!==n&&e.splice(n,1)},i.sceneEl.addEventListener("child-detached",this.childDetachHandler)},onButtonDown:function(){this.active=!0,this.redrawLine=!0},onButtonUp:function(){const t=new THREE.Vector3,i=[new THREE.Vector3,new THREE.Vector3],e=new THREE.Vector3;return function(n){if(!this.active)return;if(this.active=!1,this.hitEntity.setAttribute("visible",!1),this.teleportEntity.setAttribute("visible",!1),!this.hit)return;const s=this.data.cameraRig||this.el.sceneEl.camera.el;if(s.object3D.getWorldPosition(this.rigWorldPosition),this.newRigWorldPosition.copy(this.hitPoint),t.copy(this.newRigWorldPosition),s.object3D.parent&&s.object3D.parent.worldToLocal(t),s.setAttribute("position",t),this.data.rotateOnTeleport&&(this.teleportOriginQuaternion.setFromEuler(new THREE.Euler(0,this.teleportOrigin.object3D.rotation.y,0)),this.teleportOriginQuaternion.invert(),this.teleportOriginQuaternion.multiply(this.hitEntityQuaternion),this.cameraRig.object3D.setRotationFromQuaternion(this.teleportOriginQuaternion)),!this.data.cameraRig){const t=document.querySelectorAll("a-entity[tracked-controls]");for(let n=0;n<t.length;n++)t[n].object3D.getWorldPosition(e),i[n].copy(this.newRigWorldPosition).sub(this.rigWorldPosition).add(e),t[n].setAttribute("position",i[n])}this.el.emit("teleported",this.teleportEventDetail)}}(),cancel:function(){this.active=!1,this.hitEntity.setAttribute("visible",!1),this.teleportEntity.setAttribute("visible",!1)},checkMeshCollisions:function(t,i,e){let n;this.data.collisionEntities?(n=this.collisionEntities.map((function(t){return t.getObject3D("mesh")})).filter((function(t){return t})),n=n.length?n:this.defaultCollisionMeshes):n=this.defaultCollisionMeshes;const s=this.raycaster.intersectObjects(n,!0);if(s.length>0&&!this.hit&&this.isValidNormalsAngle(s[0].face.normal,s[0].object)){const e=s[0].point;this.line.material.color.set(this.curveHitColor),this.line.material.opacity=this.data.hitOpacity,this.line.material.transparent=this.data.hitOpacity<1,this.hitEntity.setAttribute("position",e),this.hitEntity.setAttribute("visible",!0),this.hit=!0,this.hitPoint.copy(s[0].point);for(let e=t;e<this.line.numPoints;e++)this.line.setPoint(e,i,this.hitPoint);return!0}return this.line.setPoint(t,i,e),!1},isValidNormalsAngle:function(t,i){this.collisionObjectNormalMatrix.getNormalMatrix(i.matrixWorld),this.collisionWorldNormal.copy(t).applyMatrix3(this.collisionObjectNormalMatrix).normalize();const e=this.referenceNormal.angleTo(this.collisionWorldNormal);return THREE.MathUtils.RAD2DEG*e<=this.data.landingMaxAngle},parabolicCurveScalar:function(t,i,e,n){return t+i*n+.5*e*n*n},parabolicCurve:function(t,i,e,n,s){return s.x=this.parabolicCurveScalar(t.x,i.x,e.x,n),s.y=this.parabolicCurveScalar(t.y,i.y,e.y,n),s.z=this.parabolicCurveScalar(t.z,i.z,e.z,n),s},parabolicCurveMaxRoot:function(t,i,e){return(-i.y-Math.sqrt(i.y**2-.5*e.y*4*t.y))/(1*e.y)},createLine:function(t){const i="line"===t.type?2:t.curveNumberPoints;return new AFRAME.utils.RayCurve(i,t.curveLineWidth)},createHitEntity:function(t){const i=document.createElement("a-entity");i.className="hitEntity";const e=document.createElement("a-entity");e.setAttribute("geometry",{primitive:"torus",radius:t.hitCylinderRadius,radiusTubular:.01}),e.setAttribute("rotation",{x:90,y:0,z:0}),e.setAttribute("material",{shader:"flat",color:t.hitCylinderColor,side:"double",depthTest:!1}),i.appendChild(e);const n=document.createElement("a-entity");n.setAttribute("position",{x:0,y:t.hitCylinderHeight/2,z:0}),n.setAttribute("geometry",{primitive:"cylinder",segmentsHeight:1,radius:t.hitCylinderRadius,height:t.hitCylinderHeight,openEnded:!0}),n.setAttribute("material",{shader:"flat",color:t.hitCylinderColor,opacity:.5,side:"double",src:this.cylinderTexture,transparent:!0,depthTest:!1}),i.appendChild(n);const s=document.createElement("a-entity");return s.setAttribute("position",{x:0,y:.05,z:-1.5*t.hitCylinderRadius}),s.setAttribute("rotation",{x:90,y:180,z:0}),s.setAttribute("geometry",{primitive:"prism",height:.2,width:.2,depth:.05}),s.setAttribute("material",{shader:"flat",color:t.hitCylinderColor,side:"double",transparent:!0,opacity:.6,depthTest:!1}),i.appendChild(s),i},createDefaultPlane:function(t){const i=new THREE.PlaneGeometry(100,100);i.rotateX(-Math.PI/2);const e=new THREE.MeshBasicMaterial({color:16776960});return new THREE.Mesh(i,e)},cylinderTexture:"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAQCAYAAADXnxW3AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAADJJREFUeNpEx7ENgDAAAzArK0JA6f8X9oewlcWStU1wBGdwB08wgjeYm79jc2nbYH0DAC/+CORJxO5fAAAAAElFTkSuQmCC)"}),AFRAME.utils.RayCurve=function(t,i){this.geometry=new THREE.BufferGeometry,this.vertices=new Float32Array(3*t*6),this.uvs=new Float32Array(2*t*6),this.width=i,this.geometry.setAttribute("position",new THREE.BufferAttribute(this.vertices,3).setUsage(THREE.DynamicDrawUsage)),this.material=new THREE.MeshBasicMaterial({side:THREE.DoubleSide,color:16711680}),this.mesh=new THREE.Mesh(this.geometry,this.material),this.mesh.frustumCulled=!1,this.mesh.vertices=this.vertices,this.direction=new THREE.Vector3,this.numPoints=t},AFRAME.utils.RayCurve.prototype={setDirection:function(t){const i=new THREE.Vector3(0,1,0);this.direction.copy(t).cross(i).normalize().multiplyScalar(this.width/2)},setWidth:function(t){this.width=t},setPoint:function(){const t=new THREE.Vector3,i=new THREE.Vector3,e=new THREE.Vector3,n=new THREE.Vector3;return function(s,o,r){t.copy(o).add(this.direction),i.copy(o).sub(this.direction),e.copy(r).add(this.direction),n.copy(r).sub(this.direction);let a=18*s;this.vertices[a++]=t.x,this.vertices[a++]=t.y,this.vertices[a++]=t.z,this.vertices[a++]=i.x,this.vertices[a++]=i.y,this.vertices[a++]=i.z,this.vertices[a++]=e.x,this.vertices[a++]=e.y,this.vertices[a++]=e.z,this.vertices[a++]=e.x,this.vertices[a++]=e.y,this.vertices[a++]=e.z,this.vertices[a++]=i.x,this.vertices[a++]=i.y,this.vertices[a++]=i.z,this.vertices[a++]=n.x,this.vertices[a++]=n.y,this.vertices[a++]=n.z,this.geometry.attributes.position.needsUpdate=!0}}()}})(); -//# sourceMappingURL=aframe-blink-controls.min.js.map/* +/* * v0.5.1 generated at Wed Jan 15 10:51:41 AM CET 2025 * https://xrfragment.org * SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/dist/xrfragment.module.js b/dist/xrfragment.module.js index 0f55bb9..07639db 100644 --- a/dist/xrfragment.module.js +++ b/dist/xrfragment.module.js @@ -1,3 +1,8 @@ +/* + * v0.5.1 generated at Sun Feb 9 12:52:39 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ /* * v0.5.1 generated at Wed Jan 15 10:52:05 AM CET 2025 * https://xrfragment.org @@ -167119,3 +167124,2030 @@ xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); })(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); var xrfragment = $hx_exports["xrfragment"]; export default xrfragment; +/* + * v0.5.1 generated at Wed Jan 15 10:52:05 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:51:41 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:51:31 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:51:15 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:50:01 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:49:22 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:48:58 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:47:50 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:43:55 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:39:36 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:38:56 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:38:18 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:37:32 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:37:04 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:35:19 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:30:49 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:30:17 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:27:52 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:27:22 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:25:57 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:22:36 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:19:46 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:19:21 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:15:58 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:15:30 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Wed Jan 15 10:15:28 AM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 08:15:04 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 08:14:22 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 08:13:57 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 08:13:42 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 08:13:18 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 08:12:32 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 08:11:05 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 08:10:11 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 08:07:36 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 08:07:12 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 08:06:48 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 08:06:27 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 08:06:11 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 08:05:47 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:35:01 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:33:48 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:33:30 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:33:24 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:32:59 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:26:30 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:26:19 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:26:05 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:24:14 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:23:45 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:23:27 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:23:12 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:22:13 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:21:51 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:21:36 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:20:54 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:20:39 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:20:13 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:19:55 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:18:34 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:01:28 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 03:00:58 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:55:26 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:55:01 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:54:21 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:54:04 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:53:31 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:52:11 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:51:59 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:51:44 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:51:01 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:50:51 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:50:39 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:49:27 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:48:13 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:42:07 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:41:43 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:41:25 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:40:51 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:39:41 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:38:52 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:38:19 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:37:01 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:36:19 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:35:59 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:35:44 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:35:28 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:34:46 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:32:50 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:31:07 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:30:27 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Tue Jan 14 02:24:55 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* + * v0.5.1 generated at Fri Jan 10 07:51:18 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +// Generated by Haxe 4.3.6 +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +EReg.__name__ = true; +EReg.prototype = { + match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } +}; +var HxOverrides = function() { }; +HxOverrides.__name__ = true; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.now = function() { + return Date.now(); +}; +Math.__name__ = true; +var Reflect = function() { }; +Reflect.__name__ = true; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + return null; + } +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +var Std = function() { }; +Std.__name__ = true; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.parseInt = function(x) { + var v = parseInt(x); + if(isNaN(v)) { + return null; + } + return v; +}; +var StringBuf = function() { + this.b = ""; +}; +StringBuf.__name__ = true; +var StringTools = function() { }; +StringTools.__name__ = true; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; +}; +haxe_Exception.__name__ = true; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + unwrap: function() { + return this.__nativeException; + } + ,get_native: function() { + return this.__nativeException; + } + ,__properties__: {get_native:"get_native"} +}); +var haxe__$Template_TemplateExpr = $hxEnums["haxe._Template.TemplateExpr"] = { __ename__:true,__constructs__:null + ,OpVar: ($_=function(v) { return {_hx_index:0,v:v,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpVar",$_.__params__ = ["v"],$_) + ,OpExpr: ($_=function(expr) { return {_hx_index:1,expr:expr,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpExpr",$_.__params__ = ["expr"],$_) + ,OpIf: ($_=function(expr,eif,eelse) { return {_hx_index:2,expr:expr,eif:eif,eelse:eelse,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpIf",$_.__params__ = ["expr","eif","eelse"],$_) + ,OpStr: ($_=function(str) { return {_hx_index:3,str:str,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpStr",$_.__params__ = ["str"],$_) + ,OpBlock: ($_=function(l) { return {_hx_index:4,l:l,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpBlock",$_.__params__ = ["l"],$_) + ,OpForeach: ($_=function(expr,loop) { return {_hx_index:5,expr:expr,loop:loop,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpForeach",$_.__params__ = ["expr","loop"],$_) + ,OpMacro: ($_=function(name,params) { return {_hx_index:6,name:name,params:params,__enum__:"haxe._Template.TemplateExpr",toString:$estr}; },$_._hx_name="OpMacro",$_.__params__ = ["name","params"],$_) +}; +haxe__$Template_TemplateExpr.__constructs__ = [haxe__$Template_TemplateExpr.OpVar,haxe__$Template_TemplateExpr.OpExpr,haxe__$Template_TemplateExpr.OpIf,haxe__$Template_TemplateExpr.OpStr,haxe__$Template_TemplateExpr.OpBlock,haxe__$Template_TemplateExpr.OpForeach,haxe__$Template_TemplateExpr.OpMacro]; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +haxe_iterators_ArrayIterator.__name__ = true; +haxe_iterators_ArrayIterator.prototype = { + hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } +}; +var haxe_Template = function(str) { + var tokens = this.parseTokens(str); + this.expr = this.parseBlock(tokens); + if(!tokens.isEmpty()) { + throw haxe_Exception.thrown("Unexpected '" + Std.string(tokens.first().s) + "'"); + } +}; +haxe_Template.__name__ = true; +haxe_Template.prototype = { + execute: function(context,macros) { + this.macros = macros == null ? { } : macros; + this.context = context; + this.stack = new haxe_ds_List(); + this.buf = new StringBuf(); + this.run(this.expr); + return this.buf.b; + } + ,resolve: function(v) { + if(v == "__current__") { + return this.context; + } + if(Reflect.isObject(this.context)) { + var value = Reflect.getProperty(this.context,v); + if(value != null || Object.prototype.hasOwnProperty.call(this.context,v)) { + return value; + } + } + var _g_head = this.stack.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var ctx = val; + var value = Reflect.getProperty(ctx,v); + if(value != null || Object.prototype.hasOwnProperty.call(ctx,v)) { + return value; + } + } + return Reflect.field(haxe_Template.globals,v); + } + ,parseTokens: function(data) { + var tokens = new haxe_ds_List(); + while(haxe_Template.splitter.match(data)) { + var p = haxe_Template.splitter.matchedPos(); + if(p.pos > 0) { + tokens.add({ p : HxOverrides.substr(data,0,p.pos), s : true, l : null}); + } + if(HxOverrides.cca(data,p.pos) == 58) { + tokens.add({ p : HxOverrides.substr(data,p.pos + 2,p.len - 4), s : false, l : null}); + data = haxe_Template.splitter.matchedRight(); + continue; + } + var parp = p.pos + p.len; + var npar = 1; + var params = []; + var part = ""; + while(true) { + var c = HxOverrides.cca(data,parp); + ++parp; + if(c == 40) { + ++npar; + } else if(c == 41) { + --npar; + if(npar <= 0) { + break; + } + } else if(c == null) { + throw haxe_Exception.thrown("Unclosed macro parenthesis"); + } + if(c == 44 && npar == 1) { + params.push(part); + part = ""; + } else { + part += String.fromCodePoint(c); + } + } + params.push(part); + tokens.add({ p : haxe_Template.splitter.matched(2), s : false, l : params}); + data = HxOverrides.substr(data,parp,data.length - parp); + } + if(data.length > 0) { + tokens.add({ p : data, s : true, l : null}); + } + return tokens; + } + ,parseBlock: function(tokens) { + var l = new haxe_ds_List(); + while(true) { + var t = tokens.first(); + if(t == null) { + break; + } + if(!t.s && (t.p == "end" || t.p == "else" || HxOverrides.substr(t.p,0,7) == "elseif ")) { + break; + } + l.add(this.parse(tokens)); + } + if(l.length == 1) { + return l.first(); + } + return haxe__$Template_TemplateExpr.OpBlock(l); + } + ,parse: function(tokens) { + var t = tokens.pop(); + var p = t.p; + if(t.s) { + return haxe__$Template_TemplateExpr.OpStr(p); + } + if(t.l != null) { + var pe = new haxe_ds_List(); + var _g = 0; + var _g1 = t.l; + while(_g < _g1.length) { + var p1 = _g1[_g]; + ++_g; + pe.add(this.parseBlock(this.parseTokens(p1))); + } + return haxe__$Template_TemplateExpr.OpMacro(p,pe); + } + var kwdEnd = function(kwd) { + var pos = -1; + var length = kwd.length; + if(HxOverrides.substr(p,0,length) == kwd) { + pos = length; + var _g_offset = 0; + var _g_s = HxOverrides.substr(p,length,null); + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c == 32) { + ++pos; + } else { + break; + } + } + } + return pos; + }; + var pos = kwdEnd("if"); + if(pos > 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var eif = this.parseBlock(tokens); + var t = tokens.first(); + var eelse; + if(t == null) { + throw haxe_Exception.thrown("Unclosed 'if'"); + } + if(t.p == "end") { + tokens.pop(); + eelse = null; + } else if(t.p == "else") { + tokens.pop(); + eelse = this.parseBlock(tokens); + t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'else'"); + } + } else { + t.p = HxOverrides.substr(t.p,4,t.p.length - 4); + eelse = this.parse(tokens); + } + return haxe__$Template_TemplateExpr.OpIf(e,eif,eelse); + } + var pos = kwdEnd("foreach"); + if(pos >= 0) { + p = HxOverrides.substr(p,pos,p.length - pos); + var e = this.parseExpr(p); + var efor = this.parseBlock(tokens); + var t = tokens.pop(); + if(t == null || t.p != "end") { + throw haxe_Exception.thrown("Unclosed 'foreach'"); + } + return haxe__$Template_TemplateExpr.OpForeach(e,efor); + } + if(haxe_Template.expr_splitter.match(p)) { + return haxe__$Template_TemplateExpr.OpExpr(this.parseExpr(p)); + } + return haxe__$Template_TemplateExpr.OpVar(p); + } + ,parseExpr: function(data) { + var l = new haxe_ds_List(); + var expr = data; + while(haxe_Template.expr_splitter.match(data)) { + var p = haxe_Template.expr_splitter.matchedPos(); + var k = p.pos + p.len; + if(p.pos != 0) { + l.add({ p : HxOverrides.substr(data,0,p.pos), s : true}); + } + var p1 = haxe_Template.expr_splitter.matched(0); + l.add({ p : p1, s : p1.indexOf("\"") >= 0}); + data = haxe_Template.expr_splitter.matchedRight(); + } + if(data.length != 0) { + var _g_offset = 0; + var _g_s = data; + while(_g_offset < _g_s.length) { + var _g_key = _g_offset; + var _g_value = _g_s.charCodeAt(_g_offset++); + var i = _g_key; + var c = _g_value; + if(c != 32) { + l.add({ p : HxOverrides.substr(data,i,null), s : true}); + break; + } + } + } + var e; + try { + e = this.makeExpr(l); + if(!l.isEmpty()) { + throw haxe_Exception.thrown(l.first().p); + } + } catch( _g ) { + var _g1 = haxe_Exception.caught(_g).unwrap(); + if(typeof(_g1) == "string") { + var s = _g1; + throw haxe_Exception.thrown("Unexpected '" + s + "' in " + expr); + } else { + throw _g; + } + } + return function() { + try { + return e(); + } catch( _g ) { + var exc = haxe_Exception.caught(_g).unwrap(); + throw haxe_Exception.thrown("Error : " + Std.string(exc) + " in " + expr); + } + }; + } + ,makeConst: function(v) { + haxe_Template.expr_trim.match(v); + v = haxe_Template.expr_trim.matched(1); + if(HxOverrides.cca(v,0) == 34) { + var str = HxOverrides.substr(v,1,v.length - 2); + return function() { + return str; + }; + } + if(haxe_Template.expr_int.match(v)) { + var i = Std.parseInt(v); + return function() { + return i; + }; + } + if(haxe_Template.expr_float.match(v)) { + var f = parseFloat(v); + return function() { + return f; + }; + } + var me = this; + return function() { + return me.resolve(v); + }; + } + ,makePath: function(e,l) { + var p = l.first(); + if(p == null || p.p != ".") { + return e; + } + l.pop(); + var field = l.pop(); + if(field == null || !field.s) { + throw haxe_Exception.thrown(field.p); + } + var f = field.p; + haxe_Template.expr_trim.match(f); + f = haxe_Template.expr_trim.matched(1); + return this.makePath(function() { + return Reflect.field(e(),f); + },l); + } + ,makeExpr: function(l) { + return this.makePath(this.makeExpr2(l),l); + } + ,skipSpaces: function(l) { + var p = l.first(); + while(p != null) { + var _g_offset = 0; + var _g_s = p.p; + while(_g_offset < _g_s.length) { + var c = _g_s.charCodeAt(_g_offset++); + if(c != 32) { + return; + } + } + l.pop(); + p = l.first(); + } + } + ,makeExpr2: function(l) { + this.skipSpaces(l); + var p = l.pop(); + this.skipSpaces(l); + if(p == null) { + throw haxe_Exception.thrown("<eof>"); + } + if(p.s) { + return this.makeConst(p.p); + } + switch(p.p) { + case "!": + var e = this.makeExpr(l); + return function() { + var v = e(); + if(v != null) { + return v == false; + } else { + return true; + } + }; + case "(": + this.skipSpaces(l); + var e1 = this.makeExpr(l); + this.skipSpaces(l); + var p1 = l.pop(); + if(p1 == null || p1.s) { + throw haxe_Exception.thrown(p1); + } + if(p1.p == ")") { + return e1; + } + this.skipSpaces(l); + var e2 = this.makeExpr(l); + this.skipSpaces(l); + var p2 = l.pop(); + this.skipSpaces(l); + if(p2 == null || p2.p != ")") { + throw haxe_Exception.thrown(p2); + } + switch(p1.p) { + case "!=": + return function() { + return e1() != e2(); + }; + case "&&": + return function() { + return e1() && e2(); + }; + case "*": + return function() { + return e1() * e2(); + }; + case "+": + return function() { + return e1() + e2(); + }; + case "-": + return function() { + return e1() - e2(); + }; + case "/": + return function() { + return e1() / e2(); + }; + case "<": + return function() { + return e1() < e2(); + }; + case "<=": + return function() { + return e1() <= e2(); + }; + case "==": + return function() { + return e1() == e2(); + }; + case ">": + return function() { + return e1() > e2(); + }; + case ">=": + return function() { + return e1() >= e2(); + }; + case "||": + return function() { + return e1() || e2(); + }; + default: + throw haxe_Exception.thrown("Unknown operation " + p1.p); + } + break; + case "-": + var e3 = this.makeExpr(l); + return function() { + return -e3(); + }; + } + throw haxe_Exception.thrown(p.p); + } + ,run: function(e) { + switch(e._hx_index) { + case 0: + var v = e.v; + var _this = this.buf; + var x = Std.string(this.resolve(v)); + _this.b += Std.string(x); + break; + case 1: + var e1 = e.expr; + var _this = this.buf; + var x = Std.string(e1()); + _this.b += Std.string(x); + break; + case 2: + var e1 = e.expr; + var eif = e.eif; + var eelse = e.eelse; + var v = e1(); + if(v == null || v == false) { + if(eelse != null) { + this.run(eelse); + } + } else { + this.run(eif); + } + break; + case 3: + var str = e.str; + this.buf.b += str == null ? "null" : "" + str; + break; + case 4: + var l = e.l; + var _g_head = l.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var e1 = val; + this.run(e1); + } + break; + case 5: + var e1 = e.expr; + var loop = e.loop; + var v = e1(); + try { + var x = $getIterator(v); + if(x.hasNext == null) { + throw haxe_Exception.thrown(null); + } + v = x; + } catch( _g ) { + try { + if(v.hasNext == null) { + throw haxe_Exception.thrown(null); + } + } catch( _g1 ) { + throw haxe_Exception.thrown("Cannot iter on " + Std.string(v)); + } + } + this.stack.push(this.context); + var v1 = v; + var ctx = v1; + while(ctx.hasNext()) { + var ctx1 = ctx.next(); + this.context = ctx1; + this.run(loop); + } + this.context = this.stack.pop(); + break; + case 6: + var m = e.name; + var params = e.params; + var v = Reflect.field(this.macros,m); + var pl = []; + var old = this.buf; + pl.push($bind(this,this.resolve)); + var _g_head = params.h; + while(_g_head != null) { + var val = _g_head.item; + _g_head = _g_head.next; + var p = val; + if(p._hx_index == 0) { + var v1 = p.v; + pl.push(this.resolve(v1)); + } else { + this.buf = new StringBuf(); + this.run(p); + pl.push(this.buf.b); + } + } + this.buf = old; + try { + var _this = this.buf; + var x = Std.string(v.apply(this.macros,pl)); + _this.b += Std.string(x); + } catch( _g ) { + var e = haxe_Exception.caught(_g).unwrap(); + var plstr; + try { + plstr = pl.join(","); + } catch( _g1 ) { + plstr = "???"; + } + var msg = "Macro call " + m + "(" + plstr + ") failed (" + Std.string(e) + ")"; + throw haxe_Exception.thrown(msg); + } + break; + } + } +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; +}; +haxe_ValueException.__name__ = true; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + unwrap: function() { + return this.value; + } +}); +var haxe_ds_List = function() { + this.length = 0; +}; +haxe_ds_List.__name__ = true; +haxe_ds_List.prototype = { + add: function(item) { + var x = new haxe_ds__$List_ListNode(item,null); + if(this.h == null) { + this.h = x; + } else { + this.q.next = x; + } + this.q = x; + this.length++; + } + ,push: function(item) { + var x = new haxe_ds__$List_ListNode(item,this.h); + this.h = x; + if(this.q == null) { + this.q = x; + } + this.length++; + } + ,first: function() { + if(this.h == null) { + return null; + } else { + return this.h.item; + } + } + ,pop: function() { + if(this.h == null) { + return null; + } + var x = this.h.item; + this.h = this.h.next; + if(this.h == null) { + this.q = null; + } + this.length--; + return x; + } + ,isEmpty: function() { + return this.h == null; + } + ,toString: function() { + var s_b = ""; + var first = true; + var l = this.h; + s_b += "{"; + while(l != null) { + if(first) { + first = false; + } else { + s_b += ", "; + } + s_b += Std.string(Std.string(l.item)); + l = l.next; + } + s_b += "}"; + return s_b; + } +}; +var haxe_ds__$List_ListNode = function(item,next) { + this.item = item; + this.next = next; +}; +haxe_ds__$List_ListNode.__name__ = true; +var js_Boot = function() { }; +js_Boot.__name__ = true; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return "<function>"; + case "object": + if(o.__enum__) { + var e = $hxEnums[o.__enum__]; + var con = e.__constructs__[o._hx_index]; + var n = con._hx_name; + if(con.__params__) { + s = s + "\t"; + return n + "(" + ((function($this) { + var $r; + var _g = []; + { + var _g1 = 0; + var _g2 = con.__params__; + while(true) { + if(!(_g1 < _g2.length)) { + break; + } + var p = _g2[_g1]; + _g1 = _g1 + 1; + _g.push(js_Boot.__string_rec(o[p],s)); + } + } + $r = _g; + return $r; + }(this))).join(",") + ")"; + } else { + return n; + } + } + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +var xrfragment_Filter = $hx_exports["xrfragment"]["Filter"] = function(str) { + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +xrfragment_Filter.__name__ = true; +xrfragment_Filter.prototype = { + toObject: function() { + return Reflect.copy(this.q); + } + ,get: function() { + return Reflect.copy(this.q); + } + ,parse: function(str) { + var token = str.split(" "); + var q = { }; + var process = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + str = StringTools.trim(str); + var k = str.split("=")[0]; + var v = str.split("=")[1]; + var filter = { }; + if(q[prefix + k]) { + filter = q[prefix + k]; + } + if(xrfragment_XRF.isProp.match(str)) { + var oper = ""; + if(str.indexOf(">") != -1) { + oper = ">"; + } + if(str.indexOf("<") != -1) { + oper = "<"; + } + if(xrfragment_XRF.isExclude.match(k)) { + k = HxOverrides.substr(k,1,null); + } + v = HxOverrides.substr(v,oper.length,null); + if(oper.length == 0) { + oper = "="; + } + var rule = { }; + if(xrfragment_XRF.isNumber.match(v)) { + rule[oper] = parseFloat(v); + } else { + rule[oper] = v; + } + q["expr"] = rule; + } + var value = xrfragment_XRF.isDeep.match(str) ? k.split("*").length - 1 : 0; + q["deep"] = value; + var value = xrfragment_XRF.isExclude.match(str) ? false : true; + q["show"] = value; + var value = k.replace(xrfragment_XRF.operators.r,""); + q["key"] = value; + q["value"] = v; + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + process(token[i]); + } + return this.q = q; + } + ,test: function(obj) { + var qualify = false; + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v)) { + qualify = true; + } + } + var _g = 0; + var _g1 = Reflect.fields(obj); + while(_g < _g1.length) { + var k = _g1[_g]; + ++_g; + var v = Std.string(Reflect.field(obj,k)); + if(this.testProperty(k,v,true)) { + qualify = false; + } + } + return qualify; + } + ,testProperty: function(property,value,exclude) { + var conds = 0; + var fails = 0; + var qualify = 0; + var testprop = function(expr) { + conds += 1; + fails += expr ? 0 : 1; + return expr; + }; + if(this.q[value] != null) { + var v = this.q[value]; + if(v[property] != null) { + return v[property]; + } + } + if(Reflect.field(this.q,"expr")) { + var f = Reflect.field(this.q,"expr"); + if(!Reflect.field(this.q,"show")) { + if(Reflect.field(f,"!=") != null && testprop((value == null ? "null" : "" + value) == Std.string(Reflect.field(f,"!="))) && exclude) { + ++qualify; + } + } else { + if(Reflect.field(f,"*") != null && testprop(parseFloat(value) != null)) { + ++qualify; + } + if(Reflect.field(f,">") != null && testprop(parseFloat(value) >= parseFloat(Reflect.field(f,">")))) { + ++qualify; + } + if(Reflect.field(f,"<") != null && testprop(parseFloat(value) <= parseFloat(Reflect.field(f,"<")))) { + ++qualify; + } + if(Reflect.field(f,"=") != null && (testprop(value == Reflect.field(f,"=")) || testprop(parseFloat(value) == parseFloat(Reflect.field(f,"="))))) { + ++qualify; + } + } + } + return qualify > 0; + } +}; +var xrfragment_Parser = $hx_exports["xrfragment"]["Parser"] = function() { }; +xrfragment_Parser.__name__ = true; +xrfragment_Parser.parse = function(key,value,store,index) { + var Frag_h = Object.create(null); + Frag_h["#"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_PREDEFINED_VIEW | xrfragment_XRF.PV_EXECUTE; + Frag_h["src"] = xrfragment_XRF.T_URL; + Frag_h["href"] = xrfragment_XRF.T_URL | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["tag"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["pos"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.T_STRING | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["rot"] = xrfragment_XRF.QUERY_OPERATOR | xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_VECTOR3 | xrfragment_XRF.METADATA | xrfragment_XRF.NAVIGATOR; + Frag_h["t"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_FLOAT | xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.NAVIGATOR | xrfragment_XRF.METADATA; + Frag_h["s"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["loop"] = xrfragment_XRF.PV_OVERRIDE | xrfragment_XRF.T_PREDEFINED_VIEW; + Frag_h["uv"] = xrfragment_XRF.T_VECTOR2 | xrfragment_XRF.T_MEDIAFRAG; + Frag_h["namespace"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["SPDX"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["unit"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + Frag_h["description"] = xrfragment_XRF.IMMUTABLE | xrfragment_XRF.T_STRING; + var keyStripped = key.replace(xrfragment_XRF.operators.r,""); + var isPVDynamic = key.length > 0 && !Object.prototype.hasOwnProperty.call(Frag_h,key); + if(isPVDynamic) { + var v = new xrfragment_XRF(key,xrfragment_XRF.PV_EXECUTE | xrfragment_XRF.NAVIGATOR,index); + v.validate(value); + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEY,v.flags); + if(!Object.prototype.hasOwnProperty.call(Frag_h,key)) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + } + if(value.length == 0) { + v.flags = xrfragment_XRF.set(xrfragment_XRF.T_DYNAMICKEYVALUE,v.flags); + } + store[keyStripped] = v; + return true; + } + var v = new xrfragment_XRF(key,Frag_h[key],index); + if(Object.prototype.hasOwnProperty.call(Frag_h,key)) { + if(!v.validate(value)) { + console.log("src/xrfragment/Parser.hx:67:","⚠ fragment '" + key + "' has incompatible value (" + value + ")"); + return false; + } + store[keyStripped] = v; + if(xrfragment_Parser.debug) { + console.log("src/xrfragment/Parser.hx:71:","✔ " + key + ": " + v.string); + } + } else { + if(typeof(value) == "string") { + v.guessType(v,value); + } + v.flags = xrfragment_XRF.set(xrfragment_XRF.CUSTOMFRAG,v.flags); + store[keyStripped] = v; + } + return true; +}; +xrfragment_Parser.getMetaData = function() { + var meta = { title : ["title","og:title","dc.title"], description : ["aria-description","og:description","dc.description"], author : ["author","dc.creator"], publisher : ["publisher","dc.publisher"], website : ["og:site_name","og:url","dc.publisher"], license : ["SPDX","dc.rights"]}; + return meta; +}; +var xrfragment_URI = $hx_exports["xrfragment"]["URI"] = function() { + this.XRF = { }; + this.hash = { }; + this.fragment = ""; +}; +xrfragment_URI.__name__ = true; +xrfragment_URI.parseFragment = function(url,filter) { + var store = { }; + if(url == null || url.indexOf("#") == -1) { + return store; + } + var fragment = url.split("#"); + var splitArray = fragment[1].split("&"); + var _g = 0; + var _g1 = splitArray.length; + while(_g < _g1) { + var i = _g++; + var splitByEqual = splitArray[i].split("="); + var regexPlus = new EReg("\\+","g"); + var key = splitByEqual[0]; + var value = ""; + if(splitByEqual.length > 1) { + if(xrfragment_XRF.isVector.match(splitByEqual[1])) { + value = splitByEqual[1]; + } else { + var s = regexPlus.split(splitByEqual[1]).join(" "); + value = decodeURIComponent(s.split("+").join(" ")); + } + } + var ok = xrfragment_Parser.parse(key,value,store,i); + } + if(filter != null && filter != 0) { + var _g = 0; + var _g1 = Reflect.fields(store); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var xrf = store[key]; + if(!xrf.is(filter)) { + Reflect.deleteField(store,key); + } + } + } + return store; +}; +xrfragment_URI.template = function(uri,vars) { + var parts = uri.split("#"); + if(parts.length == 1) { + return uri; + } + var frag = parts[1]; + frag = StringTools.replace(frag,"{","::"); + frag = StringTools.replace(frag,"}","::"); + frag = new haxe_Template(frag).execute(vars); + frag = StringTools.replace(frag,"null",""); + parts[1] = frag; + return parts.join("#"); +}; +xrfragment_URI.parse = function(stringUrl,flags) { + var r = new EReg("^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\\d*))?)(((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[?#]|$)))*/?)?([^?#/]*))(?:\\?([^#]*))?(?:#(.*))?)",""); + if(stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != "/" && stringUrl.charAt(0) != "#") { + stringUrl = "/" + stringUrl; + } + r.match(stringUrl); + var url = new xrfragment_URI(); + var _g = 0; + var _g1 = xrfragment_URI._parts.length; + while(_g < _g1) { + var i = _g++; + url[xrfragment_URI._parts[i]] = r.matched(i); + } + if(xrfragment_URI.isRelative(url) == true) { + if(url.directory == null && url.host != null) { + url.file = url.host; + } + url.host = ""; + } + url.hash = { }; + if(url.fragment != null && url.fragment.length > 0) { + url.XRF = xrfragment_URI.parseFragment("#" + url.fragment,flags); + var key; + var _g = 0; + var _g1 = Reflect.fields(url.XRF); + while(_g < _g1.length) { + var key = _g1[_g]; + ++_g; + var v = url.XRF[key]; + url.hash[key] = v["string"]; + } + } + xrfragment_URI.computeVars(url); + return url; +}; +xrfragment_URI.computeVars = function(url) { + var r_r = new RegExp("//","g".split("u").join("")); + if(url.directory != null && url.directory.indexOf("//") != -1) { + url.directory = url.directory.replace(r_r,"/"); + } + if(url.path != null && url.path.indexOf("//") != -1) { + url.path = url.path.replace(r_r,"/"); + } + if(url.file != null && url.file.indexOf("//") != -1) { + url.file = url.file.replace(r_r,"/"); + } + url.URN = url.scheme + "://" + url.host; + if(url.port != null) { + url.URN += ":" + url.port; + } + url.URN += url.directory; + if(url.file != null) { + var parts = url.file.split("."); + if(parts.length > 1) { + url.fileExt = parts.pop(); + } + } +}; +xrfragment_URI.toString = function(url) { + var result = ""; + if(url.scheme != null) { + result += url.scheme + "://"; + } + if(url.user != null) { + result += url.user + ":"; + } + if(url.password != null) { + result += url.password + "@"; + } + if(url.host != null) { + result += url.host; + } + if(url.port != null) { + result += ":" + url.port; + } + if(url.directory != null) { + result += url.directory; + } + if(url.file != null) { + result += url.file; + } + if(url.query != null) { + result += "?" + url.query; + } + if(url.fragment != null) { + result += "#" + url.fragment; + } + return result; +}; +xrfragment_URI.appendURI = function(url,appendedURI) { + if(xrfragment_URI.isRelative(url) == true) { + return xrfragment_URI.appendToRelativeURI(url,appendedURI); + } else { + return xrfragment_URI.appendToAbsoluteURI(url,appendedURI); + } +}; +xrfragment_URI.isRelative = function(url) { + return url.scheme == null; +}; +xrfragment_URI.appendToRelativeURI = function(url,appendedURI) { + if(url.directory == null || url.host == null) { + return xrfragment_URI.cloneURI(appendedURI); + } + var resultURI = new xrfragment_URI(); + resultURI.host = url.host; + resultURI.directory = url.directory; + if(appendedURI.host != null) { + resultURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + var directory = appendedURI.directory; + if(appendedURI.host == null) { + resultURI.directory += HxOverrides.substr(directory,1,null); + } else { + resultURI.directory += directory; + } + } + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.appendToAbsoluteURI = function(url,appendedURI) { + var resultURI = new xrfragment_URI(); + if(url.scheme != null) { + resultURI.scheme = url.scheme; + } + if(url.host != null) { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(appendedURI.host != null) { + appendedURI.directory += appendedURI.host; + } + if(appendedURI.directory != null) { + directory += appendedURI.directory; + } + resultURI.directory = directory; + if(appendedURI.file != null) { + resultURI.file = appendedURI.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(appendedURI.query != null) { + resultURI.query = appendedURI.query; + } + if(appendedURI.fragment != null) { + resultURI.fragment = appendedURI.fragment; + } + return resultURI; +}; +xrfragment_URI.toAbsolute = function(url,newUrl) { + var newURI = xrfragment_URI.parse(newUrl,0); + var resultURI = new xrfragment_URI(); + resultURI.port = url.port; + resultURI.source = newUrl; + if(newURI.scheme != null) { + resultURI.scheme = newURI.scheme; + } else { + resultURI.scheme = url.scheme; + } + if(newURI.host != null && newURI.host.length > 0) { + resultURI.host = newURI.host; + resultURI.port = null; + resultURI.fragment = null; + resultURI.hash = { }; + resultURI.XRF = { }; + if(newURI.port != null) { + resultURI.port = newURI.port; + } + } else { + resultURI.host = url.host; + } + var directory = ""; + if(url.directory != null) { + directory = url.directory; + } + if(newURI.directory != null && newURI.source.charAt(0) != "#" && newURI.directory.length > 0) { + if(newUrl.charAt(0) != "/" && newUrl.indexOf("://") == -1) { + var stripRelative_r = new RegExp("\\./.*","".split("u").join("")); + directory = directory.replace(stripRelative_r,""); + directory += newURI.directory; + } else { + directory = newURI.directory; + } + } + resultURI.directory = directory; + if(newURI.file != null && newURI.file.length > 0) { + resultURI.file = newURI.file; + } else { + resultURI.file = url.file; + } + resultURI.path = resultURI.directory + resultURI.file; + if(newURI.query != null) { + resultURI.query = newURI.query; + } + if(newURI.fragment != null) { + resultURI.fragment = newURI.fragment; + } + resultURI.hash = newURI.hash; + resultURI.XRF = newURI.XRF; + xrfragment_URI.computeVars(resultURI); + return resultURI; +}; +xrfragment_URI.cloneURI = function(url) { + var clonedURI = new xrfragment_URI(); + clonedURI.url = url.url; + clonedURI.source = url.source; + clonedURI.scheme = url.scheme; + clonedURI.authority = url.authority; + clonedURI.userInfo = url.userInfo; + clonedURI.password = url.password; + clonedURI.host = url.host; + clonedURI.port = url.port; + clonedURI.relative = url.relative; + clonedURI.path = url.path; + clonedURI.directory = url.directory; + clonedURI.file = url.file; + clonedURI.query = url.query; + clonedURI.fragment = url.fragment; + return clonedURI; +}; +var xrfragment_XRF = $hx_exports["xrfragment"]["XRF"] = function(_fragment,_flags,_index) { + this.floats = []; + this.shift = []; + this.fragment = _fragment; + this.flags = _flags; + this.index = _index; +}; +xrfragment_XRF.__name__ = true; +xrfragment_XRF.set = function(flag,flags) { + return flags | flag; +}; +xrfragment_XRF.unset = function(flag,flags) { + return flags & ~flag; +}; +xrfragment_XRF.prototype = { + is: function(flag) { + var v = this.flags; + if(!(typeof(v) == "number" && ((v | 0) === v))) { + this.flags = 0; + } + return (this.flags & flag) != 0; + } + ,validate: function(value) { + this.guessType(this,value); + var ok = true; + if(value.length == 0 && !this.is(xrfragment_XRF.T_PREDEFINED_VIEW)) { + ok = false; + } + if(!this.is(xrfragment_XRF.T_FLOAT) && this.is(xrfragment_XRF.T_VECTOR2) && !(typeof(this.x) == "number" && typeof(this.y) == "number")) { + ok = false; + } + if(!(this.is(xrfragment_XRF.T_VECTOR2) || this.is(xrfragment_XRF.T_STRING)) && this.is(xrfragment_XRF.T_VECTOR3) && !(typeof(this.x) == "number" && typeof(this.y) == "number" && typeof(this.z) == "number")) { + ok = false; + } + return ok; + } + ,guessType: function(v,str) { + v.string = str; + if(xrfragment_XRF.isReset.match(v.fragment)) { + v.reset = true; + } + if(v.fragment == "loop") { + v.loop = true; + } + if(typeof(str) != "string") { + return; + } + if(str.length > 0) { + if(xrfragment_XRF.isXRFScheme.match(str)) { + v.xrfScheme = true; + str = str.replace(xrfragment_XRF.isXRFScheme.r,""); + v.string = str; + } + if(str.split(",").length > 1) { + var xyzn = str.split(","); + if(xyzn.length > 0) { + v.x = parseFloat(xyzn[0]); + } + if(xyzn.length > 1) { + v.y = parseFloat(xyzn[1]); + } + if(xyzn.length > 2) { + v.z = parseFloat(xyzn[2]); + } + var _g = 0; + var _g1 = xyzn.length; + while(_g < _g1) { + var i = _g++; + v.shift.push(xrfragment_XRF.isShift.match(xyzn[i])); + v.floats.push(parseFloat(xyzn[i].replace(xrfragment_XRF.isShift.r,""))); + } + } + if(xrfragment_XRF.isColor.match(str)) { + v.color = str; + } + if(xrfragment_XRF.isFloat.match(str)) { + v.x = parseFloat(str); + v.float = v.x; + } + if(xrfragment_XRF.isInt.match(str)) { + v.int = Std.parseInt(str); + v.x = v.int; + v.floats.push(v.x); + } + v.filter = new xrfragment_Filter(v.fragment + "=" + v.string); + } else { + v.filter = new xrfragment_Filter(v.fragment); + } + } +}; +function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } +function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } +$global.$haxeUID |= 0; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.__name__ = true; +Array.__name__ = true; +js_Boot.__toStr = ({ }).toString; +haxe_Template.splitter = new EReg("(::[A-Za-z0-9_ ()&|!+=/><*.\"-]+::|\\$\\$([A-Za-z0-9_-]+)\\()",""); +haxe_Template.expr_splitter = new EReg("(\\(|\\)|[ \r\n\t]*\"[^\"]*\"[ \r\n\t]*|[!+=/><*.&|-]+)",""); +haxe_Template.expr_trim = new EReg("^[ ]*([^ ]+)[ ]*$",""); +haxe_Template.expr_int = new EReg("^[0-9]+$",""); +haxe_Template.expr_float = new EReg("^([+-]?)(?=\\d|,\\d)\\d*(,\\d*)?([Ee]([+-]?\\d+))?$",""); +haxe_Template.globals = { }; +haxe_Template.hxKeepArrayIterator = new haxe_iterators_ArrayIterator([]); +xrfragment_Parser.error = ""; +xrfragment_Parser.debug = false; +xrfragment_URI.__meta__ = { statics : { template : { keep : null}}}; +xrfragment_URI._parts = ["source","scheme","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"]; +xrfragment_XRF.IMMUTABLE = 1; +xrfragment_XRF.PROP_BIND = 2; +xrfragment_XRF.QUERY_OPERATOR = 4; +xrfragment_XRF.PROMPT = 8; +xrfragment_XRF.CUSTOMFRAG = 16; +xrfragment_XRF.NAVIGATOR = 32; +xrfragment_XRF.METADATA = 64; +xrfragment_XRF.PV_OVERRIDE = 128; +xrfragment_XRF.PV_EXECUTE = 256; +xrfragment_XRF.T_COLOR = 8192; +xrfragment_XRF.T_INT = 16384; +xrfragment_XRF.T_FLOAT = 32768; +xrfragment_XRF.T_VECTOR2 = 65536; +xrfragment_XRF.T_VECTOR3 = 131072; +xrfragment_XRF.T_URL = 262144; +xrfragment_XRF.T_PREDEFINED_VIEW = 524288; +xrfragment_XRF.T_STRING = 1048576; +xrfragment_XRF.T_MEDIAFRAG = 2097152; +xrfragment_XRF.T_DYNAMICKEY = 4194304; +xrfragment_XRF.T_DYNAMICKEYVALUE = 8388608; +xrfragment_XRF.isColor = new EReg("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$",""); +xrfragment_XRF.isInt = new EReg("^[-0-9]+$",""); +xrfragment_XRF.isFloat = new EReg("^[-0-9]+\\.[0-9]+$",""); +xrfragment_XRF.isVector = new EReg("([,]+|\\w)",""); +xrfragment_XRF.isUrl = new EReg("(://)?\\..*",""); +xrfragment_XRF.isUrlOrPretypedView = new EReg("(^#|://)?\\..*",""); +xrfragment_XRF.isString = new EReg(".*",""); +xrfragment_XRF.operators = new EReg("(^[-]|^[!]|[\\*]$)","g"); +xrfragment_XRF.isProp = new EReg("^.*=[><=]?",""); +xrfragment_XRF.isExclude = new EReg("^-",""); +xrfragment_XRF.isDeep = new EReg("\\*",""); +xrfragment_XRF.isNumber = new EReg("^[0-9\\.]+$",""); +xrfragment_XRF.isMediaFrag = new EReg("^([0-9\\.,\\*+-]+)$",""); +xrfragment_XRF.isReset = new EReg("^!",""); +xrfragment_XRF.isShift = new EReg("^(\\+|--)",""); +xrfragment_XRF.isXRFScheme = new EReg("^xrf://",""); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; +export default xrfragment; diff --git a/dist/xrfragment.plugin.editor.js b/dist/xrfragment.plugin.editor.js index 6aa0956..6a9e1d6 100644 --- a/dist/xrfragment.plugin.editor.js +++ b/dist/xrfragment.plugin.editor.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Wed Jan 15 10:52:05 AM CET 2025 + * v0.5.1 generated at Sun Feb 9 12:52:39 PM CET 2025 * https://xrfragment.org * SPDX-License-Identifier: AGPL-3.0-or-later */ diff --git a/dist/xrfragment.plugin.frontend.css.js b/dist/xrfragment.plugin.frontend.css.js index 0bf3b11..1299f5e 100644 --- a/dist/xrfragment.plugin.frontend.css.js +++ b/dist/xrfragment.plugin.frontend.css.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Wed Jan 15 10:52:05 AM CET 2025 + * v0.5.1 generated at Sun Feb 9 12:52:39 PM CET 2025 * https://xrfragment.org * SPDX-License-Identifier: AGPL-3.0-or-later */ diff --git a/dist/xrfragment.plugin.frontend.js b/dist/xrfragment.plugin.frontend.js index e1e550f..70c9649 100644 --- a/dist/xrfragment.plugin.frontend.js +++ b/dist/xrfragment.plugin.frontend.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Wed Jan 15 10:52:05 AM CET 2025 + * v0.5.1 generated at Sun Feb 9 12:52:39 PM CET 2025 * https://xrfragment.org * SPDX-License-Identifier: AGPL-3.0-or-later */ diff --git a/dist/xrfragment.plugin.matrix.js b/dist/xrfragment.plugin.matrix.js index 3527818..5038734 100644 --- a/dist/xrfragment.plugin.matrix.js +++ b/dist/xrfragment.plugin.matrix.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Wed Jan 15 10:52:05 AM CET 2025 + * v0.5.1 generated at Sun Feb 9 12:52:39 PM CET 2025 * https://xrfragment.org * SPDX-License-Identifier: AGPL-3.0-or-later */ diff --git a/dist/xrfragment.plugin.network.js b/dist/xrfragment.plugin.network.js index 0627838..2578b51 100644 --- a/dist/xrfragment.plugin.network.js +++ b/dist/xrfragment.plugin.network.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Wed Jan 15 10:52:05 AM CET 2025 + * v0.5.1 generated at Sun Feb 9 12:52:39 PM CET 2025 * https://xrfragment.org * SPDX-License-Identifier: AGPL-3.0-or-later */ diff --git a/dist/xrfragment.plugin.p2p.js b/dist/xrfragment.plugin.p2p.js index 956016f..a1ec855 100644 --- a/dist/xrfragment.plugin.p2p.js +++ b/dist/xrfragment.plugin.p2p.js @@ -1,5 +1,5 @@ /* - * v0.5.1 generated at Wed Jan 15 10:52:05 AM CET 2025 + * v0.5.1 generated at Sun Feb 9 12:52:39 PM CET 2025 * https://xrfragment.org * SPDX-License-Identifier: AGPL-3.0-or-later */ diff --git a/dist/xrfragment.three.js b/dist/xrfragment.three.js index 96cfbb8..7eb35c6 100644 --- a/dist/xrfragment.three.js +++ b/dist/xrfragment.three.js @@ -1,3 +1,8 @@ +/* + * v0.5.1 generated at Sun Feb 9 12:52:39 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ /* * v0.5.1 generated at Wed Jan 15 10:52:05 AM CET 2025 * https://xrfragment.org diff --git a/dist/xrfragment.three.module.js b/dist/xrfragment.three.module.js index dbd7e2c..0438421 100644 --- a/dist/xrfragment.three.module.js +++ b/dist/xrfragment.three.module.js @@ -1,3 +1,8 @@ +/* + * v0.5.1 generated at Sun Feb 9 12:52:39 PM CET 2025 + * https://xrfragment.org + * SPDX-License-Identifier: AGPL-3.0-or-later + */ /* * v0.5.1 generated at Wed Jan 15 10:52:05 AM CET 2025 * https://xrfragment.org